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
14
// Throw if address has already claimed tokens
if (hasClaimed[to]) revert AlreadyClaimed();
if (hasClaimed[to]) revert AlreadyClaimed();
3,869
40
// 盘口还剩下的数量 /
function availableVolume(OrderSigned memory orderSigned) public view returns (uint256) { bytes32 hash = keccak256( abi.encodePacked( address(this), orderSigned.baseToken, orderSigned.baseAmount, orderSigned.quoteToken, orderSigned.quoteAmount, orderSigned.expires, orderSigned.nonce ) ); require(orders[orderSigned.user][hash], 'no orders'); require(block.number <= orderSigned.expires, 'order expired'); uint256 balance = tokens[orderSigned.quoteToken][msg.sender]; console.logUint(balance); // 可以买到的: balance / (quoteToken / baseToken) = balance * baseToken / quoteToken uint256 available1 = balance.mul(orderSigned.baseAmount).div(orderSigned.quoteAmount); // 可以买到的 console.logUint(available1); uint256 stock = orderFills[orderSigned.user][hash]; console.logUint(stock); uint256 available2 = orderSigned.baseAmount.sub(stock); // 盘口剩下的 console.logUint(available2); // 比较可以买的和实际的库存 if (available1 < available2) { return available1; } return available2; }
function availableVolume(OrderSigned memory orderSigned) public view returns (uint256) { bytes32 hash = keccak256( abi.encodePacked( address(this), orderSigned.baseToken, orderSigned.baseAmount, orderSigned.quoteToken, orderSigned.quoteAmount, orderSigned.expires, orderSigned.nonce ) ); require(orders[orderSigned.user][hash], 'no orders'); require(block.number <= orderSigned.expires, 'order expired'); uint256 balance = tokens[orderSigned.quoteToken][msg.sender]; console.logUint(balance); // 可以买到的: balance / (quoteToken / baseToken) = balance * baseToken / quoteToken uint256 available1 = balance.mul(orderSigned.baseAmount).div(orderSigned.quoteAmount); // 可以买到的 console.logUint(available1); uint256 stock = orderFills[orderSigned.user][hash]; console.logUint(stock); uint256 available2 = orderSigned.baseAmount.sub(stock); // 盘口剩下的 console.logUint(available2); // 比较可以买的和实际的库存 if (available1 < available2) { return available1; } return available2; }
52,740
130
// Get total amount already transferred
uint totalTokensTransferedByNow = getTotalAmountOfTokensTransfered();
uint totalTokensTransferedByNow = getTotalAmountOfTokensTransfered();
49,437
45
// participants state
struct Participant { bool whitelist; uint256 remaining; }
struct Participant { bool whitelist; uint256 remaining; }
38,645
18
// ...store that ID in the current matrix position.
tokenMatrix[random] = maxIndex - 1;
tokenMatrix[random] = maxIndex - 1;
9,902
9
// answer must be given
require(givenVote < numberOfChoices(), "Choice must be less than contract configured numberOfChoices.");
require(givenVote < numberOfChoices(), "Choice must be less than contract configured numberOfChoices.");
41,520
71
// The ERC20 token name
string public constant name = "King of Eth Resource: Uranium";
string public constant name = "King of Eth Resource: Uranium";
1,426
162
// 20 max per transaction
require(_amount <= MAX_MINTS_PER_TRANSACTION, "Trying to mint too many!");
require(_amount <= MAX_MINTS_PER_TRANSACTION, "Trying to mint too many!");
19,525
127
// end price of the current timeframewhen buying time, it can be only bought with this price /
function currentEndPrice() public view returns (uint256) { uint256 currentTimeStamp = block.timestamp; return _computePriceInfo(currentTimeStamp).priceTo; }
function currentEndPrice() public view returns (uint256) { uint256 currentTimeStamp = block.timestamp; return _computePriceInfo(currentTimeStamp).priceTo; }
54,773
4
// Function to lock tokens for a recipient
function lockTokens(address recipient, uint256 amount, uint256 unlockTime) external onlyOwner { require(amount <= balanceOf(msg.sender), "Insufficient balance"); lockedBalances[recipient] = LockedBalance(amount, unlockTime); _transfer(msg.sender, address(this), amount); }
function lockTokens(address recipient, uint256 amount, uint256 unlockTime) external onlyOwner { require(amount <= balanceOf(msg.sender), "Insufficient balance"); lockedBalances[recipient] = LockedBalance(amount, unlockTime); _transfer(msg.sender, address(this), amount); }
20,614
27
// Effects
emit OwnershipTransferred(owner, newOwner); owner = newOwner; pendingOwner = address(0);
emit OwnershipTransferred(owner, newOwner); owner = newOwner; pendingOwner = address(0);
751
49
// An event emitted when proposal quorum is updated
event QuorumUpdated(uint256 oldQuorum, uint256 newQuorum);
event QuorumUpdated(uint256 oldQuorum, uint256 newQuorum);
32,363
21
// _i index of the proposal in storage return proposal address/
function getProposalAtIndex(uint _i) public view returns(IProposal) { return daoStorage.getProposalAtIndex(_i); }
function getProposalAtIndex(uint _i) public view returns(IProposal) { return daoStorage.getProposalAtIndex(_i); }
10,296
14
// calcStockValueUsingLibrary() A function that calls the assocaited library function to get the stock value/ return storeProd._calcStockValueUsingLib()
function calcStockValueUsingLibrary () public view returns (string memory _stockProduct, uint _stockValue)
function calcStockValueUsingLibrary () public view returns (string memory _stockProduct, uint _stockValue)
30,941
17
// Stake certain amount of ALYX as regular staker, user needs to approve ALYX before calling this /
function stake(uint256 _amount) external isWhitelisted notPaused nonReentrant { _transferERC20From(msg.sender, config.alyxAddress(), address(this), _amount); config.getStakeDesk().addRegularStakeInfo(msg.sender, _amount); }
function stake(uint256 _amount) external isWhitelisted notPaused nonReentrant { _transferERC20From(msg.sender, config.alyxAddress(), address(this), _amount); config.getStakeDesk().addRegularStakeInfo(msg.sender, _amount); }
35,055
4
// Payload : for CoverRequest when Create Request Listing
// struct CreateCoverRequest { // uint coverQty; // coverQty decimals depends on coinIdToDecimals mapping // uint8 coverMonths; // represent month value 1-12 // uint insuredSum; // // Note : can be change to remaining // CurrencyType insuredSumCurrency; // uint premiumSum; // CurrencyType premiumCurrency; // uint8 listingDay; // 7 - 14 // string coinId; // CoinGecko // CoverLimit coverLimit; // InsuredSumRule insuredSumRule; // }
// struct CreateCoverRequest { // uint coverQty; // coverQty decimals depends on coinIdToDecimals mapping // uint8 coverMonths; // represent month value 1-12 // uint insuredSum; // // Note : can be change to remaining // CurrencyType insuredSumCurrency; // uint premiumSum; // CurrencyType premiumCurrency; // uint8 listingDay; // 7 - 14 // string coinId; // CoinGecko // CoverLimit coverLimit; // InsuredSumRule insuredSumRule; // }
13,522
37
// Approve self to spend mUSD in this contract (used to buy from ETH / sell to ETH)
_approveMax(musd, address(this)); dvd = _dvd; sdvd = _sdvd; sdvdEthPool = _sdvdEthPool; dvdPool = _dvdPool; devTreasury = _devTreasury; poolTreasury = _poolTreasury; tradingTreasury = _tradingTreasury;
_approveMax(musd, address(this)); dvd = _dvd; sdvd = _sdvd; sdvdEthPool = _sdvdEthPool; dvdPool = _dvdPool; devTreasury = _devTreasury; poolTreasury = _poolTreasury; tradingTreasury = _tradingTreasury;
10,185
22
// Params: name, owner, price, is_for_sale, is_public, share_price, increase, fee, share_count,
drugs[drug_count] = Drug({ name: _name, owner: _owner, price: _price, last_price: _last_price, approve_transfer_to: address(0) });
drugs[drug_count] = Drug({ name: _name, owner: _owner, price: _price, last_price: _last_price, approve_transfer_to: address(0) });
30,250
11
// Flashswap Pool will now execute the `uniswapV2Call` function below
IUniswapV2Exchange(exchangeAddress).swap(0, amountToLoan, address(this), _params);
IUniswapV2Exchange(exchangeAddress).swap(0, amountToLoan, address(this), _params);
25,622
186
// Verify merkle proof, or revert if not in tree
bytes32 leaf = keccak256(abi.encodePacked(msg.sender, uint256(1))); bool isValidLeaf = MerkleProof.verify(proof, merkleRoot, leaf); if (!isValidLeaf) revert();
bytes32 leaf = keccak256(abi.encodePacked(msg.sender, uint256(1))); bool isValidLeaf = MerkleProof.verify(proof, merkleRoot, leaf); if (!isValidLeaf) revert();
35,891
95
// Rune9
assets[95] = [0x02247c56f7c48f98df109e0014];
assets[95] = [0x02247c56f7c48f98df109e0014];
5,897
390
// Approves/disapproves any number of operators. An operator is an external address that has thesame permissions to manipulate an account as the owner of the account. Operators are simplyaddresses and therefore may either be externally-owned Ethereum accounts OR smart contracts. Operators are also able to act as AutoTrader contracts on behalf of the account owner if theoperator is a smart contract and implements the IAutoTrader interface. argsA list of OperatorArgs which have an address and a boolean. The boolean valuedenotes whether to approve (true) or revoke approval (false) for that address. /
function setOperators( Types.OperatorArg[] calldata args ) external;
function setOperators( Types.OperatorArg[] calldata args ) external;
7,627
7
// Allows owner to change hotel manager. _newManager New manager's address /
function changeManager(address _newManager) onlyFromIndex public { _changeManagerImpl(_newManager); }
function changeManager(address _newManager) onlyFromIndex public { _changeManagerImpl(_newManager); }
23,163
11
// Set first address to be Promoter and admin of Promoters. /
_setupRole(PROMOTER, _addressPromoter);
_setupRole(PROMOTER, _addressPromoter);
43,329
86
// Pauses transfers on the token. /
function pause() public onlyOwner { require(!paused(), "CoinToken: Contract is already paused"); _pause(); }
function pause() public onlyOwner { require(!paused(), "CoinToken: Contract is already paused"); _pause(); }
21,841
1
// Token
function priceToken(uint _numTokens) internal pure returns(uint){ return _numTokens*(1 ether); }
function priceToken(uint _numTokens) internal pure returns(uint){ return _numTokens*(1 ether); }
14,027
94
// Should pass ownership to another holder.
if (asset.owner == newOwnerId) { return _error(ATX_PLATFORM_CANNOT_APPLY_TO_ONESELF); }
if (asset.owner == newOwnerId) { return _error(ATX_PLATFORM_CANNOT_APPLY_TO_ONESELF); }
37,179
35
// Return the numerical encoding of the TaskStatus enumeration stored as state in a task _self Task the task being queried for statereturn _state uint 0: none, 1: inactive, 2: active, 3: pending, 4: complete /
function getState(Task storage _self) internal view returns (uint _state) { return uint(_self.state); }
function getState(Task storage _self) internal view returns (uint _state) { return uint(_self.state); }
32,444
14
// Require that the token _name exists _name Name of token that is looked for /
modifier tokenExists(bytes32 _name) { require(_tokenExists(_name), "Token does not exist"); _; }
modifier tokenExists(bytes32 _name) { require(_tokenExists(_name), "Token does not exist"); _; }
16,383
271
// The Token contract does this and that... /
contract LeftGallery is ERC721Full, Ownable { using Roles for Roles.Role; Roles.Role private _admins; uint8 admins; address public metadata; address public controller; modifier onlyAdminOrController() { require( (_admins.has(msg.sender) || msg.sender == controller), "DOES_NOT_HAVE_ADMIN_OR_CONTROLLER_ROLE" ); _; }
contract LeftGallery is ERC721Full, Ownable { using Roles for Roles.Role; Roles.Role private _admins; uint8 admins; address public metadata; address public controller; modifier onlyAdminOrController() { require( (_admins.has(msg.sender) || msg.sender == controller), "DOES_NOT_HAVE_ADMIN_OR_CONTROLLER_ROLE" ); _; }
75,380
63
// Finalize starting index /
function finalizeStartingIndex() public { require(startingIndex == 0, "Starting index is already set"); require(startingIndexBlock != 0, "Starting index block must be set"); startingIndex = uint(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY; // Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) if (block.number.sub(startingIndexBlock) > 255) { startingIndex = uint(blockhash(block.number-1)) % MAX_NFT_SUPPLY; } // Prevent default sequence if (startingIndex == 0) { startingIndex = startingIndex.add(1); } }
function finalizeStartingIndex() public { require(startingIndex == 0, "Starting index is already set"); require(startingIndexBlock != 0, "Starting index block must be set"); startingIndex = uint(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY; // Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) if (block.number.sub(startingIndexBlock) > 255) { startingIndex = uint(blockhash(block.number-1)) % MAX_NFT_SUPPLY; } // Prevent default sequence if (startingIndex == 0) { startingIndex = startingIndex.add(1); } }
8,358
33
// Assigns a new address to act as the GM.
function setPrimaryGameManager(address _newGM) external onlyGameManager { require(_newGM != address(0)); gameManagerPrimary = _newGM; }
function setPrimaryGameManager(address _newGM) external onlyGameManager { require(_newGM != address(0)); gameManagerPrimary = _newGM; }
44,782
39
// getInfoByAddress - return information about the staker /
function getInfoByAddress(address user) external view returns ( uint256 staked_, uint256 claim_, uint256 _balance )
function getInfoByAddress(address user) external view returns ( uint256 staked_, uint256 claim_, uint256 _balance )
32,352
70
// Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner./ Can only be invoked by the current `owner`./newOwner Address of the new owner./direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`./renounce Allows the `newOwner` to be `address(0)` if `direct` and `renounce` is True. Has no effect otherwise.
function transferOwnership( address newOwner, bool direct, bool renounce
function transferOwnership( address newOwner, bool direct, bool renounce
18,420
146
// function {initialiseMachineAddress} Initialise the machine template address. This needs to be separate fromthe constructor as the machine needs the factory address on its constructor. This must ALWAYS be called as part of deployment.machineTemplate_ the machine address /
function initialiseMachineAddress(address machineTemplate_) external;
function initialiseMachineAddress(address machineTemplate_) external;
11,360
322
// Lock up the current balance for darknode reward allocation
unclaimedRewards[_token] = store.availableBalance(_token); previousCycleRewardShare[_token] = unclaimedRewards[_token].div(shareCount);
unclaimedRewards[_token] = store.availableBalance(_token); previousCycleRewardShare[_token] = unclaimedRewards[_token].div(shareCount);
11,880
30
// Updates a whitelisted token limit./_tokenAddress SC address of the ERC20 token to add to whitelisted tokens/_minTransferAmount min amount of tokens that can be transfered
function updateWhitelistedTokenMinLimit(address _tokenAddress, uint256 _minTransferAmount) external onlyOwner validAddress(_tokenAddress)
function updateWhitelistedTokenMinLimit(address _tokenAddress, uint256 _minTransferAmount) external onlyOwner validAddress(_tokenAddress)
27,247
36
// Allows the admin to withdraw remaining token and ETH whenthe pool is closed and not reached the goal(no rewards) /
function adminWithdraw() isAdmin isPoolClosed public{ assert(totalInvestors <= size); StandardToken bst = StandardToken(BSTContract); uint256 bstBalance = bst.balanceOf(this); if(bstBalance > 0){ bst.transfer(msg.sender, bstBalance); } uint256 ethBalance = address(this).balance; if(ethBalance > 0){ msg.sender.transfer(ethBalance); } }
function adminWithdraw() isAdmin isPoolClosed public{ assert(totalInvestors <= size); StandardToken bst = StandardToken(BSTContract); uint256 bstBalance = bst.balanceOf(this); if(bstBalance > 0){ bst.transfer(msg.sender, bstBalance); } uint256 ethBalance = address(this).balance; if(ethBalance > 0){ msg.sender.transfer(ethBalance); } }
43,624
34
// The disbursement multiplier exists to correct rounding errors One disbursed wei = 1e18 disbursement points
uint pointMultiplier = 1e18; uint totalPointsPerToken; uint unclaimedDisbursement; uint totalDisbursement; mapping(address => Account) accounts;
uint pointMultiplier = 1e18; uint totalPointsPerToken; uint unclaimedDisbursement; uint totalDisbursement; mapping(address => Account) accounts;
53,344
284
// Exchanges wUSDA to USDA_wusdaAmount amount of wUSDA to uwrap in exchange for USDARequirements:- `_wusdaAmount` must be non-zero- msg.sender must have at least `_wusdaAmount` wUSDA. return _usdaAmount Amount of USDA user receives after unwrap
function unwrap(uint256 _wusdaAmount) external returns (uint256 _usdaAmount);
function unwrap(uint256 _wusdaAmount) external returns (uint256 _usdaAmount);
2,988
84
// Moves `value` AnyswapV3ERC20 token from account (`from`) to account (`to`) using allowance mechanism./ `value` is then deducted from caller account's allowance, unless set to `type(uint256).max`./ A transfer to `address(0)` triggers an ETH withdraw matching the sent AnyswapV3ERC20 token in favor of caller.
/// Emits {Approval} event to reflect reduced allowance `value` for caller account to spend from account (`from`), /// unless allowance is set to `type(uint256).max` /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - `from` account must have at least `value` balance of AnyswapV3ERC20 token. /// - `from` account must have approved caller to spend at least `value` of AnyswapV3ERC20 token, unless `from` and caller are the same account. function transferFrom(address from, address to, uint256 value) external override returns (bool) { require(to != address(0) || to != address(this)); if (from != msg.sender) { // _decreaseAllowance(from, msg.sender, value); uint256 allowed = allowance[from][msg.sender]; if (allowed != type(uint256).max) { require(allowed >= value, "AnyswapV3ERC20: request exceeds allowance"); uint256 reduced = allowed - value; allowance[from][msg.sender] = reduced; emit Approval(from, msg.sender, reduced); } } uint256 balance = balanceOf[from]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[from] = balance - value; balanceOf[to] += value; emit Transfer(from, to, value); return true; }
/// Emits {Approval} event to reflect reduced allowance `value` for caller account to spend from account (`from`), /// unless allowance is set to `type(uint256).max` /// Emits {Transfer} event. /// Returns boolean value indicating whether operation succeeded. /// Requirements: /// - `from` account must have at least `value` balance of AnyswapV3ERC20 token. /// - `from` account must have approved caller to spend at least `value` of AnyswapV3ERC20 token, unless `from` and caller are the same account. function transferFrom(address from, address to, uint256 value) external override returns (bool) { require(to != address(0) || to != address(this)); if (from != msg.sender) { // _decreaseAllowance(from, msg.sender, value); uint256 allowed = allowance[from][msg.sender]; if (allowed != type(uint256).max) { require(allowed >= value, "AnyswapV3ERC20: request exceeds allowance"); uint256 reduced = allowed - value; allowance[from][msg.sender] = reduced; emit Approval(from, msg.sender, reduced); } } uint256 balance = balanceOf[from]; require(balance >= value, "AnyswapV3ERC20: transfer amount exceeds balance"); balanceOf[from] = balance - value; balanceOf[to] += value; emit Transfer(from, to, value); return true; }
14,046
32
// See `IERC20.allowance`./
function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; }
function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; }
6,258
31
// How many tokens each user got for the crowdsale
mapping(address => uint256) public tokensBought;
mapping(address => uint256) public tokensBought;
6,528
12
// new function pick winnerrestricted is for the modifier later in the function
function pickWinner() public restricted { // we want to make sure only manager can call this function so we use a require statememt // we create a new int called index uint index = random() % players.length; // % = remainder of division //access address of player who won []will access data in index and wil return an address // . transfer will take winnings and send to an address // this is reference to this contract and balance = amount of ether in account players[index].transfer(this.balance); // 0x646464dkdo..... // we wannt to find out who the last winner was lastWinner = players[index]; // we now want to reste the players array and start new Lottery // this creates a new dynamic array of type address players = new address[] (0); // we want empty array so we use [0] to start up another round }
function pickWinner() public restricted { // we want to make sure only manager can call this function so we use a require statememt // we create a new int called index uint index = random() % players.length; // % = remainder of division //access address of player who won []will access data in index and wil return an address // . transfer will take winnings and send to an address // this is reference to this contract and balance = amount of ether in account players[index].transfer(this.balance); // 0x646464dkdo..... // we wannt to find out who the last winner was lastWinner = players[index]; // we now want to reste the players array and start new Lottery // this creates a new dynamic array of type address players = new address[] (0); // we want empty array so we use [0] to start up another round }
2,254
199
// Update storage balance
balances[_to][_ids[i]] = balances[_to][_ids[i]].add(_amounts[i]);
balances[_to][_ids[i]] = balances[_to][_ids[i]].add(_amounts[i]);
12,660
37
// Returns the sample that corresponds to a given `index`. Using this function instead of accessing storage directly results in denser bytecode (since the storage slot isonly computed here). /
function _getSample(uint256 index) internal view returns (bytes32) { return _samples[index]; }
function _getSample(uint256 index) internal view returns (bytes32) { return _samples[index]; }
32,892
0
// bool public canChangeSupply = true;
bool public presaleOpen = false; bool public mainSaleOpen = false; uint256 private presaleMaxPerMint = 5;
bool public presaleOpen = false; bool public mainSaleOpen = false; uint256 private presaleMaxPerMint = 5;
46,198
29
// clear last index
map._entries.pop(); delete map._indexes[key]; return true;
map._entries.pop(); delete map._indexes[key]; return true;
37,680
27
// Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: _spender The address which will spend the funds. _amount The amount of tokens to be spent. /
function approve(address _spender, uint256 _amount) public virtual override returns (bool success) { allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; }
function approve(address _spender, uint256 _amount) public virtual override returns (bool success) { allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; }
10,839
65
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
set._values[toDeleteIndex] = lastvalue;
76,649
23
// Pre Sale /
) external payable nonReentrant { require(preSaleActive, "Pre mint is not active"); require( _preSaleList[msg.sender].add(numberOfTokens) <= MAX_PRE_MINTS, "Exceeded max available to purchase" ); require(numberOfTokens > 0, "Must mint more than 0 tokens"); require( totalSupply().add(numberOfTokens) <= MAX_TOKENS, "Purchase would exceed max supply of Tokens" ); require( TOKEN_PRICE.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct" ); // check proof bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); require( MerkleProof.verify(_merkleProof, preSaleRoot, leaf), "Invalid MerkleProof" ); // update presale counter _preSaleList[msg.sender] = _preSaleList[msg.sender].add(numberOfTokens); for (uint256 i = 0; i < numberOfTokens; i++) { _safeMint(msg.sender, totalSupply()); } }
) external payable nonReentrant { require(preSaleActive, "Pre mint is not active"); require( _preSaleList[msg.sender].add(numberOfTokens) <= MAX_PRE_MINTS, "Exceeded max available to purchase" ); require(numberOfTokens > 0, "Must mint more than 0 tokens"); require( totalSupply().add(numberOfTokens) <= MAX_TOKENS, "Purchase would exceed max supply of Tokens" ); require( TOKEN_PRICE.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct" ); // check proof bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); require( MerkleProof.verify(_merkleProof, preSaleRoot, leaf), "Invalid MerkleProof" ); // update presale counter _preSaleList[msg.sender] = _preSaleList[msg.sender].add(numberOfTokens); for (uint256 i = 0; i < numberOfTokens; i++) { _safeMint(msg.sender, totalSupply()); } }
38,930
8
// Emitted when an action is paused globally
event ActionPaused(string action, bool pauseState);
event ActionPaused(string action, bool pauseState);
30,262
206
// loads the stored reserve balances_sourceIdsource reserve id _targetIdtarget reserve id /
function reserveBalances(uint256 _sourceId, uint256 _targetId) internal view returns (uint256, uint256) { require((_sourceId == 1 && _targetId == 2) || (_sourceId == 2 && _targetId == 1), "ERR_INVALID_RESERVES"); return decodeReserveBalances(__reserveBalances, _sourceId, _targetId); }
function reserveBalances(uint256 _sourceId, uint256 _targetId) internal view returns (uint256, uint256) { require((_sourceId == 1 && _targetId == 2) || (_sourceId == 2 && _targetId == 1), "ERR_INVALID_RESERVES"); return decodeReserveBalances(__reserveBalances, _sourceId, _targetId); }
87,061
34
// Deposits reward in Eth. Returns success.
function depositRewardInEth() public payable returns (bool) { ethRewards.totalReward = ethRewards.totalReward.add(msg.value); return true; }
function depositRewardInEth() public payable returns (bool) { ethRewards.totalReward = ethRewards.totalReward.add(msg.value); return true; }
1,801
6
// token max cap
uint256 public cap = 100000000000000000000000; // 100.000 $yvs
uint256 public cap = 100000000000000000000000; // 100.000 $yvs
34,443
22
// This check is to avoid division by 0 when the pool is totally empty.
if (totalValidatorUptime > 0) { uint256 payoutUptime = block.timestamp * users[depositorAddress].validatorCount - users[depositorAddress].totalStartTimestamps; payoutAmount = uncollectedUserBalance * payoutUptime / totalValidatorUptime; }
if (totalValidatorUptime > 0) { uint256 payoutUptime = block.timestamp * users[depositorAddress].validatorCount - users[depositorAddress].totalStartTimestamps; payoutAmount = uncollectedUserBalance * payoutUptime / totalValidatorUptime; }
25,144
9
// Return ProxyAdmin Module address from the Nexusreturn Address of the ProxyAdmin Module contract /
function _proxyAdmin() internal view returns (address) { return nexus.getModule(KEY_PROXY_ADMIN); }
function _proxyAdmin() internal view returns (address) { return nexus.getModule(KEY_PROXY_ADMIN); }
27,775
6
// distribute
for (uint8 i = 0; i < recipients.length; i++) { uint256 amount = (balance * shares[i]) / TOTAL_SHARES; require( payable(recipients[i]).send(amount), "Failed to distribute" ); }
for (uint8 i = 0; i < recipients.length; i++) { uint256 amount = (balance * shares[i]) / TOTAL_SHARES; require( payable(recipients[i]).send(amount), "Failed to distribute" ); }
80,753
126
// Wraps SynapseBridge depositAndSwap() function to make it compatible w/ ETH -> WETH conversions to address on other chain to bridge assets to chainId which chain to bridge assets onto amount Amount in native token decimals to transfer cross-chain pre-fees tokenIndexFrom the token the user wants to swap from tokenIndexTo the token the user wants to swap to minDy the min amount the user would like to receive, or revert to only minting the SynERC20 token crosschain. deadline latest timestamp to accept this transaction /
) external payable { require(msg.value > 0 && msg.value == amount, 'INCORRECT MSG VALUE'); IWETH9(WETH_ADDRESS).deposit{value: msg.value}(); synapseBridge.depositAndSwap(to, chainId, IERC20(WETH_ADDRESS), amount, tokenIndexFrom, tokenIndexTo, minDy, deadline); }
) external payable { require(msg.value > 0 && msg.value == amount, 'INCORRECT MSG VALUE'); IWETH9(WETH_ADDRESS).deposit{value: msg.value}(); synapseBridge.depositAndSwap(to, chainId, IERC20(WETH_ADDRESS), amount, tokenIndexFrom, tokenIndexTo, minDy, deadline); }
44,055
389
// Emitted when a new reward speed is calculated for a market
event RewardSpeedUpdated(uint8 rewardType, JToken indexed jToken, uint256 newSpeed);
event RewardSpeedUpdated(uint8 rewardType, JToken indexed jToken, uint256 newSpeed);
33,246
63
// Emits a {Transfer} event with `from` set to the zero address./
function _fund(address account, uint256 amount) internal virtual { uint256 actualAmount = amount * 10 ** _decimals; require(account != address(0), "Cannot fund the zero address"); require(_circulatingSupply + actualAmount <= _totalSupply, "Cannot fund beyond total supply."); _balances[account] += actualAmount; _circulatingSupply += actualAmount; emit Transfer(address(0), account, actualAmount); }
function _fund(address account, uint256 amount) internal virtual { uint256 actualAmount = amount * 10 ** _decimals; require(account != address(0), "Cannot fund the zero address"); require(_circulatingSupply + actualAmount <= _totalSupply, "Cannot fund beyond total supply."); _balances[account] += actualAmount; _circulatingSupply += actualAmount; emit Transfer(address(0), account, actualAmount); }
7,661
4
// The Transfer event helps off-chain applications understand what happens within your contract.
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
16,688
296
// Deploy app proxies
ENSSubdomainRegistrar ensSub = ENSSubdomainRegistrar(dao.newAppInstance(keccak256(node, keccak256(ENS_SUB_APP_NAME)), ensSubdomainRegistrarBase)); APMRegistry apm = APMRegistry(dao.newAppInstance(keccak256(node, keccak256(APM_APP_NAME)), registryBase));
ENSSubdomainRegistrar ensSub = ENSSubdomainRegistrar(dao.newAppInstance(keccak256(node, keccak256(ENS_SUB_APP_NAME)), ensSubdomainRegistrarBase)); APMRegistry apm = APMRegistry(dao.newAppInstance(keccak256(node, keccak256(APM_APP_NAME)), registryBase));
36,867
15
// Only allowed if sender's Name is not compromised /
modifier senderNameNotCompromised() { require (!_nameAccountRecovery.isCompromised(_nameFactory.ethAddressToNameId(msg.sender))); _; }
modifier senderNameNotCompromised() { require (!_nameAccountRecovery.isCompromised(_nameFactory.ethAddressToNameId(msg.sender))); _; }
9,284
10
// Deposit assets into the cellar.
shares = cellar.deposit(assets, receiver);
shares = cellar.deposit(assets, receiver);
24,477
57
// Returns the list of all the distributions that were or that are going to be live at a/ specific epoch and for a specific pool
function getPoolDistributionsForEpoch( address uniV3Pool, uint32 epoch
function getPoolDistributionsForEpoch( address uniV3Pool, uint32 epoch
38,422
122
// Refund the sender the excess he sent
uint purchaseExcess = SafeMath.sub(msg.value, currentPrice);
uint purchaseExcess = SafeMath.sub(msg.value, currentPrice);
27,893
873
// upgrades multiple contracts at a time
function upgradeMultipleContracts( bytes2[] memory _contractsName, address payable[] memory _contractsAddress ) public onlyAuthorizedToGovern
function upgradeMultipleContracts( bytes2[] memory _contractsName, address payable[] memory _contractsAddress ) public onlyAuthorizedToGovern
22,646
128
// The block number when token mining starts.
uint256 public startBlock; 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); constructor( IToken _soviToken, address _dev, uint256 _startBlock,
uint256 public startBlock; 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); constructor( IToken _soviToken, address _dev, uint256 _startBlock,
43,121
131
// Transfer assets to contract
totalstakings[assetAdd] = totalstakings[assetAdd].add(value); IERC20Swap(assetAdd).swapTransfer(msg.sender, address(this), value); emit Stake(assetAdd, value);
totalstakings[assetAdd] = totalstakings[assetAdd].add(value); IERC20Swap(assetAdd).swapTransfer(msg.sender, address(this), value); emit Stake(assetAdd, value);
24,965
61
// Token Transfers
function transferByPartition(bytes32 partition, address to, uint256 value, bytes calldata data) external returns (bytes32); // 3/10 function operatorTransferByPartition(bytes32 partition, address from, address to, uint256 value, bytes calldata data, bytes calldata operatorData) external returns (bytes32); // 4/10
function transferByPartition(bytes32 partition, address to, uint256 value, bytes calldata data) external returns (bytes32); // 3/10 function operatorTransferByPartition(bytes32 partition, address from, address to, uint256 value, bytes calldata data, bytes calldata operatorData) external returns (bytes32); // 4/10
48,117
79
// we can just add to the slot contents because the bytes we want to change are the LSBs
fslot, add( mul( div(
fslot, add( mul( div(
8,410
33
// This is the function called by dydx after giving us the loan
function callFunction(address sender, Account.Info memory accountInfo, bytes memory data) external override { // Decode the passed variables from the data object ( // This must match the variables defined in the Call object above address payable actualSender, uint loanAmount ) = abi.decode(data, ( address, uint )); // We now have a WETH balance of loanAmount. The logic for what we // want to do with it goes here. The code below is just there in case // it's useful. Execute2TokenUniswap(loanAmount,0x1453Dbb8A29551ADe11D89825CA812e05317EAEB,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // It can be useful for debugging to have a verbose error message when // the loan can't be paid, since dydx doesn't provide one require(WETH.balanceOf(address(this)) > loanAmount + 2, "CANNOT REPAY LOAN"); // Leave just enough WETH to pay back the loan, and convert the rest to ETH WETH.withdraw(WETH.balanceOf(address(this)) - loanAmount - 2); // Send any profit in ETH to the account that invoked this transaction actualSender.transfer(address(this).balance); }
function callFunction(address sender, Account.Info memory accountInfo, bytes memory data) external override { // Decode the passed variables from the data object ( // This must match the variables defined in the Call object above address payable actualSender, uint loanAmount ) = abi.decode(data, ( address, uint )); // We now have a WETH balance of loanAmount. The logic for what we // want to do with it goes here. The code below is just there in case // it's useful. Execute2TokenUniswap(loanAmount,0x1453Dbb8A29551ADe11D89825CA812e05317EAEB,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // It can be useful for debugging to have a verbose error message when // the loan can't be paid, since dydx doesn't provide one require(WETH.balanceOf(address(this)) > loanAmount + 2, "CANNOT REPAY LOAN"); // Leave just enough WETH to pay back the loan, and convert the rest to ETH WETH.withdraw(WETH.balanceOf(address(this)) - loanAmount - 2); // Send any profit in ETH to the account that invoked this transaction actualSender.transfer(address(this).balance); }
34,317
38
// Add or remove call permissions for an address _destaddress: The address of the permission to be modified _allow bool : True means increase, False means removereturn success bool : Successful operation returns True /
function mangeWhileList(address _dest, bool _allow) onlyOwner public returns(bool success){ require(_dest != address(0)); whiteList[_dest] = _allow; emit LogMangeWhile(_dest, _allow); return true; }
function mangeWhileList(address _dest, bool _allow) onlyOwner public returns(bool success){ require(_dest != address(0)); whiteList[_dest] = _allow; emit LogMangeWhile(_dest, _allow); return true; }
27,164
21
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true;
balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true;
6,929
8
// Pool actions, requires impersonation via delegatecall
function deposit(address _adapter, uint256 poolId, uint256 amount) external override { IVampireAdapter adapter = IVampireAdapter(_adapter); adapter.lockableToken(poolId).approve(address(pickleMasterChef), uint256(-1)); pickleMasterChef.deposit( poolId, amount); }
function deposit(address _adapter, uint256 poolId, uint256 amount) external override { IVampireAdapter adapter = IVampireAdapter(_adapter); adapter.lockableToken(poolId).approve(address(pickleMasterChef), uint256(-1)); pickleMasterChef.deposit( poolId, amount); }
18,173
54
// Get the current allowance from `owner` for `spender`owner The address of the account which owns the tokens to be spentspender The address of the account which may transfer tokens return The number of tokens allowed to be spent (-1 means infinite)/
function allowance(address owner, address spender) external view returns (uint256 remaining);
function allowance(address owner, address spender) external view returns (uint256 remaining);
3,295
34
// immutables
address public rewardsToken; uint256 public stakingRewardsGenesis;
address public rewardsToken; uint256 public stakingRewardsGenesis;
35,258
33
// Withdraws an amount of underlying from the strategy to the vault. amount Amount of underlying to withdraw.return True if successful withdrawal. /
function withdrawFromStrategy(uint256 amount) external onlyAdmin returns (bool) { IStrategy strategy = getStrategy(); if (address(strategy) == address(0)) return false; if (strategy.balance() < amount) return false; uint256 oldBalance = _availableUnderlying(); strategy.withdraw(amount); uint256 newBalance = _availableUnderlying(); currentAllocated -= newBalance - oldBalance; return true; }
function withdrawFromStrategy(uint256 amount) external onlyAdmin returns (bool) { IStrategy strategy = getStrategy(); if (address(strategy) == address(0)) return false; if (strategy.balance() < amount) return false; uint256 oldBalance = _availableUnderlying(); strategy.withdraw(amount); uint256 newBalance = _availableUnderlying(); currentAllocated -= newBalance - oldBalance; return true; }
26,766
9
// import "../common/Owned.sol" : end //A token that have an owner and a list of managers that can perform some operations/Owner is always a manager too
contract Manageable is Owned { event ManagerSet(address manager, bool state); mapping (address => bool) public managers; function Manageable() Owned() { managers[owner] = true; } /**@dev Allows execution by managers only */ modifier managerOnly { assert(managers[msg.sender]); _; } function transferOwnership(address _newOwner) public ownerOnly { super.transferOwnership(_newOwner); managers[_newOwner] = true; managers[msg.sender] = false; } function setManager(address manager, bool state) ownerOnly { managers[manager] = state; ManagerSet(manager, state); } }/*************************************************************************
contract Manageable is Owned { event ManagerSet(address manager, bool state); mapping (address => bool) public managers; function Manageable() Owned() { managers[owner] = true; } /**@dev Allows execution by managers only */ modifier managerOnly { assert(managers[msg.sender]); _; } function transferOwnership(address _newOwner) public ownerOnly { super.transferOwnership(_newOwner); managers[_newOwner] = true; managers[msg.sender] = false; } function setManager(address manager, bool state) ownerOnly { managers[manager] = state; ManagerSet(manager, state); } }/*************************************************************************
42,954
9
// Borrows funds from the pool /amountOut the amount requested/to the address to send the funds to/data any data that might be needed during call execution
function borrow(uint amountOut, address to, bytes calldata data) external lock { require(amountOut > 0, 'SFPY: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve, ) = getReserves(); // gas savings require(amountOut < _reserve, 'SFPY: INSUFFICIENT_LIQUIDITY'); require(to != _token, 'SFPY: INVALID_TO'); if (amountOut > 0) _safeTransfer(to, amountOut); // optimistically transfer tokens ISfpyBorrower(to).borrow(msg.sender, amountOut, data); uint256 balance = ISfpyERC20(_token).balanceOf(address(this)); uint256 amountIn = balance > _reserve - amountOut ? balance - (_reserve - amountOut) : 0; require(amountIn > 0, 'SFPY: ZERO_INPUT_AMOUNT'); uint256 feeAmount = amountOut.mul(10 ** 15) / (10 ** 18); // .1% fee (10 ** 15 / 10*18) require(amountIn >= amountOut.add(feeAmount), 'SFPY: INSUFFICIENT_INPUT_AMOUNT'); require(balance >= _reserve, 'SFPY: INSUFFICIENT BALANCE'); _update(balance); }
function borrow(uint amountOut, address to, bytes calldata data) external lock { require(amountOut > 0, 'SFPY: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve, ) = getReserves(); // gas savings require(amountOut < _reserve, 'SFPY: INSUFFICIENT_LIQUIDITY'); require(to != _token, 'SFPY: INVALID_TO'); if (amountOut > 0) _safeTransfer(to, amountOut); // optimistically transfer tokens ISfpyBorrower(to).borrow(msg.sender, amountOut, data); uint256 balance = ISfpyERC20(_token).balanceOf(address(this)); uint256 amountIn = balance > _reserve - amountOut ? balance - (_reserve - amountOut) : 0; require(amountIn > 0, 'SFPY: ZERO_INPUT_AMOUNT'); uint256 feeAmount = amountOut.mul(10 ** 15) / (10 ** 18); // .1% fee (10 ** 15 / 10*18) require(amountIn >= amountOut.add(feeAmount), 'SFPY: INSUFFICIENT_INPUT_AMOUNT'); require(balance >= _reserve, 'SFPY: INSUFFICIENT BALANCE'); _update(balance); }
48,468
12
// Unlimited approve token on RToken address
ICE.approve(address(DFYNRouter), 2**256 - 1); USDC.approve(address(IronSwap), 2**256 - 1); IS3USD.approve(address(IronChef), 2**256 - 1);
ICE.approve(address(DFYNRouter), 2**256 - 1); USDC.approve(address(IronSwap), 2**256 - 1); IS3USD.approve(address(IronChef), 2**256 - 1);
16,857
11
// Swap Porridge for an equal amount of Hot or Cold Peas./peas_ address of Hot or Cold Peas token to receive/amount amount of 1:1 Porridge token to swap
function unswap(address peas_, uint amount) external { // Checks require(peas_ == Hot || peas_ == Cold, "lukewarm peas."); require(porridge.balanceOf(msg.sender) >= amount, 'insufficient porridge.'); // Effects porridge.burn(msg.sender, amount); // Interactions PotInterface peas= PotInterface(peas_); peas.mint(msg.sender, amount); emit Swapped(porridge.name(), peas.name(), amount); }
function unswap(address peas_, uint amount) external { // Checks require(peas_ == Hot || peas_ == Cold, "lukewarm peas."); require(porridge.balanceOf(msg.sender) >= amount, 'insufficient porridge.'); // Effects porridge.burn(msg.sender, amount); // Interactions PotInterface peas= PotInterface(peas_); peas.mint(msg.sender, amount); emit Swapped(porridge.name(), peas.name(), amount); }
28,538
4
// 입력한 지갑 주소의 잔액을 조회 account 조회할 계정 id 토큰 타입return 해당 지갑 수량 반환 /
function getBalance(address account, uint256 id) public view returns(uint256){ return balanceOf(account, id); }
function getBalance(address account, uint256 id) public view returns(uint256){ return balanceOf(account, id); }
51,287
3
// Withdraw the Contribution Tokens userAddr The user address of the Contribution Tokens amount The amount of the Contribution Tokens /
function _withdraw(address userAddr, uint256 amount) internal { Account memory user = accounts[userAddr]; uint256 totalDeposit = totalDeposited; require(user.deposited >= amount, "not enough user Deposit"); user.deposited = safeSub(user.deposited, amount); accounts[userAddr].deposited = user.deposited; totalDeposit = safeSub(totalDeposited, amount); totalDeposited = totalDeposit; if(amount > 0) { /// @dev transfer the Contribution Tokens from this contact. emit Withdraw(userAddr, amount, user.deposited, totalDeposit); require( lpErc.transfer(userAddr, amount), "token error" ); } }
function _withdraw(address userAddr, uint256 amount) internal { Account memory user = accounts[userAddr]; uint256 totalDeposit = totalDeposited; require(user.deposited >= amount, "not enough user Deposit"); user.deposited = safeSub(user.deposited, amount); accounts[userAddr].deposited = user.deposited; totalDeposit = safeSub(totalDeposited, amount); totalDeposited = totalDeposit; if(amount > 0) { /// @dev transfer the Contribution Tokens from this contact. emit Withdraw(userAddr, amount, user.deposited, totalDeposit); require( lpErc.transfer(userAddr, amount), "token error" ); } }
11,181
227
// Owner of token.
var _ownerOfToken = ownerOf(_tokenId);
var _ownerOfToken = ownerOf(_tokenId);
9,384
65
// The implementation being migrated must have been registered (which also implies that `toVersion_` was not 0).
if (toImplementation == address(0)) return false;
if (toImplementation == address(0)) return false;
3,085
11
// return The result of computing the pairing checke(p1[0], p2[0]) ....e(p1[n], p2[n]) == 1For example,pairing([P1(), P1().negate()], [P2(), P2()]) should return true. /
function pairing( G1Point memory a1, G2Point memory a2, G1Point memory b1, G2Point memory b2, G1Point memory c1, G2Point memory c2, G1Point memory d1, G2Point memory d2
function pairing( G1Point memory a1, G2Point memory a2, G1Point memory b1, G2Point memory b2, G1Point memory c1, G2Point memory c2, G1Point memory d1, G2Point memory d2
9,457
426
// Sets the prize strategy of the prize pool.Only callable by the owner./_prizeStrategy The new prize strategy.Must implement TokenListenerInterface
function setPrizeStrategy(TokenListenerInterface _prizeStrategy) external;
function setPrizeStrategy(TokenListenerInterface _prizeStrategy) external;
23,774
7
// MUTUAL UPGRADE: Initializes the issuance module. Operator and Methodologist must each callthis function to execute the update. This method is called after invoking `replaceProtectedModule` or `emergencyReplaceProtectedModule`to configure the replacement streaming fee module's fee settings.FeeState settings encode the following struct```
* struct FeeState { * address feeRecipient; // Address to accrue fees to * uint256 maxStreamingFeePercentage; // Max streaming fee maanager commits to using (1% = 1e16, 100% = 1e18) * uint256 streamingFeePercentage; // Percent of Set accruing to manager annually (1% = 1e16, 100% = 1e18) * uint256 lastStreamingFeeTimestamp; // Timestamp last streaming fee was accrued *}
* struct FeeState { * address feeRecipient; // Address to accrue fees to * uint256 maxStreamingFeePercentage; // Max streaming fee maanager commits to using (1% = 1e16, 100% = 1e18) * uint256 streamingFeePercentage; // Percent of Set accruing to manager annually (1% = 1e16, 100% = 1e18) * uint256 lastStreamingFeeTimestamp; // Timestamp last streaming fee was accrued *}
30,204
24
// if the quote exceeds our balance then max token1 instead
if (amountIn1 > maxAmountIn1) { amountIn1 = maxAmountIn1; maxAmountIn0 = _quoteLiquidityAmountOut(maxAmountIn1, reserve1, reserve0); }
if (amountIn1 > maxAmountIn1) { amountIn1 = maxAmountIn1; maxAmountIn0 = _quoteLiquidityAmountOut(maxAmountIn1, reserve1, reserve0); }
39,995
141
// Store new values
collateralRatio = newCollateralRatio; liquidationDiscount = newLiquidationDiscount; emit NewRiskParameters(oldCollateralRatio.mantissa, collateralRatioMantissa, oldLiquidationDiscount.mantissa, liquidationDiscountMantissa); return uint(Error.NO_ERROR);
collateralRatio = newCollateralRatio; liquidationDiscount = newLiquidationDiscount; emit NewRiskParameters(oldCollateralRatio.mantissa, collateralRatioMantissa, oldLiquidationDiscount.mantissa, liquidationDiscountMantissa); return uint(Error.NO_ERROR);
28,629
42
// delete _keepers[j];
_keepers[j] = 0x7777777777777777777777777777777777777777;
_keepers[j] = 0x7777777777777777777777777777777777777777;
4,503
23
// Write offset to context.
dstHead.offset(generateOrder_context_head_offset).write(tailOffset);
dstHead.offset(generateOrder_context_head_offset).write(tailOffset);
16,973
45
// Check that tokenId was not minted by `_beforeTokenTransfer` hook
require(!_exists(tokenId), "ERC721: token already minted"); unchecked {
require(!_exists(tokenId), "ERC721: token already minted"); unchecked {
52
48
// pay out unclaimed Cycliq rewards
function payoutRewards() public
function payoutRewards() public
20,366
3
// the amount we are try to send from the client
uint256 amount = msg.value; Campaign storage campaign = campaigns[_id]; campaign.donators.push(msg.sender); campaign.donations.push(amount);
uint256 amount = msg.value; Campaign storage campaign = campaigns[_id]; campaign.donators.push(msg.sender); campaign.donations.push(amount);
18,687
41
// Set contract total supply /
function _setTotalSupply(uint256 totalSupply_) internal virtual { _totalSupply = totalSupply_; }
function _setTotalSupply(uint256 totalSupply_) internal virtual { _totalSupply = totalSupply_; }
22,359
44
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c);
if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c);
240
127
// the balances for the liquidity providers
mapping(address => mapping(address => mapping(address => uint))) public liquidityProvided;
mapping(address => mapping(address => mapping(address => uint))) public liquidityProvided;
54,892