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
223
// ends the round. manages paying out winner/splitting up pot /
function endRound(Star3Ddatasets.EventReturns memory _eventData_) private returns (Star3Ddatasets.EventReturns)
function endRound(Star3Ddatasets.EventReturns memory _eventData_) private returns (Star3Ddatasets.EventReturns)
33,383
148
// sell quote case quote input + base output
if (baseBalance < _BASE_RESERVE_) { uint256 quoteInput = quoteBalance.sub(uint256(_QUOTE_RESERVE_)); ( uint256 receiveBaseAmount, uint256 mtFee, PMMPricing.RState newRState, uint256 newQuoteTarget ) = querySellQu...
if (baseBalance < _BASE_RESERVE_) { uint256 quoteInput = quoteBalance.sub(uint256(_QUOTE_RESERVE_)); ( uint256 receiveBaseAmount, uint256 mtFee, PMMPricing.RState newRState, uint256 newQuoteTarget ) = querySellQu...
66,823
190
// Returns the downcasted int40 from int256, reverting onoverflow (when the input is less than smallest int40 orgreater than largest int40). Counterpart to Solidity's `int40` operator. Requirements: - input must fit into 40 bits _Available since v4.7._ /
function toInt40(int256 value) internal pure returns (int40) { require(value >= type(int40).min && value <= type(int40).max, "SafeCast: value doesn't fit in 40 bits"); return int40(value); }
function toInt40(int256 value) internal pure returns (int40) { require(value >= type(int40).min && value <= type(int40).max, "SafeCast: value doesn't fit in 40 bits"); return int40(value); }
970
44
// 给用户转账
safeTransferUser(handle.user, amount);
safeTransferUser(handle.user, amount);
17,323
30
// Delegates vote to an address. _add is the address to delegate vote to. /
function delegateVote(address _add) external isMemberAndcheckPause checkPendingRewards { require(ms.masterInitialized(),'not initialized.'); require(allDelegation[followerDelegation[_add]].leader == address(0),'already delegate'); if (followerDelegation[msg.sender] > 0) { requ...
function delegateVote(address _add) external isMemberAndcheckPause checkPendingRewards { require(ms.masterInitialized(),'not initialized.'); require(allDelegation[followerDelegation[_add]].leader == address(0),'already delegate'); if (followerDelegation[msg.sender] > 0) { requ...
12,043
15
// 添加每日兑换
function addDateInfo(uint256 _outTokenCapacity) public onlyOwner { outTokenCapacity = _outTokenCapacity; }
function addDateInfo(uint256 _outTokenCapacity) public onlyOwner { outTokenCapacity = _outTokenCapacity; }
12,236
3
// Emitted when Keep3rKeeperFundablewithdraw is called/_keeper The caller of Keep3rKeeperFundablewithdraw function/_bond The asset to withdraw from the bonding pool/_amount The amount of funds withdrawn
event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);
event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);
393
66
// Subtracts an unscaled uint256 from an `Unsigned`, reverting on overflow. a a FixedPoint. b a uint256.return the difference of `a` and `b`. /
function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) { return sub(a, fromUnscaledUint(b)); }
function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) { return sub(a, fromUnscaledUint(b)); }
5,276
211
// Whether `a` is less than or equal to `b`. a an int256. b a FixedPoint.Signed.return True if `a <= b`, or False. /
function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue <= b.rawValue; }
function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue <= b.rawValue; }
64,984
42
// buy mining
function buyMiner() public payable whenNotPaused isNotBlackList(msg.sender)
function buyMiner() public payable whenNotPaused isNotBlackList(msg.sender)
5,777
13
// Present.
event Present(address indexed fromAddress, address indexed toAddress, uint256 amount, uint256 presentTime);
event Present(address indexed fromAddress, address indexed toAddress, uint256 amount, uint256 presentTime);
32,742
36
// Withdraw staked ApeCoin from the ApeCoin pool.If withdraw is total staked amount, performs an automatic claim. _amount Amount of ApeCoin /
function withdrawSelfApeCoin(uint256 _amount) external { withdrawApeCoin(_amount, msg.sender); }
function withdrawSelfApeCoin(uint256 _amount) external { withdrawApeCoin(_amount, msg.sender); }
22,488
43
// Ballot receipt record for a voter
struct Receipt { // Whether or not a vote has been cast bool hasVoted; // Whether or not the voter supports the proposal bool support; // The number of votes the voter had, which were cast uint256 votes; }
struct Receipt { // Whether or not a vote has been cast bool hasVoted; // Whether or not the voter supports the proposal bool support; // The number of votes the voter had, which were cast uint256 votes; }
11,414
5
// ========== USER METHODS ========== /
function mint() external payable nonReentrant whenNotPaused onlyOwner { require(tx.origin == msg.sender, "Allowed for EOA only"); _mint(msg.sender, idTracker.current()); idTracker.increment(); }
function mint() external payable nonReentrant whenNotPaused onlyOwner { require(tx.origin == msg.sender, "Allowed for EOA only"); _mint(msg.sender, idTracker.current()); idTracker.increment(); }
53,846
43
// Transfers vested tokens to the given account. account address of the vested user /
function releaseToken(address account) public { require(account != address(0)); VestedToken storage vested = vestedUser[account]; uint256 unreleasedToken = _releasableAmount(account); // total releasable token currently require(unreleasedToken>0); vested.releasedToken = vested.re...
function releaseToken(address account) public { require(account != address(0)); VestedToken storage vested = vestedUser[account]; uint256 unreleasedToken = _releasableAmount(account); // total releasable token currently require(unreleasedToken>0); vested.releasedToken = vested.re...
30,714
149
// Reserve claim ??? sushi.mint(devaddr, sushiReward.div(10)); sushi.mint(address(this), sushiReward);
pool.accEthyPerShare = pool.accEthyPerShare.add(ethyReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number;
pool.accEthyPerShare = pool.accEthyPerShare.add(ethyReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number;
16,040
23
// deposit - allow deposits to a lock/_lock hash of seed
function deposit( bytes32 _lock
function deposit( bytes32 _lock
23,706
66
// we check here all the fees to ensure that we don't have a scenario where one set of fees exceeds 33%
require(fbl_calculateStateFee(TransactionState.Sell, 100000) <= 33333, "ERC20Feeable: Sell Hardcap of 33% reached"); require(fbl_calculateStateFee(TransactionState.Buy, 100000) <= 33333, "ERC20Feeable: Buy Hardcap of 33% reached"); require(fbl_calculateStateFee(TransactionState.Normal, 100...
require(fbl_calculateStateFee(TransactionState.Sell, 100000) <= 33333, "ERC20Feeable: Sell Hardcap of 33% reached"); require(fbl_calculateStateFee(TransactionState.Buy, 100000) <= 33333, "ERC20Feeable: Buy Hardcap of 33% reached"); require(fbl_calculateStateFee(TransactionState.Normal, 100...
37,169
32
// solium-disable-next-line security/no-block-members
block.timestamp < crowdsales[_token].closingTime, "Failed to buy token due to crowdsale is closed." ); deposits[msg.sender][_token] = ( deposits[msg.sender][_token].add(msg.value) ); crowdsales[_token].raised = crowdsales[_token].raised.add(msg.value)...
block.timestamp < crowdsales[_token].closingTime, "Failed to buy token due to crowdsale is closed." ); deposits[msg.sender][_token] = ( deposits[msg.sender][_token].add(msg.value) ); crowdsales[_token].raised = crowdsales[_token].raised.add(msg.value)...
82,000
9
// Returns the downcasted int32 from int256, reverting onoverflow (when the input is less than smallest int32 orgreater than largest int32). Counterpart to Solidity's `int32` operator. Requirements: - input must fit into 32 bits _Available since v3.1._ /
function toInt32(int256 value) internal pure returns (int32) { require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits"); return int32(value); }
function toInt32(int256 value) internal pure returns (int32) { require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits"); return int32(value); }
14,953
577
// Reads the uint216 at `mPtr` in memory.
function readUint216( MemoryPointer mPtr
function readUint216( MemoryPointer mPtr
33,706
0
// Payments Event Emitter
contract PaymentModelEventEmitter { event LogPaymentSent(address from, address to, uint amount); event LogPaymentRecv(address from, address to, uint amount); }
contract PaymentModelEventEmitter { event LogPaymentSent(address from, address to, uint amount); event LogPaymentRecv(address from, address to, uint amount); }
49,990
1
// Name of collection // Symbol of collection // Price per token // Max per Tx // Maximum amount of tokens in collection // URI for the contract metadata // Public sale state // Total supply // Notify on sale state change // Notify on total supply change // For URI conversions /
) ERC1155(_uri) PaymentSplitter(shareholders, shares) {} /// @notice Sets public sale state /// @param val The new value function setSaleState(bool val) external onlyOwner { saleActive = val; emit SaleStateChanged(val); }
) ERC1155(_uri) PaymentSplitter(shareholders, shares) {} /// @notice Sets public sale state /// @param val The new value function setSaleState(bool val) external onlyOwner { saleActive = val; emit SaleStateChanged(val); }
30,077
101
// `updateValueAtNow` used to update the `balances` map and the/`totalSupplyHistory`/checkpoints The history of data being updated/_value The new number of tokens
function updateValueAtNow(Checkpoint[] storage checkpoints, uint _value) internal { if ((checkpoints.length == 0) || (checkpoints[checkpoints.length - 1].fromBlock < block.number)) { Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++]; newCheckPoint.fromBlock = uint1...
function updateValueAtNow(Checkpoint[] storage checkpoints, uint _value) internal { if ((checkpoints.length == 0) || (checkpoints[checkpoints.length - 1].fromBlock < block.number)) { Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++]; newCheckPoint.fromBlock = uint1...
16,152
30
// Has surplus
totalSurplus = totalSurplus.add(surplus);
totalSurplus = totalSurplus.add(surplus);
27,964
36
// Buy tokens from contract by sending ether
function buy() payable public { require(!frozenAccount[msg.sender]); require(msg.value > 0); commission = msg.value/commissionRate; // % of wei tx require(address(this).send(commission)); buyToken(); }
function buy() payable public { require(!frozenAccount[msg.sender]); require(msg.value > 0); commission = msg.value/commissionRate; // % of wei tx require(address(this).send(commission)); buyToken(); }
28,629
24
// Withdraw an amount of asset from the platform. _recipient Address to which the asset should be sent _asset Address of the asset _amountUnits of asset to withdraw /
function withdraw( address _recipient, address _asset, uint256 _amount ) external virtual;
function withdraw( address _recipient, address _asset, uint256 _amount ) external virtual;
16,321
6
// The Owned contract A contract with helpers for basic contract ownership. /
contract Owned { address payable public owner; address private pendingOwner; event OwnershipTransferRequested( address indexed from, address indexed to ); event OwnershipTransferred( address indexed from, address indexed to ); constructor() public { owner = msg.sender; } /** ...
contract Owned { address payable public owner; address private pendingOwner; event OwnershipTransferRequested( address indexed from, address indexed to ); event OwnershipTransferred( address indexed from, address indexed to ); constructor() public { owner = msg.sender; } /** ...
29,065
7
// Borrower is attempting to create or modify a loan such that their loan's quote token would be less than the pool's minimum debt amount. /
error AmountLTMinDebt();
error AmountLTMinDebt();
39,855
26
// Ensure token belongs to the caller/
modifier isTokenOwner(uint256 _tokenId) { require(ownerOf(_tokenId) == msg.sender , "caller is not token owner"); _; }
modifier isTokenOwner(uint256 _tokenId) { require(ownerOf(_tokenId) == msg.sender , "caller is not token owner"); _; }
556
109
// DIP4GenesisBlock
function setStorageDIP4GenesisBlock(uint256 _block) internal { eternalStorage().setUint(getStorageDIP4GenesisBlockKey(), _block); }
function setStorageDIP4GenesisBlock(uint256 _block) internal { eternalStorage().setUint(getStorageDIP4GenesisBlockKey(), _block); }
2,672
17
// Determine whether all hosts have revealed their secret random numbers.
bool all_hosts_revealed = num_hosts == num_hosts_revealed;
bool all_hosts_revealed = num_hosts == num_hosts_revealed;
11,917
96
// buying can only begins as soon as the ownership has been transfer to the pendingOwner
require(owner==pendingOwner); uint256 weiAmount = msg.value;
require(owner==pendingOwner); uint256 weiAmount = msg.value;
47,693
55
// Returns the downcasted int136 from int256, reverting onoverflow (when the input is less than smallest int136 orgreater than largest int136). Counterpart to Solidity's `int136` operator. Requirements: - input must fit into 136 bits _Available since v4.7._ /
function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); }
function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); }
32,167
80
// A sample implementation of core ERC1155 function.
contract ERC1155 is IERC1155, ERC165, CommonConstants { using SafeMath for uint256; using Address for address; // id => (owner => balance) mapping (uint256 => mapping(address => uint256)) internal balances; // owner => (operator => approved) mapping (address => mapping(address => bool)) intern...
contract ERC1155 is IERC1155, ERC165, CommonConstants { using SafeMath for uint256; using Address for address; // id => (owner => balance) mapping (uint256 => mapping(address => uint256)) internal balances; // owner => (operator => approved) mapping (address => mapping(address => bool)) intern...
5,637
13
// Pools
IRewardDistributionRecipient uniPool = IRewardDistributionRecipient(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); IRewardDistributionRecipient bptPool = IRewardDistributionRecipient(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
IRewardDistributionRecipient uniPool = IRewardDistributionRecipient(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); IRewardDistributionRecipient bptPool = IRewardDistributionRecipient(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
23,525
157
// Performs a transfer out, ideally returning an explanatory error code upon failure tather than reverting. If caller has not called checked protocol's balance, may revert due to insufficient cash held in the contract. If caller has checked protocol's balance, and verified it is >= amount, this should not revert in nor...
function doTransferOut(address payable to, uint amount) internal virtual ;
function doTransferOut(address payable to, uint amount) internal virtual ;
12,324
61
// Change the RC end block number. _endBlock The end block /
function setEndBlock(uint256 _endBlock) external onlyOwner beforeEnd whenReserving { require(_endBlock >= block.number, "_endBlock < current block"); require(_endBlock >= startBlock, "_endBlock < startBlock"); require(_endBlock != endBlock, "_endBlock == endBlock"); endBlock = _endB...
function setEndBlock(uint256 _endBlock) external onlyOwner beforeEnd whenReserving { require(_endBlock >= block.number, "_endBlock < current block"); require(_endBlock >= startBlock, "_endBlock < startBlock"); require(_endBlock != endBlock, "_endBlock == endBlock"); endBlock = _endB...
47,852
59
// get fee for funder _funder address of funder to check fee /
function feeForFunder(address _funder) public view returns (uint256) { FunderPortfolio memory tokenFunder = funders[_funder]; uint8 currentId = tokenFunder.class; uint256 currentFee = classes[currentId].classFee; return (seedAmountForFunder(_funder) * currentFee) / PRECISION; }...
function feeForFunder(address _funder) public view returns (uint256) { FunderPortfolio memory tokenFunder = funders[_funder]; uint8 currentId = tokenFunder.class; uint256 currentFee = classes[currentId].classFee; return (seedAmountForFunder(_funder) * currentFee) / PRECISION; }...
502
16
// Changes the proportion of appeal fees that must be paid by winner and loser and changes the appeal period portion for losers._winnerStakeMultiplier The new winner stake multiplier value respect to DENOMINATOR._loserStakeMultiplier The new loser stake multiplier value respect to DENOMINATOR._loserAppealPeriodMultipli...
function changeMultipliers( uint256 _winnerStakeMultiplier, uint256 _loserStakeMultiplier, uint256 _loserAppealPeriodMultiplier
function changeMultipliers( uint256 _winnerStakeMultiplier, uint256 _loserStakeMultiplier, uint256 _loserAppealPeriodMultiplier
15,794
30
// Set the beneficiary address of this contract. Only the contract owner may call this. The provided beneficiary must be non-null. _beneficiary The address to pay any eth contained in this contract to upon self-destruction. /
function setSelfDestructBeneficiary(address _beneficiary) external onlyOwner { require(_beneficiary != address(0), "Beneficiary must not be zero"); selfDestructBeneficiary = _beneficiary; emit SelfDestructBeneficiaryUpdated(_beneficiary); }
function setSelfDestructBeneficiary(address _beneficiary) external onlyOwner { require(_beneficiary != address(0), "Beneficiary must not be zero"); selfDestructBeneficiary = _beneficiary; emit SelfDestructBeneficiaryUpdated(_beneficiary); }
530
17
// Set the sell amount to the user's full balance, don't sell if empty
uint256 amount = tokenBalanceOf(_customerAddress); require(amount > 0);
uint256 amount = tokenBalanceOf(_customerAddress); require(amount > 0);
21,109
8
// shares.approve(address(controller), shares.balanceOf(address(this))); the fuck
controller.redeemShares();
controller.redeemShares();
33,568
51
// tokens remaining for ILO
uint private _availTokensILO;
uint private _availTokensILO;
21,879
80
// Current max wallet amount (If limits in effect)
uint256 public maxWallet;
uint256 public maxWallet;
8,568
215
// start off by borrowing or returning:
(bool borrowMore, uint256 amount) = internalCreditOfficer();
(bool borrowMore, uint256 amount) = internalCreditOfficer();
30,669
0
// Maximum uint256
uint256 constant MAX_INT = 115792089237316195423570985008687907853269984665640564039457584007913129639935; using SafeMath for uint256; string private _name; string private _symbol; uint256 private _totalSupply; mapping(address => uint256) private balances; mapping(address => mapping(addre...
uint256 constant MAX_INT = 115792089237316195423570985008687907853269984665640564039457584007913129639935; using SafeMath for uint256; string private _name; string private _symbol; uint256 private _totalSupply; mapping(address => uint256) private balances; mapping(address => mapping(addre...
4,502
2
// Internal function to set the contract URI _contractURI string URI prefix to assign /
function _setContractURI(string memory _contractURI) internal { contractURI = _contractURI; }
function _setContractURI(string memory _contractURI) internal { contractURI = _contractURI; }
36,585
102
// See {IERC1155Inventory-isFungible(uint256)}.
function isFungible(uint256 id) external pure virtual override returns (bool) { return id.isFungibleToken(); }
function isFungible(uint256 id) external pure virtual override returns (bool) { return id.isFungibleToken(); }
33,960
9
// Adds a int256 value to the request with a given key name self The initialized request key The name of the key value The int256 value to add /
function addInt( Request memory self, string memory key, int256 value
function addInt( Request memory self, string memory key, int256 value
15,410
0
// Libraries
using SafeToken for address; using SafeMath for uint256;
using SafeToken for address; using SafeMath for uint256;
29,058
10
// Make sure the user was added at least `recoveryUserWaitTime` ago
(user.addedAt + recoveryUserWaitTime < block.timestamp) &&
(user.addedAt + recoveryUserWaitTime < block.timestamp) &&
11,111
3
// allowed draw ETH
bool public allowDraw = true;
bool public allowDraw = true;
24,094
21
// EIP20 Approval event /
event Approval(address indexed owner, address indexed spender, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
6,700
133
// Paused stops new deposits and checkpoints
bool private paused; address[] private rewardTokens; mapping(address => TotalHarvestData) private rewardTokenToTotalHarvestData; mapping(address => mapping(address => UserHarvestData)) private rewardTokenToUserToHarvestData;
bool private paused; address[] private rewardTokens; mapping(address => TotalHarvestData) private rewardTokenToTotalHarvestData; mapping(address => mapping(address => UserHarvestData)) private rewardTokenToUserToHarvestData;
60,739
193
// Withdraw balance of this contract to the `wallet` address Used only if there are some leftoverfunds (because of topUpBalance)/
function withdrawBalance() public mustBeAtStage(Stage.Finalized) { wallet.transfer(this.balance); }
function withdrawBalance() public mustBeAtStage(Stage.Finalized) { wallet.transfer(this.balance); }
17,758
516
// Decode a integer numeric value from a Result as an `int128` value. _result An instance of Result.return The `int128` decoded from the Result. /
function asInt128(Result memory _result) public pure returns(int128) { require(_result.success, "Tried to read `int128` value from errored Result"); return _result.cborValue.decodeInt128(); }
function asInt128(Result memory _result) public pure returns(int128) { require(_result.success, "Tried to read `int128` value from errored Result"); return _result.cborValue.decodeInt128(); }
12,821
119
// Minimum gain required to buy WETH is about 0.01 tokens
if(gain >= minGain){
if(gain >= minGain){
44,009
34
// Thrown if the account owner tries to transfer an unhealthy account
error CantTransferLiquidatableAccountException();
error CantTransferLiquidatableAccountException();
28,733
7
// 3. Call work to altering Vault position
Vault(_vault).work{ value: _msgValue }(_posId, _worker, _principalAmount, _borrowAmount, _maxReturn, _workData);
Vault(_vault).work{ value: _msgValue }(_posId, _worker, _principalAmount, _borrowAmount, _maxReturn, _workData);
28,644
7
// NonReceivableInitializedProxy Anna Carroll /
contract NonReceivableInitializedProxy { // address of logic contract address public immutable logic; // ======== Constructor ========= constructor(address _logic, bytes memory _initializationCalldata) { logic = _logic; // Delegatecall into the logic contract, supplying initialization ...
contract NonReceivableInitializedProxy { // address of logic contract address public immutable logic; // ======== Constructor ========= constructor(address _logic, bytes memory _initializationCalldata) { logic = _logic; // Delegatecall into the logic contract, supplying initialization ...
38,954
173
// Current price
ethAmount.mul(1e18).div(tokenAmount) :
ethAmount.mul(1e18).div(tokenAmount) :
20,805
8
// The percentage taken by the house on every game Can be changed later with the changeHouseCutPercentage() function /
uint public houseCutPercentage = 10;
uint public houseCutPercentage = 10;
45,986
350
// Returns the downcasted int184 from int256, reverting onoverflow (when the input is less than smallest int184 orgreater than largest int184). Counterpart to Solidity's `int184` operator. Requirements: - input must fit into 184 bits _Available since v4.7._ /
function toInt184(int256 value) internal pure returns (int184) { require(value >= type(int184).min && value <= type(int184).max, "SafeCast: value doesn't fit in 184 bits"); return int184(value); }
function toInt184(int256 value) internal pure returns (int184) { require(value >= type(int184).min && value <= type(int184).max, "SafeCast: value doesn't fit in 184 bits"); return int184(value); }
7,562
27
// Sends the last weis in this contract to the owner. These weis come fromthe imprecision in the ROI integer division, and would be otherwise stuckin this contract. Can be called only after all FUNDs have been redeemed. /
function drain() public onlyDuring(State.Finished) onlyBy(owner)
function drain() public onlyDuring(State.Finished) onlyBy(owner)
4,970
33
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'Helper::safeTransfer: transfer failed' );
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'Helper::safeTransfer: transfer failed' );
15,894
9
// _TOKEN Address of TOKEN/_sTOKENAddress of sTOKEN/_epochLengthEpoch length/_secondsTillFirstEpochSeconds till first epoch starts
constructor(address _TOKEN, address _sTOKEN, uint256 _epochLength, uint256 _secondsTillFirstEpoch) { require(_TOKEN != address(0), "Zero address: TOKEN"); TOKEN = IERC20(_TOKEN); require(_sTOKEN != address(0), "Zero address"); sTOKEN = IsStakingProtocol(_sTOKEN); epoch = Epoch({length: _epochLength, number:...
constructor(address _TOKEN, address _sTOKEN, uint256 _epochLength, uint256 _secondsTillFirstEpoch) { require(_TOKEN != address(0), "Zero address: TOKEN"); TOKEN = IERC20(_TOKEN); require(_sTOKEN != address(0), "Zero address"); sTOKEN = IsStakingProtocol(_sTOKEN); epoch = Epoch({length: _epochLength, number:...
1,002
19
// voteForRequest - To vote for a new Functionality Request _requestName - Name of the Functionality Request _isUpvote - Is the vote an Upvote or Downvotereturns - Successful or not (true/false) /
function voteForRequest(string _requestName, bool _isUpvote) isPOWRHolder isValidVoter(_requestName)
function voteForRequest(string _requestName, bool _isUpvote) isPOWRHolder isValidVoter(_requestName)
25,320
41
// Save off the previous white list
uint8 previousWhitelist = addressWhitelists[addressToAdd[i]];
uint8 previousWhitelist = addressWhitelists[addressToAdd[i]];
9,069
67
// The address where all the funds will be stored/
address public wallet;
address public wallet;
6,996
15
// Viewsfunction getSynthExchangeSuspensions(bytes32[] calldata synths)externalviewreturns (bool[] memory exchangeSuspensions, uint256[] memory reasons);
function synthExchangeSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason);
function synthExchangeSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason);
45,472
40
// Query a contract to see if it supports a certain interface/Returns `true` the interface is supported and `false` otherwise,/returns `true` for INTERFACE_SIGNATURE_ERC165 and/INTERFACE_SIGNATURE_ERC721, see ERC-165 for other interface signatures.
function supportsInterface(bytes4 _interfaceID) external pure returns (bool);
function supportsInterface(bytes4 _interfaceID) external pure returns (bool);
29,384
25
// Model for responses from oracles
struct ResponseInfo { address requester; // Account that requested status bool isOpen; // If open, oracle responses are accepted mapping(uint8 => address[]) responses; // Mapping key is the status code reported // This lets us group responses and identify // the response that...
struct ResponseInfo { address requester; // Account that requested status bool isOpen; // If open, oracle responses are accepted mapping(uint8 => address[]) responses; // Mapping key is the status code reported // This lets us group responses and identify // the response that...
306
0
// The premia token
IERC20 public premia;
IERC20 public premia;
52,900
52
// swap and liquify at 0.025% of initialSupply
uint256 public minimumTokensBeforeSwap = initialSupply * 250 / 1000000; address public liquidityWallet; address public operationsWallet; address public buyBackWallet; address public charityWallet;
uint256 public minimumTokensBeforeSwap = initialSupply * 250 / 1000000; address public liquidityWallet; address public operationsWallet; address public buyBackWallet; address public charityWallet;
46,156
122
// provide token1 and token2 to SUSHI
IERC20(uniLPComponentToken0).safeApprove(sushiswapRouterV2, 0); IERC20(uniLPComponentToken0).safeApprove(sushiswapRouterV2, token0Amount); IERC20(uniLPComponentToken1).safeApprove(sushiswapRouterV2, 0); IERC20(uniLPComponentToken1).safeApprove(sushiswapRouterV2, token1Amount);
IERC20(uniLPComponentToken0).safeApprove(sushiswapRouterV2, 0); IERC20(uniLPComponentToken0).safeApprove(sushiswapRouterV2, token0Amount); IERC20(uniLPComponentToken1).safeApprove(sushiswapRouterV2, 0); IERC20(uniLPComponentToken1).safeApprove(sushiswapRouterV2, token1Amount);
33,174
180
// It will deposit tokens into the locker for given beneficiary./beneficiary Address of the beneficiary, whose tokens are being locked./amount Amount of tokens being locked
function deposit (address beneficiary, uint amount ) public onlyAuction preLock { uint totalBalance = token.balanceOf(this); require(totalBalance.sub(deposited) >= amount); deposited = deposited.add(amount); emit Deposited(beneficiary, amount); }
function deposit (address beneficiary, uint amount ) public onlyAuction preLock { uint totalBalance = token.balanceOf(this); require(totalBalance.sub(deposited) >= amount); deposited = deposited.add(amount); emit Deposited(beneficiary, amount); }
4,651
94
// Nodes This contract contains all logic to manage SKALE Network nodes states,space availability, stake requirement checks, and exit functions.Nodes may be in one of several states:- Active:Node is registered and is in network operation.- Leaving: Node has begun exiting from the network.- Left:Node has left the networ...
contract Nodes is Permissions, INodes { import "./Permissions.sol"; import "./ConstantsHolder.sol"; import "./utils/Random.sol"; import "./utils/SegmentTree.sol"; import "./NodeRotation.sol"; using Random for IRandom.RandomGenerator; using SafeCastUpgradeable for uint; using SegmentTree for Segment...
contract Nodes is Permissions, INodes { import "./Permissions.sol"; import "./ConstantsHolder.sol"; import "./utils/Random.sol"; import "./utils/SegmentTree.sol"; import "./NodeRotation.sol"; using Random for IRandom.RandomGenerator; using SafeCastUpgradeable for uint; using SegmentTree for Segment...
4,921
250
// And push the new swap
self.user_swaps[_to].push(from_swaps[i]);
self.user_swaps[_to].push(from_swaps[i]);
24,006
173
// called from 'enter' proposer is client in the case of 'proposeByBoth'
function proposeByBoth(address payable _client, address _backup, bytes calldata _functionData) external allowSelfCallsOnly { bytes4 proposedActionId = getMethodId(_functionData); require(isFastAction(proposedActionId), "invalid proposal"); checkRelation(_client, _backup); bytes32 functionHash = keccak256(_func...
function proposeByBoth(address payable _client, address _backup, bytes calldata _functionData) external allowSelfCallsOnly { bytes4 proposedActionId = getMethodId(_functionData); require(isFastAction(proposedActionId), "invalid proposal"); checkRelation(_client, _backup); bytes32 functionHash = keccak256(_func...
1,232
52
// constant addresses of all advisers /
address constant ADVISER1 = 0x7915D5A865FE68C63112be5aD3DCA5187EB08f24; address constant ADVISER2 = 0x31cFF39AA68B91fa7C957272A6aA8fB8F7b69Cb0; address constant ADVISER3 = 0x358b3aeec9fae5ab15fe28d2fe6c7c9fda596857; address constant ADVISER4 = 0x1011FC646261eb5d4aB875886f1470d4919d83c8; address cons...
address constant ADVISER1 = 0x7915D5A865FE68C63112be5aD3DCA5187EB08f24; address constant ADVISER2 = 0x31cFF39AA68B91fa7C957272A6aA8fB8F7b69Cb0; address constant ADVISER3 = 0x358b3aeec9fae5ab15fe28d2fe6c7c9fda596857; address constant ADVISER4 = 0x1011FC646261eb5d4aB875886f1470d4919d83c8; address cons...
30,066
59
// Profit share owing/_investor An Ethereum address/ return A positive number
function profitShareOwing(address _investor) public view returns (uint) { if (!totalSupplyIsFixed || totalSupply_ == 0) { return 0; } InvestorAccount memory account = accounts[_investor]; return totalProfits.sub(account.lastTotalProfits) .mul(...
function profitShareOwing(address _investor) public view returns (uint) { if (!totalSupplyIsFixed || totalSupply_ == 0) { return 0; } InvestorAccount memory account = accounts[_investor]; return totalProfits.sub(account.lastTotalProfits) .mul(...
20,094
19
// Comment
function addComment(bytes32 _id, string memory _commentHash) public { require(idToIndex[_id] != 0, "Propose id don't exist!"); uint id = lsComment.push(_commentHash) - 1; proIdToComment[_id].push(id); emit NewComment(_id, _commentHash); }
function addComment(bytes32 _id, string memory _commentHash) public { require(idToIndex[_id] != 0, "Propose id don't exist!"); uint id = lsComment.push(_commentHash) - 1; proIdToComment[_id].push(id); emit NewComment(_id, _commentHash); }
38,314
195
// Address of transferProxy contract
ITransferProxy public transferProxyInstance;
ITransferProxy public transferProxyInstance;
17,826
35
// For checking how many tokens you own. _owner - the owner's addr /
function balanceOf(address _owner) public view returns(uint256) { return ownerKTCount[_owner]; }
function balanceOf(address _owner) public view returns(uint256) { return ownerKTCount[_owner]; }
31,921
14
// Retrieve the consideration item from the execution struct.
ReceivedItem memory considerationItem = considerationExecution.item;
ReceivedItem memory considerationItem = considerationExecution.item;
20,063
26
// Abstract function to transfer rewards to the desired account to Account address to send the rewards amount Amount of rewards to transfer /
function _transferRewards(address to, uint256 amount) internal virtual; function _getScaledUserBalanceAndSupply(address _asset, address _user) internal view virtual returns (uint256 userBalance, uint256 totalSupply);
function _transferRewards(address to, uint256 amount) internal virtual; function _getScaledUserBalanceAndSupply(address _asset, address _user) internal view virtual returns (uint256 userBalance, uint256 totalSupply);
5,951
9
// ! ],! "expected": [! "4", "3", "1", "2", "5", "1", "5", "3", "2", "8", "10"! ]
//! }, { //! "name": "complex", //! "input": [ //! { //! "entry": "complex", //! "calldata": [ //! ] //! }
//! }, { //! "name": "complex", //! "input": [ //! { //! "entry": "complex", //! "calldata": [ //! ] //! }
28,520
29
// Bonus token for holders of any PAC DAO NFT /
contract PACLEXAction is ERC721Enumerable { /* VARIABLES */ uint256 public currentId; address payable public beneficiary; address public owner; address public pacdao = 0xf27AC88ac7e80487f21e5c2C847290b2AE5d7B8e; address public lexarmy = 0xBe9aAF4113B5a4aFCdb7E20c21eAa53C6EE20b10; address publi...
contract PACLEXAction is ERC721Enumerable { /* VARIABLES */ uint256 public currentId; address payable public beneficiary; address public owner; address public pacdao = 0xf27AC88ac7e80487f21e5c2C847290b2AE5d7B8e; address public lexarmy = 0xBe9aAF4113B5a4aFCdb7E20c21eAa53C6EE20b10; address publi...
34,596
62
// ERC20 compatible token - Short address attack fix created 29/09/2017author Frank Bonnet /
contract Token is IToken, InputValidator { // Ethereum token standard string public standard = "Token 0.3"; string public name; string public symbol; uint8 public decimals = 8; // Token state uint internal totalTokenSupply; // Token balances mapping (address => uint) internal bala...
contract Token is IToken, InputValidator { // Ethereum token standard string public standard = "Token 0.3"; string public name; string public symbol; uint8 public decimals = 8; // Token state uint internal totalTokenSupply; // Token balances mapping (address => uint) internal bala...
27,759
98
// do the transfers and collect payment
if (zeroForOne) { if (amount1 < 0) TransferHelper.safeTransfer(token1, recipient, uint256(-amount1)); uint256 balance0Before = balance0(); ISwapHatV3SwapCallback(msg.sender).swaphatV3SwapCallback(amount0, amount1, data); require(balance0Before.add(uint256(amount0...
if (zeroForOne) { if (amount1 < 0) TransferHelper.safeTransfer(token1, recipient, uint256(-amount1)); uint256 balance0Before = balance0(); ISwapHatV3SwapCallback(msg.sender).swaphatV3SwapCallback(amount0, amount1, data); require(balance0Before.add(uint256(amount0...
25,044
5
// Withdraws from Save Withdraws token supported by mStable from Save _credits Credits to withdraw _unstake unstake from Vault?return amountWithdrawn Amount withdrawn in mUSD /
function _withdraw(uint256 _credits, bool _unstake) internal returns (uint256 amountWithdrawn)
function _withdraw(uint256 _credits, bool _unstake) internal returns (uint256 amountWithdrawn)
22,447
755
// Sets the referral code for Aave deposits. referralCode The referral code. /
function setAaveReferralCode(uint16 referralCode) external onlyOwner {
function setAaveReferralCode(uint16 referralCode) external onlyOwner {
36,086
5
// Interface for contracts conforming to ERC-721: Non-Fungible Tokens/Dieter Shirley <dete@axiomzen.co> (https:github.com/dete)
contract ERC721 { // Required methods function totalSupply() public view returns (uint256 total); function balanceOf(address _owner) public view returns (uint256 balance); function ownerOf(uint256 _tokenId) external view returns (address owner); function approve(address _to, uint256 _tokenId) extern...
contract ERC721 { // Required methods function totalSupply() public view returns (uint256 total); function balanceOf(address _owner) public view returns (uint256 balance); function ownerOf(uint256 _tokenId) external view returns (address owner); function approve(address _to, uint256 _tokenId) extern...
6,715
164
// Returns the rate at which we withdraw maker tokens./info State from `_getBalanceCheckInfo()`./ return makerTokenWithdrawRate Maker token withdraw rate.
function _getMakerTokenWithdrawRate(BalanceCheckInfo memory info) internal pure returns (int256 makerTokenWithdrawRate)
function _getMakerTokenWithdrawRate(BalanceCheckInfo memory info) internal pure returns (int256 makerTokenWithdrawRate)
54,771
6
// @inheritdoc ITasks
function taskCount() external view returns (uint256) { return taskCounter; }
function taskCount() external view returns (uint256) { return taskCounter; }
24,655
161
// Mint the destination tokens with the withdrawn collateral
destinationPool.exchangeMint( executeExchangeParams.collateralAmount.rawValue, executeExchangeParams.destNumTokens.rawValue, executeExchangeParams.recipient ); emit Exchange( executeExchangeParams.sender, address(destinationPool), executeExchangeParams.numTokens.rawValue...
destinationPool.exchangeMint( executeExchangeParams.collateralAmount.rawValue, executeExchangeParams.destNumTokens.rawValue, executeExchangeParams.recipient ); emit Exchange( executeExchangeParams.sender, address(destinationPool), executeExchangeParams.numTokens.rawValue...
7,917
183
// If there's no limit or if the limit is greater than the start distance, apply the discount rate of the base.
if (_limitLength == 0 || _limitLength > _startDistance) {
if (_limitLength == 0 || _limitLength > _startDistance) {
27,430
20
// scope for checks, avoids stack too deep errors
uint256 token0TransferCost = data.transferGasCosts[depositParams.token0]; uint256 token1TransferCost = data.transferGasCosts[depositParams.token1]; require(token0TransferCost != 0 && token1TransferCost != 0, 'OS0F'); checkOrderParams( data, ...
uint256 token0TransferCost = data.transferGasCosts[depositParams.token0]; uint256 token1TransferCost = data.transferGasCosts[depositParams.token1]; require(token0TransferCost != 0 && token1TransferCost != 0, 'OS0F'); checkOrderParams( data, ...
28,508
13
// uint256 allClaimableAmount = (lastRoiTimeinvestors[msg.sender].totalLockedapr).div(percentRaterewardPeriod); investors[msg.sender].claimableAmount = investors[msg.sender] .claimableAmount .add(allClaimableAmount);
investors[msg.sender].maxClaimableAmount = investors[msg.sender] .maxClaimableAmount .add(maxAmount); investors[msg.sender].totalLocked = investors[msg.sender] .totalLocked .add(_amount - depositFee);
investors[msg.sender].maxClaimableAmount = investors[msg.sender] .maxClaimableAmount .add(maxAmount); investors[msg.sender].totalLocked = investors[msg.sender] .totalLocked .add(_amount - depositFee);
354