Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
4
// Forbid trivial inputs, to avoid ecrecover edge cases. The main thing to avoid is something which causes ecrecover to return 0x0: then trivial signatures could be constructed with the nonceTimesGeneratorAddress input set to 0x0. solium-disable-next-line indentation
require(nonceTimesGeneratorAddress != address(0) && signingPubKeyX > 0 && signature > 0 && msgHash > 0, "no zero inputs allowed");
require(nonceTimesGeneratorAddress != address(0) && signingPubKeyX > 0 && signature > 0 && msgHash > 0, "no zero inputs allowed");
47,507
1
// Retrieving the buyers
function getBuyers() public view returns (address[16] memory) { return buyers; }
function getBuyers() public view returns (address[16] memory) { return buyers; }
18,800
160
// Add liquidity to uni
addLiquidity(tokensToAddLiquidityWith, currentbalance);
addLiquidity(tokensToAddLiquidityWith, currentbalance);
33,195
141
// Fill a limit order. The taker and sender will be the caller./order The limit order. ETH protocol fees can be/attached to this call. Any unspent ETH will be refunded to/the caller./signature The order signature./takerTokenFillAmount Maximum taker token amount to fill this order with./ return takerTokenFilledAmount Ho...
function fillLimitOrder( LibNativeOrder.LimitOrder calldata order, LibSignature.Signature calldata signature, uint128 takerTokenFillAmount ) external payable returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);
function fillLimitOrder( LibNativeOrder.LimitOrder calldata order, LibSignature.Signature calldata signature, uint128 takerTokenFillAmount ) external payable returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);
19,416
109
// liquidate relay
BancorConverterInterface(converterAddress).liquidate(_amount); poolAmountSent = _amount;
BancorConverterInterface(converterAddress).liquidate(_amount); poolAmountSent = _amount;
1,560
8
// withdraw all the funds
function withdraw() payable onlyOwner public { msg.sender.transfer(address(this).balance); //reset funders' balance to 0 for(uint256 funderIndex = 0; funderIndex < funders.length; funderIndex++){ address funder = funders[funderIndex]; addressToAmountFunded[funder] = 0...
function withdraw() payable onlyOwner public { msg.sender.transfer(address(this).balance); //reset funders' balance to 0 for(uint256 funderIndex = 0; funderIndex < funders.length; funderIndex++){ address funder = funders[funderIndex]; addressToAmountFunded[funder] = 0...
33,194
230
// since pool balance isn't calculated on individual contributions we must mint the early adopters rewards as we might come short otherwise.
sushi.mint(msg.sender, pending.mul(
sushi.mint(msg.sender, pending.mul(
35,921
7
// Checks if a given hash of miner,requestId has been disputed _hash is the sha256(abi.encodePacked(_miners[2],_requestId,_timestamp));return uint disputeId /
function getDisputeIdByDisputeHash(bytes32 _hash) external view returns (uint256)
function getDisputeIdByDisputeHash(bytes32 _hash) external view returns (uint256)
51,772
40
// Claims tokens from validator share and sends them to the/ user if his request is in the userToWithdrawRequest/_tokenId - Id of the token that wants to be claimed
function claimTokens(uint256 _tokenId) external override whenNotPaused { _require( poLidoNFT.isApprovedOrOwner(msg.sender, _tokenId), "Not owner" ); if (token2WithdrawRequest[_tokenId].requestEpoch != 0) { _claimTokensV1(_tokenId); } else if (toke...
function claimTokens(uint256 _tokenId) external override whenNotPaused { _require( poLidoNFT.isApprovedOrOwner(msg.sender, _tokenId), "Not owner" ); if (token2WithdrawRequest[_tokenId].requestEpoch != 0) { _claimTokensV1(_tokenId); } else if (toke...
31,874
137
// Calculate the saltHash given the salt/_salt Salt of the newly created address
function getSaltHash(uint256 _salt) public view returns (bytes32) { return keccak256(abi.encodePacked(_salt, tx.origin)); }
function getSaltHash(uint256 _salt) public view returns (bytes32) { return keccak256(abi.encodePacked(_salt, tx.origin)); }
1,113
19
// Remove reserve address whose balance shall no longer be included in the reserve ratio. reserveAddress The reserve address to remove. index The index of the reserve address in otherReserveAddresses.return Returns true if the transaction succeeds. /
function removeOtherReserveAddress(address reserveAddress, uint256 index) external onlyOwner returns (bool)
function removeOtherReserveAddress(address reserveAddress, uint256 index) external onlyOwner returns (bool)
23,099
5
// Min time between accrued reward withdrawals (set to 0 to disallow interim withdrawals)
uint16 rewardLockHours;
uint16 rewardLockHours;
8,099
81
// Split margin-split income between miner and wallet
splitPayFee( token, uint(batch[i + 3]), owner, minerFeeRecipient, address(batch[i + 6]), walletSplitPercentage );
splitPayFee( token, uint(batch[i + 3]), owner, minerFeeRecipient, address(batch[i + 6]), walletSplitPercentage );
27,159
180
// Returns x + y, reverts if sum overflows uint256/x The augend/y The addend/ return z The sum of x and y
function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); }
function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); }
10,692
8
// Disallows _address The address to change authorization. /
function deauthorize(address _address) public onlyOwner { require(authorized[_address]); emit AuthorizationSet(_address, false); authorized[_address] = false; }
function deauthorize(address _address) public onlyOwner { require(authorized[_address]); emit AuthorizationSet(_address, false); authorized[_address] = false; }
24,457
99
// Set Admin //Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.newPendingAdmin New pending admin./
function _setPendingAdmin(address newPendingAdmin) external;
function _setPendingAdmin(address newPendingAdmin) external;
47,568
0
// using SafeERC20 for covering USDT no-return and other transfer issues
using SafeERC20 for IERC20Metadata;
using SafeERC20 for IERC20Metadata;
12,657
381
// returns the revision number (< type(uint256).max - 1) of the contract.The number should be defined as a private constant. //Returns true if and only if the function is running in the constructor
function isConstructor() private view returns (bool) { uint256 cs; // solhint-disable-next-line no-inline-assembly assembly { cs := extcodesize(address()) } return cs == 0; }
function isConstructor() private view returns (bool) { uint256 cs; // solhint-disable-next-line no-inline-assembly assembly { cs := extcodesize(address()) } return cs == 0; }
19,647
60
// Current Round
Round storage round = rounds[currentRoundId];
Round storage round = rounds[currentRoundId];
67,606
573
// Functions
constructor(address payable manager, address tokenAddress) public { fundManager = manager; fundCreatedAt = now; isOpenForFunds = true; adrianoToken = AdrianoERC20(tokenAddress); }
constructor(address payable manager, address tokenAddress) public { fundManager = manager; fundCreatedAt = now; isOpenForFunds = true; adrianoToken = AdrianoERC20(tokenAddress); }
19,278
12
// if OpenSea's ERC1155 Proxy Address is detected, auto-return true
if (_operator == address(0x207Fa8Df3a17D96Ca7EA4f2893fcdCb78a304101)) { return true; }
if (_operator == address(0x207Fa8Df3a17D96Ca7EA4f2893fcdCb78a304101)) { return true; }
22,666
4
// Switch from the core implementation to the fallback implemenation
function emergencyUpgrade() external onlyDelegate { _upgradeCore(fallbackImplementation); emit EmergencyUpgrade(); }
function emergencyUpgrade() external onlyDelegate { _upgradeCore(fallbackImplementation); emit EmergencyUpgrade(); }
2,294
59
// An administrator who can set the pending anchor value for assets. Set in the constructor. /
address public anchorAdmin;
address public anchorAdmin;
10,406
66
// Get the amounts to be redeemed.
(amountX, amountY) = _redeemWithdrawal(round, recipient);
(amountX, amountY) = _redeemWithdrawal(round, recipient);
16,021
208
// including the Metadata extension. Built to optimize for lower gas during batch mints. Assumes serials are sequentially minted starting at `_startTokenId()`(defaults to 0, e.g. 0, 1, 2, 3..). Assumes that an owner cannot have more than 264 - 1 (max value of uint64) of supply. Assumes that the maximum token id cannot ...
contract ERC721A is IERC721A { // Mask of an entry in packed address data. uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in...
contract ERC721A is IERC721A { // Mask of an entry in packed address data. uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in...
1,750
2
// Overrides existing Treasury contracttreasury_ Address of new Treasury contractMust implement ITreasury and cannot be same as existing/
function setTreasury(ITreasury treasury_) public onlyOwner { require(treasury != treasury_, "Same Treasury"); ITreasury _previousTreasury = treasury; treasury = treasury_; emit TreasuryChanged(_previousTreasury, treasury); }
function setTreasury(ITreasury treasury_) public onlyOwner { require(treasury != treasury_, "Same Treasury"); ITreasury _previousTreasury = treasury; treasury = treasury_; emit TreasuryChanged(_previousTreasury, treasury); }
14,338
185
// Initialize the oracle array by writing the first slot. Called once for the lifecycle of the observations array/self The stored oracle array/time The time of the oracle initialization, via block.timestamp truncated to uint32/ return cardinality The number of populated elements in the oracle array/ return cardinalityN...
function initialize(Observation[65535] storage self, uint32 time) internal returns (uint16 cardinality, uint16 cardinalityNext)
function initialize(Observation[65535] storage self, uint32 time) internal returns (uint16 cardinality, uint16 cardinalityNext)
2,487
5
// End of show properties /
function setBalance(address payable account, uint256 newBalance) public onlyOwner { _setBalance(account, newBalance); }
function setBalance(address payable account, uint256 newBalance) public onlyOwner { _setBalance(account, newBalance); }
19,338
157
// Safe holyheld token transfer function, just in case if rounding error causes pool to not have enough HOLYs.
function safeTokenTransfer(address _to, uint256 _amount) internal { uint256 balance = holytoken.balanceOf(address(this)); if (_amount > balance) { holytoken.transfer(_to, balance); } else { holytoken.transfer(_to, _amount); } }
function safeTokenTransfer(address _to, uint256 _amount) internal { uint256 balance = holytoken.balanceOf(address(this)); if (_amount > balance) { holytoken.transfer(_to, balance); } else { holytoken.transfer(_to, _amount); } }
29,879
61
// Returns the integer division of two unsigned integers, reverting with custom message ondivision by zero. The result is rounded towards zero. CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}. * * 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). * * Require...
* message unnecessarily. For custom revert reasons use {tryDiv}. * * 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). * * Require...
489
39
// get all rewards that have not been claimed yet
function viewUnpaidVestRewards(address vester) public view returns (uint256)
function viewUnpaidVestRewards(address vester) public view returns (uint256)
6,699
297
// Initialize swapStorage struct
swapStorage.lpToken = lpToken; swapStorage.pooledTokens = _pooledTokens; swapStorage.tokenPrecisionMultipliers = precisionMultipliers; swapStorage.balances = new uint256[](_pooledTokens.length); swapStorage.initialA = _a.mul(AmplificationUtils.A_PRECISION); swapStorage.fu...
swapStorage.lpToken = lpToken; swapStorage.pooledTokens = _pooledTokens; swapStorage.tokenPrecisionMultipliers = precisionMultipliers; swapStorage.balances = new uint256[](_pooledTokens.length); swapStorage.initialA = _a.mul(AmplificationUtils.A_PRECISION); swapStorage.fu...
64,702
1
// deposit an ERC721 token from another contract into an ERC721 in this contract/_token the address of the NFT you are depositing/_tokenId the ID of the NFT you are depositing
function depositERC721(address _token, uint256 _tokenId) external { require(_token != address(this), "can't deposit self"); IERC721(_token).safeTransferFrom(msg.sender, address(this), _tokenId); emit Deposit(_token, _tokenId, msg.sender); }
function depositERC721(address _token, uint256 _tokenId) external { require(_token != address(this), "can't deposit self"); IERC721(_token).safeTransferFrom(msg.sender, address(this), _tokenId); emit Deposit(_token, _tokenId, msg.sender); }
32,781
143
// 更新一个属于自己的资源的内容和价格 _claimIdbytes16 : 资源的索引 _newUdfsstring: 新的udfs _newPrice uint256 : 新的价格returnbool: 操作成功返回 true /
function updateClaim(bytes16 _claimId, string _newUdfs, uint256 _newPrice) public returns(bool){ if(_hashFilter(_newUdfs) == false){ emit LogError(RScorr.InvalidUdfs); return false; } return Center_.updateClaim(_claimId, msg.sender, _newUdfs, _newPrice); }
function updateClaim(bytes16 _claimId, string _newUdfs, uint256 _newPrice) public returns(bool){ if(_hashFilter(_newUdfs) == false){ emit LogError(RScorr.InvalidUdfs); return false; } return Center_.updateClaim(_claimId, msg.sender, _newUdfs, _newPrice); }
38,955
119
// Update reward per block Only callable by owner. _rewardPerBlock: the reward per block /
function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner { rewardPerBlock = _rewardPerBlock; emit NewRewardPerBlock(_rewardPerBlock); }
function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner { rewardPerBlock = _rewardPerBlock; emit NewRewardPerBlock(_rewardPerBlock); }
76,169
717
// Domain of home chain
uint32 public remoteDomain;
uint32 public remoteDomain;
22,583
31
// get leader's follow fee
if (uints[13] == 0) return; // uints[13] = followFee uint profit = SafeMath.subtract(value, self.followStartValue); uint followFeeAmount = DecimalMath.fromFixed(SafeMath.multiply(uints[13], profit)); // uints[13] = followFee
if (uints[13] == 0) return; // uints[13] = followFee uint profit = SafeMath.subtract(value, self.followStartValue); uint followFeeAmount = DecimalMath.fromFixed(SafeMath.multiply(uints[13], profit)); // uints[13] = followFee
42,903
17
// ===================================== Address to send the charity! :)https:giveth.io/ https:etherscan.io/address/0x5ADF43DD006c6C36506e2b2DFA352E60002d22Dc
address constant public giveEthCharityAddress = 0x5ADF43DD006c6C36506e2b2DFA352E60002d22Dc; uint256 public totalEthCharityRecieved; // total ETH charity recieved from this contract uint256 public totalEthCharityCollected; // total ETH charity collected in this contract
address constant public giveEthCharityAddress = 0x5ADF43DD006c6C36506e2b2DFA352E60002d22Dc; uint256 public totalEthCharityRecieved; // total ETH charity recieved from this contract uint256 public totalEthCharityCollected; // total ETH charity collected in this contract
16,228
49
// Ensure assetData length is valid
require( assetData.length > 3, "LENGTH_GREATER_THAN_3_REQUIRED" );
require( assetData.length > 3, "LENGTH_GREATER_THAN_3_REQUIRED" );
3,754
167
// set the value of outtoken in the next round, the ratio to target token.since when the outtoken is generated, its amount is 1:1 bind to long_term token at first,the ratio of outtoken to target token should be set to "ratio_to".HTokenInterfaceGK(info.long_term.houttokenAtPeriodWithRatio(info._round + 1, ratio)).set_ra...
info.aggr.setRatioTo(address(this), info._round + 1, ratio, 2, ratio_to);
info.aggr.setRatioTo(address(this), info._round + 1, ratio, 2, ratio_to);
29,375
3
// handler Array /
modifier onlyManager { address msgSender = msg.sender; require((msgSender == managerAddr) || (msgSender == owner), "onlyManager function"); _; }
modifier onlyManager { address msgSender = msg.sender; require((msgSender == managerAddr) || (msgSender == owner), "onlyManager function"); _; }
53,305
143
// Initializes the domain separator and parameter caches. The meaning of `name` and `version` is specified in - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.- `version`: the current major version of the signing domain. NOTE: These parameters cannot be changed except th...
constructor(string memory name, string memory version) {
constructor(string memory name, string memory version) {
21,590
61
// solhint-disable-next-line no-unused-vars
function _authorizeUpgrade(address) internal view override { _onlyGovernance(); }
function _authorizeUpgrade(address) internal view override { _onlyGovernance(); }
69,588
8
// Transfer functions /
function transfer(address _to, uint256 _value) public { require(_to != address(this)); require(_to != address(0), "Cannot use zero address"); require(_value > 0, "Cannot use zero value"); require (balanceOf[msg.sender] >= _value, "Balance not enough"); // Check if the sender...
function transfer(address _to, uint256 _value) public { require(_to != address(this)); require(_to != address(0), "Cannot use zero address"); require(_value > 0, "Cannot use zero value"); require (balanceOf[msg.sender] >= _value, "Balance not enough"); // Check if the sender...
46,821
46
// Require that the sender has the funds to buy the ticket
require(addressToAmountFunded[msg.sender] > ticketPrice, "RE-9");
require(addressToAmountFunded[msg.sender] > ticketPrice, "RE-9");
45,911
11
// the state is set
c.blockNumberN = blockNumberN;
c.blockNumberN = blockNumberN;
42,896
1
// Returns the smallest of two numbers. /
function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; }
function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; }
46,286
81
// Gets the total amount of tokens stored by the contract.return uint256 representing the total amount of tokens /
function totalSupply() public view returns (uint256) { return _allTokens.length; }
function totalSupply() public view returns (uint256) { return _allTokens.length; }
8,877
15
// Decreases the tracked value for totalLP/ Can only be called by an approved vault/amount_The amount of LP tokens to remove from the total
function decreaseTotalLp(uint256 amount_) external;
function decreaseTotalLp(uint256 amount_) external;
24,875
22
// EIP-1271 signer
address private signer;
address private signer;
15,581
10
// Check the merkle proof
require(node == merkleRoots[groupId], 'MerklePreSale: Invalid proof.' );
require(node == merkleRoots[groupId], 'MerklePreSale: Invalid proof.' );
8,259
47
// Safe Variety transfer function, just in case if rounding error causes pool do not have enough Variety.
function safeVarietyTransfer(address _to, uint256 _amount) internal { if (Variety.balanceOf(address(this)) > totalVarietyInPools) { //VarietyBal = total Variety in VarietyDistributor - total Variety in Variety pools, this will make sure that VarietyDistributor never transfer rewards from deposit...
function safeVarietyTransfer(address _to, uint256 _amount) internal { if (Variety.balanceOf(address(this)) > totalVarietyInPools) { //VarietyBal = total Variety in VarietyDistributor - total Variety in Variety pools, this will make sure that VarietyDistributor never transfer rewards from deposit...
50,124
147
// If there are multiple reward tokens, they should all be liquidated to rewardToken.
function _getReward() internal { if (address(rewardPool) != address(0)) { rewardPool.getReward(); } }
function _getReward() internal { if (address(rewardPool) != address(0)) { rewardPool.getReward(); } }
33,762
65
// Returns the legacy signer for the specified account and role. If no signer has been specified it will return the account itself. _account The address of the account. role The role of the signer. /
function getLegacySigner(address _account, bytes32 role) public view returns (address) { require(isLegacyRole(role), "Role is not a legacy signer"); Account storage account = accounts[_account]; address signer; if (role == ValidatorSigner) { signer = account.signers.validator; } else if (ro...
function getLegacySigner(address _account, bytes32 role) public view returns (address) { require(isLegacyRole(role), "Role is not a legacy signer"); Account storage account = accounts[_account]; address signer; if (role == ValidatorSigner) { signer = account.signers.validator; } else if (ro...
20,139
268
// Stops ramping A immediately. Once this function is called, rampA()cannot be called for another 24 hours self Swap struct to update /
function stopRampA(Swap storage self) external { require(self.futureATime > block.timestamp, "Ramp is already stopped"); uint256 currentA = _getAPrecise(self); self.initialA = currentA; self.futureA = currentA; self.initialATime = block.timestamp; self.futureATime = ...
function stopRampA(Swap storage self) external { require(self.futureATime > block.timestamp, "Ramp is already stopped"); uint256 currentA = _getAPrecise(self); self.initialA = currentA; self.futureA = currentA; self.initialATime = block.timestamp; self.futureATime = ...
19,663
18
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
2,433
46
// Divide [prod1 prod0] by the factors of two
assembly { prod0 := div(prod0, twos) }
assembly { prod0 := div(prod0, twos) }
25,464
81
// _softCap min wei amount needed to allow send it to investment address. /
constructor(uint _softCap) public { softCap = _softCap; }
constructor(uint _softCap) public { softCap = _softCap; }
35,453
11
// Returns a boolean array where each value corresponds to theinterfaces passed in and whether they're supported or not. This allowsyou to batch check interfaces for a contract where your expectationis that some interfaces may not be supported.
* See {IERC165-supportsInterface}. * * _Available since v3.4._ */ function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) { // an array of booleans corresponding to interfaceIds and whether they're s...
* See {IERC165-supportsInterface}. * * _Available since v3.4._ */ function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) { // an array of booleans corresponding to interfaceIds and whether they're s...
21,043
2
// forkKey Fork's key
function deposit( mapping(bytes32 => Info) storage self, bytes32 forkKey, uint256 amount, bool deny
function deposit( mapping(bytes32 => Info) storage self, bytes32 forkKey, uint256 amount, bool deny
20,841
183
// Integer division for negative numbers already uses ceiling, so only check boundary condition for positive numbers
if(netCost <= 0 || netCost / int(ONE) * int(ONE) == netCost) { netCost /= int(ONE); } else {
if(netCost <= 0 || netCost / int(ONE) * int(ONE) == netCost) { netCost /= int(ONE); } else {
49,083
156
// set withdrawed total
Withdrawed[sender] = Withdrawed[sender] + WithdrawAmount ;
Withdrawed[sender] = Withdrawed[sender] + WithdrawAmount ;
16,477
124
// Clear the current queue, and update the `nextL1ToForgeQueue` and `nextL1FillingQueue` if needed /
function _clearQueue() internal returns (uint16) { uint16 l1UserTxsLen = uint16( mapL1TxQueue[nextL1ToForgeQueue].length / _L1_USER_TOTALBYTES ); delete mapL1TxQueue[nextL1ToForgeQueue]; nextL1ToForgeQueue++; if (nextL1ToForgeQueue == nextL1FillingQueue) { ...
function _clearQueue() internal returns (uint16) { uint16 l1UserTxsLen = uint16( mapL1TxQueue[nextL1ToForgeQueue].length / _L1_USER_TOTALBYTES ); delete mapL1TxQueue[nextL1ToForgeQueue]; nextL1ToForgeQueue++; if (nextL1ToForgeQueue == nextL1FillingQueue) { ...
61,058
98
// Swap native ETH for CVX on Curve/amount - amount to swap/ return amount of CRV obtained after the swap
function _swapEthToCvx(uint256 amount) internal returns (uint256) { return _ethToCvx(amount, 0); }
function _swapEthToCvx(uint256 amount) internal returns (uint256) { return _ethToCvx(amount, 0); }
21,502
7
// URI variables ------------------------------------------------------------------------
string private _contractURI; string private _baseTokenURI;
string private _contractURI; string private _baseTokenURI;
77,919
131
// Note: There are no time related requirements regarding limitEndTime. If it's below openingTime, token purchases will never be limited. If it's above closingTime, token purchases will always be limited.
if (_limitEndTime > _openingTime) {
if (_limitEndTime > _openingTime) {
75,306
187
// A map from an account owner to an approved transaction hash to if the transaction is approved or not
mapping (address => mapping (bytes32 => bool)) approvedTx;
mapping (address => mapping (bytes32 => bool)) approvedTx;
19,645
8
// The CarbonCreditTokens that form this bundle
EnumerableSetUpgradeable.AddressSet private _tokenAddresses;
EnumerableSetUpgradeable.AddressSet private _tokenAddresses;
24,745
14
// era to index+1
mapping(bytes32 => uint256) internal eraIndex; uint256 public mintPriceOffset = 0 szabo; uint256 public mintStepPrice = 500 szabo; uint256 public mintPriceBuffer = 5000 szabo;
mapping(bytes32 => uint256) internal eraIndex; uint256 public mintPriceOffset = 0 szabo; uint256 public mintStepPrice = 500 szabo; uint256 public mintPriceBuffer = 5000 szabo;
608
35
// set tokenOwnerAddress as owner of all tokens
_mint(tokenOwnerAddress, totalSupply);
_mint(tokenOwnerAddress, totalSupply);
27,158
1,005
// Packs an uint value into a "floating point" storage slot. Used for storinglastClaimIntegralSupply values in balance storage. For these values, we don't needto maintain exact precision but we don't want to be limited by storage size overflows. A floating point value is defined by the 48 most significant bits and an 8...
library FloatingPoint56 { function packTo56Bits(uint256 value) internal pure returns (uint56) { uint256 bitShift; // If the value is over the uint48 max value then we will shift it down // given the index of the most significant bit. We store this bit shift // in the least signific...
library FloatingPoint56 { function packTo56Bits(uint256 value) internal pure returns (uint56) { uint256 bitShift; // If the value is over the uint48 max value then we will shift it down // given the index of the most significant bit. We store this bit shift // in the least signific...
16,343
261
// Subtracts the user's staking amount in the Property. /
function subValue( address _property, address _sender, uint256 _value
function subValue( address _property, address _sender, uint256 _value
2,756
4
// send referral subscribers
claimedsubscribers[referrals[msg.sender]]=SafeMath.add(claimedsubscribers[referrals[msg.sender]],SafeMath.div(subscribersUsed,5));
claimedsubscribers[referrals[msg.sender]]=SafeMath.add(claimedsubscribers[referrals[msg.sender]],SafeMath.div(subscribersUsed,5));
46,356
34
// 来源于下级完成复投 当下级完成4个位置,自动复投的情况,将滑落到左/右谁少,给谁新增的位子,右边完成复投说明左边少
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals[1] == userAddress) { updateX6(userAddress, referrerAddress, level, false); return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level); } else if (users[referrerAddress].x6Matrix[level].firstLevelReferrals...
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals[1] == userAddress) { updateX6(userAddress, referrerAddress, level, false); return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level); } else if (users[referrerAddress].x6Matrix[level].firstLevelReferrals...
25,161
69
// Private function to clear current approval of a given token IDReverts if the given address is not indeed the owner of the token owner owner of the token tokenId uint256 ID of the token to be transferred /
function _clearApproval(address owner, uint256 tokenId) private { require(ownerOf(tokenId) == owner); if (_tokenApprovals[tokenId] != address(0)) { _tokenApprovals[tokenId] = address(0); } }
function _clearApproval(address owner, uint256 tokenId) private { require(ownerOf(tokenId) == owner); if (_tokenApprovals[tokenId] != address(0)) { _tokenApprovals[tokenId] = address(0); } }
52
142
// force removes the lender even if it still has a balance
function _removeLender(address a, bool force) internal { for (uint256 i = 0; i < lenders.length; i++) { if (a == address(lenders[i])) { bool allWithdrawn = lenders[i].withdrawAll(); if (!force) { require(allWithdrawn, "WITHDRAW FAILED"); ...
function _removeLender(address a, bool force) internal { for (uint256 i = 0; i < lenders.length; i++) { if (a == address(lenders[i])) { bool allWithdrawn = lenders[i].withdrawAll(); if (!force) { require(allWithdrawn, "WITHDRAW FAILED"); ...
21,326
11
// ======== MINTING ========/ presale mint /
function preSaleMint(uint256 _quantity, uint256 _maxAmount, bytes32[] calldata _proof) external payable callerIsUser { require(isPreSaleActive, "PRESALE NOT ACTIVE"); require(msg.value == preSalePrice * _quantity, "NEED TO SEND CORRECT ETH AMOUNT"); require(totalSupply() + _quantity <= MAX_...
function preSaleMint(uint256 _quantity, uint256 _maxAmount, bytes32[] calldata _proof) external payable callerIsUser { require(isPreSaleActive, "PRESALE NOT ACTIVE"); require(msg.value == preSalePrice * _quantity, "NEED TO SEND CORRECT ETH AMOUNT"); require(totalSupply() + _quantity <= MAX_...
49,165
59
// approve spender when not paused /
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { return super.approve(_spender, _value); }
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { return super.approve(_spender, _value); }
44,849
28
// Increases approved amount of tokens for spender. Returns success.
function increaseApproval(address _spender, uint256 _value) public returns (bool success) { allowed[msg.sender][_spender] = add(allowed[msg.sender][_spender], _value); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
function increaseApproval(address _spender, uint256 _value) public returns (bool success) { allowed[msg.sender][_spender] = add(allowed[msg.sender][_spender], _value); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
44,645
15
// Emitted when XVS is distributed to a supplier
event DistributedSupplierVenus(VToken indexed vToken, address indexed supplier, uint venusDelta, uint venusSupplyIndex);
event DistributedSupplierVenus(VToken indexed vToken, address indexed supplier, uint venusDelta, uint venusSupplyIndex);
24,404
9
// sale
address public immutable saleAddress; uint256 private immutable _saleSupply;
address public immutable saleAddress; uint256 private immutable _saleSupply;
25,898
282
// DocumentMajority: :proposal has achieved majority
event DocumentMajority(bytes32 proposal);
event DocumentMajority(bytes32 proposal);
37,011
66
// returns the ratio of inflation already minted
function inflationMintedRatio() external view returns (uint256);
function inflationMintedRatio() external view returns (uint256);
64,538
8
// Finally, set the price
items[_hash].price = _price;
items[_hash].price = _price;
11,021
27
// Changes the name for CosmoMask tokenId /
function changeName(uint256 tokenId, string memory newName) public { address owner = ownerOf(tokenId); require(_msgSender() == owner, "CosmoBugs: caller is not the token owner"); require(validateName(newName) == true, "CosmoBugs: not a valid new name"); require(sha256(bytes(newName))...
function changeName(uint256 tokenId, string memory newName) public { address owner = ownerOf(tokenId); require(_msgSender() == owner, "CosmoBugs: caller is not the token owner"); require(validateName(newName) == true, "CosmoBugs: not a valid new name"); require(sha256(bytes(newName))...
64,103
13
// Get the underlying price of a listed cToken asset cToken The cToken to get the underlying price ofreturn The underlying asset price mantissa (scaled by 1e18) /
function getUnderlyingPrice(CToken cToken) public view returns (uint) { address cTokenAddress = address(cToken); if (cTokenAddress == cyY3CRVAddress) { uint yVaultPrice = YVaultInterface(yVaults[cyY3CRVAddress]).getPricePerFullShare(); uint virtualPrice = CurveSwapInterface(...
function getUnderlyingPrice(CToken cToken) public view returns (uint) { address cTokenAddress = address(cToken); if (cTokenAddress == cyY3CRVAddress) { uint yVaultPrice = YVaultInterface(yVaults[cyY3CRVAddress]).getPricePerFullShare(); uint virtualPrice = CurveSwapInterface(...
38,687
120
// limit per tx per type Id
mapping(uint256 => uint256) public typeLimitPerTx;
mapping(uint256 => uint256) public typeLimitPerTx;
14,117
203
// this event is emitted whenever a Country has been whitelisted. the event is emitted by 'whitelistCountry' and 'batchWhitelistCountries' functions. `_country` is the numeric ISO 3166-1 of the whitelisted country. /
event WhitelistedCountry(uint16 _country);
event WhitelistedCountry(uint16 _country);
14,164
8
// add new module to wallet _wallet attach module to new module _module attach module /
function addModule(address _moduleRegistry, address _wallet, address _module, bytes calldata data) external virtual override onlyWallet(_wallet) onlyWhenUnlocked(_wallet) { require(registry.isRegisteredModule(_module), "TM: module is not registered"); IWallet(_wallet).authoriseModule(_moduleRegistry...
function addModule(address _moduleRegistry, address _wallet, address _module, bytes calldata data) external virtual override onlyWallet(_wallet) onlyWhenUnlocked(_wallet) { require(registry.isRegisteredModule(_module), "TM: module is not registered"); IWallet(_wallet).authoriseModule(_moduleRegistry...
20,687
109
// allows the withdrawal of the liquidity from a position or from the item tokens.positionId id of the position.objectId object id of the item token to burn.unwrapPair if the liquidity pool tokens will be unwrapped or not.removedLiquidity amount of liquidity to remove. /
function withdrawLiquidity(uint256 positionId, uint256 objectId, bool unwrapPair, uint256 removedLiquidity) public { // retrieve liquidity mining position LiquidityMiningPosition storage liquidityMiningPosition = _positions[positionId]; uint256 setupIndex = objectId != 0 ? getObjectIdSetupIn...
function withdrawLiquidity(uint256 positionId, uint256 objectId, bool unwrapPair, uint256 removedLiquidity) public { // retrieve liquidity mining position LiquidityMiningPosition storage liquidityMiningPosition = _positions[positionId]; uint256 setupIndex = objectId != 0 ? getObjectIdSetupIn...
38,434
0
// contractState => (accountAddress => bool)
mapping (uint8 => mapping (address => bool)) public confirmations;
mapping (uint8 => mapping (address => bool)) public confirmations;
12,193
149
// PriorityQueue A priority queue implementation. /
contract PriorityQueue is Ownable { using SafeMath for uint256; uint256[] heapList; uint256 public currentSize; constructor() public { heapList = [0]; } /** * @dev Inserts an element into the priority queue. * @param _priority Priority to insert. * @param _value Some additional ...
contract PriorityQueue is Ownable { using SafeMath for uint256; uint256[] heapList; uint256 public currentSize; constructor() public { heapList = [0]; } /** * @dev Inserts an element into the priority queue. * @param _priority Priority to insert. * @param _value Some additional ...
40,003
18
// Tier 2 presale
require(_presaleAllowance[msg.sender] > 0, "You are not eligible to presale mint");
require(_presaleAllowance[msg.sender] > 0, "You are not eligible to presale mint");
30,929
46
// Returns a boolean stating whether `deployer` is allowed to deploy many-to-oneproxies. /
function isApprovedDeployer(address deployer) external override view returns (bool) { return _approvedDeployers[deployer]; }
function isApprovedDeployer(address deployer) external override view returns (bool) { return _approvedDeployers[deployer]; }
5,382
12
// The LIQUIDATION_KEEPER role. /
bytes32 public constant LIQUIDATION_KEEPER = keccak256(abi.encode("LIQUIDATION_KEEPER"));
bytes32 public constant LIQUIDATION_KEEPER = keccak256(abi.encode("LIQUIDATION_KEEPER"));
25,764
78
// Iterate the array of distributions sending the configured amounts
for (uint256 i = 0; i < distributions.length; i++) { if ( distributions[i].destination != address(0) || distributions[i].amount != 0 ) { remainder = remainder.sub(distributions[i].amount);
for (uint256 i = 0; i < distributions.length; i++) { if ( distributions[i].destination != address(0) || distributions[i].amount != 0 ) { remainder = remainder.sub(distributions[i].amount);
15,887
54
// Stake/Deposit into the reward pool (mining pool) for other account/ other The target account/ amount The target amount
function stakeForOther(address other, uint256 amount) external;
function stakeForOther(address other, uint256 amount) external;
2,803
33
// Check If SWAP contract have enaf ether for this opertion
require(this.balance>=safeAdd(msg.value, _ethBonus));
require(this.balance>=safeAdd(msg.value, _ethBonus));
32,423
27
// Transfer tokens from other addressSend '_value' tokens to '_to' on behalf of '_from'_from The address of the sender_to The address of the recipient_value The amount to be sent/
function transferFrom(address _from, address _to, uint256 _value) public returns(bool success){ //Check allowance require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; }
function transferFrom(address _from, address _to, uint256 _value) public returns(bool success){ //Check allowance require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; }
12,826
150
// Make unspent vested balance persistent.
_balances[msg.sender] = _balances[msg.sender].add(unspentVestedBalance);
_balances[msg.sender] = _balances[msg.sender].add(unspentVestedBalance);
18,888