Source Code
More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 856 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Approve | 27761220 | 17 days ago | IN | 0 ETH | 0.00000171 | ||||
| Approve | 27180698 | 31 days ago | IN | 0 ETH | 0.00000166 | ||||
| Transfer | 26581367 | 49 days ago | IN | 0 ETH | 0.00000475 | ||||
| Transfer | 26580818 | 49 days ago | IN | 0 ETH | 0.00000485 | ||||
| Approve | 25281297 | 86 days ago | IN | 0 ETH | 0.00000243 | ||||
| Approve | 25037847 | 92 days ago | IN | 0 ETH | 0.00000124 | ||||
| Approve | 24967403 | 94 days ago | IN | 0 ETH | 0.00000217 | ||||
| Transfer | 24940540 | 95 days ago | IN | 0 ETH | 0.00000566 | ||||
| Transfer | 24936733 | 95 days ago | IN | 0 ETH | 0.00000563 | ||||
| Approve | 24739093 | 101 days ago | IN | 0 ETH | 0.00000217 | ||||
| Approve | 23935762 | 122 days ago | IN | 0 ETH | 0.00000216 | ||||
| Approve | 23771587 | 126 days ago | IN | 0 ETH | 0.00000216 | ||||
| Approve | 23442623 | 134 days ago | IN | 0 ETH | 0.00000131 | ||||
| Transfer | 23369120 | 136 days ago | IN | 0 ETH | 0.0000059 | ||||
| Transfer | 23364102 | 136 days ago | IN | 0 ETH | 0.00000608 | ||||
| Permit | 23354223 | 136 days ago | IN | 0 ETH | 0.00000449 | ||||
| Approve | 23354216 | 136 days ago | IN | 0 ETH | 0.00000198 | ||||
| Permit | 23353999 | 136 days ago | IN | 0 ETH | 0.00000449 | ||||
| Approve | 23353981 | 136 days ago | IN | 0 ETH | 0.00000198 | ||||
| Approve | 22928832 | 147 days ago | IN | 0 ETH | 0.00000225 | ||||
| Permit | 22534034 | 156 days ago | IN | 0 ETH | 0.00000264 | ||||
| Approve | 22136971 | 165 days ago | IN | 0 ETH | 0.00000118 | ||||
| Approve | 21768454 | 174 days ago | IN | 0 ETH | 0.00000184 | ||||
| Transfer | 21602862 | 179 days ago | IN | 0 ETH | 0.00000632 | ||||
| Transfer | 21602231 | 179 days ago | IN | 0 ETH | 0.00000632 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 28440440 | 9 hrs ago | 0 ETH | ||||
| 28440440 | 9 hrs ago | 0 ETH | ||||
| 28440440 | 9 hrs ago | 0 ETH | ||||
| 28440440 | 9 hrs ago | 0 ETH | ||||
| 28440440 | 9 hrs ago | 0 ETH | ||||
| 28387507 | 2 days ago | 0 ETH | ||||
| 28387507 | 2 days ago | 0 ETH | ||||
| 28305096 | 4 days ago | 0 ETH | ||||
| 28305096 | 4 days ago | 0 ETH | ||||
| 28305096 | 4 days ago | 0 ETH | ||||
| 28305096 | 4 days ago | 0 ETH | ||||
| 28305096 | 4 days ago | 0 ETH | ||||
| 28111772 | 9 days ago | 0 ETH | ||||
| 28111772 | 9 days ago | 0 ETH | ||||
| 28111772 | 9 days ago | 0 ETH | ||||
| 28111772 | 9 days ago | 0 ETH | ||||
| 28111772 | 9 days ago | 0 ETH | ||||
| 28098708 | 9 days ago | 0 ETH | ||||
| 28098708 | 9 days ago | 0 ETH | ||||
| 28098708 | 9 days ago | 0 ETH | ||||
| 28098708 | 9 days ago | 0 ETH | ||||
| 28078249 | 9 days ago | 0 ETH | ||||
| 28078249 | 9 days ago | 0 ETH | ||||
| 28078249 | 9 days ago | 0 ETH | ||||
| 28078249 | 9 days ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Elk
Compiler Version
v0.8.18+commit.87f61d96
Contract Source Code (Solidity)
/**
*Submitted for verification at lineascan.build/ on 2024-04-20
*/
// File: @openzeppelin/contracts/utils/math/SafeCast.sol
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
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 downcasted) {
downcasted = int248(value);
require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
}
/**
* @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 downcasted) {
downcasted = int240(value);
require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
}
/**
* @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 downcasted) {
downcasted = int232(value);
require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
}
/**
* @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 downcasted) {
downcasted = int224(value);
require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
}
/**
* @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 downcasted) {
downcasted = int216(value);
require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
}
/**
* @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 downcasted) {
downcasted = int208(value);
require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
}
/**
* @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 downcasted) {
downcasted = int200(value);
require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
}
/**
* @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 downcasted) {
downcasted = int192(value);
require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
}
/**
* @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 downcasted) {
downcasted = int184(value);
require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
}
/**
* @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 downcasted) {
downcasted = int176(value);
require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
}
/**
* @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 downcasted) {
downcasted = int168(value);
require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
}
/**
* @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 downcasted) {
downcasted = int160(value);
require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
}
/**
* @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 downcasted) {
downcasted = int152(value);
require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
}
/**
* @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 downcasted) {
downcasted = int144(value);
require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
}
/**
* @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 downcasted) {
downcasted = int136(value);
require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
}
/**
* @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 downcasted) {
downcasted = int128(value);
require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
}
/**
* @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 downcasted) {
downcasted = int120(value);
require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
}
/**
* @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 downcasted) {
downcasted = int112(value);
require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
}
/**
* @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 downcasted) {
downcasted = int104(value);
require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
}
/**
* @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 downcasted) {
downcasted = int96(value);
require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
}
/**
* @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 downcasted) {
downcasted = int88(value);
require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
}
/**
* @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 downcasted) {
downcasted = int80(value);
require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
}
/**
* @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 downcasted) {
downcasted = int72(value);
require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
}
/**
* @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 downcasted) {
downcasted = int64(value);
require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
}
/**
* @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 downcasted) {
downcasted = int56(value);
require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
}
/**
* @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 downcasted) {
downcasted = int48(value);
require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
}
/**
* @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 downcasted) {
downcasted = int40(value);
require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
}
/**
* @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 downcasted) {
downcasted = int32(value);
require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
}
/**
* @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 downcasted) {
downcasted = int24(value);
require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
}
/**
* @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 downcasted) {
downcasted = int16(value);
require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
}
/**
* @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 downcasted) {
downcasted = int8(value);
require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
}
/**
* @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);
}
}
// File: @openzeppelin/contracts/governance/utils/IVotes.sol
// 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;
}
// File: @openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol
// 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);
}
// File: @openzeppelin/contracts/utils/Counters.sol
// 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;
}
}
// File: @openzeppelin/contracts/utils/math/Math.sol
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
// File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
// File: @openzeppelin/contracts/utils/cryptography/EIP712.sol
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.0;
/**
* @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);
}
}
// File: @openzeppelin/contracts/utils/StorageSlot.sol
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
}
// File: @openzeppelin/contracts/utils/Arrays.sol
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Arrays.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to array types.
*/
library Arrays {
using StorageSlot for bytes32;
/**
* @dev Searches a sorted `array` and returns the first index that contains
* a value greater or equal to `element`. If no such index exists (i.e. all
* values in the array are strictly less than `element`), the array length is
* returned. Time complexity O(log n).
*
* `array` is expected to be sorted in ascending order, and to contain no
* repeated elements.
*/
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
if (array.length == 0) {
return 0;
}
uint256 low = 0;
uint256 high = array.length;
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds down (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
low = mid + 1;
}
}
// At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
if (low > 0 && unsafeAccess(array, low - 1).value == element) {
return low - 1;
} else {
return low;
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
bytes32 slot;
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getAddressSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
bytes32 slot;
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getBytes32Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
bytes32 slot;
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getUint256Slot();
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// 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;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @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);
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// 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);
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
/**
* @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);
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* 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;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
// File: @openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/extensions/draft-ERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @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();
}
}
// File: @openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol
// OpenZeppelin Contracts (last updated v4.8.1) (token/ERC20/extensions/ERC20Votes.sol)
pragma solidity ^0.8.0;
/**
* @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`.
//
// Initially we check if the block is recent to narrow the search range.
// 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 length = ckpts.length;
uint256 low = 0;
uint256 high = length;
if (length > 5) {
uint256 mid = length - Math.sqrt(length);
if (_unsafeAccess(ckpts, mid).fromBlock > blockNumber) {
high = mid;
} else {
low = mid + 1;
}
}
while (low < high) {
uint256 mid = Math.average(low, high);
if (_unsafeAccess(ckpts, mid).fromBlock > blockNumber) {
high = mid;
} else {
low = mid + 1;
}
}
return high == 0 ? 0 : _unsafeAccess(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 {IVotes-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 {IVotes-DelegateChanged} and {IVotes-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;
Checkpoint memory oldCkpt = pos == 0 ? Checkpoint(0, 0) : _unsafeAccess(ckpts, pos - 1);
oldWeight = oldCkpt.votes;
newWeight = op(oldWeight, delta);
if (pos > 0 && oldCkpt.fromBlock == block.number) {
_unsafeAccess(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;
}
/**
* @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.
*/
function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) {
assembly {
mstore(0, ckpts.slot)
result.slot := add(keccak256(0, 0x20), pos)
}
}
}
// File: @openzeppelin/contracts/token/ERC20/extensions/ERC20Snapshot.sol
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC20Snapshot.sol)
pragma solidity ^0.8.0;
/**
* @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and
* total supply at the time are recorded for later access.
*
* This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting.
* In naive implementations it's possible to perform a "double spend" attack by reusing the same balance from different
* accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be
* used to create an efficient ERC20 forking mechanism.
*
* Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a
* snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot
* id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id
* and the account address.
*
* NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it
* return `block.number` will trigger the creation of snapshot at the beginning of each new block. When overriding this
* function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract.
*
* Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient
* alternative consider {ERC20Votes}.
*
* ==== Gas Costs
*
* Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log
* n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much
* smaller since identical balances in subsequent snapshots are stored as a single entry.
*
* There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is
* only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent
* transfers will have normal cost until the next snapshot, and so on.
*/
abstract contract ERC20Snapshot is ERC20 {
// Inspired by Jordi Baylina's MiniMeToken to record historical balances:
// https://github.com/Giveth/minime/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol
using Arrays for uint256[];
using Counters for Counters.Counter;
// Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a
// Snapshot struct, but that would impede usage of functions that work on an array.
struct Snapshots {
uint256[] ids;
uint256[] values;
}
mapping(address => Snapshots) private _accountBalanceSnapshots;
Snapshots private _totalSupplySnapshots;
// Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid.
Counters.Counter private _currentSnapshotId;
/**
* @dev Emitted by {_snapshot} when a snapshot identified by `id` is created.
*/
event Snapshot(uint256 id);
/**
* @dev Creates a new snapshot and returns its snapshot id.
*
* Emits a {Snapshot} event that contains the same id.
*
* {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a
* set of accounts, for example using {AccessControl}, or it may be open to the public.
*
* [WARNING]
* ====
* While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking,
* you must consider that it can potentially be used by attackers in two ways.
*
* First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow
* logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target
* specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs
* section above.
*
* We haven't measured the actual numbers; if this is something you're interested in please reach out to us.
* ====
*/
function _snapshot() internal virtual returns (uint256) {
_currentSnapshotId.increment();
uint256 currentId = _getCurrentSnapshotId();
emit Snapshot(currentId);
return currentId;
}
/**
* @dev Get the current snapshotId
*/
function _getCurrentSnapshotId() internal view virtual returns (uint256) {
return _currentSnapshotId.current();
}
/**
* @dev Retrieves the balance of `account` at the time `snapshotId` was created.
*/
function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {
(bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);
return snapshotted ? value : balanceOf(account);
}
/**
* @dev Retrieves the total supply at the time `snapshotId` was created.
*/
function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) {
(bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots);
return snapshotted ? value : totalSupply();
}
// Update balance and/or total supply snapshots before the values are modified. This is implemented
// in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations.
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) {
// mint
_updateAccountSnapshot(to);
_updateTotalSupplySnapshot();
} else if (to == address(0)) {
// burn
_updateAccountSnapshot(from);
_updateTotalSupplySnapshot();
} else {
// transfer
_updateAccountSnapshot(from);
_updateAccountSnapshot(to);
}
}
function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) {
require(snapshotId > 0, "ERC20Snapshot: id is 0");
require(snapshotId <= _getCurrentSnapshotId(), "ERC20Snapshot: nonexistent id");
// When a valid snapshot is queried, there are three possibilities:
// a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never
// created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds
// to this id is the current one.
// b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the
// requested id, and its value is the one to return.
// c) More snapshots were created after the requested one, and the queried value was later modified. There will be
// no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is
// larger than the requested one.
//
// In summary, we need to find an element in an array, returning the index of the smallest value that is larger if
// it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does
// exactly this.
uint256 index = snapshots.ids.findUpperBound(snapshotId);
if (index == snapshots.ids.length) {
return (false, 0);
} else {
return (true, snapshots.values[index]);
}
}
function _updateAccountSnapshot(address account) private {
_updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));
}
function _updateTotalSupplySnapshot() private {
_updateSnapshot(_totalSupplySnapshots, totalSupply());
}
function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private {
uint256 currentId = _getCurrentSnapshotId();
if (_lastSnapshotId(snapshots.ids) < currentId) {
snapshots.ids.push(currentId);
snapshots.values.push(currentValue);
}
}
function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) {
if (ids.length == 0) {
return 0;
} else {
return ids[ids.length - 1];
}
}
}
// File: contracts/ElkV3.sol
pragma solidity >=0.8.0;
contract Elk is ERC20, ERC20Snapshot, Ownable, ERC20Permit, ERC20Votes {
constructor() ERC20("Elk", "ELK") ERC20Permit("Elk") {
_mint(msg.sender, 42424242 * 10 ** decimals());
}
function snapshot() public onlyOwner {
_snapshot();
}
// The following functions are overrides required by Solidity.
function _beforeTokenTransfer(address from, address to, uint256 amount)
internal
override(ERC20, ERC20Snapshot)
{
super._beforeTokenTransfer(from, to, amount);
}
function _afterTokenTransfer(address from, address to, uint256 amount)
internal
override(ERC20, ERC20Votes)
{
super._afterTokenTransfer(from, to, amount);
}
function _mint(address to, uint256 amount)
internal
override(ERC20, ERC20Votes)
{
super._mint(to, amount);
}
function _burn(address account, uint256 amount)
internal
override(ERC20, ERC20Votes)
{
super._burn(account, amount);
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":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":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Snapshot","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"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":"uint256","name":"snapshotId","type":"uint256"}],"name":"balanceOfAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"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":[],"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":"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":[{"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":[],"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":[],"name":"snapshot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6101406040523480156200001257600080fd5b5060405180604001604052806003815260200162456c6b60e81b81525080604051806040016040528060018152602001603160f81b81525060405180604001604052806003815260200162456c6b60e81b81525060405180604001604052806003815260200162454c4b60e81b8152508160039081620000939190620009e6565b506004620000a28282620009e6565b505050620000bf620000b96200017e60201b60201c565b62000182565b815160209283012081519183019190912060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818801819052818301969096526060810194909452608080850193909352308483018190528151808603909301835260c09485019091528151919095012090529190915261012052506200017833620001626012600a62000bc5565b620001729063028757b262000bd6565b620001d4565b62000c32565b3390565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b620001eb8282620001ef60201b62000c5a1760201c565b5050565b620002068282620002a660201b62000cf71760201c565b6001600160e01b036200021a620003818216565b1115620002875760405162461bcd60e51b815260206004820152603060248201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60448201526f766572666c6f77696e6720766f74657360801b60648201526084015b60405180910390fd5b620002a0600e62000dce6200038760201b17836200039e565b50505050565b6001600160a01b038216620002fe5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016200027e565b6200030c6000838362000530565b806002600082825462000320919062000bf0565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3620001eb600083836200054d565b60025490565b600062000395828462000bf0565b90505b92915050565b82546000908190818115620003fe57620003cd87620003bf60018562000c06565b600091825260209091200190565b60408051808201909152905463ffffffff8116825264010000000090046001600160e01b0316602082015262000413565b60408051808201909152600080825260208201525b905080602001516001600160e01b031693506200043184868860201c565b92506000821180156200044a5750805163ffffffff1643145b15620004a15762000466836200056560201b62000dda1760201c565b6200047888620003bf60018662000c06565b80546001600160e01b03929092166401000000000263ffffffff90921691909117905562000526565b866040518060400160405280620004c343620005d460201b62000e5d1760201c565b63ffffffff168152602001620004e4866200056560201b62000dda1760201c565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b5050935093915050565b620005488383836200063b60201b62000ed91760201c565b505050565b62000548838383620006a760201b62000f261760201c565b60006001600160e01b03821115620005d05760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b60648201526084016200027e565b5090565b600063ffffffff821115620005d05760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b60648201526084016200027e565b620006538383836200054860201b62000ef81760201c565b6001600160a01b03831662000677576200066d82620006f3565b620005486200072b565b6001600160a01b03821662000691576200066d83620006f3565b6200069c83620006f3565b6200054882620006f3565b620006bf8383836200054860201b62000ef81760201c565b6001600160a01b038381166000908152600c602052604080822054858416835291205462000548929182169116836200073d565b6001600160a01b0381166000908152600560209081526040808320918390529091205462000728919062000878565b62000878565b50565b6200073b60066200072260025490565b565b816001600160a01b0316836001600160a01b031614158015620007605750600081115b1562000548576001600160a01b03831615620007ed576001600160a01b0383166000908152600d6020908152604082208291620007aa9190620008c7901b62000f5817856200039e565b91509150846001600160a01b0316600080516020620030838339815191528383604051620007e2929190918252602082015260400190565b60405180910390a250505b6001600160a01b0382161562000548576001600160a01b0382166000908152600d602090815260408220829162000831919062000387901b62000dce17856200039e565b91509150836001600160a01b031660008051602062003083833981519152838360405162000869929190918252602082015260400190565b60405180910390a25050505050565b600062000884620008d5565b9050806200089284620008f3565b101562000548578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b600062000395828462000c06565b6000620008ee60086200093e60201b62000f641760201c565b905090565b805460009081036200090757506000919050565b81548290620009199060019062000c06565b815481106200092c576200092c62000c1c565b90600052602060002001549050919050565b5490565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200096d57607f821691505b6020821081036200098e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200054857600081815260208120601f850160051c81016020861015620009bd5750805b601f850160051c820191505b81811015620009de57828155600101620009c9565b505050505050565b81516001600160401b0381111562000a025762000a0262000942565b62000a1a8162000a13845462000958565b8462000994565b602080601f83116001811462000a52576000841562000a395750858301515b600019600386901b1c1916600185901b178555620009de565b600085815260208120601f198616915b8281101562000a835788860151825594840194600190910190840162000a62565b508582101562000aa25787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111562000b0957816000190482111562000aed5762000aed62000ab2565b8085161562000afb57918102915b93841c939080029062000acd565b509250929050565b60008262000b225750600162000398565b8162000b315750600062000398565b816001811462000b4a576002811462000b555762000b75565b600191505062000398565b60ff84111562000b695762000b6962000ab2565b50506001821b62000398565b5060208310610133831016604e8410600b841016171562000b9a575081810a62000398565b62000ba6838362000ac8565b806000190482111562000bbd5762000bbd62000ab2565b029392505050565b60006200039560ff84168362000b11565b808202811582820484141762000398576200039862000ab2565b8082018082111562000398576200039862000ab2565b8181038181111562000398576200039862000ab2565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e051610100516101205161240162000c8260003960006113d401526000611423015260006113fe0152600061135701526000611381015260006113ab01526124016000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80637ecebe00116100f9578063a457c2d711610097578063d505accf11610071578063d505accf146103d7578063dd62ed3e146103ea578063f1127ed814610423578063f2fde38b1461046057600080fd5b8063a457c2d71461039e578063a9059cbb146103b1578063c3cda520146103c457600080fd5b806395d89b41116100d357806395d89b41146103685780639711715a14610370578063981b24d0146103785780639ab24eb01461038b57600080fd5b80637ecebe00146103315780638da5cb5b146103445780638e539e8c1461035557600080fd5b80633a46b1a8116101665780635c19a95c116101405780635c19a95c146102c35780636fcfff45146102d857806370a0823114610300578063715018a61461032957600080fd5b80633a46b1a8146102595780634ee2cd7e1461026c578063587cde1e1461027f57600080fd5b806323b872dd116101a257806323b872dd1461021c578063313ce5671461022f5780633644e5151461023e578063395093511461024657600080fd5b806306fdde03146101c9578063095ea7b3146101e757806318160ddd1461020a575b600080fd5b6101d1610473565b6040516101de91906120b2565b60405180910390f35b6101fa6101f5366004612117565b610505565b60405190151581526020016101de565b6002545b6040519081526020016101de565b6101fa61022a366004612141565b61051f565b604051601281526020016101de565b61020e610543565b6101fa610254366004612117565b610552565b61020e610267366004612117565b610591565b61020e61027a366004612117565b610610565b6102ab61028d36600461217d565b6001600160a01b039081166000908152600c60205260409020541690565b6040516001600160a01b0390911681526020016101de565b6102d66102d136600461217d565b610669565b005b6102eb6102e636600461217d565b610676565b60405163ffffffff90911681526020016101de565b61020e61030e36600461217d565b6001600160a01b031660009081526020819052604090205490565b6102d6610698565b61020e61033f36600461217d565b6106ac565b6009546001600160a01b03166102ab565b61020e610363366004612198565b6106ca565b6101d1610726565b6102d6610735565b61020e610386366004612198565b610745565b61020e61039936600461217d565b610770565b6101fa6103ac366004612117565b6107f7565b6101fa6103bf366004612117565b6108a1565b6102d66103d23660046121c2565b6108af565b6102d66103e536600461221a565b6109e5565b61020e6103f8366004612284565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6104366104313660046122b7565b610b49565b60408051825163ffffffff1681526020928301516001600160e01b031692810192909252016101de565b6102d661046e36600461217d565b610bcd565b606060038054610482906122f7565b80601f01602080910402602001604051908101604052809291908181526020018280546104ae906122f7565b80156104fb5780601f106104d0576101008083540402835291602001916104fb565b820191906000526020600020905b8154815290600101906020018083116104de57829003601f168201915b5050505050905090565b600033610513818585610f68565b60019150505b92915050565b60003361052d8582856110c0565b61053885858561114c565b506001949350505050565b600061054d61134a565b905090565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610513908290869061058c908790612341565b610f68565b60004382106105e75760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e65640060448201526064015b60405180910390fd5b6001600160a01b0383166000908152600d602052604090206106099083611471565b9392505050565b6001600160a01b038216600090815260056020526040812081908190610637908590611568565b915091508161065e576001600160a01b038516600090815260208190526040902054610660565b805b95945050505050565b6106733382611665565b50565b6001600160a01b0381166000908152600d602052604081205461051990610e5d565b6106a06116eb565b6106aa6000611745565b565b6001600160a01b0381166000908152600a6020526040812054610519565b600043821061071b5760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e65640060448201526064016105de565b610519600e83611471565b606060048054610482906122f7565b61073d6116eb565b6106736117a4565b6000806000610755846006611568565b915091508161076657600254610768565b805b949350505050565b6001600160a01b0381166000908152600d602052604081205480156107e4576001600160a01b0383166000908152600d602052604090206107b2600183612354565b815481106107c2576107c2612367565b60009182526020909120015464010000000090046001600160e01b03166107e7565b60005b6001600160e01b03169392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156108945760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016105de565b6105388286868403610f68565b60003361051381858561114c565b834211156108ff5760405162461bcd60e51b815260206004820152601d60248201527f4552433230566f7465733a207369676e6174757265206578706972656400000060448201526064016105de565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b038816918101919091526060810186905260808101859052600090610979906109719060a001604051602081830303815290604052805190602001206117fe565b858585611867565b90506109848161188f565b86146109d25760405162461bcd60e51b815260206004820152601960248201527f4552433230566f7465733a20696e76616c6964206e6f6e63650000000000000060448201526064016105de565b6109dc8188611665565b50505050505050565b83421115610a355760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016105de565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888610a648c61188f565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610abf826117fe565b90506000610acf82878787611867565b9050896001600160a01b0316816001600160a01b031614610b325760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016105de565b610b3d8a8a8a610f68565b50505050505050505050565b60408051808201909152600080825260208201526001600160a01b0383166000908152600d60205260409020805463ffffffff8416908110610b8d57610b8d612367565b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090046001600160e01b0316918101919091529392505050565b610bd56116eb565b6001600160a01b038116610c515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016105de565b61067381611745565b610c648282610cf7565b6002546001600160e01b031015610ce35760405162461bcd60e51b815260206004820152603060248201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60448201527f766572666c6f77696e6720766f7465730000000000000000000000000000000060648201526084016105de565b610cf1600e610dce836118b7565b50505050565b6001600160a01b038216610d4d5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105de565b610d5960008383611a0b565b8060026000828254610d6b9190612341565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610dca60008383611a16565b5050565b60006106098284612341565b60006001600160e01b03821115610e595760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f323420626974730000000000000000000000000000000000000000000000000060648201526084016105de565b5090565b600063ffffffff821115610e595760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f322062697473000000000000000000000000000000000000000000000000000060648201526084016105de565b6001600160a01b038316610efd57610ef082611a21565b610ef8611a53565b505050565b6001600160a01b038216610f1457610ef083611a21565b610f1d83611a21565b610ef882611a21565b6001600160a01b038381166000908152600c6020526040808220548584168352912054610ef892918216911683611a61565b60006106098284612354565b5490565b6001600160a01b038316610fe35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016105de565b6001600160a01b03821661105f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016105de565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610cf1578181101561113f5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016105de565b610cf18484848403610f68565b6001600160a01b0383166111c85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016105de565b6001600160a01b0382166112445760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016105de565b61124f838383611a0b565b6001600160a01b038316600090815260208190526040902054818110156112de5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016105de565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610cf1848484611a16565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156113a357507f000000000000000000000000000000000000000000000000000000000000000046145b156113cd57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b8154600090818160058111156114cb57600061148c84611b9e565b6114969085612354565b600088815260209020909150869082015463ffffffff1611156114bb578091506114c9565b6114c6816001612341565b92505b505b808210156115185760006114df8383611c86565b600088815260209020909150869082015463ffffffff16111561150457809150611512565b61150f816001612341565b92505b506114cb565b80156115525761153b8661152d600184612354565b600091825260209091200190565b5464010000000090046001600160e01b0316611555565b60005b6001600160e01b03169695505050505050565b600080600084116115bb5760405162461bcd60e51b815260206004820152601660248201527f4552433230536e617073686f743a20696420697320300000000000000000000060448201526064016105de565b6115c3611ca1565b8411156116125760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e7420696400000060448201526064016105de565b600061161e8486611cac565b8454909150810361163657600080925092505061165e565b600184600101828154811061164d5761164d612367565b906000526020600020015492509250505b9250929050565b6001600160a01b038281166000818152600c602081815260408084208054858452828620549490935287871673ffffffffffffffffffffffffffffffffffffffff198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610cf1828483611a61565b6009546001600160a01b031633146106aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105de565b600980546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006117b4600880546001019055565b60006117be611ca1565b90507f8030e83b04d87bef53480e26263266d6ca66863aa8506aca6f2559d18aa1cb67816040516117f191815260200190565b60405180910390a1919050565b600061051961180b61134a565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061187887878787611d4b565b9150915061188581611e0f565b5095945050505050565b6001600160a01b0381166000908152600a602052604090208054600181018255905b50919050565b82546000908190818115611904576118d48761152d600185612354565b60408051808201909152905463ffffffff8116825264010000000090046001600160e01b03166020820152611919565b60408051808201909152600080825260208201525b905080602001516001600160e01b0316935061193984868863ffffffff16565b92506000821180156119515750805163ffffffff1643145b156119965761195f83610dda565b61196e8861152d600186612354565b80546001600160e01b03929092166401000000000263ffffffff909216919091179055611a01565b8660405180604001604052806119ab43610e5d565b63ffffffff1681526020016119bf86610dda565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b5050935093915050565b610ef8838383610ed9565b610ef8838383610f26565b6001600160a01b038116600090815260056020908152604080832091839052909120546106739190611f74565b611f74565b6106aa6006611a4e60025490565b816001600160a01b0316836001600160a01b031614158015611a835750600081115b15610ef8576001600160a01b03831615611b11576001600160a01b0383166000908152600d602052604081208190611abe90610f58856118b7565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611b06929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610ef8576001600160a01b0382166000908152600d602052604081208190611b4790610dce856118b7565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611b8f929190918252602082015260400190565b60405180910390a25050505050565b600081600003611bb057506000919050565b60006001611bbd84611fbe565b901c6001901b90506001818481611bd657611bd661237d565b048201901c90506001818481611bee57611bee61237d565b048201901c90506001818481611c0657611c0661237d565b048201901c90506001818481611c1e57611c1e61237d565b048201901c90506001818481611c3657611c3661237d565b048201901c90506001818481611c4e57611c4e61237d565b048201901c90506001818481611c6657611c6661237d565b048201901c905061060981828581611c8057611c8061237d565b04612052565b6000611c956002848418612393565b61060990848416612341565b600061054d60085490565b81546000908103611cbf57506000610519565b82546000905b80821015611d0c576000611cd98383611c86565b60008781526020902090915085908201541115611cf857809150611d06565b611d03816001612341565b92505b50611cc5565b600082118015611d2a575083611d278661152d600186612354565b54145b15611d4357611d3a600183612354565b92505050610519565b509050610519565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611d825750600090506003611e06565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611dd6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611dff57600060019250925050611e06565b9150600090505b94509492505050565b6000816004811115611e2357611e236123b5565b03611e2b5750565b6001816004811115611e3f57611e3f6123b5565b03611e8c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016105de565b6002816004811115611ea057611ea06123b5565b03611eed5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016105de565b6003816004811115611f0157611f016123b5565b036106735760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016105de565b6000611f7e611ca1565b905080611f8a84612068565b1015610ef8578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b600080608083901c15611fd357608092831c92015b604083901c15611fe557604092831c92015b602083901c15611ff757602092831c92015b601083901c1561200957601092831c92015b600883901c1561201b57600892831c92015b600483901c1561202d57600492831c92015b600283901c1561203f57600292831c92015b600183901c156105195760010192915050565b60008183106120615781610609565b5090919050565b8054600090810361207b57506000919050565b8154829061208b90600190612354565b8154811061209b5761209b612367565b90600052602060002001549050919050565b919050565b600060208083528351808285015260005b818110156120df578581018301518582016040015282016120c3565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146120ad57600080fd5b6000806040838503121561212a57600080fd5b61213383612100565b946020939093013593505050565b60008060006060848603121561215657600080fd5b61215f84612100565b925061216d60208501612100565b9150604084013590509250925092565b60006020828403121561218f57600080fd5b61060982612100565b6000602082840312156121aa57600080fd5b5035919050565b803560ff811681146120ad57600080fd5b60008060008060008060c087890312156121db57600080fd5b6121e487612100565b95506020870135945060408701359350612200606088016121b1565b92506080870135915060a087013590509295509295509295565b600080600080600080600060e0888a03121561223557600080fd5b61223e88612100565b965061224c60208901612100565b95506040880135945060608801359350612268608089016121b1565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561229757600080fd5b6122a083612100565b91506122ae60208401612100565b90509250929050565b600080604083850312156122ca57600080fd5b6122d383612100565b9150602083013563ffffffff811681146122ec57600080fd5b809150509250929050565b600181811c9082168061230b57607f821691505b6020821081036118b157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156105195761051961232b565b818103818111156105195761051961232b565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6000826123b057634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220ffe3a3a2b6a0bd00f8314305fa54e440f76854f1715c2fff7e720fa97b62002764736f6c63430008120033dec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80637ecebe00116100f9578063a457c2d711610097578063d505accf11610071578063d505accf146103d7578063dd62ed3e146103ea578063f1127ed814610423578063f2fde38b1461046057600080fd5b8063a457c2d71461039e578063a9059cbb146103b1578063c3cda520146103c457600080fd5b806395d89b41116100d357806395d89b41146103685780639711715a14610370578063981b24d0146103785780639ab24eb01461038b57600080fd5b80637ecebe00146103315780638da5cb5b146103445780638e539e8c1461035557600080fd5b80633a46b1a8116101665780635c19a95c116101405780635c19a95c146102c35780636fcfff45146102d857806370a0823114610300578063715018a61461032957600080fd5b80633a46b1a8146102595780634ee2cd7e1461026c578063587cde1e1461027f57600080fd5b806323b872dd116101a257806323b872dd1461021c578063313ce5671461022f5780633644e5151461023e578063395093511461024657600080fd5b806306fdde03146101c9578063095ea7b3146101e757806318160ddd1461020a575b600080fd5b6101d1610473565b6040516101de91906120b2565b60405180910390f35b6101fa6101f5366004612117565b610505565b60405190151581526020016101de565b6002545b6040519081526020016101de565b6101fa61022a366004612141565b61051f565b604051601281526020016101de565b61020e610543565b6101fa610254366004612117565b610552565b61020e610267366004612117565b610591565b61020e61027a366004612117565b610610565b6102ab61028d36600461217d565b6001600160a01b039081166000908152600c60205260409020541690565b6040516001600160a01b0390911681526020016101de565b6102d66102d136600461217d565b610669565b005b6102eb6102e636600461217d565b610676565b60405163ffffffff90911681526020016101de565b61020e61030e36600461217d565b6001600160a01b031660009081526020819052604090205490565b6102d6610698565b61020e61033f36600461217d565b6106ac565b6009546001600160a01b03166102ab565b61020e610363366004612198565b6106ca565b6101d1610726565b6102d6610735565b61020e610386366004612198565b610745565b61020e61039936600461217d565b610770565b6101fa6103ac366004612117565b6107f7565b6101fa6103bf366004612117565b6108a1565b6102d66103d23660046121c2565b6108af565b6102d66103e536600461221a565b6109e5565b61020e6103f8366004612284565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6104366104313660046122b7565b610b49565b60408051825163ffffffff1681526020928301516001600160e01b031692810192909252016101de565b6102d661046e36600461217d565b610bcd565b606060038054610482906122f7565b80601f01602080910402602001604051908101604052809291908181526020018280546104ae906122f7565b80156104fb5780601f106104d0576101008083540402835291602001916104fb565b820191906000526020600020905b8154815290600101906020018083116104de57829003601f168201915b5050505050905090565b600033610513818585610f68565b60019150505b92915050565b60003361052d8582856110c0565b61053885858561114c565b506001949350505050565b600061054d61134a565b905090565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610513908290869061058c908790612341565b610f68565b60004382106105e75760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e65640060448201526064015b60405180910390fd5b6001600160a01b0383166000908152600d602052604090206106099083611471565b9392505050565b6001600160a01b038216600090815260056020526040812081908190610637908590611568565b915091508161065e576001600160a01b038516600090815260208190526040902054610660565b805b95945050505050565b6106733382611665565b50565b6001600160a01b0381166000908152600d602052604081205461051990610e5d565b6106a06116eb565b6106aa6000611745565b565b6001600160a01b0381166000908152600a6020526040812054610519565b600043821061071b5760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e65640060448201526064016105de565b610519600e83611471565b606060048054610482906122f7565b61073d6116eb565b6106736117a4565b6000806000610755846006611568565b915091508161076657600254610768565b805b949350505050565b6001600160a01b0381166000908152600d602052604081205480156107e4576001600160a01b0383166000908152600d602052604090206107b2600183612354565b815481106107c2576107c2612367565b60009182526020909120015464010000000090046001600160e01b03166107e7565b60005b6001600160e01b03169392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156108945760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016105de565b6105388286868403610f68565b60003361051381858561114c565b834211156108ff5760405162461bcd60e51b815260206004820152601d60248201527f4552433230566f7465733a207369676e6174757265206578706972656400000060448201526064016105de565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b038816918101919091526060810186905260808101859052600090610979906109719060a001604051602081830303815290604052805190602001206117fe565b858585611867565b90506109848161188f565b86146109d25760405162461bcd60e51b815260206004820152601960248201527f4552433230566f7465733a20696e76616c6964206e6f6e63650000000000000060448201526064016105de565b6109dc8188611665565b50505050505050565b83421115610a355760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016105de565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888610a648c61188f565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610abf826117fe565b90506000610acf82878787611867565b9050896001600160a01b0316816001600160a01b031614610b325760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016105de565b610b3d8a8a8a610f68565b50505050505050505050565b60408051808201909152600080825260208201526001600160a01b0383166000908152600d60205260409020805463ffffffff8416908110610b8d57610b8d612367565b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090046001600160e01b0316918101919091529392505050565b610bd56116eb565b6001600160a01b038116610c515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016105de565b61067381611745565b610c648282610cf7565b6002546001600160e01b031015610ce35760405162461bcd60e51b815260206004820152603060248201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60448201527f766572666c6f77696e6720766f7465730000000000000000000000000000000060648201526084016105de565b610cf1600e610dce836118b7565b50505050565b6001600160a01b038216610d4d5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105de565b610d5960008383611a0b565b8060026000828254610d6b9190612341565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610dca60008383611a16565b5050565b60006106098284612341565b60006001600160e01b03821115610e595760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f323420626974730000000000000000000000000000000000000000000000000060648201526084016105de565b5090565b600063ffffffff821115610e595760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f322062697473000000000000000000000000000000000000000000000000000060648201526084016105de565b6001600160a01b038316610efd57610ef082611a21565b610ef8611a53565b505050565b6001600160a01b038216610f1457610ef083611a21565b610f1d83611a21565b610ef882611a21565b6001600160a01b038381166000908152600c6020526040808220548584168352912054610ef892918216911683611a61565b60006106098284612354565b5490565b6001600160a01b038316610fe35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016105de565b6001600160a01b03821661105f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016105de565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610cf1578181101561113f5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016105de565b610cf18484848403610f68565b6001600160a01b0383166111c85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016105de565b6001600160a01b0382166112445760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016105de565b61124f838383611a0b565b6001600160a01b038316600090815260208190526040902054818110156112de5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016105de565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610cf1848484611a16565b6000306001600160a01b037f000000000000000000000000eeeeeb57642040be42185f49c52f7e9b38f8eeee161480156113a357507f000000000000000000000000000000000000000000000000000000000000e70846145b156113cd57507fb053fbe949f0ca739e44c8cfc3664b0c4bebe2fad627f232b8b500fd70fc10fa90565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f23f5c44ca2b306f4e83d6b0757f1e134ea5717fa5e929cb430b57243cf456c60828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b8154600090818160058111156114cb57600061148c84611b9e565b6114969085612354565b600088815260209020909150869082015463ffffffff1611156114bb578091506114c9565b6114c6816001612341565b92505b505b808210156115185760006114df8383611c86565b600088815260209020909150869082015463ffffffff16111561150457809150611512565b61150f816001612341565b92505b506114cb565b80156115525761153b8661152d600184612354565b600091825260209091200190565b5464010000000090046001600160e01b0316611555565b60005b6001600160e01b03169695505050505050565b600080600084116115bb5760405162461bcd60e51b815260206004820152601660248201527f4552433230536e617073686f743a20696420697320300000000000000000000060448201526064016105de565b6115c3611ca1565b8411156116125760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e7420696400000060448201526064016105de565b600061161e8486611cac565b8454909150810361163657600080925092505061165e565b600184600101828154811061164d5761164d612367565b906000526020600020015492509250505b9250929050565b6001600160a01b038281166000818152600c602081815260408084208054858452828620549490935287871673ffffffffffffffffffffffffffffffffffffffff198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610cf1828483611a61565b6009546001600160a01b031633146106aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105de565b600980546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006117b4600880546001019055565b60006117be611ca1565b90507f8030e83b04d87bef53480e26263266d6ca66863aa8506aca6f2559d18aa1cb67816040516117f191815260200190565b60405180910390a1919050565b600061051961180b61134a565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061187887878787611d4b565b9150915061188581611e0f565b5095945050505050565b6001600160a01b0381166000908152600a602052604090208054600181018255905b50919050565b82546000908190818115611904576118d48761152d600185612354565b60408051808201909152905463ffffffff8116825264010000000090046001600160e01b03166020820152611919565b60408051808201909152600080825260208201525b905080602001516001600160e01b0316935061193984868863ffffffff16565b92506000821180156119515750805163ffffffff1643145b156119965761195f83610dda565b61196e8861152d600186612354565b80546001600160e01b03929092166401000000000263ffffffff909216919091179055611a01565b8660405180604001604052806119ab43610e5d565b63ffffffff1681526020016119bf86610dda565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b5050935093915050565b610ef8838383610ed9565b610ef8838383610f26565b6001600160a01b038116600090815260056020908152604080832091839052909120546106739190611f74565b611f74565b6106aa6006611a4e60025490565b816001600160a01b0316836001600160a01b031614158015611a835750600081115b15610ef8576001600160a01b03831615611b11576001600160a01b0383166000908152600d602052604081208190611abe90610f58856118b7565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611b06929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610ef8576001600160a01b0382166000908152600d602052604081208190611b4790610dce856118b7565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611b8f929190918252602082015260400190565b60405180910390a25050505050565b600081600003611bb057506000919050565b60006001611bbd84611fbe565b901c6001901b90506001818481611bd657611bd661237d565b048201901c90506001818481611bee57611bee61237d565b048201901c90506001818481611c0657611c0661237d565b048201901c90506001818481611c1e57611c1e61237d565b048201901c90506001818481611c3657611c3661237d565b048201901c90506001818481611c4e57611c4e61237d565b048201901c90506001818481611c6657611c6661237d565b048201901c905061060981828581611c8057611c8061237d565b04612052565b6000611c956002848418612393565b61060990848416612341565b600061054d60085490565b81546000908103611cbf57506000610519565b82546000905b80821015611d0c576000611cd98383611c86565b60008781526020902090915085908201541115611cf857809150611d06565b611d03816001612341565b92505b50611cc5565b600082118015611d2a575083611d278661152d600186612354565b54145b15611d4357611d3a600183612354565b92505050610519565b509050610519565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611d825750600090506003611e06565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611dd6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611dff57600060019250925050611e06565b9150600090505b94509492505050565b6000816004811115611e2357611e236123b5565b03611e2b5750565b6001816004811115611e3f57611e3f6123b5565b03611e8c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016105de565b6002816004811115611ea057611ea06123b5565b03611eed5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016105de565b6003816004811115611f0157611f016123b5565b036106735760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016105de565b6000611f7e611ca1565b905080611f8a84612068565b1015610ef8578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b600080608083901c15611fd357608092831c92015b604083901c15611fe557604092831c92015b602083901c15611ff757602092831c92015b601083901c1561200957601092831c92015b600883901c1561201b57600892831c92015b600483901c1561202d57600492831c92015b600283901c1561203f57600292831c92015b600183901c156105195760010192915050565b60008183106120615781610609565b5090919050565b8054600090810361207b57506000919050565b8154829061208b90600190612354565b8154811061209b5761209b612367565b90600052602060002001549050919050565b919050565b600060208083528351808285015260005b818110156120df578581018301518582016040015282016120c3565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146120ad57600080fd5b6000806040838503121561212a57600080fd5b61213383612100565b946020939093013593505050565b60008060006060848603121561215657600080fd5b61215f84612100565b925061216d60208501612100565b9150604084013590509250925092565b60006020828403121561218f57600080fd5b61060982612100565b6000602082840312156121aa57600080fd5b5035919050565b803560ff811681146120ad57600080fd5b60008060008060008060c087890312156121db57600080fd5b6121e487612100565b95506020870135945060408701359350612200606088016121b1565b92506080870135915060a087013590509295509295509295565b600080600080600080600060e0888a03121561223557600080fd5b61223e88612100565b965061224c60208901612100565b95506040880135945060608801359350612268608089016121b1565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561229757600080fd5b6122a083612100565b91506122ae60208401612100565b90509250929050565b600080604083850312156122ca57600080fd5b6122d383612100565b9150602083013563ffffffff811681146122ec57600080fd5b809150509250929050565b600181811c9082168061230b57607f821691505b6020821081036118b157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156105195761051961232b565b818103818111156105195761051961232b565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6000826123b057634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220ffe3a3a2b6a0bd00f8314305fa54e440f76854f1715c2fff7e720fa97b62002764736f6c63430008120033
Deployed Bytecode Sourcemap
120062:1067:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;86293:100;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;88644:201;;;;;;:::i;:::-;;:::i;:::-;;;1192:14:1;;1185:22;1167:41;;1155:2;1140:18;88644:201:0;1027:187:1;87413:108:0;87501:12;;87413:108;;;1365:25:1;;;1353:2;1338:18;87413:108:0;1219:177:1;89425:295:0;;;;;;:::i;:::-;;:::i;87255:93::-;;;87338:2;1876:36:1;;1864:2;1849:18;87255:93:0;1734:184:1;100300:115:0;;;:::i;90129:238::-;;;;;;:::i;:::-;;:::i;103502:268::-;;;;;;:::i;:::-;;:::i;116095:266::-;;;;;;:::i;:::-;;:::i;102876:128::-;;;;;;:::i;:::-;-1:-1:-1;;;;;102977:19:0;;;102950:7;102977:19;;;:10;:19;;;;;;;;102876:128;;;;-1:-1:-1;;;;;2460:55:1;;;2442:74;;2430:2;2415:18;102876:128:0;2296:226:1;106388:114:0;;;;;;:::i;:::-;;:::i;:::-;;102632:151;;;;;;:::i;:::-;;:::i;:::-;;;2701:10:1;2689:23;;;2671:42;;2659:2;2644:18;102632:151:0;2527:192:1;87584:127:0;;;;;;:::i;:::-;-1:-1:-1;;;;;87685:18:0;87658:7;87685:18;;;;;;;;;;;;87584:127;79718:103;;;:::i;100042:128::-;;;;;;:::i;:::-;;:::i;79070:87::-;79143:6;;-1:-1:-1;;;;;79143:6:0;79070:87;;104059:259;;;;;;:::i;:::-;;:::i;86512:104::-;;;:::i;120266:67::-;;;:::i;116465:234::-;;;;;;:::i;:::-;;:::i;103088:212::-;;;;;;:::i;:::-;;:::i;90870:436::-;;;;;;:::i;:::-;;:::i;87917:193::-;;;;;;:::i;:::-;;:::i;106584:591::-;;;;;;:::i;:::-;;:::i;99331:645::-;;;;;;:::i;:::-;;:::i;88173:151::-;;;;;;:::i;:::-;-1:-1:-1;;;;;88289:18:0;;;88262:7;88289:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;;;;88173:151;102402:150;;;;;;:::i;:::-;;:::i;:::-;;;;5061:13:1;;5076:10;5057:30;5039:49;;5148:4;5136:17;;;5130:24;-1:-1:-1;;;;;5126:89:1;5104:20;;;5097:119;;;;5012:18;102402:150:0;4837:385:1;79976:201:0;;;;;;:::i;:::-;;:::i;86293:100::-;86347:13;86380:5;86373:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;86293:100;:::o;88644:201::-;88727:4;77701:10;88783:32;77701:10;88799:7;88808:6;88783:8;:32::i;:::-;88833:4;88826:11;;;88644:201;;;;;:::o;89425:295::-;89556:4;77701:10;89614:38;89630:4;77701:10;89645:6;89614:15;:38::i;:::-;89663:27;89673:4;89679:2;89683:6;89663:9;:27::i;:::-;-1:-1:-1;89708:4:0;;89425:295;-1:-1:-1;;;;89425:295:0:o;100300:115::-;100360:7;100387:20;:18;:20::i;:::-;100380:27;;100300:115;:::o;90129:238::-;77701:10;90217:4;88289:18;;;:11;:18;;;;;;;;-1:-1:-1;;;;;88289:27:0;;;;;;;;;;90217:4;;77701:10;90273:64;;77701:10;;88289:27;;90298:38;;90326:10;;90298:38;:::i;:::-;90273:8;:64::i;103502:268::-;103600:7;103642:12;103628:11;:26;103620:70;;;;-1:-1:-1;;;103620:70:0;;6190:2:1;103620:70:0;;;6172:21:1;6229:2;6209:18;;;6202:30;6268:33;6248:18;;;6241:61;6319:18;;103620:70:0;;;;;;;;;-1:-1:-1;;;;;103727:21:0;;;;;;:12;:21;;;;;103708:54;;103750:11;103708:18;:54::i;:::-;103701:61;103502:268;-1:-1:-1;;;103502:268:0:o;116095:266::-;-1:-1:-1;;;;;116259:33:0;;116182:7;116259:33;;;:24;:33;;;;;116182:7;;;;116238:55;;116247:10;;116238:8;:55::i;:::-;116202:91;;;;116313:11;:40;;-1:-1:-1;;;;;87685:18:0;;87658:7;87685:18;;;;;;;;;;;116313:40;;;116327:5;116313:40;116306:47;116095:266;-1:-1:-1;;;;;116095:266:0:o;106388:114::-;106460:34;77701:10;106484:9;106460;:34::i;:::-;106388:114;:::o;102632:151::-;-1:-1:-1;;;;;102746:21:0;;102702:6;102746:21;;;:12;:21;;;;;:28;102728:47;;:17;:47::i;79718:103::-;78956:13;:11;:13::i;:::-;79783:30:::1;79810:1;79783:18;:30::i;:::-;79718:103::o:0;100042:128::-;-1:-1:-1;;;;;100138:14:0;;100111:7;100138:14;;;:7;:14;;;;;41737;100138:24;41645:114;104059:259;104146:7;104188:12;104174:11;:26;104166:70;;;;-1:-1:-1;;;104166:70:0;;6190:2:1;104166:70:0;;;6172:21:1;6229:2;6209:18;;;6202:30;6268:33;6248:18;;;6241:61;6319:18;;104166:70:0;5988:355:1;104166:70:0;104254:56;104273:23;104298:11;104254:18;:56::i;86512:104::-;86568:13;86601:7;86594:14;;;;;:::i;120266:67::-;78956:13;:11;:13::i;:::-;120314:11:::1;:9;:11::i;116465:234::-:0;116537:7;116558:16;116576:13;116593:43;116602:10;116614:21;116593:8;:43::i;:::-;116557:79;;;;116656:11;:35;;87501:12;;116656:35;;;116670:5;116656:35;116649:42;116465:234;-1:-1:-1;;;;116465:234:0:o;103088:212::-;-1:-1:-1;;;;;103195:21:0;;103161:7;103195:21;;;:12;:21;;;;;:28;103241:8;;:51;;-1:-1:-1;;;;;103256:21:0;;;;;;:12;:21;;;;;103278:7;103284:1;103278:3;:7;:::i;:::-;103256:30;;;;;;;;:::i;:::-;;;;;;;;;;:36;;;;-1:-1:-1;;;;;103256:36:0;103241:51;;;103252:1;103241:51;-1:-1:-1;;;;;103234:58:0;;103088:212;-1:-1:-1;;;103088:212:0:o;90870:436::-;77701:10;90963:4;88289:18;;;:11;:18;;;;;;;;-1:-1:-1;;;;;88289:27:0;;;;;;;;;;90963:4;;77701:10;91110:15;91090:16;:35;;91082:85;;;;-1:-1:-1;;;91082:85:0;;6872:2:1;91082:85:0;;;6854:21:1;6911:2;6891:18;;;6884:30;6950:34;6930:18;;;6923:62;7021:7;7001:18;;;6994:35;7046:19;;91082:85:0;6670:401:1;91082:85:0;91203:60;91212:5;91219:7;91247:15;91228:16;:34;91203:8;:60::i;87917:193::-;87996:4;77701:10;88052:28;77701:10;88069:2;88073:6;88052:9;:28::i;106584:591::-;106811:6;106792:15;:25;;106784:67;;;;-1:-1:-1;;;106784:67:0;;7278:2:1;106784:67:0;;;7260:21:1;7317:2;7297:18;;;7290:30;7356:31;7336:18;;;7329:59;7405:18;;106784:67:0;7076:353:1;106784:67:0;106934:58;;;102082:71;106934:58;;;7665:25:1;-1:-1:-1;;;;;7726:55:1;;7706:18;;;7699:83;;;;7798:18;;;7791:34;;;7841:18;;;7834:34;;;106862:14:0;;106879:174;;106907:87;;7637:19:1;;106934:58:0;;;;;;;;;;;;106924:69;;;;;;106907:16;:87::i;:::-;107009:1;107025;107041;106879:13;:174::i;:::-;106862:191;;107081:17;107091:6;107081:9;:17::i;:::-;107072:5;:26;107064:64;;;;-1:-1:-1;;;107064:64:0;;8081:2:1;107064:64:0;;;8063:21:1;8120:2;8100:18;;;8093:30;8159:27;8139:18;;;8132:55;8204:18;;107064:64:0;7879:349:1;107064:64:0;107139:28;107149:6;107157:9;107139;:28::i;:::-;106773:402;106584:591;;;;;;:::o;99331:645::-;99575:8;99556:15;:27;;99548:69;;;;-1:-1:-1;;;99548:69:0;;8435:2:1;99548:69:0;;;8417:21:1;8474:2;8454:18;;;8447:30;8513:31;8493:18;;;8486:59;8562:18;;99548:69:0;8233:353:1;99548:69:0;99630:18;98506:95;99690:5;99697:7;99706:5;99713:16;99723:5;99713:9;:16::i;:::-;99661:79;;;;;;8878:25:1;;;;-1:-1:-1;;;;;9000:15:1;;;8980:18;;;8973:43;9052:15;;;;9032:18;;;9025:43;9084:18;;;9077:34;9127:19;;;9120:35;9171:19;;;9164:35;;;8850:19;;99661:79:0;;;;;;;;;;;;99651:90;;;;;;99630:111;;99754:12;99769:28;99786:10;99769:16;:28::i;:::-;99754:43;;99810:14;99827:28;99841:4;99847:1;99850;99853;99827:13;:28::i;:::-;99810:45;;99884:5;-1:-1:-1;;;;;99874:15:0;:6;-1:-1:-1;;;;;99874:15:0;;99866:58;;;;-1:-1:-1;;;99866:58:0;;9412:2:1;99866:58:0;;;9394:21:1;9451:2;9431:18;;;9424:30;9490:32;9470:18;;;9463:60;9540:18;;99866:58:0;9210:354:1;99866:58:0;99937:31;99946:5;99953:7;99962:5;99937:8;:31::i;:::-;99537:439;;;99331:645;;;;;;;:::o;102402:150::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;102518:21:0;;;;;;:12;:21;;;;;:26;;;;;;;;;;;;:::i;:::-;;;;;;;;;;102511:33;;;;;;;;;102518:26;;102511:33;;;;;;;;;-1:-1:-1;;;;;102511:33:0;;;;;;;;;102402:150;-1:-1:-1;;;102402:150:0:o;79976:201::-;78956:13;:11;:13::i;:::-;-1:-1:-1;;;;;80065:22:0;::::1;80057:73;;;::::0;-1:-1:-1;;;80057:73:0;;9771:2:1;80057:73:0::1;::::0;::::1;9753:21:1::0;9810:2;9790:18;;;9783:30;9849:34;9829:18;;;9822:62;9920:8;9900:18;;;9893:36;9946:19;;80057:73:0::1;9569:402:1::0;80057:73:0::1;80141:28;80160:8;80141:18;:28::i;107481:290::-:0;107566:28;107578:7;107587:6;107566:11;:28::i;:::-;87501:12;;-1:-1:-1;;;;;;107613:29:0;107605:90;;;;-1:-1:-1;;;107605:90:0;;10178:2:1;107605:90:0;;;10160:21:1;10217:2;10197:18;;;10190:30;10256:34;10236:18;;;10229:62;10327:18;10307;;;10300:46;10363:19;;107605:90:0;9976:412:1;107605:90:0;107708:55;107725:23;107750:4;107756:6;107708:16;:55::i;:::-;;;107481:290;;:::o;92903:548::-;-1:-1:-1;;;;;92987:21:0;;92979:65;;;;-1:-1:-1;;;92979:65:0;;10595:2:1;92979:65:0;;;10577:21:1;10634:2;10614:18;;;10607:30;10673:33;10653:18;;;10646:61;10724:18;;92979:65:0;10393:355:1;92979:65:0;93057:49;93086:1;93090:7;93099:6;93057:20;:49::i;:::-;93135:6;93119:12;;:22;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;;;93290:18:0;;:9;:18;;;;;;;;;;;:28;;;;;;93345:37;1365:25:1;;;93345:37:0;;1338:18:1;93345:37:0;;;;;;;93395:48;93423:1;93427:7;93436:6;93395:19;:48::i;:::-;92903:548;;:::o;110434:98::-;110492:7;110519:5;110523:1;110519;:5;:::i;2950:195::-;3007:7;-1:-1:-1;;;;;3035:26:0;;;3027:78;;;;-1:-1:-1;;;3027:78:0;;10955:2:1;3027:78:0;;;10937:21:1;10994:2;10974:18;;;10967:30;11033:34;11013:18;;;11006:62;11104:9;11084:18;;;11077:37;11131:19;;3027:78:0;10753:403:1;3027:78:0;-1:-1:-1;3131:5:0;2950:195::o;15786:190::-;15842:6;15878:16;15869:25;;;15861:76;;;;-1:-1:-1;;;15861:76:0;;11363:2:1;15861:76:0;;;11345:21:1;11402:2;11382:18;;;11375:30;11441:34;11421:18;;;11414:62;11512:8;11492:18;;;11485:36;11538:19;;15861:76:0;11161:402:1;116916:622:0;-1:-1:-1;;;;;117120:18:0;;117116:415;;117176:26;117199:2;117176:22;:26::i;:::-;117217:28;:26;:28::i;:::-;116916:622;;;:::o;117116:415::-;-1:-1:-1;;;;;117267:16:0;;117263:268;;117321:28;117344:4;117321:22;:28::i;117263:268::-;117450:28;117473:4;117450:22;:28::i;:::-;117493:26;117516:2;117493:22;:26::i;108206:262::-;-1:-1:-1;;;;;102977:19:0;;;102950:7;102977:19;;;:10;:19;;;;;;;;;;;;;;;108404:56;;102977:19;;;;;108453:6;108404:16;:56::i;110540:103::-;110603:7;110630:5;110634:1;110630;:5;:::i;41645:114::-;41737:14;;41645:114::o;94897:380::-;-1:-1:-1;;;;;95033:19:0;;95025:68;;;;-1:-1:-1;;;95025:68:0;;11770:2:1;95025:68:0;;;11752:21:1;11809:2;11789:18;;;11782:30;11848:34;11828:18;;;11821:62;11919:6;11899:18;;;11892:34;11943:19;;95025:68:0;11568:400:1;95025:68:0;-1:-1:-1;;;;;95112:21:0;;95104:68;;;;-1:-1:-1;;;95104:68:0;;12175:2:1;95104:68:0;;;12157:21:1;12214:2;12194:18;;;12187:30;12253:34;12233:18;;;12226:62;12324:4;12304:18;;;12297:32;12346:19;;95104:68:0;11973:398:1;95104:68:0;-1:-1:-1;;;;;95185:18:0;;;;;;;:11;:18;;;;;;;;:27;;;;;;;;;;;;;:36;;;95237:32;;1365:25:1;;;95237:32:0;;1338:18:1;95237:32:0;;;;;;;94897:380;;;:::o;95568:453::-;-1:-1:-1;;;;;88289:18:0;;;95703:24;88289:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;-1:-1:-1;;95770:37:0;;95766:248;;95852:6;95832:16;:26;;95824:68;;;;-1:-1:-1;;;95824:68:0;;12578:2:1;95824:68:0;;;12560:21:1;12617:2;12597:18;;;12590:30;12656:31;12636:18;;;12629:59;12705:18;;95824:68:0;12376:353:1;95824:68:0;95936:51;95945:5;95952:7;95980:6;95961:16;:25;95936:8;:51::i;91776:840::-;-1:-1:-1;;;;;91907:18:0;;91899:68;;;;-1:-1:-1;;;91899:68:0;;12936:2:1;91899:68:0;;;12918:21:1;12975:2;12955:18;;;12948:30;13014:34;12994:18;;;12987:62;13085:7;13065:18;;;13058:35;13110:19;;91899:68:0;12734:401:1;91899:68:0;-1:-1:-1;;;;;91986:16:0;;91978:64;;;;-1:-1:-1;;;91978:64:0;;13342:2:1;91978:64:0;;;13324:21:1;13381:2;13361:18;;;13354:30;13420:34;13400:18;;;13393:62;13491:5;13471:18;;;13464:33;13514:19;;91978:64:0;13140:399:1;91978:64:0;92055:38;92076:4;92082:2;92086:6;92055:20;:38::i;:::-;-1:-1:-1;;;;;92128:15:0;;92106:19;92128:15;;;;;;;;;;;92162:21;;;;92154:72;;;;-1:-1:-1;;;92154:72:0;;13746:2:1;92154:72:0;;;13728:21:1;13785:2;13765:18;;;13758:30;13824:34;13804:18;;;13797:62;13895:8;13875:18;;;13868:36;13921:19;;92154:72:0;13544:402:1;92154:72:0;-1:-1:-1;;;;;92262:15:0;;;:9;:15;;;;;;;;;;;92280:20;;;92262:38;;92480:13;;;;;;;;;;:23;;;;;;92532:26;;1365:25:1;;;92480:13:0;;92532:26;;1338:18:1;92532:26:0;;;;;;;92571:37;92591:4;92597:2;92601:6;92571:19;:37::i;69431:314::-;69484:7;69516:4;-1:-1:-1;;;;;69525:12:0;69508:29;;:66;;;;;69558:16;69541:13;:33;69508:66;69504:234;;;-1:-1:-1;69598:24:0;;69431:314::o;69504:234::-;-1:-1:-1;69934:73:0;;;69684:10;69934:73;;;;15533:25:1;;;;69696:12:0;15574:18:1;;;15567:34;69710:15:0;15617:18:1;;;15610:34;69978:13:0;15660:18:1;;;15653:34;70001:4:0;15703:19:1;;;;15696:84;;;;69934:73:0;;;;;;;;;;15505:19:1;;;;69934:73:0;;;69924:84;;;;;;100300:115::o;104407:1895::-;105624:12;;104506:7;;;105624:12;105722:1;105713:10;;105709:251;;;105740:11;105763:17;105773:6;105763:9;:17::i;:::-;105754:26;;:6;:26;:::i;:::-;110877:25;110939:21;;;111006:4;110993:18;;105740:40;;-1:-1:-1;105837:11:0;;110989:28;;105799:35;;;:49;105795:154;;;105876:3;105869:10;;105795:154;;;105926:7;:3;105932:1;105926:7;:::i;:::-;105920:13;;105795:154;105725:235;105709:251;105985:4;105979:3;:10;105972:251;;;106006:11;106020:23;106033:3;106038:4;106020:12;:23::i;:::-;110877:25;110939:21;;;111006:4;110993:18;;106006:37;;-1:-1:-1;106100:11:0;;110989:28;;106062:35;;;:49;106058:154;;;106139:3;106132:10;;106058:154;;;106189:7;:3;106195:1;106189:7;:::i;:::-;106183:13;;106058:154;105991:232;105972:251;;;106242:9;;:52;;106258:30;106272:5;106279:8;106286:1;106279:4;:8;:::i;:::-;110877:25;110939:21;;;111006:4;110993:18;;;110989:28;;110791:244;106258:30;:36;;;;-1:-1:-1;;;;;106258:36:0;106242:52;;;106254:1;106242:52;-1:-1:-1;;;;;106235:59:0;;104407:1895;-1:-1:-1;;;;;;104407:1895:0:o;117546:1619::-;117635:4;117641:7;117682:1;117669:10;:14;117661:49;;;;-1:-1:-1;;;117661:49:0;;14153:2:1;117661:49:0;;;14135:21:1;14192:2;14172:18;;;14165:30;14231:24;14211:18;;;14204:52;14273:18;;117661:49:0;13951:346:1;117661:49:0;117743:23;:21;:23::i;:::-;117729:10;:37;;117721:79;;;;-1:-1:-1;;;117721:79:0;;14504:2:1;117721:79:0;;;14486:21:1;14543:2;14523:18;;;14516:30;14582:31;14562:18;;;14555:59;14631:18;;117721:79:0;14302:353:1;117721:79:0;118939:13;118955:40;:9;118984:10;118955:28;:40::i;:::-;119021:20;;118939:56;;-1:-1:-1;119012:29:0;;119008:150;;119066:5;119073:1;119058:17;;;;;;;119008:150;119116:4;119122:9;:16;;119139:5;119122:23;;;;;;;;:::i;:::-;;;;;;;;;119108:38;;;;;117546:1619;;;;;;:::o;108646:388::-;-1:-1:-1;;;;;102977:19:0;;;108731:23;102977:19;;;:10;:19;;;;;;;;;;87685:18;;;;;;;108846:21;;;;:33;;;-1:-1:-1;;108846:33:0;;;;;;;108897:54;;102977:19;;;;;87685:18;;108846:33;;102977:19;;;108897:54;;108731:23;108897:54;108964:62;108981:15;108998:9;109009:16;108964;:62::i;79235:132::-;79143:6;;-1:-1:-1;;;;;79143:6:0;77701:10;79299:23;79291:68;;;;-1:-1:-1;;;79291:68:0;;14862:2:1;79291:68:0;;;14844:21:1;;;14881:18;;;14874:30;14940:34;14920:18;;;14913:62;14992:18;;79291:68:0;14660:356:1;80337:191:0;80430:6;;;-1:-1:-1;;;;;80447:17:0;;;-1:-1:-1;;80447:17:0;;;;;;;80480:40;;80430:6;;;80447:17;80430:6;;80480:40;;80411:16;;80480:40;80400:128;80337:191;:::o;115567:223::-;115614:7;115634:30;:18;41856:19;;41874:1;41856:19;;;41767:127;115634:30;115677:17;115697:23;:21;:23::i;:::-;115677:43;;115736:19;115745:9;115736:19;;;;1365:25:1;;1353:2;1338:18;;1219:177;115736:19:0;;;;;;;;115773:9;115567:223;-1:-1:-1;115567:223:0:o;70658:167::-;70735:7;70762:55;70784:20;:18;:20::i;:::-;70806:10;66125:57;;16529:66:1;66125:57:0;;;16517:79:1;16612:11;;;16605:27;;;16648:12;;;16641:28;;;66088:7:0;;16685:12:1;;66125:57:0;;;;;;;;;;;;66115:68;;;;;;66108:75;;65995:196;;;;;64304:279;64432:7;64453:17;64472:18;64494:25;64505:4;64511:1;64514;64517;64494:10;:25::i;:::-;64452:67;;;;64530:18;64542:5;64530:11;:18::i;:::-;-1:-1:-1;64566:9:0;64304:279;-1:-1:-1;;;;;64304:279:0:o;100553:207::-;-1:-1:-1;;;;;100674:14:0;;100613:15;100674:14;;;:7;:14;;;;;41737;;41874:1;41856:19;;;;41737:14;100735:17;100630:130;100553:207;;;:::o;109693:733::-;109930:12;;109867:17;;;;;109983:8;;:59;;110013:29;110027:5;110034:7;110040:1;110034:3;:7;:::i;110013:29::-;109983:59;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;109983:59:0;;;;;;;;109994:16;;;;;;;;;-1:-1:-1;109994:16:0;;;;;;;109983:59;109955:87;;110067:7;:13;;;-1:-1:-1;;;;;110055:25:0;;;110103:20;110106:9;110117:5;110103:2;:20;;:::i;:::-;110091:32;;110146:1;110140:3;:7;:44;;;;-1:-1:-1;110151:17:0;;:33;;110172:12;110151:33;110140:44;110136:283;;;110239:29;110258:9;110239:18;:29::i;:::-;110201;110215:5;110222:7;110228:1;110222:3;:7;:::i;110201:29::-;:67;;-1:-1:-1;;;;;110201:67:0;;;;;;;;;;;;;;;;110136:283;;;110301:5;110312:94;;;;;;;;110335:31;110353:12;110335:17;:31::i;:::-;110312:94;;;;;;110375:29;110394:9;110375:18;:29::i;:::-;-1:-1:-1;;;;;110312:94:0;;;;;;110301:106;;;;;;;-1:-1:-1;110301:106:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;110136:283;109905:521;;109693:733;;;;;;:::o;120411:198::-;120557:44;120584:4;120590:2;120594:6;120557:26;:44::i;120617:193::-;120759:43;120785:4;120791:2;120795:6;120759:25;:43::i;119173:146::-;-1:-1:-1;;;;;119257:33:0;;;;;;:24;:33;;;;;;;;87685:18;;;;;;;;119241:70;;119257:33;119241:15;:70::i;119292:18::-;119241:15;:70::i;119327:118::-;119384:53;119400:21;119423:13;87501:12;;;87413:108;109042:643;109174:3;-1:-1:-1;;;;;109167:10:0;:3;-1:-1:-1;;;;;109167:10:0;;;:24;;;;;109190:1;109181:6;:10;109167:24;109163:515;;;-1:-1:-1;;;;;109212:17:0;;;109208:224;;-1:-1:-1;;;;;109308:17:0;;109251;109308;;;:12;:17;;;;;109251;;109291:54;;109327:9;109338:6;109291:16;:54::i;:::-;109250:95;;;;109390:3;-1:-1:-1;;;;;109369:47:0;;109395:9;109406;109369:47;;;;;;15195:25:1;;;15251:2;15236:18;;15229:34;15183:2;15168:18;;15021:248;109369:47:0;;;;;;;;109231:201;;109208:224;-1:-1:-1;;;;;109452:17:0;;;109448:219;;-1:-1:-1;;;;;109548:17:0;;109491;109548;;;:12;:17;;;;;109491;;109531:49;;109567:4;109573:6;109531:16;:49::i;:::-;109490:90;;;;109625:3;-1:-1:-1;;;;;109604:47:0;;109630:9;109641;109604:47;;;;;;15195:25:1;;;15251:2;15236:18;;15229:34;15183:2;15168:18;;15021:248;109604:47:0;;;;;;;;109471:196;;109042:643;;;:::o;48700:1673::-;48748:7;48772:1;48777;48772:6;48768:47;;-1:-1:-1;48802:1:0;;48700:1673;-1:-1:-1;48700:1673:0:o;48768:47::-;49506:14;49540:1;49529:7;49534:1;49529:4;:7::i;:::-;:12;;49523:1;:19;;49506:36;;50008:1;49997:6;49993:1;:10;;;;;:::i;:::-;;49984:6;:19;49983:26;;49974:35;;50058:1;50047:6;50043:1;:10;;;;;:::i;:::-;;50034:6;:19;50033:26;;50024:35;;50108:1;50097:6;50093:1;:10;;;;;:::i;:::-;;50084:6;:19;50083:26;;50074:35;;50158:1;50147:6;50143:1;:10;;;;;:::i;:::-;;50134:6;:19;50133:26;;50124:35;;50208:1;50197:6;50193:1;:10;;;;;:::i;:::-;;50184:6;:19;50183:26;;50174:35;;50258:1;50247:6;50243:1;:10;;;;;:::i;:::-;;50234:6;:19;50233:26;;50224:35;;50308:1;50297:6;50293:1;:10;;;;;:::i;:::-;;50284:6;:19;50283:26;;50274:35;;50331:23;50335:6;50347;50343:1;:10;;;;;:::i;:::-;;50331:3;:23::i;43101:156::-;43163:7;43238:11;43248:1;43239:5;;;43238:11;:::i;:::-;43228:21;;43229:5;;;43228:21;:::i;115856:127::-;115920:7;115947:28;:18;41737:14;;41645:114;74324:958;74437:12;;74413:7;;74437:17;;74433:58;;-1:-1:-1;74478:1:0;74471:8;;74433:58;74544:12;;74503:11;;74569:444;74582:4;74576:3;:10;74569:444;;;74603:11;74617:23;74630:3;74635:4;74617:12;:23::i;:::-;76674:31;76809:19;;;76867:4;76854:18;;74603:37;;-1:-1:-1;74894:7:0;;76850:28;;74861:30;:40;74857:145;;;74929:3;74922:10;;74857:145;;;74979:7;:3;74985:1;74979:7;:::i;:::-;74973:13;;74857:145;74588:425;74569:444;;;75139:1;75133:3;:7;:56;;;;-1:-1:-1;75182:7:0;75144:28;75157:5;75164:7;75170:1;75164:3;:7;:::i;75144:28::-;:34;:45;75133:56;75129:146;;;75213:7;75219:1;75213:3;:7;:::i;:::-;75206:14;;;;;;75129:146;-1:-1:-1;75260:3:0;-1:-1:-1;75253:10:0;;62645:1520;62776:7;;63710:66;63697:79;;63693:163;;;-1:-1:-1;63809:1:0;;-1:-1:-1;63813:30:0;63793:51;;63693:163;63970:24;;;63953:14;63970:24;;;;;;;;;16935:25:1;;;17008:4;16996:17;;16976:18;;;16969:45;;;;17030:18;;;17023:34;;;17073:18;;;17066:34;;;63970:24:0;;16907:19:1;;63970:24:0;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;63970:24:0;;-1:-1:-1;;63970:24:0;;;-1:-1:-1;;;;;;;64009:20:0;;64005:103;;64062:1;64066:29;64046:50;;;;;;;64005:103;64128:6;-1:-1:-1;64136:20:0;;-1:-1:-1;62645:1520:0;;;;;;;;:::o;58037:521::-;58115:20;58106:5;:29;;;;;;;;:::i;:::-;;58102:449;;58037:521;:::o;58102:449::-;58213:29;58204:5;:38;;;;;;;;:::i;:::-;;58200:351;;58259:34;;-1:-1:-1;;;58259:34:0;;17502:2:1;58259:34:0;;;17484:21:1;17541:2;17521:18;;;17514:30;17580:26;17560:18;;;17553:54;17624:18;;58259:34:0;17300:348:1;58200:351:0;58324:35;58315:5;:44;;;;;;;;:::i;:::-;;58311:240;;58376:41;;-1:-1:-1;;;58376:41:0;;17855:2:1;58376:41:0;;;17837:21:1;17894:2;17874:18;;;17867:30;17933:33;17913:18;;;17906:61;17984:18;;58376:41:0;17653:355:1;58311:240:0;58448:30;58439:5;:39;;;;;;;;:::i;:::-;;58435:116;;58495:44;;-1:-1:-1;;;58495:44:0;;18215:2:1;58495:44:0;;;18197:21:1;18254:2;18234:18;;;18227:30;18293:34;18273:18;;;18266:62;18364:4;18344:18;;;18337:32;18386:19;;58495:44:0;18013:398:1;119453:310:0;119548:17;119568:23;:21;:23::i;:::-;119548:43;-1:-1:-1;119548:43:0;119606:30;119622:9;119606:15;:30::i;:::-;:42;119602:154;;;119665:29;;;;;;;;-1:-1:-1;119665:29:0;;;;;;;;;;;;;;119709:16;;;:35;;;;;;;;;;;;;;;119453:310::o;50850:1019::-;50902:7;;50989:3;50980:12;;;:16;50976:102;;51027:3;51017:13;;;;51049;50976:102;51105:2;51096:11;;;:15;51092:99;;51142:2;51132:12;;;;51163;51092:99;51218:2;51209:11;;;:15;51205:99;;51255:2;51245:12;;;;51276;51205:99;51331:2;51322:11;;;:15;51318:99;;51368:2;51358:12;;;;51389;51318:99;51444:1;51435:10;;;:14;51431:96;;51480:1;51470:11;;;;51500;51431:96;51554:1;51545:10;;;:14;51541:96;;51590:1;51580:11;;;;51610;51541:96;51664:1;51655:10;;;:14;51651:96;;51700:1;51690:11;;;;51720;51651:96;51774:1;51765:10;;;:14;51761:66;;51810:1;51800:11;51855:6;50850:1019;-1:-1:-1;;50850:1019:0:o;42876:106::-;42934:7;42965:1;42961;:5;:13;;42973:1;42961:13;;;-1:-1:-1;42969:1:0;;42876:106;-1:-1:-1;42876:106:0:o;119771:212::-;119865:10;;119841:7;;119865:15;;119861:115;;-1:-1:-1;119904:1:0;;119771:212;-1:-1:-1;119771:212:0:o;119861:115::-;119949:10;;119945:3;;119949:14;;119962:1;;119949:14;:::i;:::-;119945:19;;;;;;;;:::i;:::-;;;;;;;;;119938:26;;119771:212;;;:::o;119861:115::-;119771:212;;;:::o;14:548:1:-;126:4;155:2;184;173:9;166:21;216:6;210:13;259:6;254:2;243:9;239:18;232:34;284:1;294:140;308:6;305:1;302:13;294:140;;;403:14;;;399:23;;393:30;369:17;;;388:2;365:26;358:66;323:10;;294:140;;;298:3;483:1;478:2;469:6;458:9;454:22;450:31;443:42;553:2;546;542:7;537:2;529:6;525:15;521:29;510:9;506:45;502:54;494:62;;;;14:548;;;;:::o;567:196::-;635:20;;-1:-1:-1;;;;;684:54:1;;674:65;;664:93;;753:1;750;743:12;768:254;836:6;844;897:2;885:9;876:7;872:23;868:32;865:52;;;913:1;910;903:12;865:52;936:29;955:9;936:29;:::i;:::-;926:39;1012:2;997:18;;;;984:32;;-1:-1:-1;;;768:254:1:o;1401:328::-;1478:6;1486;1494;1547:2;1535:9;1526:7;1522:23;1518:32;1515:52;;;1563:1;1560;1553:12;1515:52;1586:29;1605:9;1586:29;:::i;:::-;1576:39;;1634:38;1668:2;1657:9;1653:18;1634:38;:::i;:::-;1624:48;;1719:2;1708:9;1704:18;1691:32;1681:42;;1401:328;;;;;:::o;2105:186::-;2164:6;2217:2;2205:9;2196:7;2192:23;2188:32;2185:52;;;2233:1;2230;2223:12;2185:52;2256:29;2275:9;2256:29;:::i;2724:180::-;2783:6;2836:2;2824:9;2815:7;2811:23;2807:32;2804:52;;;2852:1;2849;2842:12;2804:52;-1:-1:-1;2875:23:1;;2724:180;-1:-1:-1;2724:180:1:o;2909:156::-;2975:20;;3035:4;3024:16;;3014:27;;3004:55;;3055:1;3052;3045:12;3070:531;3172:6;3180;3188;3196;3204;3212;3265:3;3253:9;3244:7;3240:23;3236:33;3233:53;;;3282:1;3279;3272:12;3233:53;3305:29;3324:9;3305:29;:::i;:::-;3295:39;;3381:2;3370:9;3366:18;3353:32;3343:42;;3432:2;3421:9;3417:18;3404:32;3394:42;;3455:36;3487:2;3476:9;3472:18;3455:36;:::i;:::-;3445:46;;3538:3;3527:9;3523:19;3510:33;3500:43;;3590:3;3579:9;3575:19;3562:33;3552:43;;3070:531;;;;;;;;:::o;3606:606::-;3717:6;3725;3733;3741;3749;3757;3765;3818:3;3806:9;3797:7;3793:23;3789:33;3786:53;;;3835:1;3832;3825:12;3786:53;3858:29;3877:9;3858:29;:::i;:::-;3848:39;;3906:38;3940:2;3929:9;3925:18;3906:38;:::i;:::-;3896:48;;3991:2;3980:9;3976:18;3963:32;3953:42;;4042:2;4031:9;4027:18;4014:32;4004:42;;4065:37;4097:3;4086:9;4082:19;4065:37;:::i;:::-;4055:47;;4149:3;4138:9;4134:19;4121:33;4111:43;;4201:3;4190:9;4186:19;4173:33;4163:43;;3606:606;;;;;;;;;;:::o;4217:260::-;4285:6;4293;4346:2;4334:9;4325:7;4321:23;4317:32;4314:52;;;4362:1;4359;4352:12;4314:52;4385:29;4404:9;4385:29;:::i;:::-;4375:39;;4433:38;4467:2;4456:9;4452:18;4433:38;:::i;:::-;4423:48;;4217:260;;;;;:::o;4482:350::-;4549:6;4557;4610:2;4598:9;4589:7;4585:23;4581:32;4578:52;;;4626:1;4623;4616:12;4578:52;4649:29;4668:9;4649:29;:::i;:::-;4639:39;;4728:2;4717:9;4713:18;4700:32;4772:10;4765:5;4761:22;4754:5;4751:33;4741:61;;4798:1;4795;4788:12;4741:61;4821:5;4811:15;;;4482:350;;;;;:::o;5227:437::-;5306:1;5302:12;;;;5349;;;5370:61;;5424:4;5416:6;5412:17;5402:27;;5370:61;5477:2;5469:6;5466:14;5446:18;5443:38;5440:218;;-1:-1:-1;;;5511:1:1;5504:88;5615:4;5612:1;5605:15;5643:4;5640:1;5633:15;5669:184;-1:-1:-1;;;5718:1:1;5711:88;5818:4;5815:1;5808:15;5842:4;5839:1;5832:15;5858:125;5923:9;;;5944:10;;;5941:36;;;5957:18;;:::i;6348:128::-;6415:9;;;6436:11;;;6433:37;;;6450:18;;:::i;6481:184::-;-1:-1:-1;;;6530:1:1;6523:88;6630:4;6627:1;6620:15;6654:4;6651:1;6644:15;15791:184;-1:-1:-1;;;15840:1:1;15833:88;15940:4;15937:1;15930:15;15964:4;15961:1;15954:15;15980:274;16020:1;16046;16036:189;;-1:-1:-1;;;16078:1:1;16071:88;16182:4;16179:1;16172:15;16210:4;16207:1;16200:15;16036:189;-1:-1:-1;16239:9:1;;15980:274::o;17111:184::-;-1:-1:-1;;;17160:1:1;17153:88;17260:4;17257:1;17250:15;17284:4;17281:1;17274:15
Swarm Source
ipfs://ffe3a3a2b6a0bd00f8314305fa54e440f76854f1715c2fff7e720fa97b620027
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$4.83
Net Worth in ETH
Token Allocations
ELK
100.00%
Multichain Portfolio | 34 Chains
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.