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 |
|---|---|---|---|---|
141 | // stashId to stash stashId = keccak256(index) | mapping(bytes32 => Stash) public stashes;
| mapping(bytes32 => Stash) public stashes;
| 41,784 |
94 | // First withdraw all rewards, than withdarw it all, then stake back the remaining. / | function withdraw(uint256 amount) external override virtual returns (bool) {
address _staker = msg.sender;
return _withdraw(_staker, amount);
}
| function withdraw(uint256 amount) external override virtual returns (bool) {
address _staker = msg.sender;
return _withdraw(_staker, amount);
}
| 8,356 |
173 | // The maximum that the token supply can be increased to through the use of the limited printing feature. The difference between the current total supply and the supply ceiling is what is available to the 'controller' account. The value of the ceiling can only be increased by the custodian./ | uint256 public totalSupplyCeiling;
| uint256 public totalSupplyCeiling;
| 11,052 |
0 | // For tree logic we need start id from 1 not 0; | _tokenIdTracker.increment();
| _tokenIdTracker.increment();
| 23,446 |
133 | // Recover signer's address from a EIP712 signature domainSeparator Domain separator v v of the signature r r of the signature s s of the signature typeHashAndData Type hash concatenated with datareturn Signer's address / | function recover(
bytes32 domainSeparator,
uint8 v,
bytes32 r,
bytes32 s,
bytes memory typeHashAndData
| function recover(
bytes32 domainSeparator,
uint8 v,
bytes32 r,
bytes32 s,
bytes memory typeHashAndData
| 25,085 |
204 | // Creates a non-upgradeable token proxy for PermitableToken.sol, initializes its eternalStorage. _tokenImage address of the token image used for mirroring all functions. _name token name. _symbol token symbol. _decimals token decimals. _chainId chain id for current network. _owner address of the owner for this contract. / | constructor(
address _tokenImage,
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _chainId,
address _owner
| constructor(
address _tokenImage,
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _chainId,
address _owner
| 8,961 |
83 | // Updates masks for instant pot./_gameID Game ID of the game./_pID Player ID of the player./_team Team ID of the team./_gen Amount of ETH to be added into instant pot./_keys Number of keys bought./ return Dust left over. | function updateMasks(uint256 _gameID, uint256 _pID, uint256 _team, uint256 _gen, uint256 _keys)
private
returns(uint256)
| function updateMasks(uint256 _gameID, uint256 _pID, uint256 _team, uint256 _gen, uint256 _keys)
private
returns(uint256)
| 18,995 |
117 | // Present in ERC777 | mapping(address => uint256) internal _balances;
| mapping(address => uint256) internal _balances;
| 29,891 |
2 | // 30_000 evt tokens minimal investment | uint public nodePrice = 30000 * 10**18;
uint public lockedUntil;
mapping(address => mapping(string => uint)) lockingData;
event Withdrawn(address indexed withdrawer, uint indexed withdrawnAmount);
event FundsLocked(
address indexed user,
uint indexed lockedAmount,
uint indexed validationNodes
| uint public nodePrice = 30000 * 10**18;
uint public lockedUntil;
mapping(address => mapping(string => uint)) lockingData;
event Withdrawn(address indexed withdrawer, uint indexed withdrawnAmount);
event FundsLocked(
address indexed user,
uint indexed lockedAmount,
uint indexed validationNodes
| 2,109 |
10 | // return (b / 2).add(a.mul(precision)).div(b); | return (a * precision) / b;
| return (a * precision) / b;
| 9,381 |
21 | // Returns the downcasted uint88 from uint256, reverting onoverflow (when the input is greater than largest uint88). Counterpart to Solidity's `uint88` operator. Requirements: - input must fit into 88 bits _Available since v4.7._ / | function toUint88(uint256 value) internal pure returns (uint88) {
require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
return uint88(value);
}
| function toUint88(uint256 value) internal pure returns (uint88) {
require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
return uint88(value);
}
| 3,976 |
235 | // Withdraws all the accumulated payments received by the contract and transfers it to the Owner . (Unicus Platform)Calling conditions: - Only the owner of the smart contract i.e Unicus platform can invoke this / | function withdraw() public payable onlyOwner {
uint256 withdrawBalance = address(this).balance - _getOngoingAuctionsBalances(false);
_transferETH(msg.sender,withdrawBalance);
}
| function withdraw() public payable onlyOwner {
uint256 withdrawBalance = address(this).balance - _getOngoingAuctionsBalances(false);
_transferETH(msg.sender,withdrawBalance);
}
| 11,969 |
149 | // Swap collateral for debt asset | _swapTokensForExactTokens(collateralAsset, debtAsset, amounts[0], amountToRepay, useEthPath);
| _swapTokensForExactTokens(collateralAsset, debtAsset, amounts[0], amountToRepay, useEthPath);
| 39,433 |
35 | // Artefacts | function createArtefact(uint256 _artefactId) public onlyEternalStorageContract {
artefacts.push(_artefactId);
}
| function createArtefact(uint256 _artefactId) public onlyEternalStorageContract {
artefacts.push(_artefactId);
}
| 45,793 |
44 | // Transfers `amountRequested` of accrued `rewardToken` rewards from the contract to the recipient `to`/rewardToken The token being distributed as a reward/to The address where claimed rewards will be sent to/amountRequested The amount of reward tokens to claim. Claims entire reward amount if set to 0./ return reward The amount of reward tokens claimed | function claimReward(
IERC20Minimal rewardToken,
address to,
uint256 amountRequested
) external returns (uint256 reward);
| function claimReward(
IERC20Minimal rewardToken,
address to,
uint256 amountRequested
) external returns (uint256 reward);
| 32,489 |
2 | // Modify method to only allow the owner to call it. / | modifier onlyOwner {
require(msg.sender == owner);
_;
}
| modifier onlyOwner {
require(msg.sender == owner);
_;
}
| 1,392 |
153 | // Get collateral locked and normalised debt [wad] [wad] | (uint256 ink, uint256 art) = VatLike(vat).urns(ilk, urn);
| (uint256 ink, uint256 art) = VatLike(vat).urns(ilk, urn);
| 48,405 |
14 | // Get a string._context The context. _key The key. return The value. / | function getString(address _context, bytes32 _key) public view virtual returns (string memory);
| function getString(address _context, bytes32 _key) public view virtual returns (string memory);
| 2,743 |
38 | // in case index is sufficient emit event | if (idx != 0) {
emit eupdate(participant.addr, participant.amnt, idx);
}
| if (idx != 0) {
emit eupdate(participant.addr, participant.amnt, idx);
}
| 263 |
396 | // Sender redeems cTokens in exchange for a specified amount of underlying assetAccrues interest whether or not the operation succeeds, unless revertedredeemAmount The amount of underlying to receive from redeeming cTokens return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | // function redeemUnderlyingInternal(uint redeemAmount) internal nonReentrant returns (uint) {
// uint error = accrueInterest();
// if (error != uint(Error.NO_ERROR)) {
// // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
// return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
// }
// // redeemFresh emits redeem-specific logs on errors, so we don't need to
// return redeemFresh(msg.sender, 0, redeemAmount);
// }
| // function redeemUnderlyingInternal(uint redeemAmount) internal nonReentrant returns (uint) {
// uint error = accrueInterest();
// if (error != uint(Error.NO_ERROR)) {
// // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
// return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
// }
// // redeemFresh emits redeem-specific logs on errors, so we don't need to
// return redeemFresh(msg.sender, 0, redeemAmount);
// }
| 74,592 |
9 | // Check for overflows | require(_balanceOf[_to] + _value > _balanceOf[_to]);
| require(_balanceOf[_to] + _value > _balanceOf[_to]);
| 5,813 |
15 | // function to get random index from random word supplied from VRF/modulo bias is insignificant for entries less than 100 billion | function _getRandomIndex(uint256 randomWord, uint256 maxIndex) internal pure returns(uint256) {
return randomWord % maxIndex;
}
| function _getRandomIndex(uint256 randomWord, uint256 maxIndex) internal pure returns(uint256) {
return randomWord % maxIndex;
}
| 34,153 |
29 | // Adds new priceUpdaters and remove existing ones./priceUpdatersToAdd The addresses of the priceUpdaters that are now allowed/ to send fee updates./priceUpdatersToRemove The addresses of the priceUpdaters that are no longer allowed/ to send fee updates. | function applyPriceUpdatersUpdates(
address[] memory priceUpdatersToAdd,
address[] memory priceUpdatersToRemove
| function applyPriceUpdatersUpdates(
address[] memory priceUpdatersToAdd,
address[] memory priceUpdatersToRemove
| 19,931 |
173 | // Add single address to whitelist / | function singleAddressToWhiteList(address userAddress) public onlyOwner {
require(userAddress != address(0), "Address can not be zero");
whitelist[userAddress] = true;
totalWhitelist++;
}
| function singleAddressToWhiteList(address userAddress) public onlyOwner {
require(userAddress != address(0), "Address can not be zero");
whitelist[userAddress] = true;
totalWhitelist++;
}
| 12,688 |
48 | // The function can be called only before or after the tokens have been releasesd / | modifier inReleaseState(bool releaseState) {
if(releaseState != released) {
revert();
}
_;
}
| modifier inReleaseState(bool releaseState) {
if(releaseState != released) {
revert();
}
_;
}
| 5,143 |
19 | // Returns the integer division of two unsigned integers. Reverts on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Requirements: - The divisor cannot be zero./ | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
| 371 |
39 | // 10000 is a x1 multiplier. | require(_multiplierBonus >= 10000, "addYieldMultiplier: invalid multiplier");
if(!yieldMultipliers[_amount].registered){
yieldAmounts.push(_amount);
}
| require(_multiplierBonus >= 10000, "addYieldMultiplier: invalid multiplier");
if(!yieldMultipliers[_amount].registered){
yieldAmounts.push(_amount);
}
| 13,544 |
155 | // Enter the market | address[] memory cTokens = new address[](1);
cTokens[0] = _ctoken;
comptroller.enterMarkets(cTokens);
| address[] memory cTokens = new address[](1);
cTokens[0] = _ctoken;
comptroller.enterMarkets(cTokens);
| 12,739 |
13 | // fyToken reserves, cached. | uint104 internal fyTokenCached;
| uint104 internal fyTokenCached;
| 29,354 |
2 | // Hash all the public data to a single value which is used as the input for the circuit | publicDataHashes[i] = blocks[i].data.fastSHA256();
| publicDataHashes[i] = blocks[i].data.fastSHA256();
| 27,508 |
7 | // Sets freeze window Only callable from owner / | function setFreezeWindow(uint256 _freezeWindow) onlyIfWhitelisted(msg.sender) public {
freezeWindow = _freezeWindow;
}
| function setFreezeWindow(uint256 _freezeWindow) onlyIfWhitelisted(msg.sender) public {
freezeWindow = _freezeWindow;
}
| 55,746 |
60 | // returns current status of a claim | function policyStatus(address claimer, address policyBookAddress)
external
view
returns (ClaimStatus);
| function policyStatus(address claimer, address policyBookAddress)
external
view
returns (ClaimStatus);
| 26,534 |
2 | // owner -> spender -> max amount | mapping(address => mapping(address => uint256)) s_allowances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
| mapping(address => mapping(address => uint256)) s_allowances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
| 26,950 |
168 | // public variables and constants | bool public saleIsActive = false;
bool public presaleIsActive = true;
bool public claimGiftActive = false;
uint256 constant public TOTAL_SUPPLY = 10102;
uint256 public maxPublicMintPerTx = 20;
uint256 public price = 0.08 ether;
string public provenance = '';
| bool public saleIsActive = false;
bool public presaleIsActive = true;
bool public claimGiftActive = false;
uint256 constant public TOTAL_SUPPLY = 10102;
uint256 public maxPublicMintPerTx = 20;
uint256 public price = 0.08 ether;
string public provenance = '';
| 75,427 |
190 | // Pending withdrawals index range that were added in the verifyBlock operation./ NOTE: processed indexes in the queue map are [queueStartIndex, queueEndIndex) | event PendingWithdrawalsAdd(
uint32 queueStartIndex,
uint32 queueEndIndex
);
| event PendingWithdrawalsAdd(
uint32 queueStartIndex,
uint32 queueEndIndex
);
| 29,767 |
95 | // exclude from max tx | _isExcludedFromMaxTx[owner()] = true;
_isExcludedFromMaxTx[address(this)] = true;
_isExcludedFromMaxTx[address(0x000000000000000000000000000000000000dEaD)] = true;
_isExcludedFromMaxTx[address(0)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
| _isExcludedFromMaxTx[owner()] = true;
_isExcludedFromMaxTx[address(this)] = true;
_isExcludedFromMaxTx[address(0x000000000000000000000000000000000000dEaD)] = true;
_isExcludedFromMaxTx[address(0)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
| 9,778 |
24 | // Zap two tokens in, rebalance them to 50-50, before adding them to LP _token0ToZap: address of token0 to zap _token1ToZap: address of token1 to zap _token0AmountIn: amount of token0 to zap _token1AmountIn: amount of token1 to zap _lpToken: LP token address (token0/token1) _tokenAmountInMax: maximum token amount to sell (in token to sell in the intermediary swap) _tokenAmountOutMin: minimum token to receive in the intermediary swap _isToken0Sold: whether token0 is expected to be sold (if false, sell token1) / | function zapInTokenRebalancing(
address _token0ToZap,
address _token1ToZap,
uint256 _token0AmountIn,
uint256 _token1AmountIn,
address _lpToken,
uint256 _tokenAmountInMax,
uint256 _tokenAmountOutMin,
bool _isToken0Sold
| function zapInTokenRebalancing(
address _token0ToZap,
address _token1ToZap,
uint256 _token0AmountIn,
uint256 _token1AmountIn,
address _lpToken,
uint256 _tokenAmountInMax,
uint256 _tokenAmountOutMin,
bool _isToken0Sold
| 11,804 |
19 | // Check if dictionary contains fixed value at key. O(1). dictionary The PolymorphicDictionary. _key The bytes32 key. _value The bytes32 value.return true if value exists at key. / | function containsValueForKey(
PolymorphicDictionary storage dictionary,
bytes32 _key,
bytes32 _value
| function containsValueForKey(
PolymorphicDictionary storage dictionary,
bytes32 _key,
bytes32 _value
| 56,163 |
117 | // The traffick TOKEN! | TraffickToken public traffick;
| TraffickToken public traffick;
| 21,905 |
17 | // Add wallet to frozen wallets | frozenWallets[wallet] = frozenWallet;
| frozenWallets[wallet] = frozenWallet;
| 28,156 |
114 | // Burn a specified amount of STEALTH tokens/Used only by contracts for extending token utility/from The account to burn tokens from/amount The amount of tokens to burn | function burn(address from, uint256 amount) external onlyAllowed {
_burn(from, amount);
}
| function burn(address from, uint256 amount) external onlyAllowed {
_burn(from, amount);
}
| 66,611 |
4 | // 用户 | struct User
| struct User
| 7,646 |
65 | // struct to store each Colonist's traits | struct Pirate {
bool isPirate;
uint8 sky;
uint8 cockpit;
uint8 base;
uint8 engine;
uint8 nose;
uint8 wing;
uint8 weapon1;
uint8 weapon2;
| struct Pirate {
bool isPirate;
uint8 sky;
uint8 cockpit;
uint8 base;
uint8 engine;
uint8 nose;
uint8 wing;
uint8 weapon1;
uint8 weapon2;
| 57,577 |
4 | // You can declare an immutable, static array | uint[1] fixed_array;
| uint[1] fixed_array;
| 49,655 |
17 | // sub totalSupply when burn token | if (to == address(0)) {
| if (to == address(0)) {
| 5,025 |
380 | // protocol: context of the claim | string protocol;
| string protocol;
| 37,076 |
113 | // 查询组建期信息 | function getBuildingPerioInfo()
public
view
returns(uint256, uint256, uint256, uint256)
| function getBuildingPerioInfo()
public
view
returns(uint256, uint256, uint256, uint256)
| 53,092 |
50 | // Calculate the contract owner's fee Tested in test/test_fee.js | function fee (uint amount) public pure returns (uint) {
if (amount < 0.01 ether) {
return 0;
} else if (amount >= 0.01 ether && amount < 0.1 ether) {
return SafeMath.div(amount, 100000);
} else if (amount >= 0.1 ether && amount < 1 ether) {
return SafeMath.div(amount, 10000);
} else if (amount >= 1 ether) {
return SafeMath.div(amount, 1000);
}
}
| function fee (uint amount) public pure returns (uint) {
if (amount < 0.01 ether) {
return 0;
} else if (amount >= 0.01 ether && amount < 0.1 ether) {
return SafeMath.div(amount, 100000);
} else if (amount >= 0.1 ether && amount < 1 ether) {
return SafeMath.div(amount, 10000);
} else if (amount >= 1 ether) {
return SafeMath.div(amount, 1000);
}
}
| 29,280 |
7 | // : ARGUuuuuuuuuuuuuuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
require(
_exists(_tokenId),
"ERC721Metadata: URI set of nonexistent token"
);
return string(abi.encodePacked(baseURI, _tokenId.toString(), ".json"));
}
| function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
require(
_exists(_tokenId),
"ERC721Metadata: URI set of nonexistent token"
);
return string(abi.encodePacked(baseURI, _tokenId.toString(), ".json"));
}
| 35,235 |
24 | // View function to see pending brews on frontend. | function pendingRewards(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accTokenPerShare = pool.accTokenPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply > 0 && totalAllocPoint > 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number, pool.bonusEndBlock);
uint256 brewsReward = (multiplier * rewardPerBlock * pool.allocPoint) / totalAllocPoint;
accTokenPerShare += (brewsReward * 1e12) / lpSupply;
}
return (user.amount * accTokenPerShare) / 1e12 - user.rewardDebt;
}
| function pendingRewards(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accTokenPerShare = pool.accTokenPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply > 0 && totalAllocPoint > 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number, pool.bonusEndBlock);
uint256 brewsReward = (multiplier * rewardPerBlock * pool.allocPoint) / totalAllocPoint;
accTokenPerShare += (brewsReward * 1e12) / lpSupply;
}
return (user.amount * accTokenPerShare) / 1e12 - user.rewardDebt;
}
| 7,821 |
245 | // Returns the estimated per-sec borrow interest rate for this jToken after some changereturn The borrow interest rate per sec, scaled by 1e18 / | function estimateBorrowRatePerSecondAfterChange(uint256 change, bool repay) external view returns (uint256) {
uint256 cashPriorNew;
uint256 totalBorrowsNew;
if (repay) {
cashPriorNew = add_(getCashPrior(), change);
totalBorrowsNew = sub_(totalBorrows, change);
} else {
cashPriorNew = sub_(getCashPrior(), change);
totalBorrowsNew = add_(totalBorrows, change);
}
return interestRateModel.getBorrowRate(cashPriorNew, totalBorrowsNew, totalReserves);
}
| function estimateBorrowRatePerSecondAfterChange(uint256 change, bool repay) external view returns (uint256) {
uint256 cashPriorNew;
uint256 totalBorrowsNew;
if (repay) {
cashPriorNew = add_(getCashPrior(), change);
totalBorrowsNew = sub_(totalBorrows, change);
} else {
cashPriorNew = sub_(getCashPrior(), change);
totalBorrowsNew = add_(totalBorrows, change);
}
return interestRateModel.getBorrowRate(cashPriorNew, totalBorrowsNew, totalReserves);
}
| 33,144 |
46 | // Returns staker info by specified address/If staker info is empty sets last rewards claim timestamp to the current date/ for proper rewards calculation/_stakerAddress staker's address/ return memory staker struct | function _getStakerWithRecalculatedRewards(address _stakerAddress)
private
view
returns (Staker memory)
| function _getStakerWithRecalculatedRewards(address _stakerAddress)
private
view
returns (Staker memory)
| 10,037 |
135 | // 0 for newQuota indicates unlimited quota, or daily quota is disabled. | function changeQuota(
address wallet,
uint newQuota,
uint effectiveTime
)
external
onlyWalletModule(wallet)
| function changeQuota(
address wallet,
uint newQuota,
uint effectiveTime
)
external
onlyWalletModule(wallet)
| 9,542 |
20 | // next, make sure order of rounds is correct | require(previousPriceTimestamp < priceTimestamp, "Previous price timetamp must be less than answer timestamp");
require(priceTimestamp < nextPriceTimestamp, "Answer timetamp must be less than next round timestamp");
| require(previousPriceTimestamp < priceTimestamp, "Previous price timetamp must be less than answer timestamp");
require(priceTimestamp < nextPriceTimestamp, "Answer timetamp must be less than next round timestamp");
| 10,192 |
47 | // It allows users to deposit LP tokens to pool _pid: pool id _token: payment token _amount: the number of payment token being deposited _minUsdAmount: minimum USD amount that must be converted from deposit token not to revert _deadline: unix timestamp after which the transaction will revert / | function depositPool(uint8 _pid, address _token, uint256 _amount, uint256 _minUsdAmount, uint256 _deadline) external payable nonReentrant notContract ensure(_deadline) {
// Checks whether the pool id is valid
require(_pid < NUMBER_POOLS, "Deposit: Non valid pool id");
// Checks that pool was set
require(
_poolInformation[_pid].offeringAmountPool > 0 && _poolInformation[_pid].raisingAmountPool > 0,
"Deposit: Pool not set"
);
// Checks whether the block timestamp is not too early
require(block.timestamp > _poolInformation[_pid].startTime, "Deposit: Too early");
// Checks whether the block timestamp is not too late
require(block.timestamp < _poolInformation[_pid].endTime, "Deposit: Too late");
if(_token == address(0)) {
_amount = msg.value;
}
// Checks that the amount deposited is not inferior to 0
require(_amount > 0, "Deposit: Amount must be > 0");
require(
!isWhitelistSale[_pid] || _isQualifiedWhitelist(msg.sender),
"Deposit: Must be whitelisted"
);
if (_token != address(0)) {
// Transfers funds to this contract
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
}
uint256 usdAmount = computeUSDAmount(_token, _amount);
require(usdAmount >= _minUsdAmount, 'Deposit: Insufficient USD amount');
// Update the user status
_userInfo[msg.sender][_pid].amountPool = _userInfo[msg.sender][_pid].amountPool.add(usdAmount);
// Check if the pool has a limit per user
if (_poolInformation[_pid].limitPerUserInLP > 0) {
// Checks whether the limit has been reached
require(
_userInfo[msg.sender][_pid].amountPool <= _poolInformation[_pid].limitPerUserInLP,
"Deposit: New amount above user limit"
);
}
// Updates the totalAmount for pool
_poolInformation[_pid].totalAmountPool = _poolInformation[_pid].totalAmountPool.add(usdAmount);
require(
_poolInformation[_pid].totalAmountPool <= _poolInformation[_pid].raisingAmountPool,
"Deposit: Exceed pool raising amount"
);
emit Deposit(msg.sender, _token, _amount, usdAmount, _pid);
}
| function depositPool(uint8 _pid, address _token, uint256 _amount, uint256 _minUsdAmount, uint256 _deadline) external payable nonReentrant notContract ensure(_deadline) {
// Checks whether the pool id is valid
require(_pid < NUMBER_POOLS, "Deposit: Non valid pool id");
// Checks that pool was set
require(
_poolInformation[_pid].offeringAmountPool > 0 && _poolInformation[_pid].raisingAmountPool > 0,
"Deposit: Pool not set"
);
// Checks whether the block timestamp is not too early
require(block.timestamp > _poolInformation[_pid].startTime, "Deposit: Too early");
// Checks whether the block timestamp is not too late
require(block.timestamp < _poolInformation[_pid].endTime, "Deposit: Too late");
if(_token == address(0)) {
_amount = msg.value;
}
// Checks that the amount deposited is not inferior to 0
require(_amount > 0, "Deposit: Amount must be > 0");
require(
!isWhitelistSale[_pid] || _isQualifiedWhitelist(msg.sender),
"Deposit: Must be whitelisted"
);
if (_token != address(0)) {
// Transfers funds to this contract
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
}
uint256 usdAmount = computeUSDAmount(_token, _amount);
require(usdAmount >= _minUsdAmount, 'Deposit: Insufficient USD amount');
// Update the user status
_userInfo[msg.sender][_pid].amountPool = _userInfo[msg.sender][_pid].amountPool.add(usdAmount);
// Check if the pool has a limit per user
if (_poolInformation[_pid].limitPerUserInLP > 0) {
// Checks whether the limit has been reached
require(
_userInfo[msg.sender][_pid].amountPool <= _poolInformation[_pid].limitPerUserInLP,
"Deposit: New amount above user limit"
);
}
// Updates the totalAmount for pool
_poolInformation[_pid].totalAmountPool = _poolInformation[_pid].totalAmountPool.add(usdAmount);
require(
_poolInformation[_pid].totalAmountPool <= _poolInformation[_pid].raisingAmountPool,
"Deposit: Exceed pool raising amount"
);
emit Deposit(msg.sender, _token, _amount, usdAmount, _pid);
}
| 36,378 |
15 | // Require that the new implementation is different from the current one | require(implementation != _newImplementation, "!upgrade");
| require(implementation != _newImplementation, "!upgrade");
| 15,198 |
2 | // shares | address[] private addressList = [
0xE584197e8feD912e22BbcB880a8dAC6949ccb990,
0xEcc03efB7C0A7BD09A5cC7e954Ac42E8f949A0B5,
0xFF755FAfD67F65Ae9Cc9E3bE755323503deb5D34,
0x20b2ea382e9C6d82673fc276543Db0574DcB510C,
0xB3B85E05B35514963Bc441BEcA39b7E19179FD80,
0x417D8FDA9cc2F83415FDa095457ADFd6Bdc0d7ca
];
uint[] private shareList = [
| address[] private addressList = [
0xE584197e8feD912e22BbcB880a8dAC6949ccb990,
0xEcc03efB7C0A7BD09A5cC7e954Ac42E8f949A0B5,
0xFF755FAfD67F65Ae9Cc9E3bE755323503deb5D34,
0x20b2ea382e9C6d82673fc276543Db0574DcB510C,
0xB3B85E05B35514963Bc441BEcA39b7E19179FD80,
0x417D8FDA9cc2F83415FDa095457ADFd6Bdc0d7ca
];
uint[] private shareList = [
| 30,270 |
36 | // store six 4-hour intervals including the current hour sorted from oldest to newest | else {
for (uint256 i = 0; i < 6; i++) {
units[i] = ethDT.getHour(
| else {
for (uint256 i = 0; i < 6; i++) {
units[i] = ethDT.getHour(
| 34,588 |
118 | // Event emitted when the reserves are reduced / | event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);
| event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);
| 801 |
134 | // hasBeenLinked(): returns true if the point has ever been assigned keys | function hasBeenLinked(uint32 _point)
view
external
returns (bool result)
| function hasBeenLinked(uint32 _point)
view
external
returns (bool result)
| 2,022 |
109 | // Umbrella Airdrop contract/ umb.network/ This contract provides Airdrop capability. | abstract contract Airdrop is ERC20 {
function airdropTokens(
address[] calldata _addresses,
uint256[] calldata _amounts
) external {
require(_addresses.length != 0, "there are no _addresses");
require(_addresses.length == _amounts.length, "the number of _addresses should match _amounts");
for(uint i = 0; i < _addresses.length; i++) {
transfer(_addresses[i], _amounts[i]);
}
}
}
| abstract contract Airdrop is ERC20 {
function airdropTokens(
address[] calldata _addresses,
uint256[] calldata _amounts
) external {
require(_addresses.length != 0, "there are no _addresses");
require(_addresses.length == _amounts.length, "the number of _addresses should match _amounts");
for(uint i = 0; i < _addresses.length; i++) {
transfer(_addresses[i], _amounts[i]);
}
}
}
| 24,098 |
238 | // Creates and begins a new auction./_tokenId - ID of token to auction, sender must be owner./_startingPrice - Price of item (in wei) at beginning of auction./_endingPrice - Price of item (in wei) at end of auction./_duration - Length of time to move between starting/price and ending price (in seconds)./_seller - Seller, if not the message sender | function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
whenNotPaused
| function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
whenNotPaused
| 14,688 |
7 | // total user long call exposure | uint longCall;
| uint longCall;
| 15,874 |
50 | // Atomically increases the allowance granted to 'spender' by the caller. | * This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
| * This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - 'spender' cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
| 15,010 |
4 | // Returns whether lazy minting can be performed in the given execution context. | function _canLazyMint() internal view virtual returns (bool);
| function _canLazyMint() internal view virtual returns (bool);
| 542 |
268 | // 看跌 | else {
left = balance * (1 + LEVER);
right = (balance * oraclePrice * LEVER << 64) / basePrice / _expMiuT(baseBlock);
}
| else {
left = balance * (1 + LEVER);
right = (balance * oraclePrice * LEVER << 64) / basePrice / _expMiuT(baseBlock);
}
| 26,694 |
139 | // Receive the correct proportion of the rewards | if (userRewards > 0) {
userRewards = userRewards.mul(p).div(1e18);
}
| if (userRewards > 0) {
userRewards = userRewards.mul(p).div(1e18);
}
| 3,803 |
112 | // Adding unclaimed $BBONES to claimableBalance | claimableBalance[msg.sender] += getTokenUPNL(tokenId, msg.sender);
stakeHolders[msg.sender].tokenStakeBlock[tokenId] = 0;
uint tokensCount = stakeHolders[msg.sender].stakedTokens.length;
uint[] memory newStakedTokens = new uint[](tokensCount - 1);
uint j = 0;
for (uint i = 0; i < tokensCount; i++) {
| claimableBalance[msg.sender] += getTokenUPNL(tokenId, msg.sender);
stakeHolders[msg.sender].tokenStakeBlock[tokenId] = 0;
uint tokensCount = stakeHolders[msg.sender].stakedTokens.length;
uint[] memory newStakedTokens = new uint[](tokensCount - 1);
uint j = 0;
for (uint i = 0; i < tokensCount; i++) {
| 40,785 |
255 | // Transfer `_amount` tokens ot type `_type` between accounts `_from` and `_to`. / | function transferFor(
address _from,
address _to,
uint256 _type,
uint256 _amount
| function transferFor(
address _from,
address _to,
uint256 _type,
uint256 _amount
| 37,437 |
927 | // Price not cut in half | tmpPrice = tmpPrice.mul(2);
| tmpPrice = tmpPrice.mul(2);
| 19,319 |
81 | // Gets all facet addresses and their four byte function selectors./ return facets_ Facet | function facets() external view returns (Facet[] memory facets_);
| function facets() external view returns (Facet[] memory facets_);
| 14,633 |
339 | // Returns the asset balance on the vault. This balance is freely withdrawable by users. / | function assetBalance() public view returns (uint256) {
return IERC20(asset).balanceOf(address(this));
}
| function assetBalance() public view returns (uint256) {
return IERC20(asset).balanceOf(address(this));
}
| 40,163 |
22 | // Burn print on v1, should receive the funds here | IEulerBeats(EulerBeats).burnPrint(seed, minimumSupply);
| IEulerBeats(EulerBeats).burnPrint(seed, minimumSupply);
| 6,964 |
0 | // ChainlinkRound type | struct ChainlinkRound {
uint256 timestamp;
int256 answer;
uint256 roundId;
}
| struct ChainlinkRound {
uint256 timestamp;
int256 answer;
uint256 roundId;
}
| 19,693 |
47 | // The resolved pair based on the order pair alias | OrderPair pair;
OrderFlags flags;
| OrderPair pair;
OrderFlags flags;
| 56,989 |
56 | // Transferring excessess back to the sender | msg.sender.transfer(purchaseExcess);
| msg.sender.transfer(purchaseExcess);
| 2,105 |
13 | // Withdraws Ether for the owner. | function withdraw() public onlyOwner {
uint256 amount = address(this).balance;
payable(msg.sender).transfer(amount);
}
| function withdraw() public onlyOwner {
uint256 amount = address(this).balance;
payable(msg.sender).transfer(amount);
}
| 31,657 |
330 | // Sending Token to contract(Consider fee token) | amount = transferAssetToContract(invariantData.sendingAssetId, amount);
| amount = transferAssetToContract(invariantData.sendingAssetId, amount);
| 37,191 |
1 | // aka stackOf | mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Approval(address indexed src, address indexed usr, uint256 wad);
event Transfer(address indexed src, address indexed dst, uint256 wad);
| mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Approval(address indexed src, address indexed usr, uint256 wad);
event Transfer(address indexed src, address indexed dst, uint256 wad);
| 18,762 |
226 | // misc /return info about how much DTH the shop has staked | function getStakedShop(address _shop) public view returns (uint) {
return bank.getDthShop(_shop);
}
| function getStakedShop(address _shop) public view returns (uint) {
return bank.getDthShop(_shop);
}
| 8,488 |
6 | // `amountIn` is capped by the target price | sqrtRatioNextX96 = sqrtRatioTargetX96;
feeAmount = FullMath.mulDivRoundingUp(amountIn, feePips, feeComplement);
| sqrtRatioNextX96 = sqrtRatioTargetX96;
feeAmount = FullMath.mulDivRoundingUp(amountIn, feePips, feeComplement);
| 23,720 |
202 | // The delay in blocks before voting on a proposal may take place, once proposed | uint256 public votingDelay; //1 block
| uint256 public votingDelay; //1 block
| 22,704 |
16 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the error | * message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
| * message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
| 16,231 |
96 | // Destroys specified amount of senders asset tokens.//_symbol asset symbol./_value amount of tokens to destroy.// return success. | function revokeAsset(bytes32 _symbol, uint _value) public returns (uint) {
// Should have positive value.
if (_value == 0) {
return _error(CAV_PLATFORM_INVALID_VALUE);
}
Asset storage asset = assets[_symbol];
uint holderId = getHolderId(msg.sender);
// Should have enough tokens.
if (asset.wallets[holderId].balance < _value) {
return _error(CAV_PLATFORM_NOT_ENOUGH_TOKENS);
}
asset.wallets[holderId].balance = asset.wallets[holderId].balance.sub(_value);
asset.totalSupply = asset.totalSupply.sub(_value);
// Internal Out Of Gas/Throw: revert this transaction too;
// Call Stack Depth Limit reached: n/a after HF 4;
// Recursive Call: safe, all changes already made.
CAVPlatformEmitter(eventsHistory).emitRevoke(_symbol, _value, _address(holderId));
_proxyTransferEvent(holderId, 0, _value, _symbol);
return OK;
}
| function revokeAsset(bytes32 _symbol, uint _value) public returns (uint) {
// Should have positive value.
if (_value == 0) {
return _error(CAV_PLATFORM_INVALID_VALUE);
}
Asset storage asset = assets[_symbol];
uint holderId = getHolderId(msg.sender);
// Should have enough tokens.
if (asset.wallets[holderId].balance < _value) {
return _error(CAV_PLATFORM_NOT_ENOUGH_TOKENS);
}
asset.wallets[holderId].balance = asset.wallets[holderId].balance.sub(_value);
asset.totalSupply = asset.totalSupply.sub(_value);
// Internal Out Of Gas/Throw: revert this transaction too;
// Call Stack Depth Limit reached: n/a after HF 4;
// Recursive Call: safe, all changes already made.
CAVPlatformEmitter(eventsHistory).emitRevoke(_symbol, _value, _address(holderId));
_proxyTransferEvent(holderId, 0, _value, _symbol);
return OK;
}
| 51,701 |
299 | // Checks the balance pending withdrawal for the sender. | function checkPendingBalance() public view returns(uint256) {
return pendingBalances[msg.sender];
}
| function checkPendingBalance() public view returns(uint256) {
return pendingBalances[msg.sender];
}
| 30,329 |
18 | // contracts | address public ethFundDeposit; // deposit address for ETH for Nebulas Team.
address public newContractAddr; // the new contract for nebulas token updates;
| address public ethFundDeposit; // deposit address for ETH for Nebulas Team.
address public newContractAddr; // the new contract for nebulas token updates;
| 36,503 |
35 | // Add colors we couldn't include in the constructor. / | function addManyColorsToPalette(
uint8 paletteIndex,
string[] storage newColors
| function addManyColorsToPalette(
uint8 paletteIndex,
string[] storage newColors
| 43,714 |
9 | // Freeze (permanently lock) the base URI. / | function freezeBaseURI() external onlyRole(DEFAULT_ADMIN_ROLE) {
require(!isUriFrozen('base'), "BaseURI already frozen");
freezeUri("base");
}
| function freezeBaseURI() external onlyRole(DEFAULT_ADMIN_ROLE) {
require(!isUriFrozen('base'), "BaseURI already frozen");
freezeUri("base");
}
| 10,939 |
119 | // Calculate platform feee | if (ownerCutPerMillion > 0) {
platformFee = sellerShare.mul(ownerCutPerMillion).div(1000000);
}
| if (ownerCutPerMillion > 0) {
platformFee = sellerShare.mul(ownerCutPerMillion).div(1000000);
}
| 14,128 |
172 | // Returns the elements indexed at indexArray. A The array to index indexArray The array to use to indexreturn Returns array containing elements indexed at indexArray / | function argGet(address[] memory A, uint256[] memory indexArray)
internal
pure
returns (address[] memory)
| function argGet(address[] memory A, uint256[] memory indexArray)
internal
pure
returns (address[] memory)
| 27,537 |
34 | // Find token with max daily volume for the current day/day - day number/ return winToken - address of the winner token | function _findMaxVolumeToken(
uint256 day
| function _findMaxVolumeToken(
uint256 day
| 29,349 |
23 | // F4 - returns safe's values' | function GetUserData(uint256 _id) public view
returns (uint256 id, address user, address tokenAddress, uint256 amount, uint256 time)
| function GetUserData(uint256 _id) public view
returns (uint256 id, address user, address tokenAddress, uint256 amount, uint256 time)
| 45,849 |
4 | // NOTE: for future compatibility, these are reserved solidity slots The sub-class of SuperfluidToken solidity slot will start after _reserve13 | uint256 internal _reserve4;
uint256 private _reserve5;
uint256 private _reserve6;
uint256 private _reserve7;
uint256 private _reserve8;
uint256 private _reserve9;
uint256 private _reserve10;
uint256 private _reserve11;
uint256 private _reserve12;
uint256 internal _reserve13;
| uint256 internal _reserve4;
uint256 private _reserve5;
uint256 private _reserve6;
uint256 private _reserve7;
uint256 private _reserve8;
uint256 private _reserve9;
uint256 private _reserve10;
uint256 private _reserve11;
uint256 private _reserve12;
uint256 internal _reserve13;
| 23,693 |
37 | // See `IERC20.transfer`. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. / | function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
| function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
| 4,046 |
4 | // The original owner calls `setPendingOwner(newOwner)` and the new/ owner calls `acceptOwner()` to take the ownership. | function setPendingOwner(address to) external onlyOwner {
pendingOwner = to;
emit PendingOwnerSet(pendingOwner);
}
| function setPendingOwner(address to) external onlyOwner {
pendingOwner = to;
emit PendingOwnerSet(pendingOwner);
}
| 22,898 |
54 | // Check max supply | uint maxSupplyEth = fuseAdmin.maxSupplyEth();
if (maxSupplyEth < uint(-1)) {
(MathError mathErr, uint newUnderlyingBalance) = mulScalarTruncateAddUInt(Exp({mantissa: exchangeRateMantissa}), accountTokens, mintAmount);
| uint maxSupplyEth = fuseAdmin.maxSupplyEth();
if (maxSupplyEth < uint(-1)) {
(MathError mathErr, uint newUnderlyingBalance) = mulScalarTruncateAddUInt(Exp({mantissa: exchangeRateMantissa}), accountTokens, mintAmount);
| 46,422 |
96 | // Capture BAL tokens or any other tokens | function capture(address _token, uint amount) onlyOwner external {
require(_token != address(_token0), "capture: can not capture staking tokens");
require(_token != address(_token1), "capture: can not capture reward tokens");
require(beneficial != address(this), "capture: can not send to self");
require(beneficial != address(0), "capture: can not burn tokens");
IERC20(_token).safeTransfer(beneficial, amount);
}
| function capture(address _token, uint amount) onlyOwner external {
require(_token != address(_token0), "capture: can not capture staking tokens");
require(_token != address(_token1), "capture: can not capture reward tokens");
require(beneficial != address(this), "capture: can not send to self");
require(beneficial != address(0), "capture: can not burn tokens");
IERC20(_token).safeTransfer(beneficial, amount);
}
| 32,241 |
584 | // return Computes the total supply adjustment in response to the exchange rateand the targetRate. / | function computeSupplyDelta(uint256 price, uint256 mcap)
private
view
returns (int256)
| function computeSupplyDelta(uint256 price, uint256 mcap)
private
view
returns (int256)
| 6,010 |
31 | // Number of pools. | function poolCount() external view returns (uint256) {
return poolInfo.length;
}
| function poolCount() external view returns (uint256) {
return poolInfo.length;
}
| 21,248 |
10 | // Returns new campaignId. | function startCommitReveal(
uint _startBlock,
uint _commitDuration,
uint _revealDuration,
uint _revealThreshold
)
public
onlyFromProxy
returns(uint)
| function startCommitReveal(
uint _startBlock,
uint _commitDuration,
uint _revealDuration,
uint _revealThreshold
)
public
onlyFromProxy
returns(uint)
| 26,524 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.