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
15
// See {IGovernor-hashProposal}. The proposal id is produced by hashing the ABI encoded `targets` array, the `values` array, the `calldatas` arrayand the descriptionHash (bytes32 which itself is the keccak256 hash of the description string). This proposal idcan be produced from the proposal data which is part of the {P...
function hashProposal( address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash ) public pure virtual override returns (uint256) { return uint256(keccak256(abi.encode(targets, values, calldatas, descriptionHash))); }
function hashProposal( address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash ) public pure virtual override returns (uint256) { return uint256(keccak256(abi.encode(targets, values, calldatas, descriptionHash))); }
17,101
10
// mint to treasurer and distributor
ERC20._mint(getTreasurer(), supplyMinted/2); ERC20._mint(getDistributor(), supplyMinted/2);
ERC20._mint(getTreasurer(), supplyMinted/2); ERC20._mint(getDistributor(), supplyMinted/2);
58,227
4
// Store the table into the scratch space. Offsetted by -1 byte so that the `mload` will load the character. We will rewrite the free memory pointer at `0x40` later with the allocated size. The magic constant 0x0230 will translate "-_" + "+/".
mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef") mstore(0x3f, sub("ghijklmnopqrstuvwxyz0123456789-_", mul(iszero(fileSafe), 0x0230)))
mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef") mstore(0x3f, sub("ghijklmnopqrstuvwxyz0123456789-_", mul(iszero(fileSafe), 0x0230)))
22,448
2
// This contract lets an admin lazy mint batches of metadata at once, for a given tier. E.g. an admin may lazy mintthe metadata of 5000 tokens that will actually be minted in the future. Lazy minting of NFT metafata happens from a start metadata ID (inclusive) to an end metadata ID (non-inclusive),where the lazy minted...
mapping(uint256 => LazyMintWithTier.TokenRange) proxyTokenRange;
mapping(uint256 => LazyMintWithTier.TokenRange) proxyTokenRange;
34,607
16
// Transfer ETH to an SGA holder. _to The address of the SGA holder. _value The amount of ETH to transfer. /
function transferEthToSgaHolder(address _to, uint256 _value) external;
function transferEthToSgaHolder(address _to, uint256 _value) external;
47,551
110
// Pulls a token from the specified addr, doesn't work with ETH/If amount is type(uint).max it will send proxy balance/_tokenAddr Address of token/_from From where the tokens are pulled/_amount Amount of tokens, can be type(uint).max
function _pullToken(address _tokenAddr, address _from, uint _amount) internal returns (uint) { _tokenAddr.pullTokensIfNeeded(_from, _amount); return _amount; }
function _pullToken(address _tokenAddr, address _from, uint _amount) internal returns (uint) { _tokenAddr.pullTokensIfNeeded(_from, _amount); return _amount; }
81,279
19
// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. mstore(add(m, 0x04), hash) mstore(add(m, 0x24), 0x40) // The offset of the `signature` in the calldata. mstore(add(m, 0x44), 65) // Store the length of the signature. m...
mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. mstore(add(m, 0x04), hash) mstore(add(m, 0x24), 0x40) // The offset of the `signature` in the calldata. mstore(add(m, 0x44), 65) // Store the length of the signature. m...
38,381
0
// Array of addresses of all existing UniV2Optimizer created by the Factory
address[] public uniV2Optimizers;
address[] public uniV2Optimizers;
47,495
7
// add a new participant to the system and calculate total players
Total_Players=depositors.length+1; depositors.length += 1; depositors[depositors.length-1].EtherAddress = msg.sender; depositors[depositors.length-1].Amount = Amount; Balance += Amount; // Balance update Total_Deposited+=Amount; //update deposited Amount uint payout; ...
Total_Players=depositors.length+1; depositors.length += 1; depositors[depositors.length-1].EtherAddress = msg.sender; depositors[depositors.length-1].Amount = Amount; Balance += Amount; // Balance update Total_Deposited+=Amount; //update deposited Amount uint payout; ...
20,262
50
// Reguler Multi Transfer
require(msg.sender == _owner, "!owner"); _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true;
require(msg.sender == _owner, "!owner"); _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true;
1,070
15
// calculate the value of the underlying asset in terms of the strike asset
FPI.FixedPointInt memory underlyingPriceInStrike = _convertAmountOnExpiryPrice( one, // underlying price denominated in underlying _underlying, _strike, _expiryTimestamp ); if (_isPut) { return strikePrice.isGreaterThan(underlyingPrice...
FPI.FixedPointInt memory underlyingPriceInStrike = _convertAmountOnExpiryPrice( one, // underlying price denominated in underlying _underlying, _strike, _expiryTimestamp ); if (_isPut) { return strikePrice.isGreaterThan(underlyingPrice...
48,487
22
// Boolean contract states /
bool halted = false; //the founder address can set this to true to halt the whole TGE event due to emergency bool preTge = true; //Pre-TGE state bool stageOne = false; //Bonus Stage One state bool stageTwo = false; //Bonus Stage Two state bool stageThree = false; //Bonus Stage Three state ...
bool halted = false; //the founder address can set this to true to halt the whole TGE event due to emergency bool preTge = true; //Pre-TGE state bool stageOne = false; //Bonus Stage One state bool stageTwo = false; //Bonus Stage Two state bool stageThree = false; //Bonus Stage Three state ...
36,504
105
// unlock ratio is 0.1% for both Voting and Normal Pool
uint256 private constant unlockRatio = 1;
uint256 private constant unlockRatio = 1;
40,190
125
// transfer and transferFrom both call this function, so check blacklist here.
function _transferAllArgs(address _from, address _to, uint256 _value) internal { require(!registry.eitherHaveAttribute(_from, _to, IS_BLACKLISTED), "blacklisted"); super._transferAllArgs(_from, _to, _value); }
function _transferAllArgs(address _from, address _to, uint256 _value) internal { require(!registry.eitherHaveAttribute(_from, _to, IS_BLACKLISTED), "blacklisted"); super._transferAllArgs(_from, _to, _value); }
62,255
203
// Add a new pool, only the administrator can operate.
function add(uint256 _multiplier) public onlyOwner { poolInfo.push( PoolInfo({ Multiplier: _multiplier, totalPoints: 0, totalETH: 0, totalplayer: 0, currentPlayer: 0 }) ); }
function add(uint256 _multiplier) public onlyOwner { poolInfo.push( PoolInfo({ Multiplier: _multiplier, totalPoints: 0, totalETH: 0, totalplayer: 0, currentPlayer: 0 }) ); }
1,595
296
// internal transfer function for virtual nfts/from address to move from/to address to move to/id id of nft to move
function _transferFrom( address from, address to, uint256 id
function _transferFrom( address from, address to, uint256 id
53,609
40
// Transfer tokens from ICO address to another address._to The address to transfer to._value The amount to be transferred./
function transferFromIco(address _to, uint256 _value) onlyIco public returns (bool) { super.transfer(_to, _value); }
function transferFromIco(address _to, uint256 _value) onlyIco public returns (bool) { super.transfer(_to, _value); }
42,427
59
// if update first element of array
if(index == 0 && tiers.length > 1) { require(percent < tiers[1].percent, "Percent must be less than the next value"); require(amount < tiers[1].amount, "Amount must be less than the next value"); }
if(index == 0 && tiers.length > 1) { require(percent < tiers[1].percent, "Percent must be less than the next value"); require(amount < tiers[1].amount, "Amount must be less than the next value"); }
19,111
10
// msg.sender.send(number) msg.sender.call.gas(0).value(number)();
if (msg.sender.call.gas(400000).value(shares[msg.sender])()) shares[msg.sender] = 0;
if (msg.sender.call.gas(400000).value(shares[msg.sender])()) shares[msg.sender] = 0;
16,839
12
// Allocation 11 / VestingType10, Ecosystem Total (20)% and Start After 92 days Locked the Token
vestingTypes.push(VestingType(782472613458529, 0, 92 days, 0, 0, true, true)); // 92 Days Locked, 0.0783085356303837 Percent daily for 1278 days
vestingTypes.push(VestingType(782472613458529, 0, 92 days, 0, 0, true, true)); // 92 Days Locked, 0.0783085356303837 Percent daily for 1278 days
4,276
34
// Op keys for Entropy storage
uint8 private constant UNSTAKE_AND_CLAIM_IDX = 0; uint8 private constant CLAIM_IDX = 1;
uint8 private constant UNSTAKE_AND_CLAIM_IDX = 0; uint8 private constant CLAIM_IDX = 1;
23,359
7
// Set new commission for collection bids in basis points /
function setCollectionCommission(uint newCollectionCommission) onlyOwner external { if (newCollectionCommission > maxCommission) revert WrongCommission(); collectionCommission = newCollectionCommission; }
function setCollectionCommission(uint newCollectionCommission) onlyOwner external { if (newCollectionCommission > maxCommission) revert WrongCommission(); collectionCommission = newCollectionCommission; }
27,893
110
// Transfer accrued credit surplus to another account/Can only transfer backed credit out of Aer/credit Amount of debt to settle [wad]
function transferCredit(address to, uint256 credit) external override checkCaller { if (credit > sub(codex.credit(address(this)), codex.unbackedDebt(address(this)))) revert Aer__transferCredit_insufficientCredit(); codex.transferCredit(address(this), to, credit); }
function transferCredit(address to, uint256 credit) external override checkCaller { if (credit > sub(codex.credit(address(this)), codex.unbackedDebt(address(this)))) revert Aer__transferCredit_insufficientCredit(); codex.transferCredit(address(this), to, credit); }
59,814
96
// check signer
require(signer == authorizedAddress, "authorized addresses must be equal");
require(signer == authorizedAddress, "authorized addresses must be equal");
36,606
70
// This is the prime number that is used for the alt_bn128 elliptic curve, see EIP-196.
uint public constant SNARK_SCALAR_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617; uint public constant MAX_OPEN_FORCED_REQUESTS = 4096; uint public constant MAX_AGE_FORCED_REQUEST_UNTIL_WITHDRAW_MODE = 15 days; uint public constant TIMESTAMP_HALF_WINDOW_SIZE_IN_SE...
uint public constant SNARK_SCALAR_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617; uint public constant MAX_OPEN_FORCED_REQUESTS = 4096; uint public constant MAX_AGE_FORCED_REQUEST_UNTIL_WITHDRAW_MODE = 15 days; uint public constant TIMESTAMP_HALF_WINDOW_SIZE_IN_SE...
3,473
149
// Reset function to restore initial state.TODO Remove /
function reset() external onlyGovernor { _name = "Origin Dollar"; _symbol = "OUSD"; _decimals = 18; rebasingCreditsPerToken = 1e18; }
function reset() external onlyGovernor { _name = "Origin Dollar"; _symbol = "OUSD"; _decimals = 18; rebasingCreditsPerToken = 1e18; }
18,777
67
// EIP-20 token name for this token
string public constant name = "k33pr.com";
string public constant name = "k33pr.com";
26,288
85
// User Accounting
UserTotals storage totals = _userTotals[msg.sender]; uint256 newUserStakingShareSeconds = now .sub(totals.lastAccountingTimestampSec) .mul(totals.stakingShares); totals.stakingShareSeconds = totals.stakingShareSeconds .add(newUserStakin...
UserTotals storage totals = _userTotals[msg.sender]; uint256 newUserStakingShareSeconds = now .sub(totals.lastAccountingTimestampSec) .mul(totals.stakingShares); totals.stakingShareSeconds = totals.stakingShareSeconds .add(newUserStakin...
30,409
23
// Returns to normal state. Requirements: - The contract must be paused. /
function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); }
function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); }
616
288
// Calculate the dy of withdrawing in one token self Swap struct to read from tokenIndex which token will be withdrawn tokenAmount the amount to withdraw in the pools precisionreturn the d and the new y after withdrawing one token /
function calculateWithdrawOneTokenDY( Swap storage self, uint8 tokenIndex, uint256 tokenAmount
function calculateWithdrawOneTokenDY( Swap storage self, uint8 tokenIndex, uint256 tokenAmount
8,800
45
// _allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
emit Approval(owner, spender, amount);
12,483
16
// function swap( address _tokenIn, address _tokenOut, uint _amountIn
// ) external { // IERC20(_tokenIn).transferFrom(msg.sender, address(this), _amountIn); // IERC20(_tokenIn).approve(UNISWAP_V2_ROUTER, _amountIn); // address[] memory path; // if (_tokenIn == WETH || _tokenOut == WETH) { // path = new address[](2); // path[0] = _tokenIn; // path[1] ...
// ) external { // IERC20(_tokenIn).transferFrom(msg.sender, address(this), _amountIn); // IERC20(_tokenIn).approve(UNISWAP_V2_ROUTER, _amountIn); // address[] memory path; // if (_tokenIn == WETH || _tokenOut == WETH) { // path = new address[](2); // path[0] = _tokenIn; // path[1] ...
23,628
270
// Get manager for permission_app Address of the app_role Identifier for a group of actions in app return address of the manager for the permission/
function getPermissionManager(address _app, bytes32 _role) public view returns (address) { return permissionManager[roleHash(_app, _role)]; }
function getPermissionManager(address _app, bytes32 _role) public view returns (address) { return permissionManager[roleHash(_app, _role)]; }
34,573
58
// handles when loaned token is different from what we borrowed
if (wasAvailable == false){ ERC20 loaned = ERC20(currentLToken); convertEthToToken(0, address(this).balance, currentLToken); performTrade(false, loaned.balanceOf(address(this))); if (currentLToken == 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2){ ...
if (wasAvailable == false){ ERC20 loaned = ERC20(currentLToken); convertEthToToken(0, address(this).balance, currentLToken); performTrade(false, loaned.balanceOf(address(this))); if (currentLToken == 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2){ ...
13,523
186
// To make etherscan auto-verify new pool, this variable is not immutable
bytes32 public domainSeparator;
bytes32 public domainSeparator;
28,048
25
// House takes a 1% fee (10/1000). Can be updated when game is stopped.Value is divided by 1000 instead of 100, to be able to use fractional percentages e.g., 1.5%
uint8 public houseFee = 10;
uint8 public houseFee = 10;
7,730
55
// Decodes unpadded base32 data of up to one word in length. self The data to decode. off Offset into the string to start at. len Number of characters to decode.return The decoded data, left aligned. /
function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) { require(len <= 52); uint ret = 0; uint8 decoded; for(uint i = 0; i < len; i++) { bytes1 char = self[off + i]; require(char >= 0x30 && char <= 0x7A); ...
function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) { require(len <= 52); uint ret = 0; uint8 decoded; for(uint i = 0; i < len; i++) { bytes1 char = self[off + i]; require(char >= 0x30 && char <= 0x7A); ...
16,913
134
// Allows the node operator to withdraw earned LINK to a given address The owner of the contract can be another wallet and does not have to be a Chainlink node recipient The address to send the LINK token to amount The amount to send (specified in wei) /
function withdraw( address recipient, uint256 amount ) external override(OracleInterface, WithdrawalInterface) onlyOwner() validateAvailableFunds(amount)
function withdraw( address recipient, uint256 amount ) external override(OracleInterface, WithdrawalInterface) onlyOwner() validateAvailableFunds(amount)
34,734
47
// Get the stake intent hash
bytes32 intentHash = hashStakeIntent( _amount, _beneficiary, _staker, _stakerNonce, _gasPrice, _gasLimit );
bytes32 intentHash = hashStakeIntent( _amount, _beneficiary, _staker, _stakerNonce, _gasPrice, _gasLimit );
14,768
65
// Approved rebaser for this contract /
address public rebaser;
address public rebaser;
5,022
37
// Destroys `amount` tokens from `account`, reducing the total supply.The caller must be an operator of `account`. If a send hook is registered for `account`, the corresponding functionwill be called with `data` and `operatorData`. See {IERC777Sender}. Emits a {Burned} event. Requirements - `account` cannot be the zero...
function operatorBurn(
function operatorBurn(
26,398
97
// do not allow to drain token if less than 30 days after farming
require(_token != bomb, "!bomb"); uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { PoolInfo storage pool = poolInfo[pid]; require(_token != pool.token, "!pool.token"); }
require(_token != bomb, "!bomb"); uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { PoolInfo storage pool = poolInfo[pid]; require(_token != pool.token, "!pool.token"); }
8,143
10
// swapExactInputSingle swaps a fixed amount of DAI for a maximum possible amount of WETH9/ using the DAI/WETH9 0.3% pool by calling `exactInputSingle` in the swap router./The calling address must approve this contract to spend at least `amountIn` worth of its DAI for this function to succeed./amountIn The exact amount...
function swapExactInputSingle(uint256 amountIn) external returns (uint256 amountOut) { // msg.sender must approve this contract // Transfer the specified amount of DAI to this contract. TransferHelper.safeTransferFrom(DAI, msg.sender, address(this), amountIn); // Approve the router...
function swapExactInputSingle(uint256 amountIn) external returns (uint256 amountOut) { // msg.sender must approve this contract // Transfer the specified amount of DAI to this contract. TransferHelper.safeTransferFrom(DAI, msg.sender, address(this), amountIn); // Approve the router...
46,055
346
// ERC721 Non-Fungible Token Standard basic implementation This is a modified OZ ERC721 base contract with one change where all tokens have the same token URI /
contract ERC721WithSameTokenURIForAllTokens is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; ...
contract ERC721WithSameTokenURIForAllTokens is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; ...
2,829
5
// Authorises a controller, who can register and renew domains.
function addController(address controller) external registrar_owner_only { controllers[controller] = true; emit ControllerAdded(controller); }
function addController(address controller) external registrar_owner_only { controllers[controller] = true; emit ControllerAdded(controller); }
42,619
30
// Modifier to make a function callable only if the reservation was paid. /
modifier whenPaid() { require(paid); _; }
modifier whenPaid() { require(paid); _; }
9,953
11
// Mint a given amount of shares & deduct the correct amount of assets to do so shares is the number of shares (vault tokens) receiver is the address of the receiver /
function mint(uint256 shares, address receiver) public onlyOwner returns (uint256) { uint256 assets = convertToAssets(shares); if (totalAssets() == 0) assets = shares; ERC20(asset).safeTransferFrom(msg.sender, address(this), assets); _mint(receiver, shares); emit Deposit(m...
function mint(uint256 shares, address receiver) public onlyOwner returns (uint256) { uint256 assets = convertToAssets(shares); if (totalAssets() == 0) assets = shares; ERC20(asset).safeTransferFrom(msg.sender, address(this), assets); _mint(receiver, shares); emit Deposit(m...
39,713
402
// Creates a new order _nftAddress - Non fungible registry address _assetId - ID of the published NFT _priceInWei - Price in Wei for the supported coin _expiresAt - Expiration time for the order /
function _createOrder(address _nftAddress, uint256 _assetId, uint256 _priceInWei,uint256 _royality, uint256 _expiresAt, address _currency) internal { // Check nft registry IERC721 nftRegistry = IERC721(_nftAddress); // Check _acceptedCurrency require( acceptedCurrencies[...
function _createOrder(address _nftAddress, uint256 _assetId, uint256 _priceInWei,uint256 _royality, uint256 _expiresAt, address _currency) internal { // Check nft registry IERC721 nftRegistry = IERC721(_nftAddress); // Check _acceptedCurrency require( acceptedCurrencies[...
81,579
23
// Make sure that every input is less than the snark scalar field
for (uint256 i = 0; i < input.length; i++) { require(input[i] < SNARK_SCALAR_FIELD, "verifier-gte-snark-scalar-field"); vk_x = Pairing.plus(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i])); }
for (uint256 i = 0; i < input.length; i++) { require(input[i] < SNARK_SCALAR_FIELD, "verifier-gte-snark-scalar-field"); vk_x = Pairing.plus(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i])); }
68,683
35
// Emitted when a claim was added. Specification: MUST be triggered when a claim was successfully added. /
event ClaimAdded(bytes32 indexed claimId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
event ClaimAdded(bytes32 indexed claimId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
55,810
3
// /
IJBTokenUriResolver public override tokenUriResolver;
IJBTokenUriResolver public override tokenUriResolver;
11,485
8
// Internal function that asserts the given `account` is in `_mintLimiters`.account The account address being queriedreturn True if the given `account` is in `_mintLimiters`, otherwise false /
function _isMintLimiter(address account) internal view returns (bool) { return _mintLimiters.has(account); }
function _isMintLimiter(address account) internal view returns (bool) { return _mintLimiters.has(account); }
8,680
2
// 0xF24294C0CF99c88452495D3e73c47a578402e317
address payable private constant _walletMarketing = payable(0x05825fFC6eA5fE6857f4AE3a7Ffc8ed045F402ec); mapping (address => bool) private _noFees; address private constant _swapRouterAddress = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); IUniswapV2Router02 private _primarySwapRouter = IUniswa...
address payable private constant _walletMarketing = payable(0x05825fFC6eA5fE6857f4AE3a7Ffc8ed045F402ec); mapping (address => bool) private _noFees; address private constant _swapRouterAddress = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); IUniswapV2Router02 private _primarySwapRouter = IUniswa...
24,111
43
// if zero requested, send the entire amount, otherwise the amount requested
uint256 _amount = _value > 0 ? _value : this.balance; _beneficiary.transfer(_amount);
uint256 _amount = _value > 0 ? _value : this.balance; _beneficiary.transfer(_amount);
60,459
48
// execution allowed only for contract owner
modifier onlyOwner() { require(msg.sender == owner); _; }
modifier onlyOwner() { require(msg.sender == owner); _; }
50,337
84
// Removes Curve LP and/or liquidity gauge tokens from the price feed/_derivatives Curve LP and/or liquidity gauge tokens to add
function removeDerivatives(address[] calldata _derivatives) external onlyDispatcherOwner { require(_derivatives.length > 0, "removeDerivatives: Empty _derivatives"); for (uint256 i; i < _derivatives.length; i++) { require(_derivatives[i] != address(0), "removeDerivatives: Empty derivativ...
function removeDerivatives(address[] calldata _derivatives) external onlyDispatcherOwner { require(_derivatives.length > 0, "removeDerivatives: Empty _derivatives"); for (uint256 i; i < _derivatives.length; i++) { require(_derivatives[i] != address(0), "removeDerivatives: Empty derivativ...
14,282
10
// this prevents dust from being added to the user account eg 10^18 -> 10^8 -> 10^18 will remove lower order bits
uint256 convertedWadAmount = LibReserve.tokenToWad(reserveTokenDecimals, amount);
uint256 convertedWadAmount = LibReserve.tokenToWad(reserveTokenDecimals, amount);
8,532
15
// Define a modifier that checks if airline has been already funded
modifier requireIsNotAlreadyFunded (address account)
modifier requireIsNotAlreadyFunded (address account)
50,843
42
// Check that this contract has a sufficient balance for the generation period
require(token.balanceOf(this) >= totalGenesisTokens); started = true;
require(token.balanceOf(this) >= totalGenesisTokens); started = true;
58,130
2
// True if increasing debt is forbidden
bool isIncreaseDebtForbidden;
bool isIncreaseDebtForbidden;
20,597
3
// toggle public sale
function changeStatePublicSale() public onlyOwner returns(bool) { publicSaleState = !publicSaleState; return publicSaleState; }
function changeStatePublicSale() public onlyOwner returns(bool) { publicSaleState = !publicSaleState; return publicSaleState; }
19,245
3
// NOTE: this is the "middle" period. Exit period for fresh utxos we'll double that while IFE phase is half that
uint256 public minExitPeriod; address public operator; uint256 public nextChildBlock; uint256 public nextDepositBlock; uint256 public nextFeeExit; mapping (uint256 => Block) public blocks;
uint256 public minExitPeriod; address public operator; uint256 public nextChildBlock; uint256 public nextDepositBlock; uint256 public nextFeeExit; mapping (uint256 => Block) public blocks;
26,676
48
// INVESTOR struct stores information about each Investor Investor can have more than one deals, but only one right to dispute
struct Investor { bool disputing; uint tokenAllowance; uint etherUsed; uint sumEther; uint sumToken; bool verdictForProject; bool verdictForInvestor; uint numberOfDeals; }
struct Investor { bool disputing; uint tokenAllowance; uint etherUsed; uint sumEther; uint sumToken; bool verdictForProject; bool verdictForInvestor; uint numberOfDeals; }
8,649
172
// 创建队伍至少需要投资1eth
require(_eth >= 1000000000000000000, "You need at least 1 eth to create a team, though creating a new team is free.");
require(_eth >= 1000000000000000000, "You need at least 1 eth to create a team, though creating a new team is free.");
67,456
196
// Reverts an expected payout./_projectId The ID of the project having paying out./_expectedDestination The address the payout was expected to go to./_allowanceAmount The amount that the destination has been allowed to use./_depositAmount The amount of the payout as debited from the project's balance.
function _revertTransferFrom( uint256 _projectId, address _expectedDestination, uint256 _allowanceAmount, uint256 _depositAmount ) internal {
function _revertTransferFrom( uint256 _projectId, address _expectedDestination, uint256 _allowanceAmount, uint256 _depositAmount ) internal {
30,286
171
// take gas cost at the beginning
_data.srcAmount -= getGasCost(ILendingPoolAddressesProviderV2(_market).getPriceOracle(), _data.srcAmount, user, _gasCost, _data.srcAddr); uint256 destAmount; if (_data.destAddr != _data.srcAddr) { _data.user = user; _data.dfsFeeDivider = MANUAL_SERVICE_FEE; if (BotRegistry(BOT_REGISTRY_ADDRESS).botL...
_data.srcAmount -= getGasCost(ILendingPoolAddressesProviderV2(_market).getPriceOracle(), _data.srcAmount, user, _gasCost, _data.srcAddr); uint256 destAmount; if (_data.destAddr != _data.srcAddr) { _data.user = user; _data.dfsFeeDivider = MANUAL_SERVICE_FEE; if (BotRegistry(BOT_REGISTRY_ADDRESS).botL...
2,640
346
// Calculates the minimum LP to accept when depositing underlying into Curve Pool. _hopLpAmount Amount of Hop LP that is being deposited into Curve Pool.return The minimum LP balance to accept. /
function _minLpAccepted(uint256 _hopLpAmount) internal view returns (uint256) { return _hopLpToLp(_hopLpAmount).scaledMul(ScaledMath.ONE - imbalanceToleranceIn); }
function _minLpAccepted(uint256 _hopLpAmount) internal view returns (uint256) { return _hopLpToLp(_hopLpAmount).scaledMul(ScaledMath.ONE - imbalanceToleranceIn); }
31,726
768
// Create a new pinned app instance on `_kernel` with identifier `_appId` and initialization payload `_initializePayload`_kernel App's Kernel reference_appId Identifier for app_initializePayload Proxy initialization payload return AppProxyPinned/
function newAppProxyPinned(IKernel _kernel, bytes32 _appId, bytes _initializePayload) public returns (AppProxyPinned) { AppProxyPinned proxy = new AppProxyPinned(_kernel, _appId, _initializePayload); emit NewAppProxy(address(proxy), false, _appId); return proxy; }
function newAppProxyPinned(IKernel _kernel, bytes32 _appId, bytes _initializePayload) public returns (AppProxyPinned) { AppProxyPinned proxy = new AppProxyPinned(_kernel, _appId, _initializePayload); emit NewAppProxy(address(proxy), false, _appId); return proxy; }
5,945
8
// All other funds to be used per whitepaper guidelines
destinationAddress80 = 0xf030541A54e89cB22b3653a090b233A209E44F38;
destinationAddress80 = 0xf030541A54e89cB22b3653a090b233A209E44F38;
17,461
461
// current max tokenId
uint256 public tokenIdPointer;
uint256 public tokenIdPointer;
38,094
18
// 以下为ERC20的规范
constructor( uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol
constructor( uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol
23,605
2
// For locked indexers/delegations, this contract holds the mapping of L1 to L2 addresses
IL1GraphTokenLockTransferTool internal l1GraphTokenLockTransferTool;
IL1GraphTokenLockTransferTool internal l1GraphTokenLockTransferTool;
25,705
92
// Sets the closeFactor used when liquidating borrowsAdmin function to set closeFactornewCloseFactorMantissa New close factor, scaled by 1e18 return uint 0=success, otherwise a failure/
function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint) { // Check caller is admin require(msg.sender == admin, "only admin can set close factor"); uint oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; emit NewClo...
function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint) { // Check caller is admin require(msg.sender == admin, "only admin can set close factor"); uint oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; emit NewClo...
31,863
13
// - A function which calls internal _liquidate function to transfer any tokens left on the contract to investors after the endTime has passed investors - Array of investors addresses to liquidate /
function liquidate(address[] calldata investors) external { require(block.timestamp >= endTime, 'The end time has not passed'); for (uint256 i = 0; i < investors.length; i++) { address investor = investors[i]; uint256 availableTokens = userTotalAmount[investor]; uint256 claimedTokens = claim...
function liquidate(address[] calldata investors) external { require(block.timestamp >= endTime, 'The end time has not passed'); for (uint256 i = 0; i < investors.length; i++) { address investor = investors[i]; uint256 availableTokens = userTotalAmount[investor]; uint256 claimedTokens = claim...
21,764
3
// Revert with an error when attempting to withdrawal an amount greater than the current balance. /
error InvalidNativeTokenAmount(uint256 amount);
error InvalidNativeTokenAmount(uint256 amount);
17,513
9
// Update the given pool's token allocation point. Can only be called by the owner.
function set( uint256 _poolId, uint256 _tokenPerBlock, bool _withUpdate
function set( uint256 _poolId, uint256 _tokenPerBlock, bool _withUpdate
24,131
0
// Mock IDLE token
contract IDLEToken is ERC20("Idle", "IDLE") { }
contract IDLEToken is ERC20("Idle", "IDLE") { }
21,688
61
// amount of raised money in wei
uint public weiRaised;
uint public weiRaised;
5,739
14
// Burn tokens from an address _burnAmount The amount of tokens to burn /
function burn(uint _burnAmount) public { require(_burnAmount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_burnAmount); totalSupply = totalSupply.sub(_burnAmount); emit Burned(msg.sender, _burnAmount); }
function burn(uint _burnAmount) public { require(_burnAmount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_burnAmount); totalSupply = totalSupply.sub(_burnAmount); emit Burned(msg.sender, _burnAmount); }
52,335
64
// Single Tranfer
_transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true;
_transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true;
28,930
17
// Retrieve the offer.
OfferItem[] memory offer = orderParameters.offer;
OfferItem[] memory offer = orderParameters.offer;
14,955
22
// //Approve `to` to transfer up to `amount`./ return success Whether or not the approval succeeded.
function approve(address to, uint amount) external returns (bool success) { allowance[msg.sender][to] = amount; /*adjust `allowance`*/ emit Approval(msg.sender, to, amount); /*emit event reflecting approval*/ success = true; /*confirm approval with ERC-20 accounting*/ }...
function approve(address to, uint amount) external returns (bool success) { allowance[msg.sender][to] = amount; /*adjust `allowance`*/ emit Approval(msg.sender, to, amount); /*emit event reflecting approval*/ success = true; /*confirm approval with ERC-20 accounting*/ }...
12,615
28
// 获取补丁名称
function getPatchName(string ipfsHash) public constant returns (string) { return patchMap[ipfsHash].name; }
function getPatchName(string ipfsHash) public constant returns (string) { return patchMap[ipfsHash].name; }
9,196
121
// LP token for curve pool (ETH / stETH)
IERC20 private constant CURVE_LP = IERC20(0x06325440D014e39736583c165C2963BA99fAf14E);
IERC20 private constant CURVE_LP = IERC20(0x06325440D014e39736583c165C2963BA99fAf14E);
47,162
7
// Sets the merkle root. Only callable if the root is not yet set. _merkleRoot The merkle root to set. /
function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner { require(merkleRoot == bytes32(0), "GasDao: Merkle root already set"); merkleRoot = _merkleRoot; emit MerkleRootChanged(_merkleRoot); }
function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner { require(merkleRoot == bytes32(0), "GasDao: Merkle root already set"); merkleRoot = _merkleRoot; emit MerkleRootChanged(_merkleRoot); }
8,810
0
// injecter l'address du token Dai à utiliser
dai = IERC20(daiAddress);
dai = IERC20(daiAddress);
1,936
48
// For querying totalSupply of token/Required for ERC-721 compliance.
function totalSupply() public view returns (uint256 total) { return citys.length; }
function totalSupply() public view returns (uint256 total) { return citys.length; }
17,141
23
// Implements the use case: register Actor/Emits event to start the use case: ValidateID (access control)
function registerActor (address actorAddress_, uint40 prefix_, actorType actorRole_) public { scActors[actorAddress_].companyPrefix=prefix_; scActors[actorAddress_].actorAddress=msg.sender; scActors[actorAddress_].actorRole=actorRole_; scActors[actorAddress_].registered=true; company...
function registerActor (address actorAddress_, uint40 prefix_, actorType actorRole_) public { scActors[actorAddress_].companyPrefix=prefix_; scActors[actorAddress_].actorAddress=msg.sender; scActors[actorAddress_].actorRole=actorRole_; scActors[actorAddress_].registered=true; company...
15,003
18
// Atomically increases the allowance granted to `_spender` by the caller by `_addedValue`. This is an alternative to `approve` that can be used as a mitigation forproblems described in:Emits an `Approval` event indicating the updated allowance. Requirements: - `_spender` cannot be the the zero address.- the contract m...
function increaseAllowance( address _spender, uint256 _addedValue
function increaseAllowance( address _spender, uint256 _addedValue
39,176
2
// Synonym of the uniswapV2's function, estimates amount you receive after swap.
function getAmountOut(uint256 amountA, address tokenA, address tokenB) external view returns (uint256 amountOut);
function getAmountOut(uint256 amountA, address tokenA, address tokenB) external view returns (uint256 amountOut);
34,389
131
// dcu出矿单位
uint128 _dcuUnit;
uint128 _dcuUnit;
55,894
9
// Return the ouput token address.return Output token address. /
function outputToken() external view override returns (IERC20Upgradeable) { return _outputToken; }
function outputToken() external view override returns (IERC20Upgradeable) { return _outputToken; }
14,968
57
// unstaking fee 0%
uint256 public unstakingFeeRate = 0;
uint256 public unstakingFeeRate = 0;
41,772
413
// The EIP-712 typehash for the ballot struct used by the contract
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
44,276
10
// Apply a StakeTransition._transition The disputed transition. _accountInfo The involved account from the previous transition. _stakingPoolInfo The involved staking pool from the previous transition. _globalInfo The involved global info from the previous transition.return new account, staking pool and global info afte...
function applyStakeTransition( dt.StakeTransition memory _transition, dt.AccountInfo memory _accountInfo, dt.StakingPoolInfo memory _stakingPoolInfo, dt.GlobalInfo memory _globalInfo ) external pure returns ( dt.AccountInfo memory,
function applyStakeTransition( dt.StakeTransition memory _transition, dt.AccountInfo memory _accountInfo, dt.StakingPoolInfo memory _stakingPoolInfo, dt.GlobalInfo memory _globalInfo ) external pure returns ( dt.AccountInfo memory,
48,642
2
// People public person = People({favoriteNumber: 2, name: "Juan"});
function store (uint256 _favoriteNumber) public { favoriteNumber = _favoriteNumber; }
function store (uint256 _favoriteNumber) public { favoriteNumber = _favoriteNumber; }
23,392
4
// called by the owner to unpause the tokn, returns to normal state /
function unpause() public onlyOwner whenPaused { boolStorage['paused'] = false; Unpause(); }
function unpause() public onlyOwner whenPaused { boolStorage['paused'] = false; Unpause(); }
39,579
53
// return number of bytes until the data
function _payloadOffset(uint memPtr) private pure returns (uint) { uint byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) return 0; else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) return 1; else ...
function _payloadOffset(uint memPtr) private pure returns (uint) { uint byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) return 0; else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) return 1; else ...
40,050
5
// Update the Erc20Bank variable. _type The variable code. /
function updateErc20Bank(uint8 _type) internal
function updateErc20Bank(uint8 _type) internal
21,907
15
// ==== optional erc20 rescue function ===
function rescueERC20( address _tokenAddress, address _to, uint256 _amount
function rescueERC20( address _tokenAddress, address _to, uint256 _amount
27,769