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
1
// Emitted when a new withdrawal is queued by `depositor`. depositor Is the staker who is withdrawing funds. withdrawer Is the party specified by `staker` who will be able to complete the queued withdrawal and receive the withdrawn funds. delegatedAddress Is the party who the `staker` was delegated to at the time of creating the queued withdrawal withdrawalRoot Is a hash of the input data for the withdrawal. /
event WithdrawalQueued( address indexed depositor, address indexed withdrawer, address indexed delegatedAddress, bytes32 withdrawalRoot );
event WithdrawalQueued( address indexed depositor, address indexed withdrawer, address indexed delegatedAddress, bytes32 withdrawalRoot );
3,892
185
// Responsible for access rights to the contract.
MISOAccessControls public accessControls; bytes32 public constant LAUNCHER_MINTER_ROLE = keccak256("LAUNCHER_MINTER_ROLE");
MISOAccessControls public accessControls; bytes32 public constant LAUNCHER_MINTER_ROLE = keccak256("LAUNCHER_MINTER_ROLE");
24,365
163
// Liquidity gauge manager, used to stake tokens in liquidity gauges./Fei Protocol
abstract contract LiquidityGaugeManager is CoreRef { // Events event GaugeControllerChanged(address indexed oldController, address indexed newController); event GaugeSetForToken(address indexed token, address indexed gauge); event GaugeVote(address indexed gauge, uint256 amount); event GaugeStake(address indexed gauge, uint256 amount); event GaugeUnstake(address indexed gauge, uint256 amount); event GaugeRewardsClaimed(address indexed gauge, address indexed token, uint256 amount); /// @notice address of the gauge controller used for voting address public gaugeController; /// @notice mapping of token staked to gauge address mapping(address=>address) public tokenToGauge; constructor(address _gaugeController) { gaugeController = _gaugeController; } /// @notice Set the gauge controller used for gauge weight voting /// @param _gaugeController the gauge controller address function setGaugeController(address _gaugeController) public onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { require(gaugeController != _gaugeController, "LiquidityGaugeManager: same controller"); address oldController = gaugeController; gaugeController = _gaugeController; emit GaugeControllerChanged(oldController, gaugeController); } /// @notice Set gauge for a given token. /// @param token the token address to stake in gauge /// @param gaugeAddress the address of the gauge where to stake token function setTokenToGauge( address token, address gaugeAddress ) public onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { require(ILiquidityGauge(gaugeAddress).staking_token() == token, "LiquidityGaugeManager: wrong gauge for token"); require(ILiquidityGaugeController(gaugeController).gauge_types(gaugeAddress) >= 0, "LiquidityGaugeManager: wrong gauge address"); tokenToGauge[token] = gaugeAddress; emit GaugeSetForToken(token, gaugeAddress); } /// @notice Vote for a gauge's weight /// @param token the address of the token to vote for /// @param gaugeWeight the weight of gaugeAddress in basis points [0, 10_000] function voteForGaugeWeight( address token, uint256 gaugeWeight ) public whenNotPaused onlyTribeRole(TribeRoles.METAGOVERNANCE_VOTE_ADMIN) { address gaugeAddress = tokenToGauge[token]; require(gaugeAddress != address(0), "LiquidityGaugeManager: token has no gauge configured"); ILiquidityGaugeController(gaugeController).vote_for_gauge_weights(gaugeAddress, gaugeWeight); emit GaugeVote(gaugeAddress, gaugeWeight); } /// @notice Stake tokens in a gauge /// @param token the address of the token to stake in the gauge /// @param amount the amount of tokens to stake in the gauge function stakeInGauge( address token, uint256 amount ) public whenNotPaused onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { address gaugeAddress = tokenToGauge[token]; require(gaugeAddress != address(0), "LiquidityGaugeManager: token has no gauge configured"); IERC20(token).approve(gaugeAddress, amount); ILiquidityGauge(gaugeAddress).deposit(amount); emit GaugeStake(gaugeAddress, amount); } /// @notice Stake all tokens held in a gauge /// @param token the address of the token to stake in the gauge function stakeAllInGauge(address token) public whenNotPaused onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { address gaugeAddress = tokenToGauge[token]; require(gaugeAddress != address(0), "LiquidityGaugeManager: token has no gauge configured"); uint256 amount = IERC20(token).balanceOf(address(this)); IERC20(token).approve(gaugeAddress, amount); ILiquidityGauge(gaugeAddress).deposit(amount); emit GaugeStake(gaugeAddress, amount); } /// @notice Unstake tokens from a gauge /// @param token the address of the token to unstake from the gauge /// @param amount the amount of tokens to unstake from the gauge function unstakeFromGauge( address token, uint256 amount ) public whenNotPaused onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { address gaugeAddress = tokenToGauge[token]; require(gaugeAddress != address(0), "LiquidityGaugeManager: token has no gauge configured"); ILiquidityGauge(gaugeAddress).withdraw(amount, false); emit GaugeUnstake(gaugeAddress, amount); } /// @notice Claim rewards associated to a gauge where this contract stakes /// tokens. function claimGaugeRewards(address gaugeAddress) public whenNotPaused { uint256 nTokens = ILiquidityGauge(gaugeAddress).reward_count(); address[] memory tokens = new address[](nTokens); uint256[] memory amounts = new uint256[](nTokens); for (uint256 i = 0; i < nTokens; i++) { tokens[i] = ILiquidityGauge(gaugeAddress).reward_tokens(i); amounts[i] = IERC20(tokens[i]).balanceOf(address(this)); } ILiquidityGauge(gaugeAddress).claim_rewards(); for (uint256 i = 0; i < nTokens; i++) { amounts[i] = IERC20(tokens[i]).balanceOf(address(this)) - amounts[i]; emit GaugeRewardsClaimed(gaugeAddress, tokens[i], amounts[i]); } } }
abstract contract LiquidityGaugeManager is CoreRef { // Events event GaugeControllerChanged(address indexed oldController, address indexed newController); event GaugeSetForToken(address indexed token, address indexed gauge); event GaugeVote(address indexed gauge, uint256 amount); event GaugeStake(address indexed gauge, uint256 amount); event GaugeUnstake(address indexed gauge, uint256 amount); event GaugeRewardsClaimed(address indexed gauge, address indexed token, uint256 amount); /// @notice address of the gauge controller used for voting address public gaugeController; /// @notice mapping of token staked to gauge address mapping(address=>address) public tokenToGauge; constructor(address _gaugeController) { gaugeController = _gaugeController; } /// @notice Set the gauge controller used for gauge weight voting /// @param _gaugeController the gauge controller address function setGaugeController(address _gaugeController) public onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { require(gaugeController != _gaugeController, "LiquidityGaugeManager: same controller"); address oldController = gaugeController; gaugeController = _gaugeController; emit GaugeControllerChanged(oldController, gaugeController); } /// @notice Set gauge for a given token. /// @param token the token address to stake in gauge /// @param gaugeAddress the address of the gauge where to stake token function setTokenToGauge( address token, address gaugeAddress ) public onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { require(ILiquidityGauge(gaugeAddress).staking_token() == token, "LiquidityGaugeManager: wrong gauge for token"); require(ILiquidityGaugeController(gaugeController).gauge_types(gaugeAddress) >= 0, "LiquidityGaugeManager: wrong gauge address"); tokenToGauge[token] = gaugeAddress; emit GaugeSetForToken(token, gaugeAddress); } /// @notice Vote for a gauge's weight /// @param token the address of the token to vote for /// @param gaugeWeight the weight of gaugeAddress in basis points [0, 10_000] function voteForGaugeWeight( address token, uint256 gaugeWeight ) public whenNotPaused onlyTribeRole(TribeRoles.METAGOVERNANCE_VOTE_ADMIN) { address gaugeAddress = tokenToGauge[token]; require(gaugeAddress != address(0), "LiquidityGaugeManager: token has no gauge configured"); ILiquidityGaugeController(gaugeController).vote_for_gauge_weights(gaugeAddress, gaugeWeight); emit GaugeVote(gaugeAddress, gaugeWeight); } /// @notice Stake tokens in a gauge /// @param token the address of the token to stake in the gauge /// @param amount the amount of tokens to stake in the gauge function stakeInGauge( address token, uint256 amount ) public whenNotPaused onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { address gaugeAddress = tokenToGauge[token]; require(gaugeAddress != address(0), "LiquidityGaugeManager: token has no gauge configured"); IERC20(token).approve(gaugeAddress, amount); ILiquidityGauge(gaugeAddress).deposit(amount); emit GaugeStake(gaugeAddress, amount); } /// @notice Stake all tokens held in a gauge /// @param token the address of the token to stake in the gauge function stakeAllInGauge(address token) public whenNotPaused onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { address gaugeAddress = tokenToGauge[token]; require(gaugeAddress != address(0), "LiquidityGaugeManager: token has no gauge configured"); uint256 amount = IERC20(token).balanceOf(address(this)); IERC20(token).approve(gaugeAddress, amount); ILiquidityGauge(gaugeAddress).deposit(amount); emit GaugeStake(gaugeAddress, amount); } /// @notice Unstake tokens from a gauge /// @param token the address of the token to unstake from the gauge /// @param amount the amount of tokens to unstake from the gauge function unstakeFromGauge( address token, uint256 amount ) public whenNotPaused onlyTribeRole(TribeRoles.METAGOVERNANCE_GAUGE_ADMIN) { address gaugeAddress = tokenToGauge[token]; require(gaugeAddress != address(0), "LiquidityGaugeManager: token has no gauge configured"); ILiquidityGauge(gaugeAddress).withdraw(amount, false); emit GaugeUnstake(gaugeAddress, amount); } /// @notice Claim rewards associated to a gauge where this contract stakes /// tokens. function claimGaugeRewards(address gaugeAddress) public whenNotPaused { uint256 nTokens = ILiquidityGauge(gaugeAddress).reward_count(); address[] memory tokens = new address[](nTokens); uint256[] memory amounts = new uint256[](nTokens); for (uint256 i = 0; i < nTokens; i++) { tokens[i] = ILiquidityGauge(gaugeAddress).reward_tokens(i); amounts[i] = IERC20(tokens[i]).balanceOf(address(this)); } ILiquidityGauge(gaugeAddress).claim_rewards(); for (uint256 i = 0; i < nTokens; i++) { amounts[i] = IERC20(tokens[i]).balanceOf(address(this)) - amounts[i]; emit GaugeRewardsClaimed(gaugeAddress, tokens[i], amounts[i]); } } }
77,928
121
// cancels crowdsale
function stop() public onlyOwner() hasntStopped() { // we can stop only not started and not completed crowdsale if (started) { require(!isFailed()); require(!isSuccessful()); } stopped = true; }
function stop() public onlyOwner() hasntStopped() { // we can stop only not started and not completed crowdsale if (started) { require(!isFailed()); require(!isSuccessful()); } stopped = true; }
14,914
7
// only record increment of resources
emit Unbox(_tokenId, resourcesReward[0], resourcesReward[1], resourcesReward[2], resourcesReward[3], resourcesReward[4]); return (resourcesReward[0], resourcesReward[1], resourcesReward[2], resourcesReward[3], resourcesReward[4]);
emit Unbox(_tokenId, resourcesReward[0], resourcesReward[1], resourcesReward[2], resourcesReward[3], resourcesReward[4]); return (resourcesReward[0], resourcesReward[1], resourcesReward[2], resourcesReward[3], resourcesReward[4]);
6,980
24
// 获取某个候选人的总得票数 Total number of votes obtained from candidates /
function fetchVoteNumForCandidate( address payable boeaddr
function fetchVoteNumForCandidate( address payable boeaddr
14,707
9
// return true if target address has administrator privileges, false otherwise /
function isAdministrator(address target) public view returns(bool isReallyAdministrator) { return administrators[target]; }
function isAdministrator(address target) public view returns(bool isReallyAdministrator) { return administrators[target]; }
47,831
3
// Store a new order
function _storeOrder( address _nftContract, uint256 _tokenId, uint256 _price, uint256 _createdAt, address _seller, OrderStatus _status
function _storeOrder( address _nftContract, uint256 _tokenId, uint256 _price, uint256 _createdAt, address _seller, OrderStatus _status
47,929
15
//
* @dev See {IERC721-approve}. */ function approve( address to_, uint256 tokenId_ ) public virtual override exists( tokenId_ ) isApprovedOrOwner( msg.sender, tokenId_ ) { address _tokenOwner_ = _owners[ tokenId_ ]; if ( to_ == _tokenOwner_ ) { revert IERC721_APPROVE_OWNER(); } _tokenApprovals[ tokenId_ ] = to_; emit Approval( _tokenOwner_, to_, tokenId_ ); }
* @dev See {IERC721-approve}. */ function approve( address to_, uint256 tokenId_ ) public virtual override exists( tokenId_ ) isApprovedOrOwner( msg.sender, tokenId_ ) { address _tokenOwner_ = _owners[ tokenId_ ]; if ( to_ == _tokenOwner_ ) { revert IERC721_APPROVE_OWNER(); } _tokenApprovals[ tokenId_ ] = to_; emit Approval( _tokenOwner_, to_, tokenId_ ); }
20,353
3
// Not safe.
return uint8(uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty)))%100);
return uint8(uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty)))%100);
44,949
363
// Keep track of when the protocol fees were last withdrawn (only done to make this data easier available).
if (from == address(0)) { S.protocolFeeLastWithdrawnTime[token] = block.timestamp; }
if (from == address(0)) { S.protocolFeeLastWithdrawnTime[token] = block.timestamp; }
24,504
117
// Custom logic for how much the vault allows to be borrowed The contract puts 100% of the tokens to work. /
function available() public view returns (uint256) { return token.balanceOf(address(this)); }
function available() public view returns (uint256) { return token.balanceOf(address(this)); }
33,791
44
// There's no limit to the coin supplyreward follows the same emmission rate as Dogecoins'
function getMiningReward(bytes32 digest) public constant returns (uint) { if(epochCount > 600000) return (30000 * 10**uint(decimals) ); if(epochCount > 500000) return (46875 * 10**uint(decimals) ); if(epochCount > 400000) return (93750 * 10**uint(decimals) ); if(epochCount > 300000) return (187500 * 10**uint(decimals) ); if(epochCount > 200000) return (375000 * 10**uint(decimals) ); if(epochCount > 145000) return (500000 * 10**uint(decimals) ); if(epochCount > 100000) return ((uint256(keccak256(digest, blockhash(block.number - 2))) % 1500000) * 10**uint(decimals) ); return ( (uint256(keccak256(digest, blockhash(block.number - 2))) % 3000000) * 10**uint(decimals) ); }
function getMiningReward(bytes32 digest) public constant returns (uint) { if(epochCount > 600000) return (30000 * 10**uint(decimals) ); if(epochCount > 500000) return (46875 * 10**uint(decimals) ); if(epochCount > 400000) return (93750 * 10**uint(decimals) ); if(epochCount > 300000) return (187500 * 10**uint(decimals) ); if(epochCount > 200000) return (375000 * 10**uint(decimals) ); if(epochCount > 145000) return (500000 * 10**uint(decimals) ); if(epochCount > 100000) return ((uint256(keccak256(digest, blockhash(block.number - 2))) % 1500000) * 10**uint(decimals) ); return ( (uint256(keccak256(digest, blockhash(block.number - 2))) % 3000000) * 10**uint(decimals) ); }
42,202
163
// the whitelist sale must be started
require ( _publicSaleStarted == false && _wlSaleStarted == true, "Whitelist Sale is not started yet!" );
require ( _publicSaleStarted == false && _wlSaleStarted == true, "Whitelist Sale is not started yet!" );
48,718
20
// The controller of this contract can move tokens around at will,this is important to recognize! Confirm that you trust thecontroller of this contract, which in most situations should beanother open source smart contract or 0x0
if (msg.sender != controller) { require(transfersEnabled);
if (msg.sender != controller) { require(transfersEnabled);
10,991
33
// Allow contributions to this crowdfunding.
function invest() public payable stopInEmergency { require(getState() == State.Funding); require(msg.value > 0); uint weiAmount = msg.value; address investor = msg.sender; if(investedAmountOf[investor] == 0) { // A new investor investorCount++; } // calculate online fee uint onlineFeeAmount = (weiAmount * ETHERFUNDME_ONLINE_FEE) / 100; Withdraw(feeReceiver, onlineFeeAmount); // send online fee feeReceiver.transfer(onlineFeeAmount); uint investedAmount = weiAmount - onlineFeeAmount; // Update investor investedAmountOf[investor] += investedAmount; // Tell us invest was success Invested(investor, investedAmount); }
function invest() public payable stopInEmergency { require(getState() == State.Funding); require(msg.value > 0); uint weiAmount = msg.value; address investor = msg.sender; if(investedAmountOf[investor] == 0) { // A new investor investorCount++; } // calculate online fee uint onlineFeeAmount = (weiAmount * ETHERFUNDME_ONLINE_FEE) / 100; Withdraw(feeReceiver, onlineFeeAmount); // send online fee feeReceiver.transfer(onlineFeeAmount); uint investedAmount = weiAmount - onlineFeeAmount; // Update investor investedAmountOf[investor] += investedAmount; // Tell us invest was success Invested(investor, investedAmount); }
34,754
13
// Set an address at _key location/_address Address to set/_key bytes32 key location
function setReference(address _address, bytes32 _key) external ifAuthorized(msg.sender, PRESIDENT) { require(_address != address(0), "setReference: Unexpectedly _address is 0x0"); if (_key == bytes32(0)) emit LogicUpgrade(references[bytes32(0)], _address); else emit StorageUpgrade(references[_key], _address); if (references[_key] != address(0)) delete references[_key]; references[_key] = _address; }
function setReference(address _address, bytes32 _key) external ifAuthorized(msg.sender, PRESIDENT) { require(_address != address(0), "setReference: Unexpectedly _address is 0x0"); if (_key == bytes32(0)) emit LogicUpgrade(references[bytes32(0)], _address); else emit StorageUpgrade(references[_key], _address); if (references[_key] != address(0)) delete references[_key]; references[_key] = _address; }
36,912
1
// Creates a new CronUpkeep contract, with msg.sender as the owner /
function newCronUpkeep() external { newCronUpkeepWithJob(bytes("")); }
function newCronUpkeep() external { newCronUpkeepWithJob(bytes("")); }
46,341
1
// --- Events ---
event WithdrawalInitialisation( address to, uint256 amount, uint256 timeOfExecution ); event WithdrawalSuccessful(address to, uint256 amount);
event WithdrawalInitialisation( address to, uint256 amount, uint256 timeOfExecution ); event WithdrawalSuccessful(address to, uint256 amount);
47,499
25
// Used to add an approved sequencer to the whitelist. _sequencer - The sequencer address to add. /
function addSequencer(address _sequencer) external onlyOwnerOrAdmin { if (s.approvedSequencers[_sequencer]) revert BridgeFacet__addSequencer_alreadyApproved(); s.approvedSequencers[_sequencer] = true; emit SequencerAdded(_sequencer, msg.sender); }
function addSequencer(address _sequencer) external onlyOwnerOrAdmin { if (s.approvedSequencers[_sequencer]) revert BridgeFacet__addSequencer_alreadyApproved(); s.approvedSequencers[_sequencer] = true; emit SequencerAdded(_sequencer, msg.sender); }
29,989
12
// LEGACY USE ONLY: Pending administrator for this contract /
address payable private __pendingAdmin;
address payable private __pendingAdmin;
39,421
1,092
// executes a low-level call against an account if the caller is authorized to make calls
function executeCall( address to, uint256 value, bytes calldata data
function executeCall( address to, uint256 value, bytes calldata data
30,761
2
// Total amount of CAP (ticker: CAP) staked
uint256 totalSupply;
uint256 totalSupply;
6,916
3
// allowance : Check approved balance /
function allowance(address tokenOwner, address spender) virtual override public view returns (uint remaining) { return allowed[tokenOwner][spender]; }
function allowance(address tokenOwner, address spender) virtual override public view returns (uint remaining) { return allowed[tokenOwner][spender]; }
53,833
0
// Address of the yield source.
IYieldSource public immutable yieldSource;
IYieldSource public immutable yieldSource;
24,814
122
// Convert to string
return string(bstr);
return string(bstr);
16,933
34
// DEV - change the number of required signatures.must be between 1 and the number of admins.this is a dev only function_howMany - desired number of required signatures/
function changeRequiredSignatures(uint256 _howMany) public onlyDevs()
function changeRequiredSignatures(uint256 _howMany) public onlyDevs()
60,245
11
// 3. transfer xToken to poolV2
for (uint256 i = 0; i < params.cTokens.length; i++) { ( vars.xTokenAddressV1, vars.variableDebtTokenAddressV1 ) = protocolDataProviderV1.getReserveTokensAddresses( params.cTokens[i] ); vars.cTokenV2 = params.cTokens[i] == address(cApeV1) ? address(cApeV2) : params.cTokens[i];
for (uint256 i = 0; i < params.cTokens.length; i++) { ( vars.xTokenAddressV1, vars.variableDebtTokenAddressV1 ) = protocolDataProviderV1.getReserveTokensAddresses( params.cTokens[i] ); vars.cTokenV2 = params.cTokens[i] == address(cApeV1) ? address(cApeV2) : params.cTokens[i];
4,538
7
// store _recipients[i]
let recp := calldataload(add(_recipients.offset, offset))
let recp := calldataload(add(_recipients.offset, offset))
31,507
404
// Get the list of whitelisted relayersreturn The list of whitelisted relayers /
function getWhitelistedRelayers() external view returns (address[] memory);
function getWhitelistedRelayers() external view returns (address[] memory);
88,107
28
// The only error `div` can return is Error.DIVISION_BY_ZERO but we control `expScale` and it is not zero.
assert(err2 == Error.NO_ERROR);
assert(err2 == Error.NO_ERROR);
44,281
151
// Getter for the total amount of `token` already released. `token` should be the address of an IERC20contract. /
function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; }
function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; }
21,365
18
// expmods[13] = trace_generator^(2(trace_length / 2 - 1)).
mstore(0x5000, expmod(/*trace_generator*/ mload(0x3a0), mul(2, sub(div(/*trace_length*/ mload(0x80), 2), 1)), PRIME))
mstore(0x5000, expmod(/*trace_generator*/ mload(0x3a0), mul(2, sub(div(/*trace_length*/ mload(0x80), 2), 1)), PRIME))
14,611
40
// `getValueAt` retrieves the number of reputation at a given block number/checkpoints The history of values being queried/_block The block number to retrieve the value at/ return The number of reputation being queried
function getValueAt(Checkpoint[] storage checkpoints, uint256 _block) internal view returns (uint256) { if (checkpoints.length == 0) { return 0; } // Shortcut for the actual value if (_block >= checkpoints[checkpoints.length-1].fromBlock) { return checkpoints[checkpoints.length-1].value; } if (_block < checkpoints[0].fromBlock) { return 0; } // Binary search of the value in the array uint256 min = 0; uint256 max = checkpoints.length-1; while (max > min) { uint256 mid = (max + min + 1) / 2; if (checkpoints[mid].fromBlock<=_block) { min = mid; } else { max = mid-1; } } return checkpoints[min].value; }
function getValueAt(Checkpoint[] storage checkpoints, uint256 _block) internal view returns (uint256) { if (checkpoints.length == 0) { return 0; } // Shortcut for the actual value if (_block >= checkpoints[checkpoints.length-1].fromBlock) { return checkpoints[checkpoints.length-1].value; } if (_block < checkpoints[0].fromBlock) { return 0; } // Binary search of the value in the array uint256 min = 0; uint256 max = checkpoints.length-1; while (max > min) { uint256 mid = (max + min + 1) / 2; if (checkpoints[mid].fromBlock<=_block) { min = mid; } else { max = mid-1; } } return checkpoints[min].value; }
49,445
120
// number of markets
uint256 numMarkets;
uint256 numMarkets;
28,553
3
// Get Exchange and Token Info
function getExchange(address token) external view returns (address exchange); function getToken(address exchange) external view returns (address token); function getTokenWithId(uint256 tokenId) external view returns (address token);
function getExchange(address token) external view returns (address exchange); function getToken(address exchange) external view returns (address token); function getTokenWithId(uint256 tokenId) external view returns (address token);
10,763
131
// Actually perform the safeTransferFrom
function _safeTransferFrom(address from_, address to_, uint tokenId_, bytes memory data_) private canTransfer(tokenId_, from_)
function _safeTransferFrom(address from_, address to_, uint tokenId_, bytes memory data_) private canTransfer(tokenId_, from_)
26,583
128
// compute base jackpot value that would be paid if the paytable was flat and pre-multply it by current jackpotMultiplier; we will have to divide by JACKPOT_MULTIPLIER_BASE later.
uint baseJackpotValue = BASE_JACKPOT_PAYMENT * contractState.jackpotMultiplier;
uint baseJackpotValue = BASE_JACKPOT_PAYMENT * contractState.jackpotMultiplier;
2,405
2
// The BGM Token!
IMintableToken public BGM; uint256 public blockRewards;
IMintableToken public BGM; uint256 public blockRewards;
40,972
15
// Update the Token Balance
tokenBalance = tokenBalance.add(value);
tokenBalance = tokenBalance.add(value);
46,931
7
// Return the bps rate for reserve pool.
function getReservePoolBps() external view returns (uint256);
function getReservePoolBps() external view returns (uint256);
31,168
53
// override to add validRecipient_from address The address which you want to send tokens from_to address The address which you want to transfer to_value uint256 the amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) public validRecipient(_to) returns (bool)
function transferFrom(address _from, address _to, uint256 _value) public validRecipient(_to) returns (bool)
27,107
13
// Return _percent of _amount as the percentage and the remainder of _amount - percentage
function splitByPercent(uint256 _amount, uint256 _percent) internal pure returns (uint256 percentage, uint256 remainder)
function splitByPercent(uint256 _amount, uint256 _percent) internal pure returns (uint256 percentage, uint256 remainder)
8,646
14
// Update an external position and remove and external positions or components if necessary. The logic flows as follows:1) If component is not already added then add component and external position.2) If component is added but no existing external position using the passed module exists then add the external position.3) If the existing position is being added to then just update the unit and data4) If the position is being closed and no other external positions or default positions are associated with the component then untrack the component and remove external position.5) If the position is being closed and other existing
function editExternalPosition( IJasperVault _jasperVault, address _component, address _module, int256 _newUnit, bytes memory _data
function editExternalPosition( IJasperVault _jasperVault, address _component, address _module, int256 _newUnit, bytes memory _data
33,585
4
// Add the citizens' addresses
_bob = bob; _alice = alice; _sue = sue;
_bob = bob; _alice = alice; _sue = sue;
21,694
29
// Send a desired amount of funds to a wallet _account The address of the desired wallet _amount The amount of funds to send /
function _withdraw(address payable _account, uint256 _amount) internal { (bool sent, ) = _account.call{value: _amount}(""); require(sent, "Failed to send ether"); }
function _withdraw(address payable _account, uint256 _amount) internal { (bool sent, ) = _account.call{value: _amount}(""); require(sent, "Failed to send ether"); }
27,366
3
// IPFS Base URL
string public ipfsBase;
string public ipfsBase;
44,975
112
// coindrops wallet address
address public coindropsWallet; uint256 public coindropsTokens = 45000000 * 1E18; uint256 public coindropsLockEndingAt = 1527811200; // Friday, 1 June 2018 00:00:00 bool public coindropsStatus = false;
address public coindropsWallet; uint256 public coindropsTokens = 45000000 * 1E18; uint256 public coindropsLockEndingAt = 1527811200; // Friday, 1 June 2018 00:00:00 bool public coindropsStatus = false;
21,222
212
// Turn off swapping on the underlying pool during joins Otherwise tokens with callbacks would enable attacks involving simultaneous swaps and joins
bool origSwapState = bPool.isPublicSwap(); bPool.setPublicSwap(false); _; bPool.setPublicSwap(origSwapState);
bool origSwapState = bPool.isPublicSwap(); bPool.setPublicSwap(false); _; bPool.setPublicSwap(origSwapState);
6,700
28
// remove owner
function removeOwner(address owner) external onlyThis{ require(owners.length() > 1, "Remove all owners is not allowed"); require(owners.remove(owner), "Owner does not exist"); ownersSetCounter++; // change owners set emit SetOwner(owner, false); }
function removeOwner(address owner) external onlyThis{ require(owners.length() > 1, "Remove all owners is not allowed"); require(owners.remove(owner), "Owner does not exist"); ownersSetCounter++; // change owners set emit SetOwner(owner, false); }
52,009
163
// Prevents taking an action if the minimum number of responses has notbeen received for an answer. _answerId The the identifier of the answer that keeps track of the responses. /
modifier ensureMinResponsesReceived(uint256 _answerId) { if (answers[_answerId].responses.length >= answers[_answerId].minimumResponses) { _; } }
modifier ensureMinResponsesReceived(uint256 _answerId) { if (answers[_answerId].responses.length >= answers[_answerId].minimumResponses) { _; } }
50,478
35
// A function that generates a hash value of a request to which a user sends a token (executed by the user of the token) s _requested_user ETH address that requested token transfer s _value Number of tokens s _nonce One-time string return bytes32 Hash valueThe user signs the hash value obtained from this function and hands it over to the owner outside the system
function requestTokenTransfer(address _requested_user, uint256 _value, string calldata _nonce) external view returns (bytes32);
function requestTokenTransfer(address _requested_user, uint256 _value, string calldata _nonce) external view returns (bytes32);
15,294
219
// Fulfull a ticket /
function fulfill(uint256 tokenId) external onlyOwner { _fulfill(tokenId); }
function fulfill(uint256 tokenId) external onlyOwner { _fulfill(tokenId); }
72,943
34
// round 32
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 10716307389353583413755237303156291454109852751296156900963208377067748518748) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 10716307389353583413755237303156291454109852751296156900963208377067748518748) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
24,348
106
// We need to store a reference to this string as a variable so we can use it as an argument to the revert call from assembly.
string memory invalidLengthMessage = "Data field too short"; string memory callFailed = "Call failed";
string memory invalidLengthMessage = "Data field too short"; string memory callFailed = "Call failed";
7,335
37
// Increasing purchased tokens
tokensPurchased[msg.sender] += _tokenAmount;
tokensPurchased[msg.sender] += _tokenAmount;
15,128
65
// Pool info
function lockableToken(Victim victim, uint256 poolId) external view returns (IERC20) { (bool success, bytes memory result) = address(victim).staticcall(abi.encodeWithSignature("lockableToken(uint256)", poolId)); require(success, "lockableToken(uint256) staticcall failed."); return abi.decode(result, (IERC20)); }
function lockableToken(Victim victim, uint256 poolId) external view returns (IERC20) { (bool success, bytes memory result) = address(victim).staticcall(abi.encodeWithSignature("lockableToken(uint256)", poolId)); require(success, "lockableToken(uint256) staticcall failed."); return abi.decode(result, (IERC20)); }
70,045
14
// Mints a new a child token.Calculates child token ID using a namehash function.Requires the msg.sender to be the owner, approved, or operator of tokenId.Requires the token not exist. to address to receive the ownership of the given token ID tokenId uint256 ID of the parent token label subdomain label of the child token ID /
function mintChild(address to, uint256 tokenId, string calldata label) external;
function mintChild(address to, uint256 tokenId, string calldata label) external;
41,384
139
// return total tokens of the beneficiary address. /
function beneficiarytotal(address addr) public view returns (uint256) { require(_beneficiary_total[addr] != 0,'not in beneficiary list'); return _beneficiary_total[addr]; }
function beneficiarytotal(address addr) public view returns (uint256) { require(_beneficiary_total[addr] != 0,'not in beneficiary list'); return _beneficiary_total[addr]; }
44,122
39
// Overridden _beforeTokenTransfer function
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Snapshot) { super._beforeTokenTransfer(from, to, amount); }
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Snapshot) { super._beforeTokenTransfer(from, to, amount); }
9,269
132
// dai
jTokens[3] = 0xc988c170d0E38197DC634A45bF00169C7Aa7CA19;
jTokens[3] = 0xc988c170d0E38197DC634A45bF00169C7Aa7CA19;
2,566
5
// ============================== VIEW FUNCTIONS ============================== / Collection info getter serialNo bytes32 Serial of Collection queriedreturn info KeyNIndex Collection info /
function getCollectionInfo(bytes32 serialNo) public view returns (IndexNValue memory info) { return collectionData.data[serialNo]; }
function getCollectionInfo(bytes32 serialNo) public view returns (IndexNValue memory info) { return collectionData.data[serialNo]; }
29,593
60
// Verifies if receiver is contract and if so, calls (_to).onERC1155Received(...) /
function _callonERC1155Received( address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data
function _callonERC1155Received( address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data
47,113
3
// Mint Lucidia Dreams Cardholders tokens to an address/_to Address tokens get minted to/_amount Amount of tokens to mint
function reserveMint(address _to, uint _amount) external onlyOwner { _mint(_to, 1, _amount, ""); }
function reserveMint(address _to, uint _amount) external onlyOwner { _mint(_to, 1, _amount, ""); }
49,569
98
// Admin is able to set new admin/_admin Address of multisig that becomes new admin
function setAdminByAdmin(address _admin) public { require(msg.sender == admin); admin = _admin; }
function setAdminByAdmin(address _admin) public { require(msg.sender == admin); admin = _admin; }
8,662
5
// claim rewards
function claimRewards(uint256 tokenId, bool unstake) external { require(!paused, "Contract paused"); uint256 rewards = _claim(tokenId); if (unstake) { unstakeChadApe(tokenId); } if (rewards > 0) { require(CHAD.transfer(msg.sender, rewards)); } }
function claimRewards(uint256 tokenId, bool unstake) external { require(!paused, "Contract paused"); uint256 rewards = _claim(tokenId); if (unstake) { unstakeChadApe(tokenId); } if (rewards > 0) { require(CHAD.transfer(msg.sender, rewards)); } }
73,185
7
// vault does not have enough collateral to accept the over payment, so refund. TODO requestRefund requestRefund(surplusBtc, request.vault, request.requester, issueId);
}
}
12,544
41
// Add a new payee to the contract. account_ The address of the payee to add. shares_ The number of shares owned by the payee. /
function _addPayee(address account_, uint shares_) private { require(account_ != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account_] == 0, "PaymentSplitter: account already has shares"); _payees.push(account_); _shares[account_] = shares_; _totalShares += shares_; }
function _addPayee(address account_, uint shares_) private { require(account_ != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account_] == 0, "PaymentSplitter: account already has shares"); _payees.push(account_); _shares[account_] = shares_; _totalShares += shares_; }
39,745
41
// make it easier
miningTarget = miningTarget.add(miningTarget.div(2000).mul(shortage_block_pct_extra)); // by up to 50 %
miningTarget = miningTarget.add(miningTarget.div(2000).mul(shortage_block_pct_extra)); // by up to 50 %
18,261
93
// / GETTER FUNCTIONS
function balanceOf(address account) external view returns (uint256) { return balances[account]; }
function balanceOf(address account) external view returns (uint256) { return balances[account]; }
67,220
98
// Define address and the minting amounts. 85% will go to the LP and 15% will be held for the future
uint256 partnershipsPlusTokenAmount = (totalSupply * 15) / 100; // 15% for partnershipsPlus uint256 contractAmount = totalSupply - partnershipsPlusTokenAmount; // 85 % for the LP
uint256 partnershipsPlusTokenAmount = (totalSupply * 15) / 100; // 15% for partnershipsPlus uint256 contractAmount = totalSupply - partnershipsPlusTokenAmount; // 85 % for the LP
23,635
34
// newStartTimestamp: in seconds
function resetStartTimestamp(uint256 newStartTimestamp) external onlyOwner { _start_timestamp = newStartTimestamp; emit ResetStartTimestamp(newStartTimestamp); }
function resetStartTimestamp(uint256 newStartTimestamp) external onlyOwner { _start_timestamp = newStartTimestamp; emit ResetStartTimestamp(newStartTimestamp); }
6,587
5
// Function to set new burn fee. Only owner is allowed to change theburn fee below 10%. /
function setBurnFee(uint256 _fee) external onlyOwner
function setBurnFee(uint256 _fee) external onlyOwner
27,583
271
// Returns True if `self` contains `needle`. self The slice to search. needle The text to search for in `self`.return True if `needle` is found in `self`, false otherwise. /
function contains(slice memory self, slice memory needle) internal pure returns (bool) { return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr; }
function contains(slice memory self, slice memory needle) internal pure returns (bool) { return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr; }
27,532
38
// If the element we're deleting is the last one, we can just remove it without doing a swap
if (lastIndex != toDeleteIndex) { address lastValue = set.values[lastIndex];
if (lastIndex != toDeleteIndex) { address lastValue = set.values[lastIndex];
7,994
231
// require(value <= 10000, 'ERC2981Royalties: Too high');
_royalties = RoyaltyInfo(recipient, uint24(value));
_royalties = RoyaltyInfo(recipient, uint24(value));
73,602
46
// Convert response to string and return via error message
revert(string(abi.encodePacked(requiredGas)));
revert(string(abi.encodePacked(requiredGas)));
29,074
37
// Burns a specific amount of tokens. _from The address that will burn the tokens. _unitAmount The amount of token to be burned. /
function burn(address _from, uint256 _unitAmount) onlyOwner public { require(_unitAmount > 0 && balanceOf(_from) >= _unitAmount); balances[_from] = SafeMath.sub(balances[_from], _unitAmount); totalSupply = SafeMath.sub(totalSupply, _unitAmount); Burn(_from, _unitAmount); }
function burn(address _from, uint256 _unitAmount) onlyOwner public { require(_unitAmount > 0 && balanceOf(_from) >= _unitAmount); balances[_from] = SafeMath.sub(balances[_from], _unitAmount); totalSupply = SafeMath.sub(totalSupply, _unitAmount); Burn(_from, _unitAmount); }
37,548
2
// The app is at the second level, it may interact with other final level apps if whitelisted
uint256 constant internal APP_LEVEL_SECOND = 1 << 1;
uint256 constant internal APP_LEVEL_SECOND = 1 << 1;
13,473
67
// Returns cost of requestRates function. /
function requestPrice() public view returns(uint256) { uint256 requestCost = 0; for (uint256 i = 0; i < oracles.length; i++) { requestCost = requestCost.add(OracleI(oracles[i]).getPrice()); } return requestCost; }
function requestPrice() public view returns(uint256) { uint256 requestCost = 0; for (uint256 i = 0; i < oracles.length; i++) { requestCost = requestCost.add(OracleI(oracles[i]).getPrice()); } return requestCost; }
1,552
23
// check if a product is whitelisted by the owner product is the hash of underlying asset, strike asset, collateral asset, and isPut _underlying asset that the option references _strike asset that the strike price is denominated in _collateral asset that is held as collateral against short/written options _isPut True if a put option, False if a call optionreturn boolean, True if product is whitelisted /
function isOwnerWhitelistedProduct( address _underlying, address _strike, address _collateral, bool _isPut
function isOwnerWhitelistedProduct( address _underlying, address _strike, address _collateral, bool _isPut
41,311
95
// Changes the params related to arbitration. Effectively makes all new items use the new set of params. _arbitrator Arbitrator to resolve potential disputes. The arbitrator is trusted to support appeal periods and not reenter. _arbitratorExtraData Extra data for the trusted arbitrator contract. _registrationMetaEvidence The URI of the meta evidence object for registration requests. _clearingMetaEvidence The URI of the meta evidence object for clearing requests. /
function changeArbitrationParams( IArbitrator _arbitrator, bytes calldata _arbitratorExtraData, string calldata _registrationMetaEvidence, string calldata _clearingMetaEvidence
function changeArbitrationParams( IArbitrator _arbitrator, bytes calldata _arbitratorExtraData, string calldata _registrationMetaEvidence, string calldata _clearingMetaEvidence
81,125
184
// function that lets owner/governance contract approve allowance for any token inside this contract This means all future UNI like airdrops are covered And at the same time allows us to give allowance to strategy contracts. Upcoming cYFI etc vaults strategy contracts willse this function to manage and farm yield on value locked
function setStrategyContractOrDistributionContractAllowance( address tokenAddress, uint256 _amount, address contractAddress
function setStrategyContractOrDistributionContractAllowance( address tokenAddress, uint256 _amount, address contractAddress
6,961
12
// Approve the lender to take any funds
IERC20(token).approve(msg.sender, type(uint256).max);
IERC20(token).approve(msg.sender, type(uint256).max);
21,166
63
// checks for a pause on trading and depositing functionality
modifier notPaused() { require(!paused, "Paused"); _; }
modifier notPaused() { require(!paused, "Paused"); _; }
34,335
77
// transfer the NFT
IERC721(tokenAddresses[i]).safeTransferFrom(msg.sender, address(this), tokenIds[i]);
IERC721(tokenAddresses[i]).safeTransferFrom(msg.sender, address(this), tokenIds[i]);
59,275
164
// transfer to
SafeERC20.safeTransfer(IERC20(token), to, amount); return true;
SafeERC20.safeTransfer(IERC20(token), to, amount); return true;
65,664
16
// Get owned debt percentage of network by total networks internal function _index uintreturn debt network ratio by total network debt at specific time, and /
function _networkDebtPercentageAtIndex(uint _index) internal view returns (uint) { uint totalNetworkDebt = state().getTotalNetworkDebtEntryAtIndex(_index); return _networkDebtPercentage(totalNetworkDebt); }
function _networkDebtPercentageAtIndex(uint _index) internal view returns (uint) { uint totalNetworkDebt = state().getTotalNetworkDebtEntryAtIndex(_index); return _networkDebtPercentage(totalNetworkDebt); }
17,563
177
// reload balance of want after side effect
_balanceOfWant = balanceOfWant();
_balanceOfWant = balanceOfWant();
13,606
53
// 通缩相关 收取手续费
function _doCommission(int _commissionValue) { if (commissionRecvAddr == null) { return; } if (_commissionValue == 0) { return; } _transfer(msg.sender, commissionRecvAddr, _commissionValue); }
function _doCommission(int _commissionValue) { if (commissionRecvAddr == null) { return; } if (_commissionValue == 0) { return; } _transfer(msg.sender, commissionRecvAddr, _commissionValue); }
35,500
257
// Limit to main pool size.The rest of the pool is used as a reserve to improve consistency
if (bnbPool > _mainBnbPoolSize) { bnbPool = _mainBnbPoolSize; }
if (bnbPool > _mainBnbPoolSize) { bnbPool = _mainBnbPoolSize; }
31,413
23
// Permission: {onlyOwner} /
function transferAnyERC20Token( address _tokenAddress, address _beneficiary, uint256 _tokens ) external onlyOwner returns (bool success) { require(_tokenAddress != address(0), "Vesting: token address cannot be 0"); require(_tokenAddress != token, "Vesting: token cannot be ours"); return IERC20(_tokenAddress).transfer(_beneficiary, _tokens); }
function transferAnyERC20Token( address _tokenAddress, address _beneficiary, uint256 _tokens ) external onlyOwner returns (bool success) { require(_tokenAddress != address(0), "Vesting: token address cannot be 0"); require(_tokenAddress != token, "Vesting: token cannot be ours"); return IERC20(_tokenAddress).transfer(_beneficiary, _tokens); }
55,553
11
// This method isn't a view and it is extremelly expensive and inefficient.DO NOT call this method on-chain, it is for off-chain purposes only. /
function workable() external override returns (IDCASwapper.PairToSwap[] memory _pairs, uint32[] memory _smallestIntervals) { uint256 _count; // Count how many pairs can be swapped uint256 _length = _subsidizedPairs.length(); for (uint256 i; i < _length; i++) { IDCAPair _pair = IDCAPair(_subsidizedPairs.at(i)); bytes memory _swapPath = swapper.findBestSwap(_pair); uint32 _swapInterval = _getSmallestSwapInterval(_pair); if (_swapPath.length > 0 && _hasDelayPassedAlready(_pair, _swapInterval)) { _count++; } } // Create result array with correct size _pairs = new IDCASwapper.PairToSwap[](_count); _smallestIntervals = new uint32[](_count); // Fill result array for (uint256 i; i < _length; i++) { IDCAPair _pair = IDCAPair(_subsidizedPairs.at(i)); bytes memory _swapPath = swapper.findBestSwap(_pair); uint32 _swapInterval = _getSmallestSwapInterval(_pair); if (_swapPath.length > 0 && _hasDelayPassedAlready(_pair, _swapInterval)) { _pairs[--_count] = IDCASwapper.PairToSwap({pair: _pair, swapPath: _swapPath}); _smallestIntervals[_count] = _swapInterval; } } }
function workable() external override returns (IDCASwapper.PairToSwap[] memory _pairs, uint32[] memory _smallestIntervals) { uint256 _count; // Count how many pairs can be swapped uint256 _length = _subsidizedPairs.length(); for (uint256 i; i < _length; i++) { IDCAPair _pair = IDCAPair(_subsidizedPairs.at(i)); bytes memory _swapPath = swapper.findBestSwap(_pair); uint32 _swapInterval = _getSmallestSwapInterval(_pair); if (_swapPath.length > 0 && _hasDelayPassedAlready(_pair, _swapInterval)) { _count++; } } // Create result array with correct size _pairs = new IDCASwapper.PairToSwap[](_count); _smallestIntervals = new uint32[](_count); // Fill result array for (uint256 i; i < _length; i++) { IDCAPair _pair = IDCAPair(_subsidizedPairs.at(i)); bytes memory _swapPath = swapper.findBestSwap(_pair); uint32 _swapInterval = _getSmallestSwapInterval(_pair); if (_swapPath.length > 0 && _hasDelayPassedAlready(_pair, _swapInterval)) { _pairs[--_count] = IDCASwapper.PairToSwap({pair: _pair, swapPath: _swapPath}); _smallestIntervals[_count] = _swapInterval; } } }
16,889
99
// emit Transfer(0, msg.sender, 3)
mstore(0x00, numTokens) log3(0x00, 0x20, TRANSFER_SIG, 0, caller())
mstore(0x00, numTokens) log3(0x00, 0x20, TRANSFER_SIG, 0, caller())
80,866
73
// Note: changed visibility to public
require(isValidToken(_tokenId),'tokenId'); uint _cityId = tokenToCity(_tokenId); uint _i = _cityId; uint j = _i; uint len; while (j != 0) { len++; j /= 10;
require(isValidToken(_tokenId),'tokenId'); uint _cityId = tokenToCity(_tokenId); uint _i = _cityId; uint j = _i; uint len; while (j != 0) { len++; j /= 10;
23,571
127
// Check that each round end time is after the start time
require(_seedRound[0] < _seedRound[1]); require(_presale[0] < _presale[1]); require(_crowdsaleWeek1[0] < _crowdsaleWeek1[1]); require(_crowdsaleWeek2[0] < _crowdsaleWeek2[1]); require(_crowdsaleWeek3[0] < _crowdsaleWeek3[1]); require(_crowdsaleWeek4[0] < _crowdsaleWeek4[1]);
require(_seedRound[0] < _seedRound[1]); require(_presale[0] < _presale[1]); require(_crowdsaleWeek1[0] < _crowdsaleWeek1[1]); require(_crowdsaleWeek2[0] < _crowdsaleWeek2[1]); require(_crowdsaleWeek3[0] < _crowdsaleWeek3[1]); require(_crowdsaleWeek4[0] < _crowdsaleWeek4[1]);
19,775
151
// ResourceIdentifier Set Protocol A collection of utility functions to fetch information related to Resource contracts in the system /
library ResourceIdentifier { // IntegrationRegistry will always be resource ID 0 in the system uint256 constant internal INTEGRATION_REGISTRY_RESOURCE_ID = 0; // PriceOracle will always be resource ID 1 in the system uint256 constant internal PRICE_ORACLE_RESOURCE_ID = 1; // SetValuer resource will always be resource ID 2 in the system uint256 constant internal SET_VALUER_RESOURCE_ID = 2; /* ============ Internal ============ */ /** * Gets the instance of integration registry stored on Controller. Note: IntegrationRegistry is stored as index 0 on * the Controller */ function getIntegrationRegistry(IController _controller) internal view returns (IIntegrationRegistry) { return IIntegrationRegistry(_controller.resourceId(INTEGRATION_REGISTRY_RESOURCE_ID)); } /** * Gets instance of price oracle on Controller. Note: PriceOracle is stored as index 1 on the Controller */ function getPriceOracle(IController _controller) internal view returns (IPriceOracle) { return IPriceOracle(_controller.resourceId(PRICE_ORACLE_RESOURCE_ID)); } /** * Gets the instance of Set valuer on Controller. Note: SetValuer is stored as index 2 on the Controller */ function getSetValuer(IController _controller) internal view returns (ISetValuer) { return ISetValuer(_controller.resourceId(SET_VALUER_RESOURCE_ID)); } }
library ResourceIdentifier { // IntegrationRegistry will always be resource ID 0 in the system uint256 constant internal INTEGRATION_REGISTRY_RESOURCE_ID = 0; // PriceOracle will always be resource ID 1 in the system uint256 constant internal PRICE_ORACLE_RESOURCE_ID = 1; // SetValuer resource will always be resource ID 2 in the system uint256 constant internal SET_VALUER_RESOURCE_ID = 2; /* ============ Internal ============ */ /** * Gets the instance of integration registry stored on Controller. Note: IntegrationRegistry is stored as index 0 on * the Controller */ function getIntegrationRegistry(IController _controller) internal view returns (IIntegrationRegistry) { return IIntegrationRegistry(_controller.resourceId(INTEGRATION_REGISTRY_RESOURCE_ID)); } /** * Gets instance of price oracle on Controller. Note: PriceOracle is stored as index 1 on the Controller */ function getPriceOracle(IController _controller) internal view returns (IPriceOracle) { return IPriceOracle(_controller.resourceId(PRICE_ORACLE_RESOURCE_ID)); } /** * Gets the instance of Set valuer on Controller. Note: SetValuer is stored as index 2 on the Controller */ function getSetValuer(IController _controller) internal view returns (ISetValuer) { return ISetValuer(_controller.resourceId(SET_VALUER_RESOURCE_ID)); } }
11,042
263
// Handle incoming ETH to the contract address.
receive() external payable { if (msg.sender != address(token)) { deposit(); }
receive() external payable { if (msg.sender != address(token)) { deposit(); }
22,988
28
// Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol_spender The address which will spend the funds._subtractedValue The amount of tokens to decrease the allowance by./
function decreaseApproval(address _spender, uint _subtractedValue) public returns
function decreaseApproval(address _spender, uint _subtractedValue) public returns
30,836
276
// Decrement components used for issuance in vault
state.vaultInstance.batchDecrementTokenOwner( setToken.components, _componentOwner, decrementTokenOwnerValues );
state.vaultInstance.batchDecrementTokenOwner( setToken.components, _componentOwner, decrementTokenOwnerValues );
27,024