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
7
// TokensView Utility view contract to fetch multiple token information at once. /
contract TokensView { struct Token { bytes32 ID; string name; string ticker; address addr; string symbolMultihash; ArbitrableTokenList.TokenStatus status; uint numberOfRequests; } /** @dev Fetch up to 500 token IDs of the first tokens present...
contract TokensView { struct Token { bytes32 ID; string name; string ticker; address addr; string symbolMultihash; ArbitrableTokenList.TokenStatus status; uint numberOfRequests; } /** @dev Fetch up to 500 token IDs of the first tokens present...
48,160
20
// Main raffle data struct
struct RaffleStruct { STATUS status; // status of the raffle. Can be created, accepted, ended, etc uint256 maxEntries; // maximum number of entries allowed per user, to avoid abuse address collateralAddress; // address of the NFT uint256 collateralId; // NFT id of the NFT add...
struct RaffleStruct { STATUS status; // status of the raffle. Can be created, accepted, ended, etc uint256 maxEntries; // maximum number of entries allowed per user, to avoid abuse address collateralAddress; // address of the NFT uint256 collateralId; // NFT id of the NFT add...
31,836
12
// make sure input params are valid
require(pricePerCall != 0 && sellerUsername != "" && apiName != "" && bytes(hostname).length != 0);
require(pricePerCall != 0 && sellerUsername != "" && apiName != "" && bytes(hostname).length != 0);
34,335
56
// TODO: Enable/Remove these once blocktime in polyjuice is finalized (nodes, mining etc) require(block.timestamp >= rounds[roundNumber].timestamps.closeTimestamp, "Can only end round after closeTimestamp"); require( block.timestamp <= rounds[roundNumber].timestamps.closeTimestamp + config.bufferSeconds, "Can only end ...
Round storage round = rounds[roundNumber]; round.prices.closePrice = price; round.oracleIds.closeOracleId = roundId; round.status = RoundStatus.Expired; emit EndRound(roundNumber, roundId, price);
Round storage round = rounds[roundNumber]; round.prices.closePrice = price; round.oracleIds.closeOracleId = roundId; round.status = RoundStatus.Expired; emit EndRound(roundNumber, roundId, price);
37,447
149
// Add better to better list if they aren&39;t already in it
if (betterInfo[msg.sender].betAmount == 0) { betterInfo[msg.sender].betOption = option; numberOfBets[option]++; betters.push(msg.sender); }
if (betterInfo[msg.sender].betAmount == 0) { betterInfo[msg.sender].betOption = option; numberOfBets[option]++; betters.push(msg.sender); }
25,083
688
// high
t1 = PairingsBn254.copy(proof.wire_values_at_z_omega[0]); t1.sub_assign(t0);
t1 = PairingsBn254.copy(proof.wire_values_at_z_omega[0]); t1.sub_assign(t0);
78,568
65
// Fill temp variable
currentAbsoluteTokenAmounts = adapterBalances[i].absoluteTokenAmounts;
currentAbsoluteTokenAmounts = adapterBalances[i].absoluteTokenAmounts;
5,417
3
// _beforeTokenTransfer should be overriden :ERC20, ERC20Capped
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Pausable) { super._beforeTokenTransfer(from, to, amount); require(true, "ERC20Pausable: token transfer while paused"); }
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Pausable) { super._beforeTokenTransfer(from, to, amount); require(true, "ERC20Pausable: token transfer while paused"); }
45,003
274
// - `index` must be strictly less than {length}./
function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; }
function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; }
50
380
// distributes eth based on fees to gen and pot /
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns)
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns)
70,209
3
// A multipler that normalizes price from the Chainlink aggregator to 18 decimal places.
uint256 private immutable _chainlinkPriceMultiplier;
uint256 private immutable _chainlinkPriceMultiplier;
3,803
63
// The start bonus must be some fraction of the max. (i.e. <= 100%)
require( startBonus_ <= 10**BONUS_DECIMALS, "TokenGeyser: start bonus too high" );
require( startBonus_ <= 10**BONUS_DECIMALS, "TokenGeyser: start bonus too high" );
35,549
36
// the address of the contract that can modify variables this can only be changed by the owner of this contract
address public associatedContract;
address public associatedContract;
26,550
11
// return {uint} now`rhs`, timestamp, in seconds, in the future
function nowMul( uint rhs ) public pure returns( uint ){ return block.timestamp.mul(rhs); }
function nowMul( uint rhs ) public pure returns( uint ){ return block.timestamp.mul(rhs); }
13,201
91
// Return Multiple token liquidity from InstaPool. tokens Array of token addresses.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) amts Array of token amounts. getId get token amounts at this IDs from `InstaMemory` Contract. setId set token amounts at this IDs in `InstaMemory` Contract./
function flashMultiPayback(address[] calldata tokens, uint[] calldata amts, uint[] calldata getId, uint[] calldata setId) external payable { uint _length = tokens.length; DydxFlashInterface dydxContract = DydxFlashInterface(getDydxFlashAddr()); uint[] memory totalAmtFees = new uint[](_lengt...
function flashMultiPayback(address[] calldata tokens, uint[] calldata amts, uint[] calldata getId, uint[] calldata setId) external payable { uint _length = tokens.length; DydxFlashInterface dydxContract = DydxFlashInterface(getDydxFlashAddr()); uint[] memory totalAmtFees = new uint[](_lengt...
20,379
1
// mint and distribute Reward to callerNOTE: caller must be approved consumer /
function distribute(uint256 _since) external returns (uint256);
function distribute(uint256 _since) external returns (uint256);
8,612
208
// check msg.sender has sufficient sUSD to pay
require(IERC20(address(pynthsUSD())).balanceOf(msg.sender) >= _repayAmount, "Not enough sUSD balance"); PynthLoanStruct memory pynthLoan = _getLoanFromStorage(_loanCreatorsAddress, _loanID);
require(IERC20(address(pynthsUSD())).balanceOf(msg.sender) >= _repayAmount, "Not enough sUSD balance"); PynthLoanStruct memory pynthLoan = _getLoanFromStorage(_loanCreatorsAddress, _loanID);
3,830
21
// Retrieves a lienCount for specific collateral collateralId the Lien to compute a point for /
function getCollateralState( uint256 collateralId
function getCollateralState( uint256 collateralId
33,334
1
// The fee period must be between 1 day and 60 days.
uint public constant MIN_FEE_PERIOD_DURATION = 1 days; uint public constant MAX_FEE_PERIOD_DURATION = 60 days; uint public constant MAX_TARGET_THRESHOLD = 50; uint public constant MAX_LIQUIDATION_RATIO = 1e18; // 100% issuance ratio uint public constant RATIO_FROM_TARGET_BUFFER = 2e18; // 200% - m...
uint public constant MIN_FEE_PERIOD_DURATION = 1 days; uint public constant MAX_FEE_PERIOD_DURATION = 60 days; uint public constant MAX_TARGET_THRESHOLD = 50; uint public constant MAX_LIQUIDATION_RATIO = 1e18; // 100% issuance ratio uint public constant RATIO_FROM_TARGET_BUFFER = 2e18; // 200% - m...
20,049
108
// Returns true if the claimant owns the token./_claimant - Address claiming to own the token./_tokenId - ID of token whose ownership to verify.
function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) { return (nonFungibleContract.ownerOf(_tokenId) == _claimant); }
function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) { return (nonFungibleContract.ownerOf(_tokenId) == _claimant); }
58,223
12
// Function to be called by the contract owner. It unpauses the contract, resuming all normal activities/Required by Pausable
function unpause() public onlyOwner { _unpause(); }
function unpause() public onlyOwner { _unpause(); }
8,622
20
// iff this is the first bonder, then deduct maintenance fee for posting to SWARM
if (_content.firstBonderAddr == address(0)) { _bonder.freeBondAmount -= swarmMaintenanceFee; accumulatedFees += swarmMaintenanceFee; }
if (_content.firstBonderAddr == address(0)) { _bonder.freeBondAmount -= swarmMaintenanceFee; accumulatedFees += swarmMaintenanceFee; }
3,866
182
// Internal function to increase the allowance by a given increment owner Token owner's address spender Spender's address increment Amount of increase /
function _increaseAllowance( address owner, address spender, uint256 increment
function _increaseAllowance( address owner, address spender, uint256 increment
10,230
51
// Credits payouts to insurees/
function creditInsurees(bytes32 flightKey, uint payoutRate) external requireIsOperational requireCallerAuthorized
function creditInsurees(bytes32 flightKey, uint payoutRate) external requireIsOperational requireCallerAuthorized
1,084
424
// @inheritdoc IUniverseVaultV3/For Frontend serving deposit
function getShares( uint256 amount0Desired, uint256 amount1Desired
function getShares( uint256 amount0Desired, uint256 amount1Desired
28,742
375
// round 21
ark(i, q, 21004037394166516054140386756510609698837211370585899203851827276330669555417); sbox_partial(i, q); mix(i, q);
ark(i, q, 21004037394166516054140386756510609698837211370585899203851827276330669555417); sbox_partial(i, q); mix(i, q);
51,201
193
// View function for getting the current nonce of the smart wallet.This nonce is incremented whenever an action is taken that requires asignature and/or a specific caller.return The current nonce. /
function getNonce() external view returns (uint256 nonce) { nonce = _nonce; }
function getNonce() external view returns (uint256 nonce) { nonce = _nonce; }
52,691
2
// ============ Events ============/ Emitted when an admin is added admin address of the admin /
event AdminAdded(address admin);
event AdminAdded(address admin);
3,311
34
// Invariant: There will always be an ownership that has an address and is not burned before an ownership that does not have an address and is not burned. Hence, curr will not underflow.
while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; }
while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; }
20,987
126
// Crowdsale Crowdsale is a base contract for managing a token crowdsale,allowing investors to purchase tokens with ether. This contract implementssuch functionality in its most fundamental form and can be extended to provide additionalfunctionality and/or custom behavior.The external interface represents the basic int...
contract Crowdsale is Context, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; // The token being sold IERC20 private _token; // Address where funds are collected address payable private _wallet; // How many token units a buyer gets per wei. // The rate is th...
contract Crowdsale is Context, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; // The token being sold IERC20 private _token; // Address where funds are collected address payable private _wallet; // How many token units a buyer gets per wei. // The rate is th...
12,299
11
// Checks whether a token is loadable./ return bool loadable or not.
function _isTokenLoadable(address _a) internal view returns (bool) { (, , , , bool loadable, , ) = _getTokenInfo(_a); return loadable; }
function _isTokenLoadable(address _a) internal view returns (bool) { (, , , , bool loadable, , ) = _getTokenInfo(_a); return loadable; }
35,554
359
// gets address of all extensions /
function getExtensions() external view returns (address[] memory);
function getExtensions() external view returns (address[] memory);
25,119
3
// checks authorizations for token transfer/from address transferring the token/to address receiving the token/tokenId id of the transferred token
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721) { require(from == address(0) || (hasRole(MINTER_ROLE, to) && tokenMinter[tokenId] == to), "Token: must be sent to the contract that created it"); super._beforeTokenTransfer(from, to, tokenId); ...
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721) { require(from == address(0) || (hasRole(MINTER_ROLE, to) && tokenMinter[tokenId] == to), "Token: must be sent to the contract that created it"); super._beforeTokenTransfer(from, to, tokenId); ...
49,799
11
// Function that allows a recipient to change its address The change can only be made to an address that has not previously received an allocation &the distributor cannot change its address
* Emits a {ChangeAddress} event. * */ function changeAddress(address newAddress) external override { require( balances[newAddress].allocatedTokens == 0 && balances[newAddress].claimed == 0, "TokenDistro::changeAddress: ADDRESS_ALREADY_IN_USE" );...
* Emits a {ChangeAddress} event. * */ function changeAddress(address newAddress) external override { require( balances[newAddress].allocatedTokens == 0 && balances[newAddress].claimed == 0, "TokenDistro::changeAddress: ADDRESS_ALREADY_IN_USE" );...
44,374
1
// Fallback function. Implemented entirely in `_fallback`./
function _fallback() internal { _delegate(_implementation()); }
function _fallback() internal { _delegate(_implementation()); }
46,711
71
// Throws if not enough fee, and any exceeding fee will be transferred back to the player.
require(msg.value >= reviveFee);
require(msg.value >= reviveFee);
82,849
263
// if collateral isn't enabled as collateral by user, it cannot be liquidated
if (!isCollateralEnabled) { return ( uint256(Errors.CollateralManagerErrors.COLLATERAL_CANNOT_BE_LIQUIDATED), Errors.LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED ); }
if (!isCollateralEnabled) { return ( uint256(Errors.CollateralManagerErrors.COLLATERAL_CANNOT_BE_LIQUIDATED), Errors.LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED ); }
16,672
17
// expmods[12] = trace_generator^(2(trace_length / 2 - 1)).
mstore(0x5000, expmod(/*trace_generator*/ mload(0x3a0), mul(2, sub(div(/*trace_length*/ mload(0x80), 2), 1)), PRIME))
mstore(0x5000, expmod(/*trace_generator*/ mload(0x3a0), mul(2, sub(div(/*trace_length*/ mload(0x80), 2), 1)), PRIME))
17,380
749
// Do not succeed if interest rates fall below 1
if (rate < Constants.RATE_PRECISION) { return (0, false); } else {
if (rate < Constants.RATE_PRECISION) { return (0, false); } else {
6,234
96
// add the failed amount to _recipient credits for manual withdrawal
failedERC20TransferCredits[_recipient][auctionERC20Token] = failedERC20TransferCredits[_recipient][auctionERC20Token] + _amount;
failedERC20TransferCredits[_recipient][auctionERC20Token] = failedERC20TransferCredits[_recipient][auctionERC20Token] + _amount;
2,124
56
// Note: the ERC-165 identifier for this interface is 0x150b7a02.
interface IERC721TokenReceiver { function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external view returns(bytes4); }
interface IERC721TokenReceiver { function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external view returns(bytes4); }
13,567
53
// See {IERC721-ownerOf}.
function ownerOf(uint256 tokenId) public view override returns (address) { (address owner, ) = _ownerAndBatchHeadOf(tokenId); return owner; }
function ownerOf(uint256 tokenId) public view override returns (address) { (address owner, ) = _ownerAndBatchHeadOf(tokenId); return owner; }
40,228
11
// padding with '='
switch mod(mload(data), 3)
switch mod(mload(data), 3)
5,834
116
// MAX_SUPPLY = MAX_INT256 / MAX_RATE
uint256 private constant MAX_SUPPLY = ~(uint256(1) << 255) / MAX_RATE;
uint256 private constant MAX_SUPPLY = ~(uint256(1) << 255) / MAX_RATE;
11,323
10
// TODO: check if attacker and defender have enough amount of tokens
require(IERC20(token).transfer(owner(), _attackerPoint / 10 + _defenderPoint / 10), "Transfer failed"); players[msg.sender][_attackerCountry].soldiers -= _attackerPoint; players[_enemy][_enemyCountry].soldiers -= _defenderPoint; if ( players[msg.sender][_attackerCountry].so...
require(IERC20(token).transfer(owner(), _attackerPoint / 10 + _defenderPoint / 10), "Transfer failed"); players[msg.sender][_attackerCountry].soldiers -= _attackerPoint; players[_enemy][_enemyCountry].soldiers -= _defenderPoint; if ( players[msg.sender][_attackerCountry].so...
16,824
10
// The highest ratio of the new price to the anchor price that will still trigger the price to be updated
uint public immutable upperBoundAnchorRatio;
uint public immutable upperBoundAnchorRatio;
12,300
138
// calculate attributes for an animation tag based of the animation mode /
function _calcAttributes(uint256 mode) internal pure returns (string memory) { uint8[3] memory counts = [1,2,25]; string memory repeat = string(abi.encodePacked( 'repeatCount="', mode <= 4 ? 'indefinite' : uint256(counts[mode-5]).toString(), '" ' )); ...
function _calcAttributes(uint256 mode) internal pure returns (string memory) { uint8[3] memory counts = [1,2,25]; string memory repeat = string(abi.encodePacked( 'repeatCount="', mode <= 4 ? 'indefinite' : uint256(counts[mode-5]).toString(), '" ' )); ...
23,786
154
// Verify a signed authorization for a decrease in the allowancegranted to the spender and execute if valid owner Token owner's address (Authorizer) spender Spender's address decrement Amount of decrease in allowance validAfterThe time after which this is valid (unix time) validBefore The time before which this is vali...
function _decreaseAllowanceWithAuthorization( address owner, address spender, uint256 decrement, uint256 validAfter, uint256 validBefore, bytes32 nonce, uint8 v, bytes32 r, bytes32 s
function _decreaseAllowanceWithAuthorization( address owner, address spender, uint256 decrement, uint256 validAfter, uint256 validBefore, bytes32 nonce, uint8 v, bytes32 r, bytes32 s
10,579
75
// If the first 4 bytes don't match with the expected signature, we forward the revert reason.
if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) }
if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) }
20,569
17
// Cancels an auction unconditionally.
function _cancelAuction(address _nft, uint256 _tokenId, address _seller) internal { _removeAuction(_nft, _tokenId); _transfer(_seller, _seller, _nft, _tokenId); emit AuctionCancelled(_tokenId); }
function _cancelAuction(address _nft, uint256 _tokenId, address _seller) internal { _removeAuction(_nft, _tokenId); _transfer(_seller, _seller, _nft, _tokenId); emit AuctionCancelled(_tokenId); }
5,838
36
// ERC20 standard function
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){ require(_to != 0x0); require(_value <= allowed[_from][msg.sender]); require(_value <= balances[_from]); require(validateTransferAmount(_from,_value)); balances[_from] = balances[...
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){ require(_to != 0x0); require(_value <= allowed[_from][msg.sender]); require(_value <= balances[_from]); require(validateTransferAmount(_from,_value)); balances[_from] = balances[...
2,409
78
// Keep a mapping of all the reserved token IDs we're set to clear.
bool[] memory clearedTokenIds = new bool[](100); unchecked {
bool[] memory clearedTokenIds = new bool[](100); unchecked {
14,780
145
// Swap half WETH for DAI
uint256 _weth = IERC20(weth).balanceOf(address(this)); if (_weth > 0) {
uint256 _weth = IERC20(weth).balanceOf(address(this)); if (_weth > 0) {
36,751
149
// liquidate tokens for ETH when the contract reaches 100k tokens by default
uint256 public liquidateTokensAtAmount = 100000 * (10**18);
uint256 public liquidateTokensAtAmount = 100000 * (10**18);
43,032
11
// airdrop NFT
function airdropNFTFixed(address[] calldata _address, uint256 num) external onlyOwner
function airdropNFTFixed(address[] calldata _address, uint256 num) external onlyOwner
4,774
50
// Владелец должен вызвать эту функцию, чтобы присвоить начальный баланс /
function initialSupply(address _toAddress) external onlyOwner { require(!isInitialSupplied); // Создаем начальный баланс токенов на кошельке balances[_toAddress] = totalSupply; isInitialSupplied = true; }
function initialSupply(address _toAddress) external onlyOwner { require(!isInitialSupplied); // Создаем начальный баланс токенов на кошельке balances[_toAddress] = totalSupply; isInitialSupplied = true; }
37,256
206
// _secret_registry_address The address of SecretRegistry that's used by all/ TokenNetworks created by this contract/_chain_id EIP-155 Chain-ID of the chain where this contract is deployed/_settlement_timeout_min The shortest settlement period (in number of blocks)/ that can be chosen at the channel opening/_settlement...
constructor( address _secret_registry_address, uint256 _chain_id, uint256 _settlement_timeout_min, uint256 _settlement_timeout_max, uint256 _max_token_networks ) public
constructor( address _secret_registry_address, uint256 _chain_id, uint256 _settlement_timeout_min, uint256 _settlement_timeout_max, uint256 _max_token_networks ) public
14,928
15
// Returns the user-level last checkpointed epoch. user - The address of the user to query. /
function getUserLastEpochCheckpointed(address user) external view override returns (uint256) { return _userState[user].lastEpochCheckpointed; }
function getUserLastEpochCheckpointed(address user) external view override returns (uint256) { return _userState[user].lastEpochCheckpointed; }
29,045
29
// this function is defined in a child contract ///
function withdraw( bytes calldata _proof, bytes32 _root, bytes32 _nullifierHash, address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund
function withdraw( bytes calldata _proof, bytes32 _root, bytes32 _nullifierHash, address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund
22,621
64
// Keep track of total amount of funding raised and passed KYC (available + withdrawn)
uint256 public raisedFunding;
uint256 public raisedFunding;
23,922
2
// For locking in case there are less than `_editionLimit` guests
bool private _editionEnded; constructor( string memory tokenName_, string memory tokenSymbol_, uint256 invitedGuests_ ) ERC1238(tokenName_, tokenSymbol_) { _editionLimit = invitedGuests_; _editionEnded = false; }
bool private _editionEnded; constructor( string memory tokenName_, string memory tokenSymbol_, uint256 invitedGuests_ ) ERC1238(tokenName_, tokenSymbol_) { _editionLimit = invitedGuests_; _editionEnded = false; }
37,897
240
// solhint-disable-next-line no-empty-blocks
for (; wallet[i] != _tokenId; i++) { // not the pepe we are looking for }
for (; wallet[i] != _tokenId; i++) { // not the pepe we are looking for }
11,340
101
// WARNING: IRREVERSIBLE OPERATION Relinquishing controller right will lose control over pool actions
function setController(address _controller) external onlyGov { bpt.setController(_controller); }
function setController(address _controller) external onlyGov { bpt.setController(_controller); }
41,236
89
// Get the verifying key
VerifyingKey memory vk = vkRegistry.getSubsidyVk( maci.stateTreeDepth(), intStateTreeDepth, voteOptionTreeDepth );
VerifyingKey memory vk = vkRegistry.getSubsidyVk( maci.stateTreeDepth(), intStateTreeDepth, voteOptionTreeDepth );
35,319
13
// Overridden version of the {Governor-_cancel} function to cancel the timelocked proposal if it as alreadybeen queued. /
function _cancel( address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash ) internal virtual override returns (uint256) { uint256 proposalId = super._cancel(targets, values, calldatas, descriptionHash); uint256 eta = p...
function _cancel( address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash ) internal virtual override returns (uint256) { uint256 proposalId = super._cancel(targets, values, calldatas, descriptionHash); uint256 eta = p...
40,640
27
// Bonus logic contract
interface Nest_3_TokenAbonus { // View next bonus time function getNextTime() external view returns (uint256); // View bonus period function checkTimeLimit() external view returns (uint256); // View duration of triggering calculation of bonus function checkGetAbonusTimeLimit() external view re...
interface Nest_3_TokenAbonus { // View next bonus time function getNextTime() external view returns (uint256); // View bonus period function checkTimeLimit() external view returns (uint256); // View duration of triggering calculation of bonus function checkGetAbonusTimeLimit() external view re...
26,611
17
// Gets the token namereturn string representing the token name /
function name() external pure returns (string memory _name) { return tokenName; }
function name() external pure returns (string memory _name) { return tokenName; }
31,265
230
// 更新目标账号信息
Account memory account = fi.accounts[msg.sender]; account.balance -= _toUInt128(amount); fi.accounts[msg.sender] = account;
Account memory account = fi.accounts[msg.sender]; account.balance -= _toUInt128(amount); fi.accounts[msg.sender] = account;
81,706
12
// If allowance is infinite, don't decrease it to save on gas (breaks with EIP-20).
if (spenderAllowance != type(uint256).max) { require(spenderAllowance >= amount, "ERC20: allowance too low"); allowance[from][msg.sender] = spenderAllowance - amount; // Underflow is checked }
if (spenderAllowance != type(uint256).max) { require(spenderAllowance >= amount, "ERC20: allowance too low"); allowance[from][msg.sender] = spenderAllowance - amount; // Underflow is checked }
42,924
24
// Verify provided prev bisection.
bytes32 prevHash = ChallengeLib.computeBisectionHash(prevChallengedSegmentStart, prevChallengedSegmentLength); require(prevHash == bisectionHash, BIS_PREV);
bytes32 prevHash = ChallengeLib.computeBisectionHash(prevChallengedSegmentStart, prevChallengedSegmentLength); require(prevHash == bisectionHash, BIS_PREV);
11,294
37
// Each address can exist in the list exactly once.
uint i = 0; while(inputAddresses[i] != _addr) { i++; }
uint i = 0; while(inputAddresses[i] != _addr) { i++; }
62,767
399
// set lease lock on transfer from provenance to another
uint256 lockDuration = getLockDuration(tokenId); leases[tokenId] = Lease( lease.provenance, uint48(block.timestamp + lockDuration) );
uint256 lockDuration = getLockDuration(tokenId); leases[tokenId] = Lease( lease.provenance, uint48(block.timestamp + lockDuration) );
72,415
3
// Sell all of this contract's `fromTokenAddress` token balance.
(uint256 boughtAmount,) = IBalancerPool(poolAddress).swapExactAmountIn( fromTokenAddress, // tokenIn fromTokenBalance, // tokenAmountIn toTokenAddress, // tokenOut amount, // minAmountOut uint256(-1) // maxPrice );
(uint256 boughtAmount,) = IBalancerPool(poolAddress).swapExactAmountIn( fromTokenAddress, // tokenIn fromTokenBalance, // tokenAmountIn toTokenAddress, // tokenOut amount, // minAmountOut uint256(-1) // maxPrice );
29,799
471
// Calculates fee growth between a tick range tick Current tick tickLower Lower tick of range tickUpper Upper tick of rangereturn feeGrowthInside0X128 Fee growth of token 0 inside ticksreturn feeGrowthInside1X128 Fee growth of token 1 inside ticks /
function getFeeGrowthInsideTicks( int24 tick, int24 tickLower, int24 tickUpper ) internal view returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128)
function getFeeGrowthInsideTicks( int24 tick, int24 tickLower, int24 tickUpper ) internal view returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128)
15,579
14
// expmods[9] = point^(trace_length / 32).
mstore(0x4f40, expmod(point, div(/*trace_length*/ mload(0x80), 32), PRIME))
mstore(0x4f40, expmod(point, div(/*trace_length*/ mload(0x80), 32), PRIME))
31,272
15
// emit DividendWithdrawn(user, _withdrawableDividend, to);
(bool success,) = account.call{value: _withdrawableDividend}("");
(bool success,) = account.call{value: _withdrawableDividend}("");
28,889
8
// This function transfer the adminship of the contract to _newAdmin_newAdmin The new admin of the contract/
function transferAdminship(address _newAdmin) onlyAdmin public { //Admin can be transfered admin = _newAdmin; TransferAdminship(admin); }
function transferAdminship(address _newAdmin) onlyAdmin public { //Admin can be transfered admin = _newAdmin; TransferAdminship(admin); }
12,332
80
// Provides liquidity to the ETRNL/AVAX pair on Trader Joe for the Eternal Token contract. contractBalance The contract's ETRNL balance that was transferred to the treasury Requirements:- There cannot already be a liquidity swap in progress- Automatic liquidity provision must be enabled- Caller can only be the Eternal ...
function provideLiquidity(uint256 contractBalance) external override activityHalted { require(_msgSender() == address(eternal), "Only callable by ETRNL contract"); require(eternalStorage.getBool(entity, autoLiquidityProvision), "Auto-liquidity is disabled"); _provideLiquidity(contractBalanc...
function provideLiquidity(uint256 contractBalance) external override activityHalted { require(_msgSender() == address(eternal), "Only callable by ETRNL contract"); require(eternalStorage.getBool(entity, autoLiquidityProvision), "Auto-liquidity is disabled"); _provideLiquidity(contractBalanc...
7,287
72
// Internal function to mint a new tokenReverts if the given token ID already exists to The address that will own the minted token tokenId uint256 ID of the token to be minted /
function _mint(address to, uint256 tokenId) internal { require(to != address(0)); require(!_exists(tokenId)); _tokenOwner[tokenId] = to; _ownedTokensCount[to].increment(); emit Transfer(address(0), to, tokenId); }
function _mint(address to, uint256 tokenId) internal { require(to != address(0)); require(!_exists(tokenId)); _tokenOwner[tokenId] = to; _ownedTokensCount[to].increment(); emit Transfer(address(0), to, tokenId); }
12,334
122
// Returns the address of the original token owner if a token is currently on loan
mapping(uint256 => address) tokenOwnersOnLoan;
mapping(uint256 => address) tokenOwnersOnLoan;
50,564
86
// 배율 변경
function change_tokenReward(uint256 _tokenReward) public isOwner returns (bool success)
function change_tokenReward(uint256 _tokenReward) public isOwner returns (bool success)
28,056
4
// Increment the sold and bought amounts.
state.soldAmount = state.soldAmount.safeAdd(takerTokenFilledAmount); state.boughtAmount = state.boughtAmount.safeAdd(makerTokenFilledAmount);
state.soldAmount = state.soldAmount.safeAdd(takerTokenFilledAmount); state.boughtAmount = state.boughtAmount.safeAdd(makerTokenFilledAmount);
11,792
4
// Return the conversion rate from ERC-1155 to ERC-20, multiplied by 2112.
function getUnderlyingRate(uint) external view override returns (uint) { return 2**112; }
function getUnderlyingRate(uint) external view override returns (uint) { return 2**112; }
35,090
88
// calculate total amount, this includes promo code amount or discount phase amount
uint256 promoCodeBonusAmount = promoCodesContract.applyBonusAmount(msg.sender, purchasedAmount, _promoCode); uint256 discountPhaseBonusAmount = discountPhasesContract.calculateBonusAmount(purchasedAmount); uint256 discountStructBonusAmount = discountStructsContract.getBonus(msg.sender, purchasedAmount, msg.value)...
uint256 promoCodeBonusAmount = promoCodesContract.applyBonusAmount(msg.sender, purchasedAmount, _promoCode); uint256 discountPhaseBonusAmount = discountPhasesContract.calculateBonusAmount(purchasedAmount); uint256 discountStructBonusAmount = discountStructsContract.getBonus(msg.sender, purchasedAmount, msg.value)...
34,294
147
// A method to allow a stakeholder to check his bonus rewards. _stakeholder The stakeholder to check rewards for.return bonus_ Rewards of stakeholder /
function referBonusOf(address _stakeholder) public view returns (uint256 bonus_)
function referBonusOf(address _stakeholder) public view returns (uint256 bonus_)
58,553
4
// AccessControlStorage.Layout storage ac = AccessControlStorage.layout();
OwnableStorage.Layout storage os = OwnableStorage.layout(); require(msg.sender == os.owner, "setBaseCharMax: not owner"); BaseCharacterStorage.Layout storage l = BaseCharacterStorage.layout(); require(l.baseCharMaxSupply < 100_000, "setBaseCharMax: possible supply cannot be more than theoretical max");...
OwnableStorage.Layout storage os = OwnableStorage.layout(); require(msg.sender == os.owner, "setBaseCharMax: not owner"); BaseCharacterStorage.Layout storage l = BaseCharacterStorage.layout(); require(l.baseCharMaxSupply < 100_000, "setBaseCharMax: possible supply cannot be more than theoretical max");...
1,703
72
// Owner initates the transfer of the token to another account/_to The address for the token to be transferred to./_tokenId The ID of the Token that can be transferred if this call succeeds./Required for ERC-721 compliance.
function transfer( address _to, uint256 _tokenId
function transfer( address _to, uint256 _tokenId
24,232
39
// Withdraw without caring about rewards. EMERGENCY ONLY./pid The index of the pool. See `poolInfo`./to Receiver of the LP tokens.
function emergencyWithdraw(uint256 pid, address to) public { UserInfo storage user = userInfo[pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDebt = 0; IRewarder _rewarder = rewarder[pid]; if (address(_rewarder) != address(0)) { ...
function emergencyWithdraw(uint256 pid, address to) public { UserInfo storage user = userInfo[pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDebt = 0; IRewarder _rewarder = rewarder[pid]; if (address(_rewarder) != address(0)) { ...
10,373
15
// burn token
_totalSupplies[tokenId] -= amount; if (_totalSupplies[tokenId] == 0) { _allTokens.remove(tokenId); }
_totalSupplies[tokenId] -= amount; if (_totalSupplies[tokenId] == 0) { _allTokens.remove(tokenId); }
53,702
26
// call payEMI from payments
_payment.createEMI(msg.sender, _creator, _request.amount, _tenure); _request._state = payState.onEMI; _request._mode = payMode.payEMI;
_payment.createEMI(msg.sender, _creator, _request.amount, _tenure); _request._state = payState.onEMI; _request._mode = payMode.payEMI;
32,252
13
// ------------------------------------------------------------------------ Transfer the balance from token owner's account to to account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; }
function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; }
566
378
// sets the admin of the slashing pausing function percentage the new maximum slashable percentage /
function setMaxSlashablePercentage(uint256 percentage) external override onlySlashingAdmin { require(percentage <= PercentageMath.PERCENTAGE_FACTOR, 'INVALID_SLASHING_PERCENTAGE'); _maxSlashablePercentage = percentage; emit MaxSlashablePercentageChanged(percentage); }
function setMaxSlashablePercentage(uint256 percentage) external override onlySlashingAdmin { require(percentage <= PercentageMath.PERCENTAGE_FACTOR, 'INVALID_SLASHING_PERCENTAGE'); _maxSlashablePercentage = percentage; emit MaxSlashablePercentageChanged(percentage); }
75,438
39
// mapping that keeps track of last nft claim
mapping (address => uint) depositBlock;
mapping (address => uint) depositBlock;
4,982
36
// shows tradability of the contract
function Tradable() public view returns(bool) { return tradable; }
function Tradable() public view returns(bool) { return tradable; }
67,936
66
// Creates new token with token ID specified and assigns an ownership `_to` for this tokenUnsafe: doesn't execute `onERC721Received` on the receiver. Prefer the use of `saveMint` instead of `mint`.Should have a restricted access handled by the implementation_to an address to mint token to _tokenId ID of the token to mi...
function mint(address _to, uint256 _tokenId) external;
function mint(address _to, uint256 _tokenId) external;
42,722
145
// The function which performs the multi path swap. data Data required to perform swap. /
function multiSwap( Utils.SellData memory data ) public payable returns (uint256)
function multiSwap( Utils.SellData memory data ) public payable returns (uint256)
71,208
68
// if any account belongs to the excludedAccount transfer token
if (_isExcluded[sender]) { _tokenBalance[sender] = _tokenBalance[sender].sub(amount); }
if (_isExcluded[sender]) { _tokenBalance[sender] = _tokenBalance[sender].sub(amount); }
36,780
19
// Recoverer Role Functionality/ allows recovery of missent tokens (anytime) as well as recovery of un-distributed TBN once the Presale Stage has ended.
function recoverTokens(IERC20 token) external returns (bool);
function recoverTokens(IERC20 token) external returns (bool);
44,619
24
// Loop over children.
uint256 nodeIndex = (K * treeIndex) + i; uint256 nodeValue = nodes[nodeIndex]; if (currentDrawnNumber >= nodeValue) {
uint256 nodeIndex = (K * treeIndex) + i; uint256 nodeValue = nodes[nodeIndex]; if (currentDrawnNumber >= nodeValue) {
3,282
180
// Set Max Mint Amount
function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner() { maxMintAmount = _newmaxMintAmount; }
function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner() { maxMintAmount = _newmaxMintAmount; }
17,681