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
4
// an external function which exposes the internal _verifySigEIP712 method req : request being verified domainSeparator : the domain separator presented to the user when signing sig : the signature generated by the user's wallet /
function verifyEIP712( ERC20ForwardRequest calldata req, bytes32 domainSeparator, bytes calldata sig)
function verifyEIP712( ERC20ForwardRequest calldata req, bytes32 domainSeparator, bytes calldata sig)
2,593
131
// SIP 112: ETH Wrappr The fee for burning sETH and releasing ETH from the EtherWrapper.
function etherWrapperBurnFeeRate() external view returns (uint) { return getEtherWrapperBurnFeeRate(); }
function etherWrapperBurnFeeRate() external view returns (uint) { return getEtherWrapperBurnFeeRate(); }
40,856
9
// Update amount. Defines the divisor used in the mint fee rebalancing update. Example: A value of 20 will increase or decrease the _mintFeeby 5 percent. /
uint private _updateAmt;
uint private _updateAmt;
80,454
145
// burn eToken temporary solution for the not enough etokens to burn problem
if (poolToken.balanceOf(msg.sender) < _amount) { totalAmount = poolToken.balanceOf(msg.sender); } else {
if (poolToken.balanceOf(msg.sender) < _amount) { totalAmount = poolToken.balanceOf(msg.sender); } else {
28,135
31
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; }
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; }
18,005
87
// Internal function for retrieving information about out-of-limits bridge operation. _messageId id of the message that cause above-limits error.return (address of the receiver, amount of coins/tokens in the bridge operation) /
function txAboveLimits(bytes32 _messageId) internal view returns (address recipient, uint256 value) { recipient = addressStorage[keccak256(abi.encodePacked("txOutOfLimitRecipient", _messageId))]; value = uintStorage[keccak256(abi.encodePacked("txOutOfLimitValue", _messageId))]; }
function txAboveLimits(bytes32 _messageId) internal view returns (address recipient, uint256 value) { recipient = addressStorage[keccak256(abi.encodePacked("txOutOfLimitRecipient", _messageId))]; value = uintStorage[keccak256(abi.encodePacked("txOutOfLimitValue", _messageId))]; }
12,356
9
// See {ERC20-balanceOf}. /
function balanceOf(address account) external view returns (uint256) { return _balances[account]; }
function balanceOf(address account) external view returns (uint256) { return _balances[account]; }
24,001
47
// add the bid to the address => cap mapping
self.personalCaps[msg.sender] = _personalCap;
self.personalCaps[msg.sender] = _personalCap;
50,321
135
// returns the conversion fee for a given target amount_targetAmounttarget amount return conversion fee/
function calculateFee(uint256 _targetAmount) internal view returns (uint256) { return _targetAmount.mul(conversionFee).div(PPM_RESOLUTION); }
function calculateFee(uint256 _targetAmount) internal view returns (uint256) { return _targetAmount.mul(conversionFee).div(PPM_RESOLUTION); }
48,722
225
// Auction NFT address[5]: buyer, seller, token, fee, feeAdmin uint256[4]: amount, tokenId, feePercent, feePercentAdmin
function auctionNFT( address[5] memory _tradeAddress, uint256[4] memory _attributes
function auctionNFT( address[5] memory _tradeAddress, uint256[4] memory _attributes
47,297
227
// Compound based on pending rewards /
function harvestAndCompound() external nonReentrant { // Update pool information _updatePool(); // Calculate pending rewards uint256 pendingRewards = ((userInfo[msg.sender].amount * accTokenPerShare) / PRECISION_FACTOR) - userInfo[msg.sender].rewardDebt; // Return if no pending rewards if (pendingRewards == 0) { // It doesn't throw revertion (to help with the fee-sharing auto-compounding contract) return; } // Adjust user amount for pending rewards userInfo[msg.sender].amount += pendingRewards; // Adjust totalAmountStaked totalAmountStaked += pendingRewards; // Recalculate reward debt based on new user amount userInfo[msg.sender].rewardDebt = (userInfo[msg.sender].amount * accTokenPerShare) / PRECISION_FACTOR; emit Compound(msg.sender, pendingRewards); }
function harvestAndCompound() external nonReentrant { // Update pool information _updatePool(); // Calculate pending rewards uint256 pendingRewards = ((userInfo[msg.sender].amount * accTokenPerShare) / PRECISION_FACTOR) - userInfo[msg.sender].rewardDebt; // Return if no pending rewards if (pendingRewards == 0) { // It doesn't throw revertion (to help with the fee-sharing auto-compounding contract) return; } // Adjust user amount for pending rewards userInfo[msg.sender].amount += pendingRewards; // Adjust totalAmountStaked totalAmountStaked += pendingRewards; // Recalculate reward debt based on new user amount userInfo[msg.sender].rewardDebt = (userInfo[msg.sender].amount * accTokenPerShare) / PRECISION_FACTOR; emit Compound(msg.sender, pendingRewards); }
52,867
279
// The address that submitted the proposal
address source;
address source;
66,602
262
// e.g. (1e201e18) / 1e18 = 1e20 e.g. (1e201e18) / 14e17 = 7.1429e19 e.g. 11e18 / 1e17 + 1 = 11 => 111e17 / 1e18 = 1.1e18 / 1e18 = 1
exchangeRate_ = exchangeRate; credits = _underlying.divPrecisely(exchangeRate_).add(1);
exchangeRate_ = exchangeRate; credits = _underlying.divPrecisely(exchangeRate_).add(1);
10,445
5
// starts a new round when current round has ended
if (block.number > rounds[round].endBlock) { round += 1; rounds[round].endBlock = block.number + duration; rounds[round].drawBlock = block.number + duration + 5; }
if (block.number > rounds[round].endBlock) { round += 1; rounds[round].endBlock = block.number + duration; rounds[round].drawBlock = block.number + duration + 5; }
12,273
199
// Grants the verified minter role to an address The sender must have the admin role _address EOA or contract receiving the new role /
function addVerifiedMinterRole(address _address) external { grantRole(VERIFIED_MINTER_ROLE, _address); emit VerifiedMinterRoleGranted(_address, _msgSender()); }
function addVerifiedMinterRole(address _address) external { grantRole(VERIFIED_MINTER_ROLE, _address); emit VerifiedMinterRoleGranted(_address, _msgSender()); }
70,216
146
// We checked withdrawAmount <= totalFuseFees above, so this should never revert.
totalFuseFeesNew = sub_(totalFuseFees, withdrawAmount);
totalFuseFeesNew = sub_(totalFuseFees, withdrawAmount);
8,491
9
// Converts USD value of a token into token amount with acurrent price. The order of the argument _usdValue is 1E18. /
function getTokensFromUSD( address _tokenAddress, uint256 _usdValue ) external view returns (uint256)
function getTokensFromUSD( address _tokenAddress, uint256 _usdValue ) external view returns (uint256)
37,688
5
// Original code sourced from OpenZeppelinCountersProvides counters that can only be incremented or decremented by one Include with `using Counters for Counters.Counter;` Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the SafeMath overflow check, thereby saving gas/
library Counters { using SafeMath for uint256; struct Counter { //This variable should never be directly accessed by users of the library: interactions must be restricted to //the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add //this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; //default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } }
library Counters { using SafeMath for uint256; struct Counter { //This variable should never be directly accessed by users of the library: interactions must be restricted to //the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add //this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; //default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } }
36,637
47
// All ETH received from the bids
uint256 public received_wei; uint256 public received_wei_with_bonus;
uint256 public received_wei; uint256 public received_wei_with_bonus;
43,640
143
// Pixel block x coordinate
uint256 x;
uint256 x;
20,049
472
// Creates a new pool if it does not exist, then initializes if not initialized/This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool/token0 The contract address of token0 of the pool/token1 The contract address of token1 of the pool/fee The fee amount of the v3 pool for the specified token pair/sqrtPriceX96 The initial square root price of the pool as a Q64.96 value/ return pool Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessary
function createAndInitializePoolIfNecessary( address token0, address token1, uint24 fee, uint160 sqrtPriceX96 ) external payable returns (address pool);
function createAndInitializePoolIfNecessary( address token0, address token1, uint24 fee, uint160 sqrtPriceX96 ) external payable returns (address pool);
3,441
84
// Director - 5
setFeeDistributionAndStatusThreshold(5, [350, 210, 140, 70, 40], thresholds[5]);
setFeeDistributionAndStatusThreshold(5, [350, 210, 140, 70, 40], thresholds[5]);
72,138
982
// Add liquidity to a market, assuming that it is initialized. If not then/ this method will revert and the market must be initialized first./ Return liquidityTokens and negative fCash to the portfolio
function addLiquidity(MarketParameters memory market, int256 assetCash) internal returns (int256 liquidityTokens, int256 fCash)
function addLiquidity(MarketParameters memory market, int256 assetCash) internal returns (int256 liquidityTokens, int256 fCash)
35,763
30
// Address where rewards are sent for successful relays and sends /
address payable rewardAddress;
address payable rewardAddress;
12,733
3
// No need to use checked arithmetic for the amp precision, the amp is guaranteed to be at least 1
Math.div(Math.mul(ampTimesTotal - _AMP_PRECISION, P_D), _AMP_PRECISION, !roundUp) ), roundUp ); if (invariant > prevInvariant) { if (invariant - prevInvariant <= 1) { return invariant; }
Math.div(Math.mul(ampTimesTotal - _AMP_PRECISION, P_D), _AMP_PRECISION, !roundUp) ), roundUp ); if (invariant > prevInvariant) { if (invariant - prevInvariant <= 1) { return invariant; }
44,404
11
// Too many presale for address
error Presale_TooManyForAddress();
error Presale_TooManyForAddress();
27,456
220
// Returns whether the module is in a pending state /
function isPendingModule(address _module) external view returns (bool) { return moduleStates[_module] == ISetToken.ModuleState.PENDING; }
function isPendingModule(address _module) external view returns (bool) { return moduleStates[_module] == ISetToken.ModuleState.PENDING; }
21,956
48
// query support of each interface in interfaceIds
for (uint256 i = 0; i < interfaceIds.length; i++) { interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]); }
for (uint256 i = 0; i < interfaceIds.length; i++) { interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]); }
2,058
77
// Offboard BAT-A https:vote.makerdao.com/polling/QmWJfX8U?network=mainnetvote-breakdown
(,,,line,) = vat.ilks("BAT-A"); totalLineReduction = _add(totalLineReduction, line); DssExecLib.setIlkLiquidationPenalty("BAT-A", 0); DssExecLib.removeIlkFromAutoLine("BAT-A"); DssExecLib.setIlkDebtCeiling("BAT-A", 0); DssExecLib.linearInterpolation({ _name: "BAT Offboarding", _target: DssExecLib.spotter(), _ilk: "BAT-A",
(,,,line,) = vat.ilks("BAT-A"); totalLineReduction = _add(totalLineReduction, line); DssExecLib.setIlkLiquidationPenalty("BAT-A", 0); DssExecLib.removeIlkFromAutoLine("BAT-A"); DssExecLib.setIlkDebtCeiling("BAT-A", 0); DssExecLib.linearInterpolation({ _name: "BAT Offboarding", _target: DssExecLib.spotter(), _ilk: "BAT-A",
69,290
47
// totalSupply -= _value; Update totalSupply
_totalSupply = sub(_totalSupply, _value); Burn(_from, _value); return true;
_totalSupply = sub(_totalSupply, _value); Burn(_from, _value); return true;
22,882
1
// Largest positive values that can be represented as N bits signed integers.
int256 private constant _MAX_INT_22 = 2**(21) - 1; int256 private constant _MAX_INT_53 = 2**(52) - 1;
int256 private constant _MAX_INT_22 = 2**(21) - 1; int256 private constant _MAX_INT_53 = 2**(52) - 1;
21,915
115
// Set the creator payout address.
_creatorPayoutAddresses[msg.sender] = payoutAddress;
_creatorPayoutAddresses[msg.sender] = payoutAddress;
32,107
67
// The account bundles of locked tokens grouped by release date
mapping (uint8 => AccountsBundle) public bundles;
mapping (uint8 => AccountsBundle) public bundles;
71,534
22
// Allows a graph account update the metadata of a subgraph they have published _graphAccount Account that owns the subgraph _subgraphNumber Subgraph number _subgraphMetadata IPFS hash for the subgraph metadata /
function updateSubgraphMetadata( address _graphAccount, uint256 _subgraphNumber, bytes32 _subgraphMetadata
function updateSubgraphMetadata( address _graphAccount, uint256 _subgraphNumber, bytes32 _subgraphMetadata
31,284
1
// This can be called by owner(`CommitteeGovernance`) to remove a transaction filter /
function _removeTransactionFilter(address filter) internal { for (uint256 i; i < transactionFilters.length; i++) { if (transactionFilters[i] == filter) { transactionFilters[i] = transactionFilters[transactionFilters.length - 1]; transactionFilters.pop(); emit RemoveTransactionFilter(filter); return; } } revert("DAOKIT: INVALID_FILTER"); }
function _removeTransactionFilter(address filter) internal { for (uint256 i; i < transactionFilters.length; i++) { if (transactionFilters[i] == filter) { transactionFilters[i] = transactionFilters[transactionFilters.length - 1]; transactionFilters.pop(); emit RemoveTransactionFilter(filter); return; } } revert("DAOKIT: INVALID_FILTER"); }
19,102
39
// Haircut value of nToken holdings denominated in asset cash, will be local or collateral nTokens based on liquidation type
int256 nTokenHaircutAssetValue;
int256 nTokenHaircutAssetValue;
32,966
6
// 供应商
struct Supplier { bytes32 id; bytes32[] idOfBills; bytes32[] idOfRecepits; string name; }
struct Supplier { bytes32 id; bytes32[] idOfBills; bytes32[] idOfRecepits; string name; }
21,105
105
// fire.transfer(address(charcoal), fireReward);
pool.accFirePerShare = pool.accFirePerShare.add(fireReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number;
pool.accFirePerShare = pool.accFirePerShare.add(fireReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number;
36,512
0
// Make the Constructor "payable"
constructor() public payable { owner = msg.sender; }
constructor() public payable { owner = msg.sender; }
40,590
224
// if the both APIs confirm the same winner then payout the winners
if (pendingWinner[matchId] == matchResult) { mtch.winner = matchResult; emit MatchUpdated(matchId); } else {
if (pendingWinner[matchId] == matchResult) { mtch.winner = matchResult; emit MatchUpdated(matchId); } else {
78,458
0
// data structure to hold information about campaign contributors /
struct Funder { address addr; uint amount; }
struct Funder { address addr; uint amount; }
1,070
220
// Returns contract owner. Set to deployer's address by default oncontract deployment.return address Address of contract owner. owner role was called `admin` prior to V3 core contract /
function owner() public view override(Ownable, IGenArt721CoreContractV3_Base) returns (address)
function owner() public view override(Ownable, IGenArt721CoreContractV3_Base) returns (address)
33,213
23
// Increase unique signer counter
uniqueSignerCountForDataFeedIds[dataFeedIdIndex]++;
uniqueSignerCountForDataFeedIds[dataFeedIdIndex]++;
29,181
60
// Burn `amount` tokens and decreasing the total supply. /
function burn(uint256 amount) public returns (bool) { _burn(_msgSender(), amount); return true; }
function burn(uint256 amount) public returns (bool) { _burn(_msgSender(), amount); return true; }
7,394
242
// transfer ownership we need to call a transferFrom from this contract, which is the one with permission to sell the NFT
callOptionalReturn(this, abi.encodeWithSelector(this.safeTransferFrom.selector, openSales[tokenId][index].user, _msgSender(), tokenId, qty, "0x"));
callOptionalReturn(this, abi.encodeWithSelector(this.safeTransferFrom.selector, openSales[tokenId][index].user, _msgSender(), tokenId, qty, "0x"));
5,999
149
// Increment total owned area
var (area,,) = BdpCalculator.calculateArea(_contracts, _tokenId); ownStorage.incrementOwnedArea(_to, area);
var (area,,) = BdpCalculator.calculateArea(_contracts, _tokenId); ownStorage.incrementOwnedArea(_to, area);
7,151
964
// Redeem Constructor/approves max uint256 on creation for the toToken against the staking contract/_fromToken the token users will convert from/_toToken the token users will convert to/_stakingContract the staking contract/_expirationBlock a block number at which the owner can withdraw the full balance of toToken
constructor( address _fromToken, address _toToken, address _stakingContract, uint256 _expirationBlock, uint256 _stakingSchedule
constructor( address _fromToken, address _toToken, address _stakingContract, uint256 _expirationBlock, uint256 _stakingSchedule
19,606
18
// Submits a reference to evidence. EVENT._localDisputeID The dispute ID defined by the arbitrable contract._evidenceGroupID ID of the evidence group the evidence belongs to. It must match the one used in createDispute()._evidence A link to evidence using its URI. /
function submitEvidence( ArbitrableStorage storage self, uint256 _localDisputeID, uint256 _evidenceGroupID, string memory _evidence
function submitEvidence( ArbitrableStorage storage self, uint256 _localDisputeID, uint256 _evidenceGroupID, string memory _evidence
37,851
43
// Allowlist Merkle DataCredit for Merkle setup code: Cobble /
function getLeaf(address addr, uint256 amount, bool waitlist) public pure returns(bytes32) { return keccak256(abi.encodePacked(addr, amount, waitlist)); }
function getLeaf(address addr, uint256 amount, bool waitlist) public pure returns(bytes32) { return keccak256(abi.encodePacked(addr, amount, waitlist)); }
15,121
30
// shutdown the contract.
function shutdown() external onlyOwner { isShutdown = true; }
function shutdown() external onlyOwner { isShutdown = true; }
20,474
45
// Check if provided calldata matches the hash stored in dataStoreIDsForDuration in initDataStore verify consistency of signed data with stored data
bytes32 dsHash = DataStoreUtils.computeDataStoreHash(searchData.metadata); require( dataStoreHashesForDurationAtTimestamp[searchData.duration][searchData.timestamp][searchData.index] == dsHash, "DataLayrServiceManager.confirmDataStore: provided calldata does not match corresponding stored hash from initDataStore" );
bytes32 dsHash = DataStoreUtils.computeDataStoreHash(searchData.metadata); require( dataStoreHashesForDurationAtTimestamp[searchData.duration][searchData.timestamp][searchData.index] == dsHash, "DataLayrServiceManager.confirmDataStore: provided calldata does not match corresponding stored hash from initDataStore" );
38,783
20
// Contract which holds Kine MCD
IKMCD public kMCD;
IKMCD public kMCD;
4,643
13
// Secondary A Secondary contract can only be used by its primary account (the one that created it) /
contract Secondary { address private _primary; event PrimaryTransferred( address recipient ); /** * @dev Sets the primary account to the one that is creating the Secondary contract. */ constructor () internal { _primary = msg.sender; emit PrimaryTransferred(_primary); } /** * @dev Reverts if called from any account other than the primary. */ modifier onlyPrimary() { require(msg.sender == _primary); _; } /** * @return the address of the primary. */ function primary() public view returns (address) { return _primary; } /** * @dev Transfers contract to a new primary. * @param recipient The address of new primary. */ function transferPrimary(address recipient) public onlyPrimary { require(recipient != address(0)); _primary = recipient; emit PrimaryTransferred(_primary); } }
contract Secondary { address private _primary; event PrimaryTransferred( address recipient ); /** * @dev Sets the primary account to the one that is creating the Secondary contract. */ constructor () internal { _primary = msg.sender; emit PrimaryTransferred(_primary); } /** * @dev Reverts if called from any account other than the primary. */ modifier onlyPrimary() { require(msg.sender == _primary); _; } /** * @return the address of the primary. */ function primary() public view returns (address) { return _primary; } /** * @dev Transfers contract to a new primary. * @param recipient The address of new primary. */ function transferPrimary(address recipient) public onlyPrimary { require(recipient != address(0)); _primary = recipient; emit PrimaryTransferred(_primary); } }
27,373
17
// Setter for nfts contract/nftContract_ the contract containing the registry
function setNFTContract(address nftContract_) external onlyOwner { nftContract = nftContract_; }
function setNFTContract(address nftContract_) external onlyOwner { nftContract = nftContract_; }
20,795
84
// distribute pool share (thats what updateMasks() does) and adjust balances for dust.
uint256 _dust = updateMasks(_rID, addr, pool, _keys); emit onUpdateMask(_rID, addr, eth, _keys, _dust);
uint256 _dust = updateMasks(_rID, addr, pool, _keys); emit onUpdateMask(_rID, addr, eth, _keys, _dust);
977
37
// View Functions
function GetOpenPools() public view returns (uint256[] memory){ return OpenPools; }
function GetOpenPools() public view returns (uint256[] memory){ return OpenPools; }
25,786
91
// Number of transfer to execute
uint256 nTransfer = _ids.length;
uint256 nTransfer = _ids.length;
25,585
7
// auction variables (packed)
uint256 public oasisPrice; // oasis allowlist price uint256 public allowListPrice; // The allowlist price uint256 public minimumBid; // The minimum price accepted in an auction uint256 public minBidIncrement; // The minimum amount by which a bid must exceed the current highest bid uint256 public publicPrice; // public price uint256 public publicSaleMintMax; // max number of tokens per public sale mint
uint256 public oasisPrice; // oasis allowlist price uint256 public allowListPrice; // The allowlist price uint256 public minimumBid; // The minimum price accepted in an auction uint256 public minBidIncrement; // The minimum amount by which a bid must exceed the current highest bid uint256 public publicPrice; // public price uint256 public publicSaleMintMax; // max number of tokens per public sale mint
17,124
97
// ForcedExit pubdata
struct ForcedExit { //uint8 opType; -- present in pubdata, ignored at serialization //uint32 initiatorAccountId; -- present in pubdata, ignored at serialization //uint32 targetAccountId; -- present in pubdata, ignored at serialization uint16 tokenId; uint128 amount; //uint16 fee; -- present in pubdata, ignored at serialization address target; }
struct ForcedExit { //uint8 opType; -- present in pubdata, ignored at serialization //uint32 initiatorAccountId; -- present in pubdata, ignored at serialization //uint32 targetAccountId; -- present in pubdata, ignored at serialization uint16 tokenId; uint128 amount; //uint16 fee; -- present in pubdata, ignored at serialization address target; }
24,948
30
// We rely on overflow behavior here
absoluteResult = powu (uint256 (uint128 (-x)) << 63, y); negativeResult = y & 1 > 0;
absoluteResult = powu (uint256 (uint128 (-x)) << 63, y); negativeResult = y & 1 > 0;
55,185
15
// function for a participant to havest rewards from staking Tellor Lottery tokens
function harvest() public returns(bool _success){ if(participantStake[msg.sender].poolNumber > 0 && participantStake[msg.sender].poolNumber != currentPoolNumber){ uint32 i; for(i = participantStake[msg.sender].poolNumber; i < currentPoolNumber; i++){ tellor.transfer(msg.sender, ((participantStake[msg.sender].amount * (10 ** 18)).div(lottoPools[i].totalStaked) * lottoPools[i].totalValue) / 10 ** 18); } participantStake[msg.sender].poolNumber = currentPoolNumber; return true; } return false; }
function harvest() public returns(bool _success){ if(participantStake[msg.sender].poolNumber > 0 && participantStake[msg.sender].poolNumber != currentPoolNumber){ uint32 i; for(i = participantStake[msg.sender].poolNumber; i < currentPoolNumber; i++){ tellor.transfer(msg.sender, ((participantStake[msg.sender].amount * (10 ** 18)).div(lottoPools[i].totalStaked) * lottoPools[i].totalValue) / 10 ** 18); } participantStake[msg.sender].poolNumber = currentPoolNumber; return true; } return false; }
4,697
142
// the ongoing operations.
mapping(bytes32 => MultiOwnedOperationPendingState) internal m_multiOwnedPending; bytes32[] internal m_multiOwnedPendingIndex;
mapping(bytes32 => MultiOwnedOperationPendingState) internal m_multiOwnedPending; bytes32[] internal m_multiOwnedPendingIndex;
16,899
1
// Number of decimals needed to get to 18
uint256 private immutable missing_decimals;
uint256 private immutable missing_decimals;
18,645
31
// Team wallet - 12500000 tokens 0 tokens free, 12500000 tokens locked - progressive release of 5% every 30 days (after 180 days of waiting period)address team = 0xf1D3cE2B941CDb7b6F61394a41F04C24E738D3A5;address team = 0x78D921F8D3410583A573D87A9257cb15efe11C01;for tests
address team = 0xc9329F122f8B6d086b1531bc074936367b3e647B; // for Ropsten balances[team] = 12500000 ether; timeLocks[team] = TimeLock(12500000 ether, 12500000 ether, uint128(lockStartDate + (180 days)), 30 days, 625000); emit Transfer(address(0x0), team, balances[team]);
address team = 0xc9329F122f8B6d086b1531bc074936367b3e647B; // for Ropsten balances[team] = 12500000 ether; timeLocks[team] = TimeLock(12500000 ether, 12500000 ether, uint128(lockStartDate + (180 days)), 30 days, 625000); emit Transfer(address(0x0), team, balances[team]);
35,556
26
// function to restrict access to only AdminACL or the artist
function _onlyCoreAdminACLOrArtist( uint256 _projectId, bytes4 _selector
function _onlyCoreAdminACLOrArtist( uint256 _projectId, bytes4 _selector
37,749
17
// now has built in overflow checking.NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler Wrappers over Solidity's arithmetic operations./
library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * _Available since v3.4._ * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * _Available since v3.4._ * * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * _Available since v3.4._ * @dev Returns the division of two unsigned integers, with a division by zero flag. * */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * _Available since v3.4._ * * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * - Addition cannot overflow. * */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * Requirements: * * Counterpart to Solidity's `-` operator. * overflow (when the result is negative). * @dev Returns the subtraction of two unsigned integers, reverting on * - Subtraction cannot overflow. * * */ /** * Requirements: * * * @dev Returns the multiplication of two unsigned integers, reverting on * * overflow. * Counterpart to Solidity's `*` operator. * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * * Requirements: * @dev Returns the integer division of two unsigned integers, reverting on * * division by zero. The result is rounded towards zero. * * - The divisor cannot be zero. * Counterpart to Solidity's `/` operator. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * Requirements: * * opcode (which leaves remaining gas untouched) while Solidity uses an * - The divisor cannot be zero. * * * reverting when dividing by zero. * Counterpart to Solidity's `%` operator. This function uses a `revert` * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * invalid opcode to revert (consuming all remaining gas). */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * - Subtraction cannot overflow. * * * * message unnecessarily. For custom revert reasons use {trySub}. * Counterpart to Solidity's `-` operator. * Requirements: * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * Requirements: * @dev Returns the integer division of two unsigned integers, reverting with custom message on * * division by zero. The result is rounded towards zero. * - The divisor cannot be zero. * uses an invalid opcode to revert (consuming all remaining gas). * `revert` opcode (which leaves remaining gas untouched) while Solidity * * * Counterpart to Solidity's `/` operator. Note: this function uses a */ /** * CAUTION: This function is deprecated because it requires allocating memory for the error * invalid opcode to revert (consuming all remaining gas). * Counterpart to Solidity's `%` operator. This function uses a `revert` * message unnecessarily. For custom revert reasons use {tryMod}. * * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * * - The divisor cannot be zero. * reverting with custom message when dividing by zero. * opcode (which leaves remaining gas untouched) while Solidity uses an * * * Requirements: */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * _Available since v3.4._ * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * _Available since v3.4._ * * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * _Available since v3.4._ * @dev Returns the division of two unsigned integers, with a division by zero flag. * */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * _Available since v3.4._ * * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * - Addition cannot overflow. * */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * Requirements: * * Counterpart to Solidity's `-` operator. * overflow (when the result is negative). * @dev Returns the subtraction of two unsigned integers, reverting on * - Subtraction cannot overflow. * * */ /** * Requirements: * * * @dev Returns the multiplication of two unsigned integers, reverting on * * overflow. * Counterpart to Solidity's `*` operator. * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * * Requirements: * @dev Returns the integer division of two unsigned integers, reverting on * * division by zero. The result is rounded towards zero. * * - The divisor cannot be zero. * Counterpart to Solidity's `/` operator. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * Requirements: * * opcode (which leaves remaining gas untouched) while Solidity uses an * - The divisor cannot be zero. * * * reverting when dividing by zero. * Counterpart to Solidity's `%` operator. This function uses a `revert` * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * invalid opcode to revert (consuming all remaining gas). */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * - Subtraction cannot overflow. * * * * message unnecessarily. For custom revert reasons use {trySub}. * Counterpart to Solidity's `-` operator. * Requirements: * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * Requirements: * @dev Returns the integer division of two unsigned integers, reverting with custom message on * * division by zero. The result is rounded towards zero. * - The divisor cannot be zero. * uses an invalid opcode to revert (consuming all remaining gas). * `revert` opcode (which leaves remaining gas untouched) while Solidity * * * Counterpart to Solidity's `/` operator. Note: this function uses a */ /** * CAUTION: This function is deprecated because it requires allocating memory for the error * invalid opcode to revert (consuming all remaining gas). * Counterpart to Solidity's `%` operator. This function uses a `revert` * message unnecessarily. For custom revert reasons use {tryMod}. * * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * * - The divisor cannot be zero. * reverting with custom message when dividing by zero. * opcode (which leaves remaining gas untouched) while Solidity uses an * * * Requirements: */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
13,458
57
// Returns votes count that can be received by group through stCELO protocol. group The group that can receive votes.return The amount of CELO that can be received by group though stCELO protocol. /
function getReceivableVotesForGroup(address group) public view returns (uint256) { uint256 receivableVotes = getActualReceivableVotes(group); if (receivableVotes == 0) { return 0; } uint256 totalVotesForGroupByAccount = getElection().getTotalVotesForGroupByAccount( group, address(account) ); uint256 votesForGroupByAccountInProtocol = account.getCeloForGroup(group); receivableVotes += totalVotesForGroupByAccount; if (receivableVotes < votesForGroupByAccountInProtocol) { return 0; } return receivableVotes - votesForGroupByAccountInProtocol; }
function getReceivableVotesForGroup(address group) public view returns (uint256) { uint256 receivableVotes = getActualReceivableVotes(group); if (receivableVotes == 0) { return 0; } uint256 totalVotesForGroupByAccount = getElection().getTotalVotesForGroupByAccount( group, address(account) ); uint256 votesForGroupByAccountInProtocol = account.getCeloForGroup(group); receivableVotes += totalVotesForGroupByAccount; if (receivableVotes < votesForGroupByAccountInProtocol) { return 0; } return receivableVotes - votesForGroupByAccountInProtocol; }
17,975
57
// can safely be called by anyone at anytime
function setupChai() public
function setupChai() public
14,890
41
// return the name of the token. /
function name() public view returns(string) { return _name; }
function name() public view returns(string) { return _name; }
1,588
11
// Cancels an auction when the contract is paused./Only the owner may do this, and NFTs are returned to/the seller. This should only be used in emergencies./_tokenId - ID of the NFT on auction to cancel.
function cancelAuctionWhenPaused(uint256 _tokenId) external whenPaused onlyOwner
function cancelAuctionWhenPaused(uint256 _tokenId) external whenPaused onlyOwner
25,810
125
// Transfer assets to contract
totalstakings[assetAdd] = totalstakings[assetAdd].add(value); IERC20Swap(assetAdd).swapTransfer(msg.sender, address(this), value); emit Stake(assetAdd, value);
totalstakings[assetAdd] = totalstakings[assetAdd].add(value); IERC20Swap(assetAdd).swapTransfer(msg.sender, address(this), value); emit Stake(assetAdd, value);
13,511
7
// Get the temperature of the city currently stored in the contract /
function getCurrentTemp() external view returns (uint) { return tempResult; }
function getCurrentTemp() external view returns (uint) { return tempResult; }
50,643
19
// Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down.x signed 64.64-bit fixed point number y signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number /
function avg (int128 x, int128 y) internal pure returns (int128) { unchecked { return int128 ((int256 (x) + int256 (y)) >> 1); } }
function avg (int128 x, int128 y) internal pure returns (int128) { unchecked { return int128 ((int256 (x) + int256 (y)) >> 1); } }
14,829
15
// Methods for fee management
function getChainId() external view returns(uint256); function getStableAssetLiquidity(address router) external view returns(uint256, uint256); function getTokenPrice(address asset) external view returns(uint256, uint256);
function getChainId() external view returns(uint256); function getStableAssetLiquidity(address router) external view returns(uint256, uint256); function getTokenPrice(address asset) external view returns(uint256, uint256);
15,629
112
// bonus time
uint256 bonusTimeToken = tokens.mul(getTimeBonus())/100;
uint256 bonusTimeToken = tokens.mul(getTimeBonus())/100;
814
2
// bps - basic rate steps. one step is 1 / 10000 of the rate.
struct StepFunction { int[] x; // quantity for each step. Quantity of each step includes previous steps. int[] y; // rate change per quantity step in bps. }
struct StepFunction { int[] x; // quantity for each step. Quantity of each step includes previous steps. int[] y; // rate change per quantity step in bps. }
13,185
138
// See {IERC1155721Inventory-transferFrom(address,address,uint256)}. /
function transferFrom( address from, address to, uint256 nftId ) public virtual override { _transferFrom( from, to, nftId, "",
function transferFrom( address from, address to, uint256 nftId ) public virtual override { _transferFrom( from, to, nftId, "",
19,132
500
// eTaco tokens created in first block.
uint256 public rewardPerBlock;
uint256 public rewardPerBlock;
43,692
80
// Casts vote/_proposalId Proposal id/_solutionChosen solution chosen while voting. _solutionChosen[0] is the chosen solution
function submitVote(uint _proposalId, uint _solutionChosen) external; function closeProposal(uint _proposalId) external; function claimReward(address _memberAddress, uint _maxRecords) external returns(uint pendingDAppReward); function proposal(uint _proposalId) external view returns(
function submitVote(uint _proposalId, uint _solutionChosen) external; function closeProposal(uint _proposalId) external; function claimReward(address _memberAddress, uint _maxRecords) external returns(uint pendingDAppReward); function proposal(uint _proposalId) external view returns(
33,234
688
// the Uniswap router contract/ return the IUniswapV2Router02 router implementation address
function router() external view returns(IUniswapV2Router02);
function router() external view returns(IUniswapV2Router02);
39,702
19
// set decimals /
decimal = 0;
decimal = 0;
8,161
5
// Thrown if the caller is not the Moonbird owner. /
error OnlyMoonbirdOwner();
error OnlyMoonbirdOwner();
17,123
40
// outperforming
crowdFundStamp[crowdFundInitiator] = 0; crowdFundReward = crowdFundAmount[crowdFundInitiator]*(105+(bonusReturn[bonusRoll]/10))/100;
crowdFundStamp[crowdFundInitiator] = 0; crowdFundReward = crowdFundAmount[crowdFundInitiator]*(105+(bonusReturn[bonusRoll]/10))/100;
16,022
436
// Revert with a standard message if `account` is missing `role`. The format of the revert reason is given by the following regular expression:
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } }
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } }
19,273
9
// Creates a Pancake Pair
_pancakePairAddress = IPancakeFactory(_pancakeRouter.factory()).createPair(address(this), _pancakeRouter.WETH()); isAMM[_pancakePairAddress]=true;
_pancakePairAddress = IPancakeFactory(_pancakeRouter.factory()).createPair(address(this), _pancakeRouter.WETH()); isAMM[_pancakePairAddress]=true;
29,036
42
// icoStartBlock should be around block number 5,709,200 = June 1st 2018
icoStartBlock = startBlockInput;
icoStartBlock = startBlockInput;
39,709
7
// ========== VIEWS ========== // Returns the amount a user can claim at a given point in time. Requirements:- the vesting period has started /
function getClaim(address _vester) external view override hasStarted returns (uint256 vestedAmount)
function getClaim(address _vester) external view override hasStarted returns (uint256 vestedAmount)
39,673
38
// Liquidity generation logic/ Steps - All tokens tat will ever exist go to this contract / This contract accepts ETH as payable/ ETH is mapped to people/ When liquidity generationevent is over veryone can call / the mint LP function which will put all the ETH and tokens inside the uniswap contract/ without any involvement/ This LP will go into this contract/ And will be able to proportionally be withdrawn baed on ETH put in/ A emergency drain function allows the contract owner to drain all ETH and tokens from this contract/ After the liquidity generation event happened. In case
string public liquidityGenerationParticipationAgreement = "I'm not a resident of the United States \n I understand that this contract is provided with no warranty of any kind. \n I agree to not hold the contract creators, TSLA team members or anyone associated with this event liable for any damage monetary and otherwise I might onccur. \n I understand that any smart contract interaction carries an inherent risk.";
string public liquidityGenerationParticipationAgreement = "I'm not a resident of the United States \n I understand that this contract is provided with no warranty of any kind. \n I agree to not hold the contract creators, TSLA team members or anyone associated with this event liable for any damage monetary and otherwise I might onccur. \n I understand that any smart contract interaction carries an inherent risk.";
55,096
227
// NOTE: there is no check that variable sizes are same as constants (i.e. TOKEN_BYTES), fix if possible.
uint256 offset = OP_TYPE_BYTES; (offset, parsed.accountId) = Bytes.readUInt32(_data, offset); // accountId (offset, parsed.tokenId) = Bytes.readUInt16(_data, offset); // tokenId (offset, parsed.amount) = Bytes.readUInt128(_data, offset); // amount (offset, parsed.owner) = Bytes.readAddress(_data, offset); // owner (offset, parsed.pairAccountId) = Bytes.readUInt32(_data, offset); // pairAccountId require(offset == PACKED_DEPOSIT_PUBDATA_BYTES, "N"); // reading invalid deposit pubdata size
uint256 offset = OP_TYPE_BYTES; (offset, parsed.accountId) = Bytes.readUInt32(_data, offset); // accountId (offset, parsed.tokenId) = Bytes.readUInt16(_data, offset); // tokenId (offset, parsed.amount) = Bytes.readUInt128(_data, offset); // amount (offset, parsed.owner) = Bytes.readAddress(_data, offset); // owner (offset, parsed.pairAccountId) = Bytes.readUInt32(_data, offset); // pairAccountId require(offset == PACKED_DEPOSIT_PUBDATA_BYTES, "N"); // reading invalid deposit pubdata size
16,111
39
// Append userAddress and relayer address at the end to extract it from calling context
(bool success, bytes memory returnData) = address(this).call( abi.encodePacked(functionSignature, userAddress) ); require(success, "Function call not successful"); return returnData;
(bool success, bytes memory returnData) = address(this).call( abi.encodePacked(functionSignature, userAddress) ); require(success, "Function call not successful"); return returnData;
322
171
// internal
function _baseURI() internal view virtual override returns (string memory) { return baseURI; }
function _baseURI() internal view virtual override returns (string memory) { return baseURI; }
1,327
48
// Throws if called by any account other than the owner./
modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; }
modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; }
1,580
87
// Address of Opium contract set deployer
address public initializer;
address public initializer;
34,227
44
// Function to register evolve path
function addEvolvePath( address from_address, address to_address, bool burn_original, address fee_contract, uint256 evolve_fee
function addEvolvePath( address from_address, address to_address, bool burn_original, address fee_contract, uint256 evolve_fee
1,458
17
// stackingBoostAtTs calculates the multiplier at a given timestamp based on the user's stake a the given timestamp
function stackingBoostAtTs(address user, uint256 timestamp) external view returns (uint256);
function stackingBoostAtTs(address user, uint256 timestamp) external view returns (uint256);
25,327
4
// The user can set the lock status and choose to use either esLBR or LBR. id The ID of the lock setting. lbrAmount The amount of LBR to be locked. useLBR A flag indicating whether to use LBR or not. /
function setLockStatus(uint256 id, uint256 lbrAmount, bool useLBR) external { require(id < esLBRLockSettings.length, "Invalid lock setting ID"); esLBRLockSetting memory _setting = esLBRLockSettings[id]; LockStatus memory userStatus = userLockStatus[msg.sender]; if (userStatus.unlockTime > block.timestamp) { require(userStatus.duration <= _setting.duration, "Your lock-in period has not ended, and the term can only be extended, not reduced."); } if(useLBR) { IesLBR(miningIncentives.LBR()).burn(msg.sender, lbrAmount); IesLBR(miningIncentives.esLBR()).mint(msg.sender, lbrAmount); emit StakeLBR(msg.sender, lbrAmount, block.timestamp); } require(IesLBR(miningIncentives.esLBR()).balanceOf(msg.sender) >= userStatus.lockAmount + lbrAmount, "IB"); miningIncentives.refreshReward(msg.sender); userLockStatus[msg.sender] = LockStatus(userStatus.lockAmount + lbrAmount, block.timestamp + _setting.duration, _setting.duration, _setting.miningBoost); emit UserLockStatus(msg.sender, userLockStatus[msg.sender].lockAmount, userLockStatus[msg.sender].duration, _setting.duration, _setting.miningBoost); }
function setLockStatus(uint256 id, uint256 lbrAmount, bool useLBR) external { require(id < esLBRLockSettings.length, "Invalid lock setting ID"); esLBRLockSetting memory _setting = esLBRLockSettings[id]; LockStatus memory userStatus = userLockStatus[msg.sender]; if (userStatus.unlockTime > block.timestamp) { require(userStatus.duration <= _setting.duration, "Your lock-in period has not ended, and the term can only be extended, not reduced."); } if(useLBR) { IesLBR(miningIncentives.LBR()).burn(msg.sender, lbrAmount); IesLBR(miningIncentives.esLBR()).mint(msg.sender, lbrAmount); emit StakeLBR(msg.sender, lbrAmount, block.timestamp); } require(IesLBR(miningIncentives.esLBR()).balanceOf(msg.sender) >= userStatus.lockAmount + lbrAmount, "IB"); miningIncentives.refreshReward(msg.sender); userLockStatus[msg.sender] = LockStatus(userStatus.lockAmount + lbrAmount, block.timestamp + _setting.duration, _setting.duration, _setting.miningBoost); emit UserLockStatus(msg.sender, userLockStatus[msg.sender].lockAmount, userLockStatus[msg.sender].duration, _setting.duration, _setting.miningBoost); }
40,564
145
// Updates the rewards token. /
function setRewardToken(address _rewardToken) public { require(msg.sender == governance, "not governance"); require(_rewardToken != address(0x0), "reward token not set"); rewardToken = _rewardToken; }
function setRewardToken(address _rewardToken) public { require(msg.sender == governance, "not governance"); require(_rewardToken != address(0x0), "reward token not set"); rewardToken = _rewardToken; }
54,621
39
// Withdraws all of the callers earnings. /
function withdraw() onlyhodler() public
function withdraw() onlyhodler() public
3,245
198
// check token amounts
uint tokens_to_transfer = 0; for (uint i = 0; i < _addresses.length; i++) { tokens_to_transfer = tokens_to_transfer.add(_amounts[i]); }
uint tokens_to_transfer = 0; for (uint i = 0; i < _addresses.length; i++) { tokens_to_transfer = tokens_to_transfer.add(_amounts[i]); }
13,023
1
// Returns the total amount of tokens stored by the contract. /
function totalSupply() external virtual view returns (uint256);
function totalSupply() external virtual view returns (uint256);
23,489