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
2
// Mapping from a token to an enumerable set of data feeds used to get the price of the token /
mapping(address => DataFeedSet) private _whitelistedDataFeeds;
mapping(address => DataFeedSet) private _whitelistedDataFeeds;
17,245
244
// `_valueAt` retrieves the number of tokens at a given block number snapshots The history of values being queried _block The block number to retrieve the value atreturn The number of tokens being queried /
function _valueAt( Snapshot[] storage snapshots, uint128 _block
function _valueAt( Snapshot[] storage snapshots, uint128 _block
30,187
154
// has referrer
require( amount >= registrationFeeWithReferrer, "Must send at least enough LID to pay registration fee." ); require( lidToken.transferFrom( msg.sender, referrer, registrationFeeWithReferrer ),
require( amount >= registrationFeeWithReferrer, "Must send at least enough LID to pay registration fee." ); require( lidToken.transferFrom( msg.sender, referrer, registrationFeeWithReferrer ),
8,900
270
// convert to InvestmentToken
uint256 amountToBorrowIT = _fromETH(amountToBorrowETH, address(investmentToken)); if (amountToBorrowIT > 0) { _lendingPool().borrow( address(investmentToken), amountToBorrowIT, 2, referral, address(this)
uint256 amountToBorrowIT = _fromETH(amountToBorrowETH, address(investmentToken)); if (amountToBorrowIT > 0) { _lendingPool().borrow( address(investmentToken), amountToBorrowIT, 2, referral, address(this)
22,008
317
// Get imbalanced token
bool zeroForOne = PoolVariables.amountsDirection(cache.amount0Desired, cache.amount1Desired, cache.amount0, cache.amount1);
bool zeroForOne = PoolVariables.amountsDirection(cache.amount0Desired, cache.amount1Desired, cache.amount0, cache.amount1);
26,560
58
// endowmentBalance has 6 decimals as USDC, so to get 1e18 decimals, multiply by 1e12 and by 100 to get %
uint256 baseAssetPerDay = endowmentBalance.mul(1e12).mul(100).mul(86400).div(secondsFromInception); return baseAssetPerDay.mul(1e18).div(totalMoveStakedEquivalent);
uint256 baseAssetPerDay = endowmentBalance.mul(1e12).mul(100).mul(86400).div(secondsFromInception); return baseAssetPerDay.mul(1e18).div(totalMoveStakedEquivalent);
57,362
1,415
// The time for the active (if it exists) funding rate proposal. 0 otherwise.
uint256 proposalTime;
uint256 proposalTime;
52,090
24
// If the caller is the owner of the boost, unset the boost's staked team.
userStorage.delInStakedMOMO(_boostId);
userStorage.delInStakedMOMO(_boostId);
29,350
28
// Return the current price0 cumulative value on uniswap./pair The uniswap pair to query for price0 cumulative value.
function currentPrice0Cumu(address pair) public view returns (uint price0Cumu) { uint32 currTime = uint32(block.timestamp); price0Cumu = IUniswapV2Pair(pair).price0CumulativeLast(); // can use reserves without flash-manipulated risks because cumu changes if reserves change (uint reserve0, uint reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves(); if (lastTime != currTime) { unchecked { uint32 timeElapsed = currTime - lastTime; // overflow is desired price0Cumu += uint((reserve1 << 112) / reserve0) * timeElapsed; // overflow is desired } } }
function currentPrice0Cumu(address pair) public view returns (uint price0Cumu) { uint32 currTime = uint32(block.timestamp); price0Cumu = IUniswapV2Pair(pair).price0CumulativeLast(); // can use reserves without flash-manipulated risks because cumu changes if reserves change (uint reserve0, uint reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves(); if (lastTime != currTime) { unchecked { uint32 timeElapsed = currTime - lastTime; // overflow is desired price0Cumu += uint((reserve1 << 112) / reserve0) * timeElapsed; // overflow is desired } } }
40,270
78
// This will allow the supply to go slightly over the max total supply (once the last rewards are applied). Users can collect rewards (and stake) after the closure period.In theory somone could hold for a long time and then receive a very large reward.
require(_totalSupply < _maxTotalSupply, "This operation would take the total supply over the maximum supply."); _;
require(_totalSupply < _maxTotalSupply, "This operation would take the total supply over the maximum supply."); _;
32,578
59
// Roll for a jackpot (if eligible).
if (amount >= MIN_JACKPOT_BET) {
if (amount >= MIN_JACKPOT_BET) {
42,130
7
// : to set receiving amount for each wallet account. Can be called several times. /
function depositAirdrop( address[] memory accounts, uint256[] memory amounts
function depositAirdrop( address[] memory accounts, uint256[] memory amounts
30,432
140
// modifiers
modifier onlyFreeMint() { require(freeMintWhitelist[msg.sender] > 0); _; }
modifier onlyFreeMint() { require(freeMintWhitelist[msg.sender] > 0); _; }
48,021
114
// Info of each user that stakes tokens (lpToken)
mapping(address => UserInfo) public userInfo;
mapping(address => UserInfo) public userInfo;
40,660
6
// POOL_1 -> ${this pool} mockDexPool_1sendRequestTest -> bridgetransmitRequest -> node -> adpaterreceiveRequest -> ${this func} -> bridgetransmitResponse(reqId) -> node -> adpaterreceiveResponse -> mockDexPool_1setPendingRequestsDone/
function receiveRequestTest(uint256 _testData) public { require(msg.sender == bridge, "ONLY CERTAIN BRIDGE"); testData = _testData; }
function receiveRequestTest(uint256 _testData) public { require(msg.sender == bridge, "ONLY CERTAIN BRIDGE"); testData = _testData; }
4,511
12
// only member of genesis organization can deactive template
registry.deactivateTemplate("bbb");
registry.deactivateTemplate("bbb");
48,274
186
// Update the current bond level, if there's a bond (ie anything except arbitration)
if (bond > 0) { questions[question_id].bond = bond; }
if (bond > 0) { questions[question_id].bond = bond; }
47,960
113
// Retrieves the balance for a token owner./Returns `0` if the call reverts./token The address of the token contract./owner The owner of the tokens./ return balance The token balance of an owner.
function balanceOf(address token, address owner) internal view returns (uint256 balance)
function balanceOf(address token, address owner) internal view returns (uint256 balance)
12,181
89
// View governance address/ return governance address
function getGovernance() external view returns(address) { return governance; }
function getGovernance() external view returns(address) { return governance; }
15,274
47
// custom oracle
if (_oracleData[i].oracleType == 2) { address contractaddress = _oracleData[i].oracleaddress; string memory signature = _oracleData[i].signature; bytes memory calldatas = _oracleData[i].calldatas; uint256 callvalue = _oracleData[i].values; bytes memory callData; if (bytes(signature).length == 0) {
if (_oracleData[i].oracleType == 2) { address contractaddress = _oracleData[i].oracleaddress; string memory signature = _oracleData[i].signature; bytes memory calldatas = _oracleData[i].calldatas; uint256 callvalue = _oracleData[i].values; bytes memory callData; if (bytes(signature).length == 0) {
9,786
287
// Calculates reward unit price per staking.Later, the last cumulative sum of the reward amount is subtracted because to add the last recorded holder/staking reward. /
uint256 price = allStakes > 0
uint256 price = allStakes > 0
52,066
13
// Set proxy
function setProxy(address _proxy, address _owner) public onlyOperator onlyOwner(_owner) returns (bool)
function setProxy(address _proxy, address _owner) public onlyOperator onlyOwner(_owner) returns (bool)
6,588
40
// Get the worth in a token of a certain amount of ETH. _amount Amount of ETH to convert. _tokenAddress Address of the token to convert to. excludeFees If uniswap fees is considered. /
function _getTokenAmountByEthAmount( uint256 _amount, address _tokenAddress, bool excludeFees
function _getTokenAmountByEthAmount( uint256 _amount, address _tokenAddress, bool excludeFees
71,895
27
// Get the current token mint price
function getPrice() public view returns (uint) { if (_pricingMode == PricingMode.TIMEDROP && _timeDropAt > 0) { return _calcPrice(block.timestamp); } return _price; }
function getPrice() public view returns (uint) { if (_pricingMode == PricingMode.TIMEDROP && _timeDropAt > 0) { return _calcPrice(block.timestamp); } return _price; }
43,865
80
// Guarantees msg.sender is owner of the given token _tokenId uint256 ID of the token to validate its ownership belongs to msg.sender /
modifier onlyOwnerOf(uint256 _tokenId) { require(ownerOf(_tokenId) == msg.sender); _; }
modifier onlyOwnerOf(uint256 _tokenId) { require(ownerOf(_tokenId) == msg.sender); _; }
6,583
17
// executor (20 bytes) + gasLimit (4 bytes) + srcChainIdLength (1 byte) + dstChainIdLength (1 bytes) + dataType (1 byte) + remainder (5 bytes)
let blob := mload(add(_data, 84))
let blob := mload(add(_data, 84))
43,387
32
// Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amout of tokens to be transfered /
function transferFrom(address _from, address _to, uint256 _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; }
function transferFrom(address _from, address _to, uint256 _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; }
38,022
14
// update coordinator with remaining value
updateBalance(coordinator, msg.value, bidAmount);
updateBalance(coordinator, msg.value, bidAmount);
26,211
44
// ANTIBOT
FTPAntiBot private AntiBot; address private m_AntibotSvcAddress = 0xCD5312d086f078D1554e8813C27Cf6C9D1C3D9b3;
FTPAntiBot private AntiBot; address private m_AntibotSvcAddress = 0xCD5312d086f078D1554e8813C27Cf6C9D1C3D9b3;
22,751
14
// Unbundle the given token for the given amount/The sender needs to have given approval for the amount for the bundle/token_ The token the sender wishes to unbundle/amount_ The amount the sender wishes to unbundle/ return the amount after fees that the user receives
function unbundle(CarbonCreditToken token_, uint256 amount_) external returns (uint256) { uint receivedAmount = _transferFromAndUnbundle(token_, amount_); token_.safeTransfer(_msgSender(), receivedAmount); return receivedAmount; }
function unbundle(CarbonCreditToken token_, uint256 amount_) external returns (uint256) { uint receivedAmount = _transferFromAndUnbundle(token_, amount_); token_.safeTransfer(_msgSender(), receivedAmount); return receivedAmount; }
25,974
92
// Method to reclaim contribution after project is declared default (% of partial funds)beneficiary the contributor/
function reclaimContributionDefault(address payable beneficiary) external { require(state == LendingState.Default); require(!investors[beneficiary].isCompensated); // contribution = contribution * partial_funds / total_funds uint256 contribution = checkInvestorReturns(beneficiary); require(contribution > 0); investors[beneficiary].isCompensated = true; reclaimedContributions = reclaimedContributions.add(1); doReclaim(beneficiary, contribution); }
function reclaimContributionDefault(address payable beneficiary) external { require(state == LendingState.Default); require(!investors[beneficiary].isCompensated); // contribution = contribution * partial_funds / total_funds uint256 contribution = checkInvestorReturns(beneficiary); require(contribution > 0); investors[beneficiary].isCompensated = true; reclaimedContributions = reclaimedContributions.add(1); doReclaim(beneficiary, contribution); }
7,861
8
// Returns true if the beneficiary is the current reserve. /
function isBeneficiary() public view returns (bool) { return beneficiary == address(0); }
function isBeneficiary() public view returns (bool) { return beneficiary == address(0); }
11,114
42
// Sets a new duration for a token price rate cache. It reverts if there was no rate provider set initially.Note this function also updates the current cached value. duration Number of seconds until the current rate of token price is fetched again. /
function setPriceRateCacheDuration(IERC20 token, uint256 duration) external authenticate { if (_isToken0WithRateProvider(token)) { _updateToken0PriceRateCache(duration); emit PriceRateProviderSet(token, _getRateProvider0(), duration); } else if (_isToken1WithRateProvider(token)) { _updateToken1PriceRateCache(duration); emit PriceRateProviderSet(token, _getRateProvider1(), duration); } else { _revert(Errors.INVALID_TOKEN); } }
function setPriceRateCacheDuration(IERC20 token, uint256 duration) external authenticate { if (_isToken0WithRateProvider(token)) { _updateToken0PriceRateCache(duration); emit PriceRateProviderSet(token, _getRateProvider0(), duration); } else if (_isToken1WithRateProvider(token)) { _updateToken1PriceRateCache(duration); emit PriceRateProviderSet(token, _getRateProvider1(), duration); } else { _revert(Errors.INVALID_TOKEN); } }
26,599
235
// Tokens that are not on auction always have an endTimestamp of 0
require(timestamp <= auction.endTimestamp, "Auction has already ended"); require(timestamp >= auction.startTimestamp, "Auction has not started yet"); uint256 minPrice = prevPrice + auction.minBidIncrement; if (prevBidder == address(0)) { minPrice = prevPrice; }
require(timestamp <= auction.endTimestamp, "Auction has already ended"); require(timestamp >= auction.startTimestamp, "Auction has not started yet"); uint256 minPrice = prevPrice + auction.minBidIncrement; if (prevBidder == address(0)) { minPrice = prevPrice; }
38,487
37
// Checks if a given address is an OptimismMintableERC20. Not perfect, but good enough./ Just the way we like it./_token Address of the token to check./ return True if the token is an OptimismMintableERC20.
function _isOptimismMintableERC20(address _token) internal view returns (bool) { return ERC165Checker.supportsInterface(_token, type(ILegacyMintableERC20).interfaceId) || ERC165Checker.supportsInterface(_token, type(IOptimismMintableERC20).interfaceId); }
function _isOptimismMintableERC20(address _token) internal view returns (bool) { return ERC165Checker.supportsInterface(_token, type(ILegacyMintableERC20).interfaceId) || ERC165Checker.supportsInterface(_token, type(IOptimismMintableERC20).interfaceId); }
11,132
44
// Admin function to set master account which collects gas tank deposits /
function setMasterAccount(address payable _newAccount) external onlyOwner{ masterAccount = _newAccount; emit MasterAccountChanged(_newAccount, msg.sender); }
function setMasterAccount(address payable _newAccount) external onlyOwner{ masterAccount = _newAccount; emit MasterAccountChanged(_newAccount, msg.sender); }
10,149
1
// Total supply of events
uint256 public eventsMinted;
uint256 public eventsMinted;
30,309
42
// solhint-disable no-empty-blocks /
) public AdminUpgradeabilityProxy(implementation, proxyOwnerAddr, data) {} /* solhint-enable no-empty-blocks */ }
) public AdminUpgradeabilityProxy(implementation, proxyOwnerAddr, data) {} /* solhint-enable no-empty-blocks */ }
22,144
5
// Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
* Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll( address account, address operator ) external view returns (bool); }
* Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll( address account, address operator ) external view returns (bool); }
3,754
13
// return any return value or error back to the caller
switch result case 0 { revert(0, returndatasize()) }
switch result case 0 { revert(0, returndatasize()) }
3,412
219
// total amount of KTY sold
uint256 internal tokensSold;
uint256 internal tokensSold;
79,636
10
// +1 due to beginning of a month
uint256 periodsCompleted = 1 + (months - fullLockMonths + 1).div(periodMonths); uint256 potentialAmount = releasePerPeriod.mul(periodsCompleted); return potentialAmount.sub(team[_address].sent);
uint256 periodsCompleted = 1 + (months - fullLockMonths + 1).div(periodMonths); uint256 potentialAmount = releasePerPeriod.mul(periodsCompleted); return potentialAmount.sub(team[_address].sent);
18,356
34
// Returns the amount of tokens to keep for the next lottery /
function toNextLottery() public view override returns (uint256) { uint256 percentageToKeepForNextLottery = _lottery[_lotteryID.current()] .percentageToKeepForNextLottery; uint256 totalFees = claimedFees(); return ((address(this).balance + totalFees) * percentageToKeepForNextLottery) / 10000; }
function toNextLottery() public view override returns (uint256) { uint256 percentageToKeepForNextLottery = _lottery[_lotteryID.current()] .percentageToKeepForNextLottery; uint256 totalFees = claimedFees(); return ((address(this).balance + totalFees) * percentageToKeepForNextLottery) / 10000; }
45,118
46
// Unlock some tokens without vesting
allowed[investorsAllocation][msg.sender] = investorsTotal; allowed[bountyAllocation][msg.sender] = bountyTotal; allowed[liquidityPoolAllocation][msg.sender] = liquidityPoolTotal; allowed[contributorsAllocation][msg.sender] = contributorsTotal;
allowed[investorsAllocation][msg.sender] = investorsTotal; allowed[bountyAllocation][msg.sender] = bountyTotal; allowed[liquidityPoolAllocation][msg.sender] = liquidityPoolTotal; allowed[contributorsAllocation][msg.sender] = contributorsTotal;
18,946
12
// in case the creator is the resolver, move the bond to the resolver
marketBond[_market].resolverBond = _amount; marketBond[_market].totalMarketBond = marketBond[_market].totalMarketBond.add(_amount); marketBond[_market].totalDepositedMarketBond = marketBond[_market].totalDepositedMarketBond.add(_amount); transferToMarketBond(_resolverAddress, _amount); emit ResolverBondSent(_market, _resolverAddress, _amount);
marketBond[_market].resolverBond = _amount; marketBond[_market].totalMarketBond = marketBond[_market].totalMarketBond.add(_amount); marketBond[_market].totalDepositedMarketBond = marketBond[_market].totalDepositedMarketBond.add(_amount); transferToMarketBond(_resolverAddress, _amount); emit ResolverBondSent(_market, _resolverAddress, _amount);
8,910
88
// Returns the total amount of contributed funds (ETH) in the ISO/
function getContributedFundsTotal() external view returns (uint256) { return _contributedFundsTotal; }
function getContributedFundsTotal() external view returns (uint256) { return _contributedFundsTotal; }
5,182
17
// Emitted when the repayer does not have enough hTokens to repay the debt.
error BalanceSheet__RepayBorrowInsufficientBalance(IHToken bond, uint256 repayAmount, uint256 hTokenBalance);
error BalanceSheet__RepayBorrowInsufficientBalance(IHToken bond, uint256 repayAmount, uint256 hTokenBalance);
5,675
33
// mints heroes for the sender amount the amount of heroes to mint /
function enrollHeroes(uint256 amount) external whenNotPaused { uint256 totalSupply = _owners.length; if (totalSupply < MAX_GENESIS_TOKENS) revert SaleNotStarted(); if (totalSupply + amount > MAX_TOKENS) revert NotEnoughTokens(); if (amount > MAX_TOKENS_PER_TX) revert TooMuchTokensPerTx(); // check $LEGENDZ balance uint balance = legendz.balanceOf(_msgSender()); uint cost = MINT_PRICE * amount; if (cost > balance) revert NotEnoughLegendz(); // burn $LEGENDZ legendz.burn(_msgSender(), cost); uint256 seed = _random(totalSupply); for (uint i; i < amount; i++) { heroes[i + totalSupply] = _generate(seed >> i, false); _mint(_msgSender(), i + totalSupply); } }
function enrollHeroes(uint256 amount) external whenNotPaused { uint256 totalSupply = _owners.length; if (totalSupply < MAX_GENESIS_TOKENS) revert SaleNotStarted(); if (totalSupply + amount > MAX_TOKENS) revert NotEnoughTokens(); if (amount > MAX_TOKENS_PER_TX) revert TooMuchTokensPerTx(); // check $LEGENDZ balance uint balance = legendz.balanceOf(_msgSender()); uint cost = MINT_PRICE * amount; if (cost > balance) revert NotEnoughLegendz(); // burn $LEGENDZ legendz.burn(_msgSender(), cost); uint256 seed = _random(totalSupply); for (uint i; i < amount; i++) { heroes[i + totalSupply] = _generate(seed >> i, false); _mint(_msgSender(), i + totalSupply); } }
41,180
0
// reserves
_mint( sartoshi, 0); _mint( deezeFi, 1); _mint( dfarmer, 2); _mint( farokh, 3); _mint( franklin, 4); _mint( j1mmy, 5); _mint( joshOng, 6); _mint( keyboardmonkey, 7); _mint( kingBlackBored, 8); _mint( pranksy, 9);
_mint( sartoshi, 0); _mint( deezeFi, 1); _mint( dfarmer, 2); _mint( farokh, 3); _mint( franklin, 4); _mint( j1mmy, 5); _mint( joshOng, 6); _mint( keyboardmonkey, 7); _mint( kingBlackBored, 8); _mint( pranksy, 9);
59,928
3
// the token id of MoonCats that has been used
mapping(uint256 => bool) public usedMoonCats;
mapping(uint256 => bool) public usedMoonCats;
15,572
82
// Get the timestamp at which a forced trade request was queued. argsHashThe hash of the forced trade request args. return Timestamp at which the forced trade was queued, or zero, if it was not queued or was vetoed by the VETO_GUARDIAN_ROLE. /
function getQueuedForcedTradeTimestamp( bytes32 argsHash ) external view returns (uint256)
function getQueuedForcedTradeTimestamp( bytes32 argsHash ) external view returns (uint256)
75,992
57
// And then divide down by blocks per year.
(Error err1, Exp memory standardBorrowRate) = divScalar(annualBorrowRate, blocksPerYear); // basis points * blocks per year
(Error err1, Exp memory standardBorrowRate) = divScalar(annualBorrowRate, blocksPerYear); // basis points * blocks per year
42,695
173
// Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2128) - 1 updatedIndex overflows if _currentIndex + quantity > 3.4e38 (2128) - 1
unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; for (uint256 i; i < quantity; i++) {
unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; for (uint256 i; i < quantity; i++) {
4,664
31
// Public Functions//Resolves the address associated with a given name. _name Name to resolve an address for.return Address associated with the given name. /
function resolve(string memory _name) public view returns (address) { return libAddressManager.getAddress(_name); }
function resolve(string memory _name) public view returns (address) { return libAddressManager.getAddress(_name); }
18,305
104
// generates an attribute for the attributes array in the ERC721 metadata standard traitType the trait type to reference as the metadata key value the token's trait associated with the keyreturn a JSON dictionary for the single attribute /
function attributeForTypeAndValue(string memory traitType, string memory value) internal pure returns (string memory) { return string(abi.encodePacked( '{"trait_type":"', traitType, '","value":"', value, '"}' )); }
function attributeForTypeAndValue(string memory traitType, string memory value) internal pure returns (string memory) { return string(abi.encodePacked( '{"trait_type":"', traitType, '","value":"', value, '"}' )); }
21,960
4
// total ether submitted before fees.
uint256 _submitted = 0; uint256 public tier = 0;
uint256 _submitted = 0; uint256 public tier = 0;
14,379
53
// @inheritdoc IDackieV3PoolActions/noDelegateCall is applied indirectly via _modifyPosition
function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data
function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data
16,217
4
// role Role that is being renounced by the _msgSender() Removes a role from the sender's address /
function renounceRole(bytes32 role) external;
function renounceRole(bytes32 role) external;
35,913
37
// Asset ID is a identifier for look and feel in frontend
uint16 ID;
uint16 ID;
10,890
46
// reverts if game verification has been triggered
require(!_context.isDescartesInstantiated, "Game has been challenged and a verification has been requested"); if (_context.gameTimeout == 0) {
require(!_context.isDescartesInstantiated, "Game has been challenged and a verification has been requested"); if (_context.gameTimeout == 0) {
23,652
79
// 👍 CHANGE TO USE SIGN MESSAGE IN FUTURE
function autoListNFT( address _owner
function autoListNFT( address _owner
16,229
214
// Whether `a` is less than or equal to `b`. a a FixedPoint.Signed. b a FixedPoint.Signed.return True if `a <= b`, or False. /
function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue <= b.rawValue; }
function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue <= b.rawValue; }
61,857
56
// The constructor is called once the contract is deployed. Here we mint our tokens, set the name and symbol /
constructor() ERC20("AllyFocus","XYR") { uint256 total = 1800000000 * 10 ** 18; faucetSupply = total * 60 / 100; _mint(address(this), faucetSupply); // 60% goes to contract/faucet _mint(0x1A8fa6aA3Fbb0a0E96FDEf3334102FbDa7CD5Ee3, total * 15 / 100); // 15% goes to this address _mint(0xD10CE4538D312874618a684784F266141B951d86, total * 15 / 100); // 15% goes to this address _mint(0xAF41c09B707532B6372bc195Dc1002926b130b73, total * 10 / 100); // 10% goes to this address }
constructor() ERC20("AllyFocus","XYR") { uint256 total = 1800000000 * 10 ** 18; faucetSupply = total * 60 / 100; _mint(address(this), faucetSupply); // 60% goes to contract/faucet _mint(0x1A8fa6aA3Fbb0a0E96FDEf3334102FbDa7CD5Ee3, total * 15 / 100); // 15% goes to this address _mint(0xD10CE4538D312874618a684784F266141B951d86, total * 15 / 100); // 15% goes to this address _mint(0xAF41c09B707532B6372bc195Dc1002926b130b73, total * 10 / 100); // 10% goes to this address }
15,051
31
// to receive eth from the contract
address public walletOwnerAddress;
address public walletOwnerAddress;
31,096
17
// Add token to tokens white list. token Allowable token. priceFeed Price feed chain. /
function allowToken(address token, address[] memory priceFeed) external onlyOwner { allowedTokens[token] = priceFeed; emit TokenAllowed(token, priceFeed); }
function allowToken(address token, address[] memory priceFeed) external onlyOwner { allowedTokens[token] = priceFeed; emit TokenAllowed(token, priceFeed); }
26,000
7
// checks to see if the contract is frozen
modifier isFrozen() { require(administrationContractFrozen); _; }
modifier isFrozen() { require(administrationContractFrozen); _; }
43,292
193
// Allows to enable/disable minting of main sale
function flipSaleState() external onlyOwner { _isSaleActive = !_isSaleActive; }
function flipSaleState() external onlyOwner { _isSaleActive = !_isSaleActive; }
64,675
209
// attributes = [/
struct Card { uint256 attributes; uint256 modifiers; }
struct Card { uint256 attributes; uint256 modifiers; }
8,022
15
// returns true if Exp is exactly zero /
function isZeroExp(Exp memory value) internal pure returns (bool) { return value.mantissa == 0; }
function isZeroExp(Exp memory value) internal pure returns (bool) { return value.mantissa == 0; }
21,775
64
// uint contractBalance = Token(trustedRewardTokenAddress).balanceOf(address(this));
if (contractBalance < amount) { amount = contractBalance; }
if (contractBalance < amount) { amount = contractBalance; }
6,924
5
// State variable "programHash" write-access functions.
function programHash(uint256 value) internal { NamedStorage.setUintValue(PROGRAM_HASH_TAG, value); }
function programHash(uint256 value) internal { NamedStorage.setUintValue(PROGRAM_HASH_TAG, value); }
71,035
206
// append the suffix
accountContext.activeCurrencies = prefix | (suffix >> ((shifts + 1) * 16)); return;
accountContext.activeCurrencies = prefix | (suffix >> ((shifts + 1) * 16)); return;
5,863
28
// sets the Identity Registry for the token_identityRegistry the address of the Identity Registry to set Only the owner of the token smart contract can call this function emits an `IdentityRegistryAdded` event /
function setIdentityRegistry(address _identityRegistry) external;
function setIdentityRegistry(address _identityRegistry) external;
34,853
45
// Should https:github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted, this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value); _burn(account, value);
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub( value); _burn(account, value);
10,141
68
// Retrieves the bond amount of a darknode in 10^-18 REN./_darknodeID The ID of the darknode to retrieve the bond for.
function getDarknodeBond(address _darknodeID) external view returns (uint256)
function getDarknodeBond(address _darknodeID) external view returns (uint256)
31,935
2
// Reference implementation of the ERC223 standard token with custom fallback invocations. /
abstract contract ERC223CustomFallbackToken is ERC223Token { event Response(bool _success, bytes _data); function transfer(address _to, uint _value, bytes calldata _data, string calldata _custom_fallback) public returns (bool success) { // Standard function transfer similar to ERC20 transfer with no _data . // Added due to backwards compatibility reasons . balances[msg.sender] = balances[msg.sender] - _value; balances[_to] = balances[_to] + _value; if(Address.isContract(_to)) { (bool _success, bytes memory _response) = address(_to).call(abi.encodeWithSignature(_custom_fallback, msg.sender, _value, _data)); require(_success, "Fallback function execution failed on receivers side"); emit Response(_success, _response); } emit Transfer(msg.sender, _to, _value); return true; } }
abstract contract ERC223CustomFallbackToken is ERC223Token { event Response(bool _success, bytes _data); function transfer(address _to, uint _value, bytes calldata _data, string calldata _custom_fallback) public returns (bool success) { // Standard function transfer similar to ERC20 transfer with no _data . // Added due to backwards compatibility reasons . balances[msg.sender] = balances[msg.sender] - _value; balances[_to] = balances[_to] + _value; if(Address.isContract(_to)) { (bool _success, bytes memory _response) = address(_to).call(abi.encodeWithSignature(_custom_fallback, msg.sender, _value, _data)); require(_success, "Fallback function execution failed on receivers side"); emit Response(_success, _response); } emit Transfer(msg.sender, _to, _value); return true; } }
43,528
0
// See {ERC20-constructor}. /
constructor(string memory name, string memory symbol) ERC20(name, symbol) { _setupRole(OWNER_ROLE, _msgSender()); _setupRole(ADMIN_ROLE, _msgSender()); _setupRole(DELEGATE_ROLE, _msgSender()); _setRoleAdmin(DELEGATE_ROLE, ADMIN_ROLE); }
constructor(string memory name, string memory symbol) ERC20(name, symbol) { _setupRole(OWNER_ROLE, _msgSender()); _setupRole(ADMIN_ROLE, _msgSender()); _setupRole(DELEGATE_ROLE, _msgSender()); _setRoleAdmin(DELEGATE_ROLE, ADMIN_ROLE); }
26,408
485
// Struct to represent a fraction./numerator of fraction./denominator of fraction.
struct Fraction { uint256 numerator; uint256 denominator; }
struct Fraction { uint256 numerator; uint256 denominator; }
12,393
6
// Get Vesting Info - Detail, Users
function getVestingInfo(uint256 _vid) external view onlyOwner returns (Vesting memory, User[] memory)
function getVestingInfo(uint256 _vid) external view onlyOwner returns (Vesting memory, User[] memory)
26,251
11
// Delegate votes from `msg.sender` to `delegatee` delegator The address to get delegatee for /
function delegates(address delegator) external view returns (address)
function delegates(address delegator) external view returns (address)
3,686
6
// Calls the `latestRound()` function of the `from`aggregatorreturn The value of latestRound for the `from` aggregator /
function latestRound() external view virtual override returns (uint256) { return _latestRound(); }
function latestRound() external view virtual override returns (uint256) { return _latestRound(); }
36,414
43
// Checks msg.sender can transfer a token, by being owner, approved, or operator _tokenId uint256 ID of the token to validate /
modifier canTransfer(uint256 _tokenId) { require(isApprovedOrOwner(msg.sender, _tokenId)); _; }
modifier canTransfer(uint256 _tokenId) { require(isApprovedOrOwner(msg.sender, _tokenId)); _; }
59,233
3
// Execute some state update after verifying the proof (just an example)
updateSomeState(a[0]);
updateSomeState(a[0]);
4,097
64
// Set the latest Lockup contract address.Only the owner can execute this function. /
function setLockup(address _addr) external onlyOwner { lockup = _addr; }
function setLockup(address _addr) external onlyOwner { lockup = _addr; }
70,145
101
// Determine positions
for (i = maxLeaders-1; i >= 0; i--) { if (_price >= _highestPrices[i].price) { newPos = i; }
for (i = maxLeaders-1; i >= 0; i--) { if (_price >= _highestPrices[i].price) { newPos = i; }
28,264
10
// Returns the amount of time (sec) a token has for validity /
function isExpired(uint256 tokenId) public view returns (bool) { require(_exists(tokenId), 'Nonexistent token'); uint256 t = secondsSinceMint(tokenId); if (t < expiration) { return false; } else { return true; } }
function isExpired(uint256 tokenId) public view returns (bool) { require(_exists(tokenId), 'Nonexistent token'); uint256 t = secondsSinceMint(tokenId); if (t < expiration) { return false; } else { return true; } }
80,176
130
// Like `mul512`, but multiply a number by itself
function square512(uint256 a) internal pure returns (uint256 r0, uint256 r1) { assembly { let mm := mulmod(a, a, not(0)) r0 := mul(a, a) r1 := sub(sub(mm, r0), lt(mm, r0)) } }
function square512(uint256 a) internal pure returns (uint256 r0, uint256 r1) { assembly { let mm := mulmod(a, a, not(0)) r0 := mul(a, a) r1 := sub(sub(mm, r0), lt(mm, r0)) } }
19,340
53
// Current number of votes for abstaining for this proposal
uint256 abstainVotes;
uint256 abstainVotes;
19,951
44
// contracts/interfaces/IPremiumCalc.sol/ pragma solidity 0.6.11; /
interface IPremiumCalc { function calcType() external view returns (uint8); function name() external view returns (bytes32); function premiumFee() external view returns (uint256); function getPremiumPayment(address) external view returns (uint256, uint256, uint256); }
interface IPremiumCalc { function calcType() external view returns (uint8); function name() external view returns (bytes32); function premiumFee() external view returns (uint256); function getPremiumPayment(address) external view returns (uint256, uint256, uint256); }
23,750
50
// PRIVILEGED GOVERNANCE FUNCTION. Allows governance to remove a Set_setToken Address of the SetToken contract to remove /
function removeSet(address _setToken) external onlyInitialized onlyOwner { require(isSet[_setToken], "Set does not exist"); sets = sets.remove(_setToken); isSet[_setToken] = false; emit SetRemoved(_setToken); }
function removeSet(address _setToken) external onlyInitialized onlyOwner { require(isSet[_setToken], "Set does not exist"); sets = sets.remove(_setToken); isSet[_setToken] = false; emit SetRemoved(_setToken); }
3,959
2
// This method for calculating share price is used because theLooks contract factors in pending rewards
function calculateSharePrice() public view returns (uint256) { (uint256 totalLooks, ) = ILooksDistributor(looksDistributor).userInfo( looksStaking ); uint256 totalShares = ILooksStaking(looksStaking).totalShares(); return totalLooks.mul(1e18).div(totalShares); }
function calculateSharePrice() public view returns (uint256) { (uint256 totalLooks, ) = ILooksDistributor(looksDistributor).userInfo( looksStaking ); uint256 totalShares = ILooksStaking(looksStaking).totalShares(); return totalLooks.mul(1e18).div(totalShares); }
42,379
15
// Create instance of fee token
IERC20 feeToken = IERC20(_order.feeTokenAddress);
IERC20 feeToken = IERC20(_order.feeTokenAddress);
44,064
49
// returns Q112-encoded value returned value 10182112 is $1
function assetToUsd(address asset, uint amount) external view returns (uint);
function assetToUsd(address asset, uint amount) external view returns (uint);
19,080
1
// attack to the nearest ether
require(msg.value >= 1 ether); etherStore.depositFunds.value(1 ether)();
require(msg.value >= 1 ether); etherStore.depositFunds.value(1 ether)();
34,699
62
// minAmountOut is 0 here since we are going to make up the shortfall with the input token. Sandwich protection is provided by the check at the end against _maxAmountInputToken parameter specified by the user
0, _swapData );
0, _swapData );
13,893
51
// Set block number to current block number
startBlock = now;
startBlock = now;
6,306
96
// Fails if transaction is not allowed.Return values can be ignored for AntiBot launches /
function lockOrGetPenalty(address source, address dest) external returns (bool, uint256);
function lockOrGetPenalty(address source, address dest) external returns (bool, uint256);
59,350
78
// Deposits a dummy token to `MASTER_CHEF` MCV1. This is required because MCV1 holds the minting rights for SUSHI./ Any balance of transaction sender in `dummyToken` is transferred./ The allocation point for the pool on MCV1 is the total allocation point for all pools that receive double incentives./dummyToken The address of the ERC-20 token to deposit into MCV1.
function init(IERC20 dummyToken) external { uint256 balance = dummyToken.balanceOf(msg.sender); require(balance != 0, "MasterChefV2: Balance must exceed 0"); dummyToken.safeTransferFrom(msg.sender, address(this), balance); dummyToken.approve(address(MASTER_CHEF), balance); MASTER_CHEF.deposit(MASTER_PID, balance); emit LogInit(); }
function init(IERC20 dummyToken) external { uint256 balance = dummyToken.balanceOf(msg.sender); require(balance != 0, "MasterChefV2: Balance must exceed 0"); dummyToken.safeTransferFrom(msg.sender, address(this), balance); dummyToken.approve(address(MASTER_CHEF), balance); MASTER_CHEF.deposit(MASTER_PID, balance); emit LogInit(); }
10,068
1,942
// 973
entry "urgingly" : ENG_ADVERB
entry "urgingly" : ENG_ADVERB
21,809
99
// Increases the max supply for the provided `dmmTokenId` by `amount`. This call reverts with INSUFFICIENT_COLLATERAL if there isn't enough collateral in the Chainlink contract to cover the controller's requirements for minimum collateral. /
function increaseTotalSupply(uint dmmTokenId, uint amount) external;
function increaseTotalSupply(uint dmmTokenId, uint amount) external;
22,012