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
19
// superadmin on paper wallet for worst case compromise /
address superadmin; mapping(address => bool) sourceAccountBL; mapping(address => bool) destinationAccountBL;
address superadmin; mapping(address => bool) sourceAccountBL; mapping(address => bool) destinationAccountBL;
66,705
175
// Disputes a price request with an active proposal on another address' behalf. Note: this address willreceive any rewards that come from this dispute. However, any bonds are pulled from the caller. disputer address to set as the disputer. requester sender of the initial price request. identifier price identifier to identify the existing request. timestamp timestamp to identify the existing request. ancillaryData ancillary data of the price being requested.return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned tothe disputer once settled if the dispute was value (the proposal was incorrect). /
function disputePriceFor(
function disputePriceFor(
9,093
19
// Add tip to Request value from oracle _requestId being requested to be mined _tip amount the requester is willing to pay to be get on queue. Minersmine the onDeckQueryHash, or the api with the highest payout pool /
function addTip(uint256 _requestId, uint256 _tip) external;
function addTip(uint256 _requestId, uint256 _tip) external;
41,309
92
// Updating the owner details of the ship
CSCPreSaleItem memory _shipObj = allPreSaleItems[_assetId]; _shipObj.owner = _to; allPreSaleItems[_assetId] = _shipObj;
CSCPreSaleItem memory _shipObj = allPreSaleItems[_assetId]; _shipObj.owner = _to; allPreSaleItems[_assetId] = _shipObj;
31,547
24
// Transfer given number of tokens from given owner to given recipient._from address to transfer tokens from the owner of _to address to transfer tokens to the owner of _value number of tokens to transfer from given owner to given recipientreturn true if tokens were transferred successfully, false otherwise /
function transferFrom (address _from, address _to, uint256 _value) returns (bool success);
function transferFrom (address _from, address _to, uint256 _value) returns (bool success);
3,982
95
// Issue tokens to every mint.
for (uint256 i = 0; i < _cnt; i++) { _mint(_mints[i], _amounts[i]); sum = sum.add(_amounts[i]); }
for (uint256 i = 0; i < _cnt; i++) { _mint(_mints[i], _amounts[i]); sum = sum.add(_amounts[i]); }
52,006
66
// The RequestFactory which produces requests for this scheduler.
address public factoryAddress;
address public factoryAddress;
15,962
5
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.If this function is called again it overwrites the current allowance with _value.this function is required for some DEX functionality
function approve(address _spender, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
14,151
4
// _creators[creatorId] = Creator(creatorData, subscriptionFee, emptyAddressArray, 0);
_addressToCreatorId[msg.sender] = creatorId; emit CreatorAdded(creatorId, _subscriptionFee);
_addressToCreatorId[msg.sender] = creatorId; emit CreatorAdded(creatorId, _subscriptionFee);
25,211
56
// Decode the length of the stored array like in concatStorage().
let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes)
let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes)
21,519
3
// convert uint256 to bytes
function toBytes(uint256 _num) public pure returns (bytes memory _ret) { assembly { _ret := mload(0x10) mstore(_ret, 0x20) mstore(add(_ret, 0x20), _num) } }
function toBytes(uint256 _num) public pure returns (bytes memory _ret) { assembly { _ret := mload(0x10) mstore(_ret, 0x20) mstore(add(_ret, 0x20), _num) } }
1,928
4
// buy Dai on Uniswap (receive a minimum of 0 Dai and send it back to the sender) bear in mind that setting a 0 minimum balance is not a good practice and can even be a security risk so for production code, calculate the min amount before doing the swap
uniswapRouter.swapExactETHForTokens{value: msg.value}(0, path, msg.sender, deadline);
uniswapRouter.swapExactETHForTokens{value: msg.value}(0, path, msg.sender, deadline);
158
35
// transferFrom is uesd to transfer Tokens from a Accounts allowanceSpender address should be the token holder Requires- The caller must have a allowance = or bigger than the amount spending /
function transferFrom( address sender, address recipient, uint256 amount
function transferFrom( address sender, address recipient, uint256 amount
32,799
45
// return Returns if the reward has been claimed, can only be viewed when there is nolottery in progress or will return false. /
function rewardClaimed() external view override onlyEnded returns (bool) { return _rewardClaimed; }
function rewardClaimed() external view override onlyEnded returns (bool) { return _rewardClaimed; }
58,562
4
// return relayHub The address of the `RelayHub` that is trusted by this Paymaster to execute the requests. /
function getRelayHub() external view returns (address relayHub);
function getRelayHub() external view returns (address relayHub);
11,175
73
// Creates the proxy for the dst address
proxy = ProxyRegistryLike(proxyRegistry).build(dst);
proxy = ProxyRegistryLike(proxyRegistry).build(dst);
32,596
12
// (μƒλž΅) (1) μ—μŠ€ν¬λ‘œ
contract Escrow { // (2) μƒνƒœλ³€μˆ˜ CeightToken public token; // 토큰 uint256 public salesVolume; // νŒλ§€λŸ‰ uint256 public sellingPrice; // 판맀 가격 uint256 public deadline; // κΈ°ν•œ bool public isOpened; // μ—μŠ€ν¬λ‘œ κ°œμ‹œ ν”Œλž˜κ·Έ // (3) 이벀트 μ•Œλ¦Ό event EscrowStart(uint salesVolume, uint sellingPrice, uint deadline, address beneficiary); event ConfirmedPayment(address addr, uint amount); // (4) μƒμ„±μž function Escrow (CeightToken _token, uint256 _salesVolume, uint256 _priceInEther) public { token = CeightToken(_token); salesVolume = _salesVolume; sellingPrice = _priceInEther * 1 ether; } // (5) 이름 μ—†λŠ” ν•¨μˆ˜ (Ether 수령) function () public payabe { // κ°œμ‹œ μ „ λ˜λŠ” κΈ°ν•œμ΄ λλ‚œ κ²½μš°μ—λŠ” μ˜ˆμ™Έ 처리 if (!isOpened || now >= deadline) revert(); // 판맀 가격 미만인 경우 μ˜ˆμ™Έ 처리 uint amount = msg.value; if (amount < sellingPrice) revert(); // λ³΄λ‚΄λŠ” μ‚¬λžŒμ—κ²Œ 토큰을 μ „λ‹¬ν•˜κ³  μ—μŠ€ν¬λ‘œ κ°œμ‹œ ν”Œλž˜κ·Έλ₯Ό false둜 μ„€μ • token.transfer(msg.sender, salesVolume); isOpened = false; ConfirmedPayment(msg.sender, amount); } // (6) κ°œμ‹œ (토큰이 μ˜ˆμ • 수 이상이라면 κ°œμ‹œ) function start(uint256 _durationInMinutes) public onlyOwner { if (token == address(0) || salesVolume == 0 || sellingPrice == 0 || deadline != 0) revert(); if (token.balanceOf(this) >= salesVolume){ deadline = now + _durationInMinutes * 1 minutes; isOpened = true; EscrowStart(salesVolume, sellingPrice, deadline, owner); } } // (7) 남은 μ‹œκ°„ ν™•μΈμš© λ©”μ„œλ“œ (λΆ„ λ‹¨μœ„) function getRemainingTime() constant public returns(uint min) { if (now < deadline) { min = (deadline - now) / (1 minutes); } } // (8) μ’…λ£Œ function close() public onlyOwner { // 토큰을 μ†Œμœ μžμ—κ²Œ 전솑 token.transfer(owner, token.balanceOf(this)); // 계약을 파기 (ν•΄λ‹Ή 계약이 λ³΄μœ ν•˜κ³  μžˆλŠ” EhterλŠ” μ†Œμœ μžμ—κ²Œ 전솑) selfdestruct(owner); } }
contract Escrow { // (2) μƒνƒœλ³€μˆ˜ CeightToken public token; // 토큰 uint256 public salesVolume; // νŒλ§€λŸ‰ uint256 public sellingPrice; // 판맀 가격 uint256 public deadline; // κΈ°ν•œ bool public isOpened; // μ—μŠ€ν¬λ‘œ κ°œμ‹œ ν”Œλž˜κ·Έ // (3) 이벀트 μ•Œλ¦Ό event EscrowStart(uint salesVolume, uint sellingPrice, uint deadline, address beneficiary); event ConfirmedPayment(address addr, uint amount); // (4) μƒμ„±μž function Escrow (CeightToken _token, uint256 _salesVolume, uint256 _priceInEther) public { token = CeightToken(_token); salesVolume = _salesVolume; sellingPrice = _priceInEther * 1 ether; } // (5) 이름 μ—†λŠ” ν•¨μˆ˜ (Ether 수령) function () public payabe { // κ°œμ‹œ μ „ λ˜λŠ” κΈ°ν•œμ΄ λλ‚œ κ²½μš°μ—λŠ” μ˜ˆμ™Έ 처리 if (!isOpened || now >= deadline) revert(); // 판맀 가격 미만인 경우 μ˜ˆμ™Έ 처리 uint amount = msg.value; if (amount < sellingPrice) revert(); // λ³΄λ‚΄λŠ” μ‚¬λžŒμ—κ²Œ 토큰을 μ „λ‹¬ν•˜κ³  μ—μŠ€ν¬λ‘œ κ°œμ‹œ ν”Œλž˜κ·Έλ₯Ό false둜 μ„€μ • token.transfer(msg.sender, salesVolume); isOpened = false; ConfirmedPayment(msg.sender, amount); } // (6) κ°œμ‹œ (토큰이 μ˜ˆμ • 수 이상이라면 κ°œμ‹œ) function start(uint256 _durationInMinutes) public onlyOwner { if (token == address(0) || salesVolume == 0 || sellingPrice == 0 || deadline != 0) revert(); if (token.balanceOf(this) >= salesVolume){ deadline = now + _durationInMinutes * 1 minutes; isOpened = true; EscrowStart(salesVolume, sellingPrice, deadline, owner); } } // (7) 남은 μ‹œκ°„ ν™•μΈμš© λ©”μ„œλ“œ (λΆ„ λ‹¨μœ„) function getRemainingTime() constant public returns(uint min) { if (now < deadline) { min = (deadline - now) / (1 minutes); } } // (8) μ’…λ£Œ function close() public onlyOwner { // 토큰을 μ†Œμœ μžμ—κ²Œ 전솑 token.transfer(owner, token.balanceOf(this)); // 계약을 파기 (ν•΄λ‹Ή 계약이 λ³΄μœ ν•˜κ³  μžˆλŠ” EhterλŠ” μ†Œμœ μžμ—κ²Œ 전솑) selfdestruct(owner); } }
10,782
12
// Admin fee 1%
uint256 adminFee = msg.value.div(100); admin.send(adminFee); // solium-disable-line security/no-send emit AdminFeePayed(msg.sender, adminFee);
uint256 adminFee = msg.value.div(100); admin.send(adminFee); // solium-disable-line security/no-send emit AdminFeePayed(msg.sender, adminFee);
4,586
17
// Burns existing supply//Only accessible to the role MINTER//_from Owner of the tokens to burn/_amount Amount to mint
function burn(address _from, uint256 _amount) public override(ITalentToken) onlyRole(ROLE_MINTER) { // if we have already reached MAX_SUPPLY, we don't ever want to allow // minting, even if a burn has occured afterwards if (mintingAvailability > 0) { mintingAvailability += _amount; } _burn(_from, _amount); }
function burn(address _from, uint256 _amount) public override(ITalentToken) onlyRole(ROLE_MINTER) { // if we have already reached MAX_SUPPLY, we don't ever want to allow // minting, even if a burn has occured afterwards if (mintingAvailability > 0) { mintingAvailability += _amount; } _burn(_from, _amount); }
21,053
45
// Abdomen 6-7
temp = dinoGen[tokenId][1];
temp = dinoGen[tokenId][1];
10,335
9
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MODIFIERS^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
modifier onlyDevs() { require(admins_[msg.sender].isDev == true, "onlyDevs failed - msg.sender is not a dev"); _; }
modifier onlyDevs() { require(admins_[msg.sender].isDev == true, "onlyDevs failed - msg.sender is not a dev"); _; }
9,014
69
// Function to extend the transfer locking periods up to one more week. Must be executed before the current public release date. delay The amount of hours to extend the locking period.return True if the operation was successful. /
function extendLockPeriods(uint delay, bool extendGrantLock) onlyOwner public returns (bool success) { require(now < publicRelease && 0 < delay && delay <= 168); delay = delay * 3600; publicRelease = publicRelease.add(delay); partnersRelease = partnersRelease.add(delay); assert(publicRelease <= partnersRelease); UpdatedPublicReleaseDate(publicRelease); UpdatedPartnersReleaseDate(partnersRelease); if (extendGrantLock) { grantsUnlock = grantsUnlock.add(delay); assert(grantsUnlock < partnersRelease); UpdatedGrantsLockDate(grantsUnlock); } return true; }
function extendLockPeriods(uint delay, bool extendGrantLock) onlyOwner public returns (bool success) { require(now < publicRelease && 0 < delay && delay <= 168); delay = delay * 3600; publicRelease = publicRelease.add(delay); partnersRelease = partnersRelease.add(delay); assert(publicRelease <= partnersRelease); UpdatedPublicReleaseDate(publicRelease); UpdatedPartnersReleaseDate(partnersRelease); if (extendGrantLock) { grantsUnlock = grantsUnlock.add(delay); assert(grantsUnlock < partnersRelease); UpdatedGrantsLockDate(grantsUnlock); } return true; }
23,178
99
// Check that transfer returns true or null
require( checkSuccess(), "ERC20Wrapper.transfer: Bad return value" );
require( checkSuccess(), "ERC20Wrapper.transfer: Bad return value" );
52,584
15
// IAlchemistV2Actions/Alchemix Finance//Specifies user actions.
interface IAlchemistV2Actions { /// @notice Approve `spender` to mint `amount` debt tokens. /// /// **_NOTE:_** This function is WHITELISTED. /// /// @param spender The address that will be approved to mint. /// @param amount The amount of tokens that `spender` will be allowed to mint. function approveMint(address spender, uint256 amount) external; /// @notice Approve `spender` to withdraw `amount` shares of `yieldToken`. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @param spender The address that will be approved to withdraw. /// @param yieldToken The address of the yield token that `spender` will be allowed to withdraw. /// @param shares The amount of shares that `spender` will be allowed to withdraw. function approveWithdraw( address spender, address yieldToken, uint256 shares ) external; /// @notice Synchronizes the state of the account owned by `owner`. /// /// @param owner The owner of the account to synchronize. function poke(address owner) external; /// @notice Deposit a yield token into a user's account. /// /// @notice An approval must be set for `yieldToken` which is greater than `amount`. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `yieldToken` must be enabled or this call will revert with a {TokenDisabled} error. /// @notice `yieldToken` underlying token must be enabled or this call will revert with a {TokenDisabled} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `amount` must be greater than zero or the call will revert with an {IllegalArgument} error. /// /// @notice Emits a {Deposit} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **_NOTE:_** When depositing, the `AlchemistV2` contract must have **allowance()** to spend funds on behalf of **msg.sender** for at least **amount** of the **yieldToken** being deposited. This can be done via the standard `ERC20.approve()` method. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 amount = 50000; /// @notice IERC20(ydai).approve(alchemistAddress, amount); /// @notice AlchemistV2(alchemistAddress).deposit(ydai, amount, msg.sender); /// @notice ``` /// /// @param yieldToken The yield-token to deposit. /// @param amount The amount of yield tokens to deposit. /// @param recipient The owner of the account that will receive the resulting shares. /// /// @return sharesIssued The number of shares issued to `recipient`. function deposit( address yieldToken, uint256 amount, address recipient ) external returns (uint256 sharesIssued); /// @notice Deposit an underlying token into the account of `recipient` as `yieldToken`. /// /// @notice An approval must be set for the underlying token of `yieldToken` which is greater than `amount`. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `amount` must be greater than zero or the call will revert with an {IllegalArgument} error. /// /// @notice Emits a {Deposit} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// @notice **_NOTE:_** When depositing, the `AlchemistV2` contract must have **allowance()** to spend funds on behalf of **msg.sender** for at least **amount** of the **underlyingToken** being deposited. This can be done via the standard `ERC20.approve()` method. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 amount = 50000; /// @notice AlchemistV2(alchemistAddress).depositUnderlying(ydai, amount, msg.sender, 1); /// @notice ``` /// /// @param yieldToken The address of the yield token to wrap the underlying tokens into. /// @param amount The amount of the underlying token to deposit. /// @param recipient The address of the recipient. /// @param minimumAmountOut The minimum amount of yield tokens that are expected to be deposited to `recipient`. /// /// @return sharesIssued The number of shares issued to `recipient`. function depositUnderlying( address yieldToken, uint256 amount, address recipient, uint256 minimumAmountOut ) external returns (uint256 sharesIssued); /// @notice Withdraw yield tokens to `recipient` by burning `share` shares. The number of yield tokens withdrawn to `recipient` will depend on the value of shares for that yield token at the time of the call. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// /// @notice Emits a {Withdraw} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 pps = AlchemistV2(alchemistAddress).getYieldTokensPerShare(ydai); /// @notice uint256 amtYieldTokens = 5000; /// @notice AlchemistV2(alchemistAddress).withdraw(ydai, amtYieldTokens / pps, msg.sender); /// @notice ``` /// /// @param yieldToken The address of the yield token to withdraw. /// @param shares The number of shares to burn. /// @param recipient The address of the recipient. /// /// @return amountWithdrawn The number of yield tokens that were withdrawn to `recipient`. function withdraw( address yieldToken, uint256 shares, address recipient ) external returns (uint256 amountWithdrawn); /// @notice Withdraw yield tokens to `recipient` by burning `share` shares from the account of `owner` /// /// @notice `owner` must have an withdrawal allowance which is greater than `amount` for this call to succeed. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// /// @notice Emits a {Withdraw} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 pps = AlchemistV2(alchemistAddress).getYieldTokensPerShare(ydai); /// @notice uint256 amtYieldTokens = 5000; /// @notice AlchemistV2(alchemistAddress).withdrawFrom(msg.sender, ydai, amtYieldTokens / pps, msg.sender); /// @notice ``` /// /// @param owner The address of the account owner to withdraw from. /// @param yieldToken The address of the yield token to withdraw. /// @param shares The number of shares to burn. /// @param recipient The address of the recipient. /// /// @return amountWithdrawn The number of yield tokens that were withdrawn to `recipient`. function withdrawFrom( address owner, address yieldToken, uint256 shares, address recipient ) external returns (uint256 amountWithdrawn); /// @notice Withdraw underlying tokens to `recipient` by burning `share` shares and unwrapping the yield tokens that the shares were redeemed for. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice The loss in expected value of `yieldToken` must be less than the maximum permitted by the system or this call will revert with a {LossExceeded} error. /// /// @notice Emits a {Withdraw} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// @notice **_NOTE:_** The caller of `withdrawFrom()` must have **withdrawAllowance()** to withdraw funds on behalf of **owner** for at least the amount of `yieldTokens` that **shares** will be converted to. This can be done via the `approveWithdraw()` or `permitWithdraw()` methods. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 pps = AlchemistV2(alchemistAddress).getUnderlyingTokensPerShare(ydai); /// @notice uint256 amountUnderlyingTokens = 5000; /// @notice AlchemistV2(alchemistAddress).withdrawUnderlying(ydai, amountUnderlyingTokens / pps, msg.sender, 1); /// @notice ``` /// /// @param yieldToken The address of the yield token to withdraw. /// @param shares The number of shares to burn. /// @param recipient The address of the recipient. /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be withdrawn to `recipient`. /// /// @return amountWithdrawn The number of underlying tokens that were withdrawn to `recipient`. function withdrawUnderlying( address yieldToken, uint256 shares, address recipient, uint256 minimumAmountOut ) external returns (uint256 amountWithdrawn); /// @notice Withdraw underlying tokens to `recipient` by burning `share` shares from the account of `owner` and unwrapping the yield tokens that the shares were redeemed for. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice The loss in expected value of `yieldToken` must be less than the maximum permitted by the system or this call will revert with a {LossExceeded} error. /// /// @notice Emits a {Withdraw} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// @notice **_NOTE:_** The caller of `withdrawFrom()` must have **withdrawAllowance()** to withdraw funds on behalf of **owner** for at least the amount of `yieldTokens` that **shares** will be converted to. This can be done via the `approveWithdraw()` or `permitWithdraw()` methods. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 pps = AlchemistV2(alchemistAddress).getUnderlyingTokensPerShare(ydai); /// @notice uint256 amtUnderlyingTokens = 5000 * 10**ydai.decimals(); /// @notice AlchemistV2(alchemistAddress).withdrawUnderlying(msg.sender, ydai, amtUnderlyingTokens / pps, msg.sender, 1); /// @notice ``` /// /// @param owner The address of the account owner to withdraw from. /// @param yieldToken The address of the yield token to withdraw. /// @param shares The number of shares to burn. /// @param recipient The address of the recipient. /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be withdrawn to `recipient`. /// /// @return amountWithdrawn The number of underlying tokens that were withdrawn to `recipient`. function withdrawUnderlyingFrom( address owner, address yieldToken, uint256 shares, address recipient, uint256 minimumAmountOut ) external returns (uint256 amountWithdrawn); /// @notice Mint `amount` debt tokens. /// /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error. /// /// @notice Emits a {Mint} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice uint256 amtDebt = 5000; /// @notice AlchemistV2(alchemistAddress).mint(amtDebt, msg.sender); /// @notice ``` /// /// @param amount The amount of tokens to mint. /// @param recipient The address of the recipient. function mint(uint256 amount, address recipient) external; /// @notice Mint `amount` debt tokens from the account owned by `owner` to `recipient`. /// /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error. /// /// @notice Emits a {Mint} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// @notice **_NOTE:_** The caller of `mintFrom()` must have **mintAllowance()** to mint debt from the `Account` controlled by **owner** for at least the amount of **yieldTokens** that **shares** will be converted to. This can be done via the `approveMint()` or `permitMint()` methods. /// /// @notice **Example:** /// @notice ``` /// @notice uint256 amtDebt = 5000; /// @notice AlchemistV2(alchemistAddress).mintFrom(msg.sender, amtDebt, msg.sender); /// @notice ``` /// /// @param owner The address of the owner of the account to mint from. /// @param amount The amount of tokens to mint. /// @param recipient The address of the recipient. function mintFrom( address owner, uint256 amount, address recipient ) external; /// @notice Burn `amount` debt tokens to credit the account owned by `recipient`. /// /// @notice `amount` will be limited up to the amount of debt that `recipient` currently holds. /// /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error. /// @notice `recipient` must have non-zero debt or this call will revert with an {IllegalState} error. /// /// @notice Emits a {Burn} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice uint256 amtBurn = 5000; /// @notice AlchemistV2(alchemistAddress).burn(amtBurn, msg.sender); /// @notice ``` /// /// @param amount The amount of tokens to burn. /// @param recipient The address of the recipient. /// /// @return amountBurned The amount of tokens that were burned. function burn(uint256 amount, address recipient) external returns (uint256 amountBurned); /// @notice Repay `amount` debt using `underlyingToken` to credit the account owned by `recipient`. /// /// @notice `amount` will be limited up to the amount of debt that `recipient` currently holds. /// /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `underlyingToken` must be enabled or this call will revert with a {TokenDisabled} error. /// @notice `amount` must be less than or equal to the current available repay limit or this call will revert with a {ReplayLimitExceeded} error. /// /// @notice Emits a {Repay} event. /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice address dai = 0x6b175474e89094c44da98b954eedeac495271d0f; /// @notice uint256 amtRepay = 5000; /// @notice AlchemistV2(alchemistAddress).repay(dai, amtRepay, msg.sender); /// @notice ``` /// /// @param underlyingToken The address of the underlying token to repay. /// @param amount The amount of the underlying token to repay. /// @param recipient The address of the recipient which will receive credit. /// /// @return amountRepaid The amount of tokens that were repaid. function repay( address underlyingToken, uint256 amount, address recipient ) external returns (uint256 amountRepaid); /// @notice /// /// @notice `shares` will be limited up to an equal amount of debt that `recipient` currently holds. /// /// @notice `shares` must be greater than zero or this call will revert with a {IllegalArgument} error. /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `yieldToken` must be enabled or this call will revert with a {TokenDisabled} error. /// @notice `yieldToken` underlying token must be enabled or this call will revert with a {TokenDisabled} error. /// @notice The loss in expected value of `yieldToken` must be less than the maximum permitted by the system or this call will revert with a {LossExceeded} error. /// @notice `amount` must be less than or equal to the current available liquidation limit or this call will revert with a {LiquidationLimitExceeded} error. /// /// @notice Emits a {Liquidate} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 amtSharesLiquidate = 5000 * 10**ydai.decimals(); /// @notice AlchemistV2(alchemistAddress).liquidate(ydai, amtSharesLiquidate, 1); /// @notice ``` /// /// @param yieldToken The address of the yield token to liquidate. /// @param shares The number of shares to burn for credit. /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be liquidated. /// /// @return sharesLiquidated The amount of shares that were liquidated. function liquidate( address yieldToken, uint256 shares, uint256 minimumAmountOut ) external returns (uint256 sharesLiquidated); /// @notice Burns `amount` debt tokens to credit accounts which have deposited `yieldToken`. /// /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error. /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// /// @notice Emits a {Donate} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 amtSharesLiquidate = 5000; /// @notice AlchemistV2(alchemistAddress).liquidate(dai, amtSharesLiquidate, 1); /// @notice ``` /// /// @param yieldToken The address of the yield token to credit accounts for. /// @param amount The amount of debt tokens to burn. function donate(address yieldToken, uint256 amount) external; /// @notice Harvests outstanding yield that a yield token has accumulated and distributes it as credit to holders. /// /// @notice `msg.sender` must be a keeper or this call will revert with an {Unauthorized} error. /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice The amount being harvested must be greater than zero or else this call will revert with an {IllegalState} error. /// /// @notice Emits a {Harvest} event. /// /// @param yieldToken The address of the yield token to harvest. /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be withdrawn to `recipient`. function harvest(address yieldToken, uint256 minimumAmountOut) external; }
interface IAlchemistV2Actions { /// @notice Approve `spender` to mint `amount` debt tokens. /// /// **_NOTE:_** This function is WHITELISTED. /// /// @param spender The address that will be approved to mint. /// @param amount The amount of tokens that `spender` will be allowed to mint. function approveMint(address spender, uint256 amount) external; /// @notice Approve `spender` to withdraw `amount` shares of `yieldToken`. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @param spender The address that will be approved to withdraw. /// @param yieldToken The address of the yield token that `spender` will be allowed to withdraw. /// @param shares The amount of shares that `spender` will be allowed to withdraw. function approveWithdraw( address spender, address yieldToken, uint256 shares ) external; /// @notice Synchronizes the state of the account owned by `owner`. /// /// @param owner The owner of the account to synchronize. function poke(address owner) external; /// @notice Deposit a yield token into a user's account. /// /// @notice An approval must be set for `yieldToken` which is greater than `amount`. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `yieldToken` must be enabled or this call will revert with a {TokenDisabled} error. /// @notice `yieldToken` underlying token must be enabled or this call will revert with a {TokenDisabled} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `amount` must be greater than zero or the call will revert with an {IllegalArgument} error. /// /// @notice Emits a {Deposit} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **_NOTE:_** When depositing, the `AlchemistV2` contract must have **allowance()** to spend funds on behalf of **msg.sender** for at least **amount** of the **yieldToken** being deposited. This can be done via the standard `ERC20.approve()` method. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 amount = 50000; /// @notice IERC20(ydai).approve(alchemistAddress, amount); /// @notice AlchemistV2(alchemistAddress).deposit(ydai, amount, msg.sender); /// @notice ``` /// /// @param yieldToken The yield-token to deposit. /// @param amount The amount of yield tokens to deposit. /// @param recipient The owner of the account that will receive the resulting shares. /// /// @return sharesIssued The number of shares issued to `recipient`. function deposit( address yieldToken, uint256 amount, address recipient ) external returns (uint256 sharesIssued); /// @notice Deposit an underlying token into the account of `recipient` as `yieldToken`. /// /// @notice An approval must be set for the underlying token of `yieldToken` which is greater than `amount`. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `amount` must be greater than zero or the call will revert with an {IllegalArgument} error. /// /// @notice Emits a {Deposit} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// @notice **_NOTE:_** When depositing, the `AlchemistV2` contract must have **allowance()** to spend funds on behalf of **msg.sender** for at least **amount** of the **underlyingToken** being deposited. This can be done via the standard `ERC20.approve()` method. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 amount = 50000; /// @notice AlchemistV2(alchemistAddress).depositUnderlying(ydai, amount, msg.sender, 1); /// @notice ``` /// /// @param yieldToken The address of the yield token to wrap the underlying tokens into. /// @param amount The amount of the underlying token to deposit. /// @param recipient The address of the recipient. /// @param minimumAmountOut The minimum amount of yield tokens that are expected to be deposited to `recipient`. /// /// @return sharesIssued The number of shares issued to `recipient`. function depositUnderlying( address yieldToken, uint256 amount, address recipient, uint256 minimumAmountOut ) external returns (uint256 sharesIssued); /// @notice Withdraw yield tokens to `recipient` by burning `share` shares. The number of yield tokens withdrawn to `recipient` will depend on the value of shares for that yield token at the time of the call. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// /// @notice Emits a {Withdraw} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 pps = AlchemistV2(alchemistAddress).getYieldTokensPerShare(ydai); /// @notice uint256 amtYieldTokens = 5000; /// @notice AlchemistV2(alchemistAddress).withdraw(ydai, amtYieldTokens / pps, msg.sender); /// @notice ``` /// /// @param yieldToken The address of the yield token to withdraw. /// @param shares The number of shares to burn. /// @param recipient The address of the recipient. /// /// @return amountWithdrawn The number of yield tokens that were withdrawn to `recipient`. function withdraw( address yieldToken, uint256 shares, address recipient ) external returns (uint256 amountWithdrawn); /// @notice Withdraw yield tokens to `recipient` by burning `share` shares from the account of `owner` /// /// @notice `owner` must have an withdrawal allowance which is greater than `amount` for this call to succeed. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// /// @notice Emits a {Withdraw} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 pps = AlchemistV2(alchemistAddress).getYieldTokensPerShare(ydai); /// @notice uint256 amtYieldTokens = 5000; /// @notice AlchemistV2(alchemistAddress).withdrawFrom(msg.sender, ydai, amtYieldTokens / pps, msg.sender); /// @notice ``` /// /// @param owner The address of the account owner to withdraw from. /// @param yieldToken The address of the yield token to withdraw. /// @param shares The number of shares to burn. /// @param recipient The address of the recipient. /// /// @return amountWithdrawn The number of yield tokens that were withdrawn to `recipient`. function withdrawFrom( address owner, address yieldToken, uint256 shares, address recipient ) external returns (uint256 amountWithdrawn); /// @notice Withdraw underlying tokens to `recipient` by burning `share` shares and unwrapping the yield tokens that the shares were redeemed for. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice The loss in expected value of `yieldToken` must be less than the maximum permitted by the system or this call will revert with a {LossExceeded} error. /// /// @notice Emits a {Withdraw} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// @notice **_NOTE:_** The caller of `withdrawFrom()` must have **withdrawAllowance()** to withdraw funds on behalf of **owner** for at least the amount of `yieldTokens` that **shares** will be converted to. This can be done via the `approveWithdraw()` or `permitWithdraw()` methods. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 pps = AlchemistV2(alchemistAddress).getUnderlyingTokensPerShare(ydai); /// @notice uint256 amountUnderlyingTokens = 5000; /// @notice AlchemistV2(alchemistAddress).withdrawUnderlying(ydai, amountUnderlyingTokens / pps, msg.sender, 1); /// @notice ``` /// /// @param yieldToken The address of the yield token to withdraw. /// @param shares The number of shares to burn. /// @param recipient The address of the recipient. /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be withdrawn to `recipient`. /// /// @return amountWithdrawn The number of underlying tokens that were withdrawn to `recipient`. function withdrawUnderlying( address yieldToken, uint256 shares, address recipient, uint256 minimumAmountOut ) external returns (uint256 amountWithdrawn); /// @notice Withdraw underlying tokens to `recipient` by burning `share` shares from the account of `owner` and unwrapping the yield tokens that the shares were redeemed for. /// /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice The loss in expected value of `yieldToken` must be less than the maximum permitted by the system or this call will revert with a {LossExceeded} error. /// /// @notice Emits a {Withdraw} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// @notice **_NOTE:_** The caller of `withdrawFrom()` must have **withdrawAllowance()** to withdraw funds on behalf of **owner** for at least the amount of `yieldTokens` that **shares** will be converted to. This can be done via the `approveWithdraw()` or `permitWithdraw()` methods. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 pps = AlchemistV2(alchemistAddress).getUnderlyingTokensPerShare(ydai); /// @notice uint256 amtUnderlyingTokens = 5000 * 10**ydai.decimals(); /// @notice AlchemistV2(alchemistAddress).withdrawUnderlying(msg.sender, ydai, amtUnderlyingTokens / pps, msg.sender, 1); /// @notice ``` /// /// @param owner The address of the account owner to withdraw from. /// @param yieldToken The address of the yield token to withdraw. /// @param shares The number of shares to burn. /// @param recipient The address of the recipient. /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be withdrawn to `recipient`. /// /// @return amountWithdrawn The number of underlying tokens that were withdrawn to `recipient`. function withdrawUnderlyingFrom( address owner, address yieldToken, uint256 shares, address recipient, uint256 minimumAmountOut ) external returns (uint256 amountWithdrawn); /// @notice Mint `amount` debt tokens. /// /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error. /// /// @notice Emits a {Mint} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice uint256 amtDebt = 5000; /// @notice AlchemistV2(alchemistAddress).mint(amtDebt, msg.sender); /// @notice ``` /// /// @param amount The amount of tokens to mint. /// @param recipient The address of the recipient. function mint(uint256 amount, address recipient) external; /// @notice Mint `amount` debt tokens from the account owned by `owner` to `recipient`. /// /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error. /// /// @notice Emits a {Mint} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// @notice **_NOTE:_** The caller of `mintFrom()` must have **mintAllowance()** to mint debt from the `Account` controlled by **owner** for at least the amount of **yieldTokens** that **shares** will be converted to. This can be done via the `approveMint()` or `permitMint()` methods. /// /// @notice **Example:** /// @notice ``` /// @notice uint256 amtDebt = 5000; /// @notice AlchemistV2(alchemistAddress).mintFrom(msg.sender, amtDebt, msg.sender); /// @notice ``` /// /// @param owner The address of the owner of the account to mint from. /// @param amount The amount of tokens to mint. /// @param recipient The address of the recipient. function mintFrom( address owner, uint256 amount, address recipient ) external; /// @notice Burn `amount` debt tokens to credit the account owned by `recipient`. /// /// @notice `amount` will be limited up to the amount of debt that `recipient` currently holds. /// /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error. /// @notice `recipient` must have non-zero debt or this call will revert with an {IllegalState} error. /// /// @notice Emits a {Burn} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice uint256 amtBurn = 5000; /// @notice AlchemistV2(alchemistAddress).burn(amtBurn, msg.sender); /// @notice ``` /// /// @param amount The amount of tokens to burn. /// @param recipient The address of the recipient. /// /// @return amountBurned The amount of tokens that were burned. function burn(uint256 amount, address recipient) external returns (uint256 amountBurned); /// @notice Repay `amount` debt using `underlyingToken` to credit the account owned by `recipient`. /// /// @notice `amount` will be limited up to the amount of debt that `recipient` currently holds. /// /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error. /// @notice `recipient` must be non-zero or this call will revert with an {IllegalArgument} error. /// @notice `underlyingToken` must be enabled or this call will revert with a {TokenDisabled} error. /// @notice `amount` must be less than or equal to the current available repay limit or this call will revert with a {ReplayLimitExceeded} error. /// /// @notice Emits a {Repay} event. /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice address dai = 0x6b175474e89094c44da98b954eedeac495271d0f; /// @notice uint256 amtRepay = 5000; /// @notice AlchemistV2(alchemistAddress).repay(dai, amtRepay, msg.sender); /// @notice ``` /// /// @param underlyingToken The address of the underlying token to repay. /// @param amount The amount of the underlying token to repay. /// @param recipient The address of the recipient which will receive credit. /// /// @return amountRepaid The amount of tokens that were repaid. function repay( address underlyingToken, uint256 amount, address recipient ) external returns (uint256 amountRepaid); /// @notice /// /// @notice `shares` will be limited up to an equal amount of debt that `recipient` currently holds. /// /// @notice `shares` must be greater than zero or this call will revert with a {IllegalArgument} error. /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice `yieldToken` must be enabled or this call will revert with a {TokenDisabled} error. /// @notice `yieldToken` underlying token must be enabled or this call will revert with a {TokenDisabled} error. /// @notice The loss in expected value of `yieldToken` must be less than the maximum permitted by the system or this call will revert with a {LossExceeded} error. /// @notice `amount` must be less than or equal to the current available liquidation limit or this call will revert with a {LiquidationLimitExceeded} error. /// /// @notice Emits a {Liquidate} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 amtSharesLiquidate = 5000 * 10**ydai.decimals(); /// @notice AlchemistV2(alchemistAddress).liquidate(ydai, amtSharesLiquidate, 1); /// @notice ``` /// /// @param yieldToken The address of the yield token to liquidate. /// @param shares The number of shares to burn for credit. /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be liquidated. /// /// @return sharesLiquidated The amount of shares that were liquidated. function liquidate( address yieldToken, uint256 shares, uint256 minimumAmountOut ) external returns (uint256 sharesLiquidated); /// @notice Burns `amount` debt tokens to credit accounts which have deposited `yieldToken`. /// /// @notice `amount` must be greater than zero or this call will revert with a {IllegalArgument} error. /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// /// @notice Emits a {Donate} event. /// /// @notice **_NOTE:_** This function is WHITELISTED. /// /// @notice **Example:** /// @notice ``` /// @notice address ydai = 0xdA816459F1AB5631232FE5e97a05BBBb94970c95; /// @notice uint256 amtSharesLiquidate = 5000; /// @notice AlchemistV2(alchemistAddress).liquidate(dai, amtSharesLiquidate, 1); /// @notice ``` /// /// @param yieldToken The address of the yield token to credit accounts for. /// @param amount The amount of debt tokens to burn. function donate(address yieldToken, uint256 amount) external; /// @notice Harvests outstanding yield that a yield token has accumulated and distributes it as credit to holders. /// /// @notice `msg.sender` must be a keeper or this call will revert with an {Unauthorized} error. /// @notice `yieldToken` must be registered or this call will revert with a {UnsupportedToken} error. /// @notice The amount being harvested must be greater than zero or else this call will revert with an {IllegalState} error. /// /// @notice Emits a {Harvest} event. /// /// @param yieldToken The address of the yield token to harvest. /// @param minimumAmountOut The minimum amount of underlying tokens that are expected to be withdrawn to `recipient`. function harvest(address yieldToken, uint256 minimumAmountOut) external; }
39,730
9
// Metadata
uint256 public revealTimeStamp; string public metadataURI; address public proxyRegistryAddress;
uint256 public revealTimeStamp; string public metadataURI; address public proxyRegistryAddress;
9,305
17
// Super Token Factory// Get the super token factoryreturn factory The factory /
function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);
function getSuperTokenFactory() external view returns (ISuperTokenFactory factory);
29,280
213
// Set the number of confirmation blocks/fromBlockNumber Block number from which the update applies/newConfirmationBlocks The new confirmation blocks value
function setConfirmationBlocks(uint256 fromBlockNumber, uint256 newConfirmationBlocks) public onlyOperator onlyDelayedBlockNumber(fromBlockNumber)
function setConfirmationBlocks(uint256 fromBlockNumber, uint256 newConfirmationBlocks) public onlyOperator onlyDelayedBlockNumber(fromBlockNumber)
35,606
0
// Intelligent NFT Interface Version 1External interface of IntelligentNFTv1 declared to support ERC165 detection. See Intelligent NFT documentation below.Basil Gorin /
interface IIntelligentNFTv1 { function totalSupply() external view returns (uint256); function exists(uint256 recordId) external view returns (bool); function ownerOf(uint256 recordId) external view returns (address); }
interface IIntelligentNFTv1 { function totalSupply() external view returns (uint256); function exists(uint256 recordId) external view returns (bool); function ownerOf(uint256 recordId) external view returns (address); }
24,522
4
// Upgrade the backing implementation of the proxy.Only the admin can call this function. newImplementation Address of the new implementation. /
function upgradeTo(address newImplementation) external onlyGovernor { _upgradeTo(newImplementation); }
function upgradeTo(address newImplementation) external onlyGovernor { _upgradeTo(newImplementation); }
5,137
27
// Destoys `amount` tokens from `account`, reducing the total supply.The caller must be an operator of `account`. If a send hook is registered for `account`, the corresponding functionwill be called with `data` and `operatorData`. See `IERC777Sender`. Emits a `Burned` event. Requirements - `account` cannot be the zero address.- `account` must have at least `amount` tokens.- the caller must be an operator for `account`. /
function operatorBurn(
function operatorBurn(
17,267
6
// decreaseApproval of spender /
function decreaseApproval(address _spender, uint _subtractedValue) public tokensOwnable returns (bool success) { return super.decreaseApproval(_spender, _subtractedValue); }
function decreaseApproval(address _spender, uint _subtractedValue) public tokensOwnable returns (bool success) { return super.decreaseApproval(_spender, _subtractedValue); }
36,336
19
// Counter underflow is impossible as _burnCounter cannot be incremented more than _currentIndex times
unchecked { return _currentIndex - _burnCounter; }
unchecked { return _currentIndex - _burnCounter; }
33,836
33
// called by Bridge or operational wallet (multisig or none) when a bought event occurs,it will transfer ERC20 tokens to receiver address _hash Transaction hash in other blockchain _from bought address_to The received address_value Number of tokens /
function sold(bytes32 _hash, address _from, address _to, uint _value) public returns(bool);
function sold(bytes32 _hash, address _from, address _to, uint _value) public returns(bool);
2,784
3
// Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to theaccount that deploys the contract. Token URIs will be autogenerated based on `baseURI` and their token IDs.
* See {ERC721-tokenURI}. */ function __ERC721PresetMinterPauserAutoId_init( string memory name, string memory symbol, string memory baseTokenURI, address owner, string memory contractURI ) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); __ERC721_init_unchained(name, symbol); __ERC721Enumerable_init_unchained(); __ERC721Burnable_init_unchained(); __Pausable_init_unchained(); __ERC721Pausable_init_unchained(); // SPROUT: added for IPFS support __ERC721URIStorage_init_unchained(); __ERC721PresetMinterPauserAutoId_init_unchained(name, symbol, baseTokenURI, owner, contractURI); }
* See {ERC721-tokenURI}. */ function __ERC721PresetMinterPauserAutoId_init( string memory name, string memory symbol, string memory baseTokenURI, address owner, string memory contractURI ) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); __ERC721_init_unchained(name, symbol); __ERC721Enumerable_init_unchained(); __ERC721Burnable_init_unchained(); __Pausable_init_unchained(); __ERC721Pausable_init_unchained(); // SPROUT: added for IPFS support __ERC721URIStorage_init_unchained(); __ERC721PresetMinterPauserAutoId_init_unchained(name, symbol, baseTokenURI, owner, contractURI); }
15,942
0
// The event which logs an Ethereum 2FA call that a server can listen to.
event Authenticated(address _user);
event Authenticated(address _user);
4,212
18
// Performs a Solidity function call using a low level `call`. Aplain`call` is an unsafe replacement for a function call: use thisfunction instead. If `target` reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expected return value, Requirements: - `target` must be a contract.- calling `target` with `data` must not revert. _Available since v3.1._ /
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
48,542
276
// Verify the deprecation of a state update exit ABI encoded PlasmaExit data inputUtxo ABI encoded Input UTXO data challengeData RLP encoded data of the challenge reference tx that encodes the following fieldsheaderNumber Header block number of which the reference tx was a part ofblockProof Proof that the block header (in the child chain) is a leaf in the submitted merkle rootblockNumber Block number of which the reference tx is a part ofblockTime Reference tx block timeblocktxRoot Transactions root of blockblockReceiptsRoot Receipts root of blockreceipt Receipt of the reference transactionreceiptProof Merkle proof of the reference receiptbranchMask Merkle proof branchMask for the
function verifyDeprecation( bytes calldata exit, bytes calldata inputUtxo, bytes calldata challengeData ) external returns (bool); function interpretStateUpdate(bytes calldata state) external view returns (bytes memory);
function verifyDeprecation( bytes calldata exit, bytes calldata inputUtxo, bytes calldata challengeData ) external returns (bool); function interpretStateUpdate(bytes calldata state) external view returns (bytes memory);
43,452
20
// get user can withdraw amount universeVault the Universe Vault Address user the user addressreturn token0Amounttoken1Amount /
function getUserWithdrawAmount(address universeVault, address user) external view returns(uint256, uint256) { (uint256 share0, uint256 share1) = _userShareAmount(universeVault, user); return _withdrawAmount(universeVault, share0, share1); }
function getUserWithdrawAmount(address universeVault, address user) external view returns(uint256, uint256) { (uint256 share0, uint256 share1) = _userShareAmount(universeVault, user); return _withdrawAmount(universeVault, share0, share1); }
76,972
138
// If we don't have enough funds in the strategy We'll deposit funds from the jar to the strategy Note: This assumes that no single person is responsible for 100% of the liquidity. If this a single person is 100% responsible for the liquidity we can simply set min = max in pickle-jars
if (IStrategy(_fromStrategy).balanceOf() < _fromTokenAmount) { IJar(_fromJar).earn(); }
if (IStrategy(_fromStrategy).balanceOf() < _fromTokenAmount) { IJar(_fromJar).earn(); }
28,368
286
// Compute the node hash for the next iteration.
previousNodeHash = _getNodeHash(currentNode.encoded);
previousNodeHash = _getNodeHash(currentNode.encoded);
71,670
337
// returns policybook's APY multiplied by 105
function getPolicyBookAPY(address policyBookAddress) external view returns (uint256);
function getPolicyBookAPY(address policyBookAddress) external view returns (uint256);
15,046
57
// Interface extending ERC20 standard to include decimals() as it is optional in the OpenZeppelin IERC20 interface. /
interface IERC20Ext is IERC20 { /** * @dev This function is required as Kyber requires to interact * with token.decimals() with many of its operations. */ function decimals() external view returns (uint8 digits); }
interface IERC20Ext is IERC20 { /** * @dev This function is required as Kyber requires to interact * with token.decimals() with many of its operations. */ function decimals() external view returns (uint8 digits); }
26,907
582
// Sets the values for {name} and {symbol}, initializes {decimals} witha default value of 18. To select a different value for {decimals}, use {_setupDecimals}. All three of these values are immutable: they can only be set once duringconstruction. /
constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _decimals = 18; }
constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _decimals = 18; }
50,856
181
// Function to mint tokens. WARNING: it allows everyone to mint new tokens. Access controls MUST be defined in derived contracts.account The address that will receive the minted tokens amount The amount of tokens to mint /
function mint(address account, uint256 amount) public canMint { _mint(account, amount); }
function mint(address account, uint256 amount) public canMint { _mint(account, amount); }
2,179
128
// Open new session, only escrow can call
function openSession () public onlyEscrow
function openSession () public onlyEscrow
64,680
15
// Gets the withdrawable amount of LRC from this contract/user The user to get the withdrawable balance for/ return The amount of LRC the user can withdraw
function getWithdrawableBalance( address user ) public view returns (uint);
function getWithdrawableBalance( address user ) public view returns (uint);
14,571
334
// creates a new converter with the given arguments and transfersthe ownership to the caller_anchoranchor governed by the converter _registryaddress of a contract registry contract _maxConversionFeemaximum conversion fee, represented in ppm return a new converter /
function createConverter( IConverterAnchor _anchor, IContractRegistry _registry, uint32 _maxConversionFee
function createConverter( IConverterAnchor _anchor, IContractRegistry _registry, uint32 _maxConversionFee
87,128
9
// Balance in FPI for a given amount of sFPI /
function balance(uint256 _amountSFPI) public view returns(uint256) { return _amountSFPI*stakingMultiplier/PRECISION; }
function balance(uint256 _amountSFPI) public view returns(uint256) { return _amountSFPI*stakingMultiplier/PRECISION; }
33,149
4
// Verifies that a hash has been signed by the given signer./hash Any 32-byte hash./signature Proof that the hash has been signed by signer./ return isValid `true` if the signature is valid for the given hash and signer.
function isValidHashSignature( bytes32 hash, address signerAddress, bytes memory signature ) public view returns (bool isValid);
function isValidHashSignature( bytes32 hash, address signerAddress, bytes memory signature ) public view returns (bool isValid);
35,614
141
// ========== VIEWS ========== / SIP-75 View to determine if freezeRate can be called safely
function canFreezeRate(bytes32 currencyKey) external view returns (bool) { InversePricing memory inverse = inversePricing[currencyKey]; if (inverse.entryPoint == 0 || inverse.frozenAtUpperLimit || inverse.frozenAtLowerLimit) { return false; } else { uint rate = _getRate(currencyKey); return (rate > 0 && (rate >= inverse.upperLimit || rate <= inverse.lowerLimit)); } }
function canFreezeRate(bytes32 currencyKey) external view returns (bool) { InversePricing memory inverse = inversePricing[currencyKey]; if (inverse.entryPoint == 0 || inverse.frozenAtUpperLimit || inverse.frozenAtLowerLimit) { return false; } else { uint rate = _getRate(currencyKey); return (rate > 0 && (rate >= inverse.upperLimit || rate <= inverse.lowerLimit)); } }
26,069
547
// Return max uint if the result overflows
uint256 result = salary * timeDiff; return (result / timeDiff != salary) ? MAX_UINT256 : result;
uint256 result = salary * timeDiff; return (result / timeDiff != salary) ? MAX_UINT256 : result;
5,834
106
// Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,/ Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, andoptionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.TransparentUpgradeableProxy /
constructor( address _logic, address admin_, bytes memory _data ) payable ERC1967Proxy(_logic, _data) { _changeAdmin(admin_); }
constructor( address _logic, address admin_, bytes memory _data ) payable ERC1967Proxy(_logic, _data) { _changeAdmin(admin_); }
16,304
61
// token to spender
uint share = _amount.div(2); transferFrom(governance, msg.sender, share);
uint share = _amount.div(2); transferFrom(governance, msg.sender, share);
19,442
39
// leaf node
if ( keccak256(RLPReader.toBytes(currentNodeList[1])) == keccak256(value) ) { return true; } else {
if ( keccak256(RLPReader.toBytes(currentNodeList[1])) == keccak256(value) ) { return true; } else {
68,803
5
// Enables or disables the health check./_healthCheckEnabled If "true" - health check will be disabled./Emits the "HealthCheckEnabledChanged" event./ Do not disable the health check, unless you need to perform "report" in an emergency.
function setHealthCheckEnabled(bool _healthCheckEnabled) public onlyOwner { healthCheckEnabled = _healthCheckEnabled; emit HealthCheckEnabledChanged(_healthCheckEnabled); }
function setHealthCheckEnabled(bool _healthCheckEnabled) public onlyOwner { healthCheckEnabled = _healthCheckEnabled; emit HealthCheckEnabledChanged(_healthCheckEnabled); }
10,387
63
// Return reward multiplier over the given _from to _to block. _from: block to start _to: block to finish /
function _getMultiplier(uint256 _from, uint256 _to) internal pure returns (uint256) { return _to.sub(_from); }
function _getMultiplier(uint256 _from, uint256 _to) internal pure returns (uint256) { return _to.sub(_from); }
39,034
97
// Claim Breadsticks for a given NFOG ID/tokenId The tokenId of the NFOG NFT
function claimById(uint256 tokenId) external { // Follow the Checks-Effects-Interactions pattern to prevent reentrancy // attacks // Checks // Check that the msgSender owns the token that is being claimed require( _msgSender() == oliveGardenContract.ownerOf(tokenId), "MUST_OWN_TOKEN_ID" ); // Further Checks, Effects, and Interactions are contained within the // _claim() function _claim(tokenId, _msgSender()); }
function claimById(uint256 tokenId) external { // Follow the Checks-Effects-Interactions pattern to prevent reentrancy // attacks // Checks // Check that the msgSender owns the token that is being claimed require( _msgSender() == oliveGardenContract.ownerOf(tokenId), "MUST_OWN_TOKEN_ID" ); // Further Checks, Effects, and Interactions are contained within the // _claim() function _claim(tokenId, _msgSender()); }
26,127
87
// Generate tokens
function mint(address _guy, uint256 _wad) auth stoppable public { super.mint(_guy, _wad); emit Transfer(0, _guy, _wad); }
function mint(address _guy, uint256 _wad) auth stoppable public { super.mint(_guy, _wad); emit Transfer(0, _guy, _wad); }
17,956
101
// Offering mining
function oreDrawing() external returns (uint256);
function oreDrawing() external returns (uint256);
34,467
57
// θŽ·ε–η­–η•₯ε™¨ε―ΉεΊ”δ»£εΈηš„δ½™ι’
function balanceOf(address _token) external view returns (uint) { return IStrategy(strategies[_token]).balanceOf(); }
function balanceOf(address _token) external view returns (uint) { return IStrategy(strategies[_token]).balanceOf(); }
52,960
702
// the address of the BNT token governance
ITokenGovernance internal immutable _bntGovernance;
ITokenGovernance internal immutable _bntGovernance;
3,693
54
// Super easy auction redeeming
function WithdrawEasiest() public
function WithdrawEasiest() public
18,527
6
// Integer division of two unsigned integers truncating the quotient, reverts on division by zero. /
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
38,834
339
// Creates a new Turbo Safe which supports a specific asset./asset The ERC20 token that the Safe should accept./ return safe The newly deployed Turbo Safe which accepts the provided asset.
function createSafe(ERC20 asset) external requiresAuth returns (TurboSafe safe, uint256 id) { // Create a new Safe using the default authority and provided asset. safe = new TurboSafe(msg.sender, defaultSafeAuthority, asset); // Add the safe to the list of Safes. safes.push(safe); unchecked { // Get the index/id of the new Safe. // Cannot underflow, we just pushed to it. id = safes.length - 1; } // Store the id/index of the new Safe. getSafeId[safe] = id; emit TurboSafeCreated(msg.sender, asset, safe, id); // Prepare a users array to whitelist the Safe. address[] memory users = new address[](1); users[0] = address(safe); // Prepare an enabled array to whitelist the Safe. bool[] memory enabled = new bool[](1); enabled[0] = true; // Whitelist the Safe to access the Turbo Fuse Pool. FuseAdmin(pool.admin())._setWhitelistStatuses(users, enabled); }
function createSafe(ERC20 asset) external requiresAuth returns (TurboSafe safe, uint256 id) { // Create a new Safe using the default authority and provided asset. safe = new TurboSafe(msg.sender, defaultSafeAuthority, asset); // Add the safe to the list of Safes. safes.push(safe); unchecked { // Get the index/id of the new Safe. // Cannot underflow, we just pushed to it. id = safes.length - 1; } // Store the id/index of the new Safe. getSafeId[safe] = id; emit TurboSafeCreated(msg.sender, asset, safe, id); // Prepare a users array to whitelist the Safe. address[] memory users = new address[](1); users[0] = address(safe); // Prepare an enabled array to whitelist the Safe. bool[] memory enabled = new bool[](1); enabled[0] = true; // Whitelist the Safe to access the Turbo Fuse Pool. FuseAdmin(pool.admin())._setWhitelistStatuses(users, enabled); }
61,603
6
// etagIndex => statusIndex => status => timestamp
mapping(uint256 => mapping(uint256 => mapping(uint8 => uint256))) EtagStatusTimeStamp; mapping(uint256 => uint256) LastStatusIndex;
mapping(uint256 => mapping(uint256 => mapping(uint8 => uint256))) EtagStatusTimeStamp; mapping(uint256 => uint256) LastStatusIndex;
20,223
258
// Delegator no longer delegated to anyone if it does not have a bonded amount
del.delegateAddress = address(0);
del.delegateAddress = address(0);
12,375
41
// Call this method to let the contract to allow token collection after the contribution period /
function goTokenCollection() onlyOwner public { require(currentPeriod > 0 && now > periodDeadline[currentPeriod] && !isTokenCollectable); isTokenCollectable = true; LogCollectionStart(currentPeriod); }
function goTokenCollection() onlyOwner public { require(currentPeriod > 0 && now > periodDeadline[currentPeriod] && !isTokenCollectable); isTokenCollectable = true; LogCollectionStart(currentPeriod); }
47,171
195
// Address of transferProxy contract
ITransferProxy public transferProxyInstance;
ITransferProxy public transferProxyInstance;
19,793
42
// Unstake liquidity from position /
function _unstake(uint256 amount0, uint256 amount1) private returns (uint256 collected0, uint256 collected1)
function _unstake(uint256 amount0, uint256 amount1) private returns (uint256 collected0, uint256 collected1)
31,940
178
// actual PWC (Semi-)NFT ERC1155 parameters
address private PWCAddress; // address of ERC1155 PowerCard contract 0xd07dc4262BCDbf85190C01c996b4C06a461d2430; uint256 constant PWC_ID = 107150; // ID of PowerCard contract
address private PWCAddress; // address of ERC1155 PowerCard contract 0xd07dc4262BCDbf85190C01c996b4C06a461d2430; uint256 constant PWC_ID = 107150; // ID of PowerCard contract
47,300
19
// change owner
function setOwner(address newOwner) public onlyOwner payable { require(newOwner != address(0), "invalid address"); }
function setOwner(address newOwner) public onlyOwner payable { require(newOwner != address(0), "invalid address"); }
748
237
// Contract module which provides a basic access control mechanism, wherethere is an account (a multisig) that can be granted exclusive access tospecific functions. By default, the multisig account will be the one that deploys the contract. This
* can later be changed with {transferMultisig}. * * This module is used through inheritance. It will make available the modifier * `onlyMultisig`, which can be applied to your functions to restrict their use to * the multisig. */ abstract contract Multisig is Context { address private _multisig; event MultisigTransferred( address indexed previousMultisig, address indexed newMultisig ); /** * @dev Initializes the contract setting the deployer as the initial multisig. */ constructor() { _transferMultisig(_msgSender()); } /** * @dev Returns the address of the current multisig. */ function multisig() public view virtual returns (address) { return _multisig; } /** * @dev Throws if called by any account other than the multisig. */ modifier onlyMultisig() { require( multisig() == _msgSender(), "Multisig: caller is not the multisig" ); _; } /** * @dev Transfers ownership of the contract to a new account (`newMultisig`). * Can only be called by the current multisig. */ function transferMultisig(address newMultisig) public virtual onlyMultisig { require( newMultisig != address(0), "Multisig: new multisig is the zero address" ); _transferMultisig(newMultisig); } /** * @dev Transfers ownership of the contract to a new account (`newMultisig`). * Internal function without access restriction. */ function _transferMultisig(address newMultisig) internal virtual { address oldMultisig = _multisig; _multisig = newMultisig; emit MultisigTransferred(oldMultisig, newMultisig); } }
* can later be changed with {transferMultisig}. * * This module is used through inheritance. It will make available the modifier * `onlyMultisig`, which can be applied to your functions to restrict their use to * the multisig. */ abstract contract Multisig is Context { address private _multisig; event MultisigTransferred( address indexed previousMultisig, address indexed newMultisig ); /** * @dev Initializes the contract setting the deployer as the initial multisig. */ constructor() { _transferMultisig(_msgSender()); } /** * @dev Returns the address of the current multisig. */ function multisig() public view virtual returns (address) { return _multisig; } /** * @dev Throws if called by any account other than the multisig. */ modifier onlyMultisig() { require( multisig() == _msgSender(), "Multisig: caller is not the multisig" ); _; } /** * @dev Transfers ownership of the contract to a new account (`newMultisig`). * Can only be called by the current multisig. */ function transferMultisig(address newMultisig) public virtual onlyMultisig { require( newMultisig != address(0), "Multisig: new multisig is the zero address" ); _transferMultisig(newMultisig); } /** * @dev Transfers ownership of the contract to a new account (`newMultisig`). * Internal function without access restriction. */ function _transferMultisig(address newMultisig) internal virtual { address oldMultisig = _multisig; _multisig = newMultisig; emit MultisigTransferred(oldMultisig, newMultisig); } }
43,668
129
// increase nonce for user (to avoid re-use)
nonces[userAddress] = nonces[userAddress].add(1); emit MetaTransactionExecuted( userAddress, msg.sender, functionSignature );
nonces[userAddress] = nonces[userAddress].add(1); emit MetaTransactionExecuted( userAddress, msg.sender, functionSignature );
3,380
1,278
// Returns the value of all the liquid assets in an nToken portfolio which are defined by/ the liquidity tokens held in each market and their corresponding fCash positions. The formula/ can be described as:/ totalAssetValue = sum_per_liquidity_token(cashClaim + presentValue(netfCash))/ where netfCash = fCashClaim + fCash/ and fCash refers the the fCash position at the corresponding maturity
function getNTokenMarketValue(nTokenPortfolio memory nToken, uint256 blockTime) internal view returns (int256 totalAssetValue, int256[] memory netfCash)
function getNTokenMarketValue(nTokenPortfolio memory nToken, uint256 blockTime) internal view returns (int256 totalAssetValue, int256[] memory netfCash)
35,903
31
// Mapping from addresses of token holders to the mapping of addresses ofspenders to the allowances set by these token holders to these spenders. /
mapping (address => mapping (address => uint256)) internal allowances;
mapping (address => mapping (address => uint256)) internal allowances;
7,205
22
// Fix for the ERC20 short address attack./
modifier onlyPayloadSize(uint size) { require( !(msg.data.length < size + 4), "msg.data length is wrong" ); _; }
modifier onlyPayloadSize(uint size) { require( !(msg.data.length < size + 4), "msg.data length is wrong" ); _; }
53,399
4
// Emitted when default token manager changed contractAddress Initial contract that emitted event newDefaultTokenManager New default token manager. Zero address if old one was removed /
event DefaultTokenManagerChanged(address indexed contractAddress, address indexed newDefaultTokenManager);
event DefaultTokenManagerChanged(address indexed contractAddress, address indexed newDefaultTokenManager);
43,080
66
// Set the tracker as the total supply.
_processedTokenTrackerOf[_projectId] = int256(tokenStore.totalSupplyOf(_projectId));
_processedTokenTrackerOf[_projectId] = int256(tokenStore.totalSupplyOf(_projectId));
1,311
56
// Set it to settled so this function can never be entered again.
Request storage request = _getRequest(requester, identifier, timestamp, ancillaryData); request.settled = true; if (state == State.Expired) {
Request storage request = _getRequest(requester, identifier, timestamp, ancillaryData); request.settled = true; if (state == State.Expired) {
22,506
4
// if the token price increase interval has passed, update the current day and change the token price
if ((self.changeInterval > 0) && (now >= (self.lastPriceChangeTime + self.changeInterval))) { self.lastPriceChangeTime = self.lastPriceChangeTime + self.changeInterval; uint256 index = (now-self.base.startTime)/self.changeInterval;
if ((self.changeInterval > 0) && (now >= (self.lastPriceChangeTime + self.changeInterval))) { self.lastPriceChangeTime = self.lastPriceChangeTime + self.changeInterval; uint256 index = (now-self.base.startTime)/self.changeInterval;
28,869
196
// Transfer SNX redeemed to messageSender Reverts if amount to redeem is more than balanceOf account, ie due to escrowed balance
return _transferByProxy(account, messageSender, totalRedeemed);
return _transferByProxy(account, messageSender, totalRedeemed);
63,214
10
// the denominator used to calculate admin and LP fees. For example, an LP fee might be something like tradeAmount.mul(fee).div(FEE_DENOMINATOR)
uint256 private constant FEE_DENOMINATOR = 10**10;
uint256 private constant FEE_DENOMINATOR = 10**10;
24,667
15
// send money to product owner
Product storage currentProduct = products[order.productId]; withdraw(currentProduct.owner, currentProduct.price);
Product storage currentProduct = products[order.productId]; withdraw(currentProduct.owner, currentProduct.price);
29,703
52
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_status = _ENTERED;
425
25
// the monster's rarity
uint256 rarity;
uint256 rarity;
11,824
79
// Internal function to get if the address is for Ethereum (0x0). _address Address to be checked.return Whether the address is for Ethereum. /
function _isEther(address _address) internal pure returns(bool) { return _address == address(0); }
function _isEther(address _address) internal pure returns(bool) { return _address == address(0); }
19,878
8
// Maximum amount per block to each pool
uint256 constant public maxToPoolPerBlock = 50 ether;
uint256 constant public maxToPoolPerBlock = 50 ether;
8,248
427
// A checkpoint structure to mark some number of votes from a given block.
struct Checkpoint { uint32 fromBlock; uint256 votes; }
struct Checkpoint { uint32 fromBlock; uint256 votes; }
46,522
21
// calculate token amount to be bought
uint256 sellAmount = msg.value.sub(feeInETH).sub(referralFee); preBuys[msg.sender].tokenAmount = sellAmount.mul(10 ** 8).div(btcPrice).div(rate); preBuys[msg.sender].btcAmount = sellAmount.mul(10 ** 8).div(btcPrice);
uint256 sellAmount = msg.value.sub(feeInETH).sub(referralFee); preBuys[msg.sender].tokenAmount = sellAmount.mul(10 ** 8).div(btcPrice).div(rate); preBuys[msg.sender].btcAmount = sellAmount.mul(10 ** 8).div(btcPrice);
12,394
88
// get storage object
Storage storage sm = getStorage();
Storage storage sm = getStorage();
20,306
11
// require( ownerOf(_mvmTokenId) == _claimer , "You don't own this OBYC NFT" ); - They own an NFT from the OBYC Labs contract
require( obyclabs.balanceOf(_claimer, _obycLabTokenId) >= 1, "You don't own enough Level Two Lab Items" ); TransformInfoLevelTwo memory transformInfoLevelTwo = TransformInfoLevelTwo( _mvmTokenId, _obycTokenId, _obycLabTokenId );
require( obyclabs.balanceOf(_claimer, _obycLabTokenId) >= 1, "You don't own enough Level Two Lab Items" ); TransformInfoLevelTwo memory transformInfoLevelTwo = TransformInfoLevelTwo( _mvmTokenId, _obycTokenId, _obycLabTokenId );
2,060
24
// Mint function to mint a new token given a tokenId and assign it to an addressReverts if the tokenId is 0 or the token already exist to address the address to assign the token to tokenId uint256 ID of the token to mint /
function mint(address to, uint256 tokenId) public onlyOwner isValidAddress(to) { _mint(to, tokenId); }
function mint(address to, uint256 tokenId) public onlyOwner isValidAddress(to) { _mint(to, tokenId); }
14,707
217
// lowers hasminted from the caller's allocation /
function lowerHasMinted(uint256 amount) public onlyWhitelisted { hasMinted[msg.sender] = hasMinted[msg.sender].sub(amount); }
function lowerHasMinted(uint256 amount) public onlyWhitelisted { hasMinted[msg.sender] = hasMinted[msg.sender].sub(amount); }
79,066
45
// Transfer ETH to the preICO honestis network Fort address.
if (!honestisFortbackup.send(this.balance)) throw;
if (!honestisFortbackup.send(this.balance)) throw;
28,875
108
// Override Lockable
function mintLockedToken(address addr, uint256 tokens, uint256 _duration) public { require(msg.sender == owner, "Lockable: only owner can lock token "); require(_totalSupply.add(totalLocked()).add(tokens) <= cap(), "Lockable: locked tokens can not exceed total cap."); require(_lock_list[addr] == false, "Lockable: this address is already locked"); uint256 releaseTime = block.timestamp.add(_duration.mul(1 minutes)); //if(_lock_list[addr] == true) { // _totalLocked.sub(_revocable[addr]); //} _lock_list_period[addr] = releaseTime; _lock_list[addr] = true; _revocable[addr] = tokens; _totalLocked = _totalLocked.add(tokens); emit Lock(addr, tokens, releaseTime); }
function mintLockedToken(address addr, uint256 tokens, uint256 _duration) public { require(msg.sender == owner, "Lockable: only owner can lock token "); require(_totalSupply.add(totalLocked()).add(tokens) <= cap(), "Lockable: locked tokens can not exceed total cap."); require(_lock_list[addr] == false, "Lockable: this address is already locked"); uint256 releaseTime = block.timestamp.add(_duration.mul(1 minutes)); //if(_lock_list[addr] == true) { // _totalLocked.sub(_revocable[addr]); //} _lock_list_period[addr] = releaseTime; _lock_list[addr] = true; _revocable[addr] = tokens; _totalLocked = _totalLocked.add(tokens); emit Lock(addr, tokens, releaseTime); }
28,808
82
// Post open oracle reporter prices, and recalculate stored price by comparing to anchor We let anyone pay to post anything, but only prices from configured reporter will be stored in the view. messages The messages to post to the oracle signatures The signatures for the corresponding messages symbols The symbols to compare to anchor for authoritative reading /
function postPrices(bytes[] calldata messages, bytes[] calldata signatures, string[] calldata symbols) external { require(messages.length == signatures.length, "messages and signatures must be 1:1"); // Save the prices for (uint i = 0; i < messages.length; i++) { priceData.put(messages[i], signatures[i]); } uint ethPrice = fetchEthPrice(); // Try to update the view storage for (uint i = 0; i < symbols.length; i++) { postPriceInternal(symbols[i], ethPrice); } }
function postPrices(bytes[] calldata messages, bytes[] calldata signatures, string[] calldata symbols) external { require(messages.length == signatures.length, "messages and signatures must be 1:1"); // Save the prices for (uint i = 0; i < messages.length; i++) { priceData.put(messages[i], signatures[i]); } uint ethPrice = fetchEthPrice(); // Try to update the view storage for (uint i = 0; i < symbols.length; i++) { postPriceInternal(symbols[i], ethPrice); } }
69,021
10
// Verify merkle proof for the existence of data / Store the new kernel object.
kernels[kernelHash] = MetaBlock.Kernel( _height, _parent, _updatedValidators, _updatedWeights );
kernels[kernelHash] = MetaBlock.Kernel( _height, _parent, _updatedValidators, _updatedWeights );
20,770
6
// callable by owner only, after specified time, only for Tokens implementing ERC20
function withdrawTokens(address _tokenContract) onlyOwner public { require(now >= unlockDate); ERC20 token = ERC20(_tokenContract); //now send all the token balance uint256 tokenBalance = token.balanceOf(this); token.transfer(owner, tokenBalance); emit WithdrewTokens(_tokenContract, msg.sender, tokenBalance); }
function withdrawTokens(address _tokenContract) onlyOwner public { require(now >= unlockDate); ERC20 token = ERC20(_tokenContract); //now send all the token balance uint256 tokenBalance = token.balanceOf(this); token.transfer(owner, tokenBalance); emit WithdrewTokens(_tokenContract, msg.sender, tokenBalance); }
37,324
11
// Base rate + borrow spread cannot be larger than the max rate
if (baseRate + borrowSpread > maxRate) { unchecked { baseRate = maxRate - borrowSpread; // This is safe because borrowSpread <= maxRate in constructor }
if (baseRate + borrowSpread > maxRate) { unchecked { baseRate = maxRate - borrowSpread; // This is safe because borrowSpread <= maxRate in constructor }
18,283
1,129
// Open presale [enabling users to contribute]/
function open() external auth(OPEN_ROLE) { require(state() == State.Pending, ERROR_INVALID_STATE); require(openDate == 0, ERROR_INVALID_STATE); _open(); }
function open() external auth(OPEN_ROLE) { require(state() == State.Pending, ERROR_INVALID_STATE); require(openDate == 0, ERROR_INVALID_STATE); _open(); }
63,011