More Info
Private Name Tags
ContractCreator
Sponsored
Loading...
Loading
Contract Name:
MultiTokenListener
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.6.4 <=8.0.0; import "@pooltogether/pooltogether-contracts/contracts/token/TokenListener.sol"; import "@pooltogether/pooltogether-contracts/contracts/token-faucet/TokenFaucet.sol"; import "./external/AddressRegistry.sol"; /// @title MultiTokenListener is an ownable contract which holds a number of TokenFaucets /// @notice MultiTokenListener passes through the ControlledToken beforeTokenMint and beforeTokenTransfer hooks to each TokenFaucet in its registry contract MultiTokenListener is TokenListener, AddressRegistry { /// @notice Initiaize the MultiTokenListener and Registry /// @param _owner The owner address function initialize(address _owner) public initializer { initializeAddressRegistry("TokenFaucets", _owner); } /// @notice Freezes the contract, so that there is no owner. /// @dev Useful for proxy implementations function freeze() public initializer { // no-op } /// @notice Pass through the beforeTokenMint hook to all the registry TokenFaucets /// @param to The address being minted to /// @param amount The amount of controlledToken being minted /// @param controlledToken The controlledToken address being minted /// @param referrer The referrer address function beforeTokenMint(address to, uint256 amount, address controlledToken, address referrer) external override { address faucet = addressList.start(); address end = addressList.end(); while(faucet != end){ TokenFaucet(faucet).beforeTokenMint(to, amount, controlledToken, referrer); faucet = addressList.next(faucet); } } /// @notice Pass through the beforeTokenTransfer hook to all the registry TokenFaucets /// @param from The address being transferred from /// @param to The address being transferred to /// @param amount The amount of controlledToken being transferred /// @param controlledToken The controlledToken address function beforeTokenTransfer(address from, address to, uint256 amount, address controlledToken) external override { address faucet = addressList.start(); address end = addressList.end(); while(faucet != end){ TokenFaucet(faucet).beforeTokenTransfer(from, to, amount, controlledToken); faucet = addressList.next(faucet); } } }
pragma solidity ^0.6.4; import "./TokenListenerInterface.sol"; import "./TokenListenerLibrary.sol"; import "../Constants.sol"; abstract contract TokenListener is TokenListenerInterface { function supportsInterface(bytes4 interfaceId) external override view returns (bool) { return ( interfaceId == Constants.ERC165_INTERFACE_ID_ERC165 || interfaceId == TokenListenerLibrary.ERC165_INTERFACE_ID_TOKEN_LISTENER ); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.6.0 <0.7.0; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@pooltogether/fixed-point/contracts/FixedPoint.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "../utils/ExtendedSafeCast.sol"; import "../token/TokenListener.sol"; /// @title Disburses a token at a fixed rate per second to holders of another token. /// @notice The tokens are dripped at a "drip rate per second". This is the number of tokens that /// are dripped each second. A user's share of the dripped tokens is based on how many 'measure' tokens they hold. /* solium-disable security/no-block-members */ contract TokenFaucet is OwnableUpgradeable, TokenListener { using SafeMathUpgradeable for uint256; using SafeCastUpgradeable for uint256; using ExtendedSafeCast for uint256; event Initialized( IERC20Upgradeable indexed asset, IERC20Upgradeable indexed measure, uint256 dripRatePerSecond ); event Dripped( uint256 newTokens ); event Deposited( address indexed user, uint256 amount ); event Withdrawn( address indexed to, uint256 amount ); event Claimed( address indexed user, uint256 newTokens ); event DripRateChanged( uint256 dripRatePerSecond ); struct UserState { uint128 lastExchangeRateMantissa; uint128 balance; } /// @notice The token that is being disbursed IERC20Upgradeable public asset; /// @notice The token that is user to measure a user's portion of disbursed tokens IERC20Upgradeable public measure; /// @notice The total number of tokens that are disbursed each second uint256 public dripRatePerSecond; /// @notice The cumulative exchange rate of measure token supply : dripped tokens uint112 public exchangeRateMantissa; /// @notice The total amount of tokens that have been dripped but not claimed uint112 public totalUnclaimed; /// @notice The timestamp at which the tokens were last dripped uint32 public lastDripTimestamp; /// @notice The data structure that tracks when a user last received tokens mapping(address => UserState) public userStates; /// @notice Initializes a new Comptroller V2 /// @param _asset The asset to disburse to users /// @param _measure The token to use to measure a users portion /// @param _dripRatePerSecond The amount of the asset to drip each second function initialize ( IERC20Upgradeable _asset, IERC20Upgradeable _measure, uint256 _dripRatePerSecond ) public initializer { __Ownable_init(); lastDripTimestamp = _currentTime(); asset = _asset; measure = _measure; setDripRatePerSecond(_dripRatePerSecond); emit Initialized( asset, measure, dripRatePerSecond ); } /// @notice Safely deposits asset tokens into the faucet. Must be pre-approved /// This should be used instead of transferring directly because the drip function must /// be called before receiving new assets. /// @param amount The amount of asset tokens to add (must be approved already) function deposit(uint256 amount) external { drip(); asset.transferFrom(msg.sender, address(this), amount); emit Deposited(msg.sender, amount); } /// @notice Allows the owner to withdraw tokens that have not been dripped yet. /// @param to The address to withdraw to /// @param amount The amount to withdraw function withdrawTo(address to, uint256 amount) external onlyOwner { drip(); uint256 assetTotalSupply = asset.balanceOf(address(this)); uint256 availableTotalSupply = assetTotalSupply.sub(totalUnclaimed); require(amount <= availableTotalSupply, "TokenFaucet/insufficient-funds"); asset.transfer(to, amount); emit Withdrawn(to, amount); } /// @notice Transfers all unclaimed tokens to the user /// @param user The user to claim tokens for /// @return The amount of tokens that were claimed. function claim(address user) external returns (uint256) { drip(); _captureNewTokensForUser(user); uint256 balance = userStates[user].balance; userStates[user].balance = 0; totalUnclaimed = uint256(totalUnclaimed).sub(balance).toUint112(); asset.transfer(user, balance); emit Claimed(user, balance); return balance; } /// @notice Drips new tokens. /// @dev Should be called immediately before any measure token mints/transfers/burns /// @return The number of new tokens dripped. function drip() public returns (uint256) { uint256 currentTimestamp = _currentTime(); // this should only run once per block. if (lastDripTimestamp == uint32(currentTimestamp)) { return 0; } uint256 assetTotalSupply = asset.balanceOf(address(this)); uint256 availableTotalSupply = assetTotalSupply.sub(totalUnclaimed); uint256 newSeconds = currentTimestamp.sub(lastDripTimestamp); uint256 nextExchangeRateMantissa = exchangeRateMantissa; uint256 newTokens; uint256 measureTotalSupply = measure.totalSupply(); if (measureTotalSupply > 0 && availableTotalSupply > 0) { newTokens = newSeconds.mul(dripRatePerSecond); if (newTokens > availableTotalSupply) { newTokens = availableTotalSupply; } uint256 indexDeltaMantissa = FixedPoint.calculateMantissa(newTokens, measureTotalSupply); nextExchangeRateMantissa = nextExchangeRateMantissa.add(indexDeltaMantissa); emit Dripped( newTokens ); } exchangeRateMantissa = nextExchangeRateMantissa.toUint112(); totalUnclaimed = uint256(totalUnclaimed).add(newTokens).toUint112(); lastDripTimestamp = currentTimestamp.toUint32(); return newTokens; } /// @notice Allows the owner to set the drip rate per second. This is the number of tokens that are dripped each second. /// @param _dripRatePerSecond The new drip rate in tokens per second function setDripRatePerSecond(uint256 _dripRatePerSecond) public onlyOwner { require(_dripRatePerSecond > 0, "TokenFaucet/dripRate-gt-zero"); // ensure we're all caught up drip(); dripRatePerSecond = _dripRatePerSecond; emit DripRateChanged(dripRatePerSecond); } /// @notice Captures new tokens for a user /// @dev This must be called before changes to the user's balance (i.e. before mint, transfer or burns) /// @param user The user to capture tokens for /// @return The number of new tokens function _captureNewTokensForUser( address user ) private returns (uint128) { UserState storage userState = userStates[user]; if (exchangeRateMantissa == userState.lastExchangeRateMantissa) { // ignore if exchange rate is same return 0; } uint256 deltaExchangeRateMantissa = uint256(exchangeRateMantissa).sub(userState.lastExchangeRateMantissa); uint256 userMeasureBalance = measure.balanceOf(user); uint128 newTokens = FixedPoint.multiplyUintByMantissa(userMeasureBalance, deltaExchangeRateMantissa).toUint128(); userStates[user] = UserState({ lastExchangeRateMantissa: exchangeRateMantissa, balance: uint256(userState.balance).add(newTokens).toUint128() }); return newTokens; } /// @notice Should be called before a user mints new "measure" tokens. /// @param to The user who is minting the tokens /// @param token The token they are minting function beforeTokenMint( address to, uint256, address token, address ) external override { if (token == address(measure)) { drip(); _captureNewTokensForUser(to); } } /// @notice Should be called before "measure" tokens are transferred or burned /// @param from The user who is sending the tokens /// @param to The user who is receiving the tokens /// @param token The token token they are burning function beforeTokenTransfer( address from, address to, uint256, address token ) external override { // must be measure and not be minting if (token == address(measure) && from != address(0)) { drip(); _captureNewTokensForUser(to); _captureNewTokensForUser(from); } } /// @notice returns the current time. Allows for override in testing. /// @return The current time (block.timestamp) function _currentTime() internal virtual view returns (uint32) { return block.timestamp.toUint32(); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.4 <=8.0.0; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "./MappedSinglyLinkedList.sol"; ///@notice A registry to hold Contract addresses. Underlying data structure is a singly linked list. contract AddressRegistry is OwnableUpgradeable { using MappedSinglyLinkedList for MappedSinglyLinkedList.Mapping; MappedSinglyLinkedList.Mapping internal addressList; /// @notice Emmitted when a contract has been added to the registry event AddressAdded(address indexed _address); /// @notice Emmitted when a contract has been removed to the registry event AddressRemoved(address indexed _address); /// @notice Emitted when all the registry addresses are cleared event AllAddressesCleared(); /// @notice Storage field for what type of contract this Registry is storing string public addressType; /// @notice Initializes the AddressRegistry /// @param _addressType The Type of contract the AddressRegistry will hold /// @param _owner The address of the contract owner function initializeAddressRegistry(string memory _addressType, address _owner) internal { __Ownable_init(); transferOwnership(_owner); addressType = _addressType; addressList.initialize(); } /// @notice Returns an array of all contract addresses in the linked list /// @return Array of contract addresses function getAddresses() view external returns(address[] memory) { return addressList.addressArray(); } /// @notice Adds addresses to the linked list. Will revert if the address is already in the list. Can only be called by the Registry owner. /// @param _addresses Array of contract addresses to be added function addAddresses(address[] calldata _addresses) public onlyOwner { for(uint256 _address = 0; _address < _addresses.length; _address++ ){ addressList.addAddress(_addresses[_address]); emit AddressAdded(_addresses[_address]); } } /// @notice Removes an address from the linked list. Can only be called by the Registry owner. /// @param _previousContract The address positionally located before the address that will be deleted. This may be the SENTINEL address if the list contains one contract address /// @param _address The address to remove from the linked list. function removeAddress(address _previousContract, address _address) public onlyOwner { addressList.removeAddress(_previousContract, _address); emit AddressRemoved(_address); } /// @notice Removes every address from the list function clearAll() public onlyOwner { addressList.clearAll(); emit AllAddressesCleared(); } /// @notice Determines whether the list contains the given address /// @param _addr The address to check /// @return True if the address is contained, false otherwise. function contains(address _addr) public returns (bool) { return addressList.contains(_addr); } /// @notice Gives the address at the start of the list /// @return The address at the start of the list function start() public view returns (address) { return addressList.start(); } /// @notice Exposes the internal next() iterator /// @param current The current address /// @return Returns the next address in the list function next(address current) public view returns (address) { return addressList.next(current); } /// @notice Exposes the end of the list /// @return The sentinel address function end() public view returns (address) { return addressList.end(); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.5.0 <0.7.0; import "@openzeppelin/contracts-upgradeable/introspection/IERC165Upgradeable.sol"; /// @title An interface that allows a contract to listen to token mint, transfer and burn events. interface TokenListenerInterface is IERC165Upgradeable { /// @notice Called when tokens are minted. /// @param to The address of the receiver of the minted tokens. /// @param amount The amount of tokens being minted /// @param controlledToken The address of the token that is being minted /// @param referrer The address that referred the minting. function beforeTokenMint(address to, uint256 amount, address controlledToken, address referrer) external; /// @notice Called when tokens are transferred or burned. /// @param from The address of the sender of the token transfer /// @param to The address of the receiver of the token transfer. Will be the zero address if burning. /// @param amount The amount of tokens transferred /// @param controlledToken The address of the token that was transferred function beforeTokenTransfer(address from, address to, uint256 amount, address controlledToken) external; }
pragma solidity ^0.6.12; library TokenListenerLibrary { /* * bytes4(keccak256('beforeTokenMint(address,uint256,address,address)')) == 0x4d7f3db0 * bytes4(keccak256('beforeTokenTransfer(address,address,uint256,address)')) == 0xb2210957 * * => 0x4d7f3db0 ^ 0xb2210957 == 0xff5e34e7 */ bytes4 public constant ERC165_INTERFACE_ID_TOKEN_LISTENER = 0xff5e34e7; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.6.0 <0.7.0; import "@openzeppelin/contracts-upgradeable/introspection/IERC1820RegistryUpgradeable.sol"; library Constants { IERC1820RegistryUpgradeable public constant REGISTRY = IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); // keccak256("ERC777TokensSender") bytes32 public constant TOKENS_SENDER_INTERFACE_HASH = 0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895; // keccak256("ERC777TokensRecipient") bytes32 public constant TOKENS_RECIPIENT_INTERFACE_HASH = 0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b; // keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC")); bytes32 public constant ACCEPT_MAGIC = 0xa2ef4600d742022d532d4747cb3547474667d6f13804902513b2ec01c848f4b4; bytes4 public constant ERC165_INTERFACE_ID_ERC165 = 0x01ffc9a7; bytes4 public constant ERC165_INTERFACE_ID_ERC721 = 0x80ac58cd; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the global ERC1820 Registry, as defined in the * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register * implementers for interfaces in this registry, as well as query support. * * Implementers may be shared by multiple accounts, and can also implement more * than a single interface for each account. Contracts can implement interfaces * for themselves, but externally-owned accounts (EOA) must delegate this to a * contract. * * {IERC165} interfaces can also be queried via the registry. * * For an in-depth explanation and source code analysis, see the EIP text. */ interface IERC1820RegistryUpgradeable { /** * @dev Sets `newManager` as the manager for `account`. A manager of an * account is able to set interface implementers for it. * * By default, each account is its own manager. Passing a value of `0x0` in * `newManager` will reset the manager to this initial state. * * Emits a {ManagerChanged} event. * * Requirements: * * - the caller must be the current manager for `account`. */ function setManager(address account, address newManager) external; /** * @dev Returns the manager for `account`. * * See {setManager}. */ function getManager(address account) external view returns (address); /** * @dev Sets the `implementer` contract as ``account``'s implementer for * `interfaceHash`. * * `account` being the zero address is an alias for the caller's address. * The zero address can also be used in `implementer` to remove an old one. * * See {interfaceHash} to learn how these are created. * * Emits an {InterfaceImplementerSet} event. * * Requirements: * * - the caller must be the current manager for `account`. * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not * end in 28 zeroes). * - `implementer` must implement {IERC1820Implementer} and return true when * queried for support, unless `implementer` is the caller. See * {IERC1820Implementer-canImplementInterfaceForAddress}. */ function setInterfaceImplementer(address account, bytes32 _interfaceHash, address implementer) external; /** * @dev Returns the implementer of `interfaceHash` for `account`. If no such * implementer is registered, returns the zero address. * * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28 * zeroes), `account` will be queried for support of it. * * `account` being the zero address is an alias for the caller's address. */ function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address); /** * @dev Returns the interface hash for an `interfaceName`, as defined in the * corresponding * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP]. */ function interfaceHash(string calldata interfaceName) external pure returns (bytes32); /** * @notice Updates the cache with whether the contract implements an ERC165 interface or not. * @param account Address of the contract for which to update the cache. * @param interfaceId ERC165 interface for which to update the cache. */ function updateERC165Cache(address account, bytes4 interfaceId) external; /** * @notice Checks whether a contract implements an ERC165 interface or not. * If the result is not cached a direct lookup on the contract address is performed. * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling * {updateERC165Cache} with the contract address. * @param account Address of the contract to check. * @param interfaceId ERC165 interface to check. * @return True if `account` implements `interfaceId`, false otherwise. */ function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool); /** * @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache. * @param account Address of the contract to check. * @param interfaceId ERC165 interface to check. * @return True if `account` implements `interfaceId`, false otherwise. */ function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool); event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer); event ManagerChanged(address indexed account, address indexed newManager); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCastUpgradeable { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { require(value < 2**255, "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
/** Copyright 2020 PoolTogether Inc. This file is part of PoolTogether. PoolTogether is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation under version 3 of the License. PoolTogether is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with PoolTogether. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity >=0.6.0 <0.8.0; import "./external/openzeppelin/OpenZeppelinSafeMath_V3_3_0.sol"; /** * @author Brendan Asselstine * @notice Provides basic fixed point math calculations. * * This library calculates integer fractions by scaling values by 1e18 then performing standard integer math. */ library FixedPoint { using OpenZeppelinSafeMath_V3_3_0 for uint256; // The scale to use for fixed point numbers. Same as Ether for simplicity. uint256 internal constant SCALE = 1e18; /** * Calculates a Fixed18 mantissa given the numerator and denominator * * The mantissa = (numerator * 1e18) / denominator * * @param numerator The mantissa numerator * @param denominator The mantissa denominator * @return The mantissa of the fraction */ function calculateMantissa(uint256 numerator, uint256 denominator) internal pure returns (uint256) { uint256 mantissa = numerator.mul(SCALE); mantissa = mantissa.div(denominator); return mantissa; } /** * Multiplies a Fixed18 number by an integer. * * @param b The whole integer to multiply * @param mantissa The Fixed18 number * @return An integer that is the result of multiplying the params. */ function multiplyUintByMantissa(uint256 b, uint256 mantissa) internal pure returns (uint256) { uint256 result = mantissa.mul(b); result = result.div(SCALE); return result; } /** * Divides an integer by a fixed point 18 mantissa * * @param dividend The integer to divide * @param mantissa The fixed point 18 number to serve as the divisor * @return An integer that is the result of dividing an integer by a fixed point 18 mantissa */ function divideUintByMantissa(uint256 dividend, uint256 mantissa) internal pure returns (uint256) { uint256 result = SCALE.mul(dividend); result = result.div(mantissa); return result; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal initializer { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal initializer { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } uint256[49] private __gap; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.6.0 <0.7.0; library ExtendedSafeCast { /** * @dev Converts an unsigned uint256 into a unsigned uint112. * * Requirements: * * - input must be less than or equal to maxUint112. */ function toUint112(uint256 value) internal pure returns (uint112) { require(value < 2**112, "SafeCast: value doesn't fit in an uint112"); return uint112(value); } /** * @dev Converts an unsigned uint256 into a unsigned uint96. * * Requirements: * * - input must be less than or equal to maxUint96. */ function toUint96(uint256 value) internal pure returns (uint96) { require(value < 2**96, "SafeCast: value doesn't fit in an uint96"); return uint96(value); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * 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"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // NOTE: Copied from OpenZeppelin Contracts version 3.3.0 pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library OpenZeppelinSafeMath_V3_3_0 { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.4 <=8.0.0; /// @notice An efficient implementation of a singly linked list of addresses /// @dev A mapping(address => address) tracks the 'next' pointer. A special address called the SENTINEL is used to denote the beginning and end of the list. library MappedSinglyLinkedList { /// @notice The special value address used to denote the end of the list address public constant SENTINEL = address(0x1); /// @notice The data structure to use for the list. struct Mapping { uint256 count; mapping(address => address) addressMap; } /// @notice Initializes the list. /// @dev It is important that this is called so that the SENTINEL is correctly setup. function initialize(Mapping storage self) internal { require(self.count == 0, "Already init"); self.addressMap[SENTINEL] = SENTINEL; } function start(Mapping storage self) internal view returns (address) { return self.addressMap[SENTINEL]; } function next(Mapping storage self, address current) internal view returns (address) { return self.addressMap[current]; } function end(Mapping storage) internal pure returns (address) { return SENTINEL; } function addAddresses(Mapping storage self, address[] memory addresses) internal { for (uint256 i = 0; i < addresses.length; i++) { addAddress(self, addresses[i]); } } /// @notice Adds an address to the front of the list. /// @param self The Mapping struct that this function is attached to /// @param newAddress The address to shift to the front of the list function addAddress(Mapping storage self, address newAddress) internal { require(newAddress != SENTINEL && newAddress != address(0), "Invalid address"); require(self.addressMap[newAddress] == address(0), "Already added"); self.addressMap[newAddress] = self.addressMap[SENTINEL]; self.addressMap[SENTINEL] = newAddress; self.count = self.count + 1; } /// @notice Removes an address from the list /// @param self The Mapping struct that this function is attached to /// @param prevAddress The address that precedes the address to be removed. This may be the SENTINEL if at the start. /// @param addr The address to remove from the list. function removeAddress(Mapping storage self, address prevAddress, address addr) internal { require(addr != SENTINEL && addr != address(0), "Invalid address"); require(self.addressMap[prevAddress] == addr, "Invalid prevAddress"); self.addressMap[prevAddress] = self.addressMap[addr]; delete self.addressMap[addr]; self.count = self.count - 1; } /// @notice Determines whether the list contains the given address /// @param self The Mapping struct that this function is attached to /// @param addr The address to check /// @return True if the address is contained, false otherwise. function contains(Mapping storage self, address addr) internal view returns (bool) { return addr != SENTINEL && addr != address(0) && self.addressMap[addr] != address(0); } /// @notice Returns an address array of all the addresses in this list /// @dev Contains a for loop, so complexity is O(n) wrt the list size /// @param self The Mapping struct that this function is attached to /// @return An array of all the addresses function addressArray(Mapping storage self) internal view returns (address[] memory) { address[] memory array = new address[](self.count); uint256 count; address currentAddress = self.addressMap[SENTINEL]; while (currentAddress != address(0) && currentAddress != SENTINEL) { array[count] = currentAddress; currentAddress = self.addressMap[currentAddress]; count++; } return array; } /// @notice Removes every address from the list /// @param self The Mapping struct that this function is attached to function clearAll(Mapping storage self) internal { address currentAddress = self.addressMap[SENTINEL]; while (currentAddress != address(0) && currentAddress != SENTINEL) { address nextAddress = self.addressMap[currentAddress]; delete self.addressMap[currentAddress]; currentAddress = nextAddress; } self.addressMap[SENTINEL] = SENTINEL; self.count = 0; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "istanbul", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_address","type":"address"}],"name":"AddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_address","type":"address"}],"name":"AddressRemoved","type":"event"},{"anonymous":false,"inputs":[],"name":"AllAddressesCleared","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"addAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"addressType","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"controlledToken","type":"address"},{"internalType":"address","name":"referrer","type":"address"}],"name":"beforeTokenMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"controlledToken","type":"address"}],"name":"beforeTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"clearAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"contains","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"end","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freeze","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"current","type":"address"}],"name":"next","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_previousContract","type":"address"},{"internalType":"address","name":"_address","type":"address"}],"name":"removeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"start","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506113f6806100206000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c8063a39fac12116100a2578063be9a655511610071578063be9a6555146103b8578063c4d66de8146103c0578063ebb689a1146103e6578063efbe1c1c146103ee578063f2fde38b146103f65761010b565b8063a39fac12146102d0578063ab73e31614610328578063b22109571461034e578063b6fac15a1461038a5761010b565b80635dbe47e8116100de5780635dbe47e81461027657806362a5af3b1461029c578063715018a6146102a45780638da5cb5b146102ac5761010b565b806301ffc9a7146101105780633628731c1461014b5780634d7f3db0146101bd578063506cd107146101f9575b600080fd5b6101376004803603602081101561012657600080fd5b50356001600160e01b03191661041c565b604080519115158252519081900360200190f35b6101bb6004803603602081101561016157600080fd5b81019060208101813564010000000081111561017c57600080fd5b82018360208201111561018e57600080fd5b803590602001918460208302840111640100000000831117156101b057600080fd5b509092509050610456565b005b6101bb600480360360808110156101d357600080fd5b506001600160a01b03813581169160208101359160408201358116916060013516610550565b610201610623565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561023b578181015183820152602001610223565b50505050905090810190601f1680156102685780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101376004803603602081101561028c57600080fd5b50356001600160a01b03166106b1565b6101bb6106be565b6101bb610760565b6102b461080c565b604080516001600160a01b039092168252519081900360200190f35b6102d861081b565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103145781810151838201526020016102fc565b505050509050019250505060405180910390f35b6102b46004803603602081101561033e57600080fd5b50356001600160a01b031661082c565b6101bb6004803603608081101561036457600080fd5b506001600160a01b03813581169160208101358216916040820135916060013516610839565b6101bb600480360360408110156103a057600080fd5b506001600160a01b0381358116916020013516610904565b6102b46109aa565b6101bb600480360360208110156103d657600080fd5b50356001600160a01b03166109b6565b6101bb610a87565b6102b4610b1e565b6101bb6004803603602081101561040c57600080fd5b50356001600160a01b0316610b2a565b60006001600160e01b031982166301ffc9a760e01b148061045057506001600160e01b03198216600162a1cb1960e01b0319145b92915050565b61045e610c2d565b6001600160a01b031661046f61080c565b6001600160a01b0316146104b8576040805162461bcd60e51b815260206004820181905260248201526000805160206113a1833981519152604482015290519081900360640190fd5b60005b8181101561054b576104f28383838181106104d257fe5b905060200201356001600160a01b03166065610c3190919063ffffffff16565b8282828181106104fe57fe5b905060200201356001600160a01b03166001600160a01b03167fa226db3f664042183ee0281230bba26cbf7b5057e50aee7f25a175ff45ce4d7f60405160405180910390a26001016104bb565b505050565b600061055c6065610d45565b9050600061056a6065610d62565b90505b806001600160a01b0316826001600160a01b03161461061b57604080516304d7f3db60e41b81526001600160a01b0388811660048301526024820188905286811660448301528581166064830152915191841691634d7f3db09160848082019260009290919082900301818387803b1580156105e857600080fd5b505af11580156105fc573d6000803e3d6000fd5b50505050610614826065610d6890919063ffffffff16565b915061056d565b505050505050565b6067805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106a95780601f1061067e576101008083540402835291602001916106a9565b820191906000526020600020905b81548152906001019060200180831161068c57829003601f168201915b505050505081565b6000610450606583610d8b565b600054610100900460ff16806106d757506106d7610ddd565b806106e5575060005460ff16155b6107205760405162461bcd60e51b815260040180806020018281038252602e815260200180611373602e913960400191505060405180910390fd5b600054610100900460ff1615801561074b576000805460ff1961ff0019909116610100171660011790555b801561075d576000805461ff00191690555b50565b610768610c2d565b6001600160a01b031661077961080c565b6001600160a01b0316146107c2576040805162461bcd60e51b815260206004820181905260248201526000805160206113a1833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b6033546001600160a01b031690565b60606108276065610dee565b905090565b6000610450606583610d68565b60006108456065610d45565b905060006108536065610d62565b90505b806001600160a01b0316826001600160a01b03161461061b576040805163b221095760e01b81526001600160a01b038881166004830152878116602483015260448201879052858116606483015291519184169163b22109579160848082019260009290919082900301818387803b1580156108d157600080fd5b505af11580156108e5573d6000803e3d6000fd5b505050506108fd826065610d6890919063ffffffff16565b9150610856565b61090c610c2d565b6001600160a01b031661091d61080c565b6001600160a01b031614610966576040805162461bcd60e51b815260206004820181905260248201526000805160206113a1833981519152604482015290519081900360640190fd5b61097260658383610ece565b6040516001600160a01b038216907f24a12366c02e13fe4a9e03d86a8952e85bb74a456c16e4a18b6d8295700b74bb90600090a25050565b60006108276065610d45565b600054610100900460ff16806109cf57506109cf610ddd565b806109dd575060005460ff16155b610a185760405162461bcd60e51b815260040180806020018281038252602e815260200180611373602e913960400191505060405180910390fd5b600054610100900460ff16158015610a43576000805460ff1961ff0019909116610100171660011790555b610a716040518060400160405280600c81526020016b546f6b656e4661756365747360a01b81525083610fea565b8015610a83576000805461ff00191690555b5050565b610a8f610c2d565b6001600160a01b0316610aa061080c565b6001600160a01b031614610ae9576040805162461bcd60e51b815260206004820181905260248201526000805160206113a1833981519152604482015290519081900360640190fd5b610af36065611019565b6040517fd2246837fc932fb127be794938f83245f3a8fc7fa8be0abfcddde9b07875d02090600090a1565b60006108276065610d62565b610b32610c2d565b6001600160a01b0316610b4361080c565b6001600160a01b031614610b8c576040805162461bcd60e51b815260206004820181905260248201526000805160206113a1833981519152604482015290519081900360640190fd5b6001600160a01b038116610bd15760405162461bcd60e51b815260040180806020018281038252602681526020018061134d6026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6001600160a01b038116600114801590610c5357506001600160a01b03811615155b610c96576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b6001600160a01b0381811660009081526001840160205260409020541615610cf5576040805162461bcd60e51b815260206004820152600d60248201526c105b1c9958591e481859191959609a1b604482015290519081900360640190fd5b60016000818152838201602052604080822080546001600160a01b039586168085529284208054969091166001600160a01b03199687161790559183905281549093169092179091558154019055565b60016000818152910160205260409020546001600160a01b031690565b50600190565b6001600160a01b0380821660009081526001840160205260409020541692915050565b60006001600160a01b038216600114801590610daf57506001600160a01b03821615155b8015610dd657506001600160a01b0382811660009081526001850160205260409020541615155b9392505050565b6000610de8306110b5565b15905090565b606080826000015467ffffffffffffffff81118015610e0c57600080fd5b50604051908082528060200260200182016040528015610e36578160200160208202803683370190505b50600160008181529085016020526040812054919250906001600160a01b03165b6001600160a01b03811615801590610e7957506001600160a01b038116600114155b15610ec55780838381518110610e8b57fe5b6001600160a01b03928316602091820292909201810191909152918116600090815260018088019093526040902054929091019116610e57565b50909392505050565b6001600160a01b038116600114801590610ef057506001600160a01b03811615155b610f33576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b6001600160a01b038281166000908152600185016020526040902054811690821614610f9c576040805162461bcd60e51b8152602060048201526013602482015272496e76616c696420707265764164647265737360681b604482015290519081900360640190fd5b6001600160a01b039081166000818152600185016020526040808220805495851683529082208054959094166001600160a01b03199586161790935552805490911690558054600019019055565b610ff26110bb565b610ffb81610b2a565b815161100e9060679060208501906112b9565b50610a836065611158565b6001600081815290820160205260409020546001600160a01b03165b6001600160a01b0381161580159061105757506001600160a01b038116600114155b1561108d576001600160a01b039081166000908152600183016020526040902080546001600160a01b0319811690915516611035565b50600160008181528282016020526040812080546001600160a01b0319169092179091559055565b3b151590565b600054610100900460ff16806110d457506110d4610ddd565b806110e2575060005460ff16155b61111d5760405162461bcd60e51b815260040180806020018281038252602e815260200180611373602e913960400191505060405180910390fd5b600054610100900460ff16158015611148576000805460ff1961ff0019909116610100171660011790555b6111506106be565b61074b6111c0565b80541561119b576040805162461bcd60e51b815260206004820152600c60248201526b105b1c9958591e481a5b9a5d60a21b604482015290519081900360640190fd5b60016000818152918101602052604090912080546001600160a01b0319169091179055565b600054610100900460ff16806111d957506111d9610ddd565b806111e7575060005460ff16155b6112225760405162461bcd60e51b815260040180806020018281038252602e815260200180611373602e913960400191505060405180910390fd5b600054610100900460ff1615801561124d576000805460ff1961ff0019909116610100171660011790555b6000611257610c2d565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350801561075d576000805461ff001916905550565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106112fa57805160ff1916838001178555611327565b82800160010185558215611327579182015b8281111561132757825182559160200191906001019061130c565b50611333929150611337565b5090565b5b80821115611333576000815560010161133856fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a65644f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220dcfd0a670b07b587c3dd425cd2e3d59793e6a58493b2b97fde9fe4d9cb6f4cf164736f6c634300060c0033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063a39fac12116100a2578063be9a655511610071578063be9a6555146103b8578063c4d66de8146103c0578063ebb689a1146103e6578063efbe1c1c146103ee578063f2fde38b146103f65761010b565b8063a39fac12146102d0578063ab73e31614610328578063b22109571461034e578063b6fac15a1461038a5761010b565b80635dbe47e8116100de5780635dbe47e81461027657806362a5af3b1461029c578063715018a6146102a45780638da5cb5b146102ac5761010b565b806301ffc9a7146101105780633628731c1461014b5780634d7f3db0146101bd578063506cd107146101f9575b600080fd5b6101376004803603602081101561012657600080fd5b50356001600160e01b03191661041c565b604080519115158252519081900360200190f35b6101bb6004803603602081101561016157600080fd5b81019060208101813564010000000081111561017c57600080fd5b82018360208201111561018e57600080fd5b803590602001918460208302840111640100000000831117156101b057600080fd5b509092509050610456565b005b6101bb600480360360808110156101d357600080fd5b506001600160a01b03813581169160208101359160408201358116916060013516610550565b610201610623565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561023b578181015183820152602001610223565b50505050905090810190601f1680156102685780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101376004803603602081101561028c57600080fd5b50356001600160a01b03166106b1565b6101bb6106be565b6101bb610760565b6102b461080c565b604080516001600160a01b039092168252519081900360200190f35b6102d861081b565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103145781810151838201526020016102fc565b505050509050019250505060405180910390f35b6102b46004803603602081101561033e57600080fd5b50356001600160a01b031661082c565b6101bb6004803603608081101561036457600080fd5b506001600160a01b03813581169160208101358216916040820135916060013516610839565b6101bb600480360360408110156103a057600080fd5b506001600160a01b0381358116916020013516610904565b6102b46109aa565b6101bb600480360360208110156103d657600080fd5b50356001600160a01b03166109b6565b6101bb610a87565b6102b4610b1e565b6101bb6004803603602081101561040c57600080fd5b50356001600160a01b0316610b2a565b60006001600160e01b031982166301ffc9a760e01b148061045057506001600160e01b03198216600162a1cb1960e01b0319145b92915050565b61045e610c2d565b6001600160a01b031661046f61080c565b6001600160a01b0316146104b8576040805162461bcd60e51b815260206004820181905260248201526000805160206113a1833981519152604482015290519081900360640190fd5b60005b8181101561054b576104f28383838181106104d257fe5b905060200201356001600160a01b03166065610c3190919063ffffffff16565b8282828181106104fe57fe5b905060200201356001600160a01b03166001600160a01b03167fa226db3f664042183ee0281230bba26cbf7b5057e50aee7f25a175ff45ce4d7f60405160405180910390a26001016104bb565b505050565b600061055c6065610d45565b9050600061056a6065610d62565b90505b806001600160a01b0316826001600160a01b03161461061b57604080516304d7f3db60e41b81526001600160a01b0388811660048301526024820188905286811660448301528581166064830152915191841691634d7f3db09160848082019260009290919082900301818387803b1580156105e857600080fd5b505af11580156105fc573d6000803e3d6000fd5b50505050610614826065610d6890919063ffffffff16565b915061056d565b505050505050565b6067805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106a95780601f1061067e576101008083540402835291602001916106a9565b820191906000526020600020905b81548152906001019060200180831161068c57829003601f168201915b505050505081565b6000610450606583610d8b565b600054610100900460ff16806106d757506106d7610ddd565b806106e5575060005460ff16155b6107205760405162461bcd60e51b815260040180806020018281038252602e815260200180611373602e913960400191505060405180910390fd5b600054610100900460ff1615801561074b576000805460ff1961ff0019909116610100171660011790555b801561075d576000805461ff00191690555b50565b610768610c2d565b6001600160a01b031661077961080c565b6001600160a01b0316146107c2576040805162461bcd60e51b815260206004820181905260248201526000805160206113a1833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b6033546001600160a01b031690565b60606108276065610dee565b905090565b6000610450606583610d68565b60006108456065610d45565b905060006108536065610d62565b90505b806001600160a01b0316826001600160a01b03161461061b576040805163b221095760e01b81526001600160a01b038881166004830152878116602483015260448201879052858116606483015291519184169163b22109579160848082019260009290919082900301818387803b1580156108d157600080fd5b505af11580156108e5573d6000803e3d6000fd5b505050506108fd826065610d6890919063ffffffff16565b9150610856565b61090c610c2d565b6001600160a01b031661091d61080c565b6001600160a01b031614610966576040805162461bcd60e51b815260206004820181905260248201526000805160206113a1833981519152604482015290519081900360640190fd5b61097260658383610ece565b6040516001600160a01b038216907f24a12366c02e13fe4a9e03d86a8952e85bb74a456c16e4a18b6d8295700b74bb90600090a25050565b60006108276065610d45565b600054610100900460ff16806109cf57506109cf610ddd565b806109dd575060005460ff16155b610a185760405162461bcd60e51b815260040180806020018281038252602e815260200180611373602e913960400191505060405180910390fd5b600054610100900460ff16158015610a43576000805460ff1961ff0019909116610100171660011790555b610a716040518060400160405280600c81526020016b546f6b656e4661756365747360a01b81525083610fea565b8015610a83576000805461ff00191690555b5050565b610a8f610c2d565b6001600160a01b0316610aa061080c565b6001600160a01b031614610ae9576040805162461bcd60e51b815260206004820181905260248201526000805160206113a1833981519152604482015290519081900360640190fd5b610af36065611019565b6040517fd2246837fc932fb127be794938f83245f3a8fc7fa8be0abfcddde9b07875d02090600090a1565b60006108276065610d62565b610b32610c2d565b6001600160a01b0316610b4361080c565b6001600160a01b031614610b8c576040805162461bcd60e51b815260206004820181905260248201526000805160206113a1833981519152604482015290519081900360640190fd5b6001600160a01b038116610bd15760405162461bcd60e51b815260040180806020018281038252602681526020018061134d6026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6001600160a01b038116600114801590610c5357506001600160a01b03811615155b610c96576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b6001600160a01b0381811660009081526001840160205260409020541615610cf5576040805162461bcd60e51b815260206004820152600d60248201526c105b1c9958591e481859191959609a1b604482015290519081900360640190fd5b60016000818152838201602052604080822080546001600160a01b039586168085529284208054969091166001600160a01b03199687161790559183905281549093169092179091558154019055565b60016000818152910160205260409020546001600160a01b031690565b50600190565b6001600160a01b0380821660009081526001840160205260409020541692915050565b60006001600160a01b038216600114801590610daf57506001600160a01b03821615155b8015610dd657506001600160a01b0382811660009081526001850160205260409020541615155b9392505050565b6000610de8306110b5565b15905090565b606080826000015467ffffffffffffffff81118015610e0c57600080fd5b50604051908082528060200260200182016040528015610e36578160200160208202803683370190505b50600160008181529085016020526040812054919250906001600160a01b03165b6001600160a01b03811615801590610e7957506001600160a01b038116600114155b15610ec55780838381518110610e8b57fe5b6001600160a01b03928316602091820292909201810191909152918116600090815260018088019093526040902054929091019116610e57565b50909392505050565b6001600160a01b038116600114801590610ef057506001600160a01b03811615155b610f33576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b6001600160a01b038281166000908152600185016020526040902054811690821614610f9c576040805162461bcd60e51b8152602060048201526013602482015272496e76616c696420707265764164647265737360681b604482015290519081900360640190fd5b6001600160a01b039081166000818152600185016020526040808220805495851683529082208054959094166001600160a01b03199586161790935552805490911690558054600019019055565b610ff26110bb565b610ffb81610b2a565b815161100e9060679060208501906112b9565b50610a836065611158565b6001600081815290820160205260409020546001600160a01b03165b6001600160a01b0381161580159061105757506001600160a01b038116600114155b1561108d576001600160a01b039081166000908152600183016020526040902080546001600160a01b0319811690915516611035565b50600160008181528282016020526040812080546001600160a01b0319169092179091559055565b3b151590565b600054610100900460ff16806110d457506110d4610ddd565b806110e2575060005460ff16155b61111d5760405162461bcd60e51b815260040180806020018281038252602e815260200180611373602e913960400191505060405180910390fd5b600054610100900460ff16158015611148576000805460ff1961ff0019909116610100171660011790555b6111506106be565b61074b6111c0565b80541561119b576040805162461bcd60e51b815260206004820152600c60248201526b105b1c9958591e481a5b9a5d60a21b604482015290519081900360640190fd5b60016000818152918101602052604090912080546001600160a01b0319169091179055565b600054610100900460ff16806111d957506111d9610ddd565b806111e7575060005460ff16155b6112225760405162461bcd60e51b815260040180806020018281038252602e815260200180611373602e913960400191505060405180910390fd5b600054610100900460ff1615801561124d576000805460ff1961ff0019909116610100171660011790555b6000611257610c2d565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350801561075d576000805461ff001916905550565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106112fa57805160ff1916838001178555611327565b82800160010185558215611327579182015b8281111561132757825182559160200191906001019061130c565b50611333929150611337565b5090565b5b80821115611333576000815560010161133856fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a65644f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220dcfd0a670b07b587c3dd425cd2e3d59793e6a58493b2b97fde9fe4d9cb6f4cf164736f6c634300060c0033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.