Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
5
// also not for you
constructor() ERC721("SphinxSociety", "SPHINX") {}
constructor() ERC721("SphinxSociety", "SPHINX") {}
7,652
170
// Called by users to mint from the main sale. /
function mint(uint256 numToMint) external payable { require( _saleIsActive, "Sale not active" ); // Mint tokens, checking for sufficient payment and supply. _mintInner(numToMint, 0); }
function mint(uint256 numToMint) external payable { require( _saleIsActive, "Sale not active" ); // Mint tokens, checking for sufficient payment and supply. _mintInner(numToMint, 0); }
19,351
65
// Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer.If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. /
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4);
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4);
18,581
0
// Query structure
struct Request { address caller; // the Ethereum address which has requested for the query result bool isPending; // the status of the query treatment (true if the result is still unknown) bytes32 badgeConditionGroupID; // the ID of the condition group to mint the badge string indexer; // the service indexing the data (possible values: "thegraph, "covalent") string protocol; // the set/subgraph on the indexer to use (possible values: "uniswap", "compound" ,"aave" ,"ethereum") string query; // the query to be run string queryResult; // the result of the query }
struct Request { address caller; // the Ethereum address which has requested for the query result bool isPending; // the status of the query treatment (true if the result is still unknown) bytes32 badgeConditionGroupID; // the ID of the condition group to mint the badge string indexer; // the service indexing the data (possible values: "thegraph, "covalent") string protocol; // the set/subgraph on the indexer to use (possible values: "uniswap", "compound" ,"aave" ,"ethereum") string query; // the query to be run string queryResult; // the result of the query }
54,364
1
// struct of HTLC user burn lock parameters
struct HTLCUserBurnLockParams { bytes32 xHash; /// hash of HTLC random number bytes32 smgID; /// ID of storeman group which user has selected uint tokenPairID; /// token pair id on cross chain uint value; /// exchange token value uint lockedTime; /// HTLC lock time bytes userOrigAccount; /// account of token original chain, used to receive token }
struct HTLCUserBurnLockParams { bytes32 xHash; /// hash of HTLC random number bytes32 smgID; /// ID of storeman group which user has selected uint tokenPairID; /// token pair id on cross chain uint value; /// exchange token value uint lockedTime; /// HTLC lock time bytes userOrigAccount; /// account of token original chain, used to receive token }
21,631
288
// call _receiver `onFlashLoan`
require( _receiver.onFlashLoan(msg.sender, token, _amount, _flashFee, _params) == keccak256("ERC3156FlashBorrower.onFlashLoan"), "8" );
require( _receiver.onFlashLoan(msg.sender, token, _amount, _flashFee, _params) == keccak256("ERC3156FlashBorrower.onFlashLoan"), "8" );
61,578
17
// Allow a user to claim any available staking rewards and interest rewards. /
function getReward() public override nonReentrant updateReward(msg.sender) { address baseTradegenAddress = ADDRESS_RESOLVER.getContractAddress("BaseTradegen"); address interestRewardsPoolEscrowAddress = ADDRESS_RESOLVER.getContractAddress("InterestRewardsPoolEscrow"); uint stakingReward = stakingRewards[msg.sender]; uint interestReward = interestRewards[msg.sender]; if (stakingReward > 0) { stakingRewards[msg.sender] = 0; IERC20(baseTradegenAddress).transfer(msg.sender, stakingReward); emit StakingRewardPaid(msg.sender, stakingReward, block.timestamp); } if (interestReward > 0) { interestRewards[msg.sender] = 0; IInterestRewardsPoolEscrow(interestRewardsPoolEscrowAddress).claimRewards(msg.sender, interestReward); emit InterestRewardPaid(msg.sender, interestReward, block.timestamp); } }
function getReward() public override nonReentrant updateReward(msg.sender) { address baseTradegenAddress = ADDRESS_RESOLVER.getContractAddress("BaseTradegen"); address interestRewardsPoolEscrowAddress = ADDRESS_RESOLVER.getContractAddress("InterestRewardsPoolEscrow"); uint stakingReward = stakingRewards[msg.sender]; uint interestReward = interestRewards[msg.sender]; if (stakingReward > 0) { stakingRewards[msg.sender] = 0; IERC20(baseTradegenAddress).transfer(msg.sender, stakingReward); emit StakingRewardPaid(msg.sender, stakingReward, block.timestamp); } if (interestReward > 0) { interestRewards[msg.sender] = 0; IInterestRewardsPoolEscrow(interestRewardsPoolEscrowAddress).claimRewards(msg.sender, interestReward); emit InterestRewardPaid(msg.sender, interestReward, block.timestamp); } }
37,022
24
// BL
ambassadorsMaxPremine[0xc951D3463EbBa4e9Ec8dDfe1f42bc5895C46eC8f] = 0.28 ether / BETA_DIVISOR; ambassadorsPrerequisite[0xc951D3463EbBa4e9Ec8dDfe1f42bc5895C46eC8f] = 0xFEA0904ACc8Df0F3288b6583f60B86c36Ea52AcD;
ambassadorsMaxPremine[0xc951D3463EbBa4e9Ec8dDfe1f42bc5895C46eC8f] = 0.28 ether / BETA_DIVISOR; ambassadorsPrerequisite[0xc951D3463EbBa4e9Ec8dDfe1f42bc5895C46eC8f] = 0xFEA0904ACc8Df0F3288b6583f60B86c36Ea52AcD;
81,422
9
// set last cummulative supply time share lpTokenAddress: contract address newSupplyLPTimeShare: timestamp value /
function setLastCummulativeSupplyLPTimeShare(
function setLastCummulativeSupplyLPTimeShare(
48,281
5
// When the token is transfered the protocol becomes the operator
if (isRentable) { IOperable(nftAddress).setOperator(nftId, msg.sender); }
if (isRentable) { IOperable(nftAddress).setOperator(nftId, msg.sender); }
5,299
75
// Owner can withdraw funds not exceeding balance minus potential win amounts by open bets.
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner { require(withdrawAmount <= IERC20(GAME_TOKEN).balanceOf(address(this)) - lockedInBets, "Withdrawal exceeds limit"); IERC20(GAME_TOKEN).safeTransfer(beneficiary, withdrawAmount); }
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner { require(withdrawAmount <= IERC20(GAME_TOKEN).balanceOf(address(this)) - lockedInBets, "Withdrawal exceeds limit"); IERC20(GAME_TOKEN).safeTransfer(beneficiary, withdrawAmount); }
48,013
147
// |/ A distinct Uniform Resource Identifier (URI) for a given token. URIs are defined in RFC 3986. URIs are assumed to be deterministically generated based on token ID Token IDs are assumed to be represented in their hex format in URIsreturn URI string /
function uri(uint256 _id) public view returns (string memory) { return string(abi.encodePacked(baseMetadataURI, _uint2str(_id), ".json")); }
function uri(uint256 _id) public view returns (string memory) { return string(abi.encodePacked(baseMetadataURI, _uint2str(_id), ".json")); }
22,039
89
// IModule Set Protocol Interface for interacting with Modules. /
interface IModule { /** * Called by a SetToken to notify that this module was removed from the Set token. Any logic can be included * in case checks need to be made or state needs to be cleared. */ function removeModule() external; }
interface IModule { /** * Called by a SetToken to notify that this module was removed from the Set token. Any logic can be included * in case checks need to be made or state needs to be cleared. */ function removeModule() external; }
21,914
9
// Get the size of the target.
uint256 size;
uint256 size;
15,768
5
// deposit the value specified form the caller to the donor contract
function deposit() payable public {} //fetch the value balance of the contract function getBalance() public view returns (uint256) { return address(this).balance; }
function deposit() payable public {} //fetch the value balance of the contract function getBalance() public view returns (uint256) { return address(this).balance; }
38,290
60
// return metadata, full name of the currency provided by this oracle(ej: Argentine Peso) Defined by the RCN RateOracle interface /
function name() external view returns (string memory) { return iname; }
function name() external view returns (string memory) { return iname; }
13,755
20
// spájanie pozemkov (iba ich majiteľ)
function mergeEstate(uint _id1, uint _id2, string memory _plotNumber, uint _area) public { uint i = checkLetter(_id1); uint j = checkEstate(_id1); uint x = checkLetter(_id2); uint y = checkEstate(_id2); if(owners[i].add == tx.origin && owners[x].add == tx.origin && compareStrings(estates[j].district, estates[y].district) && compareStrings(estates[j].town, estates[y].town) && compareStrings(estates[j].cadastralArea, estates[y].cadastralArea)) { createEstate(estates[j].district, estates[j].town, estates[j].cadastralArea, _plotNumber, _area, estates[j].typeOf); makeLetter(nextIdEstate-1); updateEstate(_id1, "merged", "merged", "merged", "merged", 0, "merged"); updateEstate(_id2, "merged", "merged", "merged", "merged", 0, "merged"); } }
function mergeEstate(uint _id1, uint _id2, string memory _plotNumber, uint _area) public { uint i = checkLetter(_id1); uint j = checkEstate(_id1); uint x = checkLetter(_id2); uint y = checkEstate(_id2); if(owners[i].add == tx.origin && owners[x].add == tx.origin && compareStrings(estates[j].district, estates[y].district) && compareStrings(estates[j].town, estates[y].town) && compareStrings(estates[j].cadastralArea, estates[y].cadastralArea)) { createEstate(estates[j].district, estates[j].town, estates[j].cadastralArea, _plotNumber, _area, estates[j].typeOf); makeLetter(nextIdEstate-1); updateEstate(_id1, "merged", "merged", "merged", "merged", 0, "merged"); updateEstate(_id2, "merged", "merged", "merged", "merged", 0, "merged"); } }
8,538
8
// Cancel order cancels order by setting nonce to max value. After this all"buy" functions would fail on this order order order struct /
function cancel(Order calldata order) external { require( order.signer == _msgSender() && recoverSigner(order.rootSign, order.root) == _msgSender(), "Cancel: wrong sender" ); bytes32 orderHash = getOrderHash(order); nonce[orderHash] = order.totalAmount; emit Cancel(orderHash, _msgSender()); }
function cancel(Order calldata order) external { require( order.signer == _msgSender() && recoverSigner(order.rootSign, order.root) == _msgSender(), "Cancel: wrong sender" ); bytes32 orderHash = getOrderHash(order); nonce[orderHash] = order.totalAmount; emit Cancel(orderHash, _msgSender()); }
16,305
49
// how many voters have voted for a given proposal?
function howManyVoters(bytes32 _rootHash) constant public returns (uint)
function howManyVoters(bytes32 _rootHash) constant public returns (uint)
25,857
26
// todo change this logic to handle the float exponential on reward factor
return (((_stake.amount * rewardCalculationFactor) / 100) - _stake.amount) / 31536000;
return (((_stake.amount * rewardCalculationFactor) / 100) - _stake.amount) / 31536000;
22,455
63
// Update token balance of the manager
balances[_issuer] = balances[_issuer].add(issuerTotal); balances[manager] = balances[manager].add(managerFee); if (protocolFee > 0) {
balances[_issuer] = balances[_issuer].add(issuerTotal); balances[manager] = balances[manager].add(managerFee); if (protocolFee > 0) {
47,808
0
// IRariFundManager IRariFundManager is a simple interface for RariFundManager used by RariGovernanceTokenDistributor. /
interface IRariFundManager { /** * @dev Contract of the RariFundToken. */ function rariFundToken() external returns (IRariFundToken); /** * @notice Returns the fund's total investor balance (all RFT holders' funds but not unclaimed fees) of all currencies in USD (scaled by 1e18). * @dev Ideally, we can add the `view` modifier, but Compound's `getUnderlyingBalance` function (called by `getRawFundBalance`) potentially modifies the state. */ function getFundBalance() external returns (uint256); /** * @notice Deposits funds to the Rari Stable Pool in exchange for RFT. * You may only deposit currencies accepted by the fund (see `isCurrencyAccepted(string currencyCode)`). * Please note that you must approve RariFundManager to transfer at least `amount`. * @param currencyCode The currency code of the token to be deposited. * @param amount The amount of tokens to be deposited. */ function deposit(string calldata currencyCode, uint256 amount) external; /** * @notice Withdraws funds from the Rari Stable Pool in exchange for RFT. * You may only withdraw currencies held by the fund (see `getRawFundBalance(string currencyCode)`). * Please note that you must approve RariFundManager to burn of the necessary amount of RFT. * @param currencyCode The currency code of the token to be withdrawn. * @param amount The amount of tokens to be withdrawn. */ function withdraw(string calldata currencyCode, uint256 amount) external; }
interface IRariFundManager { /** * @dev Contract of the RariFundToken. */ function rariFundToken() external returns (IRariFundToken); /** * @notice Returns the fund's total investor balance (all RFT holders' funds but not unclaimed fees) of all currencies in USD (scaled by 1e18). * @dev Ideally, we can add the `view` modifier, but Compound's `getUnderlyingBalance` function (called by `getRawFundBalance`) potentially modifies the state. */ function getFundBalance() external returns (uint256); /** * @notice Deposits funds to the Rari Stable Pool in exchange for RFT. * You may only deposit currencies accepted by the fund (see `isCurrencyAccepted(string currencyCode)`). * Please note that you must approve RariFundManager to transfer at least `amount`. * @param currencyCode The currency code of the token to be deposited. * @param amount The amount of tokens to be deposited. */ function deposit(string calldata currencyCode, uint256 amount) external; /** * @notice Withdraws funds from the Rari Stable Pool in exchange for RFT. * You may only withdraw currencies held by the fund (see `getRawFundBalance(string currencyCode)`). * Please note that you must approve RariFundManager to burn of the necessary amount of RFT. * @param currencyCode The currency code of the token to be withdrawn. * @param amount The amount of tokens to be withdrawn. */ function withdraw(string calldata currencyCode, uint256 amount) external; }
9,108
18
// 检验发送者账户余额是否足够
require(balanceOf[msg.sender] >= tokens);
require(balanceOf[msg.sender] >= tokens);
32,707
57
// vault
function b0() public view returns (uint b) { IERC20 u = IERC20(token0); b = u.balanceOf(address(this)).add(deposited0).add(dummy0); }
function b0() public view returns (uint b) { IERC20 u = IERC20(token0); b = u.balanceOf(address(this)).add(deposited0).add(dummy0); }
47,356
112
// Factory to deploy Kali DAO.
contract KaliDAOfactory { event DAOdeployed(KaliDAO indexed kaliDAO, string name); address payable public immutable kaliMaster; IRicardianLLC public immutable ricardianLLC; constructor(address payable kaliMaster_, IRicardianLLC ricardianLLC_) { kaliMaster = kaliMaster_; ricardianLLC = ricardianLLC_; } function deployKaliDAO( string memory name_, string memory symbol_, string memory docs_, bool paused_, address[] memory extensions_, bytes[] memory extensionsData_, address[] calldata voters_, uint256[] calldata shares_, uint32 votingPeriod_, uint8[13] memory govSettings_ ) public payable virtual returns (KaliDAO kaliDAO) { kaliDAO = KaliDAO(_cloneAsMinimalProxy(kaliMaster)); kaliDAO.init{value: msg.value}( name_, symbol_, docs_, paused_, extensions_, extensionsData_, voters_, shares_, votingPeriod_, govSettings_ ); bytes memory docs = bytes(docs_); if (docs.length == 0) { ricardianLLC.mintLLC(address(kaliDAO)); } emit DAOdeployed(kaliDAO, name_); } /// @dev modified from Aelin (https://github.com/AelinXYZ/aelin/blob/main/contracts/MinimalProxyFactory.sol) function _cloneAsMinimalProxy(address payable base) internal virtual returns (address payable clone) { bytes memory createData = abi.encodePacked( // constructor bytes10(0x3d602d80600a3d3981f3), // proxy code bytes10(0x363d3d373d3d3d363d73), base, bytes15(0x5af43d82803e903d91602b57fd5bf3) ); assembly { clone := create( 0, // no value add(createData, 0x20), // data 55 // data is always 55 bytes (10 constructor + 45 code) ) } // if CREATE fails for some reason, address(0) is returned require(clone != address(0), 'NULL_DEPLOY'); } }
contract KaliDAOfactory { event DAOdeployed(KaliDAO indexed kaliDAO, string name); address payable public immutable kaliMaster; IRicardianLLC public immutable ricardianLLC; constructor(address payable kaliMaster_, IRicardianLLC ricardianLLC_) { kaliMaster = kaliMaster_; ricardianLLC = ricardianLLC_; } function deployKaliDAO( string memory name_, string memory symbol_, string memory docs_, bool paused_, address[] memory extensions_, bytes[] memory extensionsData_, address[] calldata voters_, uint256[] calldata shares_, uint32 votingPeriod_, uint8[13] memory govSettings_ ) public payable virtual returns (KaliDAO kaliDAO) { kaliDAO = KaliDAO(_cloneAsMinimalProxy(kaliMaster)); kaliDAO.init{value: msg.value}( name_, symbol_, docs_, paused_, extensions_, extensionsData_, voters_, shares_, votingPeriod_, govSettings_ ); bytes memory docs = bytes(docs_); if (docs.length == 0) { ricardianLLC.mintLLC(address(kaliDAO)); } emit DAOdeployed(kaliDAO, name_); } /// @dev modified from Aelin (https://github.com/AelinXYZ/aelin/blob/main/contracts/MinimalProxyFactory.sol) function _cloneAsMinimalProxy(address payable base) internal virtual returns (address payable clone) { bytes memory createData = abi.encodePacked( // constructor bytes10(0x3d602d80600a3d3981f3), // proxy code bytes10(0x363d3d373d3d3d363d73), base, bytes15(0x5af43d82803e903d91602b57fd5bf3) ); assembly { clone := create( 0, // no value add(createData, 0x20), // data 55 // data is always 55 bytes (10 constructor + 45 code) ) } // if CREATE fails for some reason, address(0) is returned require(clone != address(0), 'NULL_DEPLOY'); } }
32,388
168
// If no URI exists for the specific id requested, fallback to the default ERC-1155 URI.
if (bytes(tokenURI[tokenId]).length == 0) { return super.uri(tokenId); }
if (bytes(tokenURI[tokenId]).length == 0) { return super.uri(tokenId); }
46,788
38
// Interface of Price oracle Implements methods of price oracle used in the crowdsale OnGrid Systems /
contract PriceOracleIface { uint256 public ethPriceInCents; function getUsdCentsFromWei(uint256 _wei) public view returns (uint256) { } }
contract PriceOracleIface { uint256 public ethPriceInCents; function getUsdCentsFromWei(uint256 _wei) public view returns (uint256) { } }
57,860
26
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) { uint contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance > 0) { if(_useImpactFeeSetter) { if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) { contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100; }
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) { uint contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance > 0) { if(_useImpactFeeSetter) { if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) { contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100; }
3,221
8
// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view override(ERC721, IERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); }
function supportsInterface(bytes4 interfaceId) public view override(ERC721, IERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); }
25,027
33
// Toggle Wl1 minting
function toggleWlOneMinting () public onlyOwner virtual
function toggleWlOneMinting () public onlyOwner virtual
46,060
45
// Burn tokens from address token holder address amount uint256 amount of tokens to burn userData bytes extra information provided by the token holder operatorData bytes extra information provided by the operator (if any) /
function _burn( address operator, address from, uint256 amount, bool invokeHook, bytes memory userData, bytes memory operatorData ) internal
function _burn( address operator, address from, uint256 amount, bool invokeHook, bytes memory userData, bytes memory operatorData ) internal
25,243
39
// The oracle will have given you an ID for the VRF keypair they have committed to (let's call it keyHash), and have told you the minimum LINK price for VRF service. Make sure your contract has sufficient LINK, and call requestRandomness(keyHash, fee, seed), where seed is the input you want to generate randomness from.Once the VRFCoordinator has received and validated the oracle's response to your request, it will call your contract's fulfillRandomness method.The randomness argument to fulfillRandomness is the actual random value generated from your seed.The requestId argument is generated from the keyHash and the seed by makeRequestId(keyHash, seed). If
abstract contract VRFConsumerBase is VRFRequestIDBase { using SafeMathChainlink for uint256; /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. * * @dev The VRFCoordinator expects a calling contract to have a method with * @dev this signature, and will trigger it once it has verified the proof * @dev associated with the randomness (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomness the VRF output */ function fulfillRandomness(bytes32 requestId, uint256 randomness) internal virtual; /** * @notice requestRandomness initiates a request for VRF output given _seed * * @dev See "SECURITY CONSIDERATIONS" above for more information on _seed. * * @dev The fulfillRandomness method receives the output, once it's provided * @dev by the Oracle, and verified by the vrfCoordinator. * * @dev The _keyHash must already be registered with the VRFCoordinator, and * @dev the _fee must exceed the fee specified during registration of the * @dev _keyHash. * * @param _keyHash ID of public key against which randomness is generated * @param _fee The amount of LINK to send with the request * @param _seed seed mixed into the input of the VRF * * @return requestId unique ID for this request * * @dev The returned requestId can be used to distinguish responses to * * @dev concurrent requests. It is passed as the first argument to * @dev fulfillRandomness. */ function requestRandomness(bytes32 _keyHash, uint256 _fee, uint256 _seed) internal returns (bytes32 requestId) { LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, _seed)); // This is the seed passed to VRFCoordinator. The oracle will mix this with // the hash of the block containing this request to obtain the seed/input // which is finally passed to the VRF cryptographic machinery. uint256 vRFSeed = makeVRFInputSeed(_keyHash, _seed, address(this), nonces[_keyHash]); // nonces[_keyHash] must stay in sync with // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest). // This provides protection against the user repeating their input // seed, which would result in a predictable/duplicate output. nonces[_keyHash] = nonces[_keyHash].add(1); return makeRequestId(_keyHash, vRFSeed); } LinkTokenInterface internal LINK; address private vrfCoordinator; // Nonces for each VRF key from which randomness has been requested. // // Must stay in sync with VRFCoordinator[_keyHash][this] mapping(bytes32 /* keyHash */ => uint256 /* nonce */) public nonces; constructor(address _vrfCoordinator, address _link) public { vrfCoordinator = _vrfCoordinator; LINK = LinkTokenInterface(_link); } // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external { require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill"); fulfillRandomness(requestId, randomness); } }
abstract contract VRFConsumerBase is VRFRequestIDBase { using SafeMathChainlink for uint256; /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. * * @dev The VRFCoordinator expects a calling contract to have a method with * @dev this signature, and will trigger it once it has verified the proof * @dev associated with the randomness (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomness the VRF output */ function fulfillRandomness(bytes32 requestId, uint256 randomness) internal virtual; /** * @notice requestRandomness initiates a request for VRF output given _seed * * @dev See "SECURITY CONSIDERATIONS" above for more information on _seed. * * @dev The fulfillRandomness method receives the output, once it's provided * @dev by the Oracle, and verified by the vrfCoordinator. * * @dev The _keyHash must already be registered with the VRFCoordinator, and * @dev the _fee must exceed the fee specified during registration of the * @dev _keyHash. * * @param _keyHash ID of public key against which randomness is generated * @param _fee The amount of LINK to send with the request * @param _seed seed mixed into the input of the VRF * * @return requestId unique ID for this request * * @dev The returned requestId can be used to distinguish responses to * * @dev concurrent requests. It is passed as the first argument to * @dev fulfillRandomness. */ function requestRandomness(bytes32 _keyHash, uint256 _fee, uint256 _seed) internal returns (bytes32 requestId) { LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, _seed)); // This is the seed passed to VRFCoordinator. The oracle will mix this with // the hash of the block containing this request to obtain the seed/input // which is finally passed to the VRF cryptographic machinery. uint256 vRFSeed = makeVRFInputSeed(_keyHash, _seed, address(this), nonces[_keyHash]); // nonces[_keyHash] must stay in sync with // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest). // This provides protection against the user repeating their input // seed, which would result in a predictable/duplicate output. nonces[_keyHash] = nonces[_keyHash].add(1); return makeRequestId(_keyHash, vRFSeed); } LinkTokenInterface internal LINK; address private vrfCoordinator; // Nonces for each VRF key from which randomness has been requested. // // Must stay in sync with VRFCoordinator[_keyHash][this] mapping(bytes32 /* keyHash */ => uint256 /* nonce */) public nonces; constructor(address _vrfCoordinator, address _link) public { vrfCoordinator = _vrfCoordinator; LINK = LinkTokenInterface(_link); } // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external { require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill"); fulfillRandomness(requestId, randomness); } }
41,777
75
// Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burningOperator MUST be msg.senderWhen minting/creating tokens, the `_from` field MUST be set to `0x0`When burning/destroying tokens, the `_to` field MUST be set to `0x0`The total amount transferred from address 0x0 minus the total amount transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token IDTo broadcast the existence of multiple token IDs with no initial balance, this SHOULD emit the TransferBatch event from `0x0` to `0x0`, with the token creator
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
23,109
29
// hellhog
if (_trait != 22) { return abi.encodePacked(V, BEGINNING, string(backs[_trait]), END, F_E); } else {
if (_trait != 22) { return abi.encodePacked(V, BEGINNING, string(backs[_trait]), END, F_E); } else {
35,733
135
// limit timed activity only if timed flag is active
if (_timedActive) { require(isOpen(), "TimedCrowdsale: not open"); }
if (_timedActive) { require(isOpen(), "TimedCrowdsale: not open"); }
8,136
9
// Function to transfer tokens._to Address of the recipient. _amount Amount to send. return True if the operation was successful. /
function transfer(address _to, uint256 _amount) public returns (bool) { _transfer(msg.sender, _to, _amount); return true; }
function transfer(address _to, uint256 _amount) public returns (bool) { _transfer(msg.sender, _to, _amount); return true; }
49,695
61
// we cant define a return value for fallbacktherefore, we must do the call in in-line assemblyso we can use the return() opcode to returndynamic data from the storage contract
address store = address(_getStorageContract()); bytes memory cdata = abi.encodePacked(_msgData(), _msgSender()); uint256 value = msg.value;
address store = address(_getStorageContract()); bytes memory cdata = abi.encodePacked(_msgData(), _msgSender()); uint256 value = msg.value;
48,575
156
// Sets up the centralized accessList contract_accessList the address of accessList contract. return A boolean that indicates if the operation was successful./
function setupAccessList(address _accessList) public
function setupAccessList(address _accessList) public
57,360
55
// check which snap balance has a smaller difference in block numbers
if ( array2[j].blockNumber - array1[i - 1].blockNumber < array1[i].blockNumber - array2[j].blockNumber ) {
if ( array2[j].blockNumber - array1[i - 1].blockNumber < array1[i].blockNumber - array2[j].blockNumber ) {
19,808
20
// 0xF
OffChainFailure, OffChainSuccess, AwatingOffChainProcess, OffChainProcessStarted, OffChainServiceUnreachable, OffChainActionRequired, OffChainExpiry_LimitReached, RESERVEDxF7, DuplicateOffChainRequest, RESERVEDxF9,
OffChainFailure, OffChainSuccess, AwatingOffChainProcess, OffChainProcessStarted, OffChainServiceUnreachable, OffChainActionRequired, OffChainExpiry_LimitReached, RESERVEDxF7, DuplicateOffChainRequest, RESERVEDxF9,
10,676
2
// Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin rolebearer except when using {AccessControl-_setupRole}. /
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
33,706
182
// Determine if someone is in the whitelsit
modifier onlyWhitelist(address a)
modifier onlyWhitelist(address a)
10,420
22
// Royalty support for various other standards
function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory); function getFeeBps(uint256 tokenId) external view returns (uint[] memory); function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory); function royaltyInfo(uint256 tokenId, uint256 value, bytes calldata data) external view returns (address, uint256, bytes memory);
function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory); function getFeeBps(uint256 tokenId) external view returns (uint[] memory); function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory); function royaltyInfo(uint256 tokenId, uint256 value, bytes calldata data) external view returns (address, uint256, bytes memory);
13,117
108
// Apply pending rewards to trove's state
Troves[_borrower].coll = Troves[_borrower].coll.add(pendingETHReward); Troves[_borrower].debt = Troves[_borrower].debt.add(pendingLUSDDebtReward); _updateTroveRewardSnapshots(_borrower);
Troves[_borrower].coll = Troves[_borrower].coll.add(pendingETHReward); Troves[_borrower].debt = Troves[_borrower].debt.add(pendingLUSDDebtReward); _updateTroveRewardSnapshots(_borrower);
36,364
40
// init contract interface
setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5); setEngineerInterface(0xd7afbf5141a7f1d6b0473175f7a6b0a7954ed3d2); setAirdropGameInterface(0x465efa69a42273e3e368cfe3b6483ab97b3c33eb); setBossWannaCryInterface(0x7ea4af9805b8a0a58ce67c4b6b14cce0a1834491); setDepositInterface(0x134d3c5575eaaa1365d9268bb2a4b4d8fd1c5907);
setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5); setEngineerInterface(0xd7afbf5141a7f1d6b0473175f7a6b0a7954ed3d2); setAirdropGameInterface(0x465efa69a42273e3e368cfe3b6483ab97b3c33eb); setBossWannaCryInterface(0x7ea4af9805b8a0a58ce67c4b6b14cce0a1834491); setDepositInterface(0x134d3c5575eaaa1365d9268bb2a4b4d8fd1c5907);
16,076
71
// Allow the token holder to upgrade some of their tokens to a new contract.
function upgrade(uint _value) public { UpgradeState state = getUpgradeState(); require(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading); // Validate input value. require(_value != 0); balances[msg.sender] = balances[msg.sender].sub(_value); // Take tokens out from circulation totalSupply_ = totalSupply_.sub(_value); totalUpgraded = totalUpgraded.add(_value); // Token Upgrader reissues the tokens tokenUpgrader.upgradeFrom(msg.sender, _value); Upgrade(msg.sender, tokenUpgrader, _value); }
function upgrade(uint _value) public { UpgradeState state = getUpgradeState(); require(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading); // Validate input value. require(_value != 0); balances[msg.sender] = balances[msg.sender].sub(_value); // Take tokens out from circulation totalSupply_ = totalSupply_.sub(_value); totalUpgraded = totalUpgraded.add(_value); // Token Upgrader reissues the tokens tokenUpgrader.upgradeFrom(msg.sender, _value); Upgrade(msg.sender, tokenUpgrader, _value); }
13,280
35
// ------------------------------------------------------------------------ Token functions ------------------------------------------------------------------------
function transfer(Data storage self, address to, uint tokens) public returns (bool success) { // Owner and minter can move tokens before the tokens are transferable require(self.transferable || (self.mintable && (msg.sender == self.owner || msg.sender == self.minter))); require(!self.accountLocked[msg.sender]); self.balances[msg.sender] = safeSub(self.balances[msg.sender], tokens); self.balances[to] = safeAdd(self.balances[to], tokens); Transfer(msg.sender, to, tokens); return true; }
function transfer(Data storage self, address to, uint tokens) public returns (bool success) { // Owner and minter can move tokens before the tokens are transferable require(self.transferable || (self.mintable && (msg.sender == self.owner || msg.sender == self.minter))); require(!self.accountLocked[msg.sender]); self.balances[msg.sender] = safeSub(self.balances[msg.sender], tokens); self.balances[to] = safeAdd(self.balances[to], tokens); Transfer(msg.sender, to, tokens); return true; }
19,920
67
// Transfer Staking Info
user_staking_amount[newUser] = user_staking_amount[oldUser]; user_staking_period_index[newUser] = user_staking_period_index[oldUser]; user_staking_periods[newUser] = user_staking_periods[oldUser];
user_staking_amount[newUser] = user_staking_amount[oldUser]; user_staking_period_index[newUser] = user_staking_period_index[oldUser]; user_staking_periods[newUser] = user_staking_periods[oldUser];
43,355
123
// Transfer remaining balance to msg.sender
msg.sender.transfer(value);
msg.sender.transfer(value);
11,503
35
// Emit GenerativeSeriesDeployed /
function emitGenerativeSeriesDeployed(address contractAddress) external;
function emitGenerativeSeriesDeployed(address contractAddress) external;
42,263
40
// MANAGER ONLY. Removes a pending module from the SetToken. /
function removePendingModule(address _module) external onlyManager { require(!isLocked, "Only when unlocked"); require(moduleStates[_module] == ISetToken.ModuleState.PENDING, "Module must be pending"); moduleStates[_module] = ISetToken.ModuleState.NONE; emit PendingModuleRemoved(_module); }
function removePendingModule(address _module) external onlyManager { require(!isLocked, "Only when unlocked"); require(moduleStates[_module] == ISetToken.ModuleState.PENDING, "Module must be pending"); moduleStates[_module] = ISetToken.ModuleState.NONE; emit PendingModuleRemoved(_module); }
36,063
60
// when minting is whitelist-only, mint 1 tokenId to an address specified by the whitelisted sender_value value to refund, must exactly match what was specified in the Merkle tree_proof the Merkle proof to prove the sender and refund value/
function claimRefund(uint256 _value, bytes32[] memory _proof) external payable { require(!refundClaimed[msg.sender], "refund already claimed"); require(refundMerkleRoot != "", "whitelist merkleRoot missing"); require(verifyMerkleProof(msg.sender, _value, _proof), "failed to verify merkle proof"); refundClaimed[msg.sender] = true; // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = payable(msg.sender).call{value: _value}(""); require(success, "transfer failed"); }
function claimRefund(uint256 _value, bytes32[] memory _proof) external payable { require(!refundClaimed[msg.sender], "refund already claimed"); require(refundMerkleRoot != "", "whitelist merkleRoot missing"); require(verifyMerkleProof(msg.sender, _value, _proof), "failed to verify merkle proof"); refundClaimed[msg.sender] = true; // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = payable(msg.sender).call{value: _value}(""); require(success, "transfer failed"); }
27,248
2,148
// 1076
entry "unidiosyncratically" : ENG_ADVERB
entry "unidiosyncratically" : ENG_ADVERB
21,912
164
// for statistic
package.Total = package.Total.add(amount); if(package.Type == FinancialType.CRFI){ uInfo.nowInvestFinCRFI = uInfo.nowInvestFinCRFI.add(amount); SInfo.nowInvestCRFI = SInfo.nowInvestCRFI.add(amount); SInfo.totalWeightCRFI = SInfo.totalWeightCRFI.add(amount.mul(package.Weight) / Decimal); } else if(package.Type == FinancialType.CFil){
package.Total = package.Total.add(amount); if(package.Type == FinancialType.CRFI){ uInfo.nowInvestFinCRFI = uInfo.nowInvestFinCRFI.add(amount); SInfo.nowInvestCRFI = SInfo.nowInvestCRFI.add(amount); SInfo.totalWeightCRFI = SInfo.totalWeightCRFI.add(amount.mul(package.Weight) / Decimal); } else if(package.Type == FinancialType.CFil){
23,016
4
// See {IGovernor-COUNTING_MODE}. / solhint-disable-next-line func-name-mixedcase
function COUNTING_MODE() public pure virtual override returns (string memory) { return "support=bravo&quorum=for,abstain"; }
function COUNTING_MODE() public pure virtual override returns (string memory) { return "support=bravo&quorum=for,abstain"; }
1,826
625
// Cancel a decrease stake request during the lockup Either called by the service provider via DelegateManager or governance _account - address of service provider /
function cancelDecreaseStakeRequest(address _account) external
function cancelDecreaseStakeRequest(address _account) external
56,130
48
// convenience to manage a growing array
function insertPlayer(address value) internal { if(numPlayers == players.length) { players.length += 1; } players[numPlayers++] = value; }
function insertPlayer(address value) internal { if(numPlayers == players.length) { players.length += 1; } players[numPlayers++] = value; }
16,547
950
// Returns the average supply between now and the previous mint time using the integral of the total supply.
uint256 avgTotalSupply = integralTotalSupply.sub(lastClaimIntegralSupply).div(timeSinceLastClaim); if (avgTotalSupply == 0) return 0; uint256 incentivesToClaim = nTokenBalance.mul(incentiveRate).div(avgTotalSupply);
uint256 avgTotalSupply = integralTotalSupply.sub(lastClaimIntegralSupply).div(timeSinceLastClaim); if (avgTotalSupply == 0) return 0; uint256 incentivesToClaim = nTokenBalance.mul(incentiveRate).div(avgTotalSupply);
37,651
4
// Returns the address of the owner of the NFT. NFTs assigned to the zero address areconsidered invalid, and queries about them do throw. _tokenId The identifier for an NFT.return Address of _tokenId owner. /
function ownerOf(uint256 _tokenId) external view returns (address); function mint(address _to, uint256 _tokenId) external ;
function ownerOf(uint256 _tokenId) external view returns (address); function mint(address _to, uint256 _tokenId) external ;
39,033
22
// Initializes a loan with Loan Core. Compared to initializeLoan, this verifies the specific items in a bundle. Only works with bundles implementing the IVaultFactory interface.The caller must be a borrower or lender, or approved by a borrower or lender. The external signer must be a borrower or lender, or approved by a borrower or lender. The external signer must come from the opposite side of the loan as the caller.loanTerms The terms agreed by the lender and borrower. borrowerAddress of the borrower. lenderAddress of the lender. sig The loan terms signature, with v, r, s fields, and a nonce. nonce
function initializeLoanWithItems( LoanLibrary.LoanTerms calldata loanTerms, address borrower, address lender, Signature calldata sig, uint160 nonce, LoanLibrary.Predicate[] calldata itemPredicates
function initializeLoanWithItems( LoanLibrary.LoanTerms calldata loanTerms, address borrower, address lender, Signature calldata sig, uint160 nonce, LoanLibrary.Predicate[] calldata itemPredicates
49,959
41
// Add two integers
function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; assert(c >= a); return c; }
function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; assert(c >= a); return c; }
75,234
22
// find where to insert the new score
if (waffles[leaderboardWaffleIds[i]].votes < votes) { for (uint j = LEADERBOARD_WAFFLE_COUNT; i < j; j--) { leaderboardWaffleIds[j] = leaderboardWaffleIds[j - 1]; }
if (waffles[leaderboardWaffleIds[i]].votes < votes) { for (uint j = LEADERBOARD_WAFFLE_COUNT; i < j; j--) { leaderboardWaffleIds[j] = leaderboardWaffleIds[j - 1]; }
11,282
36
// Ensure the user is not trying to purchase more tokens than are available
require(totalSupply + tokens <= maxSupply, "Maximum supply reached");
require(totalSupply + tokens <= maxSupply, "Maximum supply reached");
13,611
8
// Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/
function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue( target, data, value,
function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue( target, data, value,
25,641
32
// We should have reverted in preExecCheck. But safer is better.
require(length > 0, Errors.INVALID_HINT_COLLECTED); bool isDelegateCall = transaction.flag.isDelegateCall(); for (uint256 i = 0; i < length; ++i) { bytes32 role = preResults[i].role; address authAddress = preResults[i].authorizer; require(authorizerSet[isDelegateCall][role].contains(authAddress), Errors.INVALID_HINT_COLLECTED);
require(length > 0, Errors.INVALID_HINT_COLLECTED); bool isDelegateCall = transaction.flag.isDelegateCall(); for (uint256 i = 0; i < length; ++i) { bytes32 role = preResults[i].role; address authAddress = preResults[i].authorizer; require(authorizerSet[isDelegateCall][role].contains(authAddress), Errors.INVALID_HINT_COLLECTED);
22,921
274
// Use "this" in order that the havven account is the sender. That this is an explicit transfer also initialises fee entitlement information.
return _transfer(this, account, value);
return _transfer(this, account, value);
25,698
263
// Add setting deprecation _settingId The ID of the setting _creatorNameId The nameId that created the setting _creatorTAOId The taoId that created the setting _associatedTAOId The taoId that the setting affects _newSettingId The new settingId value to route _newSettingContractAddress The address of the new setting contract to routereturn The ID of the "Associated" setting deprecationreturn The ID of the "Creator" setting deprecation /
function addDeprecation(uint256 _settingId, address _creatorNameId, address _creatorTAOId, address _associatedTAOId, uint256 _newSettingId, address _newSettingContractAddress) public inWhitelist returns (bytes32, bytes32) { require (_storeSettingDeprecation(_settingId, _creatorNameId, _creatorTAOId, _associatedTAOId, _newSettingId, _newSettingContractAddress)); // Store the associatedTAOSettingDeprecation info bytes32 _associatedTAOSettingDeprecationId = keccak256(abi.encodePacked(this, _associatedTAOId, _settingId)); AssociatedTAOSettingDeprecation storage _associatedTAOSettingDeprecation = associatedTAOSettingDeprecations[_associatedTAOSettingDeprecationId]; _associatedTAOSettingDeprecation.associatedTAOSettingDeprecationId = _associatedTAOSettingDeprecationId; _associatedTAOSettingDeprecation.associatedTAOId = _associatedTAOId; _associatedTAOSettingDeprecation.settingId = _settingId; // Store the creatorTAOSettingDeprecation info bytes32 _creatorTAOSettingDeprecationId = keccak256(abi.encodePacked(this, _creatorTAOId, _settingId)); CreatorTAOSettingDeprecation storage _creatorTAOSettingDeprecation = creatorTAOSettingDeprecations[_creatorTAOSettingDeprecationId]; _creatorTAOSettingDeprecation.creatorTAOSettingDeprecationId = _creatorTAOSettingDeprecationId; _creatorTAOSettingDeprecation.creatorTAOId = _creatorTAOId; _creatorTAOSettingDeprecation.settingId = _settingId; return (_associatedTAOSettingDeprecationId, _creatorTAOSettingDeprecationId); }
function addDeprecation(uint256 _settingId, address _creatorNameId, address _creatorTAOId, address _associatedTAOId, uint256 _newSettingId, address _newSettingContractAddress) public inWhitelist returns (bytes32, bytes32) { require (_storeSettingDeprecation(_settingId, _creatorNameId, _creatorTAOId, _associatedTAOId, _newSettingId, _newSettingContractAddress)); // Store the associatedTAOSettingDeprecation info bytes32 _associatedTAOSettingDeprecationId = keccak256(abi.encodePacked(this, _associatedTAOId, _settingId)); AssociatedTAOSettingDeprecation storage _associatedTAOSettingDeprecation = associatedTAOSettingDeprecations[_associatedTAOSettingDeprecationId]; _associatedTAOSettingDeprecation.associatedTAOSettingDeprecationId = _associatedTAOSettingDeprecationId; _associatedTAOSettingDeprecation.associatedTAOId = _associatedTAOId; _associatedTAOSettingDeprecation.settingId = _settingId; // Store the creatorTAOSettingDeprecation info bytes32 _creatorTAOSettingDeprecationId = keccak256(abi.encodePacked(this, _creatorTAOId, _settingId)); CreatorTAOSettingDeprecation storage _creatorTAOSettingDeprecation = creatorTAOSettingDeprecations[_creatorTAOSettingDeprecationId]; _creatorTAOSettingDeprecation.creatorTAOSettingDeprecationId = _creatorTAOSettingDeprecationId; _creatorTAOSettingDeprecation.creatorTAOId = _creatorTAOId; _creatorTAOSettingDeprecation.settingId = _settingId; return (_associatedTAOSettingDeprecationId, _creatorTAOSettingDeprecationId); }
32,481
45
// Adds liquidity to Uniswap V2 Pair and returns liquidity shares to the "to" address.
(amountA, amountB, liquidity) = addExactShortLiquidity( router_, optionToken.redeemToken(), underlyingToken, outputRedeems_, amountBMax_, amountBMin_, to_, deadline_ );
(amountA, amountB, liquidity) = addExactShortLiquidity( router_, optionToken.redeemToken(), underlyingToken, outputRedeems_, amountBMax_, amountBMin_, to_, deadline_ );
32,057
15
// Returns total supply of issued tokens /
function totalSupply() constant returns (uint256 totalSupply) { return supply; }
function totalSupply() constant returns (uint256 totalSupply) { return supply; }
51,639
159
// Returns whether an address is allowed to withdraw their funds. To beimplemented by derived contracts. payee The destination address of the funds. /
function withdrawalAllowed(address payee) public view returns (bool);
function withdrawalAllowed(address payee) public view returns (bool);
9,045
146
// Emitted when a relay is removed (deregistered). unstakeTime is the time when unstake will be callable.
event RelayRemoved(address indexed relay, uint256 unstakeTime);
event RelayRemoved(address indexed relay, uint256 unstakeTime);
13,732
19
// Emitted if the account is invalid for transaction.
event InvalidAccount(address indexed addr, bytes msg);
event InvalidAccount(address indexed addr, bytes msg);
3,694
145
// ========= update public variables =========
totalRewardsKTYclaimed = totalRewardsKTYclaimed.add(_KTY); totalRewardsSDAOclaimed = totalRewardsSDAOclaimed.add(_SDAO); totalLockedLP = totalLockedLP.sub(_LP); uint256 _currentMonth = getCurrentMonth(); if (_currentMonth < 5) { for (uint i = _currentMonth; i < 6; i++) { adjustedMonthlyDeposits[i] = adjustedMonthlyDeposits[i] .sub(adjustedLP);
totalRewardsKTYclaimed = totalRewardsKTYclaimed.add(_KTY); totalRewardsSDAOclaimed = totalRewardsSDAOclaimed.add(_SDAO); totalLockedLP = totalLockedLP.sub(_LP); uint256 _currentMonth = getCurrentMonth(); if (_currentMonth < 5) { for (uint i = _currentMonth; i < 6; i++) { adjustedMonthlyDeposits[i] = adjustedMonthlyDeposits[i] .sub(adjustedLP);
79,373
11
// Otherwise we mint the proportion that this increases the value held by this contract
mintAmount = (localReserveSupply * _amount) / totalValue;
mintAmount = (localReserveSupply * _amount) / totalValue;
27,638
121
// capable of changing PCV Deposit and Global Rate Limited Minter in the PSM
bytes32 internal constant PSM_ADMIN_ROLE = keccak256("PSM_ADMIN_ROLE");
bytes32 internal constant PSM_ADMIN_ROLE = keccak256("PSM_ADMIN_ROLE");
48,413
13
// Get a snapshot of the account's balances, and the cached exchange rate This is used by joetroller to more efficiently perform liquidity checks. account Address of the account to snapshotreturn (possible error, token balance, borrow balance, exchange rate mantissa) /
function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);
function getAccountSnapshot(address account) external view returns (uint256, uint256, uint256, uint256);
26,088
152
// A method to retrieve the stake for a stakeholder._stakeholder The stakeholder to retrieve the stake for. return uint256 The amount of wei staked./
function stakeOf(address _stakeholder) public view returns(uint256) { return stakes[_stakeholder]; }
function stakeOf(address _stakeholder) public view returns(uint256) { return stakes[_stakeholder]; }
31,788
561
// Converts an internal underlying cash value to its asset cash value/ar exchange rate object between asset and underlying/underlyingBalance amount to convert to asset cash, denominated in internal token precision
function convertFromUnderlying(AssetRateParameters memory ar, int256 underlyingBalance) internal pure returns (int256)
function convertFromUnderlying(AssetRateParameters memory ar, int256 underlyingBalance) internal pure returns (int256)
16,064
16
// Transfer votes
trackVotes(_msgSender(), recipient, uint96(amount));
trackVotes(_msgSender(), recipient, uint96(amount));
848
0
// See {ERC721-Transfer}.
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
11,310
13
// Contract that contains the functions to interact with the ZlotsJackpotHoldingContract
contract ZlotsJackpotHoldingContract { function payOutWinner(address winner) public; function getJackpot() public view returns (uint); }
contract ZlotsJackpotHoldingContract { function payOutWinner(address winner) public; function getJackpot() public view returns (uint); }
8,194
26
// SUSHI/Enter Meowshi. Deposit SUSHI `amount`. Mint MEOW for `to`.
function meowSushi(address to, uint256 amount) external returns (uint256 shares) { sushiToken.transferFrom(msg.sender, address(this), amount); ISushiBar(sushiBar).enter(amount); (, shares) = bento.deposit(IERC20(sushiBar), address(this), address(this), ISushiBar(sushiBar).balanceOf(address(this)), 0); meowMint(to, shares * multiplier); }
function meowSushi(address to, uint256 amount) external returns (uint256 shares) { sushiToken.transferFrom(msg.sender, address(this), amount); ISushiBar(sushiBar).enter(amount); (, shares) = bento.deposit(IERC20(sushiBar), address(this), address(this), ISushiBar(sushiBar).balanceOf(address(this)), 0); meowMint(to, shares * multiplier); }
47,361
108
// Swap the depositToken for targetToken
temp.tokensToSwap = _getTokenAmount(address(poolInfo.depositToken), temp.poolAmount); require(temp.tokensToSwap > 0, "bad token swap"); address[] memory uniswapPath = new address[](3); uniswapPath[0] = address(poolInfo.depositToken); uniswapPath[1] = address(weth); uniswapPath[2] = address(poolInfo.targetToken); poolInfo.depositToken.safeApprove(address(uniswapRouter), 0); poolInfo.depositToken.safeApprove(address(uniswapRouter), temp.tokensToSwap); uniswapRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(temp.tokensToSwap, 0, uniswapPath, address(this), temp.deadline);
temp.tokensToSwap = _getTokenAmount(address(poolInfo.depositToken), temp.poolAmount); require(temp.tokensToSwap > 0, "bad token swap"); address[] memory uniswapPath = new address[](3); uniswapPath[0] = address(poolInfo.depositToken); uniswapPath[1] = address(weth); uniswapPath[2] = address(poolInfo.targetToken); poolInfo.depositToken.safeApprove(address(uniswapRouter), 0); poolInfo.depositToken.safeApprove(address(uniswapRouter), temp.tokensToSwap); uniswapRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(temp.tokensToSwap, 0, uniswapPath, address(this), temp.deadline);
28,450
34
// Absolve a validator from a benign misbehaviour.
function absolveFirstBenign(address validator) public has_benign_misbehaved(validator) { validatorsStatus[validator].firstBenign[msg.sender] = 0; AddressVotes.remove(validatorsStatus[validator].benignMisbehaviour, msg.sender); }
function absolveFirstBenign(address validator) public has_benign_misbehaved(validator) { validatorsStatus[validator].firstBenign[msg.sender] = 0; AddressVotes.remove(validatorsStatus[validator].benignMisbehaviour, msg.sender); }
31,845
26
// Internally used struct capturing wallet order nonce invalidations created via `invalidateOrderNonce` /
struct NonceInvalidation { bool exists; uint64 timestampInMs; uint256 effectiveBlockNumber; }
struct NonceInvalidation { bool exists; uint64 timestampInMs; uint256 effectiveBlockNumber; }
2,628
18
// Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol spender The address which will spend the funds. addedValue The amount of tokens to increase the allowance by. /
function increaseApproval(address spender, uint256 addedValue) public returns (bool){ allowed[msg.sender][spender] = allowed[msg.sender][spender].add(addedValue); emit Approval(msg.sender, spender, allowed[msg.sender][spender]); return true; }
function increaseApproval(address spender, uint256 addedValue) public returns (bool){ allowed[msg.sender][spender] = allowed[msg.sender][spender].add(addedValue); emit Approval(msg.sender, spender, allowed[msg.sender][spender]); return true; }
53,043
46
// make new pool token/token request call for dapp
* Emit {NewPoolTOKENrequest} evt. * * * Requirements: * payable only Is InOwners and no paused and pool not exist require and extra charge _depfee * * lock type: nonReentrant */ function newPoolTOKENrequest( address tka, address tkb, uint256 amounta, uint256 amountb ) external payable nonReentrant returns (uint256) { require(!isPaused()); require(!PoolExist(tka, tkb)); require(msg.value >= _depfee, "1"); _executor.transfer(msg.value); ERC20 _tokenb = ERC20(tkb); ERC20 _tokena = ERC20(tka); require(_tokena.allowance(_msgSender(), address(this)) >= amounta, "2"); require(_tokenb.allowance(_msgSender(), address(this)) >= amountb, "3"); require(_tokena.transferFrom(_msgSender(), address(this), amounta)); require(_tokenb.transferFrom(_msgSender(), address(this), amountb)); uint256 indx = _newPool(_msgSender(), tka, tkb, amountb, amountb, false); _Pools[indx].isConfirmed = false; _addPendig(indx); emit NewPoolTOKENrequest( tka, tkb, _msgSender(), amounta, amountb, indx ); return indx; }
* Emit {NewPoolTOKENrequest} evt. * * * Requirements: * payable only Is InOwners and no paused and pool not exist require and extra charge _depfee * * lock type: nonReentrant */ function newPoolTOKENrequest( address tka, address tkb, uint256 amounta, uint256 amountb ) external payable nonReentrant returns (uint256) { require(!isPaused()); require(!PoolExist(tka, tkb)); require(msg.value >= _depfee, "1"); _executor.transfer(msg.value); ERC20 _tokenb = ERC20(tkb); ERC20 _tokena = ERC20(tka); require(_tokena.allowance(_msgSender(), address(this)) >= amounta, "2"); require(_tokenb.allowance(_msgSender(), address(this)) >= amountb, "3"); require(_tokena.transferFrom(_msgSender(), address(this), amounta)); require(_tokenb.transferFrom(_msgSender(), address(this), amountb)); uint256 indx = _newPool(_msgSender(), tka, tkb, amountb, amountb, false); _Pools[indx].isConfirmed = false; _addPendig(indx); emit NewPoolTOKENrequest( tka, tkb, _msgSender(), amounta, amountb, indx ); return indx; }
30,814
58
// Checks if the sale is open.return isOpen True if the crowdsale is open, false otherwise. /
function isOpen() public view returns (bool) { return block.timestamp >= uint256(marketInfo.startTime) && block.timestamp <= uint256(marketInfo.endTime); }
function isOpen() public view returns (bool) { return block.timestamp >= uint256(marketInfo.startTime) && block.timestamp <= uint256(marketInfo.endTime); }
25,124
18
// Return InstaEvent Address./
// function getEventAddr() internal pure returns (address) { // return 0x2af7ea6Cb911035f3eb1ED895Cb6692C39ecbA97; // InstaEvent Address // }
// function getEventAddr() internal pure returns (address) { // return 0x2af7ea6Cb911035f3eb1ED895Cb6692C39ecbA97; // InstaEvent Address // }
15,240
150
// Check the paused status of the contract
if (Pausable.paused()) { return FAILURE_PAUSED; }
if (Pausable.paused()) { return FAILURE_PAUSED; }
22,126
4
// Tracks how many Loopy Cups have been purchased with CHILL
uint256 public cupsPurchasedWithChill = 0;
uint256 public cupsPurchasedWithChill = 0;
58,495
176
// Returns the list of enabled modules.
function enabledModules() external view returns (address[] memory _modules);
function enabledModules() external view returns (address[] memory _modules);
3,638
69
// New version address should be other than 0x0.
if (_newVersion == 0x0) { return false; }
if (_newVersion == 0x0) { return false; }
34,494
149
// Verify the Oracle Request sender The sender of the request payment The amount of payment given (specified in wei) callbackAddress The callback address for the response callbackFunctionId The callback function ID for the response nonce The nonce sent by the requester /
function _verifyOracleRequest( address sender, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 nonce, uint256 dataVersion ) private returns (
function _verifyOracleRequest( address sender, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 nonce, uint256 dataVersion ) private returns (
68,912
51
// Gets the current supply interest rate based on the given asset, total cash and total borrows The return value should be scaled by 1e18, thus a return value of `(true, 1000000000000)` implies an interest rate of 0.000001 or 0.0001% per block. asset The asset to get the interest rate of cash The total cash of the asset in the market borrows The total borrows of the asset in the marketreturn Success or failure and the supply interest rate per block scaled by 10e18 /
function getSupplyRate( address asset, uint256 cash, uint256 borrows ) public view returns (uint256, uint256);
function getSupplyRate( address asset, uint256 cash, uint256 borrows ) public view returns (uint256, uint256);
73,966
187
// Initialize TokenPorter contract./_tokenAddr Address of metToken contract/_auctionsAddr Address of auctions contract
function initTokenPorter(address _tokenAddr, address _auctionsAddr) public onlyOwner { require(_tokenAddr != 0x0); require(_auctionsAddr != 0x0); auctions = Auctions(_auctionsAddr); token = METToken(_tokenAddr); }
function initTokenPorter(address _tokenAddr, address _auctionsAddr) public onlyOwner { require(_tokenAddr != 0x0); require(_auctionsAddr != 0x0); auctions = Auctions(_auctionsAddr); token = METToken(_tokenAddr); }
27,619
27
// Solidity automatically throws when dividing by 0
struct percent { uint num; uint den; }
struct percent { uint num; uint den; }
68,994
499
// A map from an account owner to a destination address to a tokenID to an amount to a storageID to a new recipient address
mapping (address => mapping (address => mapping (uint16 => mapping (uint => mapping (uint32 => address))))) withdrawalRecipient;
mapping (address => mapping (address => mapping (uint16 => mapping (uint => mapping (uint32 => address))))) withdrawalRecipient;
24,571
45
// Must be divisible by 10x the number of digits over 3. /
require((_personalCap % (10**(placeholder - 3))) == 0);
require((_personalCap % (10**(placeholder - 3))) == 0);
1,139
256
// round 14
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 16442329894745639881165035015179028112772410105963688121820543219662832524136) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 16442329894745639881165035015179028112772410105963688121820543219662832524136) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
24,055