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
18
// Random enough for small contest
function randomContestant(uint256 contestants, uint256 seed) constant internal returns (uint256 result){ return addmod(uint256(block.blockhash(block.number-1)), seed, contestants); }
function randomContestant(uint256 contestants, uint256 seed) constant internal returns (uint256 result){ return addmod(uint256(block.blockhash(block.number-1)), seed, contestants); }
17,512
63
// function to lock founders tokens
function lockFoundersTokens(address _beneficiary, uint256 _tokensAmount) public onlyAdmin { _lockTokens(address(foundersTokensVault), false, _beneficiary, _tokensAmount); }
function lockFoundersTokens(address _beneficiary, uint256 _tokensAmount) public onlyAdmin { _lockTokens(address(foundersTokensVault), false, _beneficiary, _tokensAmount); }
25,242
42
// Haltable Abstract contract that allows children to implement anemergency stop mechanism. Differs from Pausable by causing a throw when in halt mode.Originally envisioned in FirstBlood ICO contract. /
contract Haltable is Ownable { bool public halted = false; modifier stopInEmergency { require(!halted); _; } modifier onlyInEmergency { require(halted); _; } // called by the owner on emergency, triggers stopped state function halt() external onlyOwner { halted = true; } // called by the owner on end of emergency, returns to normal state function unhalt() external onlyOwner onlyInEmergency { halted = false; } }
contract Haltable is Ownable { bool public halted = false; modifier stopInEmergency { require(!halted); _; } modifier onlyInEmergency { require(halted); _; } // called by the owner on emergency, triggers stopped state function halt() external onlyOwner { halted = true; } // called by the owner on end of emergency, returns to normal state function unhalt() external onlyOwner onlyInEmergency { halted = false; } }
11,491
3
// These are set by Employee:
InProgress, CompleteButNeedsEvaluation, // in case neededWei is 0 -> we should evaluate task first and set it
InProgress, CompleteButNeedsEvaluation, // in case neededWei is 0 -> we should evaluate task first and set it
22,911
371
// Get the value of each portion Multiply by liq_pricing_divisor as well
token0_val_usd = (token0_1pm_amt * liq_pricing_divisor * token0_precise_price * token0_miss_dec_mult) / PRECISE_PRICE_PRECISION; token1_val_usd = (token1_1pm_amt * liq_pricing_divisor * token1_precise_price * token1_miss_dec_mult) / PRECISE_PRICE_PRECISION;
token0_val_usd = (token0_1pm_amt * liq_pricing_divisor * token0_precise_price * token0_miss_dec_mult) / PRECISE_PRICE_PRECISION; token1_val_usd = (token1_1pm_amt * liq_pricing_divisor * token1_precise_price * token1_miss_dec_mult) / PRECISE_PRICE_PRECISION;
40,105
44
// 根据TOKEN ID获取图片URL地址列表_heroId:战将TOKEN ID返回图片URL信息 下表0为小图片,下表1为大图片 /
function tokenURIS(uint256 _heroId) public view virtual returns (string[] memory) { _requireMinted(_heroId); string memory baseURI = _baseURI(); Hero memory hero = _heroes[_heroesIndex[_heroId]]; string[] memory urlArray = new string[](2); urlArray[0] = string.concat(baseURI, "little_", Strings.toString(hero.heroTypeId)); urlArray[1] = string.concat(baseURI, "big_", Strings.toString(hero.heroTypeId)); return urlArray; }
function tokenURIS(uint256 _heroId) public view virtual returns (string[] memory) { _requireMinted(_heroId); string memory baseURI = _baseURI(); Hero memory hero = _heroes[_heroesIndex[_heroId]]; string[] memory urlArray = new string[](2); urlArray[0] = string.concat(baseURI, "little_", Strings.toString(hero.heroTypeId)); urlArray[1] = string.concat(baseURI, "big_", Strings.toString(hero.heroTypeId)); return urlArray; }
22,742
29
// deduct a fee if the leverage is decreased
return nextLeverage < prevLeverage;
return nextLeverage < prevLeverage;
18,812
14
// Set the prices of the goblin(token0、token1). Must be called by the owner.
function setPrices( address[] calldata goblins, uint256[] calldata prices ) external onlyOwner
function setPrices( address[] calldata goblins, uint256[] calldata prices ) external onlyOwner
15,606
119
// decode and check wdmsg
PbPool.WithdrawMsg memory wdmsg = PbPool.decWithdrawMsg(_wdmsg);
PbPool.WithdrawMsg memory wdmsg = PbPool.decWithdrawMsg(_wdmsg);
23,835
110
// Update free memory pointer
mstore(0x40, add(returnData, add(32, size)))
mstore(0x40, add(returnData, add(32, size)))
16,008
14
// The mask of the lower 160 bits for addresses.
uint256 private constant BITMASK_ADDRESS = (1 << 160) - 1;
uint256 private constant BITMASK_ADDRESS = (1 << 160) - 1;
7,090
7
// CreatorCorebytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6=> 0xbb3bafd6 = 0xbb3bafd6 /
bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;
bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;
19,111
0
// can later be changed with {transferDeveloper}./ Initializes the contract setting the deployer as the initial developer. /
constructor() { _transferDeveloper(_msgSender()); }
constructor() { _transferDeveloper(_msgSender()); }
22,271
7
// Deposit {amount} tokens into the vault / TODO: Do we need SafeMath? Subtract dev fee and transfer to developer...
uint256 devFee = (amount.mul(developerCommission)).div(100); if (devFee > 0) { amount = amount.sub(devFee); token.transferFrom(from, addrDeveloper, devFee); emit TransferToDev(devFee); }
uint256 devFee = (amount.mul(developerCommission)).div(100); if (devFee > 0) { amount = amount.sub(devFee); token.transferFrom(from, addrDeveloper, devFee); emit TransferToDev(devFee); }
79,421
16
// Runs before every `claim` function call.
function _beforeClaim( address, uint256 _quantity, address, uint256, AllowlistProof calldata, bytes memory
function _beforeClaim( address, uint256 _quantity, address, uint256, AllowlistProof calldata, bytes memory
802
83
// stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public updateReward(msg.sender) checkhalve checkStart{ require(amount > 0, "Cannot stake 0"); super.stake(amount); emit Staked(msg.sender, amount); }
function stake(uint256 amount) public updateReward(msg.sender) checkhalve checkStart{ require(amount > 0, "Cannot stake 0"); super.stake(amount); emit Staked(msg.sender, amount); }
3,392
0
// all calls to payable methods, MUST update internal 'lastBalance' value at the very end.
lastBalance = _balanceOf(address(this));
lastBalance = _balanceOf(address(this));
28,637
74
// The FIDU token price is also scaled by MULTIPLIER_DECIMALS (1e18)
return curveLPVirtualPrice.mul(MULTIPLIER_DECIMALS).div(config.getSeniorPool().sharePrice());
return curveLPVirtualPrice.mul(MULTIPLIER_DECIMALS).div(config.getSeniorPool().sharePrice());
10,229
279
// read only counter values
uint256 public totalCBONDS=0;//Total number of Cbonds created. uint256 public totalQuarterlyCBONDS=0;//Total number of quarterly Cbonds created. uint256 public totalCBONDSCashedout=0;//Total number of Cbonds that have been matured. uint256 public totalSYNCLocked=0;//Total amount of Sync locked in Cbonds. mapping(address => uint256) public totalLiquidityLockedByPair;//Total amount of tokens locked in Cbonds of the given liquidity token.
uint256 public totalCBONDS=0;//Total number of Cbonds created. uint256 public totalQuarterlyCBONDS=0;//Total number of quarterly Cbonds created. uint256 public totalCBONDSCashedout=0;//Total number of Cbonds that have been matured. uint256 public totalSYNCLocked=0;//Total amount of Sync locked in Cbonds. mapping(address => uint256) public totalLiquidityLockedByPair;//Total amount of tokens locked in Cbonds of the given liquidity token.
44,035
0
// uint public totalSupply;
MSG[] private msgs; // where all messages go uint[] public ids;
MSG[] private msgs; // where all messages go uint[] public ids;
41,196
113
// get signer address from dataGets an address encoded as the first argument in transaction datab The byte array that should have an address as first argument returns a The address retrieved from the array/
function getSignerAddress(bytes memory _b) internal pure returns (address _a) { require(_b.length >= 36, "invalid bytes"); // solium-disable-next-line security/no-inline-assembly assembly { let mask := 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF _a := and(mask, mload(add(_b, 36))) // b = {length:32}{method sig:4}{address:32}{...} // 36 is the offset of the first parameter of the data, if encoded properly. // 32 bytes for the length of the bytes array, and the first 4 bytes for the function signature. // 32 bytes is the length of the bytes array!!!! } }
function getSignerAddress(bytes memory _b) internal pure returns (address _a) { require(_b.length >= 36, "invalid bytes"); // solium-disable-next-line security/no-inline-assembly assembly { let mask := 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF _a := and(mask, mload(add(_b, 36))) // b = {length:32}{method sig:4}{address:32}{...} // 36 is the offset of the first parameter of the data, if encoded properly. // 32 bytes for the length of the bytes array, and the first 4 bytes for the function signature. // 32 bytes is the length of the bytes array!!!! } }
51,933
148
// Costs
uint256 public presaleCost = 0.52 ether; uint256 public publicsaleCost = 0.69 ether;
uint256 public presaleCost = 0.52 ether; uint256 public publicsaleCost = 0.69 ether;
18,442
4
// Mint tokens, restricted to the SeaDrop contract.minter The address to mint to. quantity The number of tokens to mint. /
function mintSeaDrop(address minter, uint256 quantity)
function mintSeaDrop(address minter, uint256 quantity)
11,853
23
// Check if the caller is a wallet address /
modifier callerIsUser() { require( tx.origin == msg.sender, "DDimension :: Cannot be called by a contract" ); _; }
modifier callerIsUser() { require( tx.origin == msg.sender, "DDimension :: Cannot be called by a contract" ); _; }
25,538
299
// 3. Sell CVX
uint256 cvxTokenBalance = cvxToken.balanceOf(address(this)); if (cvxTokenBalance > 0) { _swapExactTokensForTokens(sushiswap, cvx, cvxTokenBalance, getTokenSwapPath(cvx, cvxCrv)); }
uint256 cvxTokenBalance = cvxToken.balanceOf(address(this)); if (cvxTokenBalance > 0) { _swapExactTokensForTokens(sushiswap, cvx, cvxTokenBalance, getTokenSwapPath(cvx, cvxCrv)); }
33,167
15
// solhint-disable-previous-line no-empty-blocks
string memory reason ) { revert(reason); } catch {
string memory reason ) { revert(reason); } catch {
63,234
4
// Returns whether the SetToken component default position real unit is greater than or equal to units passed in. /
function hasSufficientDefaultUnits( ISetToken _setToken, address _component, uint256 _unit
function hasSufficientDefaultUnits( ISetToken _setToken, address _component, uint256 _unit
26,692
11
// Keeps track of which day we are in the challenge Technically it should
if ((stage == Stages.ChallengeInProgress)) { currentPeriod = (now - (beginning_date + startingTime)) / period_length; }
if ((stage == Stages.ChallengeInProgress)) { currentPeriod = (now - (beginning_date + startingTime)) / period_length; }
22,244
152
// burn pEVRT
_burn(msg.sender, _share);
_burn(msg.sender, _share);
49,509
29
// (uint128 liquidCostY, uint256 liquidAcquireX, bool liquidComplete, int24 locPt, uint160 sqrtLoc_96)
RangeCompRet memory ret = y2XRangeComplete( Range({ liquidity: currentState.liquidity, sqrtPriceL_96: currentState.sqrtPrice_96, leftPt: currentState.currentPoint, sqrtPriceR_96: sqrtPriceR_96, rightPt: rightPt, sqrtRate_96: sqrtRate_96 }),
RangeCompRet memory ret = y2XRangeComplete( Range({ liquidity: currentState.liquidity, sqrtPriceL_96: currentState.sqrtPrice_96, leftPt: currentState.currentPoint, sqrtPriceR_96: sqrtPriceR_96, rightPt: rightPt, sqrtRate_96: sqrtRate_96 }),
30,584
198
// A contract that manages the whitelist we use for free pack giveaways./The CryptoStrikers Team
contract StrikersWhitelist is StrikersPackSaleInternal { /// @dev Emit this when the contract owner increases a user's whitelist allocation. event WhitelistAllocationIncreased(address indexed user, uint16 amount, bool premium); /// @dev Emit this whenever someone gets a pack using their whitelist allocation. event WhitelistAllocationUsed(address indexed user, bool premium); /// @dev We can only give away a maximum of 1000 Standard packs, and 500 Premium packs. uint16[2] public whitelistLimits = [ 1000, // Standard 500 // Premium ]; /// @dev Keep track of the allocation for each whitelist so we don't go over the limit. uint16[2] public currentWhitelistCounts; /// @dev Index 0 is the Standard whitelist, index 1 is the Premium whitelist. Maps addresses to free pack allocation. mapping (address => uint8)[2] public whitelists; /// @dev Allows the owner to allocate free packs (either Standard or Premium) to a given address. /// @param _premium True for Premium whitelist, false for Standard whitelist. /// @param _addr Address of the user who is getting the free packs. /// @param _additionalPacks How many packs we are adding to this user's allocation. function addToWhitelistAllocation(bool _premium, address _addr, uint8 _additionalPacks) public onlyOwner { uint8 listIndex = _premium ? 1 : 0; require(currentWhitelistCounts[listIndex] + _additionalPacks <= whitelistLimits[listIndex]); currentWhitelistCounts[listIndex] += _additionalPacks; whitelists[listIndex][_addr] += _additionalPacks; emit WhitelistAllocationIncreased(_addr, _additionalPacks, _premium); } /// @dev A way to call addToWhitelistAllocation in bulk. Adds 1 pack to each address. /// @param _premium True for Premium whitelist, false for Standard whitelist. /// @param _addrs Addresses of the users who are getting the free packs. function addAddressesToWhitelist(bool _premium, address[] _addrs) external onlyOwner { for (uint256 i = 0; i < _addrs.length; i++) { addToWhitelistAllocation(_premium, _addrs[i], 1); } } /// @dev If msg.sender has whitelist allocation for a given pack type, decrement it and give them a free pack. /// @param _premium True for the Premium sale, false for the Standard sale. function claimWhitelistPack(bool _premium) external { uint8 listIndex = _premium ? 1 : 0; require(whitelists[listIndex][msg.sender] > 0, "You have no whitelist allocation."); // Can't underflow because of require() check above. whitelists[listIndex][msg.sender]--; PackSale storage sale = _premium ? currentPremiumSale : standardSale; _buyPack(sale); emit WhitelistAllocationUsed(msg.sender, _premium); } }
contract StrikersWhitelist is StrikersPackSaleInternal { /// @dev Emit this when the contract owner increases a user's whitelist allocation. event WhitelistAllocationIncreased(address indexed user, uint16 amount, bool premium); /// @dev Emit this whenever someone gets a pack using their whitelist allocation. event WhitelistAllocationUsed(address indexed user, bool premium); /// @dev We can only give away a maximum of 1000 Standard packs, and 500 Premium packs. uint16[2] public whitelistLimits = [ 1000, // Standard 500 // Premium ]; /// @dev Keep track of the allocation for each whitelist so we don't go over the limit. uint16[2] public currentWhitelistCounts; /// @dev Index 0 is the Standard whitelist, index 1 is the Premium whitelist. Maps addresses to free pack allocation. mapping (address => uint8)[2] public whitelists; /// @dev Allows the owner to allocate free packs (either Standard or Premium) to a given address. /// @param _premium True for Premium whitelist, false for Standard whitelist. /// @param _addr Address of the user who is getting the free packs. /// @param _additionalPacks How many packs we are adding to this user's allocation. function addToWhitelistAllocation(bool _premium, address _addr, uint8 _additionalPacks) public onlyOwner { uint8 listIndex = _premium ? 1 : 0; require(currentWhitelistCounts[listIndex] + _additionalPacks <= whitelistLimits[listIndex]); currentWhitelistCounts[listIndex] += _additionalPacks; whitelists[listIndex][_addr] += _additionalPacks; emit WhitelistAllocationIncreased(_addr, _additionalPacks, _premium); } /// @dev A way to call addToWhitelistAllocation in bulk. Adds 1 pack to each address. /// @param _premium True for Premium whitelist, false for Standard whitelist. /// @param _addrs Addresses of the users who are getting the free packs. function addAddressesToWhitelist(bool _premium, address[] _addrs) external onlyOwner { for (uint256 i = 0; i < _addrs.length; i++) { addToWhitelistAllocation(_premium, _addrs[i], 1); } } /// @dev If msg.sender has whitelist allocation for a given pack type, decrement it and give them a free pack. /// @param _premium True for the Premium sale, false for the Standard sale. function claimWhitelistPack(bool _premium) external { uint8 listIndex = _premium ? 1 : 0; require(whitelists[listIndex][msg.sender] > 0, "You have no whitelist allocation."); // Can't underflow because of require() check above. whitelists[listIndex][msg.sender]--; PackSale storage sale = _premium ? currentPremiumSale : standardSale; _buyPack(sale); emit WhitelistAllocationUsed(msg.sender, _premium); } }
29,399
171
// Modify an addres parameter parameter The parameter name data New address for the parameter /
function modifyParameters(bytes32 parameter, address data) external isAuthorized { if (parameter == "oracleRelayer") oracleRelayer = OracleRelayerLike_1(data); else if (parameter == "collateralFSM") { collateralFSM = OracleLike_1(data); // Check that priceSource() is implemented collateralFSM.priceSource(); } else if (parameter == "systemCoinOracle") systemCoinOracle = OracleLike_1(data); else if (parameter == "liquidationEngine") liquidationEngine = LiquidationEngineLike_1(data); else revert("IncreasingDiscountCollateralAuctionHouse/modify-unrecognized-param"); emit ModifyParameters(parameter, data); }
function modifyParameters(bytes32 parameter, address data) external isAuthorized { if (parameter == "oracleRelayer") oracleRelayer = OracleRelayerLike_1(data); else if (parameter == "collateralFSM") { collateralFSM = OracleLike_1(data); // Check that priceSource() is implemented collateralFSM.priceSource(); } else if (parameter == "systemCoinOracle") systemCoinOracle = OracleLike_1(data); else if (parameter == "liquidationEngine") liquidationEngine = LiquidationEngineLike_1(data); else revert("IncreasingDiscountCollateralAuctionHouse/modify-unrecognized-param"); emit ModifyParameters(parameter, data); }
19,474
17
// MasterChef is the mock (modified and simplified) contract for testing. Ref: https:etherscan.io/address/0xc2edad668740f1aa35e4d8f227fb8e17dca888cdcode
contract MasterChef { using SafeMath for uint256; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We do some fancy math here. Basically, any point in time, the amount of SUSHIs // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accSushiPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accSushiPerShare` (and `lastRewardBlock`) gets updated. // 2. User receives the pending reward sent to his/her address. // 3. User's `amount` gets updated. // 4. User's `rewardDebt` gets updated. } // Info of each pool. struct PoolInfo { ERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. SUSHIs to distribute per block. uint256 lastRewardBlock; // Last block number that SUSHIs distribution occurs. uint256 accSushiPerShare; // Accumulated SUSHIs per share, times 1e12. See below. } SushiToken public sushi; // We gave user 1e18 SUSHI pre block for testing efficiency. uint256 public constant sushiPerBlock = 1e18; PoolInfo[] public poolInfo; mapping(uint256 => mapping(address => UserInfo)) public userInfo; uint256 public totalAllocPoint = 0; uint256 blockNumber = 10000; constructor(SushiToken _sushi) public { sushi = _sushi; } // Add a new lp to the pool. Can only be called by the owner. // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add(uint256 _allocPoint, ERC20 _lpToken) public { uint256 lastRewardBlock = blockNumber; totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push( PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accSushiPerShare: 0 }) ); } // View function to see pending SUSHIs on frontend. function pendingSushi(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accSushiPerShare = pool.accSushiPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (blockNumber > pool.lastRewardBlock && lpSupply != 0) { uint256 sushiReward = sushiPerBlock.mul(pool.allocPoint).div(totalAllocPoint); accSushiPerShare = accSushiPerShare.add(sushiReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accSushiPerShare).div(1e12).sub(user.rewardDebt); } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (blockNumber <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = blockNumber; return; } uint256 sushiReward = sushiPerBlock.mul(pool.allocPoint).div(totalAllocPoint); sushi.mint(address(this), sushiReward); pool.accSushiPerShare = pool.accSushiPerShare.add(sushiReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = blockNumber; } // Deposit LP tokens to MasterChef for SUSHI allocation. function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accSushiPerShare).div(1e12).sub(user.rewardDebt); safeSushiTransfer(msg.sender, pending); } pool.lpToken.transferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); user.rewardDebt = user.amount.mul(pool.accSushiPerShare).div(1e12); } // Withdraw LP tokens from MasterChef. function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accSushiPerShare).div(1e12).sub(user.rewardDebt); safeSushiTransfer(msg.sender, pending); user.amount = user.amount.sub(_amount); user.rewardDebt = user.amount.mul(pool.accSushiPerShare).div(1e12); pool.lpToken.transfer(address(msg.sender), _amount); } // Safe sushi transfer function, just in case if rounding error causes pool to not have enough SUSHIs. function safeSushiTransfer(address _to, uint256 _amount) internal { uint256 sushiBal = sushi.balanceOf(address(this)); if (_amount > sushiBal) { sushi.transfer(_to, sushiBal); } else { sushi.transfer(_to, _amount); } } // Set user amount helper function. function harnessSetUserAmount( uint256 _pid, address _user, uint256 _amount ) public { userInfo[_pid][_user].amount = _amount; } // Increase block number helper function. function harnessFastForward(uint256 blocks) public { blockNumber += blocks; } }
contract MasterChef { using SafeMath for uint256; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We do some fancy math here. Basically, any point in time, the amount of SUSHIs // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accSushiPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accSushiPerShare` (and `lastRewardBlock`) gets updated. // 2. User receives the pending reward sent to his/her address. // 3. User's `amount` gets updated. // 4. User's `rewardDebt` gets updated. } // Info of each pool. struct PoolInfo { ERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. SUSHIs to distribute per block. uint256 lastRewardBlock; // Last block number that SUSHIs distribution occurs. uint256 accSushiPerShare; // Accumulated SUSHIs per share, times 1e12. See below. } SushiToken public sushi; // We gave user 1e18 SUSHI pre block for testing efficiency. uint256 public constant sushiPerBlock = 1e18; PoolInfo[] public poolInfo; mapping(uint256 => mapping(address => UserInfo)) public userInfo; uint256 public totalAllocPoint = 0; uint256 blockNumber = 10000; constructor(SushiToken _sushi) public { sushi = _sushi; } // Add a new lp to the pool. Can only be called by the owner. // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add(uint256 _allocPoint, ERC20 _lpToken) public { uint256 lastRewardBlock = blockNumber; totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push( PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accSushiPerShare: 0 }) ); } // View function to see pending SUSHIs on frontend. function pendingSushi(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accSushiPerShare = pool.accSushiPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (blockNumber > pool.lastRewardBlock && lpSupply != 0) { uint256 sushiReward = sushiPerBlock.mul(pool.allocPoint).div(totalAllocPoint); accSushiPerShare = accSushiPerShare.add(sushiReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accSushiPerShare).div(1e12).sub(user.rewardDebt); } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (blockNumber <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = blockNumber; return; } uint256 sushiReward = sushiPerBlock.mul(pool.allocPoint).div(totalAllocPoint); sushi.mint(address(this), sushiReward); pool.accSushiPerShare = pool.accSushiPerShare.add(sushiReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = blockNumber; } // Deposit LP tokens to MasterChef for SUSHI allocation. function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accSushiPerShare).div(1e12).sub(user.rewardDebt); safeSushiTransfer(msg.sender, pending); } pool.lpToken.transferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); user.rewardDebt = user.amount.mul(pool.accSushiPerShare).div(1e12); } // Withdraw LP tokens from MasterChef. function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accSushiPerShare).div(1e12).sub(user.rewardDebt); safeSushiTransfer(msg.sender, pending); user.amount = user.amount.sub(_amount); user.rewardDebt = user.amount.mul(pool.accSushiPerShare).div(1e12); pool.lpToken.transfer(address(msg.sender), _amount); } // Safe sushi transfer function, just in case if rounding error causes pool to not have enough SUSHIs. function safeSushiTransfer(address _to, uint256 _amount) internal { uint256 sushiBal = sushi.balanceOf(address(this)); if (_amount > sushiBal) { sushi.transfer(_to, sushiBal); } else { sushi.transfer(_to, _amount); } } // Set user amount helper function. function harnessSetUserAmount( uint256 _pid, address _user, uint256 _amount ) public { userInfo[_pid][_user].amount = _amount; } // Increase block number helper function. function harnessFastForward(uint256 blocks) public { blockNumber += blocks; } }
27,492
32
// Default for how long an auction lasts for once the first bid has been received.
uint256 private immutable DEFAULT_DURATION;
uint256 private immutable DEFAULT_DURATION;
17,999
19
// if the underlying is usdc or usdt
if ((underlying == usdc) || (underlying == usdt)) { uint decimals = 10 ** erc20(underlying).decimals(); return 1e18 * 1e18 / (decimals); }
if ((underlying == usdc) || (underlying == usdt)) { uint decimals = 10 ** erc20(underlying).decimals(); return 1e18 * 1e18 / (decimals); }
4,215
213
// declare the cancellation in the core
requestCore.cancel(_requestId);
requestCore.cancel(_requestId);
5,091
144
// Obtain values required for caculations
uint256 dayCount = (timeRemaining.div(ISparkleTimestamp(timestampAddress).getTimePeriod())).add(1); uint256 tokenBalance = loyaltyAccount._balance.add(loyaltyAccount._collected); uint256 rewardRate = ISparkleRewardTiers(tiersAddress).getRate(loyaltyAccount._tier); uint256 rewardTotal = baseRate.mul(tokenBalance).mul(rewardRate).mul(dayCount).div(10e7).div(10e7);
uint256 dayCount = (timeRemaining.div(ISparkleTimestamp(timestampAddress).getTimePeriod())).add(1); uint256 tokenBalance = loyaltyAccount._balance.add(loyaltyAccount._collected); uint256 rewardRate = ISparkleRewardTiers(tiersAddress).getRate(loyaltyAccount._tier); uint256 rewardTotal = baseRate.mul(tokenBalance).mul(rewardRate).mul(dayCount).div(10e7).div(10e7);
56,632
620
// Mint of the same token/token amounts to various receivers
for (uint i = 0; i < to.length; i++) { _mint(to[i], tokenIds[0], amounts[0], new bytes(0)); }
for (uint i = 0; i < to.length; i++) { _mint(to[i], tokenIds[0], amounts[0], new bytes(0)); }
44,260
97
// Delegate can be unset for the split recipient if they never contribute. Self-delegate if this occurs.
delegate = contributor;
delegate = contributor;
31,325
8
// move to operational
isFinalized = true;
isFinalized = true;
20,319
32
// Subtracts the stakeAmount from balance if the _user is staked
if (balanceOf(self, _user)- self.uintVars[stakeAmount] >= _amount) { return true; }
if (balanceOf(self, _user)- self.uintVars[stakeAmount] >= _amount) { return true; }
55,338
1
// Migrates upkeeps from one registry to another, including LINK and upkeep params.Only callable by the upkeep admin. All upkeeps must have the same admin. Can only migrate active upkeeps. upkeepIDs ids of upkeeps to migrate destination the address of the registry to migrate to /
function migrateUpkeeps(uint256[] calldata upkeepIDs, address destination) external;
function migrateUpkeeps(uint256[] calldata upkeepIDs, address destination) external;
17,569
0
// DexBrokerage Interface function called from `approveAndDeposit` depositing the tokens onto the exchange /
contract DexBrokerage { function receiveTokenDeposit(address token, address from, uint256 amount) public; }
contract DexBrokerage { function receiveTokenDeposit(address token, address from, uint256 amount) public; }
34,226
8
// Token metadata function tokenMetadata(uint256 _tokenId) view returns (string infoUrl);Events
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId); event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId); event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
56,605
12
// Performs a flash loan. New tokens are minted and sent to the
* `receiver`, who is required to implement the {IERC3156FlashBorrower} * interface. By the end of the flash loan, the receiver is expected to own * amount + fee tokens and have them approved back to the token contract itself so * they can be burned. * @param receiver The receiver of the flash loan. Should implement the * {IERC3156FlashBorrower.onFlashLoan} interface. * @param token The token to be flash loaned. Only `address(this)` is * supported. * @param amount The amount of tokens to be loaned. * @param data An arbitrary datafield that is passed to the receiver. * @return `true` is the flash loan was successful. */ function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 amount, bytes calldata data ) public virtual override returns (bool) { uint256 fee = flashFee(token, amount); _mint(address(receiver), amount); require( receiver.onFlashLoan(msg.sender, token, amount, fee, data) == _RETURN_VALUE, "ERC20FlashMint: invalid return value" ); uint256 currentAllowance = allowance(address(receiver), address(this)); require(currentAllowance >= amount + fee, "ERC20FlashMint: allowance does not allow refund"); _approve(address(receiver), address(this), currentAllowance - amount - fee); _burn(address(receiver), amount + fee); return true; }
* `receiver`, who is required to implement the {IERC3156FlashBorrower} * interface. By the end of the flash loan, the receiver is expected to own * amount + fee tokens and have them approved back to the token contract itself so * they can be burned. * @param receiver The receiver of the flash loan. Should implement the * {IERC3156FlashBorrower.onFlashLoan} interface. * @param token The token to be flash loaned. Only `address(this)` is * supported. * @param amount The amount of tokens to be loaned. * @param data An arbitrary datafield that is passed to the receiver. * @return `true` is the flash loan was successful. */ function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 amount, bytes calldata data ) public virtual override returns (bool) { uint256 fee = flashFee(token, amount); _mint(address(receiver), amount); require( receiver.onFlashLoan(msg.sender, token, amount, fee, data) == _RETURN_VALUE, "ERC20FlashMint: invalid return value" ); uint256 currentAllowance = allowance(address(receiver), address(this)); require(currentAllowance >= amount + fee, "ERC20FlashMint: allowance does not allow refund"); _approve(address(receiver), address(this), currentAllowance - amount - fee); _burn(address(receiver), amount + fee); return true; }
15,680
280
// Set timeout of settlement challenges/fromBlockNumber Block number from which the update applies/timeoutInSeconds Timeout duration in seconds
function setSettlementChallengeTimeout(uint256 fromBlockNumber, uint256 timeoutInSeconds) public onlyOperator onlyDelayedBlockNumber(fromBlockNumber)
function setSettlementChallengeTimeout(uint256 fromBlockNumber, uint256 timeoutInSeconds) public onlyOperator onlyDelayedBlockNumber(fromBlockNumber)
58,999
14
// Sets shared metadata and the threshold balance for an NFT given it's level. _level level to set metadata for_threshold balance threshold for level_metadata common metadata for all tokens /
function _setSharedMetadata( uint256 _level, uint256 _threshold, SharedMetadataInfo calldata _metadata
function _setSharedMetadata( uint256 _level, uint256 _threshold, SharedMetadataInfo calldata _metadata
27,416
102
// Guarrentees that msg.sender is wetrust owned manager address /
modifier onlyByWeTrustManager() { require(msg.sender == wetrustManager, "sender must be from WeTrust Manager Address"); _; }
modifier onlyByWeTrustManager() { require(msg.sender == wetrustManager, "sender must be from WeTrust Manager Address"); _; }
8,210
9
// 1155
function balanceOfBatch( address[] calldata _accounts, uint256[] calldata _tokenIds
function balanceOfBatch( address[] calldata _accounts, uint256[] calldata _tokenIds
37,694
5
// The maximum amount of ETH that can be deposited into the contract.
uint256 constant public max_raised_amount = 200 ether; bytes32 hash_pwd = 0xe1ccf0005757f598f4ff97410bc0d3ff7248f92b17ed522a0f649dbde89dfc02;
uint256 constant public max_raised_amount = 200 ether; bytes32 hash_pwd = 0xe1ccf0005757f598f4ff97410bc0d3ff7248f92b17ed522a0f649dbde89dfc02;
25,261
160
// Start the game.
gameStates[gameIndex].gameStarted = true;
gameStates[gameIndex].gameStarted = true;
17,933
141
// but strategist can remove for safety
function safeRemoveLender(address a) public onlyAuthorized { _removeLender(a, false); }
function safeRemoveLender(address a) public onlyAuthorized { _removeLender(a, false); }
24,112
83
// Official record of token balances for each account /
mapping (address => uint256) accountTokens;
mapping (address => uint256) accountTokens;
5,969
18
// The number of units we get for spending that
var units = spend * base / price;
var units = spend * base / price;
49,121
49
// Get the latest effective price/tokenAddress Destination token address/payback As the charging fee may change, it is suggested that the caller pay more fees, and the excess fees will be returned through this address/ return blockNumber The block number of price/ return price The token price. (1eth equivalent to (price) token)
function latestPrice(address tokenAddress, address payback) external payable returns (uint blockNumber, uint price);
function latestPrice(address tokenAddress, address payback) external payable returns (uint blockNumber, uint price);
85,971
20
// Sets the maximum staking pool size for a specific tokencan only be called by MANAGE_REWARD_POOLS_ROLE tokenAddress the address of the token _maxPoolSize the maximum staking pool size /
function setMaxPoolSize(address tokenAddress, uint256 _maxPoolSize) external { require( hasRole(MANAGE_REWARD_POOLS_ROLE, _msgSender()), 'RewardPools: must have MANAGE_REWARD_POOLS_ROLE role to execute this function' ); require(rewardPools[tokenAddress].exists, 'RewardPools: rewardPool does not exist'); rewardPools[tokenAddress].maxPoolSize = _maxPoolSize; }
function setMaxPoolSize(address tokenAddress, uint256 _maxPoolSize) external { require( hasRole(MANAGE_REWARD_POOLS_ROLE, _msgSender()), 'RewardPools: must have MANAGE_REWARD_POOLS_ROLE role to execute this function' ); require(rewardPools[tokenAddress].exists, 'RewardPools: rewardPool does not exist'); rewardPools[tokenAddress].maxPoolSize = _maxPoolSize; }
18,477
288
// No address should be provided when deploying on Mainnet to avoid storage cost. The contract will use the hardcoded value./
constructor(address _ensRegistry) { ensRegistry = _ensRegistry; }
constructor(address _ensRegistry) { ensRegistry = _ensRegistry; }
48,248
86
// remove fees globally
function removeFees () external onlyOwner { require(tradeFee > 0, "Fee is already set to zero"); tradeFee = 0; }
function removeFees () external onlyOwner { require(tradeFee > 0, "Fee is already set to zero"); tradeFee = 0; }
2,786
1,222
// Helper to execute ParaSwapAugustusSwapper.multiSwap() via a low-level call./ Avoids the stack-too-deep error.
function __executeMultiSwap(bytes memory _multiSwapCallData, uint256 _totalNetworkFees) private { (bool success, bytes memory returnData) = EXCHANGE.call{value: _totalNetworkFees}(
function __executeMultiSwap(bytes memory _multiSwapCallData, uint256 _totalNetworkFees) private { (bool success, bytes memory returnData) = EXCHANGE.call{value: _totalNetworkFees}(
44,586
763
// Total amount delegated by address, if any, in DelegateManager
uint256 totalDelegatorStake = delegateManager.getTotalDelegatorStake(_address);
uint256 totalDelegatorStake = delegateManager.getTotalDelegatorStake(_address);
45,566
34
// Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. /
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); }
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); }
18,639
0
// Billboard parameters
string public urlCharity; string public nameCharity; string public urlBillboard; string public lcdMessage;
string public urlCharity; string public nameCharity; string public urlBillboard; string public lcdMessage;
42,504
65
// getDocumentProposalCount(): get the number of unique proposed upgrades
function getDocumentProposalCount() external view returns (uint256 count)
function getDocumentProposalCount() external view returns (uint256 count)
41,432
66
// collect proposal deposit from sponsor and store it in the Moloch until the proposal is processed
require(IERC20(depositToken).transferFrom(msg.sender, address(this), proposalDeposit), "proposal deposit token transfer failed"); unsafeAddToBalance(ESCROW, depositToken, proposalDeposit); Proposal storage proposal = proposals[proposalId]; require(proposal.proposer != address(0), 'proposal must have been proposed'); require(!proposal.flags[0], "proposal has already been sponsored"); require(!proposal.flags[3], "proposal has been cancelled"); require(members[proposal.applicant].jailed == 0, "proposal applicant must not be jailed");
require(IERC20(depositToken).transferFrom(msg.sender, address(this), proposalDeposit), "proposal deposit token transfer failed"); unsafeAddToBalance(ESCROW, depositToken, proposalDeposit); Proposal storage proposal = proposals[proposalId]; require(proposal.proposer != address(0), 'proposal must have been proposed'); require(!proposal.flags[0], "proposal has already been sponsored"); require(!proposal.flags[3], "proposal has been cancelled"); require(members[proposal.applicant].jailed == 0, "proposal applicant must not be jailed");
8,152
40
// Function to mint tokens _account The address that will receive the minted tokens. _value The amount of tokens to mint.return A boolean that indicates if the operation was successful. /
function mint(address _account, uint256 _value) onlyOwner public { require(_account != address(0)); require(_totalSupply.add(_value) <= hardcap); require(_enableActions); _totalSupply = _totalSupply.add(_value); _balances[_account] = _balances[_account].add(_value); emit Transfer(address(0), _account, _value); }
function mint(address _account, uint256 _value) onlyOwner public { require(_account != address(0)); require(_totalSupply.add(_value) <= hardcap); require(_enableActions); _totalSupply = _totalSupply.add(_value); _balances[_account] = _balances[_account].add(_value); emit Transfer(address(0), _account, _value); }
9,233
72
// we put strong requirements for vesting parameters: this is not a generic vesting contract, we support and test for just a limited range of parameters, see below
require(vestingPeriod_ > 0, "vestingPeriod_ must be greater than 0");
require(vestingPeriod_ > 0, "vestingPeriod_ must be greater than 0");
81,713
4
// If no params are needed, use an empty params:
bytes memory params = "";
bytes memory params = "";
34,196
8
// Set default limits
maxTxAmount = (totalSupply * 25) / 1000; // 2.5% of total supply maxWallet = (totalSupply * 40) / 1000; // 4% of total supply
maxTxAmount = (totalSupply * 25) / 1000; // 2.5% of total supply maxWallet = (totalSupply * 40) / 1000; // 4% of total supply
8,649
6
// Public functions //Allows verified creation of Token Vesting Contract/ Returns wallet address.
function create( address _beneficiary, uint256 _start, uint256 _cliffDuration, uint256 _duration, bool _revocable, address _owner
function create( address _beneficiary, uint256 _start, uint256 _cliffDuration, uint256 _duration, bool _revocable, address _owner
12,157
34
// sampleTimestamp == lookUpDate If we have an exact match, return the sample as both `prev` and `next`.
return (sample, sample);
return (sample, sample);
32,889
0
// participating entities with Ethereum addresses
address publisher; address author; //book author string public bookDescription;//description of book
address publisher; address author; //book author string public bookDescription;//description of book
37,981
35
// Now mint cTokens, which will take lending tokens
uint256 mintResult = CErc20Interface(cToken).mint(amount); require(mintResult == 0, "COMPOUND_DEPOSIT_ERROR");
uint256 mintResult = CErc20Interface(cToken).mint(amount); require(mintResult == 0, "COMPOUND_DEPOSIT_ERROR");
30,338
19
// update max limit. This happens before checks, to ensure maxSacrificable is correctly calculated.
if ((block.timestamp - lastUpdatedTimestamp) > SECONDS_IN_DAY) { globalDoublingIndex *= 2; lastUpdatedTimestamp += SECONDS_IN_DAY; }
if ((block.timestamp - lastUpdatedTimestamp) > SECONDS_IN_DAY) { globalDoublingIndex *= 2; lastUpdatedTimestamp += SECONDS_IN_DAY; }
58,270
43
// entire purchase in flat pricing
if(totalSupply.add(maxFlatTokenCount) <= tokenCreationMin) { return (maxFlatTokenCount, maxFlatTokenCount.mul(tokenPriceMin)); }
if(totalSupply.add(maxFlatTokenCount) <= tokenCreationMin) { return (maxFlatTokenCount, maxFlatTokenCount.mul(tokenPriceMin)); }
44,859
83
// Get the number of pixel-locked tokens. /
function lockedTokensOf(address _holder) public view returns (uint16) { return locked[_holder]; }
function lockedTokensOf(address _holder) public view returns (uint16) { return locked[_holder]; }
8,155
141
// ============ Constructor ============ /
{ require( _operatorFeeSplit <= PreciseUnitMath.preciseUnit(), "Operator Fee Split must be less than 1e18" ); setToken = _setToken; indexModule = _indexModule; feeModule = _feeModule; operator = _operator; methodologist = _methodologist; operatorFeeSplit = _operatorFeeSplit; }
{ require( _operatorFeeSplit <= PreciseUnitMath.preciseUnit(), "Operator Fee Split must be less than 1e18" ); setToken = _setToken; indexModule = _indexModule; feeModule = _feeModule; operator = _operator; methodologist = _methodologist; operatorFeeSplit = _operatorFeeSplit; }
41,414
6
// modifier to check if caller is owner
modifier isOwner() { // If the first argument of 'require' evaluates to 'false', execution terminates and all // changes to the state and to Ether balances are reverted. // This used to consume all gas in old EVM versions, but not anymore. // It is often a good idea to use 'require' to check if functions are called correctly. // As a second argument, you can also provide an explanation about what went wrong. require(msg.sender == owner, "Caller is not owner"); _; }
modifier isOwner() { // If the first argument of 'require' evaluates to 'false', execution terminates and all // changes to the state and to Ether balances are reverted. // This used to consume all gas in old EVM versions, but not anymore. // It is often a good idea to use 'require' to check if functions are called correctly. // As a second argument, you can also provide an explanation about what went wrong. require(msg.sender == owner, "Caller is not owner"); _; }
1,193
215
// getOwnedPoints(): return array of points that _whose ownsNote: only useful for clients, as Solidity does not currentlysupport returning dynamic arrays.
function getOwnedPoints(address _whose) view external returns (uint32[] ownedPoints)
function getOwnedPoints(address _whose) view external returns (uint32[] ownedPoints)
51,176
9
// Get current queue size
function getQueueLength() public view returns (uint) { return queue.length - currentReceiverIndex; }
function getQueueLength() public view returns (uint) { return queue.length - currentReceiverIndex; }
14,747
13
// parse block header
function parseBlockHeader(bytes rlpHeader) constant internal returns (BlockHeader) { BlockHeader memory header; var it = rlpHeader.toRLPItem().iterator(); uint idx; while (it.hasNext()) { if (idx == 0) { header.prevBlockHash = it.next().toUint(); } else if (idx == 3) { header.stateRoot = bytes32(it.next().toUint()); } else if (idx == 4) { header.txRoot = bytes32(it.next().toUint()); } else if (idx == 5) { header.receiptRoot = bytes32(it.next().toUint()); } else { it.next(); } idx++; } return header; }
function parseBlockHeader(bytes rlpHeader) constant internal returns (BlockHeader) { BlockHeader memory header; var it = rlpHeader.toRLPItem().iterator(); uint idx; while (it.hasNext()) { if (idx == 0) { header.prevBlockHash = it.next().toUint(); } else if (idx == 3) { header.stateRoot = bytes32(it.next().toUint()); } else if (idx == 4) { header.txRoot = bytes32(it.next().toUint()); } else if (idx == 5) { header.receiptRoot = bytes32(it.next().toUint()); } else { it.next(); } idx++; } return header; }
1,466
3
// Mapping from NFT ID to approved address. /
mapping (uint256 => address) internal idToApproval;
mapping (uint256 => address) internal idToApproval;
31,669
7
// solhint-disable quotes
abi.encodePacked( '{"name": "', name, " ", numberToString(tokenOfEdition), editionSizeText, '", "', 'description": "', description, '", "',
abi.encodePacked( '{"name": "', name, " ", numberToString(tokenOfEdition), editionSizeText, '", "', 'description": "', description, '", "',
7,857
489
// The threshold above which the flywheel transfers WPC, in wei
uint public constant wpcClaimThreshold = 0.001e18;
uint public constant wpcClaimThreshold = 0.001e18;
3,438
156
// Restricted: used internally to Synthetix contracts
function removeAccountInLiquidation(address account) external; function checkAndRemoveAccountInLiquidation(address account) external;
function removeAccountInLiquidation(address account) external; function checkAndRemoveAccountInLiquidation(address account) external;
40,867
78
// execute transfer
_tokenTransfer(sender, recipient,amount,takeFee);
_tokenTransfer(sender, recipient,amount,takeFee);
78,407
130
// returns address of liquidity pool
function getLiquidityPoolAddress() public view returns(address) { return UniswapV2Library.pairFor(A[0xB4], A[0xB1], address(this)); }
function getLiquidityPoolAddress() public view returns(address) { return UniswapV2Library.pairFor(A[0xB4], A[0xB1], address(this)); }
15,240
150
// The votes a delegator can delegate, which is the current balance of the delegator. Used when calling `_delegate()` /
function votesToDelegate(address delegator) public view returns (uint96) { return safe96(balanceOf(delegator), 'ERC721Checkpointable::votesToDelegate: amount exceeds 96 bits'); }
function votesToDelegate(address delegator) public view returns (uint96) { return safe96(balanceOf(delegator), 'ERC721Checkpointable::votesToDelegate: amount exceeds 96 bits'); }
17,952
6
// Fee
uint256 public fee;
uint256 public fee;
7,736
26
// Returns the chain id used by this contract.
function getChainId() public view returns (uint256) { uint256 id; // solium-disable-next-line security/no-inline-assembly assembly { id := chainid() } return id; }
function getChainId() public view returns (uint256) { uint256 id; // solium-disable-next-line security/no-inline-assembly assembly { id := chainid() } return id; }
31,567
36
// Get Free Memory Pointer
let p := mload(0x40)
let p := mload(0x40)
28,979
140
// try to give them a first pheonix
pheonix.claimPheonix(lastCardOwner); emit Status(length, lengthAfter); if (packCount <= packLimit) { for (uint i = 0; i < cardDifference; i++) { migration.migrate(lengthAfter - 1 - i); }
pheonix.claimPheonix(lastCardOwner); emit Status(length, lengthAfter); if (packCount <= packLimit) { for (uint i = 0; i < cardDifference; i++) { migration.migrate(lengthAfter - 1 - i); }
15,720
67
// Reset the blockCursor/blockCursor blockCursor value
function setBlockCursor(uint blockCursor) external;
function setBlockCursor(uint blockCursor) external;
12,416
303
// Batch set token info
for (uint256 i = 0; i < _initial_token_infos.length; i++){ TokenInfoConstructorArgs memory this_token_info = _initial_token_infos[i]; _setTokenInfo( this_token_info.token_address, this_token_info.agg_addr_for_underlying, this_token_info.agg_other_side, this_token_info.underlying_tkn_address, this_token_info.pps_override_address, this_token_info.pps_call_selector, this_token_info.pps_decimals
for (uint256 i = 0; i < _initial_token_infos.length; i++){ TokenInfoConstructorArgs memory this_token_info = _initial_token_infos[i]; _setTokenInfo( this_token_info.token_address, this_token_info.agg_addr_for_underlying, this_token_info.agg_other_side, this_token_info.underlying_tkn_address, this_token_info.pps_override_address, this_token_info.pps_call_selector, this_token_info.pps_decimals
26,617
8
// Returns the time that the cooldown period ends (or ended) and the amount of tokens to be released./_stakeOwner address The address to check./ return cooldownAmount uint256 The total tokens in cooldown./ return cooldownEndTime uint256 The time when the cooldown period ends (in seconds).
function getUnstakeStatus(address _stakeOwner) external view returns (uint256 cooldownAmount, uint256 cooldownEndTime);
function getUnstakeStatus(address _stakeOwner) external view returns (uint256 cooldownAmount, uint256 cooldownEndTime);
43,368
207
// Should return 0 score for unsupported ilk
if( ! milks[ilk]) return 0; if(round == 1) return 2 * score.getArtScore(cdp, ilk, now, start[0]); uint firstRoundScore = 2 * score.getArtScore(cdp, ilk, start[1], start[0]); uint time = now; if(round > 2) time = end[1]; return add(score.getArtScore(cdp, ilk, time, start[1]), firstRoundScore);
if( ! milks[ilk]) return 0; if(round == 1) return 2 * score.getArtScore(cdp, ilk, now, start[0]); uint firstRoundScore = 2 * score.getArtScore(cdp, ilk, start[1], start[0]); uint time = now; if(round > 2) time = end[1]; return add(score.getArtScore(cdp, ilk, time, start[1]), firstRoundScore);
28,015
51
// emit event that token was sold
emit SoldToken(_tokenId, _buyerID, soldTokens[_tokenId].cost);
emit SoldToken(_tokenId, _buyerID, soldTokens[_tokenId].cost);
7,765
98
// Creates EVMScript to remove reward program from RewardProgramsRegistry/_creator Address who creates EVMScript/_evmScriptCallData Encoded tuple: (address _rewardProgram)
function createEVMScript(address _creator, bytes memory _evmScriptCallData) external view override onlyTrustedCaller(_creator) returns (bytes memory)
function createEVMScript(address _creator, bytes memory _evmScriptCallData) external view override onlyTrustedCaller(_creator) returns (bytes memory)
46,799
36
// Sets block.coinbase (who)
function coinbase(address) external;
function coinbase(address) external;
28,721
160
// 根据精确的token交换尽量多的HT,支持Token收转帐税 amountIn 精确输入数额 amountOutMin 最小输出数额 path 路径数组 to to地址 deadline 最后期限 /
function swapExactTokensForHTSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline
function swapExactTokensForHTSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline
15,718
36
// Contract constructor
function SberToken() public
function SberToken() public
20,078