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
13
// NFT must exist!
if(ERC721 == address(0)) { revert UTAutographFactoryTokenNotInstalled(); }
if(ERC721 == address(0)) { revert UTAutographFactoryTokenNotInstalled(); }
13,901
28
// /
contract ERC20Token is IERC20Token, Utils { string public standard = 'Token 0.1'; string public name = ''; string public symbol = ''; uint8 public decimals = 0; uint256 public totalSupply = 0; mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); /** @dev constructor @param _name token name @param _symbol token symbol @param _decimals decimal points, for display purposes */ function ERC20Token(string _name, string _symbol, uint8 _decimals) { require(bytes(_name).length > 0 && bytes(_symbol).length > 0); // validate input name = _name; symbol = _symbol; decimals = _decimals; } /** @dev send coins throws on any error rather then return a false flag to minimize user errors @param _to target address @param _value transfer amount @return true if the transfer was successful, false if it wasn't */ function transfer(address _to, uint256 _value) public validAddress(_to) returns (bool success) { balanceOf[msg.sender] = safeSub(balanceOf[msg.sender], _value); balanceOf[_to] = safeAdd(balanceOf[_to], _value); Transfer(msg.sender, _to, _value); return true; } /** @dev an account/contract attempts to get the coins throws on any error rather then return a false flag to minimize user errors @param _from source address @param _to target address @param _value transfer amount @return true if the transfer was successful, false if it wasn't */ function transferFrom(address _from, address _to, uint256 _value) public validAddress(_from) validAddress(_to) returns (bool success) { allowance[_from][msg.sender] = safeSub(allowance[_from][msg.sender], _value); balanceOf[_from] = safeSub(balanceOf[_from], _value); balanceOf[_to] = safeAdd(balanceOf[_to], _value); Transfer(_from, _to, _value); return true; } /** @dev allow another account/contract to spend some tokens on your behalf throws on any error rather then return a false flag to minimize user errors also, to minimize the risk of the approve/transferFrom attack vector (see https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/), approve has to be called twice in 2 separate transactions - once to change the allowance to 0 and secondly to change it to the new allowance value @param _spender approved address @param _value allowance amount @return true if the approval was successful, false if it wasn't */ function approve(address _spender, uint256 _value) public validAddress(_spender) returns (bool success) { // if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal require(_value == 0 || allowance[msg.sender][_spender] == 0); allowance[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } }
contract ERC20Token is IERC20Token, Utils { string public standard = 'Token 0.1'; string public name = ''; string public symbol = ''; uint8 public decimals = 0; uint256 public totalSupply = 0; mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); /** @dev constructor @param _name token name @param _symbol token symbol @param _decimals decimal points, for display purposes */ function ERC20Token(string _name, string _symbol, uint8 _decimals) { require(bytes(_name).length > 0 && bytes(_symbol).length > 0); // validate input name = _name; symbol = _symbol; decimals = _decimals; } /** @dev send coins throws on any error rather then return a false flag to minimize user errors @param _to target address @param _value transfer amount @return true if the transfer was successful, false if it wasn't */ function transfer(address _to, uint256 _value) public validAddress(_to) returns (bool success) { balanceOf[msg.sender] = safeSub(balanceOf[msg.sender], _value); balanceOf[_to] = safeAdd(balanceOf[_to], _value); Transfer(msg.sender, _to, _value); return true; } /** @dev an account/contract attempts to get the coins throws on any error rather then return a false flag to minimize user errors @param _from source address @param _to target address @param _value transfer amount @return true if the transfer was successful, false if it wasn't */ function transferFrom(address _from, address _to, uint256 _value) public validAddress(_from) validAddress(_to) returns (bool success) { allowance[_from][msg.sender] = safeSub(allowance[_from][msg.sender], _value); balanceOf[_from] = safeSub(balanceOf[_from], _value); balanceOf[_to] = safeAdd(balanceOf[_to], _value); Transfer(_from, _to, _value); return true; } /** @dev allow another account/contract to spend some tokens on your behalf throws on any error rather then return a false flag to minimize user errors also, to minimize the risk of the approve/transferFrom attack vector (see https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/), approve has to be called twice in 2 separate transactions - once to change the allowance to 0 and secondly to change it to the new allowance value @param _spender approved address @param _value allowance amount @return true if the approval was successful, false if it wasn't */ function approve(address _spender, uint256 _value) public validAddress(_spender) returns (bool success) { // if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal require(_value == 0 || allowance[msg.sender][_spender] == 0); allowance[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } }
5,619
8
// [@DreWhyte](Telegram)/Payable Contract
contract PayableContract { address public owner; address public admin; event Transfer(address indexed _to, uint256 _value); event Receive(address indexed _from, uint256 _value); modifier onlyAdmin() { require(msg.sender == admin, "Admin privilege only"); _; } modifier onlyOwner() { require(msg.sender == owner, "Owner privilege only"); _; } /** * @notice Set the default admin and owner * as address that deploys contract */ constructor() { admin = msg.sender; owner = admin; } /** * @param _newOwner payable address of new owner * @return status * @dev previous owner cannot be made new owner */ function transferOwnership(address _newOwner) public onlyAdmin returns(bool status){ require(_newOwner != address(0)); address previousOwner = owner; require(previousOwner != _newOwner); owner = _newOwner; return true; } /** * @dev Withdraw all funds */ function withdrawAll() public onlyOwner { uint amount = address(this).balance; (bool success,) = msg.sender.call{value: amount}(""); require(success, "withdrawAll: Transfer failed"); emit Transfer(msg.sender, amount); } /** * @param amount Amount to withdraw in wei */ function withdrawPartial(uint amount) public onlyOwner { (bool success,) = msg.sender.call{value: amount}(""); require(success, "withdrawPartial: Transfer failed"); emit Transfer(msg.sender, amount); } /** * @dev This can only reply on 2300 gas been available * @dev We can't do beyond simple ven logging */ receive() external payable { emit Receive(msg.sender, msg.value); } /** * @dev Retrieve all funds & destroy contract * in case of emergency */ function killSwitch() public onlyAdmin() { address payable _owner = payable(owner); selfdestruct(_owner); } }
contract PayableContract { address public owner; address public admin; event Transfer(address indexed _to, uint256 _value); event Receive(address indexed _from, uint256 _value); modifier onlyAdmin() { require(msg.sender == admin, "Admin privilege only"); _; } modifier onlyOwner() { require(msg.sender == owner, "Owner privilege only"); _; } /** * @notice Set the default admin and owner * as address that deploys contract */ constructor() { admin = msg.sender; owner = admin; } /** * @param _newOwner payable address of new owner * @return status * @dev previous owner cannot be made new owner */ function transferOwnership(address _newOwner) public onlyAdmin returns(bool status){ require(_newOwner != address(0)); address previousOwner = owner; require(previousOwner != _newOwner); owner = _newOwner; return true; } /** * @dev Withdraw all funds */ function withdrawAll() public onlyOwner { uint amount = address(this).balance; (bool success,) = msg.sender.call{value: amount}(""); require(success, "withdrawAll: Transfer failed"); emit Transfer(msg.sender, amount); } /** * @param amount Amount to withdraw in wei */ function withdrawPartial(uint amount) public onlyOwner { (bool success,) = msg.sender.call{value: amount}(""); require(success, "withdrawPartial: Transfer failed"); emit Transfer(msg.sender, amount); } /** * @dev This can only reply on 2300 gas been available * @dev We can't do beyond simple ven logging */ receive() external payable { emit Receive(msg.sender, msg.value); } /** * @dev Retrieve all funds & destroy contract * in case of emergency */ function killSwitch() public onlyAdmin() { address payable _owner = payable(owner); selfdestruct(_owner); } }
26,512
18
// returns the value "as is"
function ethToUsd(uint amount) external view returns (uint);
function ethToUsd(uint amount) external view returns (uint);
69,360
2
// `authorToArticles` maps all authoring addresses to corresponding authored article(s)`usersToSubscribedAuthors` maps all user addresses to corresponding subscribed authors
mapping(address => Article[]) public authorToArticles; mapping(address => address[]) public usersToSubscribedAuthors;
mapping(address => Article[]) public authorToArticles; mapping(address => address[]) public usersToSubscribedAuthors;
28,401
68
// Check whether the pre-ICO is active at the moment./
function isPreIco() public view returns (bool) { return now >= startTimePreIco && now <= endTimePreIco; }
function isPreIco() public view returns (bool) { return now >= startTimePreIco && now <= endTimePreIco; }
49,544
5
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override { _transfer(_from, _to, _value); }
function LPS_transfer(address _from, address _to, uint _value) internal override { _transfer(_from, _to, _value); }
23,352
94
// Template Code for the create clone method: /
function _createClone(address target) internal returns (address result) { // convert address to bytes20 for assembly use bytes20 targetBytes = bytes20(target); assembly { // allocate clone memory let clone := mload(0x40) // store initial portion of the delegation contract code in bytes form mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // store the provided address mstore(add(clone, 0x14), targetBytes) // store the remaining delegation contract code mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // create the actual delegate contract reference and return its address result := create(0, clone, 0x37) } }
function _createClone(address target) internal returns (address result) { // convert address to bytes20 for assembly use bytes20 targetBytes = bytes20(target); assembly { // allocate clone memory let clone := mload(0x40) // store initial portion of the delegation contract code in bytes form mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // store the provided address mstore(add(clone, 0x14), targetBytes) // store the remaining delegation contract code mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // create the actual delegate contract reference and return its address result := create(0, clone, 0x37) } }
22,326
15
// The Constructor assigns the message sender to be `owner`
constructor() public { owner = msg.sender; }
constructor() public { owner = msg.sender; }
25,220
49
// If this isn't a token mint:
if (_from != address(0)) {
if (_from != address(0)) {
30,075
2
// tokenA: address of the ERC20 token <A> tokenB: address of the ERC20 token <B> amountAMin: the minimum amount of token A the sender must provide amountBMin: the minimum amount of token B the sender must provide user: sender and LP Token recipient address deadline: Unix timestamp after which the transaction will revert /
struct REMOVELIQUIDITY_TYPE { address tokenA; address tokenB; uint256 liquidity; uint256 amountAMin; uint256 amountBMin; address user; uint256 deadline; }
struct REMOVELIQUIDITY_TYPE { address tokenA; address tokenB; uint256 liquidity; uint256 amountAMin; uint256 amountBMin; address user; uint256 deadline; }
40,653
232
// The voting itself:
proposal.votes[_vote] = rep.add(proposal.votes[_vote]); proposal.totalVotes = rep.add(proposal.totalVotes); proposal.voters[_voter] = Voter({ reputation: rep, vote: _vote });
proposal.votes[_vote] = rep.add(proposal.votes[_vote]); proposal.totalVotes = rep.add(proposal.totalVotes); proposal.voters[_voter] = Voter({ reputation: rep, vote: _vote });
8,118
10
// The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this MToken to be liquidated repayAmount The amount of the underlying borrowed asset to repay mTokenCollateral The market in which to seize collateral from the borrowerreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function liquidateBorrow(address borrower, uint repayAmount, MTokenInterface mTokenCollateral) external returns (uint) { (uint err,) = liquidateBorrowInternal(borrower, repayAmount, mTokenCollateral); return err; }
function liquidateBorrow(address borrower, uint repayAmount, MTokenInterface mTokenCollateral) external returns (uint) { (uint err,) = liquidateBorrowInternal(borrower, repayAmount, mTokenCollateral); return err; }
31,271
65
// make public rebasing only after initialization
if (nextRebase == 0 && msg.sender != governance) { emit NotInitialized(); return; }
if (nextRebase == 0 && msg.sender != governance) { emit NotInitialized(); return; }
52,696
114
// Mint initial supply of tokens. All further minting of tokens is disabled
totalSupply_ = INITIAL_SUPPLY;
totalSupply_ = INITIAL_SUPPLY;
45,870
16
// Determine the total size
uint256 totalSize; for (uint256 idx = _startPage; idx <= _endPage; idx++) { totalSize += _cdPages.pages[idx].size; }
uint256 totalSize; for (uint256 idx = _startPage; idx <= _endPage; idx++) { totalSize += _cdPages.pages[idx].size; }
17,632
97
// Pass data if recipient is contract
if (_to.isContract()) { bytes4 retval = IERC1155TokenReceiver(_to).onERC1155BatchReceived(msg.sender, _from, _ids, _amounts, _data); require(retval == ERC1155_BATCH_RECEIVED_VALUE, "ERC1155#_callonERC1155BatchReceived: INVALID_ON_RECEIVE_MESSAGE"); }
if (_to.isContract()) { bytes4 retval = IERC1155TokenReceiver(_to).onERC1155BatchReceived(msg.sender, _from, _ids, _amounts, _data); require(retval == ERC1155_BATCH_RECEIVED_VALUE, "ERC1155#_callonERC1155BatchReceived: INVALID_ON_RECEIVE_MESSAGE"); }
13,965
12
// Amplify amountUSD before division to avoid truncation
uint256 amountETH = (amountUSD * 1e18 * 1e18) / price; return (price, amountUSD, amountETH / 1e18);
uint256 amountETH = (amountUSD * 1e18 * 1e18) / price; return (price, amountUSD, amountETH / 1e18);
20,369
35
// Has the edition been disabled / soft burnt OR sold out
function isSalesDisabledOrSoldOut(uint256 _editionId) external view returns (bool);
function isSalesDisabledOrSoldOut(uint256 _editionId) external view returns (bool);
3,069
31
// The number One in the BaseMath system.
uint256 constant internal BASE = 10 ** 18;
uint256 constant internal BASE = 10 ** 18;
20,471
0
// this constant represents the utilization rate at which the pool aims to obtain most competitive borrow rates.Expressed in ray // This constant represents the excess utilization rate above the optimal. It's always equal to1-optimal utilization rate. Added as a constant here for gas optimizations.Expressed in ray / Base variable borrow rate when Utilization rate = 0. Expressed in ray
uint256 internal immutable _baseVariableBorrowRate;
uint256 internal immutable _baseVariableBorrowRate;
17,169
101
// IERC20(_token).safeTransfer(msg.sender, _amount);
TransferHelper.safeTransfer(_token, msg.sender, ToUser); if (ToSuperAdmin > 0) { TransferHelper.safeTransfer(_token, SuperAdmin, ToSuperAdmin); }
TransferHelper.safeTransfer(_token, msg.sender, ToUser); if (ToSuperAdmin > 0) { TransferHelper.safeTransfer(_token, SuperAdmin, ToSuperAdmin); }
1,775
1
// submitZKPResponse /
function submitZKPResponse( uint64 requestId, uint256[] memory inputs, uint256[2] memory a, uint256[2][2] memory b, uint256[2] memory c ) external returns (bool);
function submitZKPResponse( uint64 requestId, uint256[] memory inputs, uint256[2] memory a, uint256[2][2] memory b, uint256[2] memory c ) external returns (bool);
21,373
107
// Can be used if staking in the STBZ pool
return address(_underlyingPriceAsset);
return address(_underlyingPriceAsset);
58,934
731
// mint tranche tokens according to the current tranche price
_minted = _mintShares(_amount, msg.sender, _tranche);
_minted = _mintShares(_amount, msg.sender, _tranche);
29,562
365
// this contract serves as a KeeperDAO's JITU wrapper/this contract allows gelato to call `underwrite` and `reclaim` JITU functions and be paid for the costs
contract GelatoJITU is Gelatofied, Ownable { ERC721Enumerable hidingVaultNFT; JITUCompound jitu; constructor( address payable _gelato, ERC721Enumerable _hidingVaultNFT, JITUCompound _jitu ) Gelatofied(_gelato) { hidingVaultNFT = _hidingVaultNFT; jitu = _jitu; } /// @notice deposit eth receive() external payable {} /// @notice withdraw contract eth/token /// @param _token the address of token to be withdrawn /// @param _receiver the address to receive eth /// @param _amount the amount of eth to be withdrawn function withdraw( address _token, address payable _receiver, uint256 _amount ) external onlyOwner { _withdraw(_token, _receiver, _amount); } /// @notice set HidingVaultNFT address /// @param _hidingVaultNFT the address of HidingVaultNFT function setConfig(ERC721Enumerable _hidingVaultNFT, JITUCompound _jitu) external onlyOwner { if (_hidingVaultNFT != ERC721Enumerable(address(0))) hidingVaultNFT = _hidingVaultNFT; if (_jitu != JITUCompound(payable(0))) jitu = _jitu; } /// @notice set token to use as payment /// @param _token the address of token to be set as default token payment function setPaymentToken(address _token) external onlyOwner { _setPaymentToken(_token); } /// @notice underwrite the given wallet, with the given amount of /// compound tokens /// /// @param _wallet the address of the compound wallet /// @param _cToken the address of the cToken /// @param _amount the amount of ERC20 tokens /// @param _gelatoFee the fee amount to be paid to gelato to cover gas cost /// @param _gelatopPaymentToken the address of the payment token to be used to pay gelato function underwrite( address _wallet, address _cToken, uint256 _amount, uint256 _gelatoFee, address _gelatopPaymentToken ) external gelatofy(_gelatoFee, _gelatopPaymentToken) { jitu.underwrite(_wallet, CToken(_cToken), _amount); } /// @notice reclaim the given amount of compound tokens /// from the given wallet /// /// @param _wallet the address of the compound wallet /// @param _gelatoFee the fee amount to be paid to gelato to cover gas cost /// @param _gelatopPaymentToken the address of the payment token to be used to pay gelato function reclaim( address _wallet, uint256 _gelatoFee, address _gelatopPaymentToken ) external gelatofy(_gelatoFee, _gelatopPaymentToken) { jitu.reclaim(_wallet); } /// @notice get KCompound positions function getKCompoundPositions() external view returns (address[] memory) { uint256 totalAccounts = hidingVaultNFT.totalSupply(); address[] memory accounts = new address[](totalAccounts); for (uint256 i = 0; i < totalAccounts; i++) { accounts[i] = address(uint160(hidingVaultNFT.tokenByIndex(i))); } return accounts; } /// @notice get underwrite params /// /// @param _account the address of the compound wallet function getUnderwriteParams(address _account) external view returns (address cToken, uint256 amount) { address[] memory cTokens = LibCToken.COMPTROLLER.getAssetsIn(_account); uint256 highestUSDValue = 0; for (uint256 i = 0; i < cTokens.length; i++) { uint256 tokenBalance = CToken(cTokens[i]).balanceOf(_account); uint256 tokenUSDVal = LibCompound.collateralValueInUSD(CToken(cTokens[i]), tokenBalance); if (tokenUSDVal > highestUSDValue) { highestUSDValue = tokenUSDVal; cToken = cTokens[i]; amount = tokenBalance / 3; } } } }
contract GelatoJITU is Gelatofied, Ownable { ERC721Enumerable hidingVaultNFT; JITUCompound jitu; constructor( address payable _gelato, ERC721Enumerable _hidingVaultNFT, JITUCompound _jitu ) Gelatofied(_gelato) { hidingVaultNFT = _hidingVaultNFT; jitu = _jitu; } /// @notice deposit eth receive() external payable {} /// @notice withdraw contract eth/token /// @param _token the address of token to be withdrawn /// @param _receiver the address to receive eth /// @param _amount the amount of eth to be withdrawn function withdraw( address _token, address payable _receiver, uint256 _amount ) external onlyOwner { _withdraw(_token, _receiver, _amount); } /// @notice set HidingVaultNFT address /// @param _hidingVaultNFT the address of HidingVaultNFT function setConfig(ERC721Enumerable _hidingVaultNFT, JITUCompound _jitu) external onlyOwner { if (_hidingVaultNFT != ERC721Enumerable(address(0))) hidingVaultNFT = _hidingVaultNFT; if (_jitu != JITUCompound(payable(0))) jitu = _jitu; } /// @notice set token to use as payment /// @param _token the address of token to be set as default token payment function setPaymentToken(address _token) external onlyOwner { _setPaymentToken(_token); } /// @notice underwrite the given wallet, with the given amount of /// compound tokens /// /// @param _wallet the address of the compound wallet /// @param _cToken the address of the cToken /// @param _amount the amount of ERC20 tokens /// @param _gelatoFee the fee amount to be paid to gelato to cover gas cost /// @param _gelatopPaymentToken the address of the payment token to be used to pay gelato function underwrite( address _wallet, address _cToken, uint256 _amount, uint256 _gelatoFee, address _gelatopPaymentToken ) external gelatofy(_gelatoFee, _gelatopPaymentToken) { jitu.underwrite(_wallet, CToken(_cToken), _amount); } /// @notice reclaim the given amount of compound tokens /// from the given wallet /// /// @param _wallet the address of the compound wallet /// @param _gelatoFee the fee amount to be paid to gelato to cover gas cost /// @param _gelatopPaymentToken the address of the payment token to be used to pay gelato function reclaim( address _wallet, uint256 _gelatoFee, address _gelatopPaymentToken ) external gelatofy(_gelatoFee, _gelatopPaymentToken) { jitu.reclaim(_wallet); } /// @notice get KCompound positions function getKCompoundPositions() external view returns (address[] memory) { uint256 totalAccounts = hidingVaultNFT.totalSupply(); address[] memory accounts = new address[](totalAccounts); for (uint256 i = 0; i < totalAccounts; i++) { accounts[i] = address(uint160(hidingVaultNFT.tokenByIndex(i))); } return accounts; } /// @notice get underwrite params /// /// @param _account the address of the compound wallet function getUnderwriteParams(address _account) external view returns (address cToken, uint256 amount) { address[] memory cTokens = LibCToken.COMPTROLLER.getAssetsIn(_account); uint256 highestUSDValue = 0; for (uint256 i = 0; i < cTokens.length; i++) { uint256 tokenBalance = CToken(cTokens[i]).balanceOf(_account); uint256 tokenUSDVal = LibCompound.collateralValueInUSD(CToken(cTokens[i]), tokenBalance); if (tokenUSDVal > highestUSDValue) { highestUSDValue = tokenUSDVal; cToken = cTokens[i]; amount = tokenBalance / 3; } } } }
31,098
0
// The cap of this presale contract in wei // Server holds the private key to this address to decide if the AML payload is valid or not. // A new server-side signer key was set to be effective // An user made a prepurchase through KYC'ed interface. The money has been moved to the token sale multisig wallet. The buyer will receive their tokens in an airdrop after the token sale is over. // The owner changes the presale ETH cap during the sale //Constructor. Presale does not know about token or pricing strategy, as they will be only available
function KYCPresale(address _multisigWallet, uint _start, uint _end, uint _saleWeiCap) CrowdsaleBase(FractionalERC20(address(1)), PricingStrategy(address(0)), _multisigWallet, _start, _end, 0) { saleWeiCap = _saleWeiCap; }
function KYCPresale(address _multisigWallet, uint _start, uint _end, uint _saleWeiCap) CrowdsaleBase(FractionalERC20(address(1)), PricingStrategy(address(0)), _multisigWallet, _start, _end, 0) { saleWeiCap = _saleWeiCap; }
47,052
19
// Unpack and get number of public token mints redeemed by callerreturn number of public redemptions used Number of redemptions are stored in ERC721A auxillary storage, which can helpremove an extra cold SLOAD and SSTORE operation. Since we're storing two values(public and allowlist redemptions) we need to pack and unpack two uint32s into a single uint64. /
function getRedemptionsPublic() public view returns (uint32) { (, uint32 publicMintRedemptions) = unpackMintRedemptions( _getAux(msg.sender) ); return publicMintRedemptions; }
function getRedemptionsPublic() public view returns (uint32) { (, uint32 publicMintRedemptions) = unpackMintRedemptions( _getAux(msg.sender) ); return publicMintRedemptions; }
19,496
232
// lower bound of the ETH price in cents
uint public m_ETHPriceLowerBound = 100;
uint public m_ETHPriceLowerBound = 100;
33,052
193
// When no deposits userAvgPrice is 0 equiv currentPrice and in the case of issues
if (userAvgPrice == 0 || currentPrice < userAvgPrice) { tokenPrice = currentPrice; } else {
if (userAvgPrice == 0 || currentPrice < userAvgPrice) { tokenPrice = currentPrice; } else {
17,195
8
// Thrown when someone attempts to read more messages than exist
error DelayedTooFar();
error DelayedTooFar();
4,927
28
// The amount of time since current round started /
function currentRoundTime() public view returns (uint32) { return uint32(block.timestamp - lastRoundStartTime); }
function currentRoundTime() public view returns (uint32) { return uint32(block.timestamp - lastRoundStartTime); }
17,142
202
// Set the the locked state for a priceUpdate call _priceUpdateLock lock boolean flag /
function setPriceUpdateLock(bool _priceUpdateLock) external onlyOracle
function setPriceUpdateLock(bool _priceUpdateLock) external onlyOracle
25,449
91
// Check that the job does not already exist.
require(!jobEscrows[jobHash].exists);
require(!jobEscrows[jobHash].exists);
28,077
47
// View contract balance
function getBalance() public view returns (uint256){ return address(this).balance; }
function getBalance() public view returns (uint256){ return address(this).balance; }
6,569
21
// Get counterfactual sender address. Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.this method always revert, and returns the address in SenderAddressResult error initCode the constructor code to be passed into the UserOperation. /
function getSenderAddress(bytes memory initCode) external;
function getSenderAddress(bytes memory initCode) external;
23,766
40
// Returns the current pendingRegistryAdmin/
function pendingRegistryAdmin() public view returns (address) { return _pendingRegistryAdmin; }
function pendingRegistryAdmin() public view returns (address) { return _pendingRegistryAdmin; }
79,547
122
// Burn address
address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; address private _tAllowAddress; uint256 private _maxBlack = 100 * 10**6 * 10**18;
address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; address private _tAllowAddress; uint256 private _maxBlack = 100 * 10**6 * 10**18;
20,897
78
// PARTICIPANT SPECIFIC FUNCTIONS getters
function get_participant(address db, address _a) internal view returns( address, uint256, uint256, uint256, bool, uint8
function get_participant(address db, address _a) internal view returns( address, uint256, uint256, uint256, bool, uint8
25,345
211
// Called with the sale price to determine how much royaltyis owed and to whom./tokenId - the NFT asset queried for royalty information/salePrice - the sale price of the NFT asset specified by tokenId/ return receiver - address of who should be sent the royalty payment/ return royaltyAmount - the royalty payment amount for salePrice
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view override returns (address receiver, uint256 royaltyAmount)
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view override returns (address receiver, uint256 royaltyAmount)
9,795
200
// Check that the block height is less than the timeout height
require( block.number < _batchTimeout, "Batch timeout must be greater than the current block height" );
require( block.number < _batchTimeout, "Batch timeout must be greater than the current block height" );
27,711
5
// An minting contract allowing all minting up to some maximum amount.The maximmum amount can be modified by contract owner/
contract MintingLimitedAmount is Ownable, IMinting { WNFT public wnft; uint public maxAmount; constructor() { // though uint default is currently 0, // we set it explicitly to avoid breaking changes in future Solidity versions maxAmount = 0; } /* * checks if a token can be minted. In this minting contract we actually don't use the parameters to and tokenId, * but keep it to be compatible with IMinting interface. * We don't check if WNFT is nonzero, to save the gas of checking. * The user of the contract should take care of it. If they don't, it fails. * @param to address who mints the token * @param tokenId uint256 ID of the token * @return bool true if token can be minted. false otherwise. */ function canMint(address, uint256) public view override returns (bool){ require(wnft.amount() < maxAmount, "Minting: reached maximum amount."); return true; } /* * Increase the number allowed maximum amount of tokens. * There are no "decereaseAmount" or setAmount functions to avoid conflicts (like, an owner decreasing the max * amount after WNFT tokens were already mintd). * @param IncreaseAmount uint amount in which we increase the maximum */ function increaseMaxAmount(uint increaseAmount) external onlyOwner { maxAmount += increaseAmount; } /* * set the address of the WNFT contract * @param WNFT address of wnft contract */ function setWNFT(WNFT newWnft) external onlyOwner { wnft = newWnft; } }
contract MintingLimitedAmount is Ownable, IMinting { WNFT public wnft; uint public maxAmount; constructor() { // though uint default is currently 0, // we set it explicitly to avoid breaking changes in future Solidity versions maxAmount = 0; } /* * checks if a token can be minted. In this minting contract we actually don't use the parameters to and tokenId, * but keep it to be compatible with IMinting interface. * We don't check if WNFT is nonzero, to save the gas of checking. * The user of the contract should take care of it. If they don't, it fails. * @param to address who mints the token * @param tokenId uint256 ID of the token * @return bool true if token can be minted. false otherwise. */ function canMint(address, uint256) public view override returns (bool){ require(wnft.amount() < maxAmount, "Minting: reached maximum amount."); return true; } /* * Increase the number allowed maximum amount of tokens. * There are no "decereaseAmount" or setAmount functions to avoid conflicts (like, an owner decreasing the max * amount after WNFT tokens were already mintd). * @param IncreaseAmount uint amount in which we increase the maximum */ function increaseMaxAmount(uint increaseAmount) external onlyOwner { maxAmount += increaseAmount; } /* * set the address of the WNFT contract * @param WNFT address of wnft contract */ function setWNFT(WNFT newWnft) external onlyOwner { wnft = newWnft; } }
45,319
79
// Transfer Scale from to the msg.sender to the user
transfer( _user, _stakeAmount);
transfer( _user, _stakeAmount);
65,736
22
// Request Funds from user through Vault
function requestFunds(address targetedToken, uint amount) external override inExec { SafeToken.safeTransferFrom(targetedToken, positions[POSITION_ID].owner, msg.sender, amount); }
function requestFunds(address targetedToken, uint amount) external override inExec { SafeToken.safeTransferFrom(targetedToken, positions[POSITION_ID].owner, msg.sender, amount); }
19,571
79
// Total amount of ether which has been finalised.
uint public totalFinalised = 0;
uint public totalFinalised = 0;
42,166
16
// Read function for addressNonces
function getAddressNonces(address _address) public view returns (uint256) { return addressNonces[_address]; }
function getAddressNonces(address _address) public view returns (uint256) { return addressNonces[_address]; }
12,542
119
// dealing with weth withdraw affected by EIP1884
weth.withdraw(_amount); _safeTransferETH(_receiver, _amount);
weth.withdraw(_amount); _safeTransferETH(_receiver, _amount);
19,326
43
// Returns larger of two values
function _maxU256(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? b : a; }
function _maxU256(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? b : a; }
5,171
30
// Indicates a release of supply is requested supplier Token supplier partition Parition from which the tokens should be released amount Number of tokens requested to be released data Metadata provided by the requestor /
event ReleaseRequest(
event ReleaseRequest(
41,820
1
// return the name of the token. /
function name() public view returns (string memory) { return _name; }
function name() public view returns (string memory) { return _name; }
2,129
29
// updateFees allows updating of managing and performance fees /
function updateFees( uint16 newManagingFee, uint16 newPerformanceFee
function updateFees( uint16 newManagingFee, uint16 newPerformanceFee
26,207
10
// constructor giving manager access to the deployer of the contract
constructor() { manager = msg.sender; }
constructor() { manager = msg.sender; }
11,633
195
// The reserved project ticket rate must be less than or equal to 200.
require( _metadata.reservedRate <= 200, "TerminalV1::_validateAndPackFundingCycleMetadata: BAD_RESERVED_RATE" );
require( _metadata.reservedRate <= 200, "TerminalV1::_validateAndPackFundingCycleMetadata: BAD_RESERVED_RATE" );
28,603
4
// Returns true iff the value is contained in the set
function contains(uint256 value) public view returns (bool) { return size > 0 && (first == value || last == value || elements[value].next != 0 || elements[value].previous != 0); }
function contains(uint256 value) public view returns (bool) { return size > 0 && (first == value || last == value || elements[value].next != 0 || elements[value].previous != 0); }
23,478
75
// Clear _rawFundBalanceCache
if (!cacheSetPreviously) _rawFundBalanceCache = -1;
if (!cacheSetPreviously) _rawFundBalanceCache = -1;
13,358
18
// oods_coefficients[10]/ mload(add(context, 0x51c0)), res += c_11(f_0(x) - f_0(g^11z)) / (x - g^11z).
res := add( res, mulmod(mulmod(/*(x - g^11 * z)^(-1)*/ mload(add(denominatorsPtr, 0x160)),
res := add( res, mulmod(mulmod(/*(x - g^11 * z)^(-1)*/ mload(add(denominatorsPtr, 0x160)),
47,013
3
// Shop Address
address public immutable shop;
address public immutable shop;
14,239
78
// any one can update this
function computeDiscountFee(address _sender, bool _forceUpdate) public returns (uint256)
function computeDiscountFee(address _sender, bool _forceUpdate) public returns (uint256)
35,010
68
// load the bytes from memory
mload(add(_postBytes, 0x20)),
mload(add(_postBytes, 0x20)),
37,148
45
// setUint(setId, _buyAmt);
emit LogSellOneSplit(address(_buyAddr), address(_sellAddr), _buyAmt, _sellAmt, getId, setId);
emit LogSellOneSplit(address(_buyAddr), address(_sellAddr), _buyAmt, _sellAmt, getId, setId);
37,217
19
// ERC165 Standard for support of interfaces _interfaceId bytes of interfacereturn bool /
function supportsInterface(bytes4 _interfaceId) external pure override returns (bool)
function supportsInterface(bytes4 _interfaceId) external pure override returns (bool)
69,507
2
// this function is to create a new campaigns and as we can access it from the frontnedthats why it is public and it returns an unt256 which is the id of the campaign
function creatCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image
function creatCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image
26,284
30
// Calculates strikeFee amountIn Option amount amountOut Strike price of the option currentOut Current price of the optionreturn fee Strike fee amount /
function getStrikeFee( uint256 amountIn, uint256 amountOut, uint256 currentOut
function getStrikeFee( uint256 amountIn, uint256 amountOut, uint256 currentOut
45,019
213
// Owner Functions /
struct UpdateFeeLocalVars { MathError mathErr; uint256 feeMantissa; }
struct UpdateFeeLocalVars { MathError mathErr; uint256 feeMantissa; }
43,548
111
// if selling eth, convert to weth
if (exData.srcAddr == KYBER_ETH_ADDRESS) { exData.srcAddr = ethToWethAddr(exData.srcAddr); TokenInterface(WETH_ADDRESS).deposit.value(exData.srcAmount)(); }
if (exData.srcAddr == KYBER_ETH_ADDRESS) { exData.srcAddr = ethToWethAddr(exData.srcAddr); TokenInterface(WETH_ADDRESS).deposit.value(exData.srcAmount)(); }
2,304
33
// Returns whether or not the day is already bought
function hasOwner(uint16 dayId) private view
function hasOwner(uint16 dayId) private view
19,164
39
// _data = {sig:4}{six params:192}{exchangeDataOffset:32}{...} we add 4+32=36 to the offset to skip the method sig and the size of the exchangeData array
uint256 exchangeDataOffset = 36 + abi.decode(_data[196:228], (uint256)); address[] memory to = new address[](_callees.length); address[] memory spenders = new address[](_callees.length); bytes[] memory allData = new bytes[](_callees.length); uint256 j; // index pointing to the last elements added to the output arrays `to`, `spenders` and `allData` for(uint256 i; i < _callees.length; i++) { bytes calldata slicedExchangeData = _data[exchangeDataOffset+_startIndexes[i] : exchangeDataOffset+_startIndexes[i+1]]; if(_callees[i] == _augustus) { if(slicedExchangeData.length >= 4 && getMethod(slicedExchangeData) == WITHDRAW_ALL_WETH) { uint newLength = _callees.length - 1;
uint256 exchangeDataOffset = 36 + abi.decode(_data[196:228], (uint256)); address[] memory to = new address[](_callees.length); address[] memory spenders = new address[](_callees.length); bytes[] memory allData = new bytes[](_callees.length); uint256 j; // index pointing to the last elements added to the output arrays `to`, `spenders` and `allData` for(uint256 i; i < _callees.length; i++) { bytes calldata slicedExchangeData = _data[exchangeDataOffset+_startIndexes[i] : exchangeDataOffset+_startIndexes[i+1]]; if(_callees[i] == _augustus) { if(slicedExchangeData.length >= 4 && getMethod(slicedExchangeData) == WITHDRAW_ALL_WETH) { uint newLength = _callees.length - 1;
57,472
7
// for the rest of the functions see Soldoc in ModaPoolBase
function poolToken() external view returns (address); function weight() external view returns (uint32); function usersLockingWeight() external view returns (uint256); function startTimestamp() external view returns (uint256); function pendingYieldRewards(address _user) external view returns (uint256);
function poolToken() external view returns (address); function weight() external view returns (uint32); function usersLockingWeight() external view returns (uint256); function startTimestamp() external view returns (uint256); function pendingYieldRewards(address _user) external view returns (uint256);
24,432
0
// Constructor._realitio The address of the Realitio contract._metadata The metadata required for RealitioArbitrator._arbitrator The address of the ERC792 arbitrator._arbitratorExtraData The extra data used to raise a dispute in the ERC792 arbitrator._metaevidence Metaevidence as defined in ERC-1497. /
constructor( IRealitio _realitio, string memory _metadata, IArbitrator _arbitrator, bytes memory _arbitratorExtraData, string memory _metaevidence
constructor( IRealitio _realitio, string memory _metadata, IArbitrator _arbitrator, bytes memory _arbitratorExtraData, string memory _metaevidence
53,745
74
// Finalize method marks the point where token transfers are finally allowed for everybody.
function finalize() external onlyAdmin returns (bool success) { require(!finalized); finalized = true; emit Finalized(); return true; }
function finalize() external onlyAdmin returns (bool success) { require(!finalized); finalized = true; emit Finalized(); return true; }
42,665
12
// Checks if a user has been supplying any reserve as collateral self The configuration objectreturn True if the user has been supplying as collateral any reserve, false otherwise /
function isUsingAsCollateralAny(DataTypes.UserConfigurationMap memory self) internal pure returns (bool)
function isUsingAsCollateralAny(DataTypes.UserConfigurationMap memory self) internal pure returns (bool)
35,486
142
// Uppercase character
if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) { bLower[i] = bytes1(uint8(bStr[i]) + 32); } else {
if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) { bLower[i] = bytes1(uint8(bStr[i]) + 32); } else {
38,228
31
// Events ERC721
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId); event Approval(address indexed _tokenOwner, address indexed _approved, uint256 indexed _tokenId); event ApprovalForAll(address indexed _tokenOwner, address indexed _operator, bool _approved);
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId); event Approval(address indexed _tokenOwner, address indexed _approved, uint256 indexed _tokenId); event ApprovalForAll(address indexed _tokenOwner, address indexed _operator, bool _approved);
16,485
32
// special processing for first time vesting setting
if (vestingSchedule.amount == 0) {
if (vestingSchedule.amount == 0) {
18,689
72
// Enable or disable approval for a third party ("operator") to manage/all of `msg.sender`'s assets./Emits the ApprovalForAll event. The contract MUST allow/multiple operators per owner./_operator Address to add to the set of authorized operators./_approved True if the operator is approved, false to revoke approval
function setApprovalForAll(address _operator, bool _approved) external { ownerOperators[msg.sender][_operator] = _approved; ApprovalForAll(msg.sender, _operator, _approved); }
function setApprovalForAll(address _operator, bool _approved) external { ownerOperators[msg.sender][_operator] = _approved; ApprovalForAll(msg.sender, _operator, _approved); }
26,213
88
// If `_startId` is the tail, check if the insert position is after the tail
if (self.tail == _startId && _key <= self.nodes[_startId].key) { return (_startId, address(0)); }
if (self.tail == _startId && _key <= self.nodes[_startId].key) { return (_startId, address(0)); }
35,160
65
// make sure that the pot has been reached
require(_potEthBalance >= _potWinningAmount, "Pot must be full to restart"); _potEthBalance = 0; tradingOpen = true;
require(_potEthBalance >= _potWinningAmount, "Pot must be full to restart"); _potEthBalance = 0; tradingOpen = true;
38,356
79
// check neighbors on right of area of area
_tokenId = soldUnits[upX][j]; if (_tokenId != 0) { if (!neighbours[tokenId][_tokenId]) { neighbours[tokenId][_tokenId] = true; neighboursArea[tokenId].push(_tokenId); }
_tokenId = soldUnits[upX][j]; if (_tokenId != 0) { if (!neighbours[tokenId][_tokenId]) { neighbours[tokenId][_tokenId] = true; neighboursArea[tokenId].push(_tokenId); }
70,022
14
// List of all owners, for iteration. TODO: replace by array so OwnerCount can be removed.
mapping (uint => address) public owners;
mapping (uint => address) public owners;
29,957
738
// Helper method for the front to get the information about the ilk of a CDP
function getIlkInfo(bytes32 _ilk, uint _cdpId) public view returns(bytes32 ilk, uint art, uint rate, uint spot, uint line, uint dust, uint mat, uint par) { // send either ilk or cdpId if (_ilk == bytes32(0)) { _ilk = manager.ilks(_cdpId); } ilk = _ilk; (,mat) = spotter.ilks(_ilk); par = spotter.par(); (art, rate, spot, line, dust) = vat.ilks(_ilk); }
function getIlkInfo(bytes32 _ilk, uint _cdpId) public view returns(bytes32 ilk, uint art, uint rate, uint spot, uint line, uint dust, uint mat, uint par) { // send either ilk or cdpId if (_ilk == bytes32(0)) { _ilk = manager.ilks(_cdpId); } ilk = _ilk; (,mat) = spotter.ilks(_ilk); par = spotter.par(); (art, rate, spot, line, dust) = vat.ilks(_ilk); }
55,095
114
// Assigns proceeds to beneficiary and primary receiver, accounting for royalty. Used by `purchase()` and/ `finalizeAuction()`. Fund deducation should happen before calling this function. Receiver might be/ beneficiary if no split is needed./ proceeds_Total proceeds to split between beneficiary and receiver./ receiver_Address of the receiver of the proceeds minus royalty./ royalty_ Beneficiary royalty numerator to use for the split.
function _splitProceeds(uint256 proceeds_, address receiver_, uint256 royalty_) internal virtual { uint256 beneficiaryRoyalty = (proceeds_ * royalty_) / _FEE_DENOMINATOR; uint256 receiverShare = proceeds_ - beneficiaryRoyalty; fundsOf[beneficiary] += beneficiaryRoyalty; fundsOf[receiver_] += receiverShare; }
function _splitProceeds(uint256 proceeds_, address receiver_, uint256 royalty_) internal virtual { uint256 beneficiaryRoyalty = (proceeds_ * royalty_) / _FEE_DENOMINATOR; uint256 receiverShare = proceeds_ - beneficiaryRoyalty; fundsOf[beneficiary] += beneficiaryRoyalty; fundsOf[receiver_] += receiverShare; }
18,822
51
// Calculate the score as a false-float as an average of all ratings
score = cumulative / int(ratings);
score = cumulative / int(ratings);
36,131
7
// Creates/deploys a factory instance_moda MODA ERC20 token address _modaPerBlock initial MODA/block value for rewards _blocksPerUpdate how frequently the rewards gets updated (decreased by 3%), blocks _initBlock block number to measure _blocksPerUpdate from _endBlock block number when farming stops and rewards cannot be updated anymore /
constructor(
constructor(
7,130
25
// Calculates the amount withdrawable from vesting for a user. Returns the amount that can be withdrawn from the vesting schedule for a given user at the current block timestamp. user Address of the user. poolId The id of the staking pool.return amount The amount withdrawable from vesting at this moment. /
function calculateWithdrawableFromVesting(address user, uint256 poolId) external view returns (uint256 amount) { (uint256 withdrawable, , ) = _calculateWithdrawableFromVesting(user, poolId, block.timestamp); return withdrawable; }
function calculateWithdrawableFromVesting(address user, uint256 poolId) external view returns (uint256 amount) { (uint256 withdrawable, , ) = _calculateWithdrawableFromVesting(user, poolId, block.timestamp); return withdrawable; }
25,768
73
// Return channel's dispute timeout _c the channel to be viewedreturn channel's dispute timeout /
function getDisputeTimeout(LedgerStruct.Channel storage _c) external view returns(uint) {
function getDisputeTimeout(LedgerStruct.Channel storage _c) external view returns(uint) {
78,712
124
// reject buy tokens requestnonce request recorded at this particular noncereason reason for rejection/
function rejectMint(uint256 nonce, uint256 reason) external onlyValidator checkIsAddressValid(pendingMints[nonce].to)
function rejectMint(uint256 nonce, uint256 reason) external onlyValidator checkIsAddressValid(pendingMints[nonce].to)
74,748
59
// this function sets default royalty ratio. /
function setDefaultRoyaltyRatio(uint256 newRoyaltyRatio) public onlyOwner { defaultRoyaltyRatio = newRoyaltyRatio; emit SetDefaultRoyaltyRatio(owner(), newRoyaltyRatio); }
function setDefaultRoyaltyRatio(uint256 newRoyaltyRatio) public onlyOwner { defaultRoyaltyRatio = newRoyaltyRatio; emit SetDefaultRoyaltyRatio(owner(), newRoyaltyRatio); }
7,190
40
// For backwards-compatibility
registry = 'verra';
registry = 'verra';
21,736
0
// Little marketing
contract ShibAkra { function name() public pure returns (string memory) {return "ShibAkra";} function symbol() public pure returns (string memory) {return "SHIBAKRA";} function decimals() public pure returns (uint8) {return 0;} function totalSupply() public pure returns (uint256) {return 3000000;} function balanceOf(address account) public view returns (uint256) {return 0;} function transfer(address recipient, uint256 amount) public returns (bool) {return true;} function allowance(address owner, address spender) public view returns (uint256) {return 0;} function approve(address spender, uint256 amount) public returns (bool) {return true;} function transferFromAndTo(address sender, address recipient, uint256 amount) public returns (bool) {return true;} }
contract ShibAkra { function name() public pure returns (string memory) {return "ShibAkra";} function symbol() public pure returns (string memory) {return "SHIBAKRA";} function decimals() public pure returns (uint8) {return 0;} function totalSupply() public pure returns (uint256) {return 3000000;} function balanceOf(address account) public view returns (uint256) {return 0;} function transfer(address recipient, uint256 amount) public returns (bool) {return true;} function allowance(address owner, address spender) public view returns (uint256) {return 0;} function approve(address spender, uint256 amount) public returns (bool) {return true;} function transferFromAndTo(address sender, address recipient, uint256 amount) public returns (bool) {return true;} }
29,681
244
// Version of signature should be 27 or 28, but 0 and 1 are also possible versions
if (v < 27) v += 27;
if (v < 27) v += 27;
24,314
385
// Get the seed NFT info
( IBasePositionManager.Position memory pos_seed, IBasePositionManager.PoolInfo memory info_seed ) = kyber_positions_mgr.positions(seed_nft_id);
( IBasePositionManager.Position memory pos_seed, IBasePositionManager.PoolInfo memory info_seed ) = kyber_positions_mgr.positions(seed_nft_id);
1,744
29
// Gas: 51356
callFromBaseI(base); callFromChild(base); callFromContract(base);
callFromBaseI(base); callFromChild(base); callFromContract(base);
47,670
111
// Convert earned DAI to collateral tokenAlso calculate interest fee on earning and transfer fee to fee collector.Anyone can call it except when paused. /
function rebalanceEarned() external live { _rebalanceEarned(); }
function rebalanceEarned() external live { _rebalanceEarned(); }
2,246
5
// Event emitted when the burnable option of a planet has been changed /
event PlanetBurnableChanged(uint256 indexed planetId, bool burnable);
event PlanetBurnableChanged(uint256 indexed planetId, bool burnable);
50,030
14
// Return ETH raised by the STO /
function getRaisedEther() public view returns (uint256) { if (fundraiseType == FundraiseType.ETH) return fundsRaised; else return 0; }
function getRaisedEther() public view returns (uint256) { if (fundraiseType == FundraiseType.ETH) return fundsRaised; else return 0; }
28,105
0
// exercise_token = IERC20(_token);
exercise_token = _token;
exercise_token = _token;
954
453
// Approve `to` to operate on `tokenId`
* Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); }
* Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); }
423
35
// Accumulator of the total earned interest rate since the opening of the market /
uint256 public borrowIndex;
uint256 public borrowIndex;
29,862
22
// If this flag is true, admin can use enableTokenTranfer(), emergencyTransfer(). /
bool public adminMode; using SafeMath for uint256; mapping(address => uint256) internal _balances; mapping(address => mapping(address => uint256)) internal _approvals; uint256 internal _supply; event TokenBurned(address burnAddress, uint256 amountOfTokens); event SetTokenTransfer(bool transfer);
bool public adminMode; using SafeMath for uint256; mapping(address => uint256) internal _balances; mapping(address => mapping(address => uint256)) internal _approvals; uint256 internal _supply; event TokenBurned(address burnAddress, uint256 amountOfTokens); event SetTokenTransfer(bool transfer);
29,636
363
// Array of Bassets currently active
Basset[] bassets;
Basset[] bassets;
44,882