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
65
// KYC Check
validateWhitelisted(_beneficiary);
validateWhitelisted(_beneficiary);
59,291
5
// Whenever the drop has been succesfully set
bool public dropSet;
bool public dropSet;
15,305
4
// read the mints made by a specified wallet address._wallet the wallet address/
function mintsForWallet(address _wallet) public view returns (uint64) { return _getAux(_wallet); }
function mintsForWallet(address _wallet) public view returns (uint64) { return _getAux(_wallet); }
37,240
167
// Provides a safe ERC20.transfer version for different ERC-20 implementations./ Reverts on a failed transfer./token The address of the ERC-20 token./to Transfer tokens to./amount The token amount.
function safeTransfer( IERC20 token, address to, uint256 amount
function safeTransfer( IERC20 token, address to, uint256 amount
5,344
22
// fadeout options at the end of fadout
return minFadeValue;
return minFadeValue;
16,525
39
// Creates a vesting contract that vests its balance of any ERC20 token to the_beneficiary, gradually in a linear fashion until _start + _duration. By then allof the balance will have vested. _beneficiary address of the beneficiary to whom vested tokens are transferred _cliff duration in seconds of the cliff in which t...
function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public { require(_beneficiary != address(0)); require(_cliff <= _duration); beneficiary = _beneficiary; revocable = _revocable; duration = _duration; cliff = _start.add(_cliff); ...
function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public { require(_beneficiary != address(0)); require(_cliff <= _duration); beneficiary = _beneficiary; revocable = _revocable; duration = _duration; cliff = _start.add(_cliff); ...
2,598
130
// Sets the price of a product_productId - the product id_price - the product price/
function setPrice(uint256 _productId, uint256 _price) external onlyMinter
function setPrice(uint256 _productId, uint256 _price) external onlyMinter
22,975
68
// Create a new stake It is recomended to call stakeOnExistingNode after creating a new stakeso that a griefer doesn't remove your stake by immediately calling returnOldDeposit /
function newStake() external payable onlyValidator whenNotPaused { _newStake(msg.value); }
function newStake() external payable onlyValidator whenNotPaused { _newStake(msg.value); }
22,006
5
// Buys the given summoner. Must pay the exact correct prirce.
function buy(address nft, uint256 tokenId) external payable nonReentrant { uint256 price = prices[nft][tokenId]; require(price > 0, "not listed"); require(msg.value == price, "bad msg.value"); uint256 fee = (price * feeBps) / 10000; uint256 get = price - fee; address lister = listers[tokenId][...
function buy(address nft, uint256 tokenId) external payable nonReentrant { uint256 price = prices[nft][tokenId]; require(price > 0, "not listed"); require(msg.value == price, "bad msg.value"); uint256 fee = (price * feeBps) / 10000; uint256 get = price - fee; address lister = listers[tokenId][...
40,458
34
// If this vault is underwater-with-respect-to-rewards (different than noncompliant), liquidation is pro-rata underater iff: weiAsset[target_address] < vSYMDebtE18[target_address]/1E18weiPervSYM(liqPenaltyE10+1E10)/1E10
uint LHS2 = weiAsset[target_address].mul( 10 ** 18 ).mul( 10 ** 10); uint RHS2 = vSYMDebtE18[target_address].mul( weiPervSYM ).mul( liqPenaltyE10.add( 10 ** 10 )); uint weiClaim; if( LHS2 < RHS2 ) { // pro-rata claim
uint LHS2 = weiAsset[target_address].mul( 10 ** 18 ).mul( 10 ** 10); uint RHS2 = vSYMDebtE18[target_address].mul( weiPervSYM ).mul( liqPenaltyE10.add( 10 ** 10 )); uint weiClaim; if( LHS2 < RHS2 ) { // pro-rata claim
8,276
361
// Exactly how much of userIn to swap to get perfectly balanced ratio for LP tokens This code matches Alpha Homora and Zapper reserveIn Amount of reserves for asset 0 userIn Availabe amount of asset 0 to swapreturn Amount of userIn to swap for asset 1 /
function calculateSwapInAmount(uint256 reserveIn, uint256 userIn) internal pure returns (uint256)
function calculateSwapInAmount(uint256 reserveIn, uint256 userIn) internal pure returns (uint256)
81,205
26
// @inheritdoc IIndexPrice/we overwrite the index price in BaseToken depending on the status/1. Open: the price is from the price feed/2. Paused or Closed: the price is twap when the token was paused
function getIndexPrice(uint256 interval) public view override returns (uint256) { if (_status == IBaseToken.Status.Open) { return _formatDecimals(IPriceFeed(_priceFeed).getPrice(interval)); } return _pausedIndexPrice; }
function getIndexPrice(uint256 interval) public view override returns (uint256) { if (_status == IBaseToken.Status.Open) { return _formatDecimals(IPriceFeed(_priceFeed).getPrice(interval)); } return _pausedIndexPrice; }
2,212
188
// track the tokens that ascended & add to the global goal
sacrificed.increment(); ritualizedInhabitants[vessel] = true; emit performRitualEvent(msg.sender, vessel, sacrifice);
sacrificed.increment(); ritualizedInhabitants[vessel] = true; emit performRitualEvent(msg.sender, vessel, sacrifice);
43,791
27
// this function is defined in a child contract //whether a note is already spent /
function isSpent(bytes32 _nullifierHash) public view returns (bool) { return nullifierHashes[_nullifierHash]; }
function isSpent(bytes32 _nullifierHash) public view returns (bool) { return nullifierHashes[_nullifierHash]; }
34,924
50
// Calculates partial value given a numerator and denominator rounded down./numerator Numerator./denominator Denominator./target Value to calculate partial of./ return Partial value of target rounded down.
function getPartialAmountFloor( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (uint256 partialAmount)
function getPartialAmountFloor( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (uint256 partialAmount)
8,678
81
// Internal function to notify SDT to the gauge
function _distributeSDT() internal { if (sdtDistributor != address(0)) { ISDTDistributor(sdtDistributor).distribute(gauge); } }
function _distributeSDT() internal { if (sdtDistributor != address(0)) { ISDTDistributor(sdtDistributor).distribute(gauge); } }
30,979
259
// Construct an array of market(s) to enable as collateral.
CERC20[] memory marketsToEnter = new CERC20[](1); marketsToEnter[0] = assetTurboCToken;
CERC20[] memory marketsToEnter = new CERC20[](1); marketsToEnter[0] = assetTurboCToken;
11,028
159
// case 3. normal case
uint256 baseInputRatio = DecimalMath.divFloor(baseInput, baseReserve); uint256 quoteInputRatio = DecimalMath.divFloor(quoteInput, quoteReserve); uint256 mintRatio = quoteInputRatio < baseInputRatio ? quoteInputRatio : baseInputRatio; shares = DecimalMath.mulFloor(totalSup...
uint256 baseInputRatio = DecimalMath.divFloor(baseInput, baseReserve); uint256 quoteInputRatio = DecimalMath.divFloor(quoteInput, quoteReserve); uint256 mintRatio = quoteInputRatio < baseInputRatio ? quoteInputRatio : baseInputRatio; shares = DecimalMath.mulFloor(totalSup...
7,972
10
// ENCHANT BALANCE
uint enchant_total = enchant.totalSupply(); uint enchant_balance = enchant.balanceOf(member); uint enchant_totalSeance = seance.balanceOf(address(enchant));
uint enchant_total = enchant.totalSupply(); uint enchant_balance = enchant.balanceOf(member); uint enchant_totalSeance = seance.balanceOf(address(enchant));
42,852
60
// Track the address for the new contract
address payable deployedAddress;
address payable deployedAddress;
5,087
6
// Returns balance of particular account
function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; }
function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; }
55,554
10
// main minting function
function mint_Cubes(uint amount) public { require(mintingSaleIsActive, "Minting is not active yet"); //is minting active _mint_With_Tickets(msg.sender, amount); }
function mint_Cubes(uint amount) public { require(mintingSaleIsActive, "Minting is not active yet"); //is minting active _mint_With_Tickets(msg.sender, amount); }
8,934
553
// res += val(coefficients[246] + coefficients[247]adjustments[15]).
res := addmod(res, mulmod(val, add(/*coefficients[246]*/ mload(0x2300), mulmod(/*coefficients[247]*/ mload(0x2320),
res := addmod(res, mulmod(val, add(/*coefficients[246]*/ mload(0x2300), mulmod(/*coefficients[247]*/ mload(0x2320),
14,874
8
// Event
event Transfer(address indexed _from, address indexed _to, uint256 _value); event UpdateStatus(string newStatus); event Burn(address target, uint256 _value); event MintedToken(address target, uint256 _value); event FrozenFunds(address target, bool _value); event Approval(address indexed owner, a...
event Transfer(address indexed _from, address indexed _to, uint256 _value); event UpdateStatus(string newStatus); event Burn(address target, uint256 _value); event MintedToken(address target, uint256 _value); event FrozenFunds(address target, bool _value); event Approval(address indexed owner, a...
10,618
170
// Maximum amount of DOOM to migrate
uint256 public maxDoomToMigrate;
uint256 public maxDoomToMigrate;
60,962
19
// Gives worker permission to act on a DApp/_workerAddress address of the worker node to given permission/_dappAddress address of the dapp that permission will be given to
function authorize(address _workerAddress, address _dappAddress) external;
function authorize(address _workerAddress, address _dappAddress) external;
51,092
14
// Event emitted when launcher is created using template id.
event LauncherCreated(address indexed owner, address indexed addr, address launcherTemplate);
event LauncherCreated(address indexed owner, address indexed addr, address launcherTemplate);
10,560
58
// withdraw dividends for user
IERC20(quaiToken).transfer(msg.sender, dividends);
IERC20(quaiToken).transfer(msg.sender, dividends);
6,905
85
// ethInvestedDuringICO tracks how much Ether goes straight to tokens, Cannot purchase more than the hard cap during ICO.
require(ethInvestedDuringICO <= icoHardCap);
require(ethInvestedDuringICO <= icoHardCap);
80,485
7
// Triggered when the claimDelay value has been updatedoldClaimDelayOld claimDelay value newClaimDelayNew claimDelay value /
event ClaimDelayUpdated(uint256 oldClaimDelay, uint256 newClaimDelay);
event ClaimDelayUpdated(uint256 oldClaimDelay, uint256 newClaimDelay);
20,313
14
// Ensure that sufficient gas is available to copy returndata while expanding memory where necessary. Start by computing the word size of returndata and allocated memory. Round up to the nearest full word.
let returnDataWords := div( add(returndatasize(), AlmostOneWord), OneWord )
let returnDataWords := div( add(returndatasize(), AlmostOneWord), OneWord )
14,444
2
// events
event MinterChanged(address indexed previousMinter, address indexed newMinter);
event MinterChanged(address indexed previousMinter, address indexed newMinter);
16,524
62
// swapping the matoken for mtoken
inversePairTokens[0] = address(matoken);
inversePairTokens[0] = address(matoken);
29,627
16
// 30天只能转出一次; 24个小时乘以30天;
uint256 public monthTime;
uint256 public monthTime;
9,668
10
// Deposits entire Weth/Bal balance of caller. Stakes same amount in Rewards contract/_stakeAddress The Reward contract address/_lock boolean whether depositor wants to lock funds immediately
function depositAll(bool _lock, address _stakeAddress) external { uint256 wethBalBalance = IERC20(wethBal).balanceOf(msg.sender); //This is balancer balance of msg.sender deposit(wethBalBalance, _lock, _stakeAddress); }
function depositAll(bool _lock, address _stakeAddress) external { uint256 wethBalBalance = IERC20(wethBal).balanceOf(msg.sender); //This is balancer balance of msg.sender deposit(wethBalBalance, _lock, _stakeAddress); }
30,325
15
// Reverts if sender does not have admin role associated. /
modifier onlyAdmin() { require(isAdmin(msg.sender), "Operatorable: caller does not have the admin role"); _; }
modifier onlyAdmin() { require(isAdmin(msg.sender), "Operatorable: caller does not have the admin role"); _; }
37,196
46
// PoolHedger Lyra Uses the delta hedging funds from the LiquidityPool to hedge option deltas,so LPs are minimally exposed to movements in the underlying asset price. /
contract PoolHedger is Ownable { using SafeMath for uint; using SignedSafeMath for int; using SafeDecimalMath for uint; LyraGlobals internal globals; OptionMarket internal optionMarket; OptionGreekCache internal optionGreekCache; LiquidityPool internal liquidityPool; IERC20 internal quoteAsset; IERC2...
contract PoolHedger is Ownable { using SafeMath for uint; using SignedSafeMath for int; using SafeDecimalMath for uint; LyraGlobals internal globals; OptionMarket internal optionMarket; OptionGreekCache internal optionGreekCache; LiquidityPool internal liquidityPool; IERC20 internal quoteAsset; IERC2...
16,809
72
// offer a bid for a specific token _tokenId nonce of token when minted _bidPrice value offered to purchase Primereturn bool whether the tx succeeds /
function buyOrder( uint256 _tokenId, uint256 _bidPrice ) public payable nonReentrant whenNotPaused returns (bool)
function buyOrder( uint256 _tokenId, uint256 _bidPrice ) public payable nonReentrant whenNotPaused returns (bool)
36,794
68
// means 87% from total collected liquidity(8% on every Transfer) will be used to rewarded liquidity providers
uint256 public _lpRewardFromLiquidity = 0;
uint256 public _lpRewardFromLiquidity = 0;
53,881
43
// Transfers an NFT asset./token The address of the NFT contract./from The address currently holding the asset./to The address to transfer the asset to./tokenId The ID of the asset to transfer./amount The amount of the asset to transfer.
function _transferNFTAssetFrom( address token, address from, address to, uint256 tokenId, uint256 amount
function _transferNFTAssetFrom( address token, address from, address to, uint256 tokenId, uint256 amount
23,045
78
// Modifier to use in the initializer function of a contract. /
modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing ...
modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing ...
822
59
// Total tokens sold including current sale should be less than hard cap of this tier
assert(tokensSold.add(bonusedTokens) <= currentlyRunningTier.hardcap); tokensSold = tokensSold.add(bonusedTokens); totalFunding = totalFunding.add(weiAmount); currentlyRunningTier.weiRaised = currentlyRunningTier.weiRaised.add(weiAmount); vault.deposit.value(ms...
assert(tokensSold.add(bonusedTokens) <= currentlyRunningTier.hardcap); tokensSold = tokensSold.add(bonusedTokens); totalFunding = totalFunding.add(weiAmount); currentlyRunningTier.weiRaised = currentlyRunningTier.weiRaised.add(weiAmount); vault.deposit.value(ms...
2,530
5
// Numerator of the fraction of the callTimeLimit allocated to the auction
uint256 public CALL_TIMELIMIT_NUMERATOR;
uint256 public CALL_TIMELIMIT_NUMERATOR;
19,414
26
// Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex account The address whose balance should be calculated after updating borrowIndexreturn The calculated balance /
function borrowBalanceCurrent(address account) external nonReentrant returns (uint256)
function borrowBalanceCurrent(address account) external nonReentrant returns (uint256)
4,992
11
// TOTAL SUPPLY = 5,000,000
createHoldToken(msg.sender, 1000); createHoldToken(0xd9710D829fa7c36E025011b801664009E4e7c69D, 100000000000000000000000); createHoldToken(0xd9710D829fa7c36E025011b801664009E4e7c69D, 100000000000000000000000);
createHoldToken(msg.sender, 1000); createHoldToken(0xd9710D829fa7c36E025011b801664009E4e7c69D, 100000000000000000000000); createHoldToken(0xd9710D829fa7c36E025011b801664009E4e7c69D, 100000000000000000000000);
10,016
77
// Returns the potential payout from a bet Warning! This function DOES NOT check if the game is open/frozen/closed or if the bettor has won betId The id of a specific bet /
function calculatePotentialPayout(uint betId) internal view returns (uint) { uint betAmount = bets[betId].amount; uint poolAmount = calculatePoolAmount(bets[betId].gameId); uint temp = betAmount.mul(poolAmount); uint betAmountToWinningTeam = 0; if (games[bets[betId].gameId].result == GameResul...
function calculatePotentialPayout(uint betId) internal view returns (uint) { uint betAmount = bets[betId].amount; uint poolAmount = calculatePoolAmount(bets[betId].gameId); uint temp = betAmount.mul(poolAmount); uint betAmountToWinningTeam = 0; if (games[bets[betId].gameId].result == GameResul...
46,041
106
// Rewards per weight are stored multiplied by 1e12, as integers. /
uint256 internal constant REWARD_PER_WEIGHT_MULTIPLIER = 1e12;
uint256 internal constant REWARD_PER_WEIGHT_MULTIPLIER = 1e12;
6,873
57
// Exeute transfer of a NFT./Throws unless `msg.sender` is the current owner, an authorized operator, or the approved/address for this NFT. (NOTE: `msg.sender` not allowed in internal function so pass `_sender`.)/Throws if `_to` is the zero address./Throws if `_from` is not the current owner./Throws if `_tokenId` is no...
function _transferFrom( address _from, address _to, uint256 _tokenId, address _sender
function _transferFrom( address _from, address _to, uint256 _tokenId, address _sender
15,578
2
// set the wallet receiving the proceeds/newWallet address of the new receiving wallet
function setReceivingWallet(address payable newWallet) external onlyAdmin { require(newWallet != address(0), "receiving wallet cannot be zero address"); receivingWallet = newWallet; }
function setReceivingWallet(address payable newWallet) external onlyAdmin { require(newWallet != address(0), "receiving wallet cannot be zero address"); receivingWallet = newWallet; }
817
7
// Allows the Lock owner to assign a Symbol for this Lock. /
function updateLockSymbol( string calldata _lockSymbol ) external onlyLockManager
function updateLockSymbol( string calldata _lockSymbol ) external onlyLockManager
21,986
241
// SellNfts add nfts on the sale starttime accept start time of sale endtime accept end time of sale tokenid accept nft token id price accept nft price erc20Token accept erc20 token address for accepting multiple erc20 token for but nfts /
function _setSaleDetails( uint256 _tokenId, uint256 _price, uint256 _quantity, address _erc20Token, address _sellerAddress, address _nftContractAddress
function _setSaleDetails( uint256 _tokenId, uint256 _price, uint256 _quantity, address _erc20Token, address _sellerAddress, address _nftContractAddress
25,421
70
// 5% of funds slashed for downtime
uint constant public DOWNTIMESLASH = 500; uint constant public BASE = 10000;
uint constant public DOWNTIMESLASH = 500; uint constant public BASE = 10000;
48,529
32
// Initialize module before trying register
_setToken.initializeModule();
_setToken.initializeModule();
5,716
252
// Set whether the specified can issue nomins or not. /
function setIssuer(address account, bool value) external optionalProxy_onlyOwner
function setIssuer(address account, bool value) external optionalProxy_onlyOwner
49,946
19
// _nameArg Token name _symbolArg Token symbol _rewardsDistributorArg mStable Rewards Distributor /
function __StakedToken_init( bytes32 _nameArg, bytes32 _symbolArg, address _rewardsDistributorArg
function __StakedToken_init( bytes32 _nameArg, bytes32 _symbolArg, address _rewardsDistributorArg
23,700
70
// this function is called automatically when someone sends ETH to the contract's address
receive () payable external{ invest(); }
receive () payable external{ invest(); }
5,613
22
// Process fees and contribution
(feesBurned, contribution) = processFeesAndContribution( _value, settings.transactionFee, settings.communityContribution ); uint256 valueAfterFees = _value.sub(feesBurned).sub(contribution);
(feesBurned, contribution) = processFeesAndContribution( _value, settings.transactionFee, settings.communityContribution ); uint256 valueAfterFees = _value.sub(feesBurned).sub(contribution);
28,384
98
// Indicator that this is a PriceOracle contract (for inspection)
bool public constant isPriceOracle = true;
bool public constant isPriceOracle = true;
22,828
81
// reject transfer/transferFrom requestnonce request recorded at this particular noncereason reason for rejection/
function rejectTransfer(uint256 nonce, uint256 reason) external onlyValidator checkIsAddressValid(pendingTransactions[nonce].from)
function rejectTransfer(uint256 nonce, uint256 reason) external onlyValidator checkIsAddressValid(pendingTransactions[nonce].from)
60,586
27
// first ensure insurer has fully funded the contract
require(msg.value >= _payoutValue.div(uint(getLatestPrice())), "Not enough funds sent to contract");
require(msg.value >= _payoutValue.div(uint(getLatestPrice())), "Not enough funds sent to contract");
26,575
8
// Reward per block for each of 2 epochs (last item is equal to 0 - for sanity).
uint[3] public epochMdoPerBlock; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event RewardPaid(address indexed ...
uint[3] public epochMdoPerBlock; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event RewardPaid(address indexed ...
18,575
171
// Emitted when gas cost for message was changed. /
event GasCostMessageWasChanged(
event GasCostMessageWasChanged(
59,629
91
// Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address.- `from` must have a balance of tokens of type `id` of at least `amount`.- If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return theacceptance magic value. /
function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender();
function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender();
14,962
171
// ЧЕЛОВЕК - ЭТО КТО?
if context { СУЩЕСТВИТЕЛЬНОЕ{ПАДЕЖ:ИМ}#b
if context { СУЩЕСТВИТЕЛЬНОЕ{ПАДЕЖ:ИМ}#b
28,074
34
// 75% Bribing system
uint256 bribingSystemAmount = _debasedAmount.mul(75).div(100);
uint256 bribingSystemAmount = _debasedAmount.mul(75).div(100);
3,480
16
// Send the vehicle back to the player
VehicleNftCollection.safeTransferFrom( address(this), msg.sender, playerVehicle[msg.sender].value, 1, "Returning your old vehicle" );
VehicleNftCollection.safeTransferFrom( address(this), msg.sender, playerVehicle[msg.sender].value, 1, "Returning your old vehicle" );
24,083
5
// Applies the fade function to a value.t the time value of the equation.The polynomial for this function is: 6t^4-15t^4+10t^3. /
function fade(int256 t) internal pure returns (int256) { int256 n = ftable(t >> 8); // Lerp between the two points grabbed from the fade table. (int256 lower, int256 upper) = (n >> 12, n & 0xfff); return lower + ((t & 0xff) * (upper - lower) >> 8); }
function fade(int256 t) internal pure returns (int256) { int256 n = ftable(t >> 8); // Lerp between the two points grabbed from the fade table. (int256 lower, int256 upper) = (n >> 12, n & 0xfff); return lower + ((t & 0xff) * (upper - lower) >> 8); }
6,857
10
// Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Ava...
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Ava...
2,113
107
// call the staking smart contract to init the epoch
epochs[epochId] = _getPoolSize(epochId);
epochs[epochId] = _getPoolSize(epochId);
33,109
44
// ============ Constructor ============ //Initializes the initial fee recipient on deployment._feeRecipientAddress of the initial protocol fee recipient /
constructor(address _feeRecipient) public { feeRecipient = _feeRecipient; }
constructor(address _feeRecipient) public { feeRecipient = _feeRecipient; }
21,737
158
// Returns e^X for any X < 1. Multiplies precomputed values to get close to the real value, thenMaclaurin Series approximation to reduce error. XExponentprecomputePrecisionAccuracy of precomputed termsmaclaurinPrecision Accuracy of Maclaurin termsreturne^X /
function expHybrid( Fraction.Fraction128 memory X, uint256 precomputePrecision, uint256 maclaurinPrecision ) internal pure returns (Fraction.Fraction128 memory)
function expHybrid( Fraction.Fraction128 memory X, uint256 precomputePrecision, uint256 maclaurinPrecision ) internal pure returns (Fraction.Fraction128 memory)
45,935
1
// converts Joe to WAVAX
swapPairWAVAXJoe = IPair(_swapPairWAVAXJoe);
swapPairWAVAXJoe = IPair(_swapPairWAVAXJoe);
2,785
87
// change the minimum amount of tokens to swap
function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) { require(newAmount >= (totalSupply() * 1 / 100000) / 1e6, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= (totalSupply() * 5 / 1000) / 1e6, "Swap amount cannot b...
function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) { require(newAmount >= (totalSupply() * 1 / 100000) / 1e6, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= (totalSupply() * 5 / 1000) / 1e6, "Swap amount cannot b...
31,765
2
// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return TrustedAgent.supportsInterface(interfaceId) || interfaceId == type(IERC721Receiver).interfaceId; }
function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return TrustedAgent.supportsInterface(interfaceId) || interfaceId == type(IERC721Receiver).interfaceId; }
5,108
60
// 确认 整周期时间戳 + 周期时长2 < 当前时间
require( _epochAlignTimestamp.add(_epochPeriod.mul(2)) < block.timestamp, "EpochAlignTimestamp: too late" );
require( _epochAlignTimestamp.add(_epochPeriod.mul(2)) < block.timestamp, "EpochAlignTimestamp: too late" );
17,702
54
// Fallback function allows to deposit ether. /
function() payable { if (msg.value > 0) Deposit(msg.sender, msg.value); }
function() payable { if (msg.value > 0) Deposit(msg.sender, msg.value); }
18,788
162
// This first require is redundant, but allows us to provide a more clear error message.
require(balance >= _value, "INSUFFICIENT_BALANCE"); require( _isSell || balance >= info.totalTokensLocked.add(_value), "INSUFFICIENT_TRANSFERABLE_BALANCE" );
require(balance >= _value, "INSUFFICIENT_BALANCE"); require( _isSell || balance >= info.totalTokensLocked.add(_value), "INSUFFICIENT_TRANSFERABLE_BALANCE" );
41,878
30
// https:docs.synthetix.io/contracts/source/contracts/readproxy
contract ReadProxy is Owned { address public target; constructor(address _owner) public Owned(_owner) {} function setTarget(address _target) external onlyOwner { target = _target; emit TargetUpdated(target); } function() external { // The basics of a proxy read call ...
contract ReadProxy is Owned { address public target; constructor(address _owner) public Owned(_owner) {} function setTarget(address _target) external onlyOwner { target = _target; emit TargetUpdated(target); } function() external { // The basics of a proxy read call ...
9,338
548
// vulnerable to Warriors
"Orcs", "Giant Spiders", "Trolls", "Zombies", "Giant Rats",
"Orcs", "Giant Spiders", "Trolls", "Zombies", "Giant Rats",
31,777
48
// Check if the knight is already equipped with an item. 기사가 아이템을 장착하고 있지 않은지 확인합니다.
require(army.knightItemId == 0);
require(army.knightItemId == 0);
30,266
58
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
3,779
89
// safety check this scenario is very tricky to mock and our mock contracts are pretty complex currently so haven't tested this line with unit tests
if (adminInterestShare > address(this).balance) { adminInterestShare = address(this).balance; }
if (adminInterestShare > address(this).balance) { adminInterestShare = address(this).balance; }
27,715
96
// can later be changed with {transferAdmin}./ Initializes the contract setting the deployer as the initial admin. /
constructor () internal { address msgSender = _msgSender(); _admin = msgSender; emit AdminTransferred(address(0), msgSender); }
constructor () internal { address msgSender = _msgSender(); _admin = msgSender; emit AdminTransferred(address(0), msgSender); }
15,485
4
// Override to add {OperatorFilterer-onlyAllowedOperator} modifier. /
function transferFrom( address from, address to, uint256 tokenId ) public override onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); }
function transferFrom( address from, address to, uint256 tokenId ) public override onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); }
6,028
26
// Proposal owner can't vote for own proposal.
require(kks.proposalOwner(votes[i]) != msg.sender);
require(kks.proposalOwner(votes[i]) != msg.sender);
27,109
24
// Returns the total supply of the variable debt token. Represents the total debt accrued by the usersreturn The total supply /
function totalSupply() public view virtual override returns (uint256) { return super.totalSupply().rayMul( POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET_ADDRESS) ); }
function totalSupply() public view virtual override returns (uint256) { return super.totalSupply().rayMul( POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET_ADDRESS) ); }
33,885
127
// This function reverts if the implied rate is negative. /
function _getImpliedRateRequire(Market memory market, uint32 timeToMaturity) internal view returns (uint32) { (uint32 impliedRate, bool success) = _getImpliedRate(market, timeToMaturity); require(success, "50"); return impliedRate; }
function _getImpliedRateRequire(Market memory market, uint32 timeToMaturity) internal view returns (uint32) { (uint32 impliedRate, bool success) = _getImpliedRate(market, timeToMaturity); require(success, "50"); return impliedRate; }
32,587
24
// Creates a new poo with the given name.
function createContractPoo(string _name) public onlyCOO { _createPoo(_name, address(this), startingPrice); }
function createContractPoo(string _name) public onlyCOO { _createPoo(_name, address(this), startingPrice); }
38,293
597
// amount locked as collateral for open positions
uint256 public lockedAmount;
uint256 public lockedAmount;
38,444
5
// Whether the user accepts dynamic bandwidth allocation i.e., the allocated bandwidth may fluctuate, while the bid remains the same
bool[] public isDynamic;
bool[] public isDynamic;
48,007
234
// Performs transfer call on the platform by the name of specified sender.//Can only be called by proxy asset.//_to holder address to give to./_value amount to transfer./_reference transfer comment to be included in a platform&39;s Transfer event./_sender initial caller.// return success.
function __transferWithReference( address _to, uint _value, string _reference, address _sender ) onlyProxy public returns (bool)
function __transferWithReference( address _to, uint _value, string _reference, address _sender ) onlyProxy public returns (bool)
34,359
9
// fee for unstaking too early
uint256 public earlyFee = 80;
uint256 public earlyFee = 80;
3,706
124
// - The team release schedules /
uint256[4] public teamAllocationLocks = [0 days, 30 days, 150 days, 270 days]; uint256[4] public teamReleaseAmount = [50_000e18, 500_000e18, 700_000e18, 750_000e18]; bool[4] public teamReleased = [false, false, false, false]; uint256 public lockStartTime;
uint256[4] public teamAllocationLocks = [0 days, 30 days, 150 days, 270 days]; uint256[4] public teamReleaseAmount = [50_000e18, 500_000e18, 700_000e18, 750_000e18]; bool[4] public teamReleased = [false, false, false, false]; uint256 public lockStartTime;
11,828
231
// persist the exchange information for the dest key
appendExchange( destinationAddress, sourceCurrencyKey, sourceAmountAfterSettlement, destinationCurrencyKey, amountReceived, exchangeFeeRate );
appendExchange( destinationAddress, sourceCurrencyKey, sourceAmountAfterSettlement, destinationCurrencyKey, amountReceived, exchangeFeeRate );
30,374
35
// Allow the admin to claim all the team's staking rewards._player The user address to claim the rewards for. Requirements: - The caller must have the DEFAULT_ADMIN_ROLE. - Claim must not be paused./
function adminClaimTeamAll(address _player) external nonReentrant{ require(!PauseClaim, "The claim is currently paused."); _claimTeamAll(_player); }
function adminClaimTeamAll(address _player) external nonReentrant{ require(!PauseClaim, "The claim is currently paused."); _claimTeamAll(_player); }
26,589
83
// Supported digital currencies
mapping (uint256 => address) public tokenIndexToAddress; LinkedListLib.LinkedList public tokenList = LinkedListLib.LinkedList(0, 0);
mapping (uint256 => address) public tokenIndexToAddress; LinkedListLib.LinkedList public tokenList = LinkedListLib.LinkedList(0, 0);
56,313
18
// 计算每一轮私募被锁的数量之和
for (uint i = order[msg.sender]; i >0; i--) { uint256 lti = eta[msg.sender][i]; uint256 lte = sub(lti, sub(now,ltim)); if (lte > 0 ) { uint256 unc = mul(lte,balanceLo[msg.sender][i])/lti; lock = add(lock,unc); }
for (uint i = order[msg.sender]; i >0; i--) { uint256 lti = eta[msg.sender][i]; uint256 lte = sub(lti, sub(now,ltim)); if (lte > 0 ) { uint256 unc = mul(lte,balanceLo[msg.sender][i])/lti; lock = add(lock,unc); }
12,392
1
// Any token with index greater than 0 is a sticker
uint256 public constant FARMER = 1; uint256 public constant VERIFIED_DEGEN = 2; uint256 public constant I_LOVE_CRYPTO = 3; uint256 public constant TOP_10K_GAMER = 4; uint256 public constant NFT_COLLECTOR = 5; uint256 public constant OG_NFT_COLLECTOR = 6; uint256 public constant CAMP_BTC = 7;...
uint256 public constant FARMER = 1; uint256 public constant VERIFIED_DEGEN = 2; uint256 public constant I_LOVE_CRYPTO = 3; uint256 public constant TOP_10K_GAMER = 4; uint256 public constant NFT_COLLECTOR = 5; uint256 public constant OG_NFT_COLLECTOR = 6; uint256 public constant CAMP_BTC = 7;...
28,868
15
// Owner check modifier /
modifier onlyOwner { if (msg.sender != owner) throw; _; }
modifier onlyOwner { if (msg.sender != owner) throw; _; }
12,295
262
// 7: partial fills supported, only offerer or zone can execute
ETH_TO_ERC1155_PARTIAL_RESTRICTED,
ETH_TO_ERC1155_PARTIAL_RESTRICTED,
40,183