Source Code
Latest 25 from a total of 2,510,726 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Mint | 56226673 | 6 secs ago | IN | 0 AVAX | 0.00009845 | ||||
Mint | 56226673 | 6 secs ago | IN | 0 AVAX | 0.0000985 | ||||
Mint | 56226673 | 6 secs ago | IN | 0 AVAX | 0.0000985 | ||||
Mint | 56226671 | 10 secs ago | IN | 0 AVAX | 0.00009848 | ||||
Mint | 56226671 | 10 secs ago | IN | 0 AVAX | 0.00009845 | ||||
Mint | 56226671 | 10 secs ago | IN | 0 AVAX | 0.00009845 | ||||
Mint | 56226671 | 10 secs ago | IN | 0 AVAX | 0.00009845 | ||||
Mint | 56226670 | 11 secs ago | IN | 0 AVAX | 0.0000985 | ||||
Mint | 56226667 | 20 secs ago | IN | 0 AVAX | 0.0000985 | ||||
Mint | 56226666 | 21 secs ago | IN | 0 AVAX | 0.00009495 | ||||
Mint | 56226664 | 26 secs ago | IN | 0 AVAX | 0.00009845 | ||||
Mint | 56226664 | 26 secs ago | IN | 0 AVAX | 0.00009845 | ||||
Mint | 56226662 | 30 secs ago | IN | 0 AVAX | 0.00009843 | ||||
Mint | 56226662 | 30 secs ago | IN | 0 AVAX | 0.0000985 | ||||
Mint | 56226662 | 30 secs ago | IN | 0 AVAX | 0.0000985 | ||||
Mint | 56226661 | 33 secs ago | IN | 0 AVAX | 0.00009495 | ||||
Mint | 56226660 | 34 secs ago | IN | 0 AVAX | 0.00009848 | ||||
Mint | 56226657 | 38 secs ago | IN | 0 AVAX | 0.00009845 | ||||
Mint | 56226657 | 38 secs ago | IN | 0 AVAX | 0.00009849 | ||||
Mint | 56226657 | 38 secs ago | IN | 0 AVAX | 0.0000985 | ||||
Mint | 56226656 | 43 secs ago | IN | 0 AVAX | 0.00009494 | ||||
Mint | 56226656 | 43 secs ago | IN | 0 AVAX | 0.00009843 | ||||
Mint | 56226655 | 47 secs ago | IN | 0 AVAX | 0.00009495 | ||||
Mint | 56226653 | 49 secs ago | IN | 0 AVAX | 0.00009495 | ||||
Mint | 56226653 | 49 secs ago | IN | 0 AVAX | 0.00009845 |
Loading...
Loading
Contract Name:
XPower
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 // solhint-disable not-rely-on-time // solhint-disable no-empty-blocks pragma solidity 0.8.20; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import {Constants} from "./libs/Constants.sol"; import {FeeTracker} from "./base/FeeTracker.sol"; import {MoeMigratable} from "./base/Migratable.sol"; /** * Class for the XPOW proof-of-work tokens: It verifies, that the nonce and the * block-hash result in a positive amount. After a successful verification, the * corresponding amount is minted for the beneficiary (plus the MoE treasury). */ contract XPower is ERC20, ERC20Burnable, FeeTracker, MoeMigratable, Ownable { /** set of nonce-hashes already minted for */ mapping(bytes32 => bool) private _hashes; /** map from block-hashes to timestamps */ mapping(bytes32 => uint256) private _timestamps; /** map from intervals to block-hashes */ mapping(uint256 => bytes32) private _blockHashes; /** @param moeBase addresses of old contracts */ /** @param deadlineIn seconds to end-of-migration */ constructor( address[] memory moeBase, uint256 deadlineIn ) // ERC20 constructor: name, symbol ERC20("XPower", "XPOW") // MoeMigratable: old contract, rel. deadline [seconds] MoeMigratable(moeBase, deadlineIn) {} /** @return number of decimals of representation */ function decimals() public view virtual override returns (uint8) { return Constants.DECIMALS; } /** emitted on caching most recent block-hash */ event Init(bytes32 blockHash, uint256 timestamp); /** cache most recent block-hash */ function init() external { uint256 interval = currentInterval(); if (uint256(_blockHashes[interval]) == 0) { bytes32 blockHash = blockhash(block.number - 1); uint256 timestamp = block.timestamp; _blockHashes[interval] = blockHash; _timestamps[blockHash] = timestamp; emit Init(blockHash, timestamp); } else { bytes32 blockHash = _blockHashes[interval]; uint256 timestamp = _timestamps[blockHash]; emit Init(blockHash, timestamp); } } /** mint tokens for to-beneficiary, block-hash & data (incl. nonce) */ function mint( address to, bytes32 blockHash, bytes calldata data ) external tracked { // check block-hash to be in current interval require(_recent(blockHash), "expired block-hash"); // calculate nonce-hash & pair-index for to, block-hash & data (bytes32 nonceHash, bytes32 pairIndex) = _hashOf(to, blockHash, data); require(_unique(pairIndex), "duplicate nonce-hash"); // calculate number of zeros of nonce-hash uint256 zeros = _zerosOf(nonceHash); require(zeros > 0, "empty nonce-hash"); // calculate amount of tokens of zeros uint256 amount = _amountOf(zeros); // ensure unique (nonce-hash, block-hash) _hashes[pairIndex] = true; // mint for contract owner _mint(owner(), amount >> 3); // mint for beneficiary _mint(to, amount); } /** @return block-hash */ function blockHashOf(uint256 interval) external view returns (bytes32) { return _blockHashes[interval]; } /** @return current interval's timestamp */ function currentInterval() public view returns (uint256) { return block.timestamp / (1 hours); } /** check whether block-hash has recently been cached */ function _recent(bytes32 blockHash) private view returns (bool) { return _timestamps[blockHash] >= currentInterval() * (1 hours); } /** @return hash of contract, to-beneficiary, block-hash & data (incl. nonce) */ function _hashOf( address to, bytes32 blockHash, bytes calldata data ) internal view returns (bytes32, bytes32) { bytes32 nonceHash = keccak256( bytes.concat( bytes20(uint160(address(this)) ^ uint160(to)), blockHash, data ) ); return (nonceHash, nonceHash ^ blockHash); } /** check whether (nonce-hash, block-hash) pair is unique */ function _unique(bytes32 pairIndex) private view returns (bool) { return !_hashes[pairIndex]; } /** @return number of leading-zeros */ function _zerosOf(bytes32 nonceHash) internal pure returns (uint8) { if (nonceHash > 0) { return uint8(63 - (Math.log2(uint256(nonceHash)) >> 2)); } return 64; } /** @return amount (for level) */ function _amountOf(uint256 level) internal view returns (uint256) { return (2 ** level - 1) * 10 ** decimals(); } /** @return true if this contract implements the interface defined by interface-id */ function supportsInterface( bytes4 interfaceId ) public view virtual override(MoeMigratable) returns (bool) { return super.supportsInterface(interfaceId); } /** @return fee-estimate plus averages over gas and gas-price */ function fees() external view returns (uint256[] memory) { return _fees(FEE_ADD, FEE_MUL, FEE_DIV); } /** fee-tracker estimate: 21_000+700+1360+1088+68*8 */ uint256 private constant FEE_ADD = 24_692_000_000_000; uint256 private constant FEE_MUL = 1_6168707436776024; uint256 private constant FEE_DIV = 1_0000000000000000; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // 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(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. 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 for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the 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. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // 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 preconditions 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 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * 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}. * * 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 default value returned by this function, unless * it's 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 `from` to `to`. * * 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; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _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; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _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; // Overflow not possible: amount <= accountBalance <= totalSupply. _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 (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.20; library Constants { /** a century in [seconds] (approximation) */ uint256 internal constant CENTURY = 365_25 days; /** a year in [seconds] (approximation) */ uint256 internal constant YEAR = CENTURY / 100; /** a month [seconds] (approximation) */ uint256 internal constant MONTH = YEAR / 12; /** number of decimals of representation */ uint8 internal constant DECIMALS = 18; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.20; /** * Allows tracking of fees using cumulative moving-averages: * > * > avg[n+1] = (fee[n+1] + n*avg[n]) / (n+1) * > */ abstract contract FeeTracker { /** cumulative moving-averages: gas & gas-price */ uint256[2] private _average; /** gas & gas-price tracker */ modifier tracked() { uint256 gas = gasleft(); _; _update(gas - gasleft(), tx.gasprice); } /** update averages over gas & gas-price */ function _update(uint256 gasValue, uint256 gasPrice) private { uint256 value = _average[0]; if (value > 0) { _average[0] = (gasValue + value * 0xf) >> 4; } else { _average[0] = (gasValue); } uint256 price = _average[1]; if (price > 0) { _average[1] = (gasPrice + price * 0xf) >> 4; } else { _average[1] = (gasPrice); } } /** @return fee-estimate and averages over gas & gas-price */ function _fees(uint256 add, uint256 mul, uint256 div) internal view returns (uint256[] memory) { uint256[] memory array = new uint256[](3); uint256 gasPrice = _average[1]; array[2] = gasPrice; uint256 gasValue = _average[0]; array[1] = gasValue; uint256 feeValue = gasPrice * gasValue; array[0] = ((feeValue + add) * mul) / div; return array; } }
// SPDX-License-Identifier: GPL-3.0 // solhint-disable not-rely-on-time // solhint-disable one-contract-per-file // solhint-disable reason-string pragma solidity 0.8.20; import {ERC20, IERC20, IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import {Supervised, MoeMigratableSupervised, SovMigratableSupervised} from "./Supervised.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; /** * Allows migration of tokens from an old contract upto a certain deadline. * Further, it is possible to close down the migration window earlier than * the specified deadline. */ abstract contract Migratable is ERC20, ERC20Burnable, Supervised { /** burnable ERC20 tokens */ ERC20Burnable[] private _base; /** base address to index map */ mapping(address => uint256) private _index; /** timestamp of immigration deadline */ uint256 private _deadlineBy; /** flag to seal immigration */ bool[] private _sealed; /** number of immigrated tokens */ uint256 private _migrated; /** * @param base addresses of old contracts * @param deadlineIn seconds to end-of-migration */ constructor(address[] memory base, uint256 deadlineIn) { _deadlineBy = block.timestamp + deadlineIn; _base = new ERC20Burnable[](base.length); _sealed = new bool[](base.length); for (uint256 i = 0; i < base.length; i++) { _base[i] = ERC20Burnable(base[i]); _index[base[i]] = i; } } /** * @param base address of old contract * @return index of base address */ function oldIndexOf(address base) external view returns (uint256) { return _index[base]; } /** * migrate amount of ERC20 tokens * * @param amount of ERC20s to migrate * @param index single of base contract */ function migrate( uint256 amount, uint256[] memory index ) external returns (uint256) { return _migrateFrom(msg.sender, amount, index); } /** * migrate amount of ERC20 tokens * * @param account to migrate from * @param amount of ERC20s to migrate * @param index single of base contract */ function migrateFrom( address account, uint256 amount, uint256[] memory index ) external returns (uint256) { require( account == msg.sender || approvedMigrate(account, msg.sender), "caller is not token owner or approved" ); return _migrateFrom(account, amount, index); } /** approve migrate by `operator` */ function approveMigrate(address operator, bool approved) external { require(msg.sender != operator, "approving migrate for self"); _migrateApprovals[msg.sender][operator] = approved; emit ApproveMigrate(msg.sender, operator, approved); } /** @return true if `account` approved migrate by `operator` */ function approvedMigrate( address account, address operator ) public view returns (bool) { return _migrateApprovals[account][operator]; } /** migrate approvals: account => operator */ mapping(address => mapping(address => bool)) private _migrateApprovals; /** * emitted when `account` grants or revokes permission to * `operator` to migrate their tokens according to `approved` */ event ApproveMigrate( address indexed account, address indexed operator, bool approved ); /** migrate amount of ERC20 tokens */ function _migrateFrom( address account, uint256 amount, uint256[] memory index ) internal virtual returns (uint256) { uint256 minAmount = Math.min( amount, _base[index[0]].balanceOf(account) ); uint256 newAmount = _premigrate(account, minAmount, index[0]); _mint(account, newAmount); return newAmount; } /** migrate amount of ERC20 tokens */ function _premigrate( address account, uint256 amount, uint256 index ) internal returns (uint256) { require(!_sealed[index], "migration sealed"); uint256 timestamp = block.timestamp; require(_deadlineBy >= timestamp, "deadline passed"); _base[index].burnFrom(account, amount); assert(amount > 0 || amount == 0); uint256 newAmount = newUnits(amount, index); _migrated += newAmount; return newAmount; } /** * @param oldAmount to convert from * @param index of base contract * @return forward converted new amount w.r.t. decimals */ function newUnits( uint256 oldAmount, uint256 index ) public view returns (uint256) { if (decimals() >= _base[index].decimals()) { return oldAmount * (10 ** (decimals() - _base[index].decimals())); } else { return oldAmount / (10 ** (_base[index].decimals() - decimals())); } } /** * @param newAmount to convert from * @param index of base contract * @return backward converted old amount w.r.t. decimals */ function oldUnits( uint256 newAmount, uint256 index ) public view returns (uint256) { if (decimals() >= _base[index].decimals()) { return newAmount / (10 ** (decimals() - _base[index].decimals())); } else { return newAmount * (10 ** (_base[index].decimals() - decimals())); } } /** @return number of migrated tokens */ function migrated() public view returns (uint256) { return _migrated; } /** * seal immigration * * @param index of base contract */ function _seal(uint256 index) internal { _sealed[index] = true; emit Seal(index); } event Seal(uint256 index); /** seal-all immigration */ function _sealAll() internal { for (uint256 i = 0; i < _sealed.length; i++) { _sealed[i] = true; } emit SealAll(); } event SealAll(); /** @return seal flags (of all bases) */ function seals() public view returns (bool[] memory) { return _sealed; } /** @return true if this contract implements the interface defined by interface-id */ function supportsInterface( bytes4 interfaceId ) public view virtual override returns (bool) { return interfaceId == type(IERC20).interfaceId || interfaceId == type(IERC20Metadata).interfaceId || super.supportsInterface(interfaceId); } } /** * Allows migration of MOE tokens from an old contract upto a certain deadline. */ abstract contract MoeMigratable is Migratable, MoeMigratableSupervised { /** @param base addresses of old contracts */ /** @param deadlineIn seconds to end-of-migration */ constructor( address[] memory base, uint256 deadlineIn ) Migratable(base, deadlineIn) {} /** seal migration */ function seal(uint256 index) external onlyRole(MOE_SEAL_ROLE) { _seal(index); } /** seal-all migration */ function sealAll() external onlyRole(MOE_SEAL_ROLE) { _sealAll(); } /** @return true if this contract implements the interface defined by interface-id */ function supportsInterface( bytes4 interfaceId ) public view virtual override(Migratable, Supervised) returns (bool) { return super.supportsInterface(interfaceId); } } /** * Allows migration of SOV tokens from an old contract upto a certain deadline. */ abstract contract SovMigratable is Migratable, SovMigratableSupervised { /** migratable MOE tokens */ MoeMigratable private _moeMigratable; /** @param moe address of MOE tokens */ /** @param base addresses of old contracts */ /** @param deadlineIn seconds to end-of-migration */ constructor( address moe, address[] memory base, uint256 deadlineIn ) Migratable(base, deadlineIn) { _moeMigratable = MoeMigratable(moe); } /** * migrate amount of SOV tokens * * @param account to migrate from * @param amount of ERC20s to migrate * @param index pair of [sov_index, moe_index] */ /// /// @dev assumes old (XPower:APower) == new (XPower:APower) w.r.t. decimals /// function _migrateFrom( address account, uint256 amount, uint256[] memory index ) internal override returns (uint256) { uint256[] memory moeIndex = new uint256[](1); moeIndex[0] = index[1]; // drop sov-index uint256 newAmountSov = newUnits(amount, index[0]); uint256 migAmountSov = _premigrate(account, amount, index[0]); assert(migAmountSov == newAmountSov); uint256 newAmountMoe = moeUnits(newAmountSov); uint256 oldAmountMoe = _moeMigratable.oldUnits(newAmountMoe, moeIndex[0]); uint256 migAmountMoe = _moeMigratable.migrateFrom(account, oldAmountMoe, moeIndex); assert(_moeMigratable.transferFrom(account, (address)(this), migAmountMoe)); _mint(account, newAmountSov); return newAmountSov; } /** * @param sovAmount to convert from * @return cross-converted MOE amount w.r.t. decimals */ function moeUnits(uint256 sovAmount) public view returns (uint256) { if (decimals() >= _moeMigratable.decimals()) { return sovAmount / (10 ** (decimals() - _moeMigratable.decimals())); } else { return sovAmount * (10 ** (_moeMigratable.decimals() - decimals())); } } /** * @param moeAmount to convert from * @return cross-converted SOV amount w.r.t. decimals */ function sovUnits(uint256 moeAmount) public view returns (uint256) { if (decimals() >= _moeMigratable.decimals()) { return moeAmount * (10 ** (decimals() - _moeMigratable.decimals())); } else { return moeAmount / (10 ** (_moeMigratable.decimals() - decimals())); } } /** seal migration */ function seal(uint256 index) external onlyRole(SOV_SEAL_ROLE) { _seal(index); } /** seal-all migration */ function sealAll() external onlyRole(SOV_SEAL_ROLE) { _sealAll(); } /** @return true if this contract implements the interface defined by interface-id */ function supportsInterface( bytes4 interfaceId ) public view virtual override(Migratable, Supervised) returns (bool) { return super.supportsInterface(interfaceId); } }
// 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 (last updated v4.9.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: GPL-3.0 // solhint-disable one-contract-per-file pragma solidity 0.8.20; import {AccessControlEnumerable} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; abstract contract Supervised is AccessControlEnumerable { constructor() { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); } /** @return true if this contract implements the interface defined by interface-id */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return super.supportsInterface(interfaceId); } } abstract contract MoeTreasurySupervised is Supervised { /** role grants right to change APR parametrization */ bytes32 public constant APR_ROLE = keccak256("APR_ROLE"); bytes32 public constant APR_ADMIN_ROLE = keccak256("APR_ADMIN_ROLE"); /** role grants right to change APB parametrization */ bytes32 public constant APB_ROLE = keccak256("APB_ROLE"); bytes32 public constant APB_ADMIN_ROLE = keccak256("APB_ADMIN_ROLE"); constructor() { _setRoleAdmin(APR_ROLE, APR_ADMIN_ROLE); _grantRole(APR_ADMIN_ROLE, msg.sender); _setRoleAdmin(APB_ROLE, APB_ADMIN_ROLE); _grantRole(APB_ADMIN_ROLE, msg.sender); } } abstract contract MoeMigratableSupervised is Supervised { /** role grants right to seal MOE immigration */ bytes32 public constant MOE_SEAL_ROLE = keccak256("MOE_SEAL_ROLE"); bytes32 public constant MOE_SEAL_ADMIN_ROLE = keccak256("MOE_SEAL_ADMIN_ROLE"); constructor() { _setRoleAdmin(MOE_SEAL_ROLE, MOE_SEAL_ADMIN_ROLE); _grantRole(MOE_SEAL_ADMIN_ROLE, msg.sender); } } abstract contract SovMigratableSupervised is Supervised { /** role grants right to seal SOV immigration */ bytes32 public constant SOV_SEAL_ROLE = keccak256("SOV_SEAL_ROLE"); bytes32 public constant SOV_SEAL_ADMIN_ROLE = keccak256("SOV_SEAL_ADMIN_ROLE"); constructor() { _setRoleAdmin(SOV_SEAL_ROLE, SOV_SEAL_ADMIN_ROLE); _grantRole(SOV_SEAL_ADMIN_ROLE, msg.sender); } } abstract contract NftMigratableSupervised is Supervised { /** role grants right to seal NFT immigration */ bytes32 public constant NFT_SEAL_ROLE = keccak256("NFT_SEAL_ROLE"); bytes32 public constant NFT_SEAL_ADMIN_ROLE = keccak256("NFT_SEAL_ADMIN_ROLE"); /** role grants right to open NFT emigration */ bytes32 public constant NFT_OPEN_ROLE = keccak256("NFT_OPEN_ROLE"); bytes32 public constant NFT_OPEN_ADMIN_ROLE = keccak256("NFT_OPEN_ADMIN_ROLE"); constructor() { _setRoleAdmin(NFT_SEAL_ROLE, NFT_SEAL_ADMIN_ROLE); _grantRole(NFT_SEAL_ADMIN_ROLE, msg.sender); _setRoleAdmin(NFT_OPEN_ROLE, NFT_OPEN_ADMIN_ROLE); _grantRole(NFT_OPEN_ADMIN_ROLE, msg.sender); } } abstract contract NftRoyaltySupervised is Supervised { /** role grants right to set the NFT's default royalty beneficiary */ bytes32 public constant NFT_ROYAL_ROLE = keccak256("NFT_ROYAL_ROLE"); bytes32 public constant NFT_ROYAL_ADMIN_ROLE = keccak256("NFT_ROYAL_ADMIN_ROLE"); constructor() { _setRoleAdmin(NFT_ROYAL_ROLE, NFT_ROYAL_ADMIN_ROLE); _grantRole(NFT_ROYAL_ADMIN_ROLE, msg.sender); } } abstract contract URIMalleableSupervised is Supervised { /** role grants right to change metadata URIs */ bytes32 public constant URI_DATA_ROLE = keccak256("URI_DATA_ROLE"); bytes32 public constant URI_DATA_ADMIN_ROLE = keccak256("URI_DATA_ADMIN_ROLE"); constructor() { _setRoleAdmin(URI_DATA_ROLE, URI_DATA_ADMIN_ROLE); _grantRole(URI_DATA_ADMIN_ROLE, msg.sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @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. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @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 revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. 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. * * ```solidity * 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. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ 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) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // 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; /// @solidity memory-safe-assembly 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 in 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; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// 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 (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// 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: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// 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); }
{ "remappings": [ "@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/", "forge-std/=lib/forge-std/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address[]","name":"moeBase","type":"address[]"},{"internalType":"uint256","name":"deadlineIn","type":"uint256"}],"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":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApproveMigrate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Init","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"Seal","type":"event"},{"anonymous":false,"inputs":[],"name":"SealAll","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"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MOE_SEAL_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MOE_SEAL_ROLE","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":[{"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":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"approveMigrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"approvedMigrate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"interval","type":"uint256"}],"name":"blockHashOf","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"fees","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256[]","name":"index","type":"uint256[]"}],"name":"migrate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256[]","name":"index","type":"uint256[]"}],"name":"migrateFrom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"migrated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"oldAmount","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"newUnits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"base","type":"address"}],"name":"oldIndexOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newAmount","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"oldUnits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"seal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"seals","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","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":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620033f6380380620033f68339810160408190526200003491620005e5565b81818181604051806040016040528060068152602001652c2837bbb2b960d11b8152506040518060400160405280600481526020016358504f5760e01b81525081600390816200008591906200074d565b5060046200009482826200074d565b50620000a691506000905033620002b0565b620000b281426200082f565b600b5581516001600160401b03811115620000d157620000d1620005b2565b604051908082528060200260200182016040528015620000fb578160200160208202803683370190505b50805162000112916009916020909101906200048f565b5081516001600160401b038111156200012f576200012f620005b2565b60405190808252806020026020018201604052801562000159578160200160208202803683370190505b5080516200017091600c91602090910190620004f9565b5060005b82518110156200023b5782818151811062000193576200019362000845565b602002602001015160098281548110620001b157620001b162000845565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600a6000858481518110620001f957620001f962000845565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550808062000232906200085b565b91505062000174565b5050506200027f7faa06a9d3e3ec1501dfa4c06793f24ccddc527fa3089263f11fd78652bb9bafdb600080516020620033d6833981519152620002db60201b60201c565b6200029a600080516020620033d683398151915233620002b0565b50620002a890503362000326565b505062000877565b620002bc828262000378565b6000828152600860205260409020620002d690826200041d565b505050565b600082815260076020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b600f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff16620004195760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620003d83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600062000434836001600160a01b0384166200043d565b90505b92915050565b6000818152600183016020526040812054620004865750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000437565b50600062000437565b828054828255906000526020600020908101928215620004e7579160200282015b82811115620004e757825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620004b0565b50620004f59291506200059b565b5090565b82805482825590600052602060002090601f01602090048101928215620004e75791602002820160005b838211156200056257835183826101000a81548160ff021916908315150217905550926020019260010160208160000104928301926001030262000523565b8015620005915782816101000a81549060ff021916905560010160208160000104928301926001030262000562565b5050620004f59291505b5b80821115620004f557600081556001016200059c565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b0381168114620005e057600080fd5b919050565b60008060408385031215620005f957600080fd5b82516001600160401b03808211156200061157600080fd5b818501915085601f8301126200062657600080fd5b81516020828211156200063d576200063d620005b2565b8160051b604051601f19603f83011681018181108682111715620006655762000665620005b2565b6040529283528183019350848101820192898411156200068457600080fd5b948201945b83861015620006ad576200069d86620005c8565b8552948201949382019362000689565b97909101519698969750505050505050565b600181811c90821680620006d457607f821691505b602082108103620006f557634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002d657600081815260208120601f850160051c81016020861015620007245750805b601f850160051c820191505b81811015620007455782815560010162000730565b505050505050565b81516001600160401b03811115620007695762000769620005b2565b62000781816200077a8454620006bf565b84620006fb565b602080601f831160018114620007b95760008415620007a05750858301515b600019600386901b1c1916600185901b17855562000745565b600085815260208120601f198616915b82811015620007ea57888601518255948401946001909101908401620007c9565b5085821015620008095787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b8082018082111562000437576200043762000819565b634e487b7160e01b600052603260045260246000fd5b60006001820162000870576200087062000819565b5060010190565b612b4f80620008876000396000f3fe608060405234801561001057600080fd5b50600436106102695760003560e01c806370a0823111610151578063a457c2d7116100c3578063d547741f11610087578063d547741f14610590578063dd62ed3e146105a3578063e1c7392a146105b6578063f2fde38b146105be578063f544c35e146105d1578063fad1919a146105fa57600080fd5b8063a457c2d71461051d578063a9059cbb14610530578063b6483bab14610543578063bb14047014610556578063ca15c8731461057d57600080fd5b80638da5cb5b116101155780638da5cb5b146104ad5780639010d07c146104d257806391d14854146104e557806395d89b41146104f85780639af1d35a14610500578063a217fddf1461051557600080fd5b806370a0823114610443578063715018a61461046c5780637766912d1461047457806379cc67901461048757806386fe212d1461049a57600080fd5b80632c678c64116101ea57806339444ffe116101ae57806339444ffe146103a857806339509351146103bb57806342966c68146103ce578063550c8a69146103e15780636c18080e1461041d5780636c9efc911461043057600080fd5b80632c678c64146103635780632f2ff15d1461036b578063313ce5671461037e578063363487bc1461038d57806336568abe1461039557600080fd5b80630a99e88a116102315780630a99e88a146102f45780630c7fa13e1461031b57806318160ddd1461032557806323b872dd1461032d578063248a9ca31461034057600080fd5b806301ffc9a71461026e57806306fdde0314610296578063080e1301146102ab57806308560eca146102cc578063095ea7b3146102e1575b600080fd5b61028161027c3660046123c0565b61061a565b60405190151581526020015b60405180910390f35b61029e61062b565b60405161028d919061240e565b6102be6102b93660046124f2565b6106bd565b60405190815260200161028d565b6102d46106d1565b60405161028d9190612539565b6102816102ef36600461259b565b610748565b6102be7faa06a9d3e3ec1501dfa4c06793f24ccddc527fa3089263f11fd78652bb9bafdb81565b610323610760565b005b6002546102be565b61028161033b3660046125c5565b610795565b6102be61034e366004612601565b60009081526007602052604090206001015490565b600d546102be565b61032361037936600461261a565b6107b9565b6040516012815260200161028d565b6102be6107e3565b6103236103a336600461261a565b6107f6565b6102be6103b6366004612646565b610879565b6102816103c936600461259b565b610a5e565b6103236103dc366004612601565b610a80565b6102816103ef366004612668565b6001600160a01b039182166000908152600e6020908152604080832093909416825291909152205460ff1690565b61032361042b366004612692565b610a8a565b6102be61043e366004612646565b610b4e565b6102be6104513660046126ce565b6001600160a01b031660009081526020819052604090205490565b610323610cf2565b6102be6104823660046126e9565b610d06565b61032361049536600461259b565b610daf565b6103236104a8366004612601565b610dc4565b600f546001600160a01b03165b6040516001600160a01b03909116815260200161028d565b6104ba6104e0366004612646565b610df7565b6102816104f336600461261a565b610e0f565b61029e610e3a565b610508610e49565b60405161028d9190612740565b6102be600081565b61028161052b36600461259b565b610e6a565b61028161053e36600461259b565b610ee5565b610323610551366004612778565b610ef3565b6102be7f7df1fa30796d39d0e882422146943ee011c6f6b410f211570cc3a712e3e51e6a81565b6102be61058b366004612601565b61106d565b61032361059e36600461261a565b611084565b6102be6105b1366004612668565b6110a9565b6103236110d4565b6103236105cc3660046126ce565b6111ba565b6102be6105df3660046126ce565b6001600160a01b03166000908152600a602052604090205490565b6102be610608366004612601565b60009081526012602052604090205490565b600061062582611230565b92915050565b60606003805461063a906127ff565b80601f0160208091040260200160405190810160405280929190818152602001828054610666906127ff565b80156106b35780601f10610688576101008083540402835291602001916106b3565b820191906000526020600020905b81548152906001019060200180831161069657829003601f168201915b5050505050905090565b60006106ca33848461123b565b9392505050565b6060600c8054806020026020016040519081016040528092919081815260200182805480156106b357602002820191906000526020600020906000905b825461010083900a900460ff16151581526020600192830181810494850194909303909202910180841161070e5790505050505050905090565b600033610756818585611329565b5060019392505050565b7faa06a9d3e3ec1501dfa4c06793f24ccddc527fa3089263f11fd78652bb9bafdb61078a8161144d565b610792611457565b50565b6000336107a38582856114e1565b6107ae85858561155b565b506001949350505050565b6000828152600760205260409020600101546107d48161144d565b6107de83836116ff565b505050565b60006107f1610e104261284f565b905090565b6001600160a01b038116331461086b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108758282611721565b5050565b60006009828154811061088e5761088e612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa1580156108dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109009190612887565b60ff166012106109b8576009828154811061091d5761091d612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa15801561096b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098f9190612887565b60125b61099c91906128aa565b6109a790600a6129a7565b6109b1908461284f565b9050610625565b6012600983815481106109cd576109cd612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa158015610a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3f9190612887565b610a4991906128aa565b610a5490600a6129a7565b6109b190846129b6565b600033610756818585610a7183836110a9565b610a7b91906129cd565b611329565b6107923382611743565b6001600160a01b0382163303610ae25760405162461bcd60e51b815260206004820152601a60248201527f617070726f76696e67206d69677261746520666f722073656c660000000000006044820152606401610862565b336000818152600e602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917fde18c0fde0d143c421bc0b8320f254129857d0bb1b96dcc4ea2b51145177d099910160405180910390a35050565b600060098281548110610b6357610b63612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa158015610bb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd59190612887565b60ff16601210610c6b5760098281548110610bf257610bf2612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa158015610c40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c649190612887565b6012610a3f565b601260098381548110610c8057610c80612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa158015610cce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109929190612887565b610cfa611875565b610d0460006118cf565b565b60006001600160a01b038416331480610d4257506001600160a01b0384166000908152600e6020908152604080832033845290915290205460ff165b610d9c5760405162461bcd60e51b815260206004820152602560248201527f63616c6c6572206973206e6f7420746f6b656e206f776e6572206f72206170706044820152641c9bdd995960da1b6064820152608401610862565b610da784848461123b565b949350505050565b610dba8233836114e1565b6108758282611743565b7faa06a9d3e3ec1501dfa4c06793f24ccddc527fa3089263f11fd78652bb9bafdb610dee8161144d565b61087582611921565b60008281526008602052604081206106ca908361199b565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606004805461063a906127ff565b60606107f16516750de388006639715a8f3f0a58662386f26fc100006119a7565b60003381610e7882866110a9565b905083811015610ed85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610862565b6107ae8286868403611329565b60003361075681858561155b565b60005a9050610f0184611a70565b610f425760405162461bcd60e51b81526020600482015260126024820152710caf0e0d2e4cac840c4d8dec6d65ad0c2e6d60731b6044820152606401610862565b600080610f5187878787611aa0565b600081815260106020526040902054919350915060ff1615610fac5760405162461bcd60e51b81526020600482015260146024820152730c8eae0d8d2c6c2e8ca40dcdedcc6ca5ad0c2e6d60631b6044820152606401610862565b6000610fb783611ae6565b60ff16905060008111610fff5760405162461bcd60e51b815260206004820152601060248201526f0cadae0e8f240dcdedcc6ca5ad0c2e6d60831b6044820152606401610862565b600061100a82611b0d565b6000848152601060205260409020805460ff19166001179055905061104461103a600f546001600160a01b031690565b600383901c611b3c565b61104e8982611b3c565b505050506110665a61106090836129e0565b3a611bfb565b5050505050565b600081815260086020526040812061062590611c5d565b60008281526007602052604090206001015461109f8161144d565b6107de8383611721565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60006110de6107e3565b600081815260126020526040812054919250036111685760006111026001436129e0565b60008381526012602090815260408083209340938490558383526011825291829020429081905582518481529182018190529293507f2c6c5a9e4f0ddd70b42bd7fcac74128409018755c234dc0d2d29c66eb6335c9a91015b60405180910390a1505050565b6000818152601260209081526040808320548084526011835292819020548151848152928301819052917f2c6c5a9e4f0ddd70b42bd7fcac74128409018755c234dc0d2d29c66eb6335c9a910161115b565b6111c2611875565b6001600160a01b0381166112275760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610862565b610792816118cf565b600061062582611c67565b6000806112eb8460098560008151811061125757611257612871565b60200260200101518154811061126f5761126f612871565b6000918252602090912001546040516370a0823160e01b81526001600160a01b038981166004830152909116906370a0823190602401602060405180830381865afa1580156112c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e691906129f3565b611ca7565b9050600061131486838660008151811061130757611307612871565b6020026020010151611cbd565b90506113208682611b3c565b95945050505050565b6001600160a01b03831661138b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610862565b6001600160a01b0382166113ec5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610862565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6107928133611e42565b60005b600c548110156114b5576001600c828154811061147957611479612871565b90600052602060002090602091828204019190066101000a81548160ff02191690831515021790555080806114ad90612a0c565b91505061145a565b506040517f080684993fcc29870167e21abb26431451334f3eb727ac7591fd7253b934179990600090a1565b60006114ed84846110a9565b9050600019811461155557818110156115485760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610862565b6115558484848403611329565b50505050565b6001600160a01b0383166115bf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610862565b6001600160a01b0382166116215760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610862565b6001600160a01b038316600090815260208190526040902054818110156116995760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610862565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611555565b6117098282611e9b565b60008281526008602052604090206107de9082611f21565b61172b8282611f36565b60008281526008602052604090206107de9082611f9d565b6001600160a01b0382166117a35760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610862565b6001600160a01b038216600090815260208190526040902054818110156118175760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610862565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b600f546001600160a01b03163314610d045760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610862565b600f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600c828154811061193657611936612871565b90600052602060002090602091828204019190066101000a81548160ff0219169083151502179055507fdf64dc6e7fb0c6d764fd8e483d791a4710da5311e3f4e1a93d2b20af6ba941548160405161199091815260200190565b60405180910390a150565b60006106ca8383611fb2565b60408051600380825260808201909252606091600091906020820184803683375050600654825192935091829150839060029081106119e8576119e8612871565b60209081029190910101526005548251819084906001908110611a0d57611a0d612871565b60209081029190910101526000611a2482846129b6565b90508587611a328a846129cd565b611a3c91906129b6565b611a46919061284f565b84600081518110611a5957611a59612871565b602090810291909101015250919695505050505050565b6000611a7a6107e3565b611a8690610e106129b6565b600092835260116020526040909220549190911015919050565b600080600086301860601b868686604051602001611ac19493929190612a25565b60408051808303601f1901815291905280516020909101209795881896505050505050565b60008115611b05576002611af983611fdc565b610625911c603f6129e0565b506040919050565b6000611b1b6012600a6129a7565b6001611b28846002612a55565b611b3291906129e0565b61062591906129b6565b6001600160a01b038216611b925760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610862565b8060026000828254611ba491906129cd565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6005548015611c25576004611c1182600f6129b6565b611c1b90856129cd565b901c600555611c2b565b60058390555b6006548015611c55576004611c4182600f6129b6565b611c4b90856129cd565b901c600655611555565b505060065550565b6000610625825490565b60006001600160e01b031982166336372b0760e01b1480611c9857506001600160e01b0319821663a219a02560e01b145b80610625575061062582612070565b6000818310611cb657816106ca565b5090919050565b6000600c8281548110611cd257611cd2612871565b90600052602060002090602091828204019190069054906101000a900460ff1615611d325760405162461bcd60e51b815260206004820152601060248201526f1b5a59dc985d1a5bdb881cd9585b195960821b6044820152606401610862565b600b544290811115611d785760405162461bcd60e51b815260206004820152600f60248201526e191958591b1a5b99481c185cdcd959608a1b6044820152606401610862565b60098381548110611d8b57611d8b612871565b60009182526020909120015460405163079cc67960e41b81526001600160a01b03878116600483015260248201879052909116906379cc679090604401600060405180830381600087803b158015611de257600080fd5b505af1158015611df6573d6000803e3d6000fd5b505050506000841180611e07575083155b611e1357611e13612a61565b6000611e1f8585610b4e565b905080600d6000828254611e3391906129cd565b90915550909695505050505050565b611e4c8282610e0f565b61087557611e598161207b565b611e6483602061208d565b604051602001611e75929190612a77565b60408051601f198184030181529082905262461bcd60e51b82526108629160040161240e565b611ea58282610e0f565b6108755760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611edd3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006106ca836001600160a01b038416612229565b611f408282610e0f565b156108755760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006106ca836001600160a01b038416612278565b6000826000018281548110611fc957611fc9612871565b9060005260206000200154905092915050565b600080608083901c15611ff157608092831c92015b604083901c1561200357604092831c92015b602083901c1561201557602092831c92015b601083901c1561202757601092831c92015b600883901c1561203957600892831c92015b600483901c1561204b57600492831c92015b600283901c1561205d57600292831c92015b600183901c156106255760010192915050565b60006106258261236b565b60606106256001600160a01b03831660145b6060600061209c8360026129b6565b6120a79060026129cd565b67ffffffffffffffff8111156120bf576120bf612441565b6040519080825280601f01601f1916602001820160405280156120e9576020820181803683370190505b509050600360fc1b8160008151811061210457612104612871565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061213357612133612871565b60200101906001600160f81b031916908160001a90535060006121578460026129b6565b6121629060016129cd565b90505b60018111156121da576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061219657612196612871565b1a60f81b8282815181106121ac576121ac612871565b60200101906001600160f81b031916908160001a90535060049490941c936121d381612aec565b9050612165565b5083156106ca5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610862565b600081815260018301602052604081205461227057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610625565b506000610625565b6000818152600183016020526040812054801561236157600061229c6001836129e0565b85549091506000906122b0906001906129e0565b90508181146123155760008660000182815481106122d0576122d0612871565b90600052602060002001549050808760000184815481106122f3576122f3612871565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061232657612326612b03565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610625565b6000915050610625565b60006001600160e01b03198216635a05180f60e01b148061062557506106258260006001600160e01b03198216637965db0b60e01b148061062557506301ffc9a760e01b6001600160e01b0319831614610625565b6000602082840312156123d257600080fd5b81356001600160e01b0319811681146106ca57600080fd5b60005b838110156124055781810151838201526020016123ed565b50506000910152565b602081526000825180602084015261242d8160408501602087016123ea565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261246857600080fd5b8135602067ffffffffffffffff8083111561248557612485612441565b8260051b604051601f19603f830116810181811084821117156124aa576124aa612441565b6040529384528581018301938381019250878511156124c857600080fd5b83870191505b848210156124e7578135835291830191908301906124ce565b979650505050505050565b6000806040838503121561250557600080fd5b82359150602083013567ffffffffffffffff81111561252357600080fd5b61252f85828601612457565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015612573578351151583529284019291840191600101612555565b50909695505050505050565b80356001600160a01b038116811461259657600080fd5b919050565b600080604083850312156125ae57600080fd5b6125b78361257f565b946020939093013593505050565b6000806000606084860312156125da57600080fd5b6125e38461257f565b92506125f16020850161257f565b9150604084013590509250925092565b60006020828403121561261357600080fd5b5035919050565b6000806040838503121561262d57600080fd5b8235915061263d6020840161257f565b90509250929050565b6000806040838503121561265957600080fd5b50508035926020909101359150565b6000806040838503121561267b57600080fd5b6126848361257f565b915061263d6020840161257f565b600080604083850312156126a557600080fd5b6126ae8361257f565b9150602083013580151581146126c357600080fd5b809150509250929050565b6000602082840312156126e057600080fd5b6106ca8261257f565b6000806000606084860312156126fe57600080fd5b6127078461257f565b925060208401359150604084013567ffffffffffffffff81111561272a57600080fd5b61273686828701612457565b9150509250925092565b6020808252825182820181905260009190848201906040850190845b818110156125735783518352928401929184019160010161275c565b6000806000806060858703121561278e57600080fd5b6127978561257f565b935060208501359250604085013567ffffffffffffffff808211156127bb57600080fd5b818701915087601f8301126127cf57600080fd5b8135818111156127de57600080fd5b8860208285010111156127f057600080fd5b95989497505060200194505050565b600181811c9082168061281357607f821691505b60208210810361283357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008261286c57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561289957600080fd5b815160ff811681146106ca57600080fd5b60ff828116828216039081111561062557610625612839565b600181815b808511156128fe5781600019048211156128e4576128e4612839565b808516156128f157918102915b93841c93908002906128c8565b509250929050565b60008261291557506001610625565b8161292257506000610625565b816001811461293857600281146129425761295e565b6001915050610625565b60ff84111561295357612953612839565b50506001821b610625565b5060208310610133831016604e8410600b8410161715612981575081810a610625565b61298b83836128c3565b806000190482111561299f5761299f612839565b029392505050565b60006106ca60ff841683612906565b808202811582820484141761062557610625612839565b8082018082111561062557610625612839565b8181038181111561062557610625612839565b600060208284031215612a0557600080fd5b5051919050565b600060018201612a1e57612a1e612839565b5060010190565b6bffffffffffffffffffffffff198516815283601482015281836034830137600091016034019081529392505050565b60006106ca8383612906565b634e487b7160e01b600052600160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612aaf8160178501602088016123ea565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612ae08160288401602088016123ea565b01602801949350505050565b600081612afb57612afb612839565b506000190190565b634e487b7160e01b600052603160045260246000fdfea26469706673582212205e23ad6be74eca5b1097b68399ae23b8713fd364e3692c0a030be399fa2bea1964736f6c634300081400337df1fa30796d39d0e882422146943ee011c6f6b410f211570cc3a712e3e51e6a00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000007861f80000000000000000000000000000000000000000000000000000000000000001200000000000000000000000074a68215aedf59f317a23e87c13b848a292f27a4000000000000000000000000c63e3b6d0a2d382a74b13d19426b65c0aa5f36480000000000000000000000002c5c3374c216bd8c36d598c40d990eb2a2250ccd0000000000000000000000001ab7b945f50d33cf387fb74eb5f7a092ad03dc810000000000000000000000004353cac32924b45c01c2880f65e75b3795ddfd60000000000000000000000000f0f11d6d86346c541ba2ef2f48ad7a58255cd52b0000000000000000000000000f310c35c006a86bd0df6595b1856ce8ef06bbd3000000000000000000000000551b372ad7a7b85bab113b273fd4c7924dff4071000000000000000000000000c18dbf3ebe65146b60b70fefb686e621267fe8770000000000000000000000001e6ab3d65ad983202ebd92575aa5a168d0d6ebc9000000000000000000000000d8bf63ed3384f32d6cd5af9b72299aadb78729920000000000000000000000008dd3fb456f8d36191d94572802d7715a0665106b000000000000000000000000e2dc552ab6848c2126229554ab3411911c28547b00000000000000000000000028ada872f3ded545a275c3802b731f44d1883f73000000000000000000000000706c35f32c4a1bb783c4c83048467ed9c451152e000000000000000000000000e1448f03c097eb487560b93b4b5bc536faff94ad000000000000000000000000bc340583e3299e43f1e993c61857c3de37e25460000000000000000000000000856cc60002bac150b2738b424677879c02c516cb
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102695760003560e01c806370a0823111610151578063a457c2d7116100c3578063d547741f11610087578063d547741f14610590578063dd62ed3e146105a3578063e1c7392a146105b6578063f2fde38b146105be578063f544c35e146105d1578063fad1919a146105fa57600080fd5b8063a457c2d71461051d578063a9059cbb14610530578063b6483bab14610543578063bb14047014610556578063ca15c8731461057d57600080fd5b80638da5cb5b116101155780638da5cb5b146104ad5780639010d07c146104d257806391d14854146104e557806395d89b41146104f85780639af1d35a14610500578063a217fddf1461051557600080fd5b806370a0823114610443578063715018a61461046c5780637766912d1461047457806379cc67901461048757806386fe212d1461049a57600080fd5b80632c678c64116101ea57806339444ffe116101ae57806339444ffe146103a857806339509351146103bb57806342966c68146103ce578063550c8a69146103e15780636c18080e1461041d5780636c9efc911461043057600080fd5b80632c678c64146103635780632f2ff15d1461036b578063313ce5671461037e578063363487bc1461038d57806336568abe1461039557600080fd5b80630a99e88a116102315780630a99e88a146102f45780630c7fa13e1461031b57806318160ddd1461032557806323b872dd1461032d578063248a9ca31461034057600080fd5b806301ffc9a71461026e57806306fdde0314610296578063080e1301146102ab57806308560eca146102cc578063095ea7b3146102e1575b600080fd5b61028161027c3660046123c0565b61061a565b60405190151581526020015b60405180910390f35b61029e61062b565b60405161028d919061240e565b6102be6102b93660046124f2565b6106bd565b60405190815260200161028d565b6102d46106d1565b60405161028d9190612539565b6102816102ef36600461259b565b610748565b6102be7faa06a9d3e3ec1501dfa4c06793f24ccddc527fa3089263f11fd78652bb9bafdb81565b610323610760565b005b6002546102be565b61028161033b3660046125c5565b610795565b6102be61034e366004612601565b60009081526007602052604090206001015490565b600d546102be565b61032361037936600461261a565b6107b9565b6040516012815260200161028d565b6102be6107e3565b6103236103a336600461261a565b6107f6565b6102be6103b6366004612646565b610879565b6102816103c936600461259b565b610a5e565b6103236103dc366004612601565b610a80565b6102816103ef366004612668565b6001600160a01b039182166000908152600e6020908152604080832093909416825291909152205460ff1690565b61032361042b366004612692565b610a8a565b6102be61043e366004612646565b610b4e565b6102be6104513660046126ce565b6001600160a01b031660009081526020819052604090205490565b610323610cf2565b6102be6104823660046126e9565b610d06565b61032361049536600461259b565b610daf565b6103236104a8366004612601565b610dc4565b600f546001600160a01b03165b6040516001600160a01b03909116815260200161028d565b6104ba6104e0366004612646565b610df7565b6102816104f336600461261a565b610e0f565b61029e610e3a565b610508610e49565b60405161028d9190612740565b6102be600081565b61028161052b36600461259b565b610e6a565b61028161053e36600461259b565b610ee5565b610323610551366004612778565b610ef3565b6102be7f7df1fa30796d39d0e882422146943ee011c6f6b410f211570cc3a712e3e51e6a81565b6102be61058b366004612601565b61106d565b61032361059e36600461261a565b611084565b6102be6105b1366004612668565b6110a9565b6103236110d4565b6103236105cc3660046126ce565b6111ba565b6102be6105df3660046126ce565b6001600160a01b03166000908152600a602052604090205490565b6102be610608366004612601565b60009081526012602052604090205490565b600061062582611230565b92915050565b60606003805461063a906127ff565b80601f0160208091040260200160405190810160405280929190818152602001828054610666906127ff565b80156106b35780601f10610688576101008083540402835291602001916106b3565b820191906000526020600020905b81548152906001019060200180831161069657829003601f168201915b5050505050905090565b60006106ca33848461123b565b9392505050565b6060600c8054806020026020016040519081016040528092919081815260200182805480156106b357602002820191906000526020600020906000905b825461010083900a900460ff16151581526020600192830181810494850194909303909202910180841161070e5790505050505050905090565b600033610756818585611329565b5060019392505050565b7faa06a9d3e3ec1501dfa4c06793f24ccddc527fa3089263f11fd78652bb9bafdb61078a8161144d565b610792611457565b50565b6000336107a38582856114e1565b6107ae85858561155b565b506001949350505050565b6000828152600760205260409020600101546107d48161144d565b6107de83836116ff565b505050565b60006107f1610e104261284f565b905090565b6001600160a01b038116331461086b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108758282611721565b5050565b60006009828154811061088e5761088e612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa1580156108dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109009190612887565b60ff166012106109b8576009828154811061091d5761091d612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa15801561096b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098f9190612887565b60125b61099c91906128aa565b6109a790600a6129a7565b6109b1908461284f565b9050610625565b6012600983815481106109cd576109cd612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa158015610a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3f9190612887565b610a4991906128aa565b610a5490600a6129a7565b6109b190846129b6565b600033610756818585610a7183836110a9565b610a7b91906129cd565b611329565b6107923382611743565b6001600160a01b0382163303610ae25760405162461bcd60e51b815260206004820152601a60248201527f617070726f76696e67206d69677261746520666f722073656c660000000000006044820152606401610862565b336000818152600e602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917fde18c0fde0d143c421bc0b8320f254129857d0bb1b96dcc4ea2b51145177d099910160405180910390a35050565b600060098281548110610b6357610b63612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa158015610bb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd59190612887565b60ff16601210610c6b5760098281548110610bf257610bf2612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa158015610c40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c649190612887565b6012610a3f565b601260098381548110610c8057610c80612871565b600091825260209182902001546040805163313ce56760e01b815290516001600160a01b039092169263313ce567926004808401938290030181865afa158015610cce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109929190612887565b610cfa611875565b610d0460006118cf565b565b60006001600160a01b038416331480610d4257506001600160a01b0384166000908152600e6020908152604080832033845290915290205460ff165b610d9c5760405162461bcd60e51b815260206004820152602560248201527f63616c6c6572206973206e6f7420746f6b656e206f776e6572206f72206170706044820152641c9bdd995960da1b6064820152608401610862565b610da784848461123b565b949350505050565b610dba8233836114e1565b6108758282611743565b7faa06a9d3e3ec1501dfa4c06793f24ccddc527fa3089263f11fd78652bb9bafdb610dee8161144d565b61087582611921565b60008281526008602052604081206106ca908361199b565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606004805461063a906127ff565b60606107f16516750de388006639715a8f3f0a58662386f26fc100006119a7565b60003381610e7882866110a9565b905083811015610ed85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610862565b6107ae8286868403611329565b60003361075681858561155b565b60005a9050610f0184611a70565b610f425760405162461bcd60e51b81526020600482015260126024820152710caf0e0d2e4cac840c4d8dec6d65ad0c2e6d60731b6044820152606401610862565b600080610f5187878787611aa0565b600081815260106020526040902054919350915060ff1615610fac5760405162461bcd60e51b81526020600482015260146024820152730c8eae0d8d2c6c2e8ca40dcdedcc6ca5ad0c2e6d60631b6044820152606401610862565b6000610fb783611ae6565b60ff16905060008111610fff5760405162461bcd60e51b815260206004820152601060248201526f0cadae0e8f240dcdedcc6ca5ad0c2e6d60831b6044820152606401610862565b600061100a82611b0d565b6000848152601060205260409020805460ff19166001179055905061104461103a600f546001600160a01b031690565b600383901c611b3c565b61104e8982611b3c565b505050506110665a61106090836129e0565b3a611bfb565b5050505050565b600081815260086020526040812061062590611c5d565b60008281526007602052604090206001015461109f8161144d565b6107de8383611721565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60006110de6107e3565b600081815260126020526040812054919250036111685760006111026001436129e0565b60008381526012602090815260408083209340938490558383526011825291829020429081905582518481529182018190529293507f2c6c5a9e4f0ddd70b42bd7fcac74128409018755c234dc0d2d29c66eb6335c9a91015b60405180910390a1505050565b6000818152601260209081526040808320548084526011835292819020548151848152928301819052917f2c6c5a9e4f0ddd70b42bd7fcac74128409018755c234dc0d2d29c66eb6335c9a910161115b565b6111c2611875565b6001600160a01b0381166112275760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610862565b610792816118cf565b600061062582611c67565b6000806112eb8460098560008151811061125757611257612871565b60200260200101518154811061126f5761126f612871565b6000918252602090912001546040516370a0823160e01b81526001600160a01b038981166004830152909116906370a0823190602401602060405180830381865afa1580156112c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e691906129f3565b611ca7565b9050600061131486838660008151811061130757611307612871565b6020026020010151611cbd565b90506113208682611b3c565b95945050505050565b6001600160a01b03831661138b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610862565b6001600160a01b0382166113ec5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610862565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6107928133611e42565b60005b600c548110156114b5576001600c828154811061147957611479612871565b90600052602060002090602091828204019190066101000a81548160ff02191690831515021790555080806114ad90612a0c565b91505061145a565b506040517f080684993fcc29870167e21abb26431451334f3eb727ac7591fd7253b934179990600090a1565b60006114ed84846110a9565b9050600019811461155557818110156115485760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610862565b6115558484848403611329565b50505050565b6001600160a01b0383166115bf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610862565b6001600160a01b0382166116215760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610862565b6001600160a01b038316600090815260208190526040902054818110156116995760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610862565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611555565b6117098282611e9b565b60008281526008602052604090206107de9082611f21565b61172b8282611f36565b60008281526008602052604090206107de9082611f9d565b6001600160a01b0382166117a35760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610862565b6001600160a01b038216600090815260208190526040902054818110156118175760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610862565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b600f546001600160a01b03163314610d045760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610862565b600f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600c828154811061193657611936612871565b90600052602060002090602091828204019190066101000a81548160ff0219169083151502179055507fdf64dc6e7fb0c6d764fd8e483d791a4710da5311e3f4e1a93d2b20af6ba941548160405161199091815260200190565b60405180910390a150565b60006106ca8383611fb2565b60408051600380825260808201909252606091600091906020820184803683375050600654825192935091829150839060029081106119e8576119e8612871565b60209081029190910101526005548251819084906001908110611a0d57611a0d612871565b60209081029190910101526000611a2482846129b6565b90508587611a328a846129cd565b611a3c91906129b6565b611a46919061284f565b84600081518110611a5957611a59612871565b602090810291909101015250919695505050505050565b6000611a7a6107e3565b611a8690610e106129b6565b600092835260116020526040909220549190911015919050565b600080600086301860601b868686604051602001611ac19493929190612a25565b60408051808303601f1901815291905280516020909101209795881896505050505050565b60008115611b05576002611af983611fdc565b610625911c603f6129e0565b506040919050565b6000611b1b6012600a6129a7565b6001611b28846002612a55565b611b3291906129e0565b61062591906129b6565b6001600160a01b038216611b925760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610862565b8060026000828254611ba491906129cd565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6005548015611c25576004611c1182600f6129b6565b611c1b90856129cd565b901c600555611c2b565b60058390555b6006548015611c55576004611c4182600f6129b6565b611c4b90856129cd565b901c600655611555565b505060065550565b6000610625825490565b60006001600160e01b031982166336372b0760e01b1480611c9857506001600160e01b0319821663a219a02560e01b145b80610625575061062582612070565b6000818310611cb657816106ca565b5090919050565b6000600c8281548110611cd257611cd2612871565b90600052602060002090602091828204019190069054906101000a900460ff1615611d325760405162461bcd60e51b815260206004820152601060248201526f1b5a59dc985d1a5bdb881cd9585b195960821b6044820152606401610862565b600b544290811115611d785760405162461bcd60e51b815260206004820152600f60248201526e191958591b1a5b99481c185cdcd959608a1b6044820152606401610862565b60098381548110611d8b57611d8b612871565b60009182526020909120015460405163079cc67960e41b81526001600160a01b03878116600483015260248201879052909116906379cc679090604401600060405180830381600087803b158015611de257600080fd5b505af1158015611df6573d6000803e3d6000fd5b505050506000841180611e07575083155b611e1357611e13612a61565b6000611e1f8585610b4e565b905080600d6000828254611e3391906129cd565b90915550909695505050505050565b611e4c8282610e0f565b61087557611e598161207b565b611e6483602061208d565b604051602001611e75929190612a77565b60408051601f198184030181529082905262461bcd60e51b82526108629160040161240e565b611ea58282610e0f565b6108755760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611edd3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006106ca836001600160a01b038416612229565b611f408282610e0f565b156108755760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006106ca836001600160a01b038416612278565b6000826000018281548110611fc957611fc9612871565b9060005260206000200154905092915050565b600080608083901c15611ff157608092831c92015b604083901c1561200357604092831c92015b602083901c1561201557602092831c92015b601083901c1561202757601092831c92015b600883901c1561203957600892831c92015b600483901c1561204b57600492831c92015b600283901c1561205d57600292831c92015b600183901c156106255760010192915050565b60006106258261236b565b60606106256001600160a01b03831660145b6060600061209c8360026129b6565b6120a79060026129cd565b67ffffffffffffffff8111156120bf576120bf612441565b6040519080825280601f01601f1916602001820160405280156120e9576020820181803683370190505b509050600360fc1b8160008151811061210457612104612871565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061213357612133612871565b60200101906001600160f81b031916908160001a90535060006121578460026129b6565b6121629060016129cd565b90505b60018111156121da576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061219657612196612871565b1a60f81b8282815181106121ac576121ac612871565b60200101906001600160f81b031916908160001a90535060049490941c936121d381612aec565b9050612165565b5083156106ca5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610862565b600081815260018301602052604081205461227057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610625565b506000610625565b6000818152600183016020526040812054801561236157600061229c6001836129e0565b85549091506000906122b0906001906129e0565b90508181146123155760008660000182815481106122d0576122d0612871565b90600052602060002001549050808760000184815481106122f3576122f3612871565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061232657612326612b03565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610625565b6000915050610625565b60006001600160e01b03198216635a05180f60e01b148061062557506106258260006001600160e01b03198216637965db0b60e01b148061062557506301ffc9a760e01b6001600160e01b0319831614610625565b6000602082840312156123d257600080fd5b81356001600160e01b0319811681146106ca57600080fd5b60005b838110156124055781810151838201526020016123ed565b50506000910152565b602081526000825180602084015261242d8160408501602087016123ea565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261246857600080fd5b8135602067ffffffffffffffff8083111561248557612485612441565b8260051b604051601f19603f830116810181811084821117156124aa576124aa612441565b6040529384528581018301938381019250878511156124c857600080fd5b83870191505b848210156124e7578135835291830191908301906124ce565b979650505050505050565b6000806040838503121561250557600080fd5b82359150602083013567ffffffffffffffff81111561252357600080fd5b61252f85828601612457565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015612573578351151583529284019291840191600101612555565b50909695505050505050565b80356001600160a01b038116811461259657600080fd5b919050565b600080604083850312156125ae57600080fd5b6125b78361257f565b946020939093013593505050565b6000806000606084860312156125da57600080fd5b6125e38461257f565b92506125f16020850161257f565b9150604084013590509250925092565b60006020828403121561261357600080fd5b5035919050565b6000806040838503121561262d57600080fd5b8235915061263d6020840161257f565b90509250929050565b6000806040838503121561265957600080fd5b50508035926020909101359150565b6000806040838503121561267b57600080fd5b6126848361257f565b915061263d6020840161257f565b600080604083850312156126a557600080fd5b6126ae8361257f565b9150602083013580151581146126c357600080fd5b809150509250929050565b6000602082840312156126e057600080fd5b6106ca8261257f565b6000806000606084860312156126fe57600080fd5b6127078461257f565b925060208401359150604084013567ffffffffffffffff81111561272a57600080fd5b61273686828701612457565b9150509250925092565b6020808252825182820181905260009190848201906040850190845b818110156125735783518352928401929184019160010161275c565b6000806000806060858703121561278e57600080fd5b6127978561257f565b935060208501359250604085013567ffffffffffffffff808211156127bb57600080fd5b818701915087601f8301126127cf57600080fd5b8135818111156127de57600080fd5b8860208285010111156127f057600080fd5b95989497505060200194505050565b600181811c9082168061281357607f821691505b60208210810361283357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008261286c57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561289957600080fd5b815160ff811681146106ca57600080fd5b60ff828116828216039081111561062557610625612839565b600181815b808511156128fe5781600019048211156128e4576128e4612839565b808516156128f157918102915b93841c93908002906128c8565b509250929050565b60008261291557506001610625565b8161292257506000610625565b816001811461293857600281146129425761295e565b6001915050610625565b60ff84111561295357612953612839565b50506001821b610625565b5060208310610133831016604e8410600b8410161715612981575081810a610625565b61298b83836128c3565b806000190482111561299f5761299f612839565b029392505050565b60006106ca60ff841683612906565b808202811582820484141761062557610625612839565b8082018082111561062557610625612839565b8181038181111561062557610625612839565b600060208284031215612a0557600080fd5b5051919050565b600060018201612a1e57612a1e612839565b5060010190565b6bffffffffffffffffffffffff198516815283601482015281836034830137600091016034019081529392505050565b60006106ca8383612906565b634e487b7160e01b600052600160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612aaf8160178501602088016123ea565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612ae08160288401602088016123ea565b01602801949350505050565b600081612afb57612afb612839565b506000190190565b634e487b7160e01b600052603160045260246000fdfea26469706673582212205e23ad6be74eca5b1097b68399ae23b8713fd364e3692c0a030be399fa2bea1964736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000007861f80000000000000000000000000000000000000000000000000000000000000001200000000000000000000000074a68215aedf59f317a23e87c13b848a292f27a4000000000000000000000000c63e3b6d0a2d382a74b13d19426b65c0aa5f36480000000000000000000000002c5c3374c216bd8c36d598c40d990eb2a2250ccd0000000000000000000000001ab7b945f50d33cf387fb74eb5f7a092ad03dc810000000000000000000000004353cac32924b45c01c2880f65e75b3795ddfd60000000000000000000000000f0f11d6d86346c541ba2ef2f48ad7a58255cd52b0000000000000000000000000f310c35c006a86bd0df6595b1856ce8ef06bbd3000000000000000000000000551b372ad7a7b85bab113b273fd4c7924dff4071000000000000000000000000c18dbf3ebe65146b60b70fefb686e621267fe8770000000000000000000000001e6ab3d65ad983202ebd92575aa5a168d0d6ebc9000000000000000000000000d8bf63ed3384f32d6cd5af9b72299aadb78729920000000000000000000000008dd3fb456f8d36191d94572802d7715a0665106b000000000000000000000000e2dc552ab6848c2126229554ab3411911c28547b00000000000000000000000028ada872f3ded545a275c3802b731f44d1883f73000000000000000000000000706c35f32c4a1bb783c4c83048467ed9c451152e000000000000000000000000e1448f03c097eb487560b93b4b5bc536faff94ad000000000000000000000000bc340583e3299e43f1e993c61857c3de37e25460000000000000000000000000856cc60002bac150b2738b424677879c02c516cb
-----Decoded View---------------
Arg [0] : moeBase (address[]): 0x74A68215AEdf59f317a23E87C13B848a292F27A4,0xc63e3B6D0a2d382A74B13D19426b65C0aa5F3648,0x2c5C3374c216BD8C36d598C40d990Eb2a2250cCD,0x1Ab7b945f50D33cF387Fb74eB5f7a092aD03dc81,0x4353CaC32924b45C01c2880F65E75B3795DDFd60,0xF0F11D6d86346C541bA2eF2f48ad7A58255Cd52B,0x0f310C35C006a86BD0Df6595B1856ce8Ef06Bbd3,0x551b372ad7A7b85BaB113B273fd4c7924dfF4071,0xC18dBF3Ebe65146B60b70fEfb686E621267Fe877,0x1e6AB3d65Ad983202ebD92575aA5a168D0D6EBC9,0xd8bF63eD3384f32d6CD5Af9B72299AadB7872992,0x8dd3fB456f8d36191D94572802D7715a0665106B,0xe2Dc552ab6848C2126229554ab3411911C28547b,0x28ADA872f3deD545A275c3802b731F44D1883f73,0x706c35f32C4a1bb783C4C83048467ED9c451152E,0xE1448F03c097eB487560B93b4B5Bc536faFF94ad,0xBc340583e3299E43f1E993C61857c3DE37E25460,0x856cc60002Bac150b2738B424677879c02c516cb
Arg [1] : deadlineIn (uint256): 126230400
-----Encoded View---------------
21 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000007861f80
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000012
Arg [3] : 00000000000000000000000074a68215aedf59f317a23e87c13b848a292f27a4
Arg [4] : 000000000000000000000000c63e3b6d0a2d382a74b13d19426b65c0aa5f3648
Arg [5] : 0000000000000000000000002c5c3374c216bd8c36d598c40d990eb2a2250ccd
Arg [6] : 0000000000000000000000001ab7b945f50d33cf387fb74eb5f7a092ad03dc81
Arg [7] : 0000000000000000000000004353cac32924b45c01c2880f65e75b3795ddfd60
Arg [8] : 000000000000000000000000f0f11d6d86346c541ba2ef2f48ad7a58255cd52b
Arg [9] : 0000000000000000000000000f310c35c006a86bd0df6595b1856ce8ef06bbd3
Arg [10] : 000000000000000000000000551b372ad7a7b85bab113b273fd4c7924dff4071
Arg [11] : 000000000000000000000000c18dbf3ebe65146b60b70fefb686e621267fe877
Arg [12] : 0000000000000000000000001e6ab3d65ad983202ebd92575aa5a168d0d6ebc9
Arg [13] : 000000000000000000000000d8bf63ed3384f32d6cd5af9b72299aadb7872992
Arg [14] : 0000000000000000000000008dd3fb456f8d36191d94572802d7715a0665106b
Arg [15] : 000000000000000000000000e2dc552ab6848c2126229554ab3411911c28547b
Arg [16] : 00000000000000000000000028ada872f3ded545a275c3802b731f44d1883f73
Arg [17] : 000000000000000000000000706c35f32c4a1bb783c4c83048467ed9c451152e
Arg [18] : 000000000000000000000000e1448f03c097eb487560b93b4b5bc536faff94ad
Arg [19] : 000000000000000000000000bc340583e3299e43f1e993c61857c3de37e25460
Arg [20] : 000000000000000000000000856cc60002bac150b2738b424677879c02c516cb
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 29 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.