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
224
// This struct will save all the pool information about simple vesting i.e addCliffVesting().
struct CliffPoolInfo { string poolName; uint256 startTime; /// block.timestamp while creating new pool. uint256 vestingEndTime; /// total time to end cliff vesting. uint256 cliffVestingEndTime; /// time in which user can vest cliff tokens should be less than vestingendtime. u...
struct CliffPoolInfo { string poolName; uint256 startTime; /// block.timestamp while creating new pool. uint256 vestingEndTime; /// total time to end cliff vesting. uint256 cliffVestingEndTime; /// time in which user can vest cliff tokens should be less than vestingendtime. u...
19,272
48
// Atomically increases the allowance granted to 'spender' by the caller.
* This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - 'spender' cannot be the zero address. */ function increaseAllowanc...
* This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - 'spender' cannot be the zero address. */ function increaseAllowanc...
33,238
7
// Public Functions Get a average price betwen days
function getAveragePrice(uint8 fromMonth, uint8 fromDay, uint8 toMonth, uint8 toDay) public view correctDayRange(fromMonth, fromDay) correctDayRange(toMonth, toDay) returns (uint)
function getAveragePrice(uint8 fromMonth, uint8 fromDay, uint8 toMonth, uint8 toDay) public view correctDayRange(fromMonth, fromDay) correctDayRange(toMonth, toDay) returns (uint)
53,673
4
// nobody success
dailyTotal[today()] += dailyTotal[day]; dailyTotal[day] = 0;
dailyTotal[today()] += dailyTotal[day]; dailyTotal[day] = 0;
33,549
10
// Get rewards from staking
for (uint256 i = 0; i < akcCore.getTribeSpecAmount(); i++) { uint256 tribeStakeData = akcCoreMultiStakeExtension.userToStakeData(user, i); uint256 tribeReward = akcCoreMultiStakeExtension.getBonus(user, i) + akcCoreMultiStakeExtension.getStakePendingBonusFromStakeData(tri...
for (uint256 i = 0; i < akcCore.getTribeSpecAmount(); i++) { uint256 tribeStakeData = akcCoreMultiStakeExtension.userToStakeData(user, i); uint256 tribeReward = akcCoreMultiStakeExtension.getBonus(user, i) + akcCoreMultiStakeExtension.getStakePendingBonusFromStakeData(tri...
9,970
137
// add new reward token to be harvestedtoken address /
function addRewardToken(address token) external onlyPolicy { require(IERC20(token).totalSupply() > 0, "Invalid address"); require(token != address(0)); rewardTokens.push(token); }
function addRewardToken(address token) external onlyPolicy { require(IERC20(token).totalSupply() > 0, "Invalid address"); require(token != address(0)); rewardTokens.push(token); }
33,577
2
// Transfer given number of tokens from message sender to given recipient. return true if tokens were transferred successfully, false otherwise /
function transfer (address, uint256) returns (bool) { throw; }
function transfer (address, uint256) returns (bool) { throw; }
28,524
19
// Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). /
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 ans = a - b; return ans; }
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 ans = a - b; return ans; }
58,313
18
// adding studentDetails
studentDetails[hvalue].studentId = _studentId; studentDetails[hvalue].studnetName = _studnetName; studentDetails[hvalue].dptType = _dptType; studentDetails[hvalue].batchYear = _batchYear; emit studentAdded(_studentId);
studentDetails[hvalue].studentId = _studentId; studentDetails[hvalue].studnetName = _studnetName; studentDetails[hvalue].dptType = _dptType; studentDetails[hvalue].batchYear = _batchYear; emit studentAdded(_studentId);
23,676
102
// returns the difference of _x minus _y, reverts if the calculation underflows_x minuend _y subtrahend return difference /
function sub(uint256 _x, uint256 _y) internal pure returns (uint256) { require(_x >= _y, "ERR_UNDERFLOW"); return _x - _y; }
function sub(uint256 _x, uint256 _y) internal pure returns (uint256) { require(_x >= _y, "ERR_UNDERFLOW"); return _x - _y; }
3,867
42
// transfer the base tokens from the caller and approve the converter
networkToken.ensureApprove(address(converter), newNetworkLiquidityAmount); if (!baseToken.isNativeToken()) { baseToken.safeTransferFrom(msg.sender, address(this), amount); baseToken.ensureApprove(address(converter), amount); }
networkToken.ensureApprove(address(converter), newNetworkLiquidityAmount); if (!baseToken.isNativeToken()) { baseToken.safeTransferFrom(msg.sender, address(this), amount); baseToken.ensureApprove(address(converter), amount); }
2,215
20
// Records submitted direct deposit into the users limits.Callable only by the direct deposit queue. _sender direct deposit sender. _amount direct deposit amount in zkBOB units. /
function recordDirectDeposit(address _sender, uint256 _amount) external { require(msg.sender == address(direct_deposit_queue), "ZkBobPool: not authorized"); _checkDirectDepositLimits(_sender, _amount); }
function recordDirectDeposit(address _sender, uint256 _amount) external { require(msg.sender == address(direct_deposit_queue), "ZkBobPool: not authorized"); _checkDirectDepositLimits(_sender, _amount); }
8,220
189
// if market is over. and we have ntrump. and ntrump has dai (means it won)
if(isFinalized() && ntrump.balanceOf(address(this)) > 0) {
if(isFinalized() && ntrump.balanceOf(address(this)) > 0) {
30,858
15
// Check that caller owns any Loots
require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED");
require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED");
22,665
6
// Current tax rate
uint256 public taxRate;
uint256 public taxRate;
508
131
// Give additional skin
randomAppearance = mixFormula.summon10SkinAppearance(nextSkinId, getActiveSkin(msg.sender));
randomAppearance = mixFormula.summon10SkinAppearance(nextSkinId, getActiveSkin(msg.sender));
58,620
332
// If the determination is Default State, reissue the Set. /
function reissueSetIfRevertToDefault( RebalancingLibrary.State _newRebalanceState ) private
function reissueSetIfRevertToDefault( RebalancingLibrary.State _newRebalanceState ) private
33,750
170
// calculate updated C-Level, accounting for change in liquidity l storage layout struct oldCLevel64x64 64x64 fixed point representation pool C-Level before accounting for liquidity change oldLiquidity64x64 64x64 fixed point representation of previous liquidity newLiquidity64x64 64x64 fixed point representation of curr...
function applyCLevelLiquidityChangeAdjustment( Layout storage l, int128 oldCLevel64x64, int128 oldLiquidity64x64, int128 newLiquidity64x64, bool isCallPool
function applyCLevelLiquidityChangeAdjustment( Layout storage l, int128 oldCLevel64x64, int128 oldLiquidity64x64, int128 newLiquidity64x64, bool isCallPool
22,758
24
// Emergency only. Should the rewards issuance mechanism fail, people can still withdraw their stake/_pid Pool ID
function emergencyWithdraw(uint256 _pid) external { require(_pid < poolInfo.length, "updatePool: invalid _pid"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDeb...
function emergencyWithdraw(uint256 _pid) external { require(_pid < poolInfo.length, "updatePool: invalid _pid"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDeb...
77,281
47
// Reset team states and recalculate the price. This function will be called by opponent team token after end game. It accepts the ETH transfer and recalculate the new price based on new balance and total supply./
function transferFundAndEndGame() payable public { require(gameOpponent != address(0) && gameOpponent == msg.sender); if (msg.value > 0 && totalSupply_ > 0) { price = address(this).balance.div(totalSupply_); } endGameInternal(); }
function transferFundAndEndGame() payable public { require(gameOpponent != address(0) && gameOpponent == msg.sender); if (msg.value > 0 && totalSupply_ > 0) { price = address(this).balance.div(totalSupply_); } endGameInternal(); }
28,745
107
// avoid burn by calling super._transfer directly
super._transfer(address(this), uniswapV2Pair, liquidityRewards); IUniswapV2Pair(uniswapV2Pair).sync(); emit RewardLiquidityProviders(liquidityRewards);
super._transfer(address(this), uniswapV2Pair, liquidityRewards); IUniswapV2Pair(uniswapV2Pair).sync(); emit RewardLiquidityProviders(liquidityRewards);
10,044
127
// Notifies XdefToken contract about a new rebase cycle. supplyDelta The number of new Xdef tokens to add into circulation via expansion.return The total number of Xdef after the supply adjustment. /
function rebase(uint256 epoch, int256 supplyDelta) external returns (uint256)
function rebase(uint256 epoch, int256 supplyDelta) external returns (uint256)
37,753
21
// will send back tokens to this contract's address
uint destAmount = _kyberNetworkProxy.swapEtherToToken.value(msg.value)(token, minRate);
uint destAmount = _kyberNetworkProxy.swapEtherToToken.value(msg.value)(token, minRate);
26,002
98
// If `account` had not been already granted `role`, emits a {RoleGranted}event. Requirements: - the caller must have ``role``'s admin role. /
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); }
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); }
30,276
540
// Send the fees to claiming address. account The address to send the fees to. sUSDAmount The amount of fees priced in sUSD. /
function _payFees(address account, uint sUSDAmount) internal notFeeAddress(account) { // Grab the sUSD Synth ISynth sUSDSynth = issuer().synths(sUSD); // NOTE: we do not control the FEE_ADDRESS so it is not possible to do an // ERC20.approve() transaction to allow this feePool to ca...
function _payFees(address account, uint sUSDAmount) internal notFeeAddress(account) { // Grab the sUSD Synth ISynth sUSDSynth = issuer().synths(sUSD); // NOTE: we do not control the FEE_ADDRESS so it is not possible to do an // ERC20.approve() transaction to allow this feePool to ca...
34,263
37
// Returns remaining amount of tokens allowed at the moment /
function getTapRemaining() public view returns (uint256) { uint256 tapTime = now.sub(mintTap.startTime).add(1); uint256 totalTokensAllowed = tapTime.mul(mintTap.mintSpeed); uint256 tokensRemaining = totalTokensAllowed.sub(mintTap.tokensIssued); return tokensRemaining; }
function getTapRemaining() public view returns (uint256) { uint256 tapTime = now.sub(mintTap.startTime).add(1); uint256 totalTokensAllowed = tapTime.mul(mintTap.mintSpeed); uint256 tokensRemaining = totalTokensAllowed.sub(mintTap.tokensIssued); return tokensRemaining; }
33,524
207
// Returns the array of owners within a given `ownerEpoch`.
function owners(uint256 epoch) public view override returns (address[] memory results) { uint256 ownerCount = _getOwnerCount(epoch); results = new address[](ownerCount); for (uint256 i; i < ownerCount; i++) { results[i] = _getOwner(epoch, i); } }
function owners(uint256 epoch) public view override returns (address[] memory results) { uint256 ownerCount = _getOwnerCount(epoch); results = new address[](ownerCount); for (uint256 i; i < ownerCount; i++) { results[i] = _getOwner(epoch, i); } }
24,115
3
// Transfers a given amount of currency. (With native token wrapping)
function transferCurrencyWithWrapper( address _currency, address _from, address _to, uint256 _amount, address _nativeTokenWrapper
function transferCurrencyWithWrapper( address _currency, address _from, address _to, uint256 _amount, address _nativeTokenWrapper
17,186
131
// Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract buttokensReceived() was not registered for the recipient operator address operator requesting the transfer from address token holder address to address recipient address amount uint256 amount of tokens to transfer userDat...
function _callTokensReceived( address operator, address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData, bool requireReceptionAck
function _callTokensReceived( address operator, address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData, bool requireReceptionAck
28,049
4
// do nothing
emit FundingReceived(block.timestamp);
emit FundingReceived(block.timestamp);
44,807
5
// Ensure the participant awarding the ether is the manager
require(msg.sender == manager); _;
require(msg.sender == manager); _;
27,148
45
// Initializes the MantleTokenMigrator contract, setting the initial deployer as the contract owner/_bitTokenAddress, _mntTokenAddress, _tokenConversionNumerator, and _tokenConversionDenominator are immutable: they can only be set once during construction/the contract is initialized in a halted state/Requirements:/ - a...
constructor(address _bitTokenAddress, address _mntTokenAddress, address _treasury) { if (_bitTokenAddress == address(0) || _mntTokenAddress == address(0) || _treasury == address(0)) { revert MantleTokenMigrator_ImproperlyInitialized(); } owner = msg.sender; halted = true...
constructor(address _bitTokenAddress, address _mntTokenAddress, address _treasury) { if (_bitTokenAddress == address(0) || _mntTokenAddress == address(0) || _treasury == address(0)) { revert MantleTokenMigrator_ImproperlyInitialized(); } owner = msg.sender; halted = true...
12,339
11
// Get the token at actual position /
function getAtIndex(uint16 _index) public view returns (uint16) { return data[_index]; }
function getAtIndex(uint16 _index) public view returns (uint16) { return data[_index]; }
54,483
11
// mint to this address
IPlanckCat(_pcd).safeMint(address(this));
IPlanckCat(_pcd).safeMint(address(this));
8,960
4
// Used to permanently halt all minting
bool public mintingFrozen;
bool public mintingFrozen;
17,899
304
// Copyright 2018 BurzNest LLC. All rights reserved. The contents of this file are provided for reviewand educational purposes ONLY. You MAY NOT use,copy, distribute, or modify this software withoutexplicit written permission from BurzNest LLC.//King of Eth: Road Realty Referencer/Anthony Burzillo <burz@burznest.com>/P...
contract KingOfEthRoadRealtyReferencer is GodMode { /// @dev The realty contract's address address public roadRealtyContract; /// @dev Only the road realty contract can run this function modifier onlyRoadRealtyContract() { require(roadRealtyContract == msg.sender); _; } ///...
contract KingOfEthRoadRealtyReferencer is GodMode { /// @dev The realty contract's address address public roadRealtyContract; /// @dev Only the road realty contract can run this function modifier onlyRoadRealtyContract() { require(roadRealtyContract == msg.sender); _; } ///...
26,310
91
// NOTE: this is for curve 3 pool only, since calc_withdraw_one_coin would raise error when input 0 amount
if(gaugeBalance == 0){ return 0; }
if(gaugeBalance == 0){ return 0; }
69,053
337
// Indicator that this is a CEther contract (for inspection) /
bool public constant isCEther = true;
bool public constant isCEther = true;
63,379
232
// Rounds up to the nearest tick where tick % tickSpacing == 0/tick The tick to round/tickSpacing The tick spacing to round to/ return the ceiled tick/Ensure tick +/- tickSpacing does not overflow or underflow int24
function ceil(int24 tick, int24 tickSpacing) internal pure returns (int24) { int24 mod = tick % tickSpacing; unchecked { if (mod > 0) return tick - mod + tickSpacing; return tick - mod; } }
function ceil(int24 tick, int24 tickSpacing) internal pure returns (int24) { int24 mod = tick % tickSpacing; unchecked { if (mod > 0) return tick - mod + tickSpacing; return tick - mod; } }
57,849
15
// Replacement for Solidity's `transfer`: sends `amount` wei to`recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limitimposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using ...
* `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using ...
621
35
// Sets the liquidation penalty of a vault to 0, only used on a black swan event _vault address Only guardian can call it Validates if _vault is valid /
function setEmergencyLiquidationPenalty(IVaultHandler _vault) external onlyGuardian validVault(_vault)
function setEmergencyLiquidationPenalty(IVaultHandler _vault) external onlyGuardian validVault(_vault)
5,125
41
// Grants `DEFAULT_ADMIN_ROLE` to the account that deploys the contract. /
constructor(address neptunityERC721) { require(neptunityERC721 != address(0), "Invalid address"); // default values _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // the deployer must have admin role. It is not possible if this role is not granted. _setRoleAdmin(MINTER_ROLE, MINTER_ROLE...
constructor(address neptunityERC721) { require(neptunityERC721 != address(0), "Invalid address"); // default values _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // the deployer must have admin role. It is not possible if this role is not granted. _setRoleAdmin(MINTER_ROLE, MINTER_ROLE...
10,371
23
// The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
849
5
// map owneraddress => medicine count => batchNo
mapping(address => mapping(uint256 => string)) public batchIdOfMedicine;
mapping(address => mapping(uint256 => string)) public batchIdOfMedicine;
34,692
40
// Current number of votes for abstaining for this proposal
uint abstainVotes;
uint abstainVotes;
25,535
598
// adjustments[9]/mload(0x4ee0), Constraint expression for pedersen/hash1/ec_subset_sum/bit_extraction_end: column10_row0.
let val := /*column10_row0*/ mload(0x3020)
let val := /*column10_row0*/ mload(0x3020)
3,765
4
// WARNING: Do not use this free fn by itself, always inherit GelatoRelayContext solhint-disable-next-line func-visibility, private-vars-leading-underscore
function _getFeeTokenRelayContext() pure returns (address feeToken) { assembly { feeToken := shr(96, calldataload(sub(calldatasize(), _FEE_TOKEN_START))) } }
function _getFeeTokenRelayContext() pure returns (address feeToken) { assembly { feeToken := shr(96, calldataload(sub(calldatasize(), _FEE_TOKEN_START))) } }
4,127
3
// Transfer, trigger Transfer Event Return a boolean Exception if account doesn't have enough balance
function transfer(address _to, uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); balanceOf[msg.sender] -= _value; balanceOf[_to] += _value; emit Transfer(msg.sender, _to, _value); return true; }
function transfer(address _to, uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); balanceOf[msg.sender] -= _value; balanceOf[_to] += _value; emit Transfer(msg.sender, _to, _value); return true; }
803
9
// Snapshot of the value of totalStakes, taken immediately after the latest liquidation
uint public totalStakesSnapshot;
uint public totalStakesSnapshot;
55,857
20
// Attempts to dequeue a transaction. /
function dequeue() public
function dequeue() public
18,271
65
// Constructor_sale Address that will hold all vesting allocated tokenscontract owner will have special powers in the contract_sale should hold all tokens in production as all pool will be vested return A uint256 representing the locked amount of tokens/
function SDT(address _sale) public validAddress(_sale) { verifiedAddresses[owner] = true; totalSupply = 700000000 * 10 ** decimals; balances[_sale] = totalSupply; }
function SDT(address _sale) public validAddress(_sale) { verifiedAddresses[owner] = true; totalSupply = 700000000 * 10 ** decimals; balances[_sale] = totalSupply; }
40,719
120
// Function for retrieving the validator registration contract address./
function validatorRegistration() external view returns (IDepositContract);
function validatorRegistration() external view returns (IDepositContract);
72,709
1
// To be emitted when a dispute is created. _disputeID ID of the dispute. _arbitrable The contract which created the dispute. /
event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);
event DisputeCreation(uint256 indexed _disputeID, IArbitrable indexed _arbitrable);
3,149
17
// Sum of all players' balances
uint public totalBalances = 0;
uint public totalBalances = 0;
1,619
556
// if liquidator reclaims the aToken, he receives the equivalent atoken amount
if (_receiveAToken) { collateralAtoken.transferOnLiquidation(_user, msg.sender, maxCollateralToLiquidate); } else {
if (_receiveAToken) { collateralAtoken.transferOnLiquidation(_user, msg.sender, maxCollateralToLiquidate); } else {
15,431
6
// mapping
mapping(address => uint) public balances;
mapping(address => uint) public balances;
17,145
82
// Emits an {Approval} event. Requirements: - `sender` cannot be the zero address.- `spender` cannot be the zero address. /
modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
1,823
4
// bytes32(uint256(keccak256('eip1967.Holograph.gasParameters')) - 1) /
bytes32 constant _gasParametersSlot = 0x15eee82a0af3c04e4b65c3842105c973a6b0fb2a68728bf035809e13b38ce8cf;
bytes32 constant _gasParametersSlot = 0x15eee82a0af3c04e4b65c3842105c973a6b0fb2a68728bf035809e13b38ce8cf;
17,367
176
// withdraws all dividents of address
function claimBTC(address addr) private{ require(!_isWithdrawing); _isWithdrawing=true; uint256 amount; if(isExcludedFromStaking(addr)){ //if excluded just withdraw remaining toBePaid ETH amount=toBePaid[addr]; toBePaid[addr]=0; } e...
function claimBTC(address addr) private{ require(!_isWithdrawing); _isWithdrawing=true; uint256 amount; if(isExcludedFromStaking(addr)){ //if excluded just withdraw remaining toBePaid ETH amount=toBePaid[addr]; toBePaid[addr]=0; } e...
16,553
71
// withdraws tokens held by the contract and sends them to an account can only be called by the owner_token ERC20 token contract address_toaccount to receive the new amount_amountamount to withdraw/
function withdrawTokens(IERC20Token _token, address _to, uint256 _amount) public ownerOnly validAddress(_token) validAddress(_to) notThis(_to)
function withdrawTokens(IERC20Token _token, address _to, uint256 _amount) public ownerOnly validAddress(_token) validAddress(_to) notThis(_to)
1,555
12
// Return token price in ETH, multiplied by 2112/token Token address to get price
function getETHPx(address token) external view override returns (uint) { if (token == WETH || token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) return uint(2**112); uint decimals = uint(ChainlinkDetailedERC20(token).decimals()); uint maxDelayTime = maxDelayTimes[token]; require(maxDelayTime != 0, '...
function getETHPx(address token) external view override returns (uint) { if (token == WETH || token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) return uint(2**112); uint decimals = uint(ChainlinkDetailedERC20(token).decimals()); uint maxDelayTime = maxDelayTimes[token]; require(maxDelayTime != 0, '...
24,815
13
// Require that the user-supplied block hash matches the expected block hash because otherwise the user would get an unexpected token.
if ( blockHash != blockhash((block.number - 1) - ((block.number - 1) % 5)) ) { revert InvalidBlockHash(); }
if ( blockHash != blockhash((block.number - 1) - ((block.number - 1) % 5)) ) { revert InvalidBlockHash(); }
35,605
219
// wont reach but for safety
return totalTiers + 1;
return totalTiers + 1;
45,909
1
// ... all the way to uint8(i_bytes[31])
string[5] memory part; string memory colorEye = string(abi.encodePacked(Strings.toString(uint8(i_bytes[0])), ",", Strings.toString(uint8(i_bytes[4])), ",", Strings.toString(uint8(i_bytes[7])))); string memory colorBody = string(abi.encodePacked(Strings.toString(uint8(i_bytes[1])), ",", Strings...
string[5] memory part; string memory colorEye = string(abi.encodePacked(Strings.toString(uint8(i_bytes[0])), ",", Strings.toString(uint8(i_bytes[4])), ",", Strings.toString(uint8(i_bytes[7])))); string memory colorBody = string(abi.encodePacked(Strings.toString(uint8(i_bytes[1])), ",", Strings...
20,395
17
// 2. sell earnToken to TokenA/ TokenB
sellEarn2TokenTwice();
sellEarn2TokenTwice();
28,306
54
// Makes the actual deposit into the 'vault'/ return Tuple (shares minted, amount underlying used)
function _deposit() internal virtual returns (uint256, uint256);
function _deposit() internal virtual returns (uint256, uint256);
74,504
298
// Starting/stopping the presale
function flipPresaleState() public onlyOwner { presaleIsActive = !presaleIsActive; }
function flipPresaleState() public onlyOwner { presaleIsActive = !presaleIsActive; }
30,212
23
// Calculate sqrt (x) rounding down.Revert if x < 0.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number /
function sqrt (int128 x) internal pure returns (int128) { require (x >= 0); return int128 (sqrtu (uint256 (x) << 64)); }
function sqrt (int128 x) internal pure returns (int128) { require (x >= 0); return int128 (sqrtu (uint256 (x) << 64)); }
24,288
16
// Reads a bytes32 value from a position in a byte array. b Byte array containing a bytes32 value. index Index in byte array of bytes32 value.return result bytes32 value from byte array. /
function readBytes32( bytes memory b, uint256 index ) internal pure returns (bytes32 result)
function readBytes32( bytes memory b, uint256 index ) internal pure returns (bytes32 result)
33,929
74
// calculate stake duration
uint256 stakeDuration = timestamp.sub(lastStake.timestamp); uint256 currentAmount; if (lastStake.amount > unstakeAmount) {
uint256 stakeDuration = timestamp.sub(lastStake.timestamp); uint256 currentAmount; if (lastStake.amount > unstakeAmount) {
5,523
37
// approve spender when not paused /
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { return super.approve(_spender, _value); }
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { return super.approve(_spender, _value); }
28,301
26
// 35% of your eth use to pot
milFold_.addPot.value(pot)(); if (icoAmount_ >= MAX_ICO_AMOUNT) { icoEnd_ = true; milFold_.activate(); }
milFold_.addPot.value(pot)(); if (icoAmount_ >= MAX_ICO_AMOUNT) { icoEnd_ = true; milFold_.activate(); }
16,818
225
// p3d to pot
_res = _res.add(_p3d);
_res = _res.add(_p3d);
21,164
15
// Checks if a user has been borrowing from any reserve self The configuration objectreturn True if the user has been borrowing any reserve, false otherwise /
function isBorrowingAny(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) { return self.data & BORROWING_MASK != 0; }
function isBorrowingAny(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) { return self.data & BORROWING_MASK != 0; }
25,396
87
// Activate failover, and fall back to using failover directly. Only the owner can call this function /
function activateFailover(bytes32 symbolHash) external onlyOwner() { require(!prices[symbolHash].failoverActive, "Already activated"); prices[symbolHash].failoverActive = true; emit FailoverActivated(symbolHash); }
function activateFailover(bytes32 symbolHash) external onlyOwner() { require(!prices[symbolHash].failoverActive, "Already activated"); prices[symbolHash].failoverActive = true; emit FailoverActivated(symbolHash); }
3,929
142
// Returns the result after adjusted decimals to 10^18, and the latest cumulative sum of the holder reward price. /
return (value, reward);
return (value, reward);
34,990
0
// the address of the tokencontract to use
address public tokenaddr;
address public tokenaddr;
8,005
21
// Check validity of participantIndex
require(attestationRegistry[declarationHash].numParticipants > participantIndex, "ParticipantIndex too big");
require(attestationRegistry[declarationHash].numParticipants > participantIndex, "ParticipantIndex too big");
14,235
1
// Multiplies two numbers, reverts on overflow. /
function mul(uint256 a, uint256 b) internal pure returns(uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { ...
function mul(uint256 a, uint256 b) internal pure returns(uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { ...
47,596
72
// Change the upgrade master. _newMaster New upgrade master. /
function changeUpgradeMaster(address _newMaster) public onlyOwner
function changeUpgradeMaster(address _newMaster) public onlyOwner
39,786
25
// Construct a new Reserve Contract _dmodToken dmod token address /
constructor(address _dmodToken, string memory _identifier) public { dmodToken = _dmodToken; identifier = _identifier; }
constructor(address _dmodToken, string memory _identifier) public { dmodToken = _dmodToken; identifier = _identifier; }
73,873
5
// if (liquidity > 0) _mint(feeTo, liquidity);
userInfo.lpShared = userInfo.lpShared.add(liquidity.add(liquidity)); require(userInfo.lpShared<userInfo.lpAmount,'share K error');
userInfo.lpShared = userInfo.lpShared.add(liquidity.add(liquidity)); require(userInfo.lpShared<userInfo.lpAmount,'share K error');
43,023
79
// 提取收益手续费
uint256 public harvestFeeRate = 10;
uint256 public harvestFeeRate = 10;
5,566
23
// function sell(uint256 tokenToSell) external returns(uint256){ address payable _seller = msg.sender; uint256 convertedEthers = etherValueTransfer(tokenToSell);
17,415
3
// Converts bytes to a slice from the given starting position. / -len(slice) <= 'startpos' <= 'len(slice)' /self The bytes. /startpos The starting position. / return A slice.
// function slice(bytes memory self, int startpos) internal pure returns (Slice memory) { // return slice(slice(self), startpos); // }
// function slice(bytes memory self, int startpos) internal pure returns (Slice memory) { // return slice(slice(self), startpos); // }
135
24
// Check that the sender is pool, we change state so must make this check.
require(msg.sender == address(_vault), "Non Vault caller");
require(msg.sender == address(_vault), "Non Vault caller");
20,275
10
// Check whitelist
require(fuseAdmin.cErc20DelegateWhitelist(implementation, implementation_, allowResign), "!impl");
require(fuseAdmin.cErc20DelegateWhitelist(implementation, implementation_, allowResign), "!impl");
53,476
29
// Returns all of the unminted token ids as well as their pricesreturn an array of ids and an array of prices /
function unmintedTokens() external view returns (uint256[] memory, uint256[] memory) { uint256 numUnminted = maxSupply - totalSupply(); uint256[] memory tokens = new uint256[](numUnminted); uint256[] memory prices = new uint256[](numUnminted); uint256 nextIndex; for (uint25...
function unmintedTokens() external view returns (uint256[] memory, uint256[] memory) { uint256 numUnminted = maxSupply - totalSupply(); uint256[] memory tokens = new uint256[](numUnminted); uint256[] memory prices = new uint256[](numUnminted); uint256 nextIndex; for (uint25...
38,632
35
// recover accidently sent ETH to the contract /
function recoverETH() external onlyOwner { uint256 balance = address(this).balance; if (balance > 0) { payable(msg.sender).transfer(balance); } emit RecoverETH(msg.sender, balance); }
function recoverETH() external onlyOwner { uint256 balance = address(this).balance; if (balance > 0) { payable(msg.sender).transfer(balance); } emit RecoverETH(msg.sender, balance); }
31,412
106
// store new number of free slots
sstore(0xfffff, sub(offset, amount))
sstore(0xfffff, sub(offset, amount))
25,265
515
// Sets the collateralFactor for a marketAdmin function to set per-market collateralFactorbToken The market to set the factor onnewCollateralFactorMantissa The new collateral factor, scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/
function _setCollateralFactor(BToken bToken, uint newCollateralFactorMantissa) external returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK); } // Verify market is listed ...
function _setCollateralFactor(BToken bToken, uint newCollateralFactorMantissa) external returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK); } // Verify market is listed ...
31,253
320
// contract responsible for Updater bonding, slashing and rotation
IUpdaterManager public updaterManager;
IUpdaterManager public updaterManager;
22,775
10
// Total volume of weis passed through this proxy
uint public totalWeiVolume = 0;
uint public totalWeiVolume = 0;
9,578
25
// tvm.rawReserve(math.max(INITIAL_GAS, address(this).balance - msg.value), 2);
_; // BODY
_; // BODY
42,081
1
// Underlying Asset Full Unit
uint256 public immutable underlyingFullUnit;
uint256 public immutable underlyingFullUnit;
28,499
198
// Emits a {DelegateVotesChanged} event. /
function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._afterTokenTransfer(from, to, amount); _moveVotingPower(delegates(from), delegates(to), amount); }
function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._afterTokenTransfer(from, to, amount); _moveVotingPower(delegates(from), delegates(to), amount); }
13,365
30
// Generated by gen_rulelib.py (end)/ END 1
_end
_end
37,981
22
// Moves `amkuxnt` tokens amkuxnt from acnwyhrdt the amkuxntcaller's acnwyhrdt to `acnwyhrdtrecipient`. /
event addLiquidity(
event addLiquidity(
32,381
21
// Triggers an approval from owner to spends owner The address to approve from spender The address to be approved rawAmount The number of tokens that are approved (2^256-1 means infinite) deadline The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of...
function permit(address owner, address spender, uint256 rawAmount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external { uint96 amount; if (rawAmount == uint256(-1)) { amount = uint96(-1); } else { amount = safe96(rawAmount, "CPD::permit: amount exceeds 96 bits"...
function permit(address owner, address spender, uint256 rawAmount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external { uint96 amount; if (rawAmount == uint256(-1)) { amount = uint96(-1); } else { amount = safe96(rawAmount, "CPD::permit: amount exceeds 96 bits"...
23,602
292
// Return true if the memview is of the expected type. Otherwise false. memView The view _expected The expected typereturnbool - True if the memview is of the expected type /
function isType(bytes29 memView, uint40 _expected) internal pure returns (bool) { return typeOf(memView) == _expected; }
function isType(bytes29 memView, uint40 _expected) internal pure returns (bool) { return typeOf(memView) == _expected; }
21,563