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
3
// calculates the exact elapsed months to the current day
if ( DateTime.getDay(issuedAt) >= DateTime.getDay(_now) && elapsedDuration > 0 ) { elapsedDuration = elapsedDuration.sub(1); }
if ( DateTime.getDay(issuedAt) >= DateTime.getDay(_now) && elapsedDuration > 0 ) { elapsedDuration = elapsedDuration.sub(1); }
6,619
213
// Feed your twig for instant growth
function Feed (uint _twigId) external payable { onlyTwigOwner(_twigId); require (msg.value >= minPrice*5, "$"); TwigsData[_twigId].fed = 1; for (uint g=0;g<GraftsData[_twigId].length;g++) { GraftsData[_twigId][g].stopTime = block.timestamp - 3600; } TotalDonationOwed += 9*(msg.value/10); }
function Feed (uint _twigId) external payable { onlyTwigOwner(_twigId); require (msg.value >= minPrice*5, "$"); TwigsData[_twigId].fed = 1; for (uint g=0;g<GraftsData[_twigId].length;g++) { GraftsData[_twigId][g].stopTime = block.timestamp - 3600; } TotalDonationOwed += 9*(msg.value/10); }
51,298
48
// Called by a system administrator to un-pause, returns to normal state /
function unpause() external onlySysAdmin whenPaused whenNotUpgraded { paused = false; emit ContractUnpaused(); }
function unpause() external onlySysAdmin whenPaused whenNotUpgraded { paused = false; emit ContractUnpaused(); }
48,737
157
// send dest tokens
if (destToken == ETH_TOKEN_ADDRESS) { destAddress.transfer(destAmount); } else {
if (destToken == ETH_TOKEN_ADDRESS) { destAddress.transfer(destAmount); } else {
80,993
255
// remainBatchs is the number of future batches that are part of the currently active lock
uint256 remainBatches = ((locker.lockingTime.add(locker.period*batchTime).sub(startTime))/batchTime).sub(_batchIndexToLockIn); uint256 batchesCountFromCurrent = remainBatches.add(_extendPeriod); require(batchesCountFromCurrent <= maxLockingBatches, "locking period exceeds the maximum allowed"); require(_extendPeriod > 0, "_extendPeriod must be > 0"); require((_batchIndexToLockIn.add(batchesCountFromCurrent)) <= batchesIndexCap, "_extendPeriod exceed max allowed batches");
uint256 remainBatches = ((locker.lockingTime.add(locker.period*batchTime).sub(startTime))/batchTime).sub(_batchIndexToLockIn); uint256 batchesCountFromCurrent = remainBatches.add(_extendPeriod); require(batchesCountFromCurrent <= maxLockingBatches, "locking period exceeds the maximum allowed"); require(_extendPeriod > 0, "_extendPeriod must be > 0"); require((_batchIndexToLockIn.add(batchesCountFromCurrent)) <= batchesIndexCap, "_extendPeriod exceed max allowed batches");
9,923
0
// Emitted when a contract is added to the locker. /
event LockerWasAdded( string locker );
event LockerWasAdded( string locker );
69,206
22
// Adjust the decimals of the fixed point number if needed to have 18 decimals.
uint256 _adjustedOverflow = (decimals == 18) ? _overflow : JBFixedPointNumber.adjustDecimals(_overflow, decimals, 18);
uint256 _adjustedOverflow = (decimals == 18) ? _overflow : JBFixedPointNumber.adjustDecimals(_overflow, decimals, 18);
14,269
14
// The mean for the normal distribution added
uint256 public noramlDistributionMean;
uint256 public noramlDistributionMean;
13,231
53
// Track original fees to bypass fees for charity account
uint256 private ORIG_TAX_FEE; uint256 private ORIG_BURN_FEE; uint256 private ORIG_CHARITY_FEE;
uint256 private ORIG_TAX_FEE; uint256 private ORIG_BURN_FEE; uint256 private ORIG_CHARITY_FEE;
16,187
54
// View function to see pending Token/_pid The index of the pool. See `poolInfo`./_user Address of user./ return pending SUSHI reward for a given user.
function pendingToken(uint256 _pid, address _user) public view returns (uint256 pending) { PoolInfo memory pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accToken1PerShare = pool.accToken1PerShare; uint256 lpSupply = IMasterChefV2(MASTERCHEF_V2).lpToken(_pid).balanceOf(MASTERCHEF_V2); if (block.timestamp > pool.lastRewardTime && lpSupply != 0) { uint256 time = block.timestamp.sub(pool.lastRewardTime); uint256 sushiReward = time.mul(rewardPerSecond); accToken1PerShare = accToken1PerShare.add(sushiReward.mul(ACC_TOKEN_PRECISION) / lpSupply); } pending = (user.amount.mul(accToken1PerShare) / ACC_TOKEN_PRECISION).sub(user.rewardDebt).add(user.unpaidRewards); }
function pendingToken(uint256 _pid, address _user) public view returns (uint256 pending) { PoolInfo memory pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accToken1PerShare = pool.accToken1PerShare; uint256 lpSupply = IMasterChefV2(MASTERCHEF_V2).lpToken(_pid).balanceOf(MASTERCHEF_V2); if (block.timestamp > pool.lastRewardTime && lpSupply != 0) { uint256 time = block.timestamp.sub(pool.lastRewardTime); uint256 sushiReward = time.mul(rewardPerSecond); accToken1PerShare = accToken1PerShare.add(sushiReward.mul(ACC_TOKEN_PRECISION) / lpSupply); } pending = (user.amount.mul(accToken1PerShare) / ACC_TOKEN_PRECISION).sub(user.rewardDebt).add(user.unpaidRewards); }
8,101
176
// purchase tokens by sending funds directly to the contract
function () payable public { require(getCodeSize(msg.sender) == 0); // call funding function with a blank referrer fund(address(0x0000000000000000000000000000000000000000)); }
function () payable public { require(getCodeSize(msg.sender) == 0); // call funding function with a blank referrer fund(address(0x0000000000000000000000000000000000000000)); }
36,069
12
// Returns the number of reserved gods left with the supplyreturn index current index of reserved godsreturn supply max supply of reserved gods /
function reservedGodsCurrentIndexAndSupply() public view onlyRole(GENESIS_ROLE) returns (uint256 index, uint256 supply)
function reservedGodsCurrentIndexAndSupply() public view onlyRole(GENESIS_ROLE) returns (uint256 index, uint256 supply)
51,012
73
// Whether a limit is set for users
bool public userLimit;
bool public userLimit;
18,363
21
// On Exipry
if (nft.due_date + (2 days) < timestamp) {
if (nft.due_date + (2 days) < timestamp) {
6,296
86
// Allow LINK-A Join to modify Vat registry
VatAbstract(MCD_VAT).rely(MCD_JOIN_LINK_A);
VatAbstract(MCD_VAT).rely(MCD_JOIN_LINK_A);
61,422
4
// Convert a bound to a BPT price ratio bound - The bound percentage. weight - The current normalized token weight. isLowerBound - A flag indicating whether this is for a lower bound. /
function calcAdjustedBound( uint256 bound, uint256 weight, bool isLowerBound
function calcAdjustedBound( uint256 bound, uint256 weight, bool isLowerBound
18,859
95
// fees are setup so they can not exceed 30% in total and specific limits for each one.
require(liquidityFee <= 5); require(marketingFee <= 5); require(dividendFee <= 20); _liquidityFee = liquidityFee; _marketingFee = marketingFee; _dividendRewardsFee = dividendFee; _totalFee = liquidityFee + marketingFee + dividendFee;
require(liquidityFee <= 5); require(marketingFee <= 5); require(dividendFee <= 20); _liquidityFee = liquidityFee; _marketingFee = marketingFee; _dividendRewardsFee = dividendFee; _totalFee = liquidityFee + marketingFee + dividendFee;
34,921
33
// The health of a monster is levelmonsterHealth;
uint16 public monsterHealth = 10;
uint16 public monsterHealth = 10;
27,357
0
// --- ERC 3156 Data ---
bytes32 private constant _RETURN_VALUE = keccak256("ERC3156FlashBorrower.onFlashLoan"); uint256 public constant FLASH_LOAN_FEE = 9; // 1 = 0.0001%
bytes32 private constant _RETURN_VALUE = keccak256("ERC3156FlashBorrower.onFlashLoan"); uint256 public constant FLASH_LOAN_FEE = 9; // 1 = 0.0001%
7,416
21
// Structs/
struct AddressInfo { address previous; uint32 index; bool authorized; }
struct AddressInfo { address previous; uint32 index; bool authorized; }
32,661
0
// Info about each type of market
struct Market { uint256 capacity; // capacity remaining IERC20 quoteToken; // token to accept as payment bool capacityInQuote; // capacity limit is in payment token (true) or in STRL (false, default) uint64 totalDebt; // total debt from market uint64 maxPayout; // max tokens in/out (determined by capacityInQuote false/true) uint64 sold; // base tokens out uint256 purchased; // quote tokens in }
struct Market { uint256 capacity; // capacity remaining IERC20 quoteToken; // token to accept as payment bool capacityInQuote; // capacity limit is in payment token (true) or in STRL (false, default) uint64 totalDebt; // total debt from market uint64 maxPayout; // max tokens in/out (determined by capacityInQuote false/true) uint64 sold; // base tokens out uint256 purchased; // quote tokens in }
11,782
51
// canOf[user] -= amount;
return(true);
return(true);
77,460
0
// 地址对应的余额
mapping (address => uint256) public balanceOf; event Transfer(address indexed from, address indexed to, uint256 value); //转帐通知事件
mapping (address => uint256) public balanceOf; event Transfer(address indexed from, address indexed to, uint256 value); //转帐通知事件
77,810
240
// Redeems the SetToken's positions and sends the components of the givenquantity to the caller. This function only handles Default Positions (positionState = 0)._setToken Instance of the SetToken contract _quantity Quantity of the SetToken to redeem _to Address to send component assets to /
function redeem( ISetToken _setToken, uint256 _quantity, address _to
function redeem( ISetToken _setToken, uint256 _quantity, address _to
81,981
10
// event to be emitted when single id of tokens are minted Signature for Mint(address,address,uint256,uint256,uint104,uint32,uint48) : `0x36fdad7e`tokenId id of the token being transferred. /
event Mint(uint256 indexed tokenId);
event Mint(uint256 indexed tokenId);
24,691
408
// those are the "contract wide" royalties, used for collections that all pay royalties to the same recipient, with the same value once set, like any other royalties, it can not be modified
RoyaltyData private _contractRoyalties; mapping(uint256 => RoyaltyData) private _royalties;
RoyaltyData private _contractRoyalties; mapping(uint256 => RoyaltyData) private _royalties;
75,233
7
// This function should be called via the userProxy of a Gelato Task as part/of the Task.actions, if the Condition state should be updated after the task./ This is for Task Cycles/Chains and we fetch the TaskReceipt.id of thenext Task that will be auto-submitted by GelatoCore in the same exec Task transaction.
function setRefBatchId(uint256 _delta, uint256 _idDelta) external { uint256 currentBatchId = uint32(block.timestamp / BATCH_TIME); uint256 newRefBatchId = currentBatchId + _delta; refBatchId[msg.sender][_getIdOfNextTaskInCycle() + _idDelta] = newRefBatchId; }
function setRefBatchId(uint256 _delta, uint256 _idDelta) external { uint256 currentBatchId = uint32(block.timestamp / BATCH_TIME); uint256 newRefBatchId = currentBatchId + _delta; refBatchId[msg.sender][_getIdOfNextTaskInCycle() + _idDelta] = newRefBatchId; }
11,682
0
// Define the GoldNugget token contract
constructor(IERC20 _goldnugget) public { goldnugget = _goldnugget; }
constructor(IERC20 _goldnugget) public { goldnugget = _goldnugget; }
37,021
100
// all accessible
function isCustodian(address addr) external view returns (bool) { return members.isCustodian(addr); }
function isCustodian(address addr) external view returns (bool) { return members.isCustodian(addr); }
28,930
93
// If the sender has not voted then there is no need to update anything.
require(senderVote != Vote.Abstention);
require(senderVote != Vote.Abstention);
25,576
5
// Returns current time./
function getTime() public view returns (uint) { return now; }
function getTime() public view returns (uint) { return now; }
40,701
62
// Should have minter role
stablecoin.mint(msg.sender, amount); emit BorrowToken(vaultID, amount);
stablecoin.mint(msg.sender, amount); emit BorrowToken(vaultID, amount);
26,965
159
// RHINOFARM is the master of RHINO. He can make RHINO and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once RHINO is sufficiently distributed and the community can show to govern itself.
contract RHINOFARM is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // 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 RHINOs // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accRHINOPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accRHINOPerShare` (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 { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. RHINOs to distribute per block. uint256 lastRewardBlock; // Last block number that RHINOs distribution occurs. uint256 accRHINOPerShare; // Accumulated RHINOs per share, times 1e12. See below. } RHINOToken public RHINO; // The RHINO TOKEN! address public devaddr; // Dev address. mapping(address => bool) public lpTokenExistsInPool; // Track all added pools to prevent adding the same pool more then once. mapping (uint256 => mapping (address => UserInfo)) public userInfo; // Info of each user that stakes LP tokens. uint256 public totalAllocPoint = 0; // Total allocation points. Must be the sum of all allocation points in all pools. uint256 public constant startBlock = 11970000; // The block number when RHINO mining starts. uint256 public bonusEndBlock = 11970000; uint256 public constant DEV_TAX = 5; uint256 public constant BONUS_MULTIPLIER = 1; uint256 public rhinoPerBlock = 31e18; uint256 public berhaneValue = 22e12; uint256 public lastBlockUpdate = 0; // the last block when RewardPerBlock was updated with the berhaneValue PoolInfo[] public poolInfo; // Info of each pool. event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); modifier onlyDev() { require(devaddr == _msgSender(), "not dev"); _; } constructor( RHINOToken _RHINO, address _devaddr ) public { RHINO = _RHINO; devaddr = _devaddr; } function poolLength() external view returns (uint256) { return poolInfo.length; } // Add a new lp to the pool. Can only be called by the owner. function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { require(!lpTokenExistsInPool[address(_lpToken)], "MasterChef: LP Token Address already exists in pool"); if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push(PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accRHINOPerShare: 0 })); lpTokenExistsInPool[address(_lpToken)] = true; } function updateDevAddress(address _devAddress) public onlyDev { devaddr = _devAddress; } // Add a pool manually for pools that already exists, but were not auto added to the map by "add()". function updateLpTokenExists(address _lpTokenAddr, bool _isExists) external onlyOwner { lpTokenExistsInPool[_lpTokenAddr] = _isExists; } // Update the given pool's RHINO allocation point. Can only be called by the owner. function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; } // Return reward multiplier over the given _from to _to block. function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { if (_to <= bonusEndBlock) { return _to.sub(_from).mul(BONUS_MULTIPLIER); } else if (_from >= bonusEndBlock) { return _to.sub(_from); } else { return bonusEndBlock.sub(_from).mul(BONUS_MULTIPLIER).add( _to.sub(bonusEndBlock) ); } } // View function to see pending RHINOs on frontend. function pendingRHINO(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accRHINOPerShare = pool.accRHINOPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 blocksToReward = getMultiplier(pool.lastRewardBlock, block.number); uint256 rhinoReward = blocksToReward.mul(rhinoPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accRHINOPerShare = accRHINOPerShare.add(rhinoReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accRHINOPerShare).div(1e12).sub(user.rewardDebt); } // Update reward variables for all pools. Be careful of gas spending! function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } // Init the first block when berhaneValue has been updated if (lastBlockUpdate == 0) { lastBlockUpdate = block.number; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } // Get number of blocks since last update of rhinoPerBlock uint256 BlocksToUpdate = block.number - lastBlockUpdate; // Adjust Berhane depending on number of blocks to update uint256 Berhane = (BlocksToUpdate).mul(berhaneValue); // Set the new number of rhinoPerBlock with Berhane rhinoPerBlock = rhinoPerBlock.sub(Berhane); // Check how many blocks have to be rewarded since the last pool update uint256 blocksToReward = getMultiplier(pool.lastRewardBlock, block.number); uint256 CompensationSinceLastRewardUpdate = 0; if (BlocksToUpdate > 0) { CompensationSinceLastRewardUpdate = BlocksToUpdate.mul(Berhane); } uint256 rhinoReward = blocksToReward.mul(rhinoPerBlock.add(CompensationSinceLastRewardUpdate)).mul(pool.allocPoint).div(totalAllocPoint); RHINO.mint(address(this), rhinoReward); pool.accRHINOPerShare = pool.accRHINOPerShare.add(rhinoReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number; lastBlockUpdate = block.number; } // Deposit LP tokens to rhinofarm for RHINO 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.accRHINOPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) { safeRhinoTransfer(msg.sender, pending); } } if(_amount > 0) { uint256 _taxAmount = _amount.mul(DEV_TAX).div(100); _amount = _amount.sub(_taxAmount); pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); pool.lpToken.safeTransferFrom(address(msg.sender), address(devaddr), _taxAmount); user.amount = user.amount.add(_amount); } user.rewardDebt = user.amount.mul(pool.accRHINOPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); } // Withdraw LP tokens from rhinofarm. 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.accRHINOPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) { safeRhinoTransfer(msg.sender, pending); } if(_amount > 0) { user.amount = user.amount.sub(_amount); pool.lpToken.safeTransfer(address(msg.sender), _amount); } user.rewardDebt = user.amount.mul(pool.accRHINOPerShare).div(1e12); emit Withdraw(msg.sender, _pid, _amount); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDebt = 0; pool.lpToken.safeTransfer(address(msg.sender), amount); emit EmergencyWithdraw(msg.sender, _pid, amount); } // Safe RHINO transfer function, just in case if rounding error causes pool to not have enough RHINOs. function safeRhinoTransfer(address _to, uint256 _amount) internal { uint256 RhinoBal = RHINO.balanceOf(address(this)); if (_amount > RhinoBal) { RHINO.transfer(_to, RhinoBal); } else { RHINO.transfer(_to, _amount); } } // Update dev address by the previous dev. function dev(address _devaddr) public { require(msg.sender == devaddr, "dev: wut?"); devaddr = _devaddr; } }
contract RHINOFARM is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // 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 RHINOs // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accRHINOPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accRHINOPerShare` (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 { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. RHINOs to distribute per block. uint256 lastRewardBlock; // Last block number that RHINOs distribution occurs. uint256 accRHINOPerShare; // Accumulated RHINOs per share, times 1e12. See below. } RHINOToken public RHINO; // The RHINO TOKEN! address public devaddr; // Dev address. mapping(address => bool) public lpTokenExistsInPool; // Track all added pools to prevent adding the same pool more then once. mapping (uint256 => mapping (address => UserInfo)) public userInfo; // Info of each user that stakes LP tokens. uint256 public totalAllocPoint = 0; // Total allocation points. Must be the sum of all allocation points in all pools. uint256 public constant startBlock = 11970000; // The block number when RHINO mining starts. uint256 public bonusEndBlock = 11970000; uint256 public constant DEV_TAX = 5; uint256 public constant BONUS_MULTIPLIER = 1; uint256 public rhinoPerBlock = 31e18; uint256 public berhaneValue = 22e12; uint256 public lastBlockUpdate = 0; // the last block when RewardPerBlock was updated with the berhaneValue PoolInfo[] public poolInfo; // Info of each pool. event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); modifier onlyDev() { require(devaddr == _msgSender(), "not dev"); _; } constructor( RHINOToken _RHINO, address _devaddr ) public { RHINO = _RHINO; devaddr = _devaddr; } function poolLength() external view returns (uint256) { return poolInfo.length; } // Add a new lp to the pool. Can only be called by the owner. function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { require(!lpTokenExistsInPool[address(_lpToken)], "MasterChef: LP Token Address already exists in pool"); if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push(PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accRHINOPerShare: 0 })); lpTokenExistsInPool[address(_lpToken)] = true; } function updateDevAddress(address _devAddress) public onlyDev { devaddr = _devAddress; } // Add a pool manually for pools that already exists, but were not auto added to the map by "add()". function updateLpTokenExists(address _lpTokenAddr, bool _isExists) external onlyOwner { lpTokenExistsInPool[_lpTokenAddr] = _isExists; } // Update the given pool's RHINO allocation point. Can only be called by the owner. function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; } // Return reward multiplier over the given _from to _to block. function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { if (_to <= bonusEndBlock) { return _to.sub(_from).mul(BONUS_MULTIPLIER); } else if (_from >= bonusEndBlock) { return _to.sub(_from); } else { return bonusEndBlock.sub(_from).mul(BONUS_MULTIPLIER).add( _to.sub(bonusEndBlock) ); } } // View function to see pending RHINOs on frontend. function pendingRHINO(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accRHINOPerShare = pool.accRHINOPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 blocksToReward = getMultiplier(pool.lastRewardBlock, block.number); uint256 rhinoReward = blocksToReward.mul(rhinoPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accRHINOPerShare = accRHINOPerShare.add(rhinoReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accRHINOPerShare).div(1e12).sub(user.rewardDebt); } // Update reward variables for all pools. Be careful of gas spending! function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } // Init the first block when berhaneValue has been updated if (lastBlockUpdate == 0) { lastBlockUpdate = block.number; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } // Get number of blocks since last update of rhinoPerBlock uint256 BlocksToUpdate = block.number - lastBlockUpdate; // Adjust Berhane depending on number of blocks to update uint256 Berhane = (BlocksToUpdate).mul(berhaneValue); // Set the new number of rhinoPerBlock with Berhane rhinoPerBlock = rhinoPerBlock.sub(Berhane); // Check how many blocks have to be rewarded since the last pool update uint256 blocksToReward = getMultiplier(pool.lastRewardBlock, block.number); uint256 CompensationSinceLastRewardUpdate = 0; if (BlocksToUpdate > 0) { CompensationSinceLastRewardUpdate = BlocksToUpdate.mul(Berhane); } uint256 rhinoReward = blocksToReward.mul(rhinoPerBlock.add(CompensationSinceLastRewardUpdate)).mul(pool.allocPoint).div(totalAllocPoint); RHINO.mint(address(this), rhinoReward); pool.accRHINOPerShare = pool.accRHINOPerShare.add(rhinoReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number; lastBlockUpdate = block.number; } // Deposit LP tokens to rhinofarm for RHINO 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.accRHINOPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) { safeRhinoTransfer(msg.sender, pending); } } if(_amount > 0) { uint256 _taxAmount = _amount.mul(DEV_TAX).div(100); _amount = _amount.sub(_taxAmount); pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); pool.lpToken.safeTransferFrom(address(msg.sender), address(devaddr), _taxAmount); user.amount = user.amount.add(_amount); } user.rewardDebt = user.amount.mul(pool.accRHINOPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); } // Withdraw LP tokens from rhinofarm. 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.accRHINOPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) { safeRhinoTransfer(msg.sender, pending); } if(_amount > 0) { user.amount = user.amount.sub(_amount); pool.lpToken.safeTransfer(address(msg.sender), _amount); } user.rewardDebt = user.amount.mul(pool.accRHINOPerShare).div(1e12); emit Withdraw(msg.sender, _pid, _amount); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDebt = 0; pool.lpToken.safeTransfer(address(msg.sender), amount); emit EmergencyWithdraw(msg.sender, _pid, amount); } // Safe RHINO transfer function, just in case if rounding error causes pool to not have enough RHINOs. function safeRhinoTransfer(address _to, uint256 _amount) internal { uint256 RhinoBal = RHINO.balanceOf(address(this)); if (_amount > RhinoBal) { RHINO.transfer(_to, RhinoBal); } else { RHINO.transfer(_to, _amount); } } // Update dev address by the previous dev. function dev(address _devaddr) public { require(msg.sender == devaddr, "dev: wut?"); devaddr = _devaddr; } }
27,905
4
// If no xFATE exists, mint it 1:1 to the amount put in
_mint(msg.sender, safe96(_amount, "XFateToken::enter: invalid amount"));
_mint(msg.sender, safe96(_amount, "XFateToken::enter: invalid amount"));
17,060
198
// decides if round end needs to be run & new round started.and if player unmasked earnings from previously played rounds need to be moved. /
function managePlayer(uint256 _pID, RSdatasets.EventReturns memory _eventData_) private returns (RSdatasets.EventReturns)
function managePlayer(uint256 _pID, RSdatasets.EventReturns memory _eventData_) private returns (RSdatasets.EventReturns)
26,652
211
// OracleRef interface/Fei Protocol
interface IOracleRef { // ----------- Events ----------- event OracleUpdate(address indexed oldOracle, address indexed newOracle); event InvertUpdate(bool oldDoInvert, bool newDoInvert); event DecimalsNormalizerUpdate(int256 oldDecimalsNormalizer, int256 newDecimalsNormalizer); event BackupOracleUpdate(address indexed oldBackupOracle, address indexed newBackupOracle); // ----------- State changing API ----------- function updateOracle() external; // ----------- Governor only state changing API ----------- function setOracle(address newOracle) external; function setBackupOracle(address newBackupOracle) external; function setDecimalsNormalizer(int256 newDecimalsNormalizer) external; function setDoInvert(bool newDoInvert) external; // ----------- Getters ----------- function oracle() external view returns (IOracle); function backupOracle() external view returns (IOracle); function doInvert() external view returns (bool); function decimalsNormalizer() external view returns (int256); function readOracle() external view returns (Decimal.D256 memory); function invert(Decimal.D256 calldata price) external pure returns (Decimal.D256 memory); }
interface IOracleRef { // ----------- Events ----------- event OracleUpdate(address indexed oldOracle, address indexed newOracle); event InvertUpdate(bool oldDoInvert, bool newDoInvert); event DecimalsNormalizerUpdate(int256 oldDecimalsNormalizer, int256 newDecimalsNormalizer); event BackupOracleUpdate(address indexed oldBackupOracle, address indexed newBackupOracle); // ----------- State changing API ----------- function updateOracle() external; // ----------- Governor only state changing API ----------- function setOracle(address newOracle) external; function setBackupOracle(address newBackupOracle) external; function setDecimalsNormalizer(int256 newDecimalsNormalizer) external; function setDoInvert(bool newDoInvert) external; // ----------- Getters ----------- function oracle() external view returns (IOracle); function backupOracle() external view returns (IOracle); function doInvert() external view returns (bool); function decimalsNormalizer() external view returns (int256); function readOracle() external view returns (Decimal.D256 memory); function invert(Decimal.D256 calldata price) external pure returns (Decimal.D256 memory); }
46,773
5
// Hash an address_account The address to be hashed return bytes32 The hashed address /
function leaf(address _account) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_account)); }
function leaf(address _account) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_account)); }
21,340
25
// See `IPoolLenderActions` for descriptions === Write state === - `_removeMaxDeposit`: `Deposits.unscaledRemove` (remove amount in `Fenwick` tree, from index): update `values` array state - `Deposits.unscaledAdd` (add amount in `Fenwick` tree, to index): update `values` array state - decrement `lender.lps` accumulator for from bucket - increment `lender.lps` accumulator and `lender.depositTime` state for to bucket - decrement `bucket.lps` accumulator for from bucket - increment `bucket.lps` accumulator for to bucket === Reverts on === same index `MoveToSameIndex()` dust amount `DustAmountNotExceeded()` invalid index `InvalidIndex()` no LP awarded in to bucket `InsufficientLP()` move below `LUP` `PriceBelowLUP()` === Emit events === - `BucketBankruptcy` - `MoveQuoteToken` /
function moveQuoteToken( mapping(uint256 => Bucket) storage buckets_, DepositsState storage deposits_, PoolState calldata poolState_, MoveQuoteParams calldata params_
function moveQuoteToken( mapping(uint256 => Bucket) storage buckets_, DepositsState storage deposits_, PoolState calldata poolState_, MoveQuoteParams calldata params_
40,060
30
// Checks whether current timestamp is inside MEWT (excluding the boundary)/ return inMewt boolean to indicate whether still in MEWT or not
function inMewt() public view returns (bool) { return block.timestamp < getEpochStartTimestamp() + MINIMUM_EXECUTION_WAIT_THRESHOLD; }
function inMewt() public view returns (bool) { return block.timestamp < getEpochStartTimestamp() + MINIMUM_EXECUTION_WAIT_THRESHOLD; }
20,906
52
// No need to pay any fees in a P2P order without a wallet (but the fee amount is a part of amountS of the order, so the fee amount is rebated).
if (feeCtx.P2P && feeCtx.wallet == 0x0) { amount = 0; }
if (feeCtx.P2P && feeCtx.wallet == 0x0) { amount = 0; }
24,931
30
// Update Oracle Time Constants function Updates Oracle Time Constants /
function setTimeConstants(uint closeBeforeStartTime, uint closeEventOutcomeTime) onlyOwner public { oracleData.closeBeforeStartTime = closeBeforeStartTime; oracleData.closeEventOutcomeTime = closeEventOutcomeTime; emit OraclePropertiesUpdated(); }
function setTimeConstants(uint closeBeforeStartTime, uint closeEventOutcomeTime) onlyOwner public { oracleData.closeBeforeStartTime = closeBeforeStartTime; oracleData.closeEventOutcomeTime = closeEventOutcomeTime; emit OraclePropertiesUpdated(); }
17,920
9
// ----------------------------------------------------------------------------------------------------------------// Calculates the amount of shares a user would get for certain amount of fyToken./sharesReserves shares reserves amount/fyTokenReserves fyToken reserves amount/fyTokenIn fyToken amount to be traded/timeTillMaturity time till maturity in seconds/k time till maturity coefficient, multiplied by 2^64/g fee coefficient, multiplied by 2^64/c price of shares in terms of Dai, multiplied by 2^64/mu (μ) Normalization factor -- starts as c at initialization/ return amount of Shares a user would get for given amount of fyToken
function sharesOutForFYTokenIn( uint128 sharesReserves, uint128 fyTokenReserves, uint128 fyTokenIn, uint128 timeTillMaturity, int128 k, int128 g, int128 c, int128 mu
function sharesOutForFYTokenIn( uint128 sharesReserves, uint128 fyTokenReserves, uint128 fyTokenIn, uint128 timeTillMaturity, int128 k, int128 g, int128 c, int128 mu
22,853
0
// SdtDistributorEvents/StakeDAO Core Team/All the events used in `SdtDistributor` contract
abstract contract SdtDistributorEvents { event DelegateGaugeUpdated(address indexed _gaugeAddr, address indexed _delegateGauge); event DistributionsToggled(bool _distributionsOn); event GaugeControllerUpdated(address indexed _controller); event GaugeToggled(address indexed gaugeAddr, bool newStatus); event InterfaceKnownToggled(address indexed _delegateGauge, bool _isInterfaceKnown); event RateUpdated(uint256 _newRate); event Recovered(address indexed tokenAddress, address indexed to, uint256 amount); event RewardDistributed(address indexed gaugeAddr, uint256 sdtDistributed, uint256 lastMasterchefPull); event UpdateMiningParameters(uint256 time, uint256 rate, uint256 supply); }
abstract contract SdtDistributorEvents { event DelegateGaugeUpdated(address indexed _gaugeAddr, address indexed _delegateGauge); event DistributionsToggled(bool _distributionsOn); event GaugeControllerUpdated(address indexed _controller); event GaugeToggled(address indexed gaugeAddr, bool newStatus); event InterfaceKnownToggled(address indexed _delegateGauge, bool _isInterfaceKnown); event RateUpdated(uint256 _newRate); event Recovered(address indexed tokenAddress, address indexed to, uint256 amount); event RewardDistributed(address indexed gaugeAddr, uint256 sdtDistributed, uint256 lastMasterchefPull); event UpdateMiningParameters(uint256 time, uint256 rate, uint256 supply); }
1,413
175
// swap base token to quote token tokenIn address of the base token tokenOut address of the quote token tokenAmountIn amount of the base token incrementalPercentage The incremental percentage /
function _trade(address tokenIn, address tokenOut, uint256 tokenAmountIn, uint256 incrementalPercentage) internal
function _trade(address tokenIn, address tokenOut, uint256 tokenAmountIn, uint256 incrementalPercentage) internal
17,200
58
// Withdraws All days in era for member
function Check_Withdrawls_Days(uint _era, uint[] memory fdays, address _member) public view returns (uint check)
function Check_Withdrawls_Days(uint _era, uint[] memory fdays, address _member) public view returns (uint check)
18,529
49
// Method to view the current BNB stored in the contract
function totalBNBBalance() public view returns(uint) { return address(this).balance; }
function totalBNBBalance() public view returns(uint) { return address(this).balance; }
18,262
1
// Check if an attribute of the type with ID `attributeTypeID` hasbeen assigned to the account at `account` and is still valid. account address The account to check for a valid attribute. attributeTypeID uint256 The ID of the attribute type to check for.return True if the attribute is assigned and valid, false otherwise. /
function hasAttribute( address account, uint256 attributeTypeID ) external view returns (bool);
function hasAttribute( address account, uint256 attributeTypeID ) external view returns (bool);
39,330
25
// Emitted when delegation power in a FollowNFT is changed.delegate The delegate whose power has been changed. newPower The new governance power mapped to the delegate. timestamp The current block timestamp. /
event FollowNFTDelegatedPowerChanged( address indexed delegate, uint256 indexed newPower, uint256 timestamp );
event FollowNFTDelegatedPowerChanged( address indexed delegate, uint256 indexed newPower, uint256 timestamp );
3,713
211
// holds the pending new settingId value when a deprecation is set
uint256 pendingNewSettingId;
uint256 pendingNewSettingId;
32,444
137
// ストレージ
address private _controller; string[] private _meta_hashes;
address private _controller; string[] private _meta_hashes;
16,403
52
// Call overridden function ReleaseLockerAccess in this contract
ReleaseLockerAccess();
ReleaseLockerAccess();
10,345
19
// Accumulate CToken interest
return super.accrueInterest();
return super.accrueInterest();
35,316
75
// JUST Fill DATES
function updateScriptDates(uint256 tokenId, string memory _dateFilled, string memory _dateNextFill) public
function updateScriptDates(uint256 tokenId, string memory _dateFilled, string memory _dateNextFill) public
8,061
8
// change owner this this trader wallet
function changeOwner(address newOwner) external { require(msg.sender==owner); owner = newOwner; }
function changeOwner(address newOwner) external { require(msg.sender==owner); owner = newOwner; }
28,239
64
// getter for the address of the payee number `index`.
function userAddress(uint index) public view returns (address account) { return users[index]; }
function userAddress(uint index) public view returns (address account) { return users[index]; }
30,758
274
// Checks for ALPA payment
require( alpa.allowance(msgSender, address(this)) >= _hatchingALPACost(_matronId, _sireId, true), "CryptoAlpaca: Required hetching ALPA fee not sent" );
require( alpa.allowance(msgSender, address(this)) >= _hatchingALPACost(_matronId, _sireId, true), "CryptoAlpaca: Required hetching ALPA fee not sent" );
52,497
126
// Write recipient to startAmount.
mstore( add( considerationItem, ReceivedItem_amount_offset ), mload( add( considerationItem, ConsiderationItem_recipient_offset )
mstore( add( considerationItem, ReceivedItem_amount_offset ), mload( add( considerationItem, ConsiderationItem_recipient_offset )
20,648
13
// Sanity check: no-op if moving stake from undelegated to undelegated.
if (from.status == IStructs.StakeStatus.UNDELEGATED && to.status == IStructs.StakeStatus.UNDELEGATED) { return; }
if (from.status == IStructs.StakeStatus.UNDELEGATED && to.status == IStructs.StakeStatus.UNDELEGATED) { return; }
24,880
14
// Destroy this contract
function triggerSelfDestruction() public
function triggerSelfDestruction() public
39,954
50
// This callable function returns the balance, contribution cap, and remaining available balance of any contributor.
function checkContributorBalance (address addr) view public returns (uint balance, uint cap, uint remaining) { var c = whitelist[addr]; if (!c.authorized) { cap = whitelistContract.checkMemberLevel(addr); if (cap == 0) return (0,0,0); } else { cap = c.cap; } balance = c.balance; if (contractStage == 1) { if (cap<contributionCaps.length) { cap = contributionCaps[cap]; } remaining = cap.sub(balance); if (contributionCaps[0].sub(this.balance) < remaining) remaining = contributionCaps[0].sub(this.balance); } else { remaining = 0; } return (balance, cap, remaining); }
function checkContributorBalance (address addr) view public returns (uint balance, uint cap, uint remaining) { var c = whitelist[addr]; if (!c.authorized) { cap = whitelistContract.checkMemberLevel(addr); if (cap == 0) return (0,0,0); } else { cap = c.cap; } balance = c.balance; if (contractStage == 1) { if (cap<contributionCaps.length) { cap = contributionCaps[cap]; } remaining = cap.sub(balance); if (contributionCaps[0].sub(this.balance) < remaining) remaining = contributionCaps[0].sub(this.balance); } else { remaining = 0; } return (balance, cap, remaining); }
10,582
84
// Set some initial params for sale. Requirements: - `_erc20` Bags ERC20 contract address. /
constructor(Bags _erc20) { bagsContract = _erc20; }
constructor(Bags _erc20) { bagsContract = _erc20; }
15,402
6
// emitted after each canceled split control transfersplit Address of the split control transfer was canceled for /
event CancelControlTransfer(address indexed split);
event CancelControlTransfer(address indexed split);
12,269
39
// A constant role name for indicating admins. /
string public constant ROLE_ADMIN = "admin"; string public constant ROLE_PAUSE_ADMIN = "pauseAdmin";
string public constant ROLE_ADMIN = "admin"; string public constant ROLE_PAUSE_ADMIN = "pauseAdmin";
47,462
10
// Token => Reward Rate Updation history. baseToken -> rewardToken -> rewardsPerSecondEntry
mapping(address => mapping(address => RewardsPerSecondEntry[])) public rewardRateLog; uint256 private constant ACC_TOKEN_PRECISION = 1e12; address internal constant NATIVE = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; event LogDeposit(address indexed user, address indexed baseToken, uint256 nftId); event LogWithdraw(address indexed user, address baseToken, uint256 nftId, address indexed to); event LogOnReward( address indexed user, address indexed baseToken,
mapping(address => mapping(address => RewardsPerSecondEntry[])) public rewardRateLog; uint256 private constant ACC_TOKEN_PRECISION = 1e12; address internal constant NATIVE = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; event LogDeposit(address indexed user, address indexed baseToken, uint256 nftId); event LogWithdraw(address indexed user, address baseToken, uint256 nftId, address indexed to); event LogOnReward( address indexed user, address indexed baseToken,
28,122
11
// Gets a list of addresses that are ready to inject This is done by checking if the current period has ended, and should inject new funds directly after the end of each period.return list of addresses that are ready to inject /
function getReadyGauges() public view returns (address[] memory) { address[] memory gaugeList = s_gaugeList; address[] memory ready = new address[](gaugeList.length); address tokenAddress = s_injectTokenAddress; uint256 count = 0; uint256 minWaitPeriod = s_minWaitPeriodSeconds; uint256 balance = IERC20(tokenAddress).balanceOf(address(this)); Target memory target; for (uint256 idx = 0; idx < gaugeList.length; idx++) { target = s_targets[gaugeList[idx]]; IChildChainGauge gauge = IChildChainGauge(gaugeList[idx]); uint256 period_finish = gauge.reward_data(tokenAddress).period_finish; if ( target.lastInjectionTimeStamp + minWaitPeriod <= block.timestamp && (period_finish <= block.timestamp) && balance >= target.amountPerPeriod && target.periodNumber < target.maxPeriods && gauge.reward_data(tokenAddress).distributor == address(this) ) { ready[count] = gaugeList[idx]; count++; balance -= target.amountPerPeriod; } } if (count != gaugeList.length) { // ready is a list large enough to hold all possible gauges // count is the number of ready gauges that were inserted into ready // this assembly shrinks ready to length count such that it removes empty elements assembly { mstore(ready, count) } } return ready; }
function getReadyGauges() public view returns (address[] memory) { address[] memory gaugeList = s_gaugeList; address[] memory ready = new address[](gaugeList.length); address tokenAddress = s_injectTokenAddress; uint256 count = 0; uint256 minWaitPeriod = s_minWaitPeriodSeconds; uint256 balance = IERC20(tokenAddress).balanceOf(address(this)); Target memory target; for (uint256 idx = 0; idx < gaugeList.length; idx++) { target = s_targets[gaugeList[idx]]; IChildChainGauge gauge = IChildChainGauge(gaugeList[idx]); uint256 period_finish = gauge.reward_data(tokenAddress).period_finish; if ( target.lastInjectionTimeStamp + minWaitPeriod <= block.timestamp && (period_finish <= block.timestamp) && balance >= target.amountPerPeriod && target.periodNumber < target.maxPeriods && gauge.reward_data(tokenAddress).distributor == address(this) ) { ready[count] = gaugeList[idx]; count++; balance -= target.amountPerPeriod; } } if (count != gaugeList.length) { // ready is a list large enough to hold all possible gauges // count is the number of ready gauges that were inserted into ready // this assembly shrinks ready to length count such that it removes empty elements assembly { mstore(ready, count) } } return ready; }
14,353
20
// UpgradeBeaconProxyV1Prototype 0age This contract delegates all logic, including initialization, to animplementation contract specified by a hard-coded "upgrade beacon" contract.Note that this implementation can be reduced in size by stripping out themetadata hash, or even more significantly by using a minimal upgrade beaconproxy implemented using raw EVM opcodes. /
contract UpgradeBeaconProxyV1Prototype { // Set upgrade beacon address as a constant (i.e. not in contract storage). address private constant _UPGRADE_BEACON = address( 0x5BF07ceDF1296B1C11966832c3e75895ad6E1E2a ); /** * @notice In the constructor, perform initialization via delegatecall to the * implementation set on the upgrade beacon, supplying initialization calldata * as a constructor argument. The deployment will revert and pass along the * revert reason in the event that this initialization delegatecall reverts. * @param initializationCalldata Calldata to supply when performing the * initialization delegatecall. */ constructor(bytes memory initializationCalldata) public payable { // Delegatecall into the implementation, supplying initialization calldata. (bool ok, ) = _implementation().delegatecall(initializationCalldata); // Revert and include revert data if delegatecall to implementation reverts. if (!ok) { assembly { returndatacopy(0, 0, returndatasize) revert(0, returndatasize) } } } /** * @notice In the fallback, delegate execution to the implementation set on * the upgrade beacon. */ function () external payable { // Delegate execution to implementation contract provided by upgrade beacon. _delegate(_implementation()); } /** * @notice Private view function to get the current implementation from the * upgrade beacon. This is accomplished via a staticcall to the beacon with no * data, and the beacon will return an abi-encoded implementation address. * @return implementation Address of the implementation. */ function _implementation() private view returns (address implementation) { // Get the current implementation address from the upgrade beacon. (bool ok, bytes memory returnData) = _UPGRADE_BEACON.staticcall(""); // Revert and pass along revert message if call to upgrade beacon reverts. require(ok, string(returnData)); // Set the implementation to the address returned from the upgrade beacon. implementation = abi.decode(returnData, (address)); } /** * @notice Private function that delegates execution to an implementation * contract. This is a low level function that doesn't return to its internal * call site. It will return whatever is returned by the implementation to the * external caller, reverting and returning the revert data if implementation * reverts. * @param implementation Address to delegate. */ function _delegate(address implementation) private { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize) // Delegatecall to the implementation, supplying calldata and gas. // Out and outsize are set to zero - instead, use the return buffer. let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0) // Copy the returned data from the return buffer. returndatacopy(0, 0, returndatasize) switch result // Delegatecall returns 0 on error. case 0 { revert(0, returndatasize) } default { return(0, returndatasize) } } } }
contract UpgradeBeaconProxyV1Prototype { // Set upgrade beacon address as a constant (i.e. not in contract storage). address private constant _UPGRADE_BEACON = address( 0x5BF07ceDF1296B1C11966832c3e75895ad6E1E2a ); /** * @notice In the constructor, perform initialization via delegatecall to the * implementation set on the upgrade beacon, supplying initialization calldata * as a constructor argument. The deployment will revert and pass along the * revert reason in the event that this initialization delegatecall reverts. * @param initializationCalldata Calldata to supply when performing the * initialization delegatecall. */ constructor(bytes memory initializationCalldata) public payable { // Delegatecall into the implementation, supplying initialization calldata. (bool ok, ) = _implementation().delegatecall(initializationCalldata); // Revert and include revert data if delegatecall to implementation reverts. if (!ok) { assembly { returndatacopy(0, 0, returndatasize) revert(0, returndatasize) } } } /** * @notice In the fallback, delegate execution to the implementation set on * the upgrade beacon. */ function () external payable { // Delegate execution to implementation contract provided by upgrade beacon. _delegate(_implementation()); } /** * @notice Private view function to get the current implementation from the * upgrade beacon. This is accomplished via a staticcall to the beacon with no * data, and the beacon will return an abi-encoded implementation address. * @return implementation Address of the implementation. */ function _implementation() private view returns (address implementation) { // Get the current implementation address from the upgrade beacon. (bool ok, bytes memory returnData) = _UPGRADE_BEACON.staticcall(""); // Revert and pass along revert message if call to upgrade beacon reverts. require(ok, string(returnData)); // Set the implementation to the address returned from the upgrade beacon. implementation = abi.decode(returnData, (address)); } /** * @notice Private function that delegates execution to an implementation * contract. This is a low level function that doesn't return to its internal * call site. It will return whatever is returned by the implementation to the * external caller, reverting and returning the revert data if implementation * reverts. * @param implementation Address to delegate. */ function _delegate(address implementation) private { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize) // Delegatecall to the implementation, supplying calldata and gas. // Out and outsize are set to zero - instead, use the return buffer. let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0) // Copy the returned data from the return buffer. returndatacopy(0, 0, returndatasize) switch result // Delegatecall returns 0 on error. case 0 { revert(0, returndatasize) } default { return(0, returndatasize) } } } }
47,996
7
// transfer underlying NFT asset to pool and mint bNFT to onBehalfOf
IERC721Upgradeable(nftAsset).safeTransferFrom(_msgSender(), address(this), nftTokenId); IBNFT(bNftAddress).mint(onBehalfOf, nftTokenId);
IERC721Upgradeable(nftAsset).safeTransferFrom(_msgSender(), address(this), nftTokenId); IBNFT(bNftAddress).mint(onBehalfOf, nftTokenId);
26,303
125
// Deposit LP tokens to MasterChef for Demo 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.accDemoPerShare).div(1e12).sub(user.rewardDebt); safeDemoTransfer(msg.sender, pending); } pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); user.rewardDebt = user.amount.mul(pool.accDemoPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); }
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.accDemoPerShare).div(1e12).sub(user.rewardDebt); safeDemoTransfer(msg.sender, pending); } pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); user.rewardDebt = user.amount.mul(pool.accDemoPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); }
22,396
21
// Growdrop's total actual accrued interest when Growdrop is over by Growdrop's identifier /
mapping(uint256 => uint256) public TotalInterestOverActual;
mapping(uint256 => uint256) public TotalInterestOverActual;
39,473
40
// 1/
function executeSaleUsd721batch( uint256[] calldata price, uint256[] calldata tokenId, address[] calldata tokenContract, address[] calldata seller,
function executeSaleUsd721batch( uint256[] calldata price, uint256[] calldata tokenId, address[] calldata tokenContract, address[] calldata seller,
59,801
2
// Constructor adding the name and token
constructor(uint256 _maxSupply) ERC721("Empires Punks", "EM") { maxSupply = _maxSupply; }
constructor(uint256 _maxSupply) ERC721("Empires Punks", "EM") { maxSupply = _maxSupply; }
2,998
144
// Creates new token with token ID specified and assigns an ownership `_to` for this tokenChecks if `_to` is a smart contract (code size > 0). If so, it calls `onERC721Received` on `_to` and throws if the return value is not `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.Requires executor to have `ROLE_TOKEN_CREATOR` permission_to an address to mint token to _tokenId ID of the token to mint /
function safeMint(address _to, uint256 _tokenId) public override { // delegate to `safeMint` with empty data safeMint(_to, _tokenId, ""); }
function safeMint(address _to, uint256 _tokenId) public override { // delegate to `safeMint` with empty data safeMint(_to, _tokenId, ""); }
38,706
71
// newPricePerSec = newPricePerSec_markup / 1e18 for decimals / 100 to make up for markup (200 == 200%);
newPricePerSec = newPricePerSec.mul(_markup).div(1e18).div(100);
newPricePerSec = newPricePerSec.mul(_markup).div(1e18).div(100);
27,353
55
// Send `_amount` tokens to `_to` from `_from` on the condition it/is approved by `_from`/_from The address holding the tokens being transferred/_to The address of the recipient/_amount The amount of tokens to be transferred/ return True if the transfer was successful
function transferFrom(address _from, address _to, uint256 _amount) returns (bool success) { // The controller of this contract can move tokens around at will, // this is important to recognize! Confirm that you trust the // controller of this contract, which in most situations should be // another open source smart contract or 0x0 if (msg.sender != controller) { require(transfersEnabled); // The standard ERC 20 transferFrom functionality if (allowed[_from][msg.sender] < _amount) { return false; } allowed[_from][msg.sender] -= _amount; } return doTransfer(_from, _to, _amount); }
function transferFrom(address _from, address _to, uint256 _amount) returns (bool success) { // The controller of this contract can move tokens around at will, // this is important to recognize! Confirm that you trust the // controller of this contract, which in most situations should be // another open source smart contract or 0x0 if (msg.sender != controller) { require(transfersEnabled); // The standard ERC 20 transferFrom functionality if (allowed[_from][msg.sender] < _amount) { return false; } allowed[_from][msg.sender] -= _amount; } return doTransfer(_from, _to, _amount); }
28,067
20
// send received funds to the owner
owner.transfer(msg.value);
owner.transfer(msg.value);
6,206
102
// Token with Governance
contract Token is BEP20 { uint256 public maxSupply; constructor(string memory _name, string memory _symbol, uint256 _maxSupply, uint256 _initialSupply, address _holder) BEP20(_name, _symbol) public { require(_initialSupply <= _maxSupply, "Token: cap exceeded"); maxSupply = _maxSupply; _mint(_holder, _initialSupply); } /// @dev Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { require(totalSupply() + _amount <= maxSupply, "Token: cap exceeded"); _mint(_to, _amount); } }
contract Token is BEP20 { uint256 public maxSupply; constructor(string memory _name, string memory _symbol, uint256 _maxSupply, uint256 _initialSupply, address _holder) BEP20(_name, _symbol) public { require(_initialSupply <= _maxSupply, "Token: cap exceeded"); maxSupply = _maxSupply; _mint(_holder, _initialSupply); } /// @dev Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { require(totalSupply() + _amount <= maxSupply, "Token: cap exceeded"); _mint(_to, _amount); } }
34,197
112
// Interface of the ERC20 standard as defined in the EIP. /
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
417
13
// User submitted order.margin when sending the order. Refund the portion of order.margin that executes against the position
uint256 executedOrderMargin = (order.margin * executedOrderSize) / order.size; amountToReturnToUser += executedOrderMargin; remainingOrderMargin = order.margin - executedOrderMargin;
uint256 executedOrderMargin = (order.margin * executedOrderSize) / order.size; amountToReturnToUser += executedOrderMargin; remainingOrderMargin = order.margin - executedOrderMargin;
7,117
8
// Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded.
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** *@dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** *@dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** *@dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** *@dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** *@dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval( address indexed owner, address indexed spender, uint256 value ); }
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** *@dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** *@dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** *@dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** *@dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** *@dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval( address indexed owner, address indexed spender, uint256 value ); }
17,329
18
// get finalized state if asset is not performant
if (state.contractPerformance != ContractPerformance.PF) { state = ICECRegistry(address(assetRegistry)).getFinalizedState(assetId); }
if (state.contractPerformance != ContractPerformance.PF) { state = ICECRegistry(address(assetRegistry)).getFinalizedState(assetId); }
30,211
168
// The Pynths that this contract can issue.
bytes32[] public Pynths;
bytes32[] public Pynths;
35,476
125
// Safely mints `tokenId` and transfers it to `to`. Requirements: - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); }
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); }
44,918
30
// Redeem the user's cUSDC tokens for USDC tokens and transfer the USDC tokens to the user's address
uint256 usdcBalanceBefore = USDC.balanceOf(address(this)); uint256 redeemResult = ICERC20(CUSDC).redeem(_amount); if (redeemResult != 0) { revert RedemptionErrors.USDCRedeemFailed(redeemResult); }
uint256 usdcBalanceBefore = USDC.balanceOf(address(this)); uint256 redeemResult = ICERC20(CUSDC).redeem(_amount); if (redeemResult != 0) { revert RedemptionErrors.USDCRedeemFailed(redeemResult); }
13,440
16
// Such a Media Name should not exist
require(doesMediaExistsFunc(mediaName)==false);
require(doesMediaExistsFunc(mediaName)==false);
22,837
0
// Multiplies two numbers, throws on overflow. /
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
6,702
33
// require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero");
require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount);
require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount);
16,151
9
// 5 >= multiplier >= 0.2
if (_newMultiplier > 5e18 || _newMultiplier < 2e17) _newMultiplier = _multiplier;
if (_newMultiplier > 5e18 || _newMultiplier < 2e17) _newMultiplier = _multiplier;
31,845
12
// Dual Matrix Transfer Transfer Royalty to Either side
uint8 matrix = getMatrix(); uint256 deep_id_target = s.root_tokenId[targetId][matrix]; uint256 deep_id_invoker = s.root_tokenId[invokerId][matrix]; settle([deep_id_target, deep_id_invoker], true); settle([invokerId, targetId], false);
uint8 matrix = getMatrix(); uint256 deep_id_target = s.root_tokenId[targetId][matrix]; uint256 deep_id_invoker = s.root_tokenId[invokerId][matrix]; settle([deep_id_target, deep_id_invoker], true); settle([invokerId, targetId], false);
9,965
403
// Adjust amount to pay
owe = debt - _auctionDebtFloor; // owe' <= owe
owe = debt - _auctionDebtFloor; // owe' <= owe
46,408
30
// Store the function selector of `transferFrom(address,address,uint256)`.
mstore(0x00, 0x23b872dd) mstore(0x20, from) // Store the `from` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x60, amount) // Store the `amount` argument. if iszero( and( // The arguments of `and` are evaluated from right to left.
mstore(0x00, 0x23b872dd) mstore(0x20, from) // Store the `from` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x60, amount) // Store the `amount` argument. if iszero( and( // The arguments of `and` are evaluated from right to left.
5,521
25
// Although this check is not necessary (burn below will run out of gas if not true), it gives the user an explicit reason as to why the enqueue attempt failed.
require(startingGas > gasToConsume, "Insufficient gas for L2 rate limiting burn."); uint256 i; while (startingGas - gasleft() < gasToConsume) { i++; }
require(startingGas > gasToConsume, "Insufficient gas for L2 rate limiting burn."); uint256 i; while (startingGas - gasleft() < gasToConsume) { i++; }
24,463
12
// Checks the amount of input tokens to output tokens _input The address of the token being converted _output The address of the token to be converted to _inputAmount The input amount of tokens that are being converted /
function expected( address _input, address _output, uint256 _inputAmount
function expected( address _input, address _output, uint256 _inputAmount
24,636
163
// Verify merkleProof
require(merkleProof.verify(merkleRoot, keccak256(abi.encodePacked(msg.sender, amount))), "Invalid proof. Not whitelisted"); for (uint256 i = 0; i < amount; i++) { _mint(msg.sender, ogAmount + i); }
require(merkleProof.verify(merkleRoot, keccak256(abi.encodePacked(msg.sender, amount))), "Invalid proof. Not whitelisted"); for (uint256 i = 0; i < amount; i++) { _mint(msg.sender, ogAmount + i); }
29,891
1
// If the `\{id\}` substring is present in the URI, it must be replaced byclients with the actual token type ID. /
function uri(uint256 id) external view returns (string memory);
function uri(uint256 id) external view returns (string memory);
3,590
21
// Internal function to grab manager of passed JasperVault from extensions data structure._jasperVault JasperVault who's manager is needed /
function _manager( IJasperVault _jasperVault
function _manager( IJasperVault _jasperVault
43,845
4
// add coin to staking - this coin acrues interest each day
require(amount > 0, "Cannot stake zero coin"); require(user_coin_staked[user_hash] == 0, "Can only have one stake at once for stake id"); check_increment_day();
require(amount > 0, "Cannot stake zero coin"); require(user_coin_staked[user_hash] == 0, "Can only have one stake at once for stake id"); check_increment_day();
2,336
15
// Get some LP token prices
uint256 two_pool_price = two_pool.get_virtual_price(); uint256 frax2pool_price = frax2pool.get_virtual_price();
uint256 two_pool_price = two_pool.get_virtual_price(); uint256 frax2pool_price = frax2pool.get_virtual_price();
12,113
56
// knc rate range
struct KncPerEth { uint minRate; uint maxRate; uint pendingMinRate; uint pendingMaxRate; }
struct KncPerEth { uint minRate; uint maxRate; uint pendingMinRate; uint pendingMaxRate; }
2,447
259
// counting the number of concluded cycles for later use
noOfConcludedCycles++;
noOfConcludedCycles++;
27,894
12
// index = 1 signer => coinbase (beneficiary address) map
mapping(address => address) public signerCoinbase;
mapping(address => address) public signerCoinbase;
9,895