ERC-20
Overview
Max Total Supply
511.721433224654132025 pxBTRFLY
Holders
30
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
0.000018279294437448 pxBTRFLYValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
PxBtrfly
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol"; import {Pausable} from "openzeppelin-contracts/contracts/security/Pausable.sol"; import {ERC20SnapshotSolmate} from "src/tokens/ERC20SnapshotSolmate.sol"; contract PxBtrfly is ERC20SnapshotSolmate("Pirex BTRFLY", "pxBTRFLY", 18), Ownable { /** @notice Epoch details Reward/snapshotRewards/futuresRewards indexes are associated with 1 reward @param snapshotId uint256 Snapshot id @param rewards bytes32[] Rewards @param snapshotRewards uint256[] Snapshot reward amounts @param futuresRewards uint256[] Futures reward amounts @param redeemedSnapshotRewards mapping Redeemed snapshot rewards */ struct Epoch { uint256 snapshotId; bytes32[] rewards; uint256[] snapshotRewards; uint256[] futuresRewards; mapping(address => uint256) redeemedSnapshotRewards; } // Address of currently assigned operator address public operator; // Epochs mapped to epoch details mapping(uint256 => Epoch) private epochs; // Tracks cumulative total amount of rewards per token mapping(address => uint256) public cumulativeRewardsByToken; event SetOperator(address operator); event UpdateEpochFuturesRewards( uint256 indexed epoch, uint256[] futuresRewards ); error NotAuthorized(); error NoOperator(); error Paused(); error ZeroAddress(); error ZeroAmount(); error InvalidEpoch(); error InvalidFuturesRewards(); error MismatchedFuturesRewards(); modifier onlyOperator() { if (msg.sender != operator) revert NotAuthorized(); _; } modifier onlyOperatorOrNotPaused() { address _operator = operator; // Ensure an operator is set if (_operator == address(0)) revert NoOperator(); // This contract shares the same pause state as the operator if (msg.sender != _operator && Pausable(_operator).paused()) revert Paused(); _; } /** @notice Set a new operator address @param _operator address New operator address */ function setOperator(address _operator) external onlyOwner { if (_operator == address(0)) revert ZeroAddress(); emit SetOperator(_operator); // If it's the first operator, also set up 1st epoch with snapshot id 1 // and prevent reward claims until subsequent epochs if (operator == address(0)) { uint256 currentEpoch = getCurrentEpoch(); epochs[currentEpoch].snapshotId = _snapshot(); } operator = _operator; } /** @notice Return the current snapshotId @return uint256 Current snapshot id */ function getCurrentSnapshotId() external view returns (uint256) { return _getCurrentSnapshotId(); } /** @notice Get current epoch @return uint256 Current epoch */ function getCurrentEpoch() public view returns (uint256) { return (block.timestamp / 1209600) * 1209600; } /** @notice Get epoch @param epoch uint256 Epoch @return snapshotId uint256 Snapshot id @return rewards address[] Reward tokens @return snapshotRewards uint256[] Snapshot reward amounts @return futuresRewards uint256[] Futures reward amounts */ function getEpoch(uint256 epoch) external view returns ( uint256 snapshotId, bytes32[] memory rewards, uint256[] memory snapshotRewards, uint256[] memory futuresRewards ) { Epoch storage e = epochs[epoch]; return (e.snapshotId, e.rewards, e.snapshotRewards, e.futuresRewards); } /** @notice Get redeemed snapshot rewards bitmap @param account address Account @param epoch uint256 Epoch @return uint256 Redeemed snapshot bitmap */ function getEpochRedeemedSnapshotRewards(address account, uint256 epoch) external view returns (uint256) { return epochs[epoch].redeemedSnapshotRewards[account]; } /** @notice Add new epoch reward metadata @param epoch uint256 Epoch @param token address Token address @param snapshotReward uint256 Snapshot reward amount @param futuresReward uint256 Futures reward amount */ function addEpochRewardMetadata( uint256 epoch, bytes32 token, uint256 snapshotReward, uint256 futuresReward ) external onlyOperator { Epoch storage e = epochs[epoch]; e.rewards.push(token); e.snapshotRewards.push(snapshotReward); e.futuresRewards.push(futuresReward); } /** @notice Set redeemed snapshot rewards bitmap @param account address Account @param epoch uint256 Epoch @param redeemed uint256 Redeemed bitmap */ function setEpochRedeemedSnapshotRewards( address account, uint256 epoch, uint256 redeemed ) external onlyOperator { epochs[epoch].redeemedSnapshotRewards[account] = redeemed; } /** @notice Update epoch futures rewards to reflect amounts remaining after redemptions @param epoch uint256 Epoch @param futuresRewards uint256[] Futures rewards */ function updateEpochFuturesRewards( uint256 epoch, uint256[] memory futuresRewards ) external onlyOperator { if (epoch == 0) revert InvalidEpoch(); uint256 fLen = epochs[epoch].futuresRewards.length; if (fLen == 0) revert InvalidEpoch(); if (futuresRewards.length == 0) revert InvalidFuturesRewards(); if (futuresRewards.length != fLen) revert MismatchedFuturesRewards(); epochs[epoch].futuresRewards = futuresRewards; emit UpdateEpochFuturesRewards(epoch, futuresRewards); } /** @notice Update amount of cumulative rewards for the specified reward token @param token address Reward token address @param amount uint256 Amount of reward */ function updateCumulativeRewardsByToken(address token, uint256 amount) external onlyOperator { cumulativeRewardsByToken[token] = amount; } /** @notice Mint the specified amount of tokens to the specified account @param account address Receiver of the tokens @param amount uint256 Amount to be minted */ function mint(address account, uint256 amount) external onlyOperator { if (account == address(0)) revert ZeroAddress(); if (amount == 0) revert ZeroAmount(); _mint(account, amount); } /** @notice Burn the specified amount of tokens from the specified account @param account address Owner of the tokens @param amount uint256 Amount to be burned */ function burn(address account, uint256 amount) external onlyOperator { if (account == address(0)) revert ZeroAddress(); if (amount == 0) revert ZeroAmount(); _burn(account, amount); } /** @notice Approve allowances by operator with specified accounts and amount @param from address Owner of the tokens @param to address Account to be approved @param amount uint256 Amount to be approved */ function operatorApprove( address from, address to, uint256 amount ) external onlyOperator { if (from == address(0)) revert ZeroAddress(); if (to == address(0)) revert ZeroAddress(); if (amount == 0) revert ZeroAmount(); _approve(from, to, amount); } /** @notice Snapshot token balances for the current epoch */ function takeEpochSnapshot() external onlyOperatorOrNotPaused { uint256 currentEpoch = getCurrentEpoch(); // If snapshot has not been set for current epoch, take snapshot if (epochs[currentEpoch].snapshotId == 0) { epochs[currentEpoch].snapshotId = _snapshot(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _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.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Snapshot.sol) pragma solidity ^0.8.0; import {Arrays} from "openzeppelin-contracts/contracts/utils/Arrays.sol"; import {Counters} from "openzeppelin-contracts/contracts/utils/Counters.sol"; import {ECDSA} from "openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol"; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval( address indexed owner, address indexed spender, uint256 amount ); /*/////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*/////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*/////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*/////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*/////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function _approve( address owner, address spender, uint256 amount ) internal { allowance[owner][spender] = amount; emit Approval(owner, spender, amount); } function transfer(address to, uint256 amount) public virtual returns (bool) { _beforeTokenTransfer(msg.sender, to, amount); balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { _beforeTokenTransfer(from, to, amount); uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*/////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ECDSA.recover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require( recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER" ); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*/////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { _beforeTokenTransfer(address(0), to, amount); totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { _beforeTokenTransfer(from, address(0), amount); balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), 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 This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and * total supply at the time are recorded for later access. * * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting. * In naive implementations it's possible to perform a "double spend" attack by reusing the same balance from different * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be * used to create an efficient ERC20 forking mechanism. * * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id * and the account address. * * NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it * return `block.number` will trigger the creation of snapshot at the begining of each new block. When overridding this * function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract. * * Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient * alternative consider {ERC20Votes}. * * ==== Gas Costs * * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much * smaller since identical balances in subsequent snapshots are stored as a single entry. * * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent * transfers will have normal cost until the next snapshot, and so on. */ contract ERC20SnapshotSolmate is ERC20 { // Inspired by Jordi Baylina's MiniMeToken to record historical balances: // https://github.com/Giveth/minimd/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol using Arrays for uint256[]; using Counters for Counters.Counter; // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a // Snapshot struct, but that would impede usage of functions that work on an array. struct Snapshots { uint256[] ids; uint256[] values; } mapping(address => Snapshots) private _accountBalanceSnapshots; Snapshots private _totalSupplySnapshots; // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid. Counters.Counter private _currentSnapshotId; /** * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created. */ event Snapshot(uint256 id); constructor( string memory _name, string memory _symbol, uint8 _decimals ) ERC20(_name, _symbol, _decimals) {} /** * @dev Creates a new snapshot and returns its snapshot id. * * Emits a {Snapshot} event that contains the same id. * * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a * set of accounts, for example using {AccessControl}, or it may be open to the public. * * [WARNING] * ==== * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking, * you must consider that it can potentially be used by attackers in two ways. * * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs * section above. * * We haven't measured the actual numbers; if this is something you're interested in please reach out to us. * ==== */ function _snapshot() internal virtual returns (uint256) { _currentSnapshotId.increment(); uint256 currentId = _getCurrentSnapshotId(); emit Snapshot(currentId); return currentId; } /** * @dev Get the current snapshotId */ function _getCurrentSnapshotId() internal view virtual returns (uint256) { return _currentSnapshotId.current(); } /** * @dev Retrieves the balance of `account` at the time `snapshotId` was created. */ function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) { (bool snapshotted, uint256 value) = _valueAt( snapshotId, _accountBalanceSnapshots[account] ); return snapshotted ? value : balanceOf[account]; } /** * @dev Retrieves the total supply at the time `snapshotId` was created. */ function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) { (bool snapshotted, uint256 value) = _valueAt( snapshotId, _totalSupplySnapshots ); return snapshotted ? value : totalSupply; } // Update balance and/or total supply snapshots before the values are modified. This is implemented // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations. function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); if (from == address(0)) { // mint _updateAccountSnapshot(to); _updateTotalSupplySnapshot(); } else if (to == address(0)) { // burn _updateAccountSnapshot(from); _updateTotalSupplySnapshot(); } else { // transfer _updateAccountSnapshot(from); _updateAccountSnapshot(to); } } function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) { require(snapshotId > 0, "ERC20Snapshot: id is 0"); require( snapshotId <= _getCurrentSnapshotId(), "ERC20Snapshot: nonexistent id" ); // When a valid snapshot is queried, there are three possibilities: // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds // to this id is the current one. // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the // requested id, and its value is the one to return. // c) More snapshots were created after the requested one, and the queried value was later modified. There will be // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is // larger than the requested one. // // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does // exactly this. uint256 index = snapshots.ids.findUpperBound(snapshotId); if (index == snapshots.ids.length) { return (false, 0); } else { return (true, snapshots.values[index]); } } function _updateAccountSnapshot(address account) private { _updateSnapshot(_accountBalanceSnapshots[account], balanceOf[account]); } function _updateTotalSupplySnapshot() private { _updateSnapshot(_totalSupplySnapshots, totalSupply); } function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private { uint256 currentId = _getCurrentSnapshotId(); if (_lastSnapshotId(snapshots.ids) < currentId) { snapshots.ids.push(currentId); snapshots.values.push(currentValue); } } function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) { uint256 idsLen = ids.length; if (idsLen == 0) { return 0; } else { return ids[idsLen - 1]; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Arrays.sol) pragma solidity ^0.8.0; import "./StorageSlot.sol"; import "./math/Math.sol"; /** * @dev Collection of functions related to array types. */ library Arrays { using StorageSlot for bytes32; /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * * `array` is expected to be sorted in ascending order, and to contain no * repeated elements. */ function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { if (array.length == 0) { return 0; } uint256 low = 0; uint256 high = array.length; while (low < high) { uint256 mid = Math.average(low, high); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds down (it does integer division with truncation). if (unsafeAccess(array, mid).value > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && unsafeAccess(array, low - 1).value == element) { return low - 1; } else { return low; } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getAddressSlot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getBytes32Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.17/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getUint256Slot(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. 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 10, 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.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.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 `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); } }
{ "remappings": [ "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"InvalidEpoch","type":"error"},{"inputs":[],"name":"InvalidFuturesRewards","type":"error"},{"inputs":[],"name":"MismatchedFuturesRewards","type":"error"},{"inputs":[],"name":"NoOperator","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","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":false,"internalType":"address","name":"operator","type":"address"}],"name":"SetOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Snapshot","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":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"futuresRewards","type":"uint256[]"}],"name":"UpdateEpochFuturesRewards","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"bytes32","name":"token","type":"bytes32"},{"internalType":"uint256","name":"snapshotReward","type":"uint256"},{"internalType":"uint256","name":"futuresReward","type":"uint256"}],"name":"addEpochRewardMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","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":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"balanceOfAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"cumulativeRewardsByToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentSnapshotId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpoch","outputs":[{"internalType":"uint256","name":"snapshotId","type":"uint256"},{"internalType":"bytes32[]","name":"rewards","type":"bytes32[]"},{"internalType":"uint256[]","name":"snapshotRewards","type":"uint256[]"},{"internalType":"uint256[]","name":"futuresRewards","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"getEpochRedeemedSnapshotRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"operatorApprove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"redeemed","type":"uint256"}],"name":"setEpochRedeemedSnapshotRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"takeEpochSnapshot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"totalSupplyAt","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"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"updateCumulativeRewardsByToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256[]","name":"futuresRewards","type":"uint256[]"}],"name":"updateEpochFuturesRewards","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b506040518060400160405280600c81526020016b506972657820425452464c5960a01b815250604051806040016040528060088152602001677078425452464c5960c01b815250601282828282600090816200006e919062000250565b5060016200007d838262000250565b5060ff81166080524660a05262000093620000b9565b60c05250620000b39450620000ad93505062000155915050565b62000159565b6200039a565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620000ed91906200031c565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620001d657607f821691505b602082108103620001f757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200024b57600081815260208120601f850160051c81016020861015620002265750805b601f850160051c820191505b81811015620002475782815560010162000232565b5050505b505050565b81516001600160401b038111156200026c576200026c620001ab565b62000284816200027d8454620001c1565b84620001fd565b602080601f831160018114620002bc5760008415620002a35750858301515b600019600386901b1c1916600185901b17855562000247565b600085815260208120601f198616915b82811015620002ed57888601518255948401946001909101908401620002cc565b50858210156200030c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008083546200032c81620001c1565b600182811680156200034757600181146200035d576200038e565b60ff19841687528215158302870194506200038e565b8760005260208060002060005b85811015620003855781548a8201529084019082016200036a565b50505082870194505b50929695505050505050565b60805160a05160c051611f93620003ca600039600061084d01526000610818015260006102f90152611f936000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c806370a082311161010f5780639dc29fac116100a2578063bc0bc6ba11610071578063bc0bc6ba14610471578063d505accf14610494578063dd62ed3e146104a7578063f2fde38b146104d257600080fd5b80639dc29fac14610430578063a9059cbb14610443578063b3ab15fb14610456578063b97dd9e21461046957600080fd5b80638da5cb5b116100de5780638da5cb5b146103f15780638dcc05831461040257806395d89b4114610415578063981b24d01461041d57600080fd5b806370a0823114610396578063715018a6146103b6578063734b1d87146103be5780637ecebe00146103d157600080fd5b806323b872dd116101875780634108d57c116101565780634108d57c146103485780634ee2cd7e146103505780635439ad8614610363578063570ca7351461036b57600080fd5b806323b872dd146102e1578063313ce567146102f45780633644e5151461032d57806340c10f191461033557600080fd5b806318160ddd116101c357806318160ddd1461025e5780631d815629146102755780631e38bf3114610295578063206e4f07146102a857600080fd5b806306fdde03146101f5578063095ea7b3146102135780630c2970291461023657806311c08d191461024b575b600080fd5b6101fd6104e5565b60405161020a91906119f4565b60405180910390f35b610226610221366004611a5e565b610573565b604051901515815260200161020a565b610249610244366004611a88565b6105e0565b005b610249610259366004611a5e565b61068a565b61026760025481565b60405190815260200161020a565b610267610283366004611ac4565b600d6020526000908152604090205481565b6102496102a3366004611adf565b6106d1565b6102676102b6366004611a5e565b6000908152600c602090815260408083206001600160a01b0394909416835260049093019052205490565b6102266102ef366004611a88565b610727565b61031b7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff909116815260200161020a565b610267610814565b610249610343366004611a5e565b61086f565b6102496108f0565b61026761035e366004611a5e565b6109ea565b610267610a43565b600b5461037e906001600160a01b031681565b6040516001600160a01b03909116815260200161020a565b6102676103a4366004611ac4565b60036020526000908152604090205481565b610249610a4d565b6102496103cc366004611b28565b610a61565b6102676103df366004611ac4565b60056020526000908152604090205481565b600a546001600160a01b031661037e565b610249610410366004611bf2565b610b86565b6101fd610c02565b61026761042b366004611c24565b610c0f565b61024961043e366004611a5e565b610c3a565b610226610451366004611a5e565b610cb7565b610249610464366004611ac4565b610d28565b610267610dea565b61048461047f366004611c24565b610e06565b60405161020a9493929190611c78565b6102496104a2366004611cee565b610f2f565b6102676104b5366004611d61565b600460209081526000928352604080842090915290825290205481565b6102496104e0366004611ac4565b611129565b600080546104f290611d94565b80601f016020809104026020016040519081016040528092919081815260200182805461051e90611d94565b801561056b5780601f106105405761010080835404028352916020019161056b565b820191906000526020600020905b81548152906001019060200180831161054e57829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906105ce9086815260200190565b60405180910390a35060015b92915050565b600b546001600160a01b0316331461060b5760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b0383166106325760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0382166106595760405163d92e233d60e01b815260040160405180910390fd5b8060000361067a57604051631f2a200560e01b815260040160405180910390fd5b6106858383836111a2565b505050565b600b546001600160a01b031633146106b55760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b039091166000908152600d6020526040902055565b600b546001600160a01b031633146106fc5760405163ea8e4eb560e01b815260040160405180910390fd5b6000918252600c602090815260408084206001600160a01b0390951684526004909401905291902055565b6000610734848484611203565b6001600160a01b038416600090815260046020908152604080832033845290915290205460001981146107905761076b8382611dde565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906107b8908490611dde565b90915550506001600160a01b0380851660008181526003602052604090819020805487019055519091871690600080516020611f3e833981519152906108019087815260200190565b60405180910390a3506001949350505050565b60007f0000000000000000000000000000000000000000000000000000000000000000461461084a5761084561124b565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b600b546001600160a01b0316331461089a5760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b0382166108c15760405163d92e233d60e01b815260040160405180910390fd5b806000036108e257604051631f2a200560e01b815260040160405180910390fd5b6108ec82826112e5565b5050565b600b546001600160a01b03168061091a576040516337ff16a960e01b815260040160405180910390fd5b336001600160a01b038216148015906109905750806001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561096c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109909190611df1565b156109ae576040516313d0ff5960e31b815260040160405180910390fd5b60006109b8610dea565b6000818152600c6020526040812054919250036108ec576109d761134b565b6000828152600c60205260409020555050565b6001600160a01b038216600090815260066020526040812081908190610a119085906113a5565b9150915081610a38576001600160a01b038516600090815260036020526040902054610a3a565b805b95945050505050565b600061084561149b565b610a556114a6565b610a5f6000611500565b565b600b546001600160a01b03163314610a8c5760405163ea8e4eb560e01b815260040160405180910390fd5b81600003610aad5760405163d5b25b6360e01b815260040160405180910390fd5b6000828152600c602052604081206003015490819003610ae05760405163d5b25b6360e01b815260040160405180910390fd5b8151600003610b0257604051631b7d775760e01b815260040160405180910390fd5b80825114610b23576040516324d96f8960e11b815260040160405180910390fd5b6000838152600c602090815260409091208351610b4892600390920191850190611994565b50827fd14f4d687c7695013d50cc578614c3f9cc3402759ab997d52ffeacc02515026383604051610b799190611e13565b60405180910390a2505050565b600b546001600160a01b03163314610bb15760405163ea8e4eb560e01b815260040160405180910390fd5b6000938452600c602090815260408520600180820180548083018255908852838820019590955560028101805480870182559087528287200193909355600390920180549384018155845292200155565b600180546104f290611d94565b6000806000610c1f8460076113a5565b9150915081610c3057600254610c32565b805b949350505050565b600b546001600160a01b03163314610c655760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b038216610c8c5760405163d92e233d60e01b815260040160405180910390fd5b80600003610cad57604051631f2a200560e01b815260040160405180910390fd5b6108ec8282611552565b6000610cc4338484611203565b3360009081526003602052604081208054849290610ce3908490611dde565b90915550506001600160a01b03831660008181526003602052604090819020805485019055513390600080516020611f3e833981519152906105ce9086815260200190565b610d306114a6565b6001600160a01b038116610d575760405163d92e233d60e01b815260040160405180910390fd5b6040516001600160a01b03821681527fdbebfba65bd6398fb722063efc10c99f624f9cd8ba657201056af918a676d5ee9060200160405180910390a1600b546001600160a01b0316610dc8576000610dad610dea565b9050610db761134b565b6000918252600c6020526040909120555b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610df96212750042611e26565b6108459062127500611e48565b6000818152600c6020908152604080832080546001820180548451818702810187019095528085526060958695869594939260028601926003870192918591830182828015610e7457602002820191906000526020600020905b815481526020019060010190808311610e60575b5050505050925081805480602002602001604051908101604052809291908181526020018280548015610ec657602002820191906000526020600020905b815481526020019060010190808311610eb2575b5050505050915080805480602002602001604051908101604052809291908181526020018280548015610f1857602002820191906000526020600020905b815481526020019060010190808311610f04575b505050505090509450945094509450509193509193565b42841015610f845760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b6000611058610f91610814565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301825280519084012061190160f01b6101008401526101028301949094526101228083019490945280518083039094018452610142909101905281519101208585856115c0565b90506001600160a01b038116158015906110835750876001600160a01b0316816001600160a01b0316145b6110c05760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610f7b565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6111316114a6565b6001600160a01b0381166111965760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610f7b565b61119f81611500565b50565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112225761121a826115e8565b610685611616565b6001600160a01b0382166112395761121a836115e8565b611242836115e8565b610685826115e8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600060405161127d9190611e5f565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6112f160008383611203565b80600260008282546113039190611efe565b90915550506001600160a01b038216600081815260036020908152604080832080548601905551848152600080516020611f3e83398151915291015b60405180910390a35050565b600061135b600980546001019055565b600061136561149b565b90507f8030e83b04d87bef53480e26263266d6ca66863aa8506aca6f2559d18aa1cb678160405161139891815260200190565b60405180910390a1919050565b600080600084116113f15760405162461bcd60e51b815260206004820152601660248201527504552433230536e617073686f743a20696420697320360541b6044820152606401610f7b565b6113f961149b565b8411156114485760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e742069640000006044820152606401610f7b565b60006114548486611623565b8454909150810361146c576000809250925050611494565b600184600101828154811061148357611483611f11565b906000526020600020015492509250505b9250929050565b600061084560095490565b600a546001600160a01b03163314610a5f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610f7b565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61155e82600083611203565b6001600160a01b03821660009081526003602052604081208054839290611586908490611dde565b90915550506002805482900390556040518181526000906001600160a01b03841690600080516020611f3e8339815191529060200161133f565b60008060006115d1878787876116d0565b915091506115de81611794565b5095945050505050565b6001600160a01b038116600090815260066020908152604080832060039092529091205461119f91906118de565b610a5f60076002546118de565b81546000908103611636575060006105da565b82546000905b808210156116835760006116508383611928565b6000878152602090209091508590820154111561166f5780915061167d565b61167a816001611efe565b92505b5061163c565b6000821180156116af5750836116ac8661169e600186611dde565b600091825260209091200190565b54145b156116c8576116bf600183611dde565b925050506105da565b5090506105da565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611707575060009050600361178b565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561175b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166117845760006001925092505061178b565b9150600090505b94509492505050565b60008160048111156117a8576117a8611f27565b036117b05750565b60018160048111156117c4576117c4611f27565b036118115760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610f7b565b600281600481111561182557611825611f27565b036118725760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610f7b565b600381600481111561188657611886611f27565b0361119f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610f7b565b60006118e861149b565b9050806118f48461194a565b1015610685578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b60006119376002848418611e26565b61194390848416611efe565b9392505050565b805460009080820361195f5750600092915050565b8261196b600183611dde565b8154811061197b5761197b611f11565b9060005260206000200154915050919050565b50919050565b8280548282559060005260206000209081019282156119cf579160200282015b828111156119cf5782518255916020019190600101906119b4565b506119db9291506119df565b5090565b5b808211156119db57600081556001016119e0565b600060208083528351808285015260005b81811015611a2157858101830151858201604001528201611a05565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114611a5957600080fd5b919050565b60008060408385031215611a7157600080fd5b611a7a83611a42565b946020939093013593505050565b600080600060608486031215611a9d57600080fd5b611aa684611a42565b9250611ab460208501611a42565b9150604084013590509250925092565b600060208284031215611ad657600080fd5b61194382611a42565b600080600060608486031215611af457600080fd5b611afd84611a42565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215611b3b57600080fd5b8235915060208084013567ffffffffffffffff80821115611b5b57600080fd5b818601915086601f830112611b6f57600080fd5b813581811115611b8157611b81611b12565b8060051b604051601f19603f83011681018181108582111715611ba657611ba6611b12565b604052918252848201925083810185019189831115611bc457600080fd5b938501935b82851015611be257843584529385019392850192611bc9565b8096505050505050509250929050565b60008060008060808587031215611c0857600080fd5b5050823594602084013594506040840135936060013592509050565b600060208284031215611c3657600080fd5b5035919050565b600081518084526020808501945080840160005b83811015611c6d57815187529582019590820190600101611c51565b509495945050505050565b600060808201868352602060808185015281875180845260a086019150828901935060005b81811015611cb957845183529383019391830191600101611c9d565b50508481036040860152611ccd8188611c3d565b925050508281036060840152611ce38185611c3d565b979650505050505050565b600080600080600080600060e0888a031215611d0957600080fd5b611d1288611a42565b9650611d2060208901611a42565b95506040880135945060608801359350608088013560ff81168114611d4457600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215611d7457600080fd5b611d7d83611a42565b9150611d8b60208401611a42565b90509250929050565b600181811c90821680611da857607f821691505b60208210810361198e57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156105da576105da611dc8565b600060208284031215611e0357600080fd5b8151801515811461194357600080fd5b6020815260006119436020830184611c3d565b600082611e4357634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176105da576105da611dc8565b600080835481600182811c915080831680611e7b57607f831692505b60208084108203611e9a57634e487b7160e01b86526022600452602486fd5b818015611eae5760018114611ec357611ef0565b60ff1986168952841515850289019650611ef0565b60008a81526020902060005b86811015611ee85781548b820152908501908301611ecf565b505084890196505b509498975050505050505050565b808201808211156105da576105da611dc8565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122045bf3ace96043489f5d88cdd22d706916e8223a6bae6e1ac6f349d3f74b71d4c64736f6c63430008110033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c806370a082311161010f5780639dc29fac116100a2578063bc0bc6ba11610071578063bc0bc6ba14610471578063d505accf14610494578063dd62ed3e146104a7578063f2fde38b146104d257600080fd5b80639dc29fac14610430578063a9059cbb14610443578063b3ab15fb14610456578063b97dd9e21461046957600080fd5b80638da5cb5b116100de5780638da5cb5b146103f15780638dcc05831461040257806395d89b4114610415578063981b24d01461041d57600080fd5b806370a0823114610396578063715018a6146103b6578063734b1d87146103be5780637ecebe00146103d157600080fd5b806323b872dd116101875780634108d57c116101565780634108d57c146103485780634ee2cd7e146103505780635439ad8614610363578063570ca7351461036b57600080fd5b806323b872dd146102e1578063313ce567146102f45780633644e5151461032d57806340c10f191461033557600080fd5b806318160ddd116101c357806318160ddd1461025e5780631d815629146102755780631e38bf3114610295578063206e4f07146102a857600080fd5b806306fdde03146101f5578063095ea7b3146102135780630c2970291461023657806311c08d191461024b575b600080fd5b6101fd6104e5565b60405161020a91906119f4565b60405180910390f35b610226610221366004611a5e565b610573565b604051901515815260200161020a565b610249610244366004611a88565b6105e0565b005b610249610259366004611a5e565b61068a565b61026760025481565b60405190815260200161020a565b610267610283366004611ac4565b600d6020526000908152604090205481565b6102496102a3366004611adf565b6106d1565b6102676102b6366004611a5e565b6000908152600c602090815260408083206001600160a01b0394909416835260049093019052205490565b6102266102ef366004611a88565b610727565b61031b7f000000000000000000000000000000000000000000000000000000000000001281565b60405160ff909116815260200161020a565b610267610814565b610249610343366004611a5e565b61086f565b6102496108f0565b61026761035e366004611a5e565b6109ea565b610267610a43565b600b5461037e906001600160a01b031681565b6040516001600160a01b03909116815260200161020a565b6102676103a4366004611ac4565b60036020526000908152604090205481565b610249610a4d565b6102496103cc366004611b28565b610a61565b6102676103df366004611ac4565b60056020526000908152604090205481565b600a546001600160a01b031661037e565b610249610410366004611bf2565b610b86565b6101fd610c02565b61026761042b366004611c24565b610c0f565b61024961043e366004611a5e565b610c3a565b610226610451366004611a5e565b610cb7565b610249610464366004611ac4565b610d28565b610267610dea565b61048461047f366004611c24565b610e06565b60405161020a9493929190611c78565b6102496104a2366004611cee565b610f2f565b6102676104b5366004611d61565b600460209081526000928352604080842090915290825290205481565b6102496104e0366004611ac4565b611129565b600080546104f290611d94565b80601f016020809104026020016040519081016040528092919081815260200182805461051e90611d94565b801561056b5780601f106105405761010080835404028352916020019161056b565b820191906000526020600020905b81548152906001019060200180831161054e57829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906105ce9086815260200190565b60405180910390a35060015b92915050565b600b546001600160a01b0316331461060b5760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b0383166106325760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0382166106595760405163d92e233d60e01b815260040160405180910390fd5b8060000361067a57604051631f2a200560e01b815260040160405180910390fd5b6106858383836111a2565b505050565b600b546001600160a01b031633146106b55760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b039091166000908152600d6020526040902055565b600b546001600160a01b031633146106fc5760405163ea8e4eb560e01b815260040160405180910390fd5b6000918252600c602090815260408084206001600160a01b0390951684526004909401905291902055565b6000610734848484611203565b6001600160a01b038416600090815260046020908152604080832033845290915290205460001981146107905761076b8382611dde565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906107b8908490611dde565b90915550506001600160a01b0380851660008181526003602052604090819020805487019055519091871690600080516020611f3e833981519152906108019087815260200190565b60405180910390a3506001949350505050565b60007f0000000000000000000000000000000000000000000000000000000000000001461461084a5761084561124b565b905090565b507fd500ff84f368163b14b56b566e5c9a0d2f32f58f5f7021bb44f5c63300aadb6b90565b600b546001600160a01b0316331461089a5760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b0382166108c15760405163d92e233d60e01b815260040160405180910390fd5b806000036108e257604051631f2a200560e01b815260040160405180910390fd5b6108ec82826112e5565b5050565b600b546001600160a01b03168061091a576040516337ff16a960e01b815260040160405180910390fd5b336001600160a01b038216148015906109905750806001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561096c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109909190611df1565b156109ae576040516313d0ff5960e31b815260040160405180910390fd5b60006109b8610dea565b6000818152600c6020526040812054919250036108ec576109d761134b565b6000828152600c60205260409020555050565b6001600160a01b038216600090815260066020526040812081908190610a119085906113a5565b9150915081610a38576001600160a01b038516600090815260036020526040902054610a3a565b805b95945050505050565b600061084561149b565b610a556114a6565b610a5f6000611500565b565b600b546001600160a01b03163314610a8c5760405163ea8e4eb560e01b815260040160405180910390fd5b81600003610aad5760405163d5b25b6360e01b815260040160405180910390fd5b6000828152600c602052604081206003015490819003610ae05760405163d5b25b6360e01b815260040160405180910390fd5b8151600003610b0257604051631b7d775760e01b815260040160405180910390fd5b80825114610b23576040516324d96f8960e11b815260040160405180910390fd5b6000838152600c602090815260409091208351610b4892600390920191850190611994565b50827fd14f4d687c7695013d50cc578614c3f9cc3402759ab997d52ffeacc02515026383604051610b799190611e13565b60405180910390a2505050565b600b546001600160a01b03163314610bb15760405163ea8e4eb560e01b815260040160405180910390fd5b6000938452600c602090815260408520600180820180548083018255908852838820019590955560028101805480870182559087528287200193909355600390920180549384018155845292200155565b600180546104f290611d94565b6000806000610c1f8460076113a5565b9150915081610c3057600254610c32565b805b949350505050565b600b546001600160a01b03163314610c655760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b038216610c8c5760405163d92e233d60e01b815260040160405180910390fd5b80600003610cad57604051631f2a200560e01b815260040160405180910390fd5b6108ec8282611552565b6000610cc4338484611203565b3360009081526003602052604081208054849290610ce3908490611dde565b90915550506001600160a01b03831660008181526003602052604090819020805485019055513390600080516020611f3e833981519152906105ce9086815260200190565b610d306114a6565b6001600160a01b038116610d575760405163d92e233d60e01b815260040160405180910390fd5b6040516001600160a01b03821681527fdbebfba65bd6398fb722063efc10c99f624f9cd8ba657201056af918a676d5ee9060200160405180910390a1600b546001600160a01b0316610dc8576000610dad610dea565b9050610db761134b565b6000918252600c6020526040909120555b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610df96212750042611e26565b6108459062127500611e48565b6000818152600c6020908152604080832080546001820180548451818702810187019095528085526060958695869594939260028601926003870192918591830182828015610e7457602002820191906000526020600020905b815481526020019060010190808311610e60575b5050505050925081805480602002602001604051908101604052809291908181526020018280548015610ec657602002820191906000526020600020905b815481526020019060010190808311610eb2575b5050505050915080805480602002602001604051908101604052809291908181526020018280548015610f1857602002820191906000526020600020905b815481526020019060010190808311610f04575b505050505090509450945094509450509193509193565b42841015610f845760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064015b60405180910390fd5b6000611058610f91610814565b6001600160a01b038a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301825280519084012061190160f01b6101008401526101028301949094526101228083019490945280518083039094018452610142909101905281519101208585856115c0565b90506001600160a01b038116158015906110835750876001600160a01b0316816001600160a01b0316145b6110c05760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b6044820152606401610f7b565b6001600160a01b0390811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6111316114a6565b6001600160a01b0381166111965760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610f7b565b61119f81611500565b50565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112225761121a826115e8565b610685611616565b6001600160a01b0382166112395761121a836115e8565b611242836115e8565b610685826115e8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600060405161127d9190611e5f565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6112f160008383611203565b80600260008282546113039190611efe565b90915550506001600160a01b038216600081815260036020908152604080832080548601905551848152600080516020611f3e83398151915291015b60405180910390a35050565b600061135b600980546001019055565b600061136561149b565b90507f8030e83b04d87bef53480e26263266d6ca66863aa8506aca6f2559d18aa1cb678160405161139891815260200190565b60405180910390a1919050565b600080600084116113f15760405162461bcd60e51b815260206004820152601660248201527504552433230536e617073686f743a20696420697320360541b6044820152606401610f7b565b6113f961149b565b8411156114485760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e742069640000006044820152606401610f7b565b60006114548486611623565b8454909150810361146c576000809250925050611494565b600184600101828154811061148357611483611f11565b906000526020600020015492509250505b9250929050565b600061084560095490565b600a546001600160a01b03163314610a5f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610f7b565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61155e82600083611203565b6001600160a01b03821660009081526003602052604081208054839290611586908490611dde565b90915550506002805482900390556040518181526000906001600160a01b03841690600080516020611f3e8339815191529060200161133f565b60008060006115d1878787876116d0565b915091506115de81611794565b5095945050505050565b6001600160a01b038116600090815260066020908152604080832060039092529091205461119f91906118de565b610a5f60076002546118de565b81546000908103611636575060006105da565b82546000905b808210156116835760006116508383611928565b6000878152602090209091508590820154111561166f5780915061167d565b61167a816001611efe565b92505b5061163c565b6000821180156116af5750836116ac8661169e600186611dde565b600091825260209091200190565b54145b156116c8576116bf600183611dde565b925050506105da565b5090506105da565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611707575060009050600361178b565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561175b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166117845760006001925092505061178b565b9150600090505b94509492505050565b60008160048111156117a8576117a8611f27565b036117b05750565b60018160048111156117c4576117c4611f27565b036118115760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610f7b565b600281600481111561182557611825611f27565b036118725760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610f7b565b600381600481111561188657611886611f27565b0361119f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610f7b565b60006118e861149b565b9050806118f48461194a565b1015610685578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b60006119376002848418611e26565b61194390848416611efe565b9392505050565b805460009080820361195f5750600092915050565b8261196b600183611dde565b8154811061197b5761197b611f11565b9060005260206000200154915050919050565b50919050565b8280548282559060005260206000209081019282156119cf579160200282015b828111156119cf5782518255916020019190600101906119b4565b506119db9291506119df565b5090565b5b808211156119db57600081556001016119e0565b600060208083528351808285015260005b81811015611a2157858101830151858201604001528201611a05565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114611a5957600080fd5b919050565b60008060408385031215611a7157600080fd5b611a7a83611a42565b946020939093013593505050565b600080600060608486031215611a9d57600080fd5b611aa684611a42565b9250611ab460208501611a42565b9150604084013590509250925092565b600060208284031215611ad657600080fd5b61194382611a42565b600080600060608486031215611af457600080fd5b611afd84611a42565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215611b3b57600080fd5b8235915060208084013567ffffffffffffffff80821115611b5b57600080fd5b818601915086601f830112611b6f57600080fd5b813581811115611b8157611b81611b12565b8060051b604051601f19603f83011681018181108582111715611ba657611ba6611b12565b604052918252848201925083810185019189831115611bc457600080fd5b938501935b82851015611be257843584529385019392850192611bc9565b8096505050505050509250929050565b60008060008060808587031215611c0857600080fd5b5050823594602084013594506040840135936060013592509050565b600060208284031215611c3657600080fd5b5035919050565b600081518084526020808501945080840160005b83811015611c6d57815187529582019590820190600101611c51565b509495945050505050565b600060808201868352602060808185015281875180845260a086019150828901935060005b81811015611cb957845183529383019391830191600101611c9d565b50508481036040860152611ccd8188611c3d565b925050508281036060840152611ce38185611c3d565b979650505050505050565b600080600080600080600060e0888a031215611d0957600080fd5b611d1288611a42565b9650611d2060208901611a42565b95506040880135945060608801359350608088013560ff81168114611d4457600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215611d7457600080fd5b611d7d83611a42565b9150611d8b60208401611a42565b90509250929050565b600181811c90821680611da857607f821691505b60208210810361198e57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156105da576105da611dc8565b600060208284031215611e0357600080fd5b8151801515811461194357600080fd5b6020815260006119436020830184611c3d565b600082611e4357634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176105da576105da611dc8565b600080835481600182811c915080831680611e7b57607f831692505b60208084108203611e9a57634e487b7160e01b86526022600452602486fd5b818015611eae5760018114611ec357611ef0565b60ff1986168952841515850289019650611ef0565b60008a81526020902060005b86811015611ee85781548b820152908501908301611ecf565b505084890196505b509498975050505050505050565b808201808211156105da576105da611dc8565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122045bf3ace96043489f5d88cdd22d706916e8223a6bae6e1ac6f349d3f74b71d4c64736f6c63430008110033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.