Feature Tip: Add private address tag to any address under My Name Tag !
ERC-20
Overview
Max Total Supply
0.00000000063145763 IVT
Holders
121
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
0.000000000003314755 IVTValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x254a29f5...677a4faBf The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
ContinuousVestingMerkle
Compiler Version
v0.8.16+commit.07a7930e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { ContinuousVesting } from "./abstract/ContinuousVesting.sol"; import { MerkleSet } from "./abstract/MerkleSet.sol"; contract ContinuousVestingMerkle is ContinuousVesting, MerkleSet { constructor( IERC20 _token, // the token being claimed uint256 _total, // the total claimable by all users string memory _uri, // information on the sale (e.g. merkle proofs) uint256 _voteFactor, // votes have this weight uint256 _start, // vesting clock starts at this time uint256 _cliff, // claims open at this time uint256 _end, // vesting clock ends and this time bytes32 _merkleRoot // the merkle root for claim membership ) ContinuousVesting(_token, _total, _uri, _voteFactor, _start, _cliff, _end) MerkleSet(_merkleRoot) {} function NAME() external pure override returns (string memory) { return "ContinuousVestingMerkle"; } function VERSION() external pure override returns (uint256) { return 2; } function initializeDistributionRecord( uint256 index, // the beneficiary's index in the merkle root address beneficiary, // the address that will receive tokens uint256 amount, // the total claimable by this beneficiary bytes32[] calldata merkleProof ) external validMerkleProof(keccak256(abi.encodePacked(index, beneficiary, amount)), merkleProof) { _initializeDistributionRecord(beneficiary, amount); } function claim( uint256 index, // the beneficiary's index in the merkle root address beneficiary, // the address that will receive tokens uint256 totalAmount, // the total claimable by this beneficiary bytes32[] calldata merkleProof ) external validMerkleProof(keccak256(abi.encodePacked(index, beneficiary, totalAmount)), merkleProof) nonReentrant { super._executeClaim(beneficiary, totalAmount); } function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner { _setMerkleRoot(_merkleRoot); } }
// 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.5.0) (governance/utils/IVotes.sol) pragma solidity ^0.8.0; /** * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts. * * _Available since v4.5._ */ interface IVotes { /** * @dev Emitted when an account changes their delegate. */ event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /** * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes. */ event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance); /** * @dev Returns the current amount of votes that `account` has. */ function getVotes(address account) external view returns (uint256); /** * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`). */ function getPastVotes(address account, uint256 blockNumber) external view returns (uint256); /** * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`). * * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes. * Votes that have not been delegated are still part of total supply, even though they would not participate in a * vote. */ function getPastTotalSupply(uint256 blockNumber) external view returns (uint256); /** * @dev Returns the delegate that `account` has chosen. */ function delegates(address account) external view returns (address); /** * @dev Delegates votes from the sender to `delegatee`. */ function delegate(address delegatee) external; /** * @dev Delegates votes from signer to `delegatee`. */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Votes.sol) pragma solidity ^0.8.0; import "./draft-ERC20Permit.sol"; import "../../../utils/math/Math.sol"; import "../../../governance/utils/IVotes.sol"; import "../../../utils/math/SafeCast.sol"; import "../../../utils/cryptography/ECDSA.sol"; /** * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's, * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1. * * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module. * * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting * power can be queried through the public accessors {getVotes} and {getPastVotes}. * * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked. * * _Available since v4.2._ */ abstract contract ERC20Votes is IVotes, ERC20Permit { struct Checkpoint { uint32 fromBlock; uint224 votes; } bytes32 private constant _DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); mapping(address => address) private _delegates; mapping(address => Checkpoint[]) private _checkpoints; Checkpoint[] private _totalSupplyCheckpoints; /** * @dev Get the `pos`-th checkpoint for `account`. */ function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) { return _checkpoints[account][pos]; } /** * @dev Get number of checkpoints for `account`. */ function numCheckpoints(address account) public view virtual returns (uint32) { return SafeCast.toUint32(_checkpoints[account].length); } /** * @dev Get the address `account` is currently delegating to. */ function delegates(address account) public view virtual override returns (address) { return _delegates[account]; } /** * @dev Gets the current votes balance for `account` */ function getVotes(address account) public view virtual override returns (uint256) { uint256 pos = _checkpoints[account].length; return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes; } /** * @dev Retrieve the number of votes for `account` at the end of `blockNumber`. * * Requirements: * * - `blockNumber` must have been already mined */ function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) { require(blockNumber < block.number, "ERC20Votes: block not yet mined"); return _checkpointsLookup(_checkpoints[account], blockNumber); } /** * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances. * It is but NOT the sum of all the delegated votes! * * Requirements: * * - `blockNumber` must have been already mined */ function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) { require(blockNumber < block.number, "ERC20Votes: block not yet mined"); return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber); } /** * @dev Lookup a value in a list of (sorted) checkpoints. */ function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) { // We run a binary search to look for the earliest checkpoint taken after `blockNumber`. // // During the loop, the index of the wanted checkpoint remains in the range [low-1, high). // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant. // - If the middle checkpoint is after `blockNumber`, we look in [low, mid) // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high) // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not // out of bounds (in which case we're looking too far in the past and the result is 0). // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out // the same. uint256 high = ckpts.length; uint256 low = 0; while (low < high) { uint256 mid = Math.average(low, high); if (ckpts[mid].fromBlock > blockNumber) { high = mid; } else { low = mid + 1; } } return high == 0 ? 0 : ckpts[high - 1].votes; } /** * @dev Delegate votes from the sender to `delegatee`. */ function delegate(address delegatee) public virtual override { _delegate(_msgSender(), delegatee); } /** * @dev Delegates votes from signer to `delegatee` */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= expiry, "ERC20Votes: signature expired"); address signer = ECDSA.recover( _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))), v, r, s ); require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce"); _delegate(signer, delegatee); } /** * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1). */ function _maxSupply() internal view virtual returns (uint224) { return type(uint224).max; } /** * @dev Snapshots the totalSupply after it has been increased. */ function _mint(address account, uint256 amount) internal virtual override { super._mint(account, amount); require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes"); _writeCheckpoint(_totalSupplyCheckpoints, _add, amount); } /** * @dev Snapshots the totalSupply after it has been decreased. */ function _burn(address account, uint256 amount) internal virtual override { super._burn(account, amount); _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount); } /** * @dev Move voting power when tokens are transferred. * * Emits a {DelegateVotesChanged} event. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._afterTokenTransfer(from, to, amount); _moveVotingPower(delegates(from), delegates(to), amount); } /** * @dev Change delegation for `delegator` to `delegatee`. * * Emits events {DelegateChanged} and {DelegateVotesChanged}. */ function _delegate(address delegator, address delegatee) internal virtual { address currentDelegate = delegates(delegator); uint256 delegatorBalance = balanceOf(delegator); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveVotingPower(currentDelegate, delegatee, delegatorBalance); } function _moveVotingPower( address src, address dst, uint256 amount ) private { if (src != dst && amount > 0) { if (src != address(0)) { (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount); emit DelegateVotesChanged(src, oldWeight, newWeight); } if (dst != address(0)) { (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount); emit DelegateVotesChanged(dst, oldWeight, newWeight); } } } function _writeCheckpoint( Checkpoint[] storage ckpts, function(uint256, uint256) view returns (uint256) op, uint256 delta ) private returns (uint256 oldWeight, uint256 newWeight) { uint256 pos = ckpts.length; oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes; newWeight = op(oldWeight, delta); if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) { ckpts[pos - 1].votes = SafeCast.toUint224(newWeight); } else { ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(block.number), votes: SafeCast.toUint224(newWeight)})); } } function _add(uint256 a, uint256 b) private pure returns (uint256) { return a + b; } function _subtract(uint256 a, uint256 b) private pure returns (uint256) { return a - b; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; import "./draft-IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/draft-EIP712.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// 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/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/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_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) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { 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 (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`, * consuming from one or the other at each step according to the instructions given by * `proofFlags`. * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof} * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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. It 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)`. // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`. // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`. // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a // good first aproximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1; uint256 x = a; if (x >> 128 > 0) { x >>= 128; result <<= 64; } if (x >> 64 > 0) { x >>= 64; result <<= 32; } if (x >> 32 > 0) { x >>= 32; result <<= 16; } if (x >> 16 > 0) { x >>= 16; result <<= 8; } if (x >> 8 > 0) { x >>= 8; result <<= 4; } if (x >> 4 > 0) { x >>= 4; result <<= 2; } if (x >> 2 > 0) { result <<= 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) { uint256 result = sqrt(a); if (rounding == Rounding.Up && result * result < a) { result += 1; } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol) pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248) { require(value >= type(int248).min && value <= type(int248).max, "SafeCast: value doesn't fit in 248 bits"); return int248(value); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240) { require(value >= type(int240).min && value <= type(int240).max, "SafeCast: value doesn't fit in 240 bits"); return int240(value); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232) { require(value >= type(int232).min && value <= type(int232).max, "SafeCast: value doesn't fit in 232 bits"); return int232(value); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224) { require(value >= type(int224).min && value <= type(int224).max, "SafeCast: value doesn't fit in 224 bits"); return int224(value); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216) { require(value >= type(int216).min && value <= type(int216).max, "SafeCast: value doesn't fit in 216 bits"); return int216(value); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208) { require(value >= type(int208).min && value <= type(int208).max, "SafeCast: value doesn't fit in 208 bits"); return int208(value); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200) { require(value >= type(int200).min && value <= type(int200).max, "SafeCast: value doesn't fit in 200 bits"); return int200(value); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192) { require(value >= type(int192).min && value <= type(int192).max, "SafeCast: value doesn't fit in 192 bits"); return int192(value); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184) { require(value >= type(int184).min && value <= type(int184).max, "SafeCast: value doesn't fit in 184 bits"); return int184(value); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176) { require(value >= type(int176).min && value <= type(int176).max, "SafeCast: value doesn't fit in 176 bits"); return int176(value); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168) { require(value >= type(int168).min && value <= type(int168).max, "SafeCast: value doesn't fit in 168 bits"); return int168(value); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160) { require(value >= type(int160).min && value <= type(int160).max, "SafeCast: value doesn't fit in 160 bits"); return int160(value); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152) { require(value >= type(int152).min && value <= type(int152).max, "SafeCast: value doesn't fit in 152 bits"); return int152(value); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144) { require(value >= type(int144).min && value <= type(int144).max, "SafeCast: value doesn't fit in 144 bits"); return int144(value); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136) { require(value >= type(int136).min && value <= type(int136).max, "SafeCast: value doesn't fit in 136 bits"); return int136(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120) { require(value >= type(int120).min && value <= type(int120).max, "SafeCast: value doesn't fit in 120 bits"); return int120(value); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112) { require(value >= type(int112).min && value <= type(int112).max, "SafeCast: value doesn't fit in 112 bits"); return int112(value); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104) { require(value >= type(int104).min && value <= type(int104).max, "SafeCast: value doesn't fit in 104 bits"); return int104(value); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96) { require(value >= type(int96).min && value <= type(int96).max, "SafeCast: value doesn't fit in 96 bits"); return int96(value); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88) { require(value >= type(int88).min && value <= type(int88).max, "SafeCast: value doesn't fit in 88 bits"); return int88(value); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80) { require(value >= type(int80).min && value <= type(int80).max, "SafeCast: value doesn't fit in 80 bits"); return int80(value); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72) { require(value >= type(int72).min && value <= type(int72).max, "SafeCast: value doesn't fit in 72 bits"); return int72(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56) { require(value >= type(int56).min && value <= type(int56).max, "SafeCast: value doesn't fit in 56 bits"); return int56(value); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48) { require(value >= type(int48).min && value <= type(int48).max, "SafeCast: value doesn't fit in 48 bits"); return int48(value); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40) { require(value >= type(int40).min && value <= type(int40).max, "SafeCast: value doesn't fit in 40 bits"); return int40(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24) { require(value >= type(int24).min && value <= type(int24).max, "SafeCast: value doesn't fit in 24 bits"); return int24(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import "@openzeppelin/contracts/access/Ownable.sol"; import { ERC20Votes, ERC20Permit, ERC20 } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Distributor, DistributionRecord, IERC20 } from "./Distributor.sol"; import { IAdjustable } from "../../interfaces/IAdjustable.sol"; import { IVoting } from "../../interfaces/IVoting.sol"; import { Sweepable } from "../../utilities/Sweepable.sol"; abstract contract AdvancedDistributor is Ownable, Sweepable, ERC20Votes, Distributor, IAdjustable, IVoting { using SafeERC20 for IERC20; uint256 private voteFactor; constructor( IERC20 _token, uint256 _total, string memory _uri, uint256 _voteFactor, uint256 _fractionDenominator ) Distributor(_token, _total, _uri, _fractionDenominator) ERC20Permit("Internal vote tracker") ERC20("Internal vote tracker", "IVT") Sweepable(payable(msg.sender)) { voteFactor = _voteFactor; emit SetVoteFactor(voteFactor); } function tokensToVotes(uint256 tokenAmount) private view returns (uint256) { // convert a token quantity to a vote quantity return tokenAmount * voteFactor / fractionDenominator; } function _initializeDistributionRecord(address beneficiary, uint256 totalAmount) internal override { super._initializeDistributionRecord(beneficiary, totalAmount); // add voting power through ERC20Votes extension _mint(beneficiary, tokensToVotes(totalAmount)); } function _executeClaim(address beneficiary, uint256 totalAmount) internal override returns (uint256 _claimed) { _claimed = super._executeClaim(beneficiary, totalAmount); // reduce voting power through ERC20Votes extension _burn(beneficiary, tokensToVotes(_claimed)); } function adjust(address beneficiary, int256 amount) external onlyOwner { DistributionRecord memory distributionRecord = records[beneficiary]; require(distributionRecord.initialized, "must initialize before adjusting"); uint256 diff = uint256(amount > 0 ? amount : -amount); require(diff < type(uint120).max, "adjustment > max uint120"); if (amount < 0) { // decreasing claimable tokens require(total >= diff, "decrease greater than distributor total"); require(distributionRecord.total >= diff, "decrease greater than distributionRecord total"); total -= diff; records[beneficiary].total -= uint120(diff); token.safeTransfer(owner(), diff); // reduce voting power _burn(beneficiary, tokensToVotes(diff)); } else { // increasing claimable tokens total += diff; records[beneficiary].total += uint120(diff); // increase voting pwoer _mint(beneficiary, tokensToVotes(diff)); } emit Adjust(beneficiary, amount); } // Set the token being distributed function setToken(IERC20 _token) external onlyOwner { require(address(_token) != address(0), "Adjustable: token is address(0)"); token = _token; emit SetToken(token); } // Set the total to distribute function setTotal(uint256 _total) external onlyOwner { total = _total; emit SetTotal(total); } // Set the distributor metadata URI function setUri(string memory _uri) external onlyOwner { uri = _uri; emit SetUri(uri); } // set the recipient of swept funds function setSweepRecipient(address payable _recipient) external onlyOwner { _setSweepRecipient(_recipient); } function getTotalVotes() external view returns (uint256) { // supply of internal token used to track voting power return totalSupply(); } function getVoteFactor(address) external view returns (uint256) { return voteFactor; } // Set the voting power of undistributed tokens function setVoteFactor(uint256 _voteFactor) external onlyOwner { voteFactor = _voteFactor; emit SetVoteFactor(voteFactor); } // disable unused ERC20 methods: the token is only used to track voting power function _approve(address, address, uint256) internal pure override { revert("disabled for voting power"); } function _transfer(address, address, uint256) internal pure override { revert("disabled for voting power"); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import { Distributor, AdvancedDistributor } from "./AdvancedDistributor.sol"; import { IVesting } from "../../interfaces/IVesting.sol"; import { IContinuousVesting } from "../../interfaces/IContinuousVesting.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; abstract contract ContinuousVesting is AdvancedDistributor, IContinuousVesting { uint256 private start; // time vesting clock begins uint256 private cliff; // time vesting begins (all tokens vested prior to the cliff are immediately claimable) uint256 private end; // time vesting clock ends constructor( IERC20 _token, uint256 _total, string memory _uri, uint256 _voteFactor, uint256 _start, uint256 _cliff, uint256 _end ) // use a large fraction denominator to provide the highest resolution on continuous vesting. AdvancedDistributor(_token, _total, _uri, _voteFactor, 10**18) { require(_start <= _cliff, "vesting cliff before start"); require(_cliff <= _end, "vesting end before cliff"); require(_end <= 4102444800, "vesting ends after 4102444800 (Jan 1 2100)"); start = _start; cliff = _cliff; end = _end; emit SetContinuousVesting(start, cliff, end); } function getVestedFraction( address, /*beneficiary*/ uint256 time // time is in seconds past the epoch (e.g. block.timestamp) ) public view override(Distributor, IVesting) returns (uint256) { // no tokens are vested if (time <= cliff) { return 0; } // all tokens are vested if (time >= end) { return fractionDenominator; } // some tokens are vested return (fractionDenominator * (time - start)) / (end - start); } function getVestingConfig() external view returns ( uint256, uint256, uint256 ) { return (start, cliff, end); } // Adjustable admin functions function setVestingConfig( uint256 _start, uint256 _cliff, uint256 _end ) external onlyOwner { start = _start; cliff = _cliff; end = _end; emit SetContinuousVesting(start, cliff, end); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import { SafeERC20 } from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { ReentrancyGuard } from '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import { IDistributor, DistributionRecord } from '../../interfaces/IDistributor.sol'; abstract contract Distributor is IDistributor, ReentrancyGuard { using SafeERC20 for IERC20; mapping(address => DistributionRecord) internal records; // track distribution records per user IERC20 public token; // the token being claimed uint256 public total; // total tokens allocated for claims uint256 public claimed; // tokens already claimed string public uri; // ipfs link on distributor info uint256 immutable fractionDenominator; // denominator for vesting fraction (e.g. if vested fraction is 100 and fractionDenominator is 10000, 1% of tokens have vested) // provide context on the contract name and version function NAME() external view virtual returns (string memory); function VERSION() external view virtual returns (uint256); constructor( IERC20 _token, uint256 _total, string memory _uri, uint256 _fractionDenominator ) { require(address(_token) != address(0), 'Distributor: token is address(0)'); require(_total > 0, 'Distributor: total is 0'); token = _token; total = _total; uri = _uri; fractionDenominator = _fractionDenominator; emit InitializeDistributor(token, total, uri, fractionDenominator); } function _initializeDistributionRecord(address beneficiary, uint256 _totalAmount) internal virtual { // CALLER MUST VERIFY THE BENEFICIARY AND TOTAL ARE VALID! uint120 totalAmount = uint120(_totalAmount); // Checks require(totalAmount <= type(uint120).max, 'Distributor: totalAmount > type(uint120).max'); // Effects - note that the existing claimed quantity is re-used during re-initialization records[beneficiary] = DistributionRecord(true, totalAmount, records[beneficiary].claimed); emit InitializeDistributionRecord(beneficiary, totalAmount); } function _executeClaim(address beneficiary, uint256 _totalAmount) internal virtual returns (uint256) { // Checks: NONE! THIS FUNCTION DOES NOT CHECK PERMISSIONS: CALLER MUST VERIFY THE CLAIM IS VALID! uint120 totalAmount = uint120(_totalAmount); // effects if (records[beneficiary].total != totalAmount) { // re-initialize if the total has been updated _initializeDistributionRecord(beneficiary, totalAmount); } uint120 claimableAmount = uint120(getClaimableAmount(beneficiary)); require(claimableAmount > 0, 'Distributor: no more tokens claimable right now'); records[beneficiary].claimed += claimableAmount; claimed += claimableAmount; // interactions token.safeTransfer(beneficiary, claimableAmount); emit Claim(beneficiary, claimableAmount); return claimableAmount; } function getDistributionRecord(address beneficiary) external view virtual returns (DistributionRecord memory) { return records[beneficiary]; } // Get tokens vested as fraction of fractionDenominator function getVestedFraction(address beneficiary, uint256 time) public view virtual returns (uint256); function getFractionDenominator() public view returns (uint256) { return fractionDenominator; } // get the number of tokens currently claimable by a specific use function getClaimableAmount(address beneficiary) public view virtual returns (uint256) { require(records[beneficiary].initialized, 'Distributor: claim not initialized'); DistributionRecord memory record = records[beneficiary]; uint256 claimable = (record.total * getVestedFraction(beneficiary, block.timestamp)) / fractionDenominator; return record.claimed >= claimable ? 0 // no more tokens to claim : claimable - record.claimed; // claim all available tokens } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import { IMerkleSet } from "../../interfaces/IMerkleSet.sol"; contract MerkleSet is IMerkleSet { bytes32 private merkleRoot; constructor(bytes32 _merkleRoot) { _setMerkleRoot(_merkleRoot); } modifier validMerkleProof(bytes32 leaf, bytes32[] calldata merkleProof) { _verifyMembership(leaf, merkleProof); _; } function _testMembership(bytes32 leaf, bytes32[] calldata merkleProof) internal view returns (bool) { return MerkleProof.verify(merkleProof, merkleRoot, leaf); } function getMerkleRoot() public view returns (bytes32) { return merkleRoot; } function _verifyMembership(bytes32 leaf, bytes32[] calldata merkleProof) internal view { require(_testMembership(leaf, merkleProof), "invalid proof"); } function _setMerkleRoot(bytes32 _merkleRoot) internal { merkleRoot = _merkleRoot; emit SetMerkleRoot(merkleRoot); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IAdjustable { event Adjust(address indexed beneficiary, int256 amount); event SetToken(IERC20 indexed token); event SetTotal(uint256 total); event SetUri(string indexed uri); // Adjust the quantity claimable by a user function adjust(address beneficiary, int256 amount) external; // Set the token being distributed function setToken(IERC20 token) external; // Set the total distribution quantity function setTotal(uint256 total) external; // Set the distributor metadata URI function setUri(string memory uri) external; // Set the voting power of undistributed tokens function setVoteFactor(uint256 setVoteFactor) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IVesting } from "./IVesting.sol"; interface IContinuousVesting is IVesting { event SetContinuousVesting(uint256 start, uint256 cliff, uint256 end); function getVestingConfig() external view returns ( uint256, uint256, uint256 ); function setVestingConfig( uint256 _start, uint256 _cliff, uint256 _end ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; struct DistributionRecord { bool initialized; // has the claim record been initialized uint120 total; // total token quantity claimable uint120 claimed; // token quantity already claimed } interface IDistributor { event InitializeDistributor( IERC20 indexed token, uint256 total, string uri, uint256 fractionDenominator ); event InitializeDistributionRecord(address indexed beneficiary, uint256 amount); event Claim(address indexed beneficiary, uint256 amount); function getDistributionRecord(address beneficiary) external view returns (DistributionRecord memory); function getClaimableAmount(address beneficiary) external view returns (uint256); function getFractionDenominator() external view returns (uint256); function token() external view returns (IERC20); function total() external view returns (uint256); function uri() external view returns (string memory); function NAME() external view returns (string memory); function VERSION() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; interface IMerkleSet { event SetMerkleRoot(bytes32 merkleRoot); function getMerkleRoot() external view returns (bytes32 root); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; interface IVesting { function getVestedFraction( address, /*beneficiary*/ uint256 time // time is in seconds past the epoch (e.g. block.timestamp) ) external returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import { IVotes } from "@openzeppelin/contracts/governance/utils/IVotes.sol"; interface IVoting is IVotes { event SetVoteFactor(uint256 voteFactor); // an total current voting power function getTotalVotes() external view returns (uint256); // a weighting factor used to convert token holdings to voting power (eg in basis points) function getVoteFactor(address account) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract Sweepable is Ownable { using SafeERC20 for IERC20; event SetSweepRecipient(address recipient); event SweepToken(address indexed token, uint256 amount); event SweepNative(uint256 amount); address payable private recipient; constructor(address payable _recipient) { _setSweepRecipient(_recipient); } // Sweep an ERC20 token to the owner function sweepToken(IERC20 token) external onlyOwner { uint256 amount = token.balanceOf(address(this)); token.safeTransfer(recipient, amount); emit SweepToken(address(token), amount); } function sweepToken(IERC20 token, uint256 amount) external onlyOwner { token.safeTransfer(recipient, amount); emit SweepToken(address(token), amount); } // sweep native token to the recipient (public function) function sweepNative() external { uint256 amount = address(this).balance; (bool success, ) = recipient.call{value: amount}(""); require(success, "Transfer failed."); emit SweepNative(amount); } function sweepNative(uint256 amount) external onlyOwner { (bool success, ) = recipient.call{value: amount}(""); require(success, "Transfer failed."); emit SweepNative(amount); } function getSweepRecipient() public view returns (address payable) { return recipient; } function _setSweepRecipient(address payable _recipient) internal { recipient = _recipient; emit SetSweepRecipient(recipient); } }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_total","type":"uint256"},{"internalType":"string","name":"_uri","type":"string"},{"internalType":"uint256","name":"_voteFactor","type":"uint256"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_cliff","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"},{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"int256","name":"amount","type":"int256"}],"name":"Adjust","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"InitializeDistributionRecord","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"total","type":"uint256"},{"indexed":false,"internalType":"string","name":"uri","type":"string"},{"indexed":false,"internalType":"uint256","name":"fractionDenominator","type":"uint256"}],"name":"InitializeDistributor","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":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cliff","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"end","type":"uint256"}],"name":"SetContinuousVesting","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"SetMerkleRoot","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"SetSweepRecipient","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"}],"name":"SetToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"total","type":"uint256"}],"name":"SetTotal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"uri","type":"string"}],"name":"SetUri","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"voteFactor","type":"uint256"}],"name":"SetVoteFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SweepNative","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SweepToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"int256","name":"amount","type":"int256"}],"name":"adjust","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint32","name":"pos","type":"uint32"}],"name":"checkpoints","outputs":[{"components":[{"internalType":"uint32","name":"fromBlock","type":"uint32"},{"internalType":"uint224","name":"votes","type":"uint224"}],"internalType":"struct ERC20Votes.Checkpoint","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"beneficiary","type":"address"}],"name":"getClaimableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"beneficiary","type":"address"}],"name":"getDistributionRecord","outputs":[{"components":[{"internalType":"bool","name":"initialized","type":"bool"},{"internalType":"uint120","name":"total","type":"uint120"},{"internalType":"uint120","name":"claimed","type":"uint120"}],"internalType":"struct DistributionRecord","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFractionDenominator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getPastTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getPastVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSweepRecipient","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"time","type":"uint256"}],"name":"getVestedFraction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVestingConfig","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getVoteFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"initializeDistributionRecord","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","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":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_recipient","type":"address"}],"name":"setSweepRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"}],"name":"setToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_total","type":"uint256"}],"name":"setTotal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_cliff","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"setVestingConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voteFactor","type":"uint256"}],"name":"setVoteFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sweepNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sweepNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sweepToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"total","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101606040523480156200001257600080fd5b50604051620040c3380380620040c38339810160408190526200003591620005bb565b808888888888888886868686670de0b6b3a7640000848484836040518060400160405280601581526020017f496e7465726e616c20766f746520747261636b6572000000000000000000000081525080604051806040016040528060018152602001603160f81b8152506040518060400160405280601581526020017f496e7465726e616c20766f746520747261636b657200000000000000000000008152506040518060400160405280600381526020016212559560ea1b815250336200010c62000106620004c660201b60201c565b620004ca565b62000117816200051a565b5060056200012683826200077a565b5060066200013582826200077a565b5050825160208085019190912083518483012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c0019052805194019390932091935091906080523060c0526101205250506001600c555050506001600160a01b0384166200022b5760405162461bcd60e51b815260206004820181905260248201527f4469737472696275746f723a20746f6b656e206973206164647265737328302960448201526064015b60405180910390fd5b600083116200027d5760405162461bcd60e51b815260206004820152601760248201527f4469737472696275746f723a20746f74616c2069732030000000000000000000604482015260640162000222565b600e80546001600160a01b0319166001600160a01b038616179055600f8390556011620002ab83826200077a565b50610140819052600e54600f546040516001600160a01b03909216917f433127dedcff849792656a12f4a9dbc0efeb80df5cce6310f53481a93cd71c7191620002f991601190869062000846565b60405180910390a25050506012839055506040518281527f6c339c0bee516a4df5d7074ba7a974856d609f83666e915aa4a0f90e06989dc59060200160405180910390a1505050505081831115620003945760405162461bcd60e51b815260206004820152601a60248201527f76657374696e6720636c696666206265666f7265207374617274000000000000604482015260640162000222565b80821115620003e65760405162461bcd60e51b815260206004820152601860248201527f76657374696e6720656e64206265666f726520636c6966660000000000000000604482015260640162000222565b63f48657008111156200044f5760405162461bcd60e51b815260206004820152602a60248201527f76657374696e6720656e6473206166746572203431303234343438303020284a604482015269616e203120323130302960b01b606482015260840162000222565b60138390556014829055601581905560408051848152602081018490529081018290527f34ebbb9e095e6c8737f99dd9923fb97ec1ca3d25cb39225975a934dd8d7a31b49060600160405180910390a150505050505050620004b7816200056f60201b60201c565b505050505050505050620008e9565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527fccdd1baf560d2682736fa25752c8ccc0c5fc4079b245b0acf7389776308d5b1f906020015b60405180910390a150565b60168190556040518181527f914960aef5e033ce5cae8a7992d4b7a6f0f9741227b66acb67c605b7019f8a469060200162000564565b634e487b7160e01b600052604160045260246000fd5b600080600080600080600080610100898b031215620005d957600080fd5b88516001600160a01b0381168114620005f157600080fd5b60208a81015160408c0151929a509850906001600160401b03808211156200061857600080fd5b818c0191508c601f8301126200062d57600080fd5b815181811115620006425762000642620005a5565b604051601f8201601f19908116603f011681019083821181831017156200066d576200066d620005a5565b816040528281528f868487010111156200068657600080fd5b600093505b82841015620006aa57848401860151818501870152928501926200068b565b6000868483010152809b50505050505050606089015194506080890151935060a0890151925060c0890151915060e089015190509295985092959890939650565b600181811c908216806200070057607f821691505b6020821081036200072157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200077557600081815260208120601f850160051c81016020861015620007505750805b601f850160051c820191505b8181101562000771578281556001016200075c565b5050505b505050565b81516001600160401b03811115620007965762000796620005a5565b620007ae81620007a78454620006eb565b8462000727565b602080601f831160018114620007e65760008415620007cd5750858301515b600019600386901b1c1916600185901b17855562000771565b600085815260208120601f198616915b828110156200081757888601518255948401946001909101908401620007f6565b5085821015620008365787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b83815260006020606081840152600085546200086281620006eb565b8060608701526080600180841660008114620008875760018114620008a257620008d2565b60ff1985168984015283151560051b890183019550620008d2565b8a6000528660002060005b85811015620008ca5781548b8201860152908301908801620008ad565b8a0184019650505b505050505060409390930193909352509392505050565b60805160a05160c05160e051610100516101205161014051613763620009606000396000818161038a01528181611392015281816113d90152818161183e0152611f7d01526000611cd101526000611d2001526000611cfb01526000611c5401526000611c7e01526000611ca801526137636000f3fe608060405234801561001057600080fd5b50600436106103425760003560e01c806395d89b41116101b8578063c78d598511610104578063e85858d9116100a2578063f1127ed81161007c578063f1127ed8146107de578063f2fde38b1461081b578063fc0c546a1461082e578063ffa1ad741461084157600080fd5b8063e85858d914610717578063e90a182f146107c3578063eac989f8146107d657600080fd5b8063dd62ed3e116100de578063dd62ed3e146106d5578063de032f58146106e8578063e12f3a61146106fb578063e834a8341461070e57600080fd5b8063c78d59851461069e578063c9557255146106af578063d505accf146106c257600080fd5b8063a9059cbb11610171578063bb22dccb1161014b578063bb22dccb1461063f578063bf38b5c814610654578063c32b132614610678578063c3cda5201461068b57600080fd5b8063a9059cbb14610365578063ab803a7614610624578063b6d8f79f1461062c57600080fd5b806395d89b41146105a25780639a0e7d66146105aa5780639ab24eb0146105b25780639b642de1146105c5578063a3f4df7e146105d8578063a457c2d71461061157600080fd5b80633a46b1a81161029257806370a08231116102305780637cb647591161020a5780637cb64759146105585780637ecebe001461056b5780638da5cb5b1461057e5780638e539e8c1461058f57600080fd5b806370a0823114610514578063715018a61461053d57806375aa9bc61461054557600080fd5b8063587cde1e1161026c578063587cde1e146104825780635c19a95c146104c6578063684de1f5146104d95780636fcfff45146104ec57600080fd5b80633a46b1a8146104545780633cf3a02514610467578063495906571461047a57600080fd5b80631f8d1d50116102ff5780632e7ba6ef116102d95780632e7ba6ef14610417578063313ce5671461042a5780633644e51514610439578063395093511461044157600080fd5b80631f8d1d50146103e857806323b872dd146103fb5780632ddbd13a1461040e57600080fd5b806306fdde0314610347578063095ea7b3146103655780630f56b96c14610388578063144fa6d7146103b857806318160ddd146103cd5780631be19560146103d5575b600080fd5b61034f610848565b60405161035c9190613034565b60405180910390f35b61037861037336600461307c565b6108da565b604051901515815260200161035c565b7f00000000000000000000000000000000000000000000000000000000000000005b60405190815260200161035c565b6103cb6103c63660046130a8565b6108f4565b005b6004546103aa565b6103cb6103e33660046130a8565b6109a1565b6103cb6103f63660046130c5565b610a78565b6103786104093660046130de565b610abc565b6103aa600f5481565b6103cb61042536600461311f565b610ae2565b6040516012815260200161035c565b6103aa610ba6565b61037861044f36600461307c565b610bb5565b6103aa61046236600461307c565b610bd7565b6103cb6104753660046130c5565b610c4a565b6016546103aa565b6104ae6104903660046130a8565b6001600160a01b039081166000908152600960205260409020541690565b6040516001600160a01b03909116815260200161035c565b6103cb6104d43660046130a8565b610d25565b6103cb6104e736600461311f565b610d32565b6104ff6104fa3660046130a8565b610d99565b60405163ffffffff909116815260200161035c565b6103aa6105223660046130a8565b6001600160a01b031660009081526002602052604090205490565b6103cb610dbb565b6103cb61055336600461307c565b610dcf565b6103cb6105663660046130c5565b61114c565b6103aa6105793660046130a8565b61115d565b6000546001600160a01b03166104ae565b6103aa61059d3660046130c5565b61117b565b61034f6111d7565b6103aa6111e6565b6103aa6105c03660046130a8565b6111f1565b6103cb6105d33660046131ce565b611278565b60408051808201909152601781527f436f6e74696e756f757356657374696e674d65726b6c65000000000000000000602082015261034f565b61037861061f36600461307c565b6112cf565b6103cb611355565b6103aa61063a36600461307c565b611373565b6103aa61064d3660046130a8565b5060125490565b6013546014546015546040805193845260208401929092529082015260600161035c565b6103cb61068636600461327f565b611407565b6103cb6106993660046132c1565b611464565b6001546001600160a01b03166104ae565b6103cb6106bd3660046130c5565b61159a565b6103cb6106d036600461331b565b6115d7565b6103aa6106e3366004613389565b61173b565b6103cb6106f63660046130a8565b611766565b6103aa6107093660046130a8565b611777565b6103aa60105481565b61078e6107253660046130a8565b6040805160608082018352600080835260208084018290529284018190526001600160a01b03949094168452600d825292829020825193840183525460ff8116151584526001600160781b036101008204811692850192909252600160801b9004169082015290565b604080518251151581526020808401516001600160781b0390811691830191909152928201519092169082015260600161035c565b6103cb6107d136600461307c565b6118c8565b61034f6118ea565b6107f16107ec3660046133c2565b611978565b60408051825163ffffffff1681526020928301516001600160e01b0316928101929092520161035c565b6103cb6108293660046130a8565b6119fc565b600e546104ae906001600160a01b031681565b60026103aa565b606060058054610857906133f9565b80601f0160208091040260200160405190810160405280929190818152602001828054610883906133f9565b80156108d05780601f106108a5576101008083540402835291602001916108d0565b820191906000526020600020905b8154815290600101906020018083116108b357829003601f168201915b5050505050905090565b6000336108e8818585611a72565b60019150505b92915050565b6108fc611aba565b6001600160a01b0381166109575760405162461bcd60e51b815260206004820152601f60248201527f41646a75737461626c653a20746f6b656e20697320616464726573732830290060448201526064015b60405180910390fd5b600e80546001600160a01b0319166001600160a01b0383169081179091556040517fefc1fd16ea80a922086ee4e995739d59b025c1bcea6d1f67855747480c83214b90600090a250565b6109a9611aba565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156109f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a14919061342d565b600154909150610a31906001600160a01b03848116911683611b14565b816001600160a01b03167ff4a44a7f605c4971a27bcecb448108e6328b7fad34fab5bff4f69377294b826d82604051610a6c91815260200190565b60405180910390a25050565b610a80611aba565b600f8190556040518181527fac657d3615bd618ee537848e2b33acd2a9df67d4776485ab6922b0421d324d29906020015b60405180910390a150565b600033610aca858285611b6b565b610ad5858585611a72565b60019150505b9392505050565b60408051602081018790526bffffffffffffffffffffffff19606087901b169181019190915260548101849052607401604051602081830303815290604052805190602001208282610b35838383611be5565b6002600c5403610b875760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161094e565b6002600c55610b968787611c2c565b50506001600c5550505050505050565b6000610bb0611c47565b905090565b6000336108e8818585610bc8838361173b565b610bd2919061345c565b611a72565b6000438210610c285760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e656400604482015260640161094e565b6001600160a01b0383166000908152600a60205260409020610adb9083611d6e565b610c52611aba565b6001546040516000916001600160a01b03169083905b60006040518083038185875af1925050503d8060008114610ca5576040519150601f19603f3d011682016040523d82523d6000602084013e610caa565b606091505b5050905080610cee5760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b604482015260640161094e565b6040518281527f3b381fdfc0e2729a70e8b26ae2397e9014f703a8235b557f5581c4ed47280fd29060200160405180910390a15050565b610d2f3382611e2b565b50565b60408051602081018790526bffffffffffffffffffffffff19606087901b169181019190915260548101849052607401604051602081830303815290604052805190602001208282610d85838383611be5565b610d8f8787611ea5565b5050505050505050565b6001600160a01b0381166000908152600a60205260408120546108ee90611ec0565b610dc3611aba565b610dcd6000611f29565b565b610dd7611aba565b6001600160a01b0382166000908152600d60209081526040918290208251606081018452905460ff811615158083526001600160781b036101008304811694840194909452600160801b90910490921692810192909252610e7a5760405162461bcd60e51b815260206004820181905260248201527f6d75737420696e697469616c697a65206265666f72652061646a757374696e67604482015260640161094e565b6000808313610e9157610e8c8361346f565b610e93565b825b90506001600160781b038110610eeb5760405162461bcd60e51b815260206004820152601860248201527f61646a7573746d656e74203e206d61782075696e743132300000000000000000604482015260640161094e565b600083121561107d5780600f541015610f565760405162461bcd60e51b815260206004820152602760248201527f64656372656173652067726561746572207468616e206469737472696275746f6044820152661c881d1bdd185b60ca1b606482015260840161094e565b8082602001516001600160781b03161015610fca5760405162461bcd60e51b815260206004820152602e60248201527f64656372656173652067726561746572207468616e206469737472696275746960448201526d1bdb949958dbdc99081d1bdd185b60921b606482015260840161094e565b80600f6000828254610fdc919061348b565b90915550506001600160a01b0384166000908152600d60205260409020805482919060019061101a90849061010090046001600160781b031661349e565b92506101000a8154816001600160781b0302191690836001600160781b031602179055506110666110536000546001600160a01b031690565b600e546001600160a01b03169083611b14565b6110788461107383611f79565b611fb4565b611103565b80600f600082825461108f919061345c565b90915550506001600160a01b0384166000908152600d6020526040902080548291906001906110cd90849061010090046001600160781b03166134c5565b92506101000a8154816001600160781b0302191690836001600160781b03160217905550611103846110fe83611f79565b611fcc565b836001600160a01b03167fd81661cef4e40e0f1f97384c033d606e4d6b570554fc3524568d8f9fc84c83888460405161113e91815260200190565b60405180910390a250505050565b611154611aba565b610d2f81612056565b6001600160a01b0381166000908152600760205260408120546108ee565b60004382106111cc5760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e656400604482015260640161094e565b6108ee600b83611d6e565b606060068054610857906133f9565b6000610bb060045490565b6001600160a01b0381166000908152600a60205260408120548015611265576001600160a01b0383166000908152600a6020526040902061123360018361348b565b81548110611243576112436134e5565b60009182526020909120015464010000000090046001600160e01b0316611268565b60005b6001600160e01b03169392505050565b611280611aba565b601161128c8282613549565b50601160405161129c9190613609565b604051908190038120907fd70c1392a974224e639e7a9607dcb2c766826aecfe2dc356f442ce0488b01e1f90600090a250565b600033816112dd828661173b565b90508381101561133d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161094e565b61134a8286868403611a72565b506001949350505050565b60015460405147916000916001600160a01b03909116908390610c68565b60006014548211611386575060006108ee565b60155482106113b657507f00000000000000000000000000000000000000000000000000000000000000006108ee565b6013546015546113c6919061348b565b6013546113d3908461348b565b6113fd907f000000000000000000000000000000000000000000000000000000000000000061367f565b610adb919061369e565b61140f611aba565b60138390556014829055601581905560408051848152602081018490529081018290527f34ebbb9e095e6c8737f99dd9923fb97ec1ca3d25cb39225975a934dd8d7a31b49060600160405180910390a1505050565b834211156114b45760405162461bcd60e51b815260206004820152601d60248201527f4552433230566f7465733a207369676e61747572652065787069726564000000604482015260640161094e565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b03881691810191909152606081018690526080810185905260009061152e906115269060a0016040516020818303038152906040528051906020012061208b565b8585856120d9565b905061153981612101565b86146115875760405162461bcd60e51b815260206004820152601960248201527f4552433230566f7465733a20696e76616c6964206e6f6e636500000000000000604482015260640161094e565b6115918188611e2b565b50505050505050565b6115a2611aba565b60128190556040518181527f6c339c0bee516a4df5d7074ba7a974856d609f83666e915aa4a0f90e06989dc590602001610ab1565b834211156116275760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161094e565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886116568c612101565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006116b18261208b565b905060006116c1828787876120d9565b9050896001600160a01b0316816001600160a01b0316146117245760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161094e565b61172f8a8a8a611a72565b50505050505050505050565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b61176e611aba565b610d2f81612129565b6001600160a01b0381166000908152600d602052604081205460ff166117ea5760405162461bcd60e51b815260206004820152602260248201527f4469737472696275746f723a20636c61696d206e6f7420696e697469616c697a604482015261195960f21b606482015260840161094e565b6001600160a01b0382166000908152600d602090815260408083208151606081018352905460ff8116151582526001600160781b036101008204811694830194909452600160801b900490921690820152907f00000000000000000000000000000000000000000000000000000000000000006118678542611373565b83602001516001600160781b031661187f919061367f565b611889919061369e565b90508082604001516001600160781b031610156118bd5760408201516118b8906001600160781b03168261348b565b6118c0565b60005b949350505050565b6118d0611aba565b600154610a31906001600160a01b03848116911683611b14565b601180546118f7906133f9565b80601f0160208091040260200160405190810160405280929190818152602001828054611923906133f9565b80156119705780601f1061194557610100808354040283529160200191611970565b820191906000526020600020905b81548152906001019060200180831161195357829003601f168201915b505050505081565b60408051808201909152600080825260208201526001600160a01b0383166000908152600a60205260409020805463ffffffff84169081106119bc576119bc6134e5565b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090046001600160e01b0316918101919091529392505050565b611a04611aba565b6001600160a01b038116611a695760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161094e565b610d2f81611f29565b60405162461bcd60e51b815260206004820152601960248201527f64697361626c656420666f7220766f74696e6720706f77657200000000000000604482015260640161094e565b6000546001600160a01b03163314610dcd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161094e565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611b66908490612177565b505050565b6000611b77848461173b565b90506000198114611bdf5781811015611bd25760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161094e565b611bdf8484848403611a72565b50505050565b611bf0838383612249565b611b665760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b210383937b7b360991b604482015260640161094e565b6000611c38838361228c565b90506108ee8361107383611f79565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015611ca057507f000000000000000000000000000000000000000000000000000000000000000046145b15611cca57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b8154600090815b81811015611dd2576000611d898284612446565b905084868281548110611d9e57611d9e6134e5565b60009182526020909120015463ffffffff161115611dbe57809250611dcc565b611dc981600161345c565b91505b50611d75565b8115611e165784611de460018461348b565b81548110611df457611df46134e5565b60009182526020909120015464010000000090046001600160e01b0316611e19565b60005b6001600160e01b031695945050505050565b6001600160a01b03828116600081815260096020818152604080842080546002845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4611bdf828483612461565b611eaf828261259e565b611ebc826110fe83611f79565b5050565b600063ffffffff821115611f255760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b606482015260840161094e565b5090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60007f000000000000000000000000000000000000000000000000000000000000000060125483611faa919061367f565b6108ee919061369e565b611fbe82826126fa565b611bdf600b61284f8361285b565b611fd682826129d4565b6004546001600160e01b0310156120485760405162461bcd60e51b815260206004820152603060248201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60448201526f766572666c6f77696e6720766f74657360801b606482015260840161094e565b611bdf600b612abb8361285b565b60168190556040518181527f914960aef5e033ce5cae8a7992d4b7a6f0f9741227b66acb67c605b7019f8a4690602001610ab1565b60006108ee612098611c47565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006120ea87878787612ac7565b915091506120f781612bb4565b5095945050505050565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527fccdd1baf560d2682736fa25752c8ccc0c5fc4079b245b0acf7389776308d5b1f90602001610ab1565b60006121cc826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d6a9092919063ffffffff16565b805190915015611b6657808060200190518101906121ea91906136c0565b611b665760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161094e565b60006118c0838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506016549150879050612d79565b6001600160a01b0382166000908152600d602052604081205482906001600160781b0380831661010090920416146122d1576122d184826001600160781b0316611ea5565b60006122dc85611777565b90506000816001600160781b03161161234f5760405162461bcd60e51b815260206004820152602f60248201527f4469737472696275746f723a206e6f206d6f726520746f6b656e7320636c616960448201526e6d61626c65207269676874206e6f7760881b606482015260840161094e565b6001600160a01b0385166000908152600d60205260409020805482919060109061238a908490600160801b90046001600160781b03166134c5565b92506101000a8154816001600160781b0302191690836001600160781b03160217905550806001600160781b0316601060008282546123c9919061345c565b9091555050600e546123ee906001600160a01b0316866001600160781b038416611b14565b6040516001600160781b03821681526001600160a01b038616907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a26001600160781b0316949350505050565b6000612455600284841861369e565b610adb9084841661345c565b816001600160a01b0316836001600160a01b0316141580156124835750600081115b15611b66576001600160a01b03831615612511576001600160a01b0383166000908152600a6020526040812081906124be9061284f8561285b565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612506929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615611b66576001600160a01b0382166000908152600a60205260408120819061254790612abb8561285b565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724838360405161258f929190918252602082015260400190565b60405180910390a25050505050565b806001600160781b03808216111561260d5760405162461bcd60e51b815260206004820152602c60248201527f4469737472696275746f723a20746f74616c416d6f756e74203e20747970652860448201526b0ead2dce8626460525cdac2f60a31b606482015260840161094e565b60408051606081018252600181526001600160781b0383811660208084018281526001600160a01b0389166000818152600d8085528882208054600160801b8082048a168b8d01908152948690529287529851945192516fffffffffffffffffffffffffffffffff199099169415156fffffffffffffffffffffffffffffff0019169490941761010092881692909202919091176effffffffffffffffffffffffffffff60801b191696909516909402949094179093559251928352917fdb598eb8e0a3d3d5c2e02e4cab1ee8b65bb20e48fc7b42f4c76272de4cdd2434910160405180910390a2505050565b6001600160a01b03821661275a5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161094e565b6001600160a01b038216600090815260026020526040902054818110156127ce5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161094e565b6001600160a01b03831660009081526002602052604081208383039055600480548492906127fd90849061348b565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3611b6683600084612d8f565b6000610adb828461348b565b8254600090819080156128a6578561287460018361348b565b81548110612884576128846134e5565b60009182526020909120015464010000000090046001600160e01b03166128a9565b60005b6001600160e01b031692506128c283858763ffffffff16565b9150600081118015612900575043866128dc60018461348b565b815481106128ec576128ec6134e5565b60009182526020909120015463ffffffff16145b156129605761290e82612dc1565b8661291a60018461348b565b8154811061292a5761292a6134e5565b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b031602179055506129cb565b85604051806040016040528061297543611ec0565b63ffffffff16815260200161298985612dc1565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b50935093915050565b6001600160a01b038216612a2a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161094e565b8060046000828254612a3c919061345c565b90915550506001600160a01b03821660009081526002602052604081208054839290612a6990849061345c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3611ebc60008383612d8f565b6000610adb828461345c565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612afe5750600090506003612bab565b8460ff16601b14158015612b1657508460ff16601c14155b15612b275750600090506004612bab565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612b7b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612ba457600060019250925050612bab565b9150600090505b94509492505050565b6000816004811115612bc857612bc86136e2565b03612bd05750565b6001816004811115612be457612be46136e2565b03612c315760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161094e565b6002816004811115612c4557612c456136e2565b03612c925760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161094e565b6003816004811115612ca657612ca66136e2565b03612cfe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161094e565b6004816004811115612d1257612d126136e2565b03610d2f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161094e565b60606118c08484600085612e2a565b600082612d868584612f5b565b14949350505050565b6001600160a01b03838116600090815260096020526040808220548584168352912054611b6692918216911683612461565b60006001600160e01b03821115611f255760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b606482015260840161094e565b606082471015612e8b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161094e565b6001600160a01b0385163b612ee25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161094e565b600080866001600160a01b03168587604051612efe91906136f8565b60006040518083038185875af1925050503d8060008114612f3b576040519150601f19603f3d011682016040523d82523d6000602084013e612f40565b606091505b5091509150612f50828286612fa8565b979650505050505050565b600081815b8451811015612fa057612f8c82868381518110612f7f57612f7f6134e5565b6020026020010151612fe1565b915080612f9881613714565b915050612f60565b509392505050565b60608315612fb7575081610adb565b825115612fc75782518084602001fd5b8160405162461bcd60e51b815260040161094e9190613034565b6000818310612ffd576000828152602084905260409020610adb565b6000838152602083905260409020610adb565b60005b8381101561302b578181015183820152602001613013565b50506000910152565b6020815260008251806020840152613053816040850160208701613010565b601f01601f19169190910160400192915050565b6001600160a01b0381168114610d2f57600080fd5b6000806040838503121561308f57600080fd5b823561309a81613067565b946020939093013593505050565b6000602082840312156130ba57600080fd5b8135610adb81613067565b6000602082840312156130d757600080fd5b5035919050565b6000806000606084860312156130f357600080fd5b83356130fe81613067565b9250602084013561310e81613067565b929592945050506040919091013590565b60008060008060006080868803121561313757600080fd5b85359450602086013561314981613067565b935060408601359250606086013567ffffffffffffffff8082111561316d57600080fd5b818801915088601f83011261318157600080fd5b81358181111561319057600080fd5b8960208260051b85010111156131a557600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156131e057600080fd5b813567ffffffffffffffff808211156131f857600080fd5b818401915084601f83011261320c57600080fd5b81358181111561321e5761321e6131b8565b604051601f8201601f19908116603f01168101908382118183101715613246576132466131b8565b8160405282815287602084870101111561325f57600080fd5b826020860160208301376000928101602001929092525095945050505050565b60008060006060848603121561329457600080fd5b505081359360208301359350604090920135919050565b803560ff811681146132bc57600080fd5b919050565b60008060008060008060c087890312156132da57600080fd5b86356132e581613067565b95506020870135945060408701359350613301606088016132ab565b92506080870135915060a087013590509295509295509295565b600080600080600080600060e0888a03121561333657600080fd5b873561334181613067565b9650602088013561335181613067565b9550604088013594506060880135935061336d608089016132ab565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561339c57600080fd5b82356133a781613067565b915060208301356133b781613067565b809150509250929050565b600080604083850312156133d557600080fd5b82356133e081613067565b9150602083013563ffffffff811681146133b757600080fd5b600181811c9082168061340d57607f821691505b60208210810361212357634e487b7160e01b600052602260045260246000fd5b60006020828403121561343f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156108ee576108ee613446565b6000600160ff1b820161348457613484613446565b5060000390565b818103818111156108ee576108ee613446565b6001600160781b038281168282160390808211156134be576134be613446565b5092915050565b6001600160781b038181168382160190808211156134be576134be613446565b634e487b7160e01b600052603260045260246000fd5b601f821115611b6657600081815260208120601f850160051c810160208610156135225750805b601f850160051c820191505b818110156135415782815560010161352e565b505050505050565b815167ffffffffffffffff811115613563576135636131b8565b6135778161357184546133f9565b846134fb565b602080601f8311600181146135ac57600084156135945750858301515b600019600386901b1c1916600185901b178555613541565b600085815260208120601f198616915b828110156135db578886015182559484019460019091019084016135bc565b50858210156135f95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808354613617816133f9565b6001828116801561362f576001811461364457613673565b60ff1984168752821515830287019450613673565b8760005260208060002060005b8581101561366a5781548a820152908401908201613651565b50505082870194505b50929695505050505050565b600081600019048311821515161561369957613699613446565b500290565b6000826136bb57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156136d257600080fd5b81518015158114610adb57600080fd5b634e487b7160e01b600052602160045260246000fd5b6000825161370a818460208701613010565b9190910192915050565b60006001820161372657613726613446565b506001019056fea2646970667358221220bd2bce89fd382d4c71c4afd7d720a3f35e11fa134f7e8a32673f4fb0048117b864736f6c63430008100033000000000000000000000000fe3b138879d6d0555be4132dcfe6e7424e257a2e00000000000000000000000000000000000000000000b574069502768a5f000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004e200000000000000000000000000000000000000000000000000000000063a792800000000000000000000000000000000000000000000000000000000063a7928000000000000000000000000000000000000000000000000000000000676b4b002561ecbc7b54ab93d0c17b20f6bec60d7de2bbf118d597a16ba799846c14c7290000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d5166323758623438616d587332317637684a4857377975593450683542335261423536584d4779354e42784c0000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103425760003560e01c806395d89b41116101b8578063c78d598511610104578063e85858d9116100a2578063f1127ed81161007c578063f1127ed8146107de578063f2fde38b1461081b578063fc0c546a1461082e578063ffa1ad741461084157600080fd5b8063e85858d914610717578063e90a182f146107c3578063eac989f8146107d657600080fd5b8063dd62ed3e116100de578063dd62ed3e146106d5578063de032f58146106e8578063e12f3a61146106fb578063e834a8341461070e57600080fd5b8063c78d59851461069e578063c9557255146106af578063d505accf146106c257600080fd5b8063a9059cbb11610171578063bb22dccb1161014b578063bb22dccb1461063f578063bf38b5c814610654578063c32b132614610678578063c3cda5201461068b57600080fd5b8063a9059cbb14610365578063ab803a7614610624578063b6d8f79f1461062c57600080fd5b806395d89b41146105a25780639a0e7d66146105aa5780639ab24eb0146105b25780639b642de1146105c5578063a3f4df7e146105d8578063a457c2d71461061157600080fd5b80633a46b1a81161029257806370a08231116102305780637cb647591161020a5780637cb64759146105585780637ecebe001461056b5780638da5cb5b1461057e5780638e539e8c1461058f57600080fd5b806370a0823114610514578063715018a61461053d57806375aa9bc61461054557600080fd5b8063587cde1e1161026c578063587cde1e146104825780635c19a95c146104c6578063684de1f5146104d95780636fcfff45146104ec57600080fd5b80633a46b1a8146104545780633cf3a02514610467578063495906571461047a57600080fd5b80631f8d1d50116102ff5780632e7ba6ef116102d95780632e7ba6ef14610417578063313ce5671461042a5780633644e51514610439578063395093511461044157600080fd5b80631f8d1d50146103e857806323b872dd146103fb5780632ddbd13a1461040e57600080fd5b806306fdde0314610347578063095ea7b3146103655780630f56b96c14610388578063144fa6d7146103b857806318160ddd146103cd5780631be19560146103d5575b600080fd5b61034f610848565b60405161035c9190613034565b60405180910390f35b61037861037336600461307c565b6108da565b604051901515815260200161035c565b7f0000000000000000000000000000000000000000000000000de0b6b3a76400005b60405190815260200161035c565b6103cb6103c63660046130a8565b6108f4565b005b6004546103aa565b6103cb6103e33660046130a8565b6109a1565b6103cb6103f63660046130c5565b610a78565b6103786104093660046130de565b610abc565b6103aa600f5481565b6103cb61042536600461311f565b610ae2565b6040516012815260200161035c565b6103aa610ba6565b61037861044f36600461307c565b610bb5565b6103aa61046236600461307c565b610bd7565b6103cb6104753660046130c5565b610c4a565b6016546103aa565b6104ae6104903660046130a8565b6001600160a01b039081166000908152600960205260409020541690565b6040516001600160a01b03909116815260200161035c565b6103cb6104d43660046130a8565b610d25565b6103cb6104e736600461311f565b610d32565b6104ff6104fa3660046130a8565b610d99565b60405163ffffffff909116815260200161035c565b6103aa6105223660046130a8565b6001600160a01b031660009081526002602052604090205490565b6103cb610dbb565b6103cb61055336600461307c565b610dcf565b6103cb6105663660046130c5565b61114c565b6103aa6105793660046130a8565b61115d565b6000546001600160a01b03166104ae565b6103aa61059d3660046130c5565b61117b565b61034f6111d7565b6103aa6111e6565b6103aa6105c03660046130a8565b6111f1565b6103cb6105d33660046131ce565b611278565b60408051808201909152601781527f436f6e74696e756f757356657374696e674d65726b6c65000000000000000000602082015261034f565b61037861061f36600461307c565b6112cf565b6103cb611355565b6103aa61063a36600461307c565b611373565b6103aa61064d3660046130a8565b5060125490565b6013546014546015546040805193845260208401929092529082015260600161035c565b6103cb61068636600461327f565b611407565b6103cb6106993660046132c1565b611464565b6001546001600160a01b03166104ae565b6103cb6106bd3660046130c5565b61159a565b6103cb6106d036600461331b565b6115d7565b6103aa6106e3366004613389565b61173b565b6103cb6106f63660046130a8565b611766565b6103aa6107093660046130a8565b611777565b6103aa60105481565b61078e6107253660046130a8565b6040805160608082018352600080835260208084018290529284018190526001600160a01b03949094168452600d825292829020825193840183525460ff8116151584526001600160781b036101008204811692850192909252600160801b9004169082015290565b604080518251151581526020808401516001600160781b0390811691830191909152928201519092169082015260600161035c565b6103cb6107d136600461307c565b6118c8565b61034f6118ea565b6107f16107ec3660046133c2565b611978565b60408051825163ffffffff1681526020928301516001600160e01b0316928101929092520161035c565b6103cb6108293660046130a8565b6119fc565b600e546104ae906001600160a01b031681565b60026103aa565b606060058054610857906133f9565b80601f0160208091040260200160405190810160405280929190818152602001828054610883906133f9565b80156108d05780601f106108a5576101008083540402835291602001916108d0565b820191906000526020600020905b8154815290600101906020018083116108b357829003601f168201915b5050505050905090565b6000336108e8818585611a72565b60019150505b92915050565b6108fc611aba565b6001600160a01b0381166109575760405162461bcd60e51b815260206004820152601f60248201527f41646a75737461626c653a20746f6b656e20697320616464726573732830290060448201526064015b60405180910390fd5b600e80546001600160a01b0319166001600160a01b0383169081179091556040517fefc1fd16ea80a922086ee4e995739d59b025c1bcea6d1f67855747480c83214b90600090a250565b6109a9611aba565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156109f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a14919061342d565b600154909150610a31906001600160a01b03848116911683611b14565b816001600160a01b03167ff4a44a7f605c4971a27bcecb448108e6328b7fad34fab5bff4f69377294b826d82604051610a6c91815260200190565b60405180910390a25050565b610a80611aba565b600f8190556040518181527fac657d3615bd618ee537848e2b33acd2a9df67d4776485ab6922b0421d324d29906020015b60405180910390a150565b600033610aca858285611b6b565b610ad5858585611a72565b60019150505b9392505050565b60408051602081018790526bffffffffffffffffffffffff19606087901b169181019190915260548101849052607401604051602081830303815290604052805190602001208282610b35838383611be5565b6002600c5403610b875760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161094e565b6002600c55610b968787611c2c565b50506001600c5550505050505050565b6000610bb0611c47565b905090565b6000336108e8818585610bc8838361173b565b610bd2919061345c565b611a72565b6000438210610c285760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e656400604482015260640161094e565b6001600160a01b0383166000908152600a60205260409020610adb9083611d6e565b610c52611aba565b6001546040516000916001600160a01b03169083905b60006040518083038185875af1925050503d8060008114610ca5576040519150601f19603f3d011682016040523d82523d6000602084013e610caa565b606091505b5050905080610cee5760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b604482015260640161094e565b6040518281527f3b381fdfc0e2729a70e8b26ae2397e9014f703a8235b557f5581c4ed47280fd29060200160405180910390a15050565b610d2f3382611e2b565b50565b60408051602081018790526bffffffffffffffffffffffff19606087901b169181019190915260548101849052607401604051602081830303815290604052805190602001208282610d85838383611be5565b610d8f8787611ea5565b5050505050505050565b6001600160a01b0381166000908152600a60205260408120546108ee90611ec0565b610dc3611aba565b610dcd6000611f29565b565b610dd7611aba565b6001600160a01b0382166000908152600d60209081526040918290208251606081018452905460ff811615158083526001600160781b036101008304811694840194909452600160801b90910490921692810192909252610e7a5760405162461bcd60e51b815260206004820181905260248201527f6d75737420696e697469616c697a65206265666f72652061646a757374696e67604482015260640161094e565b6000808313610e9157610e8c8361346f565b610e93565b825b90506001600160781b038110610eeb5760405162461bcd60e51b815260206004820152601860248201527f61646a7573746d656e74203e206d61782075696e743132300000000000000000604482015260640161094e565b600083121561107d5780600f541015610f565760405162461bcd60e51b815260206004820152602760248201527f64656372656173652067726561746572207468616e206469737472696275746f6044820152661c881d1bdd185b60ca1b606482015260840161094e565b8082602001516001600160781b03161015610fca5760405162461bcd60e51b815260206004820152602e60248201527f64656372656173652067726561746572207468616e206469737472696275746960448201526d1bdb949958dbdc99081d1bdd185b60921b606482015260840161094e565b80600f6000828254610fdc919061348b565b90915550506001600160a01b0384166000908152600d60205260409020805482919060019061101a90849061010090046001600160781b031661349e565b92506101000a8154816001600160781b0302191690836001600160781b031602179055506110666110536000546001600160a01b031690565b600e546001600160a01b03169083611b14565b6110788461107383611f79565b611fb4565b611103565b80600f600082825461108f919061345c565b90915550506001600160a01b0384166000908152600d6020526040902080548291906001906110cd90849061010090046001600160781b03166134c5565b92506101000a8154816001600160781b0302191690836001600160781b03160217905550611103846110fe83611f79565b611fcc565b836001600160a01b03167fd81661cef4e40e0f1f97384c033d606e4d6b570554fc3524568d8f9fc84c83888460405161113e91815260200190565b60405180910390a250505050565b611154611aba565b610d2f81612056565b6001600160a01b0381166000908152600760205260408120546108ee565b60004382106111cc5760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e656400604482015260640161094e565b6108ee600b83611d6e565b606060068054610857906133f9565b6000610bb060045490565b6001600160a01b0381166000908152600a60205260408120548015611265576001600160a01b0383166000908152600a6020526040902061123360018361348b565b81548110611243576112436134e5565b60009182526020909120015464010000000090046001600160e01b0316611268565b60005b6001600160e01b03169392505050565b611280611aba565b601161128c8282613549565b50601160405161129c9190613609565b604051908190038120907fd70c1392a974224e639e7a9607dcb2c766826aecfe2dc356f442ce0488b01e1f90600090a250565b600033816112dd828661173b565b90508381101561133d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161094e565b61134a8286868403611a72565b506001949350505050565b60015460405147916000916001600160a01b03909116908390610c68565b60006014548211611386575060006108ee565b60155482106113b657507f0000000000000000000000000000000000000000000000000de0b6b3a76400006108ee565b6013546015546113c6919061348b565b6013546113d3908461348b565b6113fd907f0000000000000000000000000000000000000000000000000de0b6b3a764000061367f565b610adb919061369e565b61140f611aba565b60138390556014829055601581905560408051848152602081018490529081018290527f34ebbb9e095e6c8737f99dd9923fb97ec1ca3d25cb39225975a934dd8d7a31b49060600160405180910390a1505050565b834211156114b45760405162461bcd60e51b815260206004820152601d60248201527f4552433230566f7465733a207369676e61747572652065787069726564000000604482015260640161094e565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b03881691810191909152606081018690526080810185905260009061152e906115269060a0016040516020818303038152906040528051906020012061208b565b8585856120d9565b905061153981612101565b86146115875760405162461bcd60e51b815260206004820152601960248201527f4552433230566f7465733a20696e76616c6964206e6f6e636500000000000000604482015260640161094e565b6115918188611e2b565b50505050505050565b6115a2611aba565b60128190556040518181527f6c339c0bee516a4df5d7074ba7a974856d609f83666e915aa4a0f90e06989dc590602001610ab1565b834211156116275760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161094e565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886116568c612101565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006116b18261208b565b905060006116c1828787876120d9565b9050896001600160a01b0316816001600160a01b0316146117245760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161094e565b61172f8a8a8a611a72565b50505050505050505050565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b61176e611aba565b610d2f81612129565b6001600160a01b0381166000908152600d602052604081205460ff166117ea5760405162461bcd60e51b815260206004820152602260248201527f4469737472696275746f723a20636c61696d206e6f7420696e697469616c697a604482015261195960f21b606482015260840161094e565b6001600160a01b0382166000908152600d602090815260408083208151606081018352905460ff8116151582526001600160781b036101008204811694830194909452600160801b900490921690820152907f0000000000000000000000000000000000000000000000000de0b6b3a76400006118678542611373565b83602001516001600160781b031661187f919061367f565b611889919061369e565b90508082604001516001600160781b031610156118bd5760408201516118b8906001600160781b03168261348b565b6118c0565b60005b949350505050565b6118d0611aba565b600154610a31906001600160a01b03848116911683611b14565b601180546118f7906133f9565b80601f0160208091040260200160405190810160405280929190818152602001828054611923906133f9565b80156119705780601f1061194557610100808354040283529160200191611970565b820191906000526020600020905b81548152906001019060200180831161195357829003601f168201915b505050505081565b60408051808201909152600080825260208201526001600160a01b0383166000908152600a60205260409020805463ffffffff84169081106119bc576119bc6134e5565b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090046001600160e01b0316918101919091529392505050565b611a04611aba565b6001600160a01b038116611a695760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161094e565b610d2f81611f29565b60405162461bcd60e51b815260206004820152601960248201527f64697361626c656420666f7220766f74696e6720706f77657200000000000000604482015260640161094e565b6000546001600160a01b03163314610dcd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161094e565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611b66908490612177565b505050565b6000611b77848461173b565b90506000198114611bdf5781811015611bd25760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161094e565b611bdf8484848403611a72565b50505050565b611bf0838383612249565b611b665760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b210383937b7b360991b604482015260640161094e565b6000611c38838361228c565b90506108ee8361107383611f79565b6000306001600160a01b037f000000000000000000000000254a29f542350cd62b31e336d9f4b70677a4fabf16148015611ca057507f000000000000000000000000000000000000000000000000000000000000000146145b15611cca57507f50c391a12610b4cf61dc641fdf8e519e0362c8cddbf152b6e0ee27f189bf283790565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f7adf110a426601fee3ec52a867eb767f9316ecf57248c25e6c84aae35304fb4e828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b8154600090815b81811015611dd2576000611d898284612446565b905084868281548110611d9e57611d9e6134e5565b60009182526020909120015463ffffffff161115611dbe57809250611dcc565b611dc981600161345c565b91505b50611d75565b8115611e165784611de460018461348b565b81548110611df457611df46134e5565b60009182526020909120015464010000000090046001600160e01b0316611e19565b60005b6001600160e01b031695945050505050565b6001600160a01b03828116600081815260096020818152604080842080546002845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4611bdf828483612461565b611eaf828261259e565b611ebc826110fe83611f79565b5050565b600063ffffffff821115611f255760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b606482015260840161094e565b5090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60007f0000000000000000000000000000000000000000000000000de0b6b3a764000060125483611faa919061367f565b6108ee919061369e565b611fbe82826126fa565b611bdf600b61284f8361285b565b611fd682826129d4565b6004546001600160e01b0310156120485760405162461bcd60e51b815260206004820152603060248201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60448201526f766572666c6f77696e6720766f74657360801b606482015260840161094e565b611bdf600b612abb8361285b565b60168190556040518181527f914960aef5e033ce5cae8a7992d4b7a6f0f9741227b66acb67c605b7019f8a4690602001610ab1565b60006108ee612098611c47565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006120ea87878787612ac7565b915091506120f781612bb4565b5095945050505050565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527fccdd1baf560d2682736fa25752c8ccc0c5fc4079b245b0acf7389776308d5b1f90602001610ab1565b60006121cc826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d6a9092919063ffffffff16565b805190915015611b6657808060200190518101906121ea91906136c0565b611b665760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161094e565b60006118c0838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506016549150879050612d79565b6001600160a01b0382166000908152600d602052604081205482906001600160781b0380831661010090920416146122d1576122d184826001600160781b0316611ea5565b60006122dc85611777565b90506000816001600160781b03161161234f5760405162461bcd60e51b815260206004820152602f60248201527f4469737472696275746f723a206e6f206d6f726520746f6b656e7320636c616960448201526e6d61626c65207269676874206e6f7760881b606482015260840161094e565b6001600160a01b0385166000908152600d60205260409020805482919060109061238a908490600160801b90046001600160781b03166134c5565b92506101000a8154816001600160781b0302191690836001600160781b03160217905550806001600160781b0316601060008282546123c9919061345c565b9091555050600e546123ee906001600160a01b0316866001600160781b038416611b14565b6040516001600160781b03821681526001600160a01b038616907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a26001600160781b0316949350505050565b6000612455600284841861369e565b610adb9084841661345c565b816001600160a01b0316836001600160a01b0316141580156124835750600081115b15611b66576001600160a01b03831615612511576001600160a01b0383166000908152600a6020526040812081906124be9061284f8561285b565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612506929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615611b66576001600160a01b0382166000908152600a60205260408120819061254790612abb8561285b565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724838360405161258f929190918252602082015260400190565b60405180910390a25050505050565b806001600160781b03808216111561260d5760405162461bcd60e51b815260206004820152602c60248201527f4469737472696275746f723a20746f74616c416d6f756e74203e20747970652860448201526b0ead2dce8626460525cdac2f60a31b606482015260840161094e565b60408051606081018252600181526001600160781b0383811660208084018281526001600160a01b0389166000818152600d8085528882208054600160801b8082048a168b8d01908152948690529287529851945192516fffffffffffffffffffffffffffffffff199099169415156fffffffffffffffffffffffffffffff0019169490941761010092881692909202919091176effffffffffffffffffffffffffffff60801b191696909516909402949094179093559251928352917fdb598eb8e0a3d3d5c2e02e4cab1ee8b65bb20e48fc7b42f4c76272de4cdd2434910160405180910390a2505050565b6001600160a01b03821661275a5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161094e565b6001600160a01b038216600090815260026020526040902054818110156127ce5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161094e565b6001600160a01b03831660009081526002602052604081208383039055600480548492906127fd90849061348b565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3611b6683600084612d8f565b6000610adb828461348b565b8254600090819080156128a6578561287460018361348b565b81548110612884576128846134e5565b60009182526020909120015464010000000090046001600160e01b03166128a9565b60005b6001600160e01b031692506128c283858763ffffffff16565b9150600081118015612900575043866128dc60018461348b565b815481106128ec576128ec6134e5565b60009182526020909120015463ffffffff16145b156129605761290e82612dc1565b8661291a60018461348b565b8154811061292a5761292a6134e5565b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b031602179055506129cb565b85604051806040016040528061297543611ec0565b63ffffffff16815260200161298985612dc1565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b50935093915050565b6001600160a01b038216612a2a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161094e565b8060046000828254612a3c919061345c565b90915550506001600160a01b03821660009081526002602052604081208054839290612a6990849061345c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3611ebc60008383612d8f565b6000610adb828461345c565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612afe5750600090506003612bab565b8460ff16601b14158015612b1657508460ff16601c14155b15612b275750600090506004612bab565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612b7b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612ba457600060019250925050612bab565b9150600090505b94509492505050565b6000816004811115612bc857612bc86136e2565b03612bd05750565b6001816004811115612be457612be46136e2565b03612c315760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161094e565b6002816004811115612c4557612c456136e2565b03612c925760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161094e565b6003816004811115612ca657612ca66136e2565b03612cfe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161094e565b6004816004811115612d1257612d126136e2565b03610d2f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161094e565b60606118c08484600085612e2a565b600082612d868584612f5b565b14949350505050565b6001600160a01b03838116600090815260096020526040808220548584168352912054611b6692918216911683612461565b60006001600160e01b03821115611f255760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b606482015260840161094e565b606082471015612e8b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161094e565b6001600160a01b0385163b612ee25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161094e565b600080866001600160a01b03168587604051612efe91906136f8565b60006040518083038185875af1925050503d8060008114612f3b576040519150601f19603f3d011682016040523d82523d6000602084013e612f40565b606091505b5091509150612f50828286612fa8565b979650505050505050565b600081815b8451811015612fa057612f8c82868381518110612f7f57612f7f6134e5565b6020026020010151612fe1565b915080612f9881613714565b915050612f60565b509392505050565b60608315612fb7575081610adb565b825115612fc75782518084602001fd5b8160405162461bcd60e51b815260040161094e9190613034565b6000818310612ffd576000828152602084905260409020610adb565b6000838152602083905260409020610adb565b60005b8381101561302b578181015183820152602001613013565b50506000910152565b6020815260008251806020840152613053816040850160208701613010565b601f01601f19169190910160400192915050565b6001600160a01b0381168114610d2f57600080fd5b6000806040838503121561308f57600080fd5b823561309a81613067565b946020939093013593505050565b6000602082840312156130ba57600080fd5b8135610adb81613067565b6000602082840312156130d757600080fd5b5035919050565b6000806000606084860312156130f357600080fd5b83356130fe81613067565b9250602084013561310e81613067565b929592945050506040919091013590565b60008060008060006080868803121561313757600080fd5b85359450602086013561314981613067565b935060408601359250606086013567ffffffffffffffff8082111561316d57600080fd5b818801915088601f83011261318157600080fd5b81358181111561319057600080fd5b8960208260051b85010111156131a557600080fd5b9699959850939650602001949392505050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156131e057600080fd5b813567ffffffffffffffff808211156131f857600080fd5b818401915084601f83011261320c57600080fd5b81358181111561321e5761321e6131b8565b604051601f8201601f19908116603f01168101908382118183101715613246576132466131b8565b8160405282815287602084870101111561325f57600080fd5b826020860160208301376000928101602001929092525095945050505050565b60008060006060848603121561329457600080fd5b505081359360208301359350604090920135919050565b803560ff811681146132bc57600080fd5b919050565b60008060008060008060c087890312156132da57600080fd5b86356132e581613067565b95506020870135945060408701359350613301606088016132ab565b92506080870135915060a087013590509295509295509295565b600080600080600080600060e0888a03121561333657600080fd5b873561334181613067565b9650602088013561335181613067565b9550604088013594506060880135935061336d608089016132ab565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561339c57600080fd5b82356133a781613067565b915060208301356133b781613067565b809150509250929050565b600080604083850312156133d557600080fd5b82356133e081613067565b9150602083013563ffffffff811681146133b757600080fd5b600181811c9082168061340d57607f821691505b60208210810361212357634e487b7160e01b600052602260045260246000fd5b60006020828403121561343f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156108ee576108ee613446565b6000600160ff1b820161348457613484613446565b5060000390565b818103818111156108ee576108ee613446565b6001600160781b038281168282160390808211156134be576134be613446565b5092915050565b6001600160781b038181168382160190808211156134be576134be613446565b634e487b7160e01b600052603260045260246000fd5b601f821115611b6657600081815260208120601f850160051c810160208610156135225750805b601f850160051c820191505b818110156135415782815560010161352e565b505050505050565b815167ffffffffffffffff811115613563576135636131b8565b6135778161357184546133f9565b846134fb565b602080601f8311600181146135ac57600084156135945750858301515b600019600386901b1c1916600185901b178555613541565b600085815260208120601f198616915b828110156135db578886015182559484019460019091019084016135bc565b50858210156135f95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808354613617816133f9565b6001828116801561362f576001811461364457613673565b60ff1984168752821515830287019450613673565b8760005260208060002060005b8581101561366a5781548a820152908401908201613651565b50505082870194505b50929695505050505050565b600081600019048311821515161561369957613699613446565b500290565b6000826136bb57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156136d257600080fd5b81518015158114610adb57600080fd5b634e487b7160e01b600052602160045260246000fd5b6000825161370a818460208701613010565b9190910192915050565b60006001820161372657613726613446565b506001019056fea2646970667358221220bd2bce89fd382d4c71c4afd7d720a3f35e11fa134f7e8a32673f4fb0048117b864736f6c63430008100033
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.