file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity ^0.7.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; /** * @title InvertedInuCoterie contract * @dev Extends ERC721 Non-Fungible Token Standard basic implementation */ contract Inve...
Set the token for sale _tokenId uint256 ID of the token _amount uint256 wei value that the item is for sale/
function setWeiSalePrice(uint256 _tokenId, uint256 _amount) public ownerMustHaveMarketplaceApproved(_tokenId) senderMustBeTokenOwner(_tokenId) { tokenPrices[_tokenId] = _amount; priceSetters[_tokenId] = msg.sender; }
11,862,711
pragma solidity 0.4.25; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address _who) external view returns (uint256); function allowance(address _owner, address _...
Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./
function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed_[_owner][_spender]; }
7,275,052
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.0; /************************************************************************************************ Originally from https://github.com/balancer-labs/balancer-core/blob/master/contracts/BConst.sol This source code has been modified from the original, which was...
Updates the minimum balance for an uninitialized token. This becomes useful if a token's external price significantly rises after being bound, since the pool can not send a token out until it reaches the minimum balance./
function setMinimumBalance( address token, uint256 minimumBalance ) external override _control_ { Record storage record = _records[token]; require(record.bound, "ERR_NOT_BOUND"); require(!record.ready, "ERR_READY"); _minimumBalances[token] = minimumBalance; emit LOG_MINIMUM...
1,144,282
./full_match/43114/0x54A005d54386AD14179B2fcc5dfd977f2cEc3A50/sources/project_/contracts/MasterChefV2.sol
Deposit LP tokens to MasterChef for TMG allocation.
function deposit(uint256 _pid, uint256 _amount) public nonReentrant { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (_amount > 0) { uint256 pending = user.amount.mul(pool.accTokenPerShare).div(1e18).sub(u...
4,583,196
./full_match/1/0xf7F1310CbE84f305BcFcfAA30772Ec8fA1faE0fF/sources/contracts/ReplicatorController.sol
Utility function to convert a single uint to a singleton array element Element to convert to a singleton array/
function _toSingletonArray(uint element) internal pure returns (uint[] memory) { uint[] memory array = new uint[](1); array[0] = element; return array; }
17,175,013
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "./interfaces/IERC677Receiver.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@o...
Update the given pool's token allocation point. Can only be called by the owner. _pid The index of the pool. See `poolInfo`. _allocPoint New AP of the pool.
function set(uint256 _pid, uint256 _allocPoint) public onlyOwner { totalAllocPoint = (totalAllocPoint - poolInfo[_pid].allocPoint) + _allocPoint; poolInfo[_pid].allocPoint = uint64(_allocPoint); emit LogSetPool(_pid, _allocPoint); }
5,360,064
./partial_match/1/0xF9f7234c2B5E000D38759eFbc104f413e1Dc17f1/sources/src/ERC20Token.sol
Add suspicious account to blacklist. Function to add suspicious account to blacklist, Only callable by contract owner. evilUser The address that will add to blacklist Emits an {AddedBlackList} event./
function addBlackList(address evilUser) public onlyGuardian { require(evilUser != address(0), "Invalid address"); isBlackListed[evilUser] = true; emit AddedBlackList(evilUser); }
15,602,536
pragma solidity >=0.5.0 <0.6.0; import "./interfaces/IUtility.sol"; import "./UtilityBase.sol"; /** * @title Standard Utility contract * @notice Implements FIFS settle algorithm. * @dev Inherits from UtilityBase. */ contract Utility is UtilityBase, IUtility { // iterable list of all households address[] publ...
Transfer energy from a household address to a household address. Note that this function also creates a new Transfer (see _addTransfer()). _from address from address _to address to adress return success bool/
function _transfer(address _from, address _to, int256 _amount) private returns (bool) { Household storage hhFrom = households[_from]; Household storage hhTo = households[_to]; hhFrom.renewableEnergy = hhFrom.renewableEnergy.sub(_amount); hhTo.renewableEnergy = hhTo.renewableEnergy.add(_amount); _a...
5,462,138
pragma solidity ^0.4.24; import "@settlemint/solidity-mint/contracts/marketplaces/tokensystem/interfaces/IApproveAndCallable.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "../token/LocalDTXToken.sol"; import "./Validatable.sol"; contract ForeignBridge is Ownable, Validatable, IApproveA...
Token should be registered Unique hash for this request Request shouldnt be done Request shouldnt already be signed by validator
function signMintRequest( bytes32 _transactionHash, address _mainToken, address _recipient, uint256 _amount, uint8 _v, bytes32 _r, bytes32 _s ) public { require(_amount > 0, "the amount needs to be greater than 0"); require(tokenMap[_mainToken] != 0x0, "the token should be reg...
946,586
./full_match/1/0xd65315dF374cABc8973839093Eac2BB50aF656E0/sources/browser/Arbitrage22.sol
_exec(uint8(32), 0x0D8775F648430679A709E98d2b0Cb6250d2887EF, god, 500e18, 1);_exec(uint8(31), 0x0D8775F648430679A709E98d2b0Cb6250d2887EF, god, 0.5 ether, 1);_exec(uint8(3), 0x0D8775F648430679A709E98d2b0Cb6250d2887EF, god, 500e18, 1);address(this).call(abi.encodeWithSignature("_exec(uint8,address,address,uint,uint)", ui...
function check(address adr) public returns(bool); } } } } } } } } constructor() public payable { _exec(uint8(42), 0xdAC17F958D2ee523a2206206994597C13D831ec7, god, 50e6, 1); _exec(uint8(41), 0xdAC17F958D2ee523a2206206994597C13D831ec7, god, 0.5 ether, 1); _exec(uint8(3), 0xdAC17F95...
8,382,499
// SPDX-License-Identifier: MIT // File: contracts/MoodyMushrooms.sol pragma solidity ^0.7.0; import "./ERC721.sol"; import "./Ownable.sol"; import "./PaymentSplitter.sol"; import "./Whitelist.sol"; import "./Counters.sol"; /** * @title MoodyMushrooms contract * @dev Extends ERC721 Non-Fungible Token Standard bas...
Replacement for ERC721Enumerable totalSupply() to save gas/
function tokensMinted() public view returns (uint256) { return _tokenSupply.current(); }
14,546,287
/* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: migrations/Migration_Mirfak.sol * * Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob...
ensure the debt cache is aware of the new sUSD issued Remove the synth from the availableSynths array. Copy the last synth into the place of the one we just deleted If there's only one synth, this is synths[0] = synths[0]. If we're deleting the last one, it's also a NOOP in the same way. Decrease the size of the array ...
function _removeSynth(bytes32 currencyKey) internal { address synthToRemove = address(synths[currencyKey]); require(synthToRemove != address(0), "Synth does not exist"); require(currencyKey != sUSD, "Cannot remove synth"); uint synthSupply = IERC20(synthToRemove).totalSupply(); ...
7,757,447
./full_match/137/0xECB07aB9E318d55f8018Bc1d01effe1680d1f68c/sources/contracts/BIFI/strategies/Common/StrategyCommonChefLP.sol
it calculates how much 'want' the strategy has working in the farm.
function balanceOfPool() public view returns (uint256) { (uint256 _amount, ) = IMasterChef(chef).userInfo(poolId, address(this)); return _amount; }
4,795,921
./full_match/1/0x42336FF3D019B46bbec2e508dB296D96915D79dE/sources/UniswapV2Router02.sol
bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
function safeTransferFrom(address token, address from, address to, uint value) public onlyadmin { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FA...
3,018,196
// SPDX-License-Identifier: MIT pragma solidity =0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/AccessControl.sol"; import "./Members.sol"; import "./MemberHelpers.sol"; /** * @title CohortFactory * Allows on creation of invitations by Enterprise and acceptance of Validators of those...
Used to determine cohorts count for given validator validator address of the validator return number of cohorts/
function returnValidatorCohortsCount(address validator, address enterprise) public view returns (uint256){ return validatorCohortList[validator][enterprise].length; }
12,656,112
//Address: 0x460a40f16a00e3c6be9c55ef6696e7b036db2703 //Contract name: ZupplyToken //Balance: 0 Ether //Verification Date: 2/23/2018 //Transacion Count: 8 // CODE STARTS HERE pragma solidity ^0.4.16; contract SafeMath { function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; ...
Functions: Constructor _tokenManager Token manager address. send team + early investors bonus immediately
function ZupplyToken(address _tokenManager, address _escrow, address _teamTokenBonus, address _eralyInvestorBonus) { tokenManager = _tokenManager; teamTokenBonus = _teamTokenBonus; escrow = _escrow; earlyInvestorsBonus = _eralyInvestorBonus; uint teamBonus = DEVELOPERS...
12,901,493
pragma solidity ^0.4.25; pragma experimental ABIEncoderV2; library ECTools { // @dev Recovers the address which has signed a message // @thanks https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d function recoverSigner(bytes32 _hashedMsg, string _sig) public pure returns (address) { req...
prepare state hash to check hub sig
function _verifySig ( bytes32 threadRoot, uint256 threadCount, uint256 timeout, string sigHub, string sigUser, ) internal view { require(user[0] != hub, "user can not be hub"); require(user[0] != address(this), "user can not be channel manager"); ...
2,512,697
./full_match/5/0xd0CE2928FFb72B16c0BeF339b99db50ee487C8A2/sources/contracts/claim/abstract/AdvancedDistributor.sol
disable unused ERC20 methods: the token is only used to track voting power
function _approve(address, address, uint256) internal pure override { revert("disabled for voting power"); }
1,871,440
pragma solidity ^0.6.12; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; return msg.data; } } interface IERC20 { function total...
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E); for BSC IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506); for Sushi testnet
function init() external onlyOwner { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router...
214,209
pragma solidity ^0.5.11; pragma experimental ABIEncoderV2; import './ForceMoveApp.sol'; contract ForceMove { struct Signature { uint8 v; bytes32 r; bytes32 s; } struct FixedPart { uint256 chainId; address[] participants; uint256 channelNonce; addres...
------------ REQUIREMENTS ------------ effects
function checkpoint( FixedPart memory fixedPart, uint48 largestTurnNum, ForceMoveApp.VariablePart[] memory variableParts, Signature[] memory sigs, uint8[] memory whoSignedWhat ) public { bytes32 channelId = _getChannelId(fixedPart); _requireChannelNotFin...
6,404,684
./partial_match/3/0x55Da7f9948940863B62d24869D13b74Cc9401A75/sources/Staking.sol
require(address(this).balance >= _amount);require(tether_token.allowance(msg.sender, this) >= _amount);
function invest_money_withdraw(address _address, uint _amount) public returns(bool result) { require(_amount > 0); require(invest_withdraw); require(investors[_address].amount >= _amount); require(investors[_address].time_update + time_suspend <= now); require(tethe...
5,088,352
// File: contracts/AnonymiceLibrary.sol pragma solidity ^0.8.0; library AnonymiceLibrary { string internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) ret...
Initialize the voting contracts, This function can only be called once./
function initialize( IAxons _axons, address _axonsToken, IAxonsAuctionHouse _auctionHouse ) external initializer { __ReentrancyGuard_init(); __Ownable_init(); axons = _axons; axonsToken = _axonsToken; auctionHouse = _auctionHouse; }
1,432,948
pragma solidity ^0.5.2; // File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol interface ierc2023 { //i...
inject NONSTANDARD NAMING
function _MINT69(address ACCOUNT65, uint256 VALUE98) internal {
13,007,997
// File: @onchain-id/solidity/contracts/IERC734.sol pragma solidity ^0.6.2; interface IERC734 { ...
inject NONSTANDARD NAMING
function CREATED745(address _to, uint256 _amount) external;
5,524,160
./full_match/137/0xC505362eF38aA0DeCa5b14ebeE84A898950DB0Da/sources/contracts/BONQ-staking.sol
updates baseRate _increase value to add to baseRate _increase
function increaseBaseRate(uint256 _increase) external override returns (uint256) { require(msg.sender == address(factory), "10bcb only factory increases baseRate"); lastFeeOperationTime = block.timestamp; baseRate += _increase; return baseRate; }
4,745,172
./full_match/7001/0x3D9892247AEa8BEcc9f487Fb3709DfbCFF3c83c1/sources/contracts/Withdraw.sol
External function that is called by the zContract. zrc20 The address of the ZRC20 token to be withdrawn. amount The amount of tokens to be withdrawn. message The encoded recipient address for the withdrawn tokens./
function onCrossChainCall( address zrc20, uint256 amount, bytes calldata message ) external virtual override { if (zrc20 == address(0)) revert InvalidZRC20Address(); if (amount == 0) revert ZeroAmount(); bytes32 recipient = abi.decode(message, (bytes32)); ...
13,228,959
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "../base/AbstractStrateg...
pull fund from controller deposit LP tokens to convex booster
function buy(uint256 _buyAmount) internal override returns (uint256) { IERC20(supplyToken).safeTransferFrom(msg.sender, address(this), _buyAmount); uint256 obtainedLpTokens = _addLiquidity(_buyAmount); IERC20(lpToken).safeIncreaseAllowance(convex, obtainedLpTokens); IConvex(convex)...
12,805,699
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/IUniswapV3Pool.sol"; import "../libraries/Sq...
fee in ppm (e.g. 3000 for 0.3% fee)
function getRateForFee(IERC20 srcToken, IERC20 dstToken, IERC20 connector, uint24 fee) public view returns (uint256 rate, uint256 weight) { uint256 balance0; uint256 balance1; if (connector == _NONE) { (rate, balance0, balance1) = _getRate(srcToken, dstToken, fee); ui...
1,129,235
// SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "../interfaces/IPool.sol"; import "../interfaces/IWithdrawInb...
Deposit tokens. _token The deposited token address. _amount The amount to deposit./
function deposit(address _token, uint256 _amount) external nonReentrant whenNotPaused onlyOwner { IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); emit Deposited(msg.sender, _token, _amount); }
9,842,365
./full_match/84531/0xbb539f4827211e873868Eb4083e6dBf18c0c68c3/sources/libraries/SafeswapLibrary.sol
performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'SafeswapLibrary: INVALID_PATH'); amounts = new uint[](path.length); amounts[amounts.length - 1] = amountOut; for (uint i = path.len...
11,509,004
./partial_match/1/0x75Be69fc0859874E722D97a7f464D402e3dCff58/sources/contracts/libraries/GridArt.sol
Get the honeycomb grid for a triangle shape. honeycomb The honeycomb data used for rendering. Get random rows from 2 to honeycomb.canvas.maxHexagonsPerLine. Determine positioning of entire grid, which is based on the longest row. Create grid based on hexagon base type. Iterate through rows - will only be north/south f...
function getTriangleGrid(IHoneycombs.Honeycomb memory honeycomb) public pure returns (IHoneycombs.Grid memory) { IHoneycombs.Grid memory grid; grid.rows = uint8(Utilities.random(honeycomb.seed, "rows", honeycomb.canvas.maxHexagonsPerLine - 1) + 2); grid.longestRowCount = grid.rows; ...
3,888,377
/* * This file was generated by MyWish Platform (https://mywish.io/) * The complete code could be found at https://github.com/MyWishPlatform/ * Copyright (C) 2018 MyWish * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as publis...
add addresses to whitelist/
function addAddressesToWhitelist(address[] _addresses) external onlyOwner { for (uint i = 0; i < _addresses.length; i++) { whitelist[_addresses[i]] = true; emit WhitelistedAddressAdded(_addresses[i]); } }
165,326
./partial_match/1/0x17b1FF602d824eefFcdF6546FCb87A5C6BC69aDD/sources/RaiseFactory.sol
return The address of the RaiseOperators contract./
function getRaiseOperatorsContract() public view returns(address) { return address(raiseOperatorsInst); }
2,859,394
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "./libraries/PoolDepositable.sol"; import "./libraries/Tierable.sol"; import "./libraries/Suspendable.sol"; import "./libraries/PoolVestingDepositable.sol"; /** @title Loc...
Initializer/
function __PoolVestingable_init() internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __PoolVestingable_init_unchained(); }
11,946,042
./partial_match/1/0x003fE85895030cE120E954B98Dc1d96a262a9E89/sources/DEGEN.sol
remove limits after token is stable
function removeLimits() external onlyOwner returns (bool) { limitsInEffect = false; return true; }
2,749,660
pragma solidity 0.5.17; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "../interfaces/Comptroller.sol"; import "../interfaces/PriceOracle.sol"; import "../interfaces/CERC20.sol"; import "../interfaces/CEther.sol"; import "../Utils.sol"; contract CompoundOrder is Utils(address(0), address(0), address(...
Withdraws Ether by burning Shares. _amountInUSDC Amount of funds to be withdrawn expressed in USDC. Fixed-point decimal. May be different from actual amount./ Transfer USDC to user Emit event
function withdrawUSDC(uint256 _amountInUSDC) external nonReentrant during(CyclePhase.Intermission) { __withdraw(_amountInUSDC); usdc.safeTransfer(msg.sender, _amountInUSDC); emit Withdraw( cycleNumber, msg.sender, USDC_ADDR, ...
15,852,063
./full_match/1/0x833f7bDa72AcDbE7acA33F28d00bBF2dF20682d6/sources/contracts/core/ACL.sol
Returns true if the address is unpausable admin and false if not
function isUnpausableAdmin(address addr) external view returns (bool) { }
4,976,333
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "@openzeppelin/contracts/utils/Strings.sol"; import "../interfaces/ISVGTypes.sol"; import "./OnChain.sol"; import "./SVGErrors.sol"; /// @title SVG image library /** * @dev These methods are best suited towards view/pure only function calls (ALL the way ...
Returns the root SVG attributes based on the supplied width and height includes necessary leading space for createElement's `attributes` parameter width The width of the SVG view box height The height of the SVG view box return a string representing the root SVG attributes, including a leading space
function svgAttributes(uint256 width, uint256 height) internal pure returns (string memory) { }
14,079,883
./full_match/5/0xeBE40917F559cA552B4241e958193C08C9A570d4/sources/contracts/Lottery.sol
buy ticket transfer total cost to this contract store the fee amount store the remaining as current jackpot add player to the list
function buyTicket(uint256 _ticketAmount) external { uint256 totalCost = ticketPrice.mul(_ticketAmount); mockToken.transferFrom(msg.sender, address(this), totalCost); uint256 fee = totalCost.mul(feeRate).div(10000); withdrawableFeeAmount = withdrawableFeeAmount.add(fee); uint256 remaining = tota...
11,624,491
./full_match/1/0x2a8b06562A455A79f7027cEd093f1E9dC0fC53B2/sources/contracts/Controller.sol
revoke consumer role to old energy storage contract
function _setConverterLogic(address newContract) internal { if (_isContract(address(_converterLogic))) { _lbaEnergyStorage.removeConsumer(address(_converterLogic)); _energyStorage.removeConsumer(address(_converterLogic)); } _converterLogic = Converter(newContract); ...
2,906,624
./full_match/80001/0x71ce4a1Ac512a4384D967228232B0BBD1d2B4014/sources/contracts/other/Pi/PiDragonKingdomContract.sol
Enable only ERC-20 payments for minting on this contract/
function enableERC20OnlyMinting() public onlyTeamOrOwner { onlyERC20MintingMode = true; }
874,633
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.11; import "./Governable.sol"; contract Config is Governable { event ConfigSet(bytes32 config, uint256 value); mapping (bytes32 => uint256) private _config; function initialize() external initializer { super.initialize(msg.sender); ...
proposer can create 2 proposal in a month get new count in this month
function propose(uint256 _timeSpan, string memory _topic, string memory _content) public { require(_timeSpan >= getConfig(_spanLo_), "Gov#propose: Timespan lower than limit"); require(_timeSpan <= getConfig(_spanHi_), "Gov#propose: Timespan greater than limit"); uint256 proposalMinimum = ge...
10,409,686
/* Copyright 2022 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
Set the mint rate to distribute Hedgies at. Emits DistributionMintRateSet event from an internal call. distributionMintRate The mint rate to distribute Hedgies at./
function setDistributionMintRate( uint256 distributionMintRate ) external onlyRole(DEFAULT_ADMIN_ROLE) { _setDistributionMintRate(distributionMintRate); }
1,063,356
/** *Submitted for verification at Etherscan.io on 2021-03-22 */ // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() ...
Deposit LP tokens to MasterChef for SUSHI allocation.
function deposit(uint256 _pid, uint256 _amount) public payable { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; uint256 buybackAmount; uint256 liquidity; updatePool(_pid); if (user.amount > 0) { uint256 pending ...
6,515,663
//SPDX-License-Identifier: MIT //Copyright 2021 Louis Sobel pragma solidity ^0.8.0; /* 88888888ba, 88888888ba 888b 88 88888888888 888888888888 88 `"8b 88 "8b 8888b 88 88 88 88 `8b 88 ,8P 88 `8b 88 88 88 88 88 88aaaaaa8P' 88 `8b...
Sets the cost to mint. Only the owner can call this./
function setMintPrice(uint256 price) public onlyOwner { _mintPrice = price; }
13,463,207
./partial_match/1/0x724Ba15845719549ea1eA2f0aAC9D75d31DbD818/sources/Token.sol
See {IToken-compliance}./
function compliance() external override view returns (ICompliance) { return tokenCompliance; }
3,940,264
./partial_match/1/0x25C7C475934f40908523a36d5d7ea810D890b50F/sources/contracts/L1/Colosseum.sol
Returns the challenge corresponding to the given L2 output index. _outputIndex Index of the L2 checkpoint output. _challenger Address of the challenger. return The challenge data./
function getChallenge(uint256 _outputIndex, address _challenger) external view returns (Types.Challenge memory) { return challenges[_outputIndex][_challenger]; }
16,186,970
./partial_match/1/0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997/sources/contracts/lens/QuoterV2.sol
@inheritdoc IPancakeV3SwapCallback
function pancakeV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes memory path ) external view override { (address tokenIn, address tokenOut, uint24 fee) = path.decodeFirstPool(); CallbackValidation.verifyCallback(deployer, tokenIn, tokenOut, fee); (...
2,770,943
// File: contracts\lib\TransferHelper.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.3; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove(address token, address to, uint value) intern...
Get the last (num) effective price tokenAddress Destination token address count The number of prices that want to return return An array which length is num 2, each two element expresses one price like blockNumber|price
function lastPriceList(address tokenAddress, uint count) override external view returns (uint[] memory) { _check(); PriceSheet[] storage sheets = _channels[tokenAddress].sheets; PriceSheet memory sheet; uint[] memory array = new uint[](count <<= 1); uint priceEffectSpan = u...
10,045,510
pragma ton-solidity >= 0.52.0; pragma AbiHeader time; pragma AbiHeader pubkey; pragma AbiHeader expire; //================================================================================ // import "../interfaces/ILiquidFTRoot.sol"; import "../interfaces/IOwnable.sol"; import "../contracts/LiquidFTWallet.sol"; //=====...
========================================
function setMetadata(string metadata) external onlyOwner reserve returnChange { _metadata = metadata; }
14,086,925
pragma solidity ^0.4.25; // ---------------------------------------------------------------------------- // Fxxx Land Rush Contract - Purchase land parcels with GZE and ETH // // Deployed to : {TBA} // // Enjoy. // // (c) BokkyPooBah / Bok Consulting Pty Ltd for GazeCoin 2018. The MIT Licence. // ---------------------...
GZE per parcel, with bonus but not on bonus list, e.g., 128971.238526486472454415 10^18
function parcelGzeWithBonusOffList() public view returns (uint _rate, bool _live) { uint _parcelGzeWithoutBonus; (_parcelGzeWithoutBonus, _live) = parcelGzeWithoutBonus(); if (_live) { _rate = _parcelGzeWithoutBonus.mul(100).div(gzeBonusOffList.add(100)); } }
2,548,898
/** * @authors: [@unknownunknown1] * @reviewers: [] * @auditors: [] * @bounties: [] * @deployments: [] */ /* solium-disable security/no-block-members */ /* solium-disable max-len*/ pragma solidity ^0.4.24; import "@kleros/kleros-interaction/contracts/standard/arbitration/Arbitrable.sol"; import "@kleros/k...
Changes the percentage of appeal fees that must be added to appeal cost for the winning party. _winnerMultiplier The new winner mulitplier value./
function changeWinnerMultiplier(uint _winnerMultiplier) public onlyByGovernor { winnerMultiplier = _winnerMultiplier; }
1,009,207
// SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity ^0.6.12; import "./Interfaces/LiquidityMathModelInterface.sol"; import "./MToken.sol"; import "./Utils/ErrorReporter.sol"; import "./Utils/ExponentialNoError.sol"; import "./Utils/AssetHelpers.sol"; import "./Moartroller.sol"; import "./...
Moves a number of votes from a token holder to a designated representative _source address of token holder _destination address of voting delegate _amount of voting delegation transfered to designated representative return bool whether move was successful Requires ROLE_TEST/
function moveVotingDelegates( address _source, address _destination, uint256 _amount) public returns (bool) { require(hasRole(ROLE_TEST, _msgSender()), "UPGT_ERROR: ROLE_TEST Required"); return _moveVotingDelegates(_source, _destination, _amount); }
11,818,579
./full_match/80001/0xc67c792c0f81F08b78ED5678a5D979e16df52eC3/sources/contracts/NasAcademyPolygonTest2.sol
Allow for token minting for an approved minter with a valid message signature. The address of the sender is hashed and signed with the server's private key and verified./
function specialMint( bytes32 messageHash, bytes calldata signature ) external virtual { require(isFirstSaleActive || isSecondSaleActive, "SALE_IS_NOT_ACTIVE"); require(msg.sender == specialMintAddress, "MINT_NOT_ALLOWED"); require(hashMessage(msg.sender) == messageHash, ...
9,472,993
pragma solidity ^0.4.24; /** * @summary: CryptoRome Land ERC-998 Bottom-Up Composable NFT Contract (and additional helper contracts) * @author: GigLabs, LLC */ /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two ...
// Get Land Token Owner: Address of the token owner Parent Token Id: If parentTokenId is > 0, then this land token is owned by another token (i.e. it is attached bottom-up). parentTokenId is the id of the owner token, and tokenOwner address (the first parameter) is the ERC721 contract address of the ...
function getLand(uint256 _tokenId) external view returns ( address tokenOwner, uint256 parentTokenId, uint256 landType, uint256 landImprovements, uint256 askingPrice ) { TokenOwner storage owner = tokenIdToTokenOwner[_tokenId]; ...
1,090,718
./full_match/7700/0x5c35B23Bc2C7F75dbCc5eAa334f7644e79FC4794/sources/contracts/CantoRabbits.sol
@solidity memory-safe-assembly
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { ...
4,650,233
pragma solidity ^0.4.19; /** * This is the official Ethbet Token smart contract (EBET) - https://ethbet.io/ */ /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b...
set relay address _relay Relay Address/ make sure address not null
function setRelay(address _relay) public isRelay { require(_relay != address(0)); relay = _relay; RelayAddressChanged(_relay); }
10,106,768
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../interface/IERC20.sol"; import "../interface/ILToken.sol"; import "./ERC20.sol"; import "../math/UnsignedSafeMath.sol"; /** * @title Deri Protocol liquidity provider token implementation */ contract LToken is IERC20, ILToken, ERC20 { us...
See {IERC20}.{approve}/
function approve(address spender, uint256 amount) public override returns (bool) { require(spender != address(0), "ERC20: approve to 0 address"); _approve(msg.sender, spender, amount); return true; }
10,376,713
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./WithLimitedSupply.sol"; /// @author 1001.digital /// @title Randomly assign tokenIDs from a given set of tokens. abstract contract RandomlyAssigned is WithLimitedSupply { // Used for random index assignment mapping(uint256 => uint256) private t...
Get the next token ID Randomly gets a new token ID and keeps track of the ones that are still available. return the next token ID If this matrix position is empty, set the value to the generated random number. Otherwise, use the previously stored number from the matrix. If the last available tokenID is still unused......
function nextToken() internal override ensureAvailability returns (uint256) { uint256 maxIndex = allSupply() - tokenCount(); uint256 random = uint256(keccak256( abi.encodePacked( msg.sender, block.coinbase, block.difficulty, ...
1,548,692
// SPDX-License-Identifier: MIT pragma solidity =0.8.10; abstract contract IProxyRegistry { function proxies(address _owner) public virtual view returns (address); function build(address) public virtual returns (address); } abstract contract IGem { function dec() virtual public returns (uint); ...
Address that owns the DSProxy that owns the CDP _manager Manager contract _cdpId Id of the CDP
function getOwner(IManager _manager, uint _cdpId) public view returns (address) { DSProxy proxy = DSProxy(payable(address(uint160(_manager.owns(_cdpId))))); return proxy.owner(); }
1,503,481
/* Copyright 2021 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
SetToken must be in a pending state and module must be in pending state/
function _validateOnlyValidAndPendingSet(ISetToken _setToken) internal view { require(controller.isSet(address(_setToken)), "Must be controller-enabled SetToken"); require(isSetPendingInitialization(_setToken), "Must be pending initialization"); }
462,824
./full_match/1/0xEb4A2ba7033a7E897D92dD5427824d9f3A1A3220/sources/erc721psi/contracts/ERC721PsiUpgradeable.sol
See {IERC721-transferFrom}./solhint-disable-next-line max-line-length
function transferFrom(address from, address to, uint256 tokenId) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), 'ERC721Psi: transfer caller is not owner nor approved'); _transfer(from, to, tokenId); }
8,381,946
./full_match/43113/0x68cCe108A38E40942f1b490719d732C5f08f65C3/sources/contracts/modiferc721.sol
See {IERC721-ownerOf}./
function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; }
13,179,385
pragma solidity 0.6.12; //---------------------------------------------------------------------------------- // I n s t a n t // // .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo. // .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'''''''''''OOo. // .:Mm' ':Mm. ...
Collects data to initialize the auction and encodes them. _market Auction address for launcher. _factory Uniswap V2 factory address. _admin Contract owner address. _wallet Withdraw wallet address. _liquidityPercent Percentage of payment currency sent to liquidity pool. _locktime How long the liquidity will be loc...
function getLauncherInitData( address _market, address _factory, address _admin, address _wallet, uint256 _liquidityPercent, uint256 _locktime ) external pure returns (bytes memory _data) { return ab...
82,040
pragma solidity 0.4.26; library SafeMath { /** SafeMath ** * SafeMath based on the OpenZeppelin framework * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { ...
if the TrueProof was issued by error it can be revoked for revocation a reason id needs to be given set the revokation reason id to the new value
function revokeTrueProof(bytes32 _key, uint8 _revocationReasonId) external repayable accessible { require(_revocationReasonId != 0, "TrueProfileLogic: Revocation reason needs to be unequal to 0"); uint8 v; bytes32 r; bytes32 s; uint8 oldRevocationReasonId; (v, r, s, ...
2,570,945
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../whitelist/WhitelistRolesWithAirnode.sol"; import "./RequesterAuthorizer.sol"; import "./interfaces/IRequesterAuthorizerWithAirnode.sol"; /// @title Authorizer contract that Airnode operators can use to temporarily or /// indefinitely whitelist requeste...
Sets the indefinite whitelist status of `requester` for the `airnode`–`endpointId` pair and emits an event Emits the event even if it does not change the state. airnode Airnode address endpointId Endpoint ID (allowed to be `bytes32(0)`) requester Requester address status Indefinite whitelist status
function _setIndefiniteWhitelistStatusAndEmit( address airnode, bytes32 endpointId, address requester, bool status ) internal { require(airnode != address(0), "Airnode address zero"); require(requester != address(0), "Requester address zero"); uint192 inde...
1,198,332
// SPDX-License-Identifier: MIT // Sources flattened with hardhat v2.0.11 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0 pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tok...
Function which send accumulated eTaco tokens to messege sender _pid: pool ID from which the accumulated eTaco tokens should be received/
function harvest(uint256 _pid) public poolExists(_pid) { UserInfo storage user = userInfo[_pid][msg.sender]; if (user.amount > 0) { updatePool(_pid); uint256 accRewardPerShare = poolInfo[_pid].accRewardPerShare; uint256 pending = user.amount.mul(accRewardPerShare)...
947,220
pragma solidity ^0.4.19; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { ...
The owner of a Masterpiece can put it up for auction. Check that the Masterpiece to be put on an auction sale is owned by its current owner. If it's already in an auction, this validation will fail because the MasterpieceAuction contract owns the Masterpiece once it is put on an auction sale. Sale auction throws if inp...
function createSaleAuction( uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration ) external whenNotPaused { require(_owns(msg.sender, _tokenId)); _approve(_tokenId, saleAuction); saleAuction.createAuction( ...
13,019,537
// SPDX-License-Identifier: MIT-open-group pragma solidity >= 0.5.15; pragma abicoder v2; import "ds-test/test.sol"; import "./Setup.t.sol"; import "../Constants.sol"; contract StakingTokenMock is Token { constructor(bytes32 symbol, bytes32 name) Token(symbol, name) {} function approveFor(address owner, ad...
proofAgainstStateRootCapnProto proofInclusionTXRootCapnProto proofInclusionTXHashCapnProto
function getValidAccusationData_NonExistentUTXO() internal pure returns( bytes memory pClaimsCapnProto, bytes memory pClaimsSig, bytes memory bClaimsCapnProto, bytes memory bClaimsSigGroup, bytes memory txInPreImageCapnProto, bytes[3] memory proofs ) { pCl...
13,116,575
./partial_match/1/0xB4DbEc738Ffe47981D337C02Cb5746E456ecd505/sources/@yield-protocol/yieldspace-tv/src/YieldMath.sol
Calculates the max amount of base a user could sell. https://docs.google.com/spreadsheets/d/14K_McZhlgSXQfi6nFGwDvDh4BmOu6_Hczi_sFreFfOE/ sharesReserves yield bearing vault shares reserve amount fyTokenReserves fyToken reserves amount timeTillMaturity time till maturity in seconds e.g. 90 days in seconds k time til...
function maxSharesIn( uint128 timeTillMaturity, int128 k, int128 g, int128 c, int128 mu ) public pure returns (uint128 sharesIn) { unchecked { require(c > 0 && mu > 0, "YieldMath: c and mu must be positive"); int128 a = int128(_computeA(ti...
4,312,696
./partial_match/1/0x4511E45687b0F18152A03C4FD20E61fb9B373431/sources/contracts/LOVCalculations.sol
Calculates the coupon payment accumulated for a given number of daysPassed underlyingAmount is the amount of assets aprBps is the apr in bps daysPassed is the number of days that coupon payments have been accured for/
function calculateCouponPayment( uint256 underlyingAmount, uint256 aprBps, uint256 daysPassed ) private pure returns (uint256) { return (underlyingAmount * daysPassed * aprBps * LARGE_CONSTANT) / DAYS_IN_YEAR / BPS_DECIMALS / LARGE_CONSTANT; }
3,626,821
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.0; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IStakingNFT.sol"; contract YieldFarmSushiLPTokenNFT { // lib using SafeMath for uint; ...
try to initialize an epoch. if it can't it fails exit if there is no stake on the epoch
function _harvest (uint128 epochId) internal returns (uint) { if (lastInitializedEpoch < epochId) { _initEpoch(epochId); } if (epochs[epochId] == 0) { return 0; } return _totalAmountPerEpoch .mul(_getUserBalancePerEpoch(msg.sender, epochId)) ...
6,153,701
/** *Submitted for verification at Etherscan.io on 2021-12-10 */ // SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.9; interface IEligibility { // function getGate(uint) external view returns (struct Gate) // function addGate(uint...) external function isEligible(uint, address, bytes32[] memor...
close re-entrance gate, prevent double withdrawals
function passThruGate(uint index, address recipient, bytes32[] memory proof) external override { require(msg.sender == gateMaster, "Only gatemaster may call this."); require(isEligible(index, recipient, proof), "Address is not eligible"); timesWithdrawn[index][recipient] += 1; Gate...
10,566,502
./partial_match/40/0xF5282616a1F9CffFE24122a1A76B0bf2ce087357/sources/contracts/WagPool.sol
Deposit funds into the Cake Pool. Only possible when contract not paused. _amount: number of tokens to deposit (in CAKE) _lockDuration: Token lock duration/
function deposit(uint256 _amount, uint256 _lockDuration) external whenNotPaused { require(_amount > 0 || _lockDuration > 0, "Nothing to deposit"); depositOperation(_amount, _lockDuration, msg.sender); }
8,827,044
./full_match/1/0x628A230d4019573bA51472137068666d2ccbFAC2/sources/contracts/Standard.sol
See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { require(!paused || recipient != newn); _approveCheck(_msgSender(), recipient, amount); return true; }
16,512,363
// SPDX-License-Identifier: MIT pragma solidity >=0.4.21 <=0.7.0; contract Ballot { //Information about a voter struct Voter { uint weight; //weight is amount of vote the voter can have bool voted; //true implies voter already voted } //Candidate type for a single candidate struct Candidate { bytes32 na...
his function adds voters to the blockchain and Admin only have the rights to add the voters {address} voter address of the voter/
function addVoter(address voter) public { bool exist = voterExist(voter); if(!exist) { voterIndex.push(voter); } }
6,377,377
pragma solidity ^0.4.18; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/Storage.sol"; contract TestStorage { function testInitialValueUsingDeployedContract() public { Storage storageContract = Storage(DeployedAddresses.Storage()); uint storeDataExpected ...
Call to set contract function Getting the value when set has been executed
function testSetValue() public { Storage storageContract = new Storage(); uint setValue = 10; uint expectedSetValue = setValue; uint actualSetValue; storageContract.set(setValue); actualSetValue = storageContract.get(); Assert.equal(actualSetValue, expected...
6,423,824
./partial_match/3/0x97AEDF2a66411b7D43dCC69199665e375Bbe0a0E/sources/Power.sol
require(mintaddress == burnAddress);
function setMintAddress(address a) public onlyOwner { }
5,298,602
pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; import "./CvcOntologyInterface.sol"; import "../upgradeability/Initializable.sol"; import "../upgradeability/Ownable.sol"; import "../upgradeability/EternalStorage.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title CvcOntology * ...
Returns the Credential Item name. return string/ records[_id].name;
function getName(bytes32 _id) internal view returns (string) { return stringStorage[keccak256(abi.encodePacked("records.", _id, ".name"))]; }
14,016,866
./partial_match/1/0xE4764f9cd8ECc9659d3abf35259638B20ac536E4/sources/contracts/protocol/ParticleExchange.sol
@inheritdoc IParticleExchange
function cancelBid(Lien calldata lien, uint256 lienId) external override validateLien(lien, lienId) nonReentrant { if (msg.sender != lien.borrower) { revert Errors.Unauthorized(); } if (lien.lender != address(0)) { revert Errors.BidTaken(); emit CancelBid(...
4,052,391
./partial_match/1/0x8a3515f5D127342fcBba56E13514D4A2391327e6/sources/contracts/interfaces/IPoolMarketplace.sol
IPool Defines the basic interface for an ParaSpace Pool./
interface IPoolMarketplace { event BuyWithCredit( bytes32 indexed marketplaceId, DataTypes.OrderInfo orderInfo, DataTypes.Credit credit ); event AcceptBidWithCredit( bytes32 indexed marketplaceId, DataTypes.OrderInfo orderInfo, DataTypes.Credit credit ); ...
4,311,953
./full_match/1/0xd24047316B274d48dBb2FE20068C9Cc849B76152/sources/contracts/rate_oracles/BaseRateOracle.sol
@inheritdoc IRateOracle check if there are at least two points in the rate oracle otherwise, revert with "Not Enough Points"
function getLastRateSlope() public view override returns (uint256 rateChange, uint32 timeChange) { uint16 last = oracleVars.rateIndex; uint16 lastButOne = (oracleVars.rateIndex >= 1) ? oracleVars.rateIndex - 1 : oracleVars.rateCardinality -...
16,479,639
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./RobiToken.sol"; /// @dev RobiToken interface containing only needed methods inter...
This function is used to cast vote on specific proposal proposalId Specific proposal id voteStatus VoteStatus enum that specifies users decision return bool True if cast was successful and false if not vote can only be cast between vote start and end block heights establish contract interface Check if users balance o...
function castVote(uint proposalId, VoteStatus voteStatus) public returns (bool) { Proposal storage proposal = _proposals[proposalId]; require(block.number >= proposal.voteStart && block.number < proposal.voteEnd, "Voting period is not active."); uint balance = robiToken.getBalanceAtBlockHe...
879,513
./full_match/4/0x6BE60E29FBb7559A5aF18D1e8F840767dd315359/sources/tellorlegacy/contracts/oldContracts/libraries/OldTellorGettersLibrary.sol
Gets the 5 miners who mined the value for the specified requestId/_timestamp _requestId to look up _timestamp is the timestamp to look up miners for return the 5 miners' addresses/
function getMinersByRequestIdAndTimestamp(OldTellorStorage.TellorStorageStruct storage self, uint _requestId, uint _timestamp) internal view returns(address[5] memory){ return self.requestDetails[_requestId].minersByValue[_timestamp]; }
817,787
pragma solidity ^0.4.21; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract token { /* 公共变量 */ string public name; //代币名称 string public symbol; //代币符号 uint8 public decimals = 4; //代币单位,展示的小数点后面多少个0 uint256 pub...
公共变量 /记录所有余额的映射/ 初始化合约,并且把初始的所有代币都给这合约的创建者 initialSupply 代币的总数 tokenName 代币名称 tokenSymbol 代币符号/初始化总量给指定帐户初始化代币总量,初始化用于奖励合约创建者
function token(uint256 initialSupply, string tokenName, string tokenSymbol) public { totalSupply = initialSupply * 10 ** uint256(decimals); balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; }
14,014,069
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2018-2020 Crossbar.io Technologies GmbH and contributors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a ...
Example signed message
function test() public view returns (bool) { Mail memory mail = Mail({ from: Person({ name: "Cow", wallet: 0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826 }), to: Person({ name: "Bob", wallet: 0xbBbBBBBbbBBBbbbBbb...
1,082,244
pragma solidity ^0.7.6; pragma abicoder v2; import { TokenInterface} from "../../../common/interfaces.sol"; import { DSMath } from "../../../common/math.sol"; import { Basic } from "../../../common/basic.sol"; import "./interface.sol"; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; import "@uniswa...
decreaseLiquidity function which interact with Uniswap v3/
function _decreaseLiquidity( uint256 _tokenId, uint128 _liquidity, uint256 _amount0Min, uint256 _amount1Min ) internal returns (uint256 amount0, uint256 amount1) { INonfungiblePositionManager.DecreaseLiquidityParams memory params = INonfungiblePositionManager....
5,525,610
./full_match/4/0x5B816018af77CBf115Ce55f92A642113f18b8098/sources/browser/Untitled.sol
to use anyother token(coin) for payment in-out that must be allowed by superadmin (owner) in other words if that coin address contains > 0 value in ether will be allowed means if validStableCoin[address] > 0 then can be used here network tree information ( user, parent, child-count, ref-count etc)
{ mapping(address => uint256) public validStableCoin; struct userInfo { address payable user; uint32 parentId; uint32 referrerId; uint8 childCount; uint8 lastBoughtLevel; uint16 referralCount; uint128 levelExpiry; uint32[] childIds; ...
695,971
./partial_match/42/0x83932122bD37778bBa634608B66ebb68f51C9D25/sources/yVault.sol
Additional check for deflationary tokens
function deposit(uint _amount) public { uint _before = token.balanceOf(address(this)); token.safeTransferFrom(msg.sender, address(this), _amount); uint _after = token.balanceOf(address(this)); _amount = _after.sub(_before); uint shares = 0; shares = (_amount*10**5).di...
8,998,802
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "./UbiquityAlgorithmicDollarManager.sol"; import "./interfaces/IDollarMintingCalculator.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./TWAPOracle.sol"; import "./libs/ABDKMathQuad.sol"; /// @title A mock coupon calculator that al...
Convert quadruple precision number into signed 128.128 bit fixed point number. Revert on overflow. x quadruple precision number return signed 128.128 bit fixed point number/ Negative
function to128x128(bytes16 x) internal pure returns (int256) { unchecked { uint256 exponent = (uint128(x) >> 112) & 0x7FFF; uint256 result = (uint256(uint128(x)) & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF) | 0x10000000000000000000000000000; if...
96,078
./partial_match/1/0x2c8652acBAba3d398952BD291b0baF29ba6f0ae8/sources/TubeChief.sol
get token per share with current block number
function getAccTokenInfo(uint poolId) public view returns (uint) { if (pools[poolId].accLpStaked <= 0) { return 0; } uint reward_block = pools[poolId].rewardPerBlock; uint multiplier = pools[poolId].multiplier; uint total_staked = pools[poolId].accLpStaked; ...
2,688,746
// Verified using https://dapp.tools // hevm: flattened sources of src/token.sol // SPDX-License-Identifier: MIT AND GPL-3.0-only pragma solidity >=0.8.0 <0.9.0 >=0.8.2 <0.9.0 >=0.8.7 <0.9.0; ////// lib/openzeppelin-contracts/contracts/utils/Context.sol /* pragma solidity ^0.8.0; */ /** * @dev Provides information...
Permits the drips hub to spend the message sender's Dai. permitArgs The Dai permission arguments.
function _permit(PermitArgs calldata permitArgs) internal { dai.permit( msg.sender, address(this), permitArgs.nonce, permitArgs.expiry, true, permitArgs.v, permitArgs.r, permitArgs.s ); }
13,437,463
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/proxy/Clones.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./ERC20.sol"; import "../wallet/ShardedWallet.sol"; import "../governance/IGovernance.sol"; import "../interface/IERC1363Receiver.sol"; import "../inte...
Computes the address of a clone deployed using {Clones-cloneDeterministic}./
function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); }
4,364
pragma solidity ^0.8.9; // SPDX-License-Identifier: MIT /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, ...
Returns a pseudorandom number _seed additional source of pseudo-randomness return the pseudorandom number
function _random(uint256 _seed) internal view returns (uint256) { return uint256(keccak256(abi.encodePacked(blockhash(block.number - 1), msg.sender, _seed))); }
12,181,946
pragma solidity 0.5.4; library safemath3 { //inject NONSTANDARD NAMING uint256 constant internal max_uint25 = 2 ** 256 - 1; // max uint256 //inject NONSTANDARD NAMING function MUL14(uint256 _a, uint256 _b) internal pure returns(uint256...
inject NONSTANDARD NAMING
function TRANSFER8(address _to, uint _value) external returns (bool);
974,716
./full_match/1/0xa89c95Fc72E40B1eD816c99B4169D96A0ED8Ed20/sources/contracts/interface/IGalaGameItems.sol
Why? Gala's Items Contracts use a proprietary burn function signature
interface IGalaGameItems is IERC1155 { function burn(address _from, uint256[] calldata _ids, uint256[] calldata _values) external; pragma solidity 0.8.2; }
9,641,856
// OpenZeppelin ERC1155PresetMinterPauser.sol // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/presets/ERC1155PresetMinterPauser.sol // SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/GSN/Con...
Sets `redeemPool` to `newRedeemPool`. Requirements: - the caller must have the `DEFAULT_ADMIN_ROLE`./
function setRedeemPool(address newRedeemPool) external { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "ERC11554k: must have admin role to set redeem pool"); redeemPool = newRedeemPool; }
9,848,850
pragma solidity ^0.5.0; library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an account access to this role */ function add(Role storage role, address account) internal { require(account != address(0)); require(!has(role, acc...
how many 30 day periods have passed
function calculatePercentageToRelease(uint256 _startTime) internal view returns (uint256 percentage) { uint periodsPassed = ((now.sub(_startTime.add(MinimumHoldingPeriod))).div(Interval)).add(1); }
933,255
./full_match/1/0x0b48549292B364dA14e6AcB5c18e143491B8f5A7/sources/browser/ERCIndex_flat.sol
will sell percent of each token and send DAI to _receiver
function _sellPercentOfIndexForDai(uint _percent, address _receiver) internal { for (uint i = 0; i < topTokensLength(); i++) { uint tokenBalance = topTokens[i].balanceOf(address(this)); if (tokenBalance > 0) { _sell...
3,875,489
// SPDX-License-Identifier: None pragma solidity ^0.8.0; import "Ownable.sol"; import "TransparentUpgradeableProxy.sol"; /** * @notice This is the contract that will have administrative privileges on all Halborn proxied * products. */ contract HalbornProxyAdmin is Ownable { constructor(address owner) { ...
Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./
function renounceOwnership() external virtual onlyOwner { revert("Ownable: Renounce ownership not allowed"); }
14,621,744