ERC-20
DeFi
Overview
Max Total Supply
57.894411503922073995 PDI
Holders
118 (0.00%)
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
0.176788606791407654 PDIValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
ManagedIndex
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.13; import "./interfaces/IManagedIndex.sol"; import "./interfaces/IManagedIndexFactory.sol"; import "./interfaces/IManagedIndexReweightingLogic.sol"; import "./BaseIndex.sol"; /// @title Managed index /// @notice Contains initialization and reweighting logic contract ManagedIndex is IManagedIndex, BaseIndex { using EnumerableSet for EnumerableSet.AddressSet; /// @notice Role for index reweighting bytes32 internal immutable REWEIGH_INDEX_ROLE; constructor() BaseIndex(msg.sender) { REWEIGH_INDEX_ROLE = keccak256(abi.encodePacked("REWEIGHT_PERMISSION", address(this))); } /// @notice Index initialization with assets and their weights /// @param _assets Assets list for the index /// @param _weights List of assets corresponding weights /// @dev Method is called by factory contract only function initialize(address[] calldata _assets, uint8[] calldata _weights) external { require(msg.sender == factory, "ManagedIndex: FORBIDDEN"); uint assetsCount = _assets.length; for (uint i; i < assetsCount; ) { address asset = _assets[i]; uint8 weight = _weights[i]; weightOf[asset] = weight; assets.add(asset); emit UpdateAnatomy(asset, weight); unchecked { i = i + 1; } } } /// @inheritdoc IManagedIndex /// @dev Assets total weight should be equal to 255 function reweight(address[] calldata _updatedAssets, uint8[] calldata _updatedWeights) external override { require( IAccessControl(registry).hasRole(INDEX_MANAGER_ROLE, msg.sender) || IAccessControl(registry).hasRole(REWEIGH_INDEX_ROLE, msg.sender), "ManagedIndex: FORBIDDEN" ); (bool success, bytes memory data) = IManagedIndexFactory(factory).reweightingLogic().delegatecall( abi.encodeWithSelector(IManagedIndexReweightingLogic.reweight.selector, _updatedAssets, _updatedWeights) ); if (!success) { if (data.length == 0) { revert("ManagedIndex: REWEIGH_FAILED"); } else { assembly { revert(add(32, data), mload(data)) } } } } /// @inheritdoc ERC165 function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) { return _interfaceId == type(IManagedIndex).interfaceId || super.supportsInterface(_interfaceId); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; import "./IIndex.sol"; /// @title Managed index interface /// @notice Interface for dynamic indexes that could be updated with new anatomy data interface IManagedIndex is IIndex { /// @notice Updates index anatomy with corresponding weights and assets /// @param _assets List for new asset(s) for the index /// @param _weights List of new asset(s) corresponding weights function reweight(address[] calldata _assets, uint8[] calldata _weights) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; import "./IIndexFactory.sol"; /// @title Managed index factory interface /// @notice Provides method for index creation interface IManagedIndexFactory is IIndexFactory { event ManagedIndexCreated(address index, address[] _assets, uint8[] _weights); /// @notice Create managed index with assets and their weights /// @param _assets Assets list for the index /// @param _weights List of assets corresponding weights. Assets total weight should be equal to 255 /// @param _nameDetails Name details data (name and symbol) to use for the created index function createIndex( address[] calldata _assets, uint8[] calldata _weights, NameDetails calldata _nameDetails ) external returns (address index); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; import "./IAnatomyUpdater.sol"; /// @title ManagedIndex reweighing logic interface /// @notice Contains reweighing logic interface IManagedIndexReweightingLogic is IAnatomyUpdater { /// @notice Updates index anatomy with corresponding weights and assets /// @param _assets List for new asset(s) for the index /// @param _weights List of new asset(s) corresponding weights function reweight(address[] calldata _assets, uint8[] calldata _weights) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.13; import "@openzeppelin/contracts/access/IAccessControl.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import "./libraries/IndexLibrary.sol"; import "./interfaces/IIndex.sol"; import "./interfaces/IIndexLogic.sol"; import "./interfaces/IIndexFactory.sol"; import "./PhutureIndex.sol"; /// @title Base index /// @notice Contains common logic for all indices abstract contract BaseIndex is PhutureIndex, ReentrancyGuard, IIndex { using ERC165Checker for address; using EnumerableSet for EnumerableSet.AddressSet; /// @notice Role allows configure index related data/components bytes32 internal immutable INDEX_MANAGER_ROLE; /// @notice Checks if msg.sender has the given role's permission modifier onlyRole(bytes32 role) { require(IAccessControl(registry).hasRole(role, msg.sender), "Index: FORBIDDEN"); _; } constructor(address _factory) { require(_factory.supportsInterface(type(IIndexFactory).interfaceId), "Index: INTERFACE"); INDEX_MANAGER_ROLE = keccak256("INDEX_MANAGER_ROLE"); factory = _factory; lastTransferTime = uint96(block.timestamp); registry = IIndexFactory(_factory).registry(); vTokenFactory = IIndexFactory(_factory).vTokenFactory(); } /// @inheritdoc IIndex function mint(address _recipient) external override nonReentrant { (bool success, bytes memory data) = IIndexRegistry(registry).indexLogic().delegatecall( abi.encodeWithSelector(IIndexLogic.mint.selector, _recipient) ); if (!success) { if (data.length == 0) { revert("Index: MINT_FAILED"); } else { assembly { revert(add(32, data), mload(data)) } } } } /// @inheritdoc IIndex function burn(address _recipient) external override nonReentrant { (bool success, bytes memory data) = IIndexRegistry(registry).indexLogic().delegatecall( abi.encodeWithSelector(IIndexLogic.burn.selector, _recipient) ); if (!success) { if (data.length == 0) { revert("Index: BURN_FAILED"); } else { assembly { revert(add(32, data), mload(data)) } } } } /// @inheritdoc IIndex function anatomy() external view override returns (address[] memory _assets, uint8[] memory _weights) { _assets = assets.values(); uint assetsCount = _assets.length; _weights = new uint8[](assetsCount); for (uint i; i < assetsCount; ) { _weights[i] = weightOf[_assets[i]]; unchecked { i = i + 1; } } } /// @inheritdoc IIndex function inactiveAnatomy() external view override returns (address[] memory) { return inactiveAssets.values(); } /// @inheritdoc ERC165 function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) { return _interfaceId == type(IIndex).interfaceId || super.supportsInterface(_interfaceId); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; import "./IIndexLayout.sol"; import "./IAnatomyUpdater.sol"; /// @title Index interface /// @notice Interface containing basic logic for indexes: mint, burn, anatomy info interface IIndex is IIndexLayout, IAnatomyUpdater { /// @notice Index minting /// @param _recipient Recipient address function mint(address _recipient) external; /// @notice Index burning /// @param _recipient Recipient address function burn(address _recipient) external; /// @notice Returns index assets weights information /// @return _assets Assets list /// @return _weights List of assets corresponding weights function anatomy() external view returns (address[] memory _assets, uint8[] memory _weights); /// @notice Returns inactive assets /// @return Assets list function inactiveAnatomy() external view returns (address[] memory); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; /// @title Index layout interface /// @notice Contains storage layout of index interface IIndexLayout { /// @notice Index factory address /// @return Returns index factory address function factory() external view returns (address); /// @notice vTokenFactory address /// @return Returns vTokenFactory address function vTokenFactory() external view returns (address); /// @notice Registry address /// @return Returns registry address function registry() external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; /// @title Anatomy Updater interface /// @notice Contains event for aatomy update interface IAnatomyUpdater { event UpdateAnatomy(address asset, uint8 weight); event AssetRemoved(address asset); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; /// @title Index factory interface /// @notice Contains logic for initial fee management for indexes which will be created by this factory interface IIndexFactory { struct NameDetails { string name; string symbol; } event SetVTokenFactory(address vTokenFactory); event SetDefaultMintingFeeInBP(address indexed account, uint16 mintingFeeInBP); event SetDefaultBurningFeeInBP(address indexed account, uint16 burningFeeInBP); event SetDefaultAUMScaledPerSecondsRate(address indexed account, uint AUMScaledPerSecondsRate); /// @notice Sets default index minting fee in base point (BP) format /// @dev Will be set in FeePool on index creation /// @param _mintingFeeInBP New minting fee value function setDefaultMintingFeeInBP(uint16 _mintingFeeInBP) external; /// @notice Sets default index burning fee in base point (BP) format /// @dev Will be set in FeePool on index creation /// @param _burningFeeInBP New burning fee value function setDefaultBurningFeeInBP(uint16 _burningFeeInBP) external; /// @notice Sets reweighting logic address /// @param _reweightingLogic Reweighting logic address function setReweightingLogic(address _reweightingLogic) external; /// @notice Sets default AUM scaled per seconds rate that will be used for fee calculation /** @dev Will be set in FeePool on index creation. Effective management fee rate (annual, in percent, after dilution) is calculated by the given formula: fee = (rpow(scaledPerSecondRate, numberOfSeconds, 10*27) - 10**27) * totalSupply / 10**27, where: totalSupply - total index supply; numberOfSeconds - delta time for calculation period; scaledPerSecondRate - scaled rate, calculated off chain by the given formula: scaledPerSecondRate = ((1 + k) ** (1 / 365 days)) * AUMCalculationLibrary.RATE_SCALE_BASE, where: k = (aumFeeInBP / BP) / (1 - aumFeeInBP / BP); Note: rpow and RATE_SCALE_BASE are provided by AUMCalculationLibrary More info: https://docs.enzyme.finance/fee-formulas/management-fee After value calculated off chain, scaledPerSecondRate is set to setDefaultAUMScaledPerSecondsRate */ /// @param _AUMScaledPerSecondsRate New AUM scaled per seconds rate function setDefaultAUMScaledPerSecondsRate(uint _AUMScaledPerSecondsRate) external; /// @notice Withdraw fee balance to fee pool for a given index /// @param _index Index to withdraw fee balance from function withdrawToFeePool(address _index) external; /// @notice Index registry address /// @return Returns index registry address function registry() external view returns (address); /// @notice vTokenFactory address /// @return Returns vTokenFactory address function vTokenFactory() external view returns (address); /// @notice Minting fee in base point (BP) format /// @return Returns minting fee in base point (BP) format function defaultMintingFeeInBP() external view returns (uint16); /// @notice Burning fee in base point (BP) format /// @return Returns burning fee in base point (BP) format function defaultBurningFeeInBP() external view returns (uint16); /// @notice AUM scaled per seconds rate /// See setDefaultAUMScaledPerSecondsRate method description for more details. /// @return Returns AUM scaled per seconds rate function defaultAUMScaledPerSecondsRate() external view returns (uint); /// @notice Reweighting logic address /// @return Returns reweighting logic address function reweightingLogic() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Checker.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Library used to query support of an interface declared via {IERC165}. * * Note that these functions return the actual result of the query: they do not * `revert` if an interface is not supported. It is up to the caller to decide * what to do in these cases. */ library ERC165Checker { // As per the EIP-165 spec, no interface should ever match 0xffffffff bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; /** * @dev Returns true if `account` supports the {IERC165} interface, */ function supportsERC165(address account) internal view returns (bool) { // Any contract that implements ERC165 must explicitly indicate support of // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid return _supportsERC165Interface(account, type(IERC165).interfaceId) && !_supportsERC165Interface(account, _INTERFACE_ID_INVALID); } /** * @dev Returns true if `account` supports the interface defined by * `interfaceId`. Support for {IERC165} itself is queried automatically. * * See {IERC165-supportsInterface}. */ function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) { // query support of both ERC165 as per the spec and support of _interfaceId return supportsERC165(account) && _supportsERC165Interface(account, interfaceId); } /** * @dev Returns a boolean array where each value corresponds to the * interfaces passed in and whether they're supported or not. This allows * you to batch check interfaces for a contract where your expectation * is that some interfaces may not be supported. * * See {IERC165-supportsInterface}. * * _Available since v3.4._ */ function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) { // an array of booleans corresponding to interfaceIds and whether they're supported or not bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length); // query support of ERC165 itself if (supportsERC165(account)) { // query support of each interface in interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]); } } return interfaceIdsSupported; } /** * @dev Returns true if `account` supports all the interfaces defined in * `interfaceIds`. Support for {IERC165} itself is queried automatically. * * Batch-querying can lead to gas savings by skipping repeated checks for * {IERC165} support. * * See {IERC165-supportsInterface}. */ function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) { // query support of ERC165 itself if (!supportsERC165(account)) { return false; } // query support of each interface in _interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { if (!_supportsERC165Interface(account, interfaceIds[i])) { return false; } } // all interfaces supported return true; } /** * @notice Query if a contract implements an interface, does not check ERC165 support * @param account The address of the contract to query for support of an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @return true if the contract at account indicates support of the interface with * identifier interfaceId, false otherwise * @dev Assumes that account contains a contract that supports ERC165, otherwise * the behavior of this method is undefined. This precondition can be checked * with {supportsERC165}. * Interface identification is specified in ERC-165. */ function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId); (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams); if (result.length < 32) return false; return success && abi.decode(result, (bool)); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.13; import "./FullMath.sol"; import "./FixedPoint112.sol"; /// @title Index library /// @notice Provides various utilities for indexes library IndexLibrary { using FullMath for uint; /// @notice Initial index quantity to mint uint constant INITIAL_QUANTITY = 10000; /// @notice Total assets weight within an index uint8 constant MAX_WEIGHT = type(uint8).max; /// @notice Returns amount of asset equivalent to the given parameters /// @param _assetPerBaseInUQ Asset per base price in UQ /// @param _weight Weight of the given asset /// @param _amountInBase Total assets amount in base /// @return Amount of asset function amountInAsset( uint _assetPerBaseInUQ, uint8 _weight, uint _amountInBase ) internal pure returns (uint) { require(_assetPerBaseInUQ != 0, "IndexLibrary: ORACLE"); return ((_amountInBase * _weight) / MAX_WEIGHT).mulDiv(_assetPerBaseInUQ, FixedPoint112.Q112); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; /// @title Index logic interface /// @notice Contains mint and burn logic interface IIndexLogic { /// @notice Index minting /// @param _recipient Recipient address function mint(address _recipient) external; /// @notice Index burning /// @param _recipient Recipient address function burn(address _recipient) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.13; import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "./libraries/AUMCalculationLibrary.sol"; import "./interfaces/IFeePool.sol"; import "./interfaces/INameRegistry.sol"; import "./interfaces/IIndexRegistry.sol"; import "./IndexLayout.sol"; /// @title Phuture index /// @notice Contains AUM fee's logic, overrides name and symbol abstract contract PhutureIndex is IndexLayout, ERC20Permit, ERC165 { constructor() ERC20Permit("PhutureIndex") ERC20("", "") {} /// @notice Index symbol /// @return Returns index symbol function symbol() public view override returns (string memory) { return INameRegistry(registry).symbolOfIndex(address(this)); } /// @notice Index name /// @return Returns index name function name() public view override returns (string memory) { return INameRegistry(registry).nameOfIndex(address(this)); } /// @inheritdoc ERC165 function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) { return _interfaceId == type(IIndexLayout).interfaceId || _interfaceId == type(IERC20Permit).interfaceId || _interfaceId == type(IERC20).interfaceId || super.supportsInterface(_interfaceId); } /// @dev Overrides _transfer to include AUM fee logic function _transfer( address _from, address _to, uint _value ) internal override { _chargeAUMFee(IIndexRegistry(registry).feePool()); super._transfer(_from, _to, _value); } /// @notice Calculates and mints AUM fee /// @param _feePool Fee pool address function _chargeAUMFee(address _feePool) internal { uint timePassed = uint96(block.timestamp) - lastTransferTime; if (timePassed != 0) { address _factory = factory; uint fee = ((totalSupply() - balanceOf(_factory)) * (AUMCalculationLibrary.rpow( IFeePool(_feePool).AUMScaledPerSecondsRateOf(address(this)), timePassed, AUMCalculationLibrary.RATE_SCALE_BASE ) - AUMCalculationLibrary.RATE_SCALE_BASE)) / AUMCalculationLibrary.RATE_SCALE_BASE; if (fee != 0) { super._mint(_factory, fee); lastTransferTime = uint96(block.timestamp); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^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 IERC165 { /** * @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.8.13; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = (~denominator + 1) & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; // Invert denominator mod 2**256 // Now that denominator is an odd number, it has an inverse // modulo 2**256 such that denominator * inv = 1 mod 2**256. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, denominator * inv = 1 mod 2**4 uint256 inv = (3 * denominator) ^ 2; // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 // Because the division is now exact we can divide by multiplying // with the modular inverse of denominator. This will give us the // correct result modulo 2**256. Since the precoditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.13; /// @title FixedPoint112 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) library FixedPoint112 { uint8 internal constant RESOLUTION = 112; /// @dev 2**112 uint256 internal constant Q112 = 0x10000000000000000000000000000; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; import "./draft-IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/draft-EIP712.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.13; /// @title AUM fee calculation library /// @notice More details https://github.com/enzymefinance/protocol/blob/b671b3dfea92596dd2e962c73b233dcdb22bf753/contracts/release/utils/MakerDaoMath.sol /// @dev Taken from https://github.com/enzymefinance/protocol library AUMCalculationLibrary { /// @dev A constant used for AUM fee calculation to prevent underflow uint constant RATE_SCALE_BASE = 1e27; /// @notice Power function for AUM fee calculation /// @param _x Base number /// @param _n Exponent number /// @param _base Base number multiplier /// @return z_ Returns value of `_x` raised to power of `_n` function rpow( uint _x, uint _n, uint _base ) internal pure returns (uint z_) { assembly { switch _x case 0 { switch _n case 0 { z_ := _base } default { z_ := 0 } } default { switch mod(_n, 2) case 0 { z_ := _base } default { z_ := _x } let half := div(_base, 2) for { _n := div(_n, 2) } _n { _n := div(_n, 2) } { let xx := mul(_x, _x) if iszero(eq(div(xx, _x), _x)) { revert(0, 0) } let xxRound := add(xx, half) if lt(xxRound, xx) { revert(0, 0) } _x := div(xxRound, _base) if mod(_n, 2) { let zx := mul(z_, _x) if and(iszero(iszero(_x)), iszero(eq(div(zx, _x), z_))) { revert(0, 0) } let zxRound := add(zx, half) if lt(zxRound, zx) { revert(0, 0) } z_ := div(zxRound, _base) } } } } return z_; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; /// @title Fee pool interface /// @notice Provides methods for fee management interface IFeePool { struct MintBurnInfo { address recipient; uint share; } event Mint(address indexed index, address indexed recipient, uint share); event Burn(address indexed index, address indexed recipient, uint share); event SetMintingFeeInBP(address indexed account, address indexed index, uint16 mintingFeeInBP); event SetBurningFeeInBP(address indexed account, address indexed index, uint16 burningFeeInPB); event SetAUMScaledPerSecondsRate(address indexed account, address indexed index, uint AUMScaledPerSecondsRate); event Withdraw(address indexed index, address indexed recipient, uint amount); /// @notice Initializes FeePool with the given params /// @param _registry Index registry address function initialize(address _registry) external; /// @notice Initializes index with provided fees and makes initial mint /// @param _index Index to initialize /// @param _mintingFeeInBP Minting fee to initialize with /// @param _burningFeeInBP Burning fee to initialize with /// @param _AUMScaledPerSecondsRate Aum scaled per second rate to initialize with /// @param _mintInfo Mint info object array containing mint recipient and amount for initial mint function initializeIndex( address _index, uint16 _mintingFeeInBP, uint16 _burningFeeInBP, uint _AUMScaledPerSecondsRate, MintBurnInfo[] calldata _mintInfo ) external; /// @notice Mints fee pool shares to the given recipient in specified amount /// @param _index Index to mint fee pool's shares for /// @param _mintInfo Mint info object containing mint recipient and amount function mint(address _index, MintBurnInfo calldata _mintInfo) external; /// @notice Burns fee pool shares to the given recipient in specified amount /// @param _index Index to burn fee pool's shares for /// @param _burnInfo Burn info object containing burn recipient and amount function burn(address _index, MintBurnInfo calldata _burnInfo) external; /// @notice Mints fee pool shares to the given recipients in specified amounts /// @param _index Index to mint fee pool's shares for /// @param _mintInfo Mint info object array containing mint recipients and amounts function mintMultiple(address _index, MintBurnInfo[] calldata _mintInfo) external; /// @notice Burns fee pool shares to the given recipients in specified amounts /// @param _index Index to burn fee pool's shares for /// @param _burnInfo Burn info object array containing burn recipients and amounts function burnMultiple(address _index, MintBurnInfo[] calldata _burnInfo) external; /// @notice Sets index minting fee in base point format /// @param _index Index to set minting fee for /// @param _mintingFeeInBP New minting fee value function setMintingFeeInBP(address _index, uint16 _mintingFeeInBP) external; /// @notice Sets index burning fee in base point format /// @param _index Index to set burning fee for /// @param _burningFeeInBP New burning fee value function setBurningFeeInBP(address _index, uint16 _burningFeeInBP) external; /// @notice Sets AUM scaled per seconds rate that will be used for fee calculation /// @param _index Index to set AUM scaled per seconds rate for /// @param _AUMScaledPerSecondsRate New AUM scaled per seconds rate function setAUMScaledPerSecondsRate(address _index, uint _AUMScaledPerSecondsRate) external; /// @notice Withdraws sender fees from the given index /// @param _index Index to withdraw fees from function withdraw(address _index) external; /// @notice Withdraws platform fees from the given index to specified address /// @param _index Index to withdraw fees from /// @param _recipient Recipient to send fees to function withdrawPlatformFeeOf(address _index, address _recipient) external; /// @notice Total shares in the given index /// @return Returns total shares in the given index function totalSharesOf(address _index) external view returns (uint); /// @notice Shares of specified recipient in the given index /// @return Returns shares of specified recipient in the given index function shareOf(address _index, address _account) external view returns (uint); /// @notice Minting fee in base point format /// @return Returns minting fee in base point (BP) format function mintingFeeInBPOf(address _index) external view returns (uint16); /// @notice Burning fee in base point format /// @return Returns burning fee in base point (BP) format function burningFeeInBPOf(address _index) external view returns (uint16); /// @notice AUM scaled per seconds rate /// @return Returns AUM scaled per seconds rate function AUMScaledPerSecondsRateOf(address _index) external view returns (uint); /// @notice Returns withdrawable amount for specified account from given index /// @param _index Index to check withdrawable amount /// @param _account Recipient to check withdrawable amount for function withdrawableAmountOf(address _index, address _account) external view returns (uint); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; /// @title Name registry interface /// @notice Providing information about index names and symbols interface INameRegistry { event SetName(address index, string name); event SetSymbol(address index, string name); /// @notice Sets name of the given index /// @param _index Index address /// @param _name New index name function setIndexName(address _index, string calldata _name) external; /// @notice Sets symbol for the given index /// @param _index Index address /// @param _symbol New index symbol function setIndexSymbol(address _index, string calldata _symbol) external; /// @notice Returns index address by name /// @param _name Index name to look for /// @return Index address function indexOfName(string calldata _name) external view returns (address); /// @notice Returns index address by symbol /// @param _symbol Index symbol to look for /// @return Index address function indexOfSymbol(string calldata _symbol) external view returns (address); /// @notice Returns name of the given index /// @param _index Index address /// @return Index name function nameOfIndex(address _index) external view returns (string memory); /// @notice Returns symbol of the given index /// @param _index Index address /// @return Index symbol function symbolOfIndex(address _index) external view returns (string memory); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.13; import "./IIndexFactory.sol"; /// @title Index registry interface /// @notice Contains core components, addresses and asset market capitalizations interface IIndexRegistry { event SetIndexLogic(address indexed account, address indexLogic); event SetMaxComponents(address indexed account, uint maxComponents); event UpdateAsset(address indexed asset, uint marketCap); event SetOrderer(address indexed account, address orderer); event SetFeePool(address indexed account, address feePool); event SetPriceOracle(address indexed account, address priceOracle); /// @notice Initializes IndexRegistry with the given params /// @param _indexLogic Index logic address /// @param _maxComponents Maximum assets for an index function initialize(address _indexLogic, uint _maxComponents) external; /// @notice Sets maximum assets for an index /// @param _maxComponents Maximum assets for an index function setMaxComponents(uint _maxComponents) external; /// @notice Index logic address /// @return Returns index logic address function indexLogic() external returns (address); /// @notice Sets index logic address /// @param _indexLogic Index logic address function setIndexLogic(address _indexLogic) external; /// @notice Sets adminRole as role's admin role. /// @param _role Role /// @param _adminRole AdminRole of given role function setRoleAdmin(bytes32 _role, bytes32 _adminRole) external; /// @notice Registers new index /// @param _index Index address /// @param _nameDetails Name details (name and symbol) for provided index function registerIndex(address _index, IIndexFactory.NameDetails calldata _nameDetails) external; /// @notice Registers asset in the system, updates it's market capitalization and assigns required roles /// @param _asset Asset to register /// @param _marketCap It's current market capitalization function addAsset(address _asset, uint _marketCap) external; /// @notice Removes assets from the system /// @param _asset Asset to remove function removeAsset(address _asset) external; /// @notice Updates market capitalization for the given asset /// @param _asset Asset address to update market capitalization for /// @param _marketCap Market capitalization value function updateAssetMarketCap(address _asset, uint _marketCap) external; /// @notice Sets price oracle address /// @param _priceOracle Price oracle address function setPriceOracle(address _priceOracle) external; /// @notice Sets orderer address /// @param _orderer Orderer address function setOrderer(address _orderer) external; /// @notice Sets fee pool address /// @param _feePool Fee pool address function setFeePool(address _feePool) external; /// @notice Maximum assets for an index /// @return Returns maximum assets for an index function maxComponents() external view returns (uint); /// @notice Market capitalization of provided asset /// @return _asset Returns market capitalization of provided asset function marketCapOf(address _asset) external view returns (uint); /// @notice Returns total market capitalization of the given assets /// @param _assets Assets array to calculate market capitalization of /// @return _marketCaps Corresponding capitalizations of the given asset /// @return _totalMarketCap Total market capitalization of the given assets function marketCapsOf(address[] calldata _assets) external view returns (uint[] memory _marketCaps, uint _totalMarketCap); /// @notice Total market capitalization of all registered assets /// @return Returns total market capitalization of all registered assets function totalMarketCap() external view returns (uint); /// @notice Price oracle address /// @return Returns price oracle address function priceOracle() external view returns (address); /// @notice Orderer address /// @return Returns orderer address function orderer() external view returns (address); /// @notice Fee pool address /// @return Returns fee pool address function feePool() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.13; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "./interfaces/IIndexLayout.sol"; /// @title Index layout /// @notice Contains storage layout of index abstract contract IndexLayout is IIndexLayout { /// @inheritdoc IIndexLayout address public override factory; /// @inheritdoc IIndexLayout address public override vTokenFactory; /// @inheritdoc IIndexLayout address public override registry; /// @notice Timestamp of last AUM fee charge uint96 internal lastTransferTime; /// @notice Set with asset addresses EnumerableSet.AddressSet internal assets; /// @notice Set with previously used asset addresses EnumerableSet.AddressSet internal inactiveAssets; /// @notice Map of assets and their corresponding weights in index mapping(address => uint8) internal weightOf; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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 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 Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"AssetRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint8","name":"weight","type":"uint8"}],"name":"UpdateAnatomy","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"anatomy","outputs":[{"internalType":"address[]","name":"_assets","type":"address[]"},{"internalType":"uint8[]","name":"_weights","type":"uint8[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inactiveAnatomy","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_assets","type":"address[]"},{"internalType":"uint8[]","name":"_weights","type":"uint8[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_updatedAssets","type":"address[]"},{"internalType":"uint8[]","name":"_updatedWeights","type":"uint8[]"}],"name":"reweight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vTokenFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101806040523480156200001257600080fd5b50604080518082018252600c81526b0a0d0eae8eae4ca92dcc8caf60a31b6020808301919091528251808401845260018152603160f81b81830152835180830180865260008083528651948501909652948352805133958594916200007a91600b91620004b9565b5080516200009090600c906020840190620004b9565b5050825160208085019190912083518483012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c0019052805194019390932091935091906080523060c0526101205250506001600f5550620001539150506001600160a01b03821663d47f39ad60e01b62000365602090811b62000f7817901c565b620001975760405162461bcd60e51b815260206004820152601060248201526f496e6465783a20494e5445524641434560801b604482015260640160405180910390fd5b7f1916b456004f332cd8a19679364ef4be668619658be72c17b7e86697c4ae0f1661014052600080546001600160a01b0319166001600160a01b0383811691821790925560028054909216600160a01b426001600160601b0316021790915560408051637b10399960e01b81529051637b103999916004808201926020929091908290030181865afa15801562000232573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200025891906200055f565b600260006101000a8154816001600160a01b0302191690836001600160a01b03160217905550806001600160a01b03166328dd99126040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002bd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002e391906200055f565b600180546001600160a01b0319166001600160a01b0392909216919091179055506040517f52455745494748545f5045524d495353494f4e0000000000000000000000000060208201526001600160601b03193060601b16603382015260470160408051601f198184030181529190528051602090910120610160526200062f565b600062000372836200038f565b8015620003865750620003868383620003c7565b90505b92915050565b6000620003a4826301ffc9a760e01b620003c7565b8015620003895750620003c0826001600160e01b0319620003c7565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b03871690617530906200043090869062000591565b6000604051808303818686fa925050503d80600081146200046e576040519150601f19603f3d011682016040523d82523d6000602084013e62000473565b606091505b509150915060208151101562000490576000935050505062000389565b818015620004af575080806020019051810190620004af9190620005cf565b9695505050505050565b828054620004c790620005f3565b90600052602060002090601f016020900481019282620004eb576000855562000536565b82601f106200050657805160ff191683800117855562000536565b8280016001018555821562000536579182015b828111156200053657825182559160200191906001019062000519565b506200054492915062000548565b5090565b5b8082111562000544576000815560010162000549565b6000602082840312156200057257600080fd5b81516001600160a01b03811681146200058a57600080fd5b9392505050565b6000825160005b81811015620005b4576020818601810151858301520162000598565b81811115620005c4576000828501525b509190910192915050565b600060208284031215620005e257600080fd5b815180151581146200058a57600080fd5b600181811c908216806200060857607f821691505b6020821081036200062957634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e051610100516101205161014051610160516123416200069560003960006104ba0152600061042201526000611279015260006112c8015260006112a3015260006111fc015260006112260152600061125001526123416000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a9059cbb1161007c578063a9059cbb146102e1578063c45a0155146102f4578063d505accf14610307578063dd62ed3e1461031a578063f53af5331461032d578063fe1de1f31461034357600080fd5b806370a08231146102645780637b1039991461028d5780637ecebe00146102a057806389afcb44146102b357806395d89b41146102c6578063a457c2d7146102ce57600080fd5b806328dd99121161011557806328dd9912146101e75780632ee762e514610212578063313ce567146102275780633644e51514610236578063395093511461023e5780636a6278421461025157600080fd5b806301ffc9a71461015d57806306fdde0314610185578063095ea7b31461019a578063116b6168146101ad57806318160ddd146101c257806323b872dd146101d4575b600080fd5b61017061016b366004611d2b565b610356565b60405190151581526020015b60405180910390f35b61018d610381565b60405161017c9190611d81565b6101706101a8366004611dc9565b6103f8565b6101c06101bb366004611e41565b610410565b005b600a545b60405190815260200161017c565b6101706101e2366004611ead565b610704565b6001546101fa906001600160a01b031681565b6040516001600160a01b03909116815260200161017c565b61021a610728565b60405161017c9190611f32565b6040516012815260200161017c565b6101c6610734565b61017061024c366004611dc9565b61073e565b6101c061025f366004611f45565b610760565b6101c6610272366004611f45565b6001600160a01b031660009081526008602052604090205490565b6002546101fa906001600160a01b031681565b6101c66102ae366004611f45565b610924565b6101c06102c1366004611f45565b610942565b61018d610afc565b6101706102dc366004611dc9565b610b2d565b6101706102ef366004611dc9565b610ba8565b6000546101fa906001600160a01b031681565b6101c0610315366004611f78565b610bb6565b6101c6610328366004611fe6565b610d38565b610335610d63565b60405161017c92919061201f565b6101c0610351366004611e41565b610e43565b60006001600160e01b0319821663022d6c2d60e31b148061037b575061037b82610f9b565b92915050565b60025460405163ed3b559f60e01b81523060048201526060916001600160a01b03169063ed3b559f906024015b600060405180830381865afa1580156103cb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103f3919081019061208f565b905090565b600033610406818585610fc0565b5060019392505050565b600254604051632474521560e21b81527f000000000000000000000000000000000000000000000000000000000000000060048201523360248201526001600160a01b03909116906391d1485490604401602060405180830381865afa15801561047e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a2919061213c565b8061053a5750600254604051632474521560e21b81527f000000000000000000000000000000000000000000000000000000000000000060048201523360248201526001600160a01b03909116906391d1485490604401602060405180830381865afa158015610516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053a919061213c565b6105855760405162461bcd60e51b815260206004820152601760248201527626b0b730b3b2b224b73232bc1d102327a92124a22222a760491b60448201526064015b60405180910390fd5b6000805460408051630384935560e51b8152905183926001600160a01b0316916370926aa09160048083019260209291908290030181865afa1580156105cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f3919061215e565b6001600160a01b031663116b616860e01b8787878760405160240161061b949392919061217b565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610659919061220a565b600060405180830381855af49150503d8060008114610694576040519150601f19603f3d011682016040523d82523d6000602084013e610699565b606091505b5091509150816106fc5780516000036106f45760405162461bcd60e51b815260206004820152601c60248201527f4d616e61676564496e6465783a20524557454947485f4641494c454400000000604482015260640161057c565b805181602001fd5b505050505050565b6000336107128582856110e4565b61071d85858561115e565b506001949350505050565b60606103f360056111e2565b60006103f36111ef565b6000336104068185856107518383610d38565b61075b919061223c565b610fc0565b6002600f54036107b25760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057c565b6002600f81905550600080600260009054906101000a90046001600160a01b03166001600160a01b031663b07bdef66040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610812573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610836919061215e565b604080516001600160a01b0386811660248084019190915283518084039091018152604490920183526020820180516001600160e01b03166335313c2160e11b1790529151929091169161088a919061220a565b600060405180830381855af49150503d80600081146108c5576040519150601f19603f3d011682016040523d82523d6000602084013e6108ca565b606091505b50915091508161091a5780516000036106f45760405162461bcd60e51b8152602060048201526012602482015271125b99195e0e881352539517d1905253115160721b604482015260640161057c565b50506001600f5550565b6001600160a01b0381166000908152600d602052604081205461037b565b6002600f54036109945760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057c565b6002600f81905550600080600260009054906101000a90046001600160a01b03166001600160a01b031663b07bdef66040518163ffffffff1660e01b81526004016020604051808303816000875af11580156109f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a18919061215e565b604080516001600160a01b0386811660248084019190915283518084039091018152604490920183526020820180516001600160e01b031663226bf2d160e21b17905291519290911691610a6c919061220a565b600060405180830381855af49150503d8060008114610aa7576040519150601f19603f3d011682016040523d82523d6000602084013e610aac565b606091505b50915091508161091a5780516000036106f45760405162461bcd60e51b8152602060048201526012602482015271125b99195e0e881095549397d1905253115160721b604482015260640161057c565b60025460405163554f94ab60e01b81523060048201526060916001600160a01b03169063554f94ab906024016103ae565b60003381610b3b8286610d38565b905083811015610b9b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161057c565b61071d8286868403610fc0565b60003361040681858561115e565b83421115610c065760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161057c565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888610c538c6001600160a01b03166000908152600d6020526040902080546001810190915590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610cae82611316565b90506000610cbe82878787611364565b9050896001600160a01b0316816001600160a01b031614610d215760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161057c565b610d2c8a8a8a610fc0565b50505050505050505050565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b606080610d7060036111e2565b80519092508067ffffffffffffffff811115610d8e57610d8e612079565b604051908082528060200260200182016040528015610db7578160200160208202803683370190505b50915060005b81811015610e3d5760076000858381518110610ddb57610ddb612254565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a900460ff16838281518110610e2357610e23612254565b60ff90921660209283029190910190910152600101610dbd565b50509091565b6000546001600160a01b03163314610e975760405162461bcd60e51b815260206004820152601760248201527626b0b730b3b2b224b73232bc1d102327a92124a22222a760491b604482015260640161057c565b8260005b818110156106fc576000868683818110610eb757610eb7612254565b9050602002016020810190610ecc9190611f45565b90506000858584818110610ee257610ee2612254565b9050602002016020810190610ef7919061226a565b6001600160a01b0383166000908152600760205260409020805460ff191660ff83161790559050610f2960038361138c565b50604080516001600160a01b038416815260ff831660208201527f570021dbfc0c0d1b83293d5c8ce73e7cef80870624da237d3e4bc6bda4abab58910160405180910390a15050600101610e9b565b6000610f83836113a1565b8015610f945750610f9483836113d4565b9392505050565b60006001600160e01b03198216630381024d60e41b148061037b575061037b826114bd565b6001600160a01b0383166110225760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161057c565b6001600160a01b0382166110835760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161057c565b6001600160a01b0383811660008181526009602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006110f08484610d38565b90506000198114611158578181101561114b5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161057c565b6111588484848403610fc0565b50505050565b6002546040805163ae2e933b60e01b815290516111d2926001600160a01b03169163ae2e933b9160048083019260209291908290030181865afa1580156111a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cd919061215e565b611528565b6111dd83838361166f565b505050565b60606000610f948361183d565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561124857507f000000000000000000000000000000000000000000000000000000000000000046145b1561127257507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600061037b6113236111ef565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061137587878787611899565b9150915061138281611986565b5095945050505050565b6000610f94836001600160a01b038416611b3f565b60006113b4826301ffc9a760e01b6113d4565b801561037b57506113cd826001600160e01b03196113d4565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b038716906175309061143b90869061220a565b6000604051808303818686fa925050503d8060008114611477576040519150601f19603f3d011682016040523d82523d6000602084013e61147c565b606091505b5091509150602081511015611497576000935050505061037b565b8180156114b35750808060200190518101906114b3919061213c565b9695505050505050565b60006001600160e01b03198216634bcbd0ef60e11b14806114ee57506001600160e01b03198216634ec7fbed60e11b145b8061150957506001600160e01b031982166336372b0760e01b145b8061037b57506301ffc9a760e01b6001600160e01b031983161461037b565b60025460009061154890600160a01b90046001600160601b031642612285565b6001600160601b03169050801561166b5760008054604051635612e00b60e01b81523060048201526001600160a01b0391821692916b033b2e3c9fd0803ce80000009182916115f29190881690635612e00b90602401602060405180830381865afa1580156115bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115df91906122ad565b866b033b2e3c9fd0803ce8000000611b8e565b6115fc91906122c6565b6001600160a01b038416600090815260086020526040902054600a5461162291906122c6565b61162c91906122dd565b61163691906122fc565b90508015611158576116488282611c4c565b5050600280546001600160a01b0316600160a01b426001600160601b0316021790555b5050565b6001600160a01b0383166116d35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161057c565b6001600160a01b0382166117355760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161057c565b6001600160a01b038316600090815260086020526040902054818110156117ad5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161057c565b6001600160a01b038085166000908152600860205260408082208585039055918516815290812080548492906117e490849061223c565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161183091815260200190565b60405180910390a3611158565b60608160000180548060200260200160405190810160405280929190818152602001828054801561188d57602002820191906000526020600020905b815481526020019060010190808311611879575b50505050509050919050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156118d0575060009050600361197d565b8460ff16601b141580156118e857508460ff16601c14155b156118f9575060009050600461197d565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561194d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166119765760006001925092505061197d565b9150600090505b94509492505050565b600081600481111561199a5761199a61231e565b036119a25750565b60018160048111156119b6576119b661231e565b03611a035760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161057c565b6002816004811115611a1757611a1761231e565b03611a645760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161057c565b6003816004811115611a7857611a7861231e565b03611ad05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161057c565b6004816004811115611ae457611ae461231e565b03611b3c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161057c565b50565b6000818152600183016020526040812054611b865750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561037b565b50600061037b565b6000838015611c2e57600184168015611ba957859250611bad565b8392505b50600283046002850494505b8415611c28578586028687820414611bd057600080fd5b81810181811015611be057600080fd5b8590049650506001851615611c1d578583028387820414158715151615611c0657600080fd5b81810181811015611c1657600080fd5b8590049350505b600285049450611bb9565b50611c44565b838015611c3e5760009250611c42565b8392505b505b509392505050565b6001600160a01b038216611ca25760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161057c565b80600a6000828254611cb4919061223c565b90915550506001600160a01b03821660009081526008602052604081208054839290611ce190849061223c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600060208284031215611d3d57600080fd5b81356001600160e01b031981168114610f9457600080fd5b60005b83811015611d70578181015183820152602001611d58565b838111156111585750506000910152565b6020815260008251806020840152611da0816040850160208701611d55565b601f01601f19169190910160400192915050565b6001600160a01b0381168114611b3c57600080fd5b60008060408385031215611ddc57600080fd5b8235611de781611db4565b946020939093013593505050565b60008083601f840112611e0757600080fd5b50813567ffffffffffffffff811115611e1f57600080fd5b6020830191508360208260051b8501011115611e3a57600080fd5b9250929050565b60008060008060408587031215611e5757600080fd5b843567ffffffffffffffff80821115611e6f57600080fd5b611e7b88838901611df5565b90965094506020870135915080821115611e9457600080fd5b50611ea187828801611df5565b95989497509550505050565b600080600060608486031215611ec257600080fd5b8335611ecd81611db4565b92506020840135611edd81611db4565b929592945050506040919091013590565b600081518084526020808501945080840160005b83811015611f275781516001600160a01b031687529582019590820190600101611f02565b509495945050505050565b602081526000610f946020830184611eee565b600060208284031215611f5757600080fd5b8135610f9481611db4565b803560ff81168114611f7357600080fd5b919050565b600080600080600080600060e0888a031215611f9357600080fd5b8735611f9e81611db4565b96506020880135611fae81611db4565b95506040880135945060608801359350611fca60808901611f62565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215611ff957600080fd5b823561200481611db4565b9150602083013561201481611db4565b809150509250929050565b6040815260006120326040830185611eee565b82810360208481019190915284518083528582019282019060005b8181101561206c57845160ff168352938301939183019160010161204d565b5090979650505050505050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156120a157600080fd5b815167ffffffffffffffff808211156120b957600080fd5b818401915084601f8301126120cd57600080fd5b8151818111156120df576120df612079565b604051601f8201601f19908116603f0116810190838211818310171561210757612107612079565b8160405282815287602084870101111561212057600080fd5b612131836020830160208801611d55565b979650505050505050565b60006020828403121561214e57600080fd5b81518015158114610f9457600080fd5b60006020828403121561217057600080fd5b8151610f9481611db4565b6040808252810184905260008560608301825b878110156121be5782356121a181611db4565b6001600160a01b031682526020928301929091019060010161218e565b5083810360208581019190915285825291508590820160005b868110156121fd5760ff6121ea84611f62565b16825291830191908301906001016121d7565b5098975050505050505050565b6000825161221c818460208701611d55565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561224f5761224f612226565b500190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561227c57600080fd5b610f9482611f62565b60006001600160601b03838116908316818110156122a5576122a5612226565b039392505050565b6000602082840312156122bf57600080fd5b5051919050565b6000828210156122d8576122d8612226565b500390565b60008160001904831182151516156122f7576122f7612226565b500290565b60008261231957634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052602160045260246000fdfea164736f6c634300080d000a
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063a9059cbb1161007c578063a9059cbb146102e1578063c45a0155146102f4578063d505accf14610307578063dd62ed3e1461031a578063f53af5331461032d578063fe1de1f31461034357600080fd5b806370a08231146102645780637b1039991461028d5780637ecebe00146102a057806389afcb44146102b357806395d89b41146102c6578063a457c2d7146102ce57600080fd5b806328dd99121161011557806328dd9912146101e75780632ee762e514610212578063313ce567146102275780633644e51514610236578063395093511461023e5780636a6278421461025157600080fd5b806301ffc9a71461015d57806306fdde0314610185578063095ea7b31461019a578063116b6168146101ad57806318160ddd146101c257806323b872dd146101d4575b600080fd5b61017061016b366004611d2b565b610356565b60405190151581526020015b60405180910390f35b61018d610381565b60405161017c9190611d81565b6101706101a8366004611dc9565b6103f8565b6101c06101bb366004611e41565b610410565b005b600a545b60405190815260200161017c565b6101706101e2366004611ead565b610704565b6001546101fa906001600160a01b031681565b6040516001600160a01b03909116815260200161017c565b61021a610728565b60405161017c9190611f32565b6040516012815260200161017c565b6101c6610734565b61017061024c366004611dc9565b61073e565b6101c061025f366004611f45565b610760565b6101c6610272366004611f45565b6001600160a01b031660009081526008602052604090205490565b6002546101fa906001600160a01b031681565b6101c66102ae366004611f45565b610924565b6101c06102c1366004611f45565b610942565b61018d610afc565b6101706102dc366004611dc9565b610b2d565b6101706102ef366004611dc9565b610ba8565b6000546101fa906001600160a01b031681565b6101c0610315366004611f78565b610bb6565b6101c6610328366004611fe6565b610d38565b610335610d63565b60405161017c92919061201f565b6101c0610351366004611e41565b610e43565b60006001600160e01b0319821663022d6c2d60e31b148061037b575061037b82610f9b565b92915050565b60025460405163ed3b559f60e01b81523060048201526060916001600160a01b03169063ed3b559f906024015b600060405180830381865afa1580156103cb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103f3919081019061208f565b905090565b600033610406818585610fc0565b5060019392505050565b600254604051632474521560e21b81527f1916b456004f332cd8a19679364ef4be668619658be72c17b7e86697c4ae0f1660048201523360248201526001600160a01b03909116906391d1485490604401602060405180830381865afa15801561047e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a2919061213c565b8061053a5750600254604051632474521560e21b81527f7a351710be3fdcea63ecc7fc646491b8b8137c983fc9e2f5c5332d62d80de1fe60048201523360248201526001600160a01b03909116906391d1485490604401602060405180830381865afa158015610516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053a919061213c565b6105855760405162461bcd60e51b815260206004820152601760248201527626b0b730b3b2b224b73232bc1d102327a92124a22222a760491b60448201526064015b60405180910390fd5b6000805460408051630384935560e51b8152905183926001600160a01b0316916370926aa09160048083019260209291908290030181865afa1580156105cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f3919061215e565b6001600160a01b031663116b616860e01b8787878760405160240161061b949392919061217b565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610659919061220a565b600060405180830381855af49150503d8060008114610694576040519150601f19603f3d011682016040523d82523d6000602084013e610699565b606091505b5091509150816106fc5780516000036106f45760405162461bcd60e51b815260206004820152601c60248201527f4d616e61676564496e6465783a20524557454947485f4641494c454400000000604482015260640161057c565b805181602001fd5b505050505050565b6000336107128582856110e4565b61071d85858561115e565b506001949350505050565b60606103f360056111e2565b60006103f36111ef565b6000336104068185856107518383610d38565b61075b919061223c565b610fc0565b6002600f54036107b25760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057c565b6002600f81905550600080600260009054906101000a90046001600160a01b03166001600160a01b031663b07bdef66040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610812573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610836919061215e565b604080516001600160a01b0386811660248084019190915283518084039091018152604490920183526020820180516001600160e01b03166335313c2160e11b1790529151929091169161088a919061220a565b600060405180830381855af49150503d80600081146108c5576040519150601f19603f3d011682016040523d82523d6000602084013e6108ca565b606091505b50915091508161091a5780516000036106f45760405162461bcd60e51b8152602060048201526012602482015271125b99195e0e881352539517d1905253115160721b604482015260640161057c565b50506001600f5550565b6001600160a01b0381166000908152600d602052604081205461037b565b6002600f54036109945760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057c565b6002600f81905550600080600260009054906101000a90046001600160a01b03166001600160a01b031663b07bdef66040518163ffffffff1660e01b81526004016020604051808303816000875af11580156109f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a18919061215e565b604080516001600160a01b0386811660248084019190915283518084039091018152604490920183526020820180516001600160e01b031663226bf2d160e21b17905291519290911691610a6c919061220a565b600060405180830381855af49150503d8060008114610aa7576040519150601f19603f3d011682016040523d82523d6000602084013e610aac565b606091505b50915091508161091a5780516000036106f45760405162461bcd60e51b8152602060048201526012602482015271125b99195e0e881095549397d1905253115160721b604482015260640161057c565b60025460405163554f94ab60e01b81523060048201526060916001600160a01b03169063554f94ab906024016103ae565b60003381610b3b8286610d38565b905083811015610b9b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161057c565b61071d8286868403610fc0565b60003361040681858561115e565b83421115610c065760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161057c565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888610c538c6001600160a01b03166000908152600d6020526040902080546001810190915590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610cae82611316565b90506000610cbe82878787611364565b9050896001600160a01b0316816001600160a01b031614610d215760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161057c565b610d2c8a8a8a610fc0565b50505050505050505050565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b606080610d7060036111e2565b80519092508067ffffffffffffffff811115610d8e57610d8e612079565b604051908082528060200260200182016040528015610db7578160200160208202803683370190505b50915060005b81811015610e3d5760076000858381518110610ddb57610ddb612254565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a900460ff16838281518110610e2357610e23612254565b60ff90921660209283029190910190910152600101610dbd565b50509091565b6000546001600160a01b03163314610e975760405162461bcd60e51b815260206004820152601760248201527626b0b730b3b2b224b73232bc1d102327a92124a22222a760491b604482015260640161057c565b8260005b818110156106fc576000868683818110610eb757610eb7612254565b9050602002016020810190610ecc9190611f45565b90506000858584818110610ee257610ee2612254565b9050602002016020810190610ef7919061226a565b6001600160a01b0383166000908152600760205260409020805460ff191660ff83161790559050610f2960038361138c565b50604080516001600160a01b038416815260ff831660208201527f570021dbfc0c0d1b83293d5c8ce73e7cef80870624da237d3e4bc6bda4abab58910160405180910390a15050600101610e9b565b6000610f83836113a1565b8015610f945750610f9483836113d4565b9392505050565b60006001600160e01b03198216630381024d60e41b148061037b575061037b826114bd565b6001600160a01b0383166110225760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161057c565b6001600160a01b0382166110835760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161057c565b6001600160a01b0383811660008181526009602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006110f08484610d38565b90506000198114611158578181101561114b5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161057c565b6111588484848403610fc0565b50505050565b6002546040805163ae2e933b60e01b815290516111d2926001600160a01b03169163ae2e933b9160048083019260209291908290030181865afa1580156111a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cd919061215e565b611528565b6111dd83838361166f565b505050565b60606000610f948361183d565b6000306001600160a01b037f000000000000000000000000632806bf5c8f062932dd121244c9fbe7becb8b481614801561124857507f000000000000000000000000000000000000000000000000000000000000000146145b1561127257507f4c7c237f3e0fb12ef111e837c78a75c2e6d52a119f881a3075d8dd6dfa75f4d790565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527fd8490b9547e91f58ad99f64a02c3ef802c5e3605722e0326052a33e9c4c648e6828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600061037b6113236111ef565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061137587878787611899565b9150915061138281611986565b5095945050505050565b6000610f94836001600160a01b038416611b3f565b60006113b4826301ffc9a760e01b6113d4565b801561037b57506113cd826001600160e01b03196113d4565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b038716906175309061143b90869061220a565b6000604051808303818686fa925050503d8060008114611477576040519150601f19603f3d011682016040523d82523d6000602084013e61147c565b606091505b5091509150602081511015611497576000935050505061037b565b8180156114b35750808060200190518101906114b3919061213c565b9695505050505050565b60006001600160e01b03198216634bcbd0ef60e11b14806114ee57506001600160e01b03198216634ec7fbed60e11b145b8061150957506001600160e01b031982166336372b0760e01b145b8061037b57506301ffc9a760e01b6001600160e01b031983161461037b565b60025460009061154890600160a01b90046001600160601b031642612285565b6001600160601b03169050801561166b5760008054604051635612e00b60e01b81523060048201526001600160a01b0391821692916b033b2e3c9fd0803ce80000009182916115f29190881690635612e00b90602401602060405180830381865afa1580156115bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115df91906122ad565b866b033b2e3c9fd0803ce8000000611b8e565b6115fc91906122c6565b6001600160a01b038416600090815260086020526040902054600a5461162291906122c6565b61162c91906122dd565b61163691906122fc565b90508015611158576116488282611c4c565b5050600280546001600160a01b0316600160a01b426001600160601b0316021790555b5050565b6001600160a01b0383166116d35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161057c565b6001600160a01b0382166117355760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161057c565b6001600160a01b038316600090815260086020526040902054818110156117ad5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161057c565b6001600160a01b038085166000908152600860205260408082208585039055918516815290812080548492906117e490849061223c565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161183091815260200190565b60405180910390a3611158565b60608160000180548060200260200160405190810160405280929190818152602001828054801561188d57602002820191906000526020600020905b815481526020019060010190808311611879575b50505050509050919050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156118d0575060009050600361197d565b8460ff16601b141580156118e857508460ff16601c14155b156118f9575060009050600461197d565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561194d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166119765760006001925092505061197d565b9150600090505b94509492505050565b600081600481111561199a5761199a61231e565b036119a25750565b60018160048111156119b6576119b661231e565b03611a035760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161057c565b6002816004811115611a1757611a1761231e565b03611a645760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161057c565b6003816004811115611a7857611a7861231e565b03611ad05760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161057c565b6004816004811115611ae457611ae461231e565b03611b3c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161057c565b50565b6000818152600183016020526040812054611b865750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561037b565b50600061037b565b6000838015611c2e57600184168015611ba957859250611bad565b8392505b50600283046002850494505b8415611c28578586028687820414611bd057600080fd5b81810181811015611be057600080fd5b8590049650506001851615611c1d578583028387820414158715151615611c0657600080fd5b81810181811015611c1657600080fd5b8590049350505b600285049450611bb9565b50611c44565b838015611c3e5760009250611c42565b8392505b505b509392505050565b6001600160a01b038216611ca25760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161057c565b80600a6000828254611cb4919061223c565b90915550506001600160a01b03821660009081526008602052604081208054839290611ce190849061223c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600060208284031215611d3d57600080fd5b81356001600160e01b031981168114610f9457600080fd5b60005b83811015611d70578181015183820152602001611d58565b838111156111585750506000910152565b6020815260008251806020840152611da0816040850160208701611d55565b601f01601f19169190910160400192915050565b6001600160a01b0381168114611b3c57600080fd5b60008060408385031215611ddc57600080fd5b8235611de781611db4565b946020939093013593505050565b60008083601f840112611e0757600080fd5b50813567ffffffffffffffff811115611e1f57600080fd5b6020830191508360208260051b8501011115611e3a57600080fd5b9250929050565b60008060008060408587031215611e5757600080fd5b843567ffffffffffffffff80821115611e6f57600080fd5b611e7b88838901611df5565b90965094506020870135915080821115611e9457600080fd5b50611ea187828801611df5565b95989497509550505050565b600080600060608486031215611ec257600080fd5b8335611ecd81611db4565b92506020840135611edd81611db4565b929592945050506040919091013590565b600081518084526020808501945080840160005b83811015611f275781516001600160a01b031687529582019590820190600101611f02565b509495945050505050565b602081526000610f946020830184611eee565b600060208284031215611f5757600080fd5b8135610f9481611db4565b803560ff81168114611f7357600080fd5b919050565b600080600080600080600060e0888a031215611f9357600080fd5b8735611f9e81611db4565b96506020880135611fae81611db4565b95506040880135945060608801359350611fca60808901611f62565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215611ff957600080fd5b823561200481611db4565b9150602083013561201481611db4565b809150509250929050565b6040815260006120326040830185611eee565b82810360208481019190915284518083528582019282019060005b8181101561206c57845160ff168352938301939183019160010161204d565b5090979650505050505050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156120a157600080fd5b815167ffffffffffffffff808211156120b957600080fd5b818401915084601f8301126120cd57600080fd5b8151818111156120df576120df612079565b604051601f8201601f19908116603f0116810190838211818310171561210757612107612079565b8160405282815287602084870101111561212057600080fd5b612131836020830160208801611d55565b979650505050505050565b60006020828403121561214e57600080fd5b81518015158114610f9457600080fd5b60006020828403121561217057600080fd5b8151610f9481611db4565b6040808252810184905260008560608301825b878110156121be5782356121a181611db4565b6001600160a01b031682526020928301929091019060010161218e565b5083810360208581019190915285825291508590820160005b868110156121fd5760ff6121ea84611f62565b16825291830191908301906001016121d7565b5098975050505050505050565b6000825161221c818460208701611d55565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561224f5761224f612226565b500190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561227c57600080fd5b610f9482611f62565b60006001600160601b03838116908316818110156122a5576122a5612226565b039392505050565b6000602082840312156122bf57600080fd5b5051919050565b6000828210156122d8576122d8612226565b500390565b60008160001904831182151516156122f7576122f7612226565b500290565b60008261231957634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052602160045260246000fdfea164736f6c634300080d000a
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.