Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
TCT
Compiler Version
v0.8.30+commit.73712a01
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2025-09-23
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity >=0.6.2;
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
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/utils/Context.sol
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
// File: @openzeppelin/contracts/interfaces/draft-IERC6093.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC6093.sol)
pragma solidity >=0.8.4;
/**
* @dev Standard ERC-20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC-721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC-1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
/**
* @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}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC-20
* applications.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* Both 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 returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/// @inheritdoc IERC20
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/// @inheritdoc IERC20
function balanceOf(address account) public view virtual 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 `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/// @inheritdoc IERC20
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` 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 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Skips emitting an {Approval} event indicating an allowance update. This is not
* required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
*
* 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 `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` 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.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` 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.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
*
* ```solidity
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner`'s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance < type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.20;
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys a `value` amount of tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 value) public virtual {
_burn(_msgSender(), value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, deducting from
* the caller's allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `value`.
*/
function burnFrom(address account, uint256 value) public virtual {
_spendAllowance(account, _msgSender(), value);
_burn(account, value);
}
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC-20 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.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
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].
*
* CAUTION: See Security Considerations above.
*/
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/cryptography/ECDSA.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.20;
/**
* @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
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
error ECDSAInvalidSignatureLength(uint256 length);
/**
* @dev The signature has an S value that is in the upper half order.
*/
error ECDSAInvalidSignatureS(bytes32 s);
/**
* @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
* return address(0) without also returning an error description. Errors are documented using an enum (error type)
* and a bytes32 providing additional information about the error.
*
* If no error is returned, then the address can be used for verification purposes.
*
* The `ecrecover` EVM precompile 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 {MessageHashUtils-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]
*/
function tryRecover(
bytes32 hash,
bytes memory signature
) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly ("memory-safe") {
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, bytes32(signature.length));
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM precompile 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 {MessageHashUtils-toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
_throwError(error, errorArg);
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[ERC-2098 short signatures]
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
unchecked {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
// We do not check for an overflow here since the shift operation results in 0 or 1.
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.
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
// 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, s);
}
// 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, bytes32(0));
}
return (signer, RecoverError.NoError, bytes32(0));
}
/**
* @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, bytes32 errorArg) = tryRecover(hash, v, r, s);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
*/
function _throwError(RecoverError error, bytes32 errorArg) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert ECDSAInvalidSignature();
} else if (error == RecoverError.InvalidSignatureLength) {
revert ECDSAInvalidSignatureLength(uint256(errorArg));
} else if (error == RecoverError.InvalidSignatureS) {
revert ECDSAInvalidSignatureS(errorArg);
}
}
}
// File: @openzeppelin/contracts/utils/Panic.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)
pragma solidity ^0.8.20;
/**
* @dev Helper library for emitting standardized panic codes.
*
* ```solidity
* contract Example {
* using Panic for uint256;
*
* // Use any of the declared internal constants
* function foo() { Panic.GENERIC.panic(); }
*
* // Alternatively
* function foo() { Panic.panic(Panic.GENERIC); }
* }
* ```
*
* Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
*
* _Available since v5.1._
*/
// slither-disable-next-line unused-state
library Panic {
/// @dev generic / unspecified error
uint256 internal constant GENERIC = 0x00;
/// @dev used by the assert() builtin
uint256 internal constant ASSERT = 0x01;
/// @dev arithmetic underflow or overflow
uint256 internal constant UNDER_OVERFLOW = 0x11;
/// @dev division or modulo by zero
uint256 internal constant DIVISION_BY_ZERO = 0x12;
/// @dev enum conversion error
uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
/// @dev invalid encoding in storage
uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
/// @dev empty array pop
uint256 internal constant EMPTY_ARRAY_POP = 0x31;
/// @dev array out of bounds access
uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
/// @dev resource error (too large allocation or too large array)
uint256 internal constant RESOURCE_ERROR = 0x41;
/// @dev calling invalid internal function
uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;
/// @dev Reverts with a panic code. Recommended to use with
/// the internal constants with predefined codes.
function panic(uint256 code) internal pure {
assembly ("memory-safe") {
mstore(0x00, 0x4e487b71)
mstore(0x20, code)
revert(0x1c, 0x24)
}
}
}
// File: @openzeppelin/contracts/utils/math/SafeCast.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.20;
/**
* @dev Wrappers over Solidity's uintXX/intXX/bool 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.
*/
library SafeCast {
/**
* @dev Value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
/**
* @dev An int value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedIntToUint(int256 value);
/**
* @dev Value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);
/**
* @dev An uint value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedUintToInt(uint256 value);
/**
* @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
*/
function toUint248(uint256 value) internal pure returns (uint248) {
if (value > type(uint248).max) {
revert SafeCastOverflowedUintDowncast(248, value);
}
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
*/
function toUint240(uint256 value) internal pure returns (uint240) {
if (value > type(uint240).max) {
revert SafeCastOverflowedUintDowncast(240, value);
}
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
*/
function toUint232(uint256 value) internal pure returns (uint232) {
if (value > type(uint232).max) {
revert SafeCastOverflowedUintDowncast(232, value);
}
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
*/
function toUint224(uint256 value) internal pure returns (uint224) {
if (value > type(uint224).max) {
revert SafeCastOverflowedUintDowncast(224, value);
}
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
*/
function toUint216(uint256 value) internal pure returns (uint216) {
if (value > type(uint216).max) {
revert SafeCastOverflowedUintDowncast(216, value);
}
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
*/
function toUint208(uint256 value) internal pure returns (uint208) {
if (value > type(uint208).max) {
revert SafeCastOverflowedUintDowncast(208, value);
}
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
*/
function toUint200(uint256 value) internal pure returns (uint200) {
if (value > type(uint200).max) {
revert SafeCastOverflowedUintDowncast(200, value);
}
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
*/
function toUint192(uint256 value) internal pure returns (uint192) {
if (value > type(uint192).max) {
revert SafeCastOverflowedUintDowncast(192, value);
}
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
*/
function toUint184(uint256 value) internal pure returns (uint184) {
if (value > type(uint184).max) {
revert SafeCastOverflowedUintDowncast(184, value);
}
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
*/
function toUint176(uint256 value) internal pure returns (uint176) {
if (value > type(uint176).max) {
revert SafeCastOverflowedUintDowncast(176, value);
}
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
*/
function toUint168(uint256 value) internal pure returns (uint168) {
if (value > type(uint168).max) {
revert SafeCastOverflowedUintDowncast(168, value);
}
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
*/
function toUint160(uint256 value) internal pure returns (uint160) {
if (value > type(uint160).max) {
revert SafeCastOverflowedUintDowncast(160, value);
}
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
*/
function toUint152(uint256 value) internal pure returns (uint152) {
if (value > type(uint152).max) {
revert SafeCastOverflowedUintDowncast(152, value);
}
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
*/
function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
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
*/
function toUint136(uint256 value) internal pure returns (uint136) {
if (value > type(uint136).max) {
revert SafeCastOverflowedUintDowncast(136, value);
}
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
*/
function toUint128(uint256 value) internal pure returns (uint128) {
if (value > type(uint128).max) {
revert SafeCastOverflowedUintDowncast(128, value);
}
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
*/
function toUint120(uint256 value) internal pure returns (uint120) {
if (value > type(uint120).max) {
revert SafeCastOverflowedUintDowncast(120, value);
}
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
*/
function toUint112(uint256 value) internal pure returns (uint112) {
if (value > type(uint112).max) {
revert SafeCastOverflowedUintDowncast(112, value);
}
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
*/
function toUint104(uint256 value) internal pure returns (uint104) {
if (value > type(uint104).max) {
revert SafeCastOverflowedUintDowncast(104, value);
}
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
*/
function toUint96(uint256 value) internal pure returns (uint96) {
if (value > type(uint96).max) {
revert SafeCastOverflowedUintDowncast(96, value);
}
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
*/
function toUint88(uint256 value) internal pure returns (uint88) {
if (value > type(uint88).max) {
revert SafeCastOverflowedUintDowncast(88, value);
}
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
*/
function toUint80(uint256 value) internal pure returns (uint80) {
if (value > type(uint80).max) {
revert SafeCastOverflowedUintDowncast(80, value);
}
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
*/
function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
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
*/
function toUint64(uint256 value) internal pure returns (uint64) {
if (value > type(uint64).max) {
revert SafeCastOverflowedUintDowncast(64, value);
}
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
*/
function toUint56(uint256 value) internal pure returns (uint56) {
if (value > type(uint56).max) {
revert SafeCastOverflowedUintDowncast(56, value);
}
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
*/
function toUint48(uint256 value) internal pure returns (uint48) {
if (value > type(uint48).max) {
revert SafeCastOverflowedUintDowncast(48, value);
}
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
*/
function toUint40(uint256 value) internal pure returns (uint40) {
if (value > type(uint40).max) {
revert SafeCastOverflowedUintDowncast(40, value);
}
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
*/
function toUint32(uint256 value) internal pure returns (uint32) {
if (value > type(uint32).max) {
revert SafeCastOverflowedUintDowncast(32, value);
}
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
*/
function toUint24(uint256 value) internal pure returns (uint24) {
if (value > type(uint24).max) {
revert SafeCastOverflowedUintDowncast(24, value);
}
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
*/
function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
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
*/
function toUint8(uint256 value) internal pure returns (uint8) {
if (value > type(uint8).max) {
revert SafeCastOverflowedUintDowncast(8, value);
}
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
if (value < 0) {
revert SafeCastOverflowedIntToUint(value);
}
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
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(248, value);
}
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(240, value);
}
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(232, value);
}
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(224, value);
}
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(216, value);
}
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(208, value);
}
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(200, value);
}
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(184, value);
}
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(176, value);
}
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(168, value);
}
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(160, value);
}
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(152, value);
}
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(144, value);
}
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(136, value);
}
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(128, value);
}
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(120, value);
}
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(112, value);
}
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(104, value);
}
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(96, value);
}
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(88, value);
}
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(80, value);
}
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(72, value);
}
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(64, value);
}
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(56, value);
}
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(48, value);
}
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(40, value);
}
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(32, value);
}
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(24, value);
}
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(8, value);
}
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
if (value > uint256(type(int256).max)) {
revert SafeCastOverflowedUintToInt(value);
}
return int256(value);
}
/**
* @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
*/
function toUint(bool b) internal pure returns (uint256 u) {
assembly ("memory-safe") {
u := iszero(iszero(b))
}
}
}
// File: @openzeppelin/contracts/utils/math/Math.sol
// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Return the 512-bit addition of two uint256.
*
* The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.
*/
function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
assembly ("memory-safe") {
low := add(a, b)
high := lt(low, a)
}
}
/**
* @dev Return the 512-bit multiplication of two uint256.
*
* The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.
*/
function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
// 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use
// the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = high * 2²⁵⁶ + low.
assembly ("memory-safe") {
let mm := mulmod(a, b, not(0))
low := mul(a, b)
high := sub(sub(mm, low), lt(mm, low))
}
}
/**
* @dev Returns the addition of two unsigned integers, with a success flag (no overflow).
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a + b;
success = c >= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a - b;
success = c <= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a * b;
assembly ("memory-safe") {
// Only true when the multiplication doesn't overflow
// (c / a == b) || (a == 0)
success := or(eq(div(c, a), b), iszero(a))
}
// equivalent to: success ? c : 0
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the division of two unsigned integers, with a success flag (no division by zero).
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
success = b > 0;
assembly ("memory-safe") {
// The `DIV` opcode returns zero when the denominator is 0.
result := div(a, b)
}
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
success = b > 0;
assembly ("memory-safe") {
// The `MOD` opcode returns zero when the denominator is 0.
result := mod(a, b)
}
}
}
/**
* @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryAdd(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.
*/
function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {
(, uint256 result) = trySub(a, b);
return result;
}
/**
* @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryMul(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
*
* IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
* However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
* one branch when needed, making this function more expensive.
*/
function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
unchecked {
// branchless ternary works because:
// b ^ (a ^ b) == a
// b ^ 0 == b
return b ^ ((a ^ b) * SafeCast.toUint(condition));
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a > b, a, b);
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(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 towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
Panic.panic(Panic.DIVISION_BY_ZERO);
}
// The following calculation ensures accurate ceiling division without overflow.
// Since a is non-zero, (a - 1) / b will not overflow.
// The largest possible result occurs when (a - 1) / b is type(uint256).max,
// but the largest value we can obtain is type(uint256).max - 1, which happens
// when a = type(uint256).max and b = 1.
unchecked {
return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
}
}
/**
* @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
*
* 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 {
(uint256 high, uint256 low) = mul512(x, y);
// Handle non-overflow cases, 256 by 256 division.
if (high == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return low / denominator;
}
// Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.
if (denominator <= high) {
Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [high low].
uint256 remainder;
assembly ("memory-safe") {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
high := sub(high, gt(remainder, low))
low := sub(low, 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.
uint256 twos = denominator & (0 - denominator);
assembly ("memory-safe") {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [high low] by twos.
low := div(low, twos)
// Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from high into low.
low |= high * twos;
// Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such
// that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv ≡ 1 mod 2⁴.
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⁸
inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶
inverse *= 2 - denominator * inverse; // inverse mod 2³²
inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴
inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸
inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶
// 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²⁵⁶. Since the preconditions guarantee that the outcome is
// less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high
// is no longer required.
result = low * inverse;
return result;
}
}
/**
* @dev 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) {
return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
}
/**
* @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.
*/
function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {
unchecked {
(uint256 high, uint256 low) = mul512(x, y);
if (high >= 1 << n) {
Panic.panic(Panic.UNDER_OVERFLOW);
}
return (high << (256 - n)) | (low >> n);
}
}
/**
* @dev Calculates x * y >> n with full precision, following the selected rounding direction.
*/
function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {
return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);
}
/**
* @dev Calculate the modular multiplicative inverse of a number in Z/nZ.
*
* If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.
* If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.
*
* If the input value is not inversible, 0 is returned.
*
* NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the
* inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.
*/
function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
unchecked {
if (n == 0) return 0;
// The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)
// Used to compute integers x and y such that: ax + ny = gcd(a, n).
// When the gcd is 1, then the inverse of a modulo n exists and it's x.
// ax + ny = 1
// ax = 1 + (-y)n
// ax ≡ 1 (mod n) # x is the inverse of a modulo n
// If the remainder is 0 the gcd is n right away.
uint256 remainder = a % n;
uint256 gcd = n;
// Therefore the initial coefficients are:
// ax + ny = gcd(a, n) = n
// 0a + 1n = n
int256 x = 0;
int256 y = 1;
while (remainder != 0) {
uint256 quotient = gcd / remainder;
(gcd, remainder) = (
// The old remainder is the next gcd to try.
remainder,
// Compute the next remainder.
// Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd
// where gcd is at most n (capped to type(uint256).max)
gcd - remainder * quotient
);
(x, y) = (
// Increment the coefficient of a.
y,
// Decrement the coefficient of n.
// Can overflow, but the result is casted to uint256 so that the
// next value of y is "wrapped around" to a value between 0 and n - 1.
x - y * int256(quotient)
);
}
if (gcd != 1) return 0; // No inverse exists.
return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.
}
}
/**
* @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.
*
* From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is
* prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that
* `a**(p-2)` is the modular multiplicative inverse of a in Fp.
*
* NOTE: this function does NOT check that `p` is a prime greater than `2`.
*/
function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
unchecked {
return Math.modExp(a, p - 2, p);
}
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)
*
* Requirements:
* - modulus can't be zero
* - underlying staticcall to precompile must succeed
*
* IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make
* sure the chain you're using it on supports the precompiled contract for modular exponentiation
* at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,
* the underlying function will succeed given the lack of a revert, but the result may be incorrectly
* interpreted as 0.
*/
function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
(bool success, uint256 result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).
* It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying
* to operate modulo 0 or if the underlying precompile reverted.
*
* IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain
* you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in
* https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack
* of a revert, but the result may be incorrectly interpreted as 0.
*/
function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
if (m == 0) return (false, 0);
assembly ("memory-safe") {
let ptr := mload(0x40)
// | Offset | Content | Content (Hex) |
// |-----------|------------|--------------------------------------------------------------------|
// | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x60:0x7f | value of b | 0x<.............................................................b> |
// | 0x80:0x9f | value of e | 0x<.............................................................e> |
// | 0xa0:0xbf | value of m | 0x<.............................................................m> |
mstore(ptr, 0x20)
mstore(add(ptr, 0x20), 0x20)
mstore(add(ptr, 0x40), 0x20)
mstore(add(ptr, 0x60), b)
mstore(add(ptr, 0x80), e)
mstore(add(ptr, 0xa0), m)
// Given the result < m, it's guaranteed to fit in 32 bytes,
// so we can use the memory scratch space located at offset 0.
success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
result := mload(0x00)
}
}
/**
* @dev Variant of {modExp} that supports inputs of arbitrary length.
*/
function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
(bool success, bytes memory result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Variant of {tryModExp} that supports inputs of arbitrary length.
*/
function tryModExp(
bytes memory b,
bytes memory e,
bytes memory m
) internal view returns (bool success, bytes memory result) {
if (_zeroBytes(m)) return (false, new bytes(0));
uint256 mLen = m.length;
// Encode call args in result and move the free memory pointer
result = abi.encodePacked(b.length, e.length, mLen, b, e, m);
assembly ("memory-safe") {
let dataPtr := add(result, 0x20)
// Write result on top of args to avoid allocating extra memory.
success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
// Overwrite the length.
// result.length > returndatasize() is guaranteed because returndatasize() == m.length
mstore(result, mLen)
// Set the memory pointer after the returned data.
mstore(0x40, add(dataPtr, mLen))
}
}
/**
* @dev Returns whether the provided byte array is zero.
*/
function _zeroBytes(bytes memory byteArray) private pure returns (bool) {
for (uint256 i = 0; i < byteArray.length; ++i) {
if (byteArray[i] != 0) {
return false;
}
}
return true;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* This method is based on Newton's method for computing square roots; the algorithm is restricted to only
* using integer operations.
*/
function sqrt(uint256 a) internal pure returns (uint256) {
unchecked {
// Take care of easy edge cases when a == 0 or a == 1
if (a <= 1) {
return a;
}
// In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a
// sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between
// the current value as `ε_n = | x_n - sqrt(a) |`.
//
// For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root
// of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is
// bigger than any uint256.
//
// By noticing that
// `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`
// we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar
// to the msb function.
uint256 aa = a;
uint256 xn = 1;
if (aa >= (1 << 128)) {
aa >>= 128;
xn <<= 64;
}
if (aa >= (1 << 64)) {
aa >>= 64;
xn <<= 32;
}
if (aa >= (1 << 32)) {
aa >>= 32;
xn <<= 16;
}
if (aa >= (1 << 16)) {
aa >>= 16;
xn <<= 8;
}
if (aa >= (1 << 8)) {
aa >>= 8;
xn <<= 4;
}
if (aa >= (1 << 4)) {
aa >>= 4;
xn <<= 2;
}
if (aa >= (1 << 2)) {
xn <<= 1;
}
// We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).
//
// We can refine our estimation by noticing that the middle of that interval minimizes the error.
// If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).
// This is going to be our x_0 (and ε_0)
xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)
// From here, Newton's method give us:
// x_{n+1} = (x_n + a / x_n) / 2
//
// One should note that:
// x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a
// = ((x_n² + a) / (2 * x_n))² - a
// = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a
// = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)
// = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)
// = (x_n² - a)² / (2 * x_n)²
// = ((x_n² - a) / (2 * x_n))²
// ≥ 0
// Which proves that for all n ≥ 1, sqrt(a) ≤ x_n
//
// This gives us the proof of quadratic convergence of the sequence:
// ε_{n+1} = | x_{n+1} - sqrt(a) |
// = | (x_n + a / x_n) / 2 - sqrt(a) |
// = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |
// = | (x_n - sqrt(a))² / (2 * x_n) |
// = | ε_n² / (2 * x_n) |
// = ε_n² / | (2 * x_n) |
//
// For the first iteration, we have a special case where x_0 is known:
// ε_1 = ε_0² / | (2 * x_0) |
// ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))
// ≤ 2**(2*e-4) / (3 * 2**(e-1))
// ≤ 2**(e-3) / 3
// ≤ 2**(e-3-log2(3))
// ≤ 2**(e-4.5)
//
// For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:
// ε_{n+1} = ε_n² / | (2 * x_n) |
// ≤ (2**(e-k))² / (2 * 2**(e-1))
// ≤ 2**(2*e-2*k) / 2**e
// ≤ 2**(e-2*k)
xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above
xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5
xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9
xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18
xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36
xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72
// Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision
// ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either
// sqrt(a) or sqrt(a) + 1.
return xn - SafeCast.toUint(xn > a / xn);
}
}
/**
* @dev 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// If upper 8 bits of 16-bit half set, add 8 to result
r |= SafeCast.toUint((x >> r) > 0xff) << 3;
// If upper 4 bits of 8-bit half set, add 4 to result
r |= SafeCast.toUint((x >> r) > 0xf) << 2;
// Shifts value right by the current result and use it as an index into this lookup table:
//
// | x (4 bits) | index | table[index] = MSB position |
// |------------|---------|-----------------------------|
// | 0000 | 0 | table[0] = 0 |
// | 0001 | 1 | table[1] = 0 |
// | 0010 | 2 | table[2] = 1 |
// | 0011 | 3 | table[3] = 1 |
// | 0100 | 4 | table[4] = 2 |
// | 0101 | 5 | table[5] = 2 |
// | 0110 | 6 | table[6] = 2 |
// | 0111 | 7 | table[7] = 2 |
// | 1000 | 8 | table[8] = 3 |
// | 1001 | 9 | table[9] = 3 |
// | 1010 | 10 | table[10] = 3 |
// | 1011 | 11 | table[11] = 3 |
// | 1100 | 12 | table[12] = 3 |
// | 1101 | 13 | table[13] = 3 |
// | 1110 | 14 | table[14] = 3 |
// | 1111 | 15 | table[15] = 3 |
//
// The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes.
assembly ("memory-safe") {
r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))
}
}
/**
* @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* 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 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8
return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}
// File: @openzeppelin/contracts/utils/math/SignedMath.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
*
* IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
* However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
* one branch when needed, making this function more expensive.
*/
function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {
unchecked {
// branchless ternary works because:
// b ^ (a ^ b) == a
// b ^ 0 == b
return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));
}
}
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return ternary(a > b, a, b);
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return ternary(a < b, a, b);
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// Formula from the "Bit Twiddling Hacks" by Sean Eron Anderson.
// Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,
// taking advantage of the most significant (or "sign" bit) in two's complement representation.
// This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,
// the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative).
int256 mask = n >> 255;
// A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.
return uint256((n + mask) ^ mask);
}
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
/**
* @dev String operations.
*/
library Strings {
using SafeCast for *;
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
uint256 private constant SPECIAL_CHARS_LOOKUP =
(1 << 0x08) | // backspace
(1 << 0x09) | // tab
(1 << 0x0a) | // newline
(1 << 0x0c) | // form feed
(1 << 0x0d) | // carriage return
(1 << 0x22) | // double quote
(1 << 0x5c); // backslash
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev The string being parsed contains characters that are not in scope of the given base.
*/
error StringsInvalidChar();
/**
* @dev The string being parsed is not a properly formatted address.
*/
error StringsInvalidAddressFormat();
/**
* @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;
assembly ("memory-safe") {
ptr := add(add(buffer, 0x20), length)
}
while (true) {
ptr--;
assembly ("memory-safe") {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal
* representation, according to EIP-55.
*/
function toChecksumHexString(address addr) internal pure returns (string memory) {
bytes memory buffer = bytes(toHexString(addr));
// hash the hex part of buffer (skip length + 2 bytes, length 40)
uint256 hashValue;
assembly ("memory-safe") {
hashValue := shr(96, keccak256(add(buffer, 0x22), 40))
}
for (uint256 i = 41; i > 1; --i) {
// possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f)
if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {
// case shift by xoring with 0x20
buffer[i] ^= 0x20;
}
hashValue >>= 4;
}
return string(buffer);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
/**
* @dev Parse a decimal string and returns the value as a `uint256`.
*
* Requirements:
* - The string must be formatted as `[0-9]*`
* - The result must fit into an `uint256` type
*/
function parseUint(string memory input) internal pure returns (uint256) {
return parseUint(input, 0, bytes(input).length);
}
/**
* @dev Variant of {parseUint-string} that parses a substring of `input` located between position `begin` (included) and
* `end` (excluded).
*
* Requirements:
* - The substring must be formatted as `[0-9]*`
* - The result must fit into an `uint256` type
*/
function parseUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {
(bool success, uint256 value) = tryParseUint(input, begin, end);
if (!success) revert StringsInvalidChar();
return value;
}
/**
* @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.
*
* NOTE: This function will revert if the result does not fit in a `uint256`.
*/
function tryParseUint(string memory input) internal pure returns (bool success, uint256 value) {
return _tryParseUintUncheckedBounds(input, 0, bytes(input).length);
}
/**
* @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid
* character.
*
* NOTE: This function will revert if the result does not fit in a `uint256`.
*/
function tryParseUint(
string memory input,
uint256 begin,
uint256 end
) internal pure returns (bool success, uint256 value) {
if (end > bytes(input).length || begin > end) return (false, 0);
return _tryParseUintUncheckedBounds(input, begin, end);
}
/**
* @dev Implementation of {tryParseUint-string-uint256-uint256} that does not check bounds. Caller should make sure that
* `begin <= end <= input.length`. Other inputs would result in undefined behavior.
*/
function _tryParseUintUncheckedBounds(
string memory input,
uint256 begin,
uint256 end
) private pure returns (bool success, uint256 value) {
bytes memory buffer = bytes(input);
uint256 result = 0;
for (uint256 i = begin; i < end; ++i) {
uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));
if (chr > 9) return (false, 0);
result *= 10;
result += chr;
}
return (true, result);
}
/**
* @dev Parse a decimal string and returns the value as a `int256`.
*
* Requirements:
* - The string must be formatted as `[-+]?[0-9]*`
* - The result must fit in an `int256` type.
*/
function parseInt(string memory input) internal pure returns (int256) {
return parseInt(input, 0, bytes(input).length);
}
/**
* @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and
* `end` (excluded).
*
* Requirements:
* - The substring must be formatted as `[-+]?[0-9]*`
* - The result must fit in an `int256` type.
*/
function parseInt(string memory input, uint256 begin, uint256 end) internal pure returns (int256) {
(bool success, int256 value) = tryParseInt(input, begin, end);
if (!success) revert StringsInvalidChar();
return value;
}
/**
* @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if
* the result does not fit in a `int256`.
*
* NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.
*/
function tryParseInt(string memory input) internal pure returns (bool success, int256 value) {
return _tryParseIntUncheckedBounds(input, 0, bytes(input).length);
}
uint256 private constant ABS_MIN_INT256 = 2 ** 255;
/**
* @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid
* character or if the result does not fit in a `int256`.
*
* NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.
*/
function tryParseInt(
string memory input,
uint256 begin,
uint256 end
) internal pure returns (bool success, int256 value) {
if (end > bytes(input).length || begin > end) return (false, 0);
return _tryParseIntUncheckedBounds(input, begin, end);
}
/**
* @dev Implementation of {tryParseInt-string-uint256-uint256} that does not check bounds. Caller should make sure that
* `begin <= end <= input.length`. Other inputs would result in undefined behavior.
*/
function _tryParseIntUncheckedBounds(
string memory input,
uint256 begin,
uint256 end
) private pure returns (bool success, int256 value) {
bytes memory buffer = bytes(input);
// Check presence of a negative sign.
bytes1 sign = begin == end ? bytes1(0) : bytes1(_unsafeReadBytesOffset(buffer, begin)); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
bool positiveSign = sign == bytes1("+");
bool negativeSign = sign == bytes1("-");
uint256 offset = (positiveSign || negativeSign).toUint();
(bool absSuccess, uint256 absValue) = tryParseUint(input, begin + offset, end);
if (absSuccess && absValue < ABS_MIN_INT256) {
return (true, negativeSign ? -int256(absValue) : int256(absValue));
} else if (absSuccess && negativeSign && absValue == ABS_MIN_INT256) {
return (true, type(int256).min);
} else return (false, 0);
}
/**
* @dev Parse a hexadecimal string (with or without "0x" prefix), and returns the value as a `uint256`.
*
* Requirements:
* - The string must be formatted as `(0x)?[0-9a-fA-F]*`
* - The result must fit in an `uint256` type.
*/
function parseHexUint(string memory input) internal pure returns (uint256) {
return parseHexUint(input, 0, bytes(input).length);
}
/**
* @dev Variant of {parseHexUint-string} that parses a substring of `input` located between position `begin` (included) and
* `end` (excluded).
*
* Requirements:
* - The substring must be formatted as `(0x)?[0-9a-fA-F]*`
* - The result must fit in an `uint256` type.
*/
function parseHexUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {
(bool success, uint256 value) = tryParseHexUint(input, begin, end);
if (!success) revert StringsInvalidChar();
return value;
}
/**
* @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.
*
* NOTE: This function will revert if the result does not fit in a `uint256`.
*/
function tryParseHexUint(string memory input) internal pure returns (bool success, uint256 value) {
return _tryParseHexUintUncheckedBounds(input, 0, bytes(input).length);
}
/**
* @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an
* invalid character.
*
* NOTE: This function will revert if the result does not fit in a `uint256`.
*/
function tryParseHexUint(
string memory input,
uint256 begin,
uint256 end
) internal pure returns (bool success, uint256 value) {
if (end > bytes(input).length || begin > end) return (false, 0);
return _tryParseHexUintUncheckedBounds(input, begin, end);
}
/**
* @dev Implementation of {tryParseHexUint-string-uint256-uint256} that does not check bounds. Caller should make sure that
* `begin <= end <= input.length`. Other inputs would result in undefined behavior.
*/
function _tryParseHexUintUncheckedBounds(
string memory input,
uint256 begin,
uint256 end
) private pure returns (bool success, uint256 value) {
bytes memory buffer = bytes(input);
// skip 0x prefix if present
bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
uint256 offset = hasPrefix.toUint() * 2;
uint256 result = 0;
for (uint256 i = begin + offset; i < end; ++i) {
uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));
if (chr > 15) return (false, 0);
result *= 16;
unchecked {
// Multiplying by 16 is equivalent to a shift of 4 bits (with additional overflow check).
// This guarantees that adding a value < 16 will not cause an overflow, hence the unchecked.
result += chr;
}
}
return (true, result);
}
/**
* @dev Parse a hexadecimal string (with or without "0x" prefix), and returns the value as an `address`.
*
* Requirements:
* - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`
*/
function parseAddress(string memory input) internal pure returns (address) {
return parseAddress(input, 0, bytes(input).length);
}
/**
* @dev Variant of {parseAddress-string} that parses a substring of `input` located between position `begin` (included) and
* `end` (excluded).
*
* Requirements:
* - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`
*/
function parseAddress(string memory input, uint256 begin, uint256 end) internal pure returns (address) {
(bool success, address value) = tryParseAddress(input, begin, end);
if (!success) revert StringsInvalidAddressFormat();
return value;
}
/**
* @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly
* formatted address. See {parseAddress-string} requirements.
*/
function tryParseAddress(string memory input) internal pure returns (bool success, address value) {
return tryParseAddress(input, 0, bytes(input).length);
}
/**
* @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly
* formatted address. See {parseAddress-string-uint256-uint256} requirements.
*/
function tryParseAddress(
string memory input,
uint256 begin,
uint256 end
) internal pure returns (bool success, address value) {
if (end > bytes(input).length || begin > end) return (false, address(0));
bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty
uint256 expectedLength = 40 + hasPrefix.toUint() * 2;
// check that input is the correct length
if (end - begin == expectedLength) {
// length guarantees that this does not overflow, and value is at most type(uint160).max
(bool s, uint256 v) = _tryParseHexUintUncheckedBounds(input, begin, end);
return (s, address(uint160(v)));
} else {
return (false, address(0));
}
}
function _tryParseChr(bytes1 chr) private pure returns (uint8) {
uint8 value = uint8(chr);
// Try to parse `chr`:
// - Case 1: [0-9]
// - Case 2: [a-f]
// - Case 3: [A-F]
// - otherwise not supported
unchecked {
if (value > 47 && value < 58) value -= 48;
else if (value > 96 && value < 103) value -= 87;
else if (value > 64 && value < 71) value -= 55;
else return type(uint8).max;
}
return value;
}
/**
* @dev Escape special characters in JSON strings. This can be useful to prevent JSON injection in NFT metadata.
*
* WARNING: This function should only be used in double quoted JSON strings. Single quotes are not escaped.
*
* NOTE: This function escapes all unicode characters, and not just the ones in ranges defined in section 2.5 of
* RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). ECMAScript's `JSON.parse` does recover escaped unicode
* characters that are not in this range, but other tooling may provide different results.
*/
function escapeJSON(string memory input) internal pure returns (string memory) {
bytes memory buffer = bytes(input);
bytes memory output = new bytes(2 * buffer.length); // worst case scenario
uint256 outputLength = 0;
for (uint256 i; i < buffer.length; ++i) {
bytes1 char = bytes1(_unsafeReadBytesOffset(buffer, i));
if (((SPECIAL_CHARS_LOOKUP & (1 << uint8(char))) != 0)) {
output[outputLength++] = "\\";
if (char == 0x08) output[outputLength++] = "b";
else if (char == 0x09) output[outputLength++] = "t";
else if (char == 0x0a) output[outputLength++] = "n";
else if (char == 0x0c) output[outputLength++] = "f";
else if (char == 0x0d) output[outputLength++] = "r";
else if (char == 0x5c) output[outputLength++] = "\\";
else if (char == 0x22) {
// solhint-disable-next-line quotes
output[outputLength++] = '"';
}
} else {
output[outputLength++] = char;
}
}
// write the actual length and deallocate unused memory
assembly ("memory-safe") {
mstore(output, outputLength)
mstore(0x40, add(output, shl(5, shr(5, add(outputLength, 63)))))
}
return string(output);
}
/**
* @dev Reads a bytes32 from a bytes array without bounds checking.
*
* NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the
* assembly block as such would prevent some optimizations.
*/
function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {
// This is not memory safe in the general case, but all calls to this private function are within bounds.
assembly ("memory-safe") {
value := mload(add(add(buffer, 0x20), offset))
}
}
}
// File: @openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol
// OpenZeppelin Contracts (last updated v5.3.0) (utils/cryptography/MessageHashUtils.sol)
pragma solidity ^0.8.20;
/**
* @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
*
* The library provides methods for generating a hash of a message that conforms to the
* https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
* specifications.
*/
library MessageHashUtils {
/**
* @dev Returns the keccak256 digest of an ERC-191 signed data with version
* `0x45` (`personal_sign` messages).
*
* The digest is calculated by prefixing a bytes32 `messageHash` with
* `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
* hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.
*
* NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
* keccak256, although any bytes32 value can be safely used because the final digest will
* be re-hashed.
*
* See {ECDSA-recover}.
*/
function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
assembly ("memory-safe") {
mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
}
}
/**
* @dev Returns the keccak256 digest of an ERC-191 signed data with version
* `0x45` (`personal_sign` messages).
*
* The digest is calculated by prefixing an arbitrary `message` with
* `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
* hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.
*
* See {ECDSA-recover}.
*/
function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
return
keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
}
/**
* @dev Returns the keccak256 digest of an ERC-191 signed data with version
* `0x00` (data with intended validator).
*
* The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
* `validator` address. Then hashing the result.
*
* See {ECDSA-recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(hex"19_00", validator, data));
}
/**
* @dev Variant of {toDataWithIntendedValidatorHash-address-bytes} optimized for cases where `data` is a bytes32.
*/
function toDataWithIntendedValidatorHash(
address validator,
bytes32 messageHash
) internal pure returns (bytes32 digest) {
assembly ("memory-safe") {
mstore(0x00, hex"19_00")
mstore(0x02, shl(96, validator))
mstore(0x16, messageHash)
digest := keccak256(0x00, 0x36)
}
}
/**
* @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).
*
* The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
* `\x19\x01` and hashing the result. It corresponds to the hash signed by the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
*
* See {ECDSA-recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
assembly ("memory-safe") {
let ptr := mload(0x40)
mstore(ptr, hex"19_01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
digest := keccak256(ptr, 0x42)
}
}
}
// File: @openzeppelin/contracts/utils/StorageSlot.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @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 ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}
// File: @openzeppelin/contracts/utils/ShortStrings.sol
// OpenZeppelin Contracts (last updated v5.3.0) (utils/ShortStrings.sol)
pragma solidity ^0.8.20;
// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
// | length | 0x BB |
type ShortString is bytes32;
/**
* @dev This library provides functions to convert short memory strings
* into a `ShortString` type that can be used as an immutable variable.
*
* Strings of arbitrary length can be optimized using this library if
* they are short enough (up to 31 bytes) by packing them with their
* length (1 byte) in a single EVM word (32 bytes). Additionally, a
* fallback mechanism can be used for every other case.
*
* Usage example:
*
* ```solidity
* contract Named {
* using ShortStrings for *;
*
* ShortString private immutable _name;
* string private _nameFallback;
*
* constructor(string memory contractName) {
* _name = contractName.toShortStringWithFallback(_nameFallback);
* }
*
* function name() external view returns (string memory) {
* return _name.toStringWithFallback(_nameFallback);
* }
* }
* ```
*/
library ShortStrings {
// Used as an identifier for strings longer than 31 bytes.
bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;
error StringTooLong(string str);
error InvalidShortString();
/**
* @dev Encode a string of at most 31 chars into a `ShortString`.
*
* This will trigger a `StringTooLong` error is the input string is too long.
*/
function toShortString(string memory str) internal pure returns (ShortString) {
bytes memory bstr = bytes(str);
if (bstr.length > 31) {
revert StringTooLong(str);
}
return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
}
/**
* @dev Decode a `ShortString` back to a "normal" string.
*/
function toString(ShortString sstr) internal pure returns (string memory) {
uint256 len = byteLength(sstr);
// using `new string(len)` would work locally but is not memory safe.
string memory str = new string(32);
assembly ("memory-safe") {
mstore(str, len)
mstore(add(str, 0x20), sstr)
}
return str;
}
/**
* @dev Return the length of a `ShortString`.
*/
function byteLength(ShortString sstr) internal pure returns (uint256) {
uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
if (result > 31) {
revert InvalidShortString();
}
return result;
}
/**
* @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
*/
function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
if (bytes(value).length < 32) {
return toShortString(value);
} else {
StorageSlot.getStringSlot(store).value = value;
return ShortString.wrap(FALLBACK_SENTINEL);
}
}
/**
* @dev Decode a string that was encoded to `ShortString` or written to storage using {toShortStringWithFallback}.
*/
function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
return toString(value);
} else {
return store;
}
}
/**
* @dev Return the length of a string that was encoded to `ShortString` or written to storage using
* {toShortStringWithFallback}.
*
* WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
* actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
*/
function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
return byteLength(value);
} else {
return bytes(store).length;
}
}
}
// File: @openzeppelin/contracts/interfaces/IERC5267.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC5267.sol)
pragma solidity >=0.4.16;
interface IERC5267 {
/**
* @dev MAY be emitted to signal that the domain could have changed.
*/
event EIP712DomainChanged();
/**
* @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
* signature.
*/
function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
}
// File: @openzeppelin/contracts/utils/cryptography/EIP712.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.20;
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.
*
* The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
* encoding is very generic and therefore its 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 order to
* produce the hash of their typed data 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].
*
* NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
* separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
* separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
*
* @custom:oz-upgrades-unsafe-allow state-variable-immutable
*/
abstract contract EIP712 is IERC5267 {
using ShortStrings for *;
bytes32 private constant TYPE_HASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
// 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 _cachedDomainSeparator;
uint256 private immutable _cachedChainId;
address private immutable _cachedThis;
bytes32 private immutable _hashedName;
bytes32 private immutable _hashedVersion;
ShortString private immutable _name;
ShortString private immutable _version;
// slither-disable-next-line constable-states
string private _nameFallback;
// slither-disable-next-line constable-states
string private _versionFallback;
/**
* @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) {
_name = name.toShortStringWithFallback(_nameFallback);
_version = version.toShortStringWithFallback(_versionFallback);
_hashedName = keccak256(bytes(name));
_hashedVersion = keccak256(bytes(version));
_cachedChainId = block.chainid;
_cachedDomainSeparator = _buildDomainSeparator();
_cachedThis = address(this);
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
return _cachedDomainSeparator;
} else {
return _buildDomainSeparator();
}
}
function _buildDomainSeparator() private view returns (bytes32) {
return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, 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 MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
}
/// @inheritdoc IERC5267
function eip712Domain()
public
view
virtual
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
)
{
return (
hex"0f", // 01111
_EIP712Name(),
_EIP712Version(),
block.chainid,
address(this),
bytes32(0),
new uint256[](0)
);
}
/**
* @dev The name parameter for the EIP712 domain.
*
* NOTE: By default this function reads _name which is an immutable value.
* It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
*/
// solhint-disable-next-line func-name-mixedcase
function _EIP712Name() internal view returns (string memory) {
return _name.toStringWithFallback(_nameFallback);
}
/**
* @dev The version parameter for the EIP712 domain.
*
* NOTE: By default this function reads _version which is an immutable value.
* It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
*/
// solhint-disable-next-line func-name-mixedcase
function _EIP712Version() internal view returns (string memory) {
return _version.toStringWithFallback(_versionFallback);
}
}
// File: @openzeppelin/contracts/utils/Nonces.sol
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides tracking nonces for addresses. Nonces will only increment.
*/
abstract contract Nonces {
/**
* @dev The nonce used for an `account` is not the expected current nonce.
*/
error InvalidAccountNonce(address account, uint256 currentNonce);
mapping(address account => uint256) private _nonces;
/**
* @dev Returns the next unused nonce for an address.
*/
function nonces(address owner) public view virtual returns (uint256) {
return _nonces[owner];
}
/**
* @dev Consumes a nonce.
*
* Returns the current value and increments nonce.
*/
function _useNonce(address owner) internal virtual returns (uint256) {
// For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be
// decremented or reset. This guarantees that the nonce never overflows.
unchecked {
// It is important to do x++ and not ++x here.
return _nonces[owner]++;
}
}
/**
* @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`.
*/
function _useCheckedNonce(address owner, uint256 nonce) internal virtual {
uint256 current = _useNonce(owner);
if (nonce != current) {
revert InvalidAccountNonce(owner, current);
}
}
}
// File: @openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/ERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Implementation of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC-20 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.
*/
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces {
bytes32 private constant PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/**
* @dev Permit deadline has expired.
*/
error ERC2612ExpiredSignature(uint256 deadline);
/**
* @dev Mismatched signature.
*/
error ERC2612InvalidSigner(address signer, address owner);
/**
* @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 ERC-20 token name.
*/
constructor(string memory name) EIP712(name, "1") {}
/// @inheritdoc IERC20Permit
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
if (block.timestamp > deadline) {
revert ERC2612ExpiredSignature(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);
if (signer != owner) {
revert ERC2612InvalidSigner(signer, owner);
}
_approve(owner, spender, value);
}
/// @inheritdoc IERC20Permit
function nonces(address owner) public view virtual override(IERC20Permit, Nonces) returns (uint256) {
return super.nonces(owner);
}
/// @inheritdoc IERC20Permit
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {
return _domainSeparatorV4();
}
}
// File: @openzeppelin/contracts/governance/utils/IVotes.sol
// OpenZeppelin Contracts (last updated v5.4.0) (governance/utils/IVotes.sol)
pragma solidity >=0.8.4;
/**
* @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.
*/
interface IVotes {
/**
* @dev The signature used has expired.
*/
error VotesExpiredSignature(uint256 expiry);
/**
* @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 voting units.
*/
event DelegateVotesChanged(address indexed delegate, uint256 previousVotes, uint256 newVotes);
/**
* @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 a specific moment in the past. If the `clock()` is
* configured to use block numbers, this will return the value at the end of the corresponding block.
*/
function getPastVotes(address account, uint256 timepoint) external view returns (uint256);
/**
* @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is
* configured to use block numbers, this will return the value at the end of the corresponding block.
*
* 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 timepoint) 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/interfaces/IERC6372.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC6372.sol)
pragma solidity >=0.4.16;
interface IERC6372 {
/**
* @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).
*/
function clock() external view returns (uint48);
/**
* @dev Description of the clock
*/
// solhint-disable-next-line func-name-mixedcase
function CLOCK_MODE() external view returns (string memory);
}
// File: @openzeppelin/contracts/interfaces/IERC5805.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC5805.sol)
pragma solidity >=0.8.4;
interface IERC5805 is IERC6372, IVotes {}
// File: @openzeppelin/contracts/utils/structs/Checkpoints.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/structs/Checkpoints.sol)
// This file was procedurally generated from scripts/generate/templates/Checkpoints.js.
pragma solidity ^0.8.20;
/**
* @dev This library defines the `Trace*` struct, for checkpointing values as they change at different points in
* time, and later looking up past values by block number. See {Votes} as an example.
*
* To create a history of checkpoints define a variable type `Checkpoints.Trace*` in your contract, and store a new
* checkpoint for the current transaction block using the {push} function.
*/
library Checkpoints {
/**
* @dev A value was attempted to be inserted on a past checkpoint.
*/
error CheckpointUnorderedInsertion();
struct Trace224 {
Checkpoint224[] _checkpoints;
}
struct Checkpoint224 {
uint32 _key;
uint224 _value;
}
/**
* @dev Pushes a (`key`, `value`) pair into a Trace224 so that it is stored as the checkpoint.
*
* Returns previous value and new value.
*
* IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint32).max` key set will disable the
* library.
*/
function push(
Trace224 storage self,
uint32 key,
uint224 value
) internal returns (uint224 oldValue, uint224 newValue) {
return _insert(self._checkpoints, key, value);
}
/**
* @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
* there is none.
*/
function lowerLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {
uint256 len = self._checkpoints.length;
uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);
return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;
}
/**
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
* if there is none.
*/
function upperLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {
uint256 len = self._checkpoints.length;
uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
/**
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
* if there is none.
*
* NOTE: This is a variant of {upperLookup} that is optimized to find "recent" checkpoint (checkpoints with high
* keys).
*/
function upperLookupRecent(Trace224 storage self, uint32 key) internal view returns (uint224) {
uint256 len = self._checkpoints.length;
uint256 low = 0;
uint256 high = len;
if (len > 5) {
uint256 mid = len - Math.sqrt(len);
if (key < _unsafeAccess(self._checkpoints, mid)._key) {
high = mid;
} else {
low = mid + 1;
}
}
uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
/**
* @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
*/
function latest(Trace224 storage self) internal view returns (uint224) {
uint256 pos = self._checkpoints.length;
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
/**
* @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
* in the most recent checkpoint.
*/
function latestCheckpoint(Trace224 storage self) internal view returns (bool exists, uint32 _key, uint224 _value) {
uint256 pos = self._checkpoints.length;
if (pos == 0) {
return (false, 0, 0);
} else {
Checkpoint224 storage ckpt = _unsafeAccess(self._checkpoints, pos - 1);
return (true, ckpt._key, ckpt._value);
}
}
/**
* @dev Returns the number of checkpoints.
*/
function length(Trace224 storage self) internal view returns (uint256) {
return self._checkpoints.length;
}
/**
* @dev Returns checkpoint at given position.
*/
function at(Trace224 storage self, uint32 pos) internal view returns (Checkpoint224 memory) {
return self._checkpoints[pos];
}
/**
* @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,
* or by updating the last one.
*/
function _insert(
Checkpoint224[] storage self,
uint32 key,
uint224 value
) private returns (uint224 oldValue, uint224 newValue) {
uint256 pos = self.length;
if (pos > 0) {
Checkpoint224 storage last = _unsafeAccess(self, pos - 1);
uint32 lastKey = last._key;
uint224 lastValue = last._value;
// Checkpoint keys must be non-decreasing.
if (lastKey > key) {
revert CheckpointUnorderedInsertion();
}
// Update or push new checkpoint
if (lastKey == key) {
last._value = value;
} else {
self.push(Checkpoint224({_key: key, _value: value}));
}
return (lastValue, value);
} else {
self.push(Checkpoint224({_key: key, _value: value}));
return (0, value);
}
}
/**
* @dev Return the index of the first (oldest) checkpoint with key strictly bigger than the search key, or `high`
* if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive
* `high`.
*
* WARNING: `high` should not be greater than the array's length.
*/
function _upperBinaryLookup(
Checkpoint224[] storage self,
uint32 key,
uint256 low,
uint256 high
) private view returns (uint256) {
while (low < high) {
uint256 mid = Math.average(low, high);
if (_unsafeAccess(self, mid)._key > key) {
high = mid;
} else {
low = mid + 1;
}
}
return high;
}
/**
* @dev Return the index of the first (oldest) checkpoint with key greater or equal than the search key, or `high`
* if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive
* `high`.
*
* WARNING: `high` should not be greater than the array's length.
*/
function _lowerBinaryLookup(
Checkpoint224[] storage self,
uint32 key,
uint256 low,
uint256 high
) private view returns (uint256) {
while (low < high) {
uint256 mid = Math.average(low, high);
if (_unsafeAccess(self, mid)._key < key) {
low = mid + 1;
} else {
high = mid;
}
}
return high;
}
/**
* @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.
*/
function _unsafeAccess(
Checkpoint224[] storage self,
uint256 pos
) private pure returns (Checkpoint224 storage result) {
assembly {
mstore(0, self.slot)
result.slot := add(keccak256(0, 0x20), pos)
}
}
struct Trace208 {
Checkpoint208[] _checkpoints;
}
struct Checkpoint208 {
uint48 _key;
uint208 _value;
}
/**
* @dev Pushes a (`key`, `value`) pair into a Trace208 so that it is stored as the checkpoint.
*
* Returns previous value and new value.
*
* IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint48).max` key set will disable the
* library.
*/
function push(
Trace208 storage self,
uint48 key,
uint208 value
) internal returns (uint208 oldValue, uint208 newValue) {
return _insert(self._checkpoints, key, value);
}
/**
* @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
* there is none.
*/
function lowerLookup(Trace208 storage self, uint48 key) internal view returns (uint208) {
uint256 len = self._checkpoints.length;
uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);
return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;
}
/**
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
* if there is none.
*/
function upperLookup(Trace208 storage self, uint48 key) internal view returns (uint208) {
uint256 len = self._checkpoints.length;
uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
/**
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
* if there is none.
*
* NOTE: This is a variant of {upperLookup} that is optimized to find "recent" checkpoint (checkpoints with high
* keys).
*/
function upperLookupRecent(Trace208 storage self, uint48 key) internal view returns (uint208) {
uint256 len = self._checkpoints.length;
uint256 low = 0;
uint256 high = len;
if (len > 5) {
uint256 mid = len - Math.sqrt(len);
if (key < _unsafeAccess(self._checkpoints, mid)._key) {
high = mid;
} else {
low = mid + 1;
}
}
uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
/**
* @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
*/
function latest(Trace208 storage self) internal view returns (uint208) {
uint256 pos = self._checkpoints.length;
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
/**
* @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
* in the most recent checkpoint.
*/
function latestCheckpoint(Trace208 storage self) internal view returns (bool exists, uint48 _key, uint208 _value) {
uint256 pos = self._checkpoints.length;
if (pos == 0) {
return (false, 0, 0);
} else {
Checkpoint208 storage ckpt = _unsafeAccess(self._checkpoints, pos - 1);
return (true, ckpt._key, ckpt._value);
}
}
/**
* @dev Returns the number of checkpoints.
*/
function length(Trace208 storage self) internal view returns (uint256) {
return self._checkpoints.length;
}
/**
* @dev Returns checkpoint at given position.
*/
function at(Trace208 storage self, uint32 pos) internal view returns (Checkpoint208 memory) {
return self._checkpoints[pos];
}
/**
* @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,
* or by updating the last one.
*/
function _insert(
Checkpoint208[] storage self,
uint48 key,
uint208 value
) private returns (uint208 oldValue, uint208 newValue) {
uint256 pos = self.length;
if (pos > 0) {
Checkpoint208 storage last = _unsafeAccess(self, pos - 1);
uint48 lastKey = last._key;
uint208 lastValue = last._value;
// Checkpoint keys must be non-decreasing.
if (lastKey > key) {
revert CheckpointUnorderedInsertion();
}
// Update or push new checkpoint
if (lastKey == key) {
last._value = value;
} else {
self.push(Checkpoint208({_key: key, _value: value}));
}
return (lastValue, value);
} else {
self.push(Checkpoint208({_key: key, _value: value}));
return (0, value);
}
}
/**
* @dev Return the index of the first (oldest) checkpoint with key strictly bigger than the search key, or `high`
* if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive
* `high`.
*
* WARNING: `high` should not be greater than the array's length.
*/
function _upperBinaryLookup(
Checkpoint208[] storage self,
uint48 key,
uint256 low,
uint256 high
) private view returns (uint256) {
while (low < high) {
uint256 mid = Math.average(low, high);
if (_unsafeAccess(self, mid)._key > key) {
high = mid;
} else {
low = mid + 1;
}
}
return high;
}
/**
* @dev Return the index of the first (oldest) checkpoint with key greater or equal than the search key, or `high`
* if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive
* `high`.
*
* WARNING: `high` should not be greater than the array's length.
*/
function _lowerBinaryLookup(
Checkpoint208[] storage self,
uint48 key,
uint256 low,
uint256 high
) private view returns (uint256) {
while (low < high) {
uint256 mid = Math.average(low, high);
if (_unsafeAccess(self, mid)._key < key) {
low = mid + 1;
} else {
high = mid;
}
}
return high;
}
/**
* @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.
*/
function _unsafeAccess(
Checkpoint208[] storage self,
uint256 pos
) private pure returns (Checkpoint208 storage result) {
assembly {
mstore(0, self.slot)
result.slot := add(keccak256(0, 0x20), pos)
}
}
struct Trace160 {
Checkpoint160[] _checkpoints;
}
struct Checkpoint160 {
uint96 _key;
uint160 _value;
}
/**
* @dev Pushes a (`key`, `value`) pair into a Trace160 so that it is stored as the checkpoint.
*
* Returns previous value and new value.
*
* IMPORTANT: Never accept `key` as a user input, since an arbitrary `type(uint96).max` key set will disable the
* library.
*/
function push(
Trace160 storage self,
uint96 key,
uint160 value
) internal returns (uint160 oldValue, uint160 newValue) {
return _insert(self._checkpoints, key, value);
}
/**
* @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if
* there is none.
*/
function lowerLookup(Trace160 storage self, uint96 key) internal view returns (uint160) {
uint256 len = self._checkpoints.length;
uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);
return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;
}
/**
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
* if there is none.
*/
function upperLookup(Trace160 storage self, uint96 key) internal view returns (uint160) {
uint256 len = self._checkpoints.length;
uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
/**
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key, or zero
* if there is none.
*
* NOTE: This is a variant of {upperLookup} that is optimized to find "recent" checkpoint (checkpoints with high
* keys).
*/
function upperLookupRecent(Trace160 storage self, uint96 key) internal view returns (uint160) {
uint256 len = self._checkpoints.length;
uint256 low = 0;
uint256 high = len;
if (len > 5) {
uint256 mid = len - Math.sqrt(len);
if (key < _unsafeAccess(self._checkpoints, mid)._key) {
high = mid;
} else {
low = mid + 1;
}
}
uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
/**
* @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.
*/
function latest(Trace160 storage self) internal view returns (uint160) {
uint256 pos = self._checkpoints.length;
return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;
}
/**
* @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value
* in the most recent checkpoint.
*/
function latestCheckpoint(Trace160 storage self) internal view returns (bool exists, uint96 _key, uint160 _value) {
uint256 pos = self._checkpoints.length;
if (pos == 0) {
return (false, 0, 0);
} else {
Checkpoint160 storage ckpt = _unsafeAccess(self._checkpoints, pos - 1);
return (true, ckpt._key, ckpt._value);
}
}
/**
* @dev Returns the number of checkpoints.
*/
function length(Trace160 storage self) internal view returns (uint256) {
return self._checkpoints.length;
}
/**
* @dev Returns checkpoint at given position.
*/
function at(Trace160 storage self, uint32 pos) internal view returns (Checkpoint160 memory) {
return self._checkpoints[pos];
}
/**
* @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,
* or by updating the last one.
*/
function _insert(
Checkpoint160[] storage self,
uint96 key,
uint160 value
) private returns (uint160 oldValue, uint160 newValue) {
uint256 pos = self.length;
if (pos > 0) {
Checkpoint160 storage last = _unsafeAccess(self, pos - 1);
uint96 lastKey = last._key;
uint160 lastValue = last._value;
// Checkpoint keys must be non-decreasing.
if (lastKey > key) {
revert CheckpointUnorderedInsertion();
}
// Update or push new checkpoint
if (lastKey == key) {
last._value = value;
} else {
self.push(Checkpoint160({_key: key, _value: value}));
}
return (lastValue, value);
} else {
self.push(Checkpoint160({_key: key, _value: value}));
return (0, value);
}
}
/**
* @dev Return the index of the first (oldest) checkpoint with key strictly bigger than the search key, or `high`
* if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive
* `high`.
*
* WARNING: `high` should not be greater than the array's length.
*/
function _upperBinaryLookup(
Checkpoint160[] storage self,
uint96 key,
uint256 low,
uint256 high
) private view returns (uint256) {
while (low < high) {
uint256 mid = Math.average(low, high);
if (_unsafeAccess(self, mid)._key > key) {
high = mid;
} else {
low = mid + 1;
}
}
return high;
}
/**
* @dev Return the index of the first (oldest) checkpoint with key greater or equal than the search key, or `high`
* if there is none. `low` and `high` define a section where to do the search, with inclusive `low` and exclusive
* `high`.
*
* WARNING: `high` should not be greater than the array's length.
*/
function _lowerBinaryLookup(
Checkpoint160[] storage self,
uint96 key,
uint256 low,
uint256 high
) private view returns (uint256) {
while (low < high) {
uint256 mid = Math.average(low, high);
if (_unsafeAccess(self, mid)._key < key) {
low = mid + 1;
} else {
high = mid;
}
}
return high;
}
/**
* @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.
*/
function _unsafeAccess(
Checkpoint160[] storage self,
uint256 pos
) private pure returns (Checkpoint160 storage result) {
assembly {
mstore(0, self.slot)
result.slot := add(keccak256(0, 0x20), pos)
}
}
}
// File: @openzeppelin/contracts/utils/types/Time.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/types/Time.sol)
pragma solidity ^0.8.20;
/**
* @dev This library provides helpers for manipulating time-related objects.
*
* It uses the following types:
* - `uint48` for timepoints
* - `uint32` for durations
*
* While the library doesn't provide specific types for timepoints and duration, it does provide:
* - a `Delay` type to represent duration that can be programmed to change value automatically at a given point
* - additional helper functions
*/
library Time {
using Time for *;
/**
* @dev Get the block timestamp as a Timepoint.
*/
function timestamp() internal view returns (uint48) {
return SafeCast.toUint48(block.timestamp);
}
/**
* @dev Get the block number as a Timepoint.
*/
function blockNumber() internal view returns (uint48) {
return SafeCast.toUint48(block.number);
}
// ==================================================== Delay =====================================================
/**
* @dev A `Delay` is a uint32 duration that can be programmed to change value automatically at a given point in the
* future. The "effect" timepoint describes when the transitions happens from the "old" value to the "new" value.
* This allows updating the delay applied to some operation while keeping some guarantees.
*
* In particular, the {update} function guarantees that if the delay is reduced, the old delay still applies for
* some time. For example if the delay is currently 7 days to do an upgrade, the admin should not be able to set
* the delay to 0 and upgrade immediately. If the admin wants to reduce the delay, the old delay (7 days) should
* still apply for some time.
*
*
* The `Delay` type is 112 bits long, and packs the following:
*
* ```
* | [uint48]: effect date (timepoint)
* | | [uint32]: value before (duration)
* ↓ ↓ ↓ [uint32]: value after (duration)
* 0xAAAAAAAAAAAABBBBBBBBCCCCCCCC
* ```
*
* NOTE: The {get} and {withUpdate} functions operate using timestamps. Block number based delays are not currently
* supported.
*/
type Delay is uint112;
/**
* @dev Wrap a duration into a Delay to add the one-step "update in the future" feature
*/
function toDelay(uint32 duration) internal pure returns (Delay) {
return Delay.wrap(duration);
}
/**
* @dev Get the value at a given timepoint plus the pending value and effect timepoint if there is a scheduled
* change after this timepoint. If the effect timepoint is 0, then the pending value should not be considered.
*/
function _getFullAt(
Delay self,
uint48 timepoint
) private pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {
(valueBefore, valueAfter, effect) = self.unpack();
return effect <= timepoint ? (valueAfter, 0, 0) : (valueBefore, valueAfter, effect);
}
/**
* @dev Get the current value plus the pending value and effect timepoint if there is a scheduled change. If the
* effect timepoint is 0, then the pending value should not be considered.
*/
function getFull(Delay self) internal view returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {
return _getFullAt(self, timestamp());
}
/**
* @dev Get the current value.
*/
function get(Delay self) internal view returns (uint32) {
(uint32 delay, , ) = self.getFull();
return delay;
}
/**
* @dev Update a Delay object so that it takes a new duration after a timepoint that is automatically computed to
* enforce the old delay at the moment of the update. Returns the updated Delay object and the timestamp when the
* new delay becomes effective.
*/
function withUpdate(
Delay self,
uint32 newValue,
uint32 minSetback
) internal view returns (Delay updatedDelay, uint48 effect) {
uint32 value = self.get();
uint32 setback = uint32(Math.max(minSetback, value > newValue ? value - newValue : 0));
effect = timestamp() + setback;
return (pack(value, newValue, effect), effect);
}
/**
* @dev Split a delay into its components: valueBefore, valueAfter and effect (transition timepoint).
*/
function unpack(Delay self) internal pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {
uint112 raw = Delay.unwrap(self);
valueAfter = uint32(raw);
valueBefore = uint32(raw >> 32);
effect = uint48(raw >> 64);
return (valueBefore, valueAfter, effect);
}
/**
* @dev pack the components into a Delay object.
*/
function pack(uint32 valueBefore, uint32 valueAfter, uint48 effect) internal pure returns (Delay) {
return Delay.wrap((uint112(effect) << 64) | (uint112(valueBefore) << 32) | uint112(valueAfter));
}
}
// File: @openzeppelin/contracts/governance/utils/Votes.sol
// OpenZeppelin Contracts (last updated v5.2.0) (governance/utils/Votes.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base abstract contract that tracks voting units, which are a measure of voting power that can be
* transferred, and provides a system of vote delegation, where an account can delegate its voting units to a sort of
* "representative" that will pool delegated voting units from different accounts and can then use it to vote in
* decisions. In fact, voting units _must_ be delegated in order to count as actual votes, and an account has to
* delegate those votes to itself if it wishes to participate in decisions and does not have a trusted representative.
*
* This contract is often combined with a token contract such that voting units correspond to token units. For an
* example, see {ERC721Votes}.
*
* The full history of delegate votes is tracked on-chain so that governance protocols can consider votes as distributed
* at a particular block number to protect against flash loans and double voting. The opt-in delegate system makes the
* cost of this history tracking optional.
*
* When using this module the derived contract must implement {_getVotingUnits} (for example, make it return
* {ERC721-balanceOf}), and can use {_transferVotingUnits} to track a change in the distribution of those units (in the
* previous example, it would be included in {ERC721-_update}).
*/
abstract contract Votes is Context, EIP712, Nonces, IERC5805 {
using Checkpoints for Checkpoints.Trace208;
bytes32 private constant DELEGATION_TYPEHASH =
keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
mapping(address account => address) private _delegatee;
mapping(address delegatee => Checkpoints.Trace208) private _delegateCheckpoints;
Checkpoints.Trace208 private _totalCheckpoints;
/**
* @dev The clock was incorrectly modified.
*/
error ERC6372InconsistentClock();
/**
* @dev Lookup to future votes is not available.
*/
error ERC5805FutureLookup(uint256 timepoint, uint48 clock);
/**
* @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based
* checkpoints (and voting), in which case {CLOCK_MODE} should be overridden as well to match.
*/
function clock() public view virtual returns (uint48) {
return Time.blockNumber();
}
/**
* @dev Machine-readable description of the clock as specified in ERC-6372.
*/
// solhint-disable-next-line func-name-mixedcase
function CLOCK_MODE() public view virtual returns (string memory) {
// Check that the clock was not modified
if (clock() != Time.blockNumber()) {
revert ERC6372InconsistentClock();
}
return "mode=blocknumber&from=default";
}
/**
* @dev Validate that a timepoint is in the past, and return it as a uint48.
*/
function _validateTimepoint(uint256 timepoint) internal view returns (uint48) {
uint48 currentTimepoint = clock();
if (timepoint >= currentTimepoint) revert ERC5805FutureLookup(timepoint, currentTimepoint);
return SafeCast.toUint48(timepoint);
}
/**
* @dev Returns the current amount of votes that `account` has.
*/
function getVotes(address account) public view virtual returns (uint256) {
return _delegateCheckpoints[account].latest();
}
/**
* @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is
* configured to use block numbers, this will return the value at the end of the corresponding block.
*
* Requirements:
*
* - `timepoint` must be in the past. If operating using block numbers, the block must be already mined.
*/
function getPastVotes(address account, uint256 timepoint) public view virtual returns (uint256) {
return _delegateCheckpoints[account].upperLookupRecent(_validateTimepoint(timepoint));
}
/**
* @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is
* configured to use block numbers, this will return the value at the end of the corresponding block.
*
* 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.
*
* Requirements:
*
* - `timepoint` must be in the past. If operating using block numbers, the block must be already mined.
*/
function getPastTotalSupply(uint256 timepoint) public view virtual returns (uint256) {
return _totalCheckpoints.upperLookupRecent(_validateTimepoint(timepoint));
}
/**
* @dev Returns the current total supply of votes.
*/
function _getTotalSupply() internal view virtual returns (uint256) {
return _totalCheckpoints.latest();
}
/**
* @dev Returns the delegate that `account` has chosen.
*/
function delegates(address account) public view virtual returns (address) {
return _delegatee[account];
}
/**
* @dev Delegates votes from the sender to `delegatee`.
*/
function delegate(address delegatee) public virtual {
address account = _msgSender();
_delegate(account, delegatee);
}
/**
* @dev Delegates votes from signer to `delegatee`.
*/
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
if (block.timestamp > expiry) {
revert VotesExpiredSignature(expiry);
}
address signer = ECDSA.recover(
_hashTypedDataV4(keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry))),
v,
r,
s
);
_useCheckedNonce(signer, nonce);
_delegate(signer, delegatee);
}
/**
* @dev Delegate all of `account`'s voting units to `delegatee`.
*
* Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}.
*/
function _delegate(address account, address delegatee) internal virtual {
address oldDelegate = delegates(account);
_delegatee[account] = delegatee;
emit DelegateChanged(account, oldDelegate, delegatee);
_moveDelegateVotes(oldDelegate, delegatee, _getVotingUnits(account));
}
/**
* @dev Transfers, mints, or burns voting units. To register a mint, `from` should be zero. To register a burn, `to`
* should be zero. Total supply of voting units will be adjusted with mints and burns.
*/
function _transferVotingUnits(address from, address to, uint256 amount) internal virtual {
if (from == address(0)) {
_push(_totalCheckpoints, _add, SafeCast.toUint208(amount));
}
if (to == address(0)) {
_push(_totalCheckpoints, _subtract, SafeCast.toUint208(amount));
}
_moveDelegateVotes(delegates(from), delegates(to), amount);
}
/**
* @dev Moves delegated votes from one delegate to another.
*/
function _moveDelegateVotes(address from, address to, uint256 amount) internal virtual {
if (from != to && amount > 0) {
if (from != address(0)) {
(uint256 oldValue, uint256 newValue) = _push(
_delegateCheckpoints[from],
_subtract,
SafeCast.toUint208(amount)
);
emit DelegateVotesChanged(from, oldValue, newValue);
}
if (to != address(0)) {
(uint256 oldValue, uint256 newValue) = _push(
_delegateCheckpoints[to],
_add,
SafeCast.toUint208(amount)
);
emit DelegateVotesChanged(to, oldValue, newValue);
}
}
}
/**
* @dev Get number of checkpoints for `account`.
*/
function _numCheckpoints(address account) internal view virtual returns (uint32) {
return SafeCast.toUint32(_delegateCheckpoints[account].length());
}
/**
* @dev Get the `pos`-th checkpoint for `account`.
*/
function _checkpoints(
address account,
uint32 pos
) internal view virtual returns (Checkpoints.Checkpoint208 memory) {
return _delegateCheckpoints[account].at(pos);
}
function _push(
Checkpoints.Trace208 storage store,
function(uint208, uint208) view returns (uint208) op,
uint208 delta
) private returns (uint208 oldValue, uint208 newValue) {
return store.push(clock(), op(store.latest(), delta));
}
function _add(uint208 a, uint208 b) private pure returns (uint208) {
return a + b;
}
function _subtract(uint208 a, uint208 b) private pure returns (uint208) {
return a - b;
}
/**
* @dev Must return the voting units held by an account.
*/
function _getVotingUnits(address) internal view virtual returns (uint256);
}
// File: @openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/ERC20Votes.sol)
pragma solidity ^0.8.20;
/**
* @dev Extension of ERC-20 to support Compound-like voting and delegation. This version is more generic than Compound's,
* and supports token supply up to 2^208^ - 1, while COMP is limited to 2^96^ - 1.
*
* NOTE: This contract does not provide interface compatibility with Compound's COMP token.
*
* This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either
* by calling the {Votes-delegate} function directly, or by providing a signature to be used with {Votes-delegateBySig}. Voting
* power can be queried through the public accessors {Votes-getVotes} and {Votes-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.
*/
abstract contract ERC20Votes is ERC20, Votes {
/**
* @dev Total supply cap has been exceeded, introducing a risk of votes overflowing.
*/
error ERC20ExceededSafeSupply(uint256 increasedSupply, uint256 cap);
/**
* @dev Maximum token supply. Defaults to `type(uint208).max` (2^208^ - 1).
*
* This maximum is enforced in {_update}. It limits the total supply of the token, which is otherwise a uint256,
* so that checkpoints can be stored in the Trace208 structure used by {Votes}. Increasing this value will not
* remove the underlying limitation, and will cause {_update} to fail because of a math overflow in
* {Votes-_transferVotingUnits}. An override could be used to further restrict the total supply (to a lower value) if
* additional logic requires it. When resolving override conflicts on this function, the minimum should be
* returned.
*/
function _maxSupply() internal view virtual returns (uint256) {
return type(uint208).max;
}
/**
* @dev Move voting power when tokens are transferred.
*
* Emits a {IVotes-DelegateVotesChanged} event.
*/
function _update(address from, address to, uint256 value) internal virtual override {
super._update(from, to, value);
if (from == address(0)) {
uint256 supply = totalSupply();
uint256 cap = _maxSupply();
if (supply > cap) {
revert ERC20ExceededSafeSupply(supply, cap);
}
}
_transferVotingUnits(from, to, value);
}
/**
* @dev Returns the voting units of an `account`.
*
* WARNING: Overriding this function may compromise the internal vote accounting.
* `ERC20Votes` assumes tokens map to voting units 1:1 and this is not easy to change.
*/
function _getVotingUnits(address account) internal view virtual override returns (uint256) {
return balanceOf(account);
}
/**
* @dev Get number of checkpoints for `account`.
*/
function numCheckpoints(address account) public view virtual returns (uint32) {
return _numCheckpoints(account);
}
/**
* @dev Get the `pos`-th checkpoint for `account`.
*/
function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoints.Checkpoint208 memory) {
return _checkpoints(account, pos);
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
/**
* @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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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/access/Ownable2Step.sol
// OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This extension of the {Ownable} contract includes a two-step mechanism to transfer
* ownership, where the new owner must call {acceptOwnership} in order to replace the
* old one. This can help prevent common mistakes, such as transfers of ownership to
* incorrect accounts, or to contracts that are unable to interact with the
* permission system.
*
* The initial owner is specified at deployment time in the constructor for `Ownable`. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*
* Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
}
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
// File: @openzeppelin/contracts/interfaces/IERC20.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/interfaces/IERC165.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
// File: @openzeppelin/contracts/interfaces/IERC1363.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
// File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}
// File: TCToken.sol
pragma solidity ^0.8.20;
/**
* @title TCT Token with Secure DAO Governance
* @notice Implements best practices for DAO voting with enhanced security
* @dev Optimized version with improved vote locking and replay protection
*/
contract TCT is
ERC20,
ERC20Burnable,
ERC20Permit,
ERC20Votes,
Ownable2Step,
ReentrancyGuard
{
using SafeERC20 for IERC20;
// ============ Constants ============
uint256 public constant INITIAL_SUPPLY = 200_000_000;
uint256 public constant MAX_SUPPLY = 1_000_000_000;
// Governance Configuration
uint256 public constant VOTING_DELAY = 1 days;
uint256 public constant VOTING_PERIOD = 3 days;
uint256 public constant EXECUTION_DELAY = 2 days;
uint256 public constant GRACE_PERIOD = 14 days;
uint256 public constant MIN_QUORUM_BPS = 400; // 4% quorum
uint256 public constant REQUIRED_MAJORITY_BPS = 5100; // 51% majority
uint256 public constant PROPOSAL_THRESHOLD = 100_000;
// ============ Custom Errors ============
error InvalidProposal();
error ProposalNotActive();
error ProposalNotSucceeded();
error ProposalNotReady();
error ProposalExpired();
error AlreadyVoted();
error InsufficientVotingPower();
error InvalidInput();
error Unauthorized();
error ExceedsMaxSupply();
error TokensLocked();
error SignatureExpired();
error ContractPaused();
error DuplicateProposal();
error RecipientNotOwner();
// ============ Proposal Structure ============
struct ProposalCore {
// Slot 1
uint64 voteStart;
uint64 voteEnd;
uint64 executeAfter;
uint64 proposalId;
// Slot 2
uint128 forVotes;
uint128 againstVotes;
// Slot 3
uint128 amount;
bool executed;
bool cancelled;
uint112 snapshotBlock;
// Slot 4+
address proposer;
address recipient;
}
struct ProposalDetails {
string description;
mapping(address => bool) hasVoted;
}
// ============ State Variables ============
uint256 private _proposalCount;
uint256 private _totalBurned;
bool public paused;
mapping(uint256 => ProposalCore) public proposals;
mapping(uint256 => ProposalDetails) private _proposalDetails;
// Improved vote locking
mapping(address => uint256) public lockedUntil;
mapping(address => uint256) public activeProposal;
// Signature replay protection
mapping(address => uint256) public votingNonces;
// Duplicate proposal prevention
mapping(bytes32 => bool) private _proposalExists;
// ============ Events ============
event ProposalCreated(
uint256 indexed proposalId,
address indexed proposer,
address indexed recipient,
uint256 amount,
uint256 voteStart,
uint256 voteEnd,
string description
);
event VoteCast(
address indexed voter,
uint256 indexed proposalId,
bool support,
uint256 weight
);
event ProposalExecuted(uint256 indexed proposalId);
event ProposalCancelled(uint256 indexed proposalId);
event TokensBurned(address indexed from, uint256 amount);
event Paused(address account);
event Unpaused(address account);
// ============ Modifiers ============
modifier whenNotPaused() {
if (paused) revert ContractPaused();
_;
}
modifier validProposal(uint256 proposalId) {
if (proposals[proposalId].proposalId == 0) revert InvalidProposal();
_;
}
// ============ Constructor ============
constructor(
string memory name,
string memory symbol
)
ERC20(name, symbol)
ERC20Permit(name)
Ownable(msg.sender)
{
_mint(msg.sender, INITIAL_SUPPLY);
_delegate(msg.sender, msg.sender);
}
// ============ Core Overrides ============
function decimals() public pure override returns (uint8) {
return 0;
}
function _update(
address from,
address to,
uint256 amount
) internal override(ERC20, ERC20Votes) {
// Check vote lock
if (from != address(0) && lockedUntil[from] > block.timestamp) {
revert TokensLocked();
}
super._update(from, to, amount);
}
// ============ Proposal Functions ============
function propose(
address recipient,
uint256 amount,
string calldata description
) external whenNotPaused returns (uint256) {
// Validations
if (recipient == address(0)) revert InvalidInput();
if (recipient != owner()) revert RecipientNotOwner();
if (amount == 0 || amount > MAX_SUPPLY - totalSupply()) revert ExceedsMaxSupply();
if (bytes(description).length == 0 || bytes(description).length > 1000) revert InvalidInput();
// Check proposer voting power
uint256 proposerVotes = getPastVotes(msg.sender, block.number - 1);
if (proposerVotes < PROPOSAL_THRESHOLD) revert InsufficientVotingPower();
// Prevent duplicate proposals
bytes32 proposalHash = keccak256(abi.encode(recipient, amount, keccak256(bytes(description))));
if (_proposalExists[proposalHash]) revert DuplicateProposal();
_proposalExists[proposalHash] = true;
uint256 proposalId = ++_proposalCount;
// Create proposal
ProposalCore storage proposal = proposals[proposalId];
proposal.proposalId = uint64(proposalId);
proposal.voteStart = uint64(block.timestamp + VOTING_DELAY);
proposal.voteEnd = uint64(block.timestamp + VOTING_DELAY + VOTING_PERIOD);
proposal.executeAfter = uint64(block.timestamp + VOTING_DELAY + VOTING_PERIOD + EXECUTION_DELAY);
proposal.snapshotBlock = uint112(block.number);
proposal.amount = uint128(amount);
proposal.proposer = msg.sender;
proposal.recipient = recipient;
_proposalDetails[proposalId].description = description;
emit ProposalCreated(
proposalId,
msg.sender,
recipient,
amount,
proposal.voteStart,
proposal.voteEnd,
description
);
return proposalId;
}
function castVote(uint256 proposalId, bool support) external {
_castVote(proposalId, msg.sender, support);
}
function castVoteBySig(
uint256 proposalId,
bool support,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
if (block.timestamp > deadline) revert SignatureExpired();
address voter = msg.sender;
uint256 nonce = votingNonces[voter]++;
bytes32 structHash = keccak256(
abi.encode(
keccak256("Vote(uint256 proposalId,bool support,uint256 nonce,uint256 deadline,uint256 chainId)"),
proposalId,
support,
nonce,
deadline,
block.chainid
)
);
bytes32 hash = _hashTypedDataV4(structHash);
address recoveredVoter = ecrecover(hash, v, r, s);
if (recoveredVoter == address(0) || recoveredVoter != voter) revert InvalidInput();
_castVote(proposalId, recoveredVoter, support);
}
function _castVote(
uint256 proposalId,
address voter,
bool support
) private nonReentrant validProposal(proposalId) {
// Check if tokens are locked for another proposal
if (lockedUntil[voter] > block.timestamp && activeProposal[voter] != proposalId) {
revert TokensLocked();
}
ProposalCore storage proposal = proposals[proposalId];
if (voter == owner()) {
revert Unauthorized(); // или можно создать новую ошибку: revert OwnerCannotVote();
}
// Check voting period
if (block.timestamp < proposal.voteStart || block.timestamp > proposal.voteEnd) {
revert ProposalNotActive();
}
// Check if already voted
if (_proposalDetails[proposalId].hasVoted[voter]) revert AlreadyVoted();
// Get voting power
uint256 votes = getPastVotes(voter, proposal.snapshotBlock);
if (votes == 0) revert InsufficientVotingPower();
// Record vote
_proposalDetails[proposalId].hasVoted[voter] = true;
if (support) {
proposal.forVotes += uint128(votes);
} else {
proposal.againstVotes += uint128(votes);
}
// Lock tokens for this proposal only
lockedUntil[voter] = proposal.voteEnd;
activeProposal[voter] = proposalId;
emit VoteCast(voter, proposalId, support, votes);
}
function execute(uint256 proposalId)
external
whenNotPaused
nonReentrant
validProposal(proposalId)
{
ProposalCore storage proposal = proposals[proposalId];
if (proposal.executed) revert InvalidProposal();
if (proposal.cancelled) revert InvalidProposal();
if (block.timestamp < proposal.executeAfter) revert ProposalNotReady();
if (block.timestamp > proposal.executeAfter + GRACE_PERIOD) revert ProposalExpired();
if (!_proposalSucceeded(proposalId)) revert ProposalNotSucceeded();
proposal.executed = true;
_mint(proposal.recipient, proposal.amount);
emit ProposalExecuted(proposalId);
}
function cancel(uint256 proposalId) external validProposal(proposalId) {
ProposalCore storage proposal = proposals[proposalId];
if (proposal.executed || proposal.cancelled) revert InvalidProposal();
if (msg.sender != proposal.proposer && msg.sender != owner()) revert Unauthorized();
proposal.cancelled = true;
emit ProposalCancelled(proposalId);
}
// ============ View Functions ============
function _proposalSucceeded(uint256 proposalId) private view returns (bool) {
ProposalCore storage proposal = proposals[proposalId];
uint256 quorum = (getPastTotalSupply(proposal.snapshotBlock) * MIN_QUORUM_BPS) / 10000;
uint256 totalVotes = proposal.forVotes + proposal.againstVotes;
if (totalVotes < quorum) return false;
uint256 majorityNeeded = (totalVotes * REQUIRED_MAJORITY_BPS) / 10000;
return proposal.forVotes > majorityNeeded;
}
function state(uint256 proposalId) external view returns (ProposalState) {
if (proposals[proposalId].proposalId == 0) return ProposalState.Invalid;
ProposalCore storage proposal = proposals[proposalId];
if (proposal.cancelled) return ProposalState.Cancelled;
if (proposal.executed) return ProposalState.Executed;
if (block.timestamp < proposal.voteStart) return ProposalState.Pending;
if (block.timestamp <= proposal.voteEnd) return ProposalState.Active;
bool succeeded = _proposalSucceeded(proposalId);
if (!succeeded) return ProposalState.Defeated;
if (block.timestamp < proposal.executeAfter) return ProposalState.Queued;
if (block.timestamp <= proposal.executeAfter + GRACE_PERIOD) return ProposalState.Ready;
return ProposalState.Expired;
}
function hasVoted(uint256 proposalId, address voter) external view returns (bool) {
return _proposalDetails[proposalId].hasVoted[voter];
}
function proposalDescription(uint256 proposalId) external view returns (string memory) {
return _proposalDetails[proposalId].description;
}
function totalBurned() external view returns (uint256) {
return _totalBurned;
}
// ============ Admin Functions ============
function pause() external onlyOwner {
paused = true;
emit Paused(msg.sender);
}
function unpause() external onlyOwner {
paused = false;
emit Unpaused(msg.sender);
}
function recoverTokens(
address tokenAddress,
address to,
uint256 amount
) external onlyOwner nonReentrant {
if (tokenAddress == address(this)) revert InvalidInput();
IERC20(tokenAddress).safeTransfer(to, amount);
}
// ============ Burn Functions ============
function burn(uint256 amount) public override {
_totalBurned += amount;
emit TokensBurned(msg.sender, amount);
super.burn(amount);
}
function burnFrom(address account, uint256 amount) public override {
_totalBurned += amount;
emit TokensBurned(account, amount);
super.burnFrom(account, amount);
}
// ============ Required Overrides ============
function nonces(address owner)
public
view
override(ERC20Permit, Nonces)
returns (uint256)
{
return super.nonces(owner);
}
}
// ============ Enums ============
enum ProposalState {
Invalid,
Pending,
Active,
Cancelled,
Defeated,
Queued,
Ready,
Expired,
Executed
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyVoted","type":"error"},{"inputs":[],"name":"CheckpointUnorderedInsertion","type":"error"},{"inputs":[],"name":"ContractPaused","type":"error"},{"inputs":[],"name":"DuplicateProposal","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[{"internalType":"uint256","name":"increasedSupply","type":"uint256"},{"internalType":"uint256","name":"cap","type":"uint256"}],"name":"ERC20ExceededSafeSupply","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ERC2612ExpiredSignature","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC2612InvalidSigner","type":"error"},{"inputs":[{"internalType":"uint256","name":"timepoint","type":"uint256"},{"internalType":"uint48","name":"clock","type":"uint48"}],"name":"ERC5805FutureLookup","type":"error"},{"inputs":[],"name":"ERC6372InconsistentClock","type":"error"},{"inputs":[],"name":"ExceedsMaxSupply","type":"error"},{"inputs":[],"name":"InsufficientVotingPower","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"currentNonce","type":"uint256"}],"name":"InvalidAccountNonce","type":"error"},{"inputs":[],"name":"InvalidInput","type":"error"},{"inputs":[],"name":"InvalidProposal","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ProposalExpired","type":"error"},{"inputs":[],"name":"ProposalNotActive","type":"error"},{"inputs":[],"name":"ProposalNotReady","type":"error"},{"inputs":[],"name":"ProposalNotSucceeded","type":"error"},{"inputs":[],"name":"RecipientNotOwner","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SignatureExpired","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[],"name":"TokensLocked","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[{"internalType":"uint256","name":"expiry","type":"uint256"}],"name":"VotesExpiredSignature","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"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":"previousVotes","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newVotes","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"ProposalCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":true,"internalType":"address","name":"proposer","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"voteStart","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"voteEnd","type":"uint256"},{"indexed":false,"internalType":"string","name":"description","type":"string"}],"name":"ProposalCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"ProposalExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"support","type":"bool"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"VoteCast","type":"event"},{"inputs":[],"name":"CLOCK_MODE","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXECUTION_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GRACE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INITIAL_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_QUORUM_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROPOSAL_THRESHOLD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REQUIRED_MAJORITY_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VOTING_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VOTING_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"activeProposal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"value","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":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"support","type":"bool"}],"name":"castVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"support","type":"bool"},{"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":"castVoteBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint32","name":"pos","type":"uint32"}],"name":"checkpoints","outputs":[{"components":[{"internalType":"uint48","name":"_key","type":"uint48"},{"internalType":"uint208","name":"_value","type":"uint208"}],"internalType":"struct Checkpoints.Checkpoint208","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clock","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","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":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"timepoint","type":"uint256"}],"name":"getPastTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"timepoint","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":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"voter","type":"address"}],"name":"hasVoted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lockedUntil","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","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":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"proposalDescription","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proposals","outputs":[{"internalType":"uint64","name":"voteStart","type":"uint64"},{"internalType":"uint64","name":"voteEnd","type":"uint64"},{"internalType":"uint64","name":"executeAfter","type":"uint64"},{"internalType":"uint64","name":"proposalId","type":"uint64"},{"internalType":"uint128","name":"forVotes","type":"uint128"},{"internalType":"uint128","name":"againstVotes","type":"uint128"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bool","name":"executed","type":"bool"},{"internalType":"bool","name":"cancelled","type":"bool"},{"internalType":"uint112","name":"snapshotBlock","type":"uint112"},{"internalType":"address","name":"proposer","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"description","type":"string"}],"name":"propose","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"state","outputs":[{"internalType":"enum ProposalState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","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":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"votingNonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
610160604052348015610010575f5ffd5b506040516144b53803806144b583398101604081905261002f916109fd565b338280604051806040016040528060018152602001603160f81b8152508585816003908161005d9190610ae5565b50600461006a8282610ae5565b5061007a9150839050600561017b565b6101205261008981600661017b565b61014052815160208084019190912060e052815190820120610100524660a05261011560e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c052506001600160a01b03811661014d57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610156816101ad565b506001600d5561016a33630bebc2006101c9565b6101743380610201565b5050610c6f565b5f6020835110156101965761018f83610277565b90506101a7565b816101a18482610ae5565b5060ff90505b92915050565b600c80546001600160a01b03191690556101c6816102b4565b50565b6001600160a01b0382166101f25760405163ec442f0560e01b81525f6004820152602401610144565b6101fd5f8383610305565b5050565b6001600160a01b038281165f8181526008602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610272818361026d8661035c565b610379565b505050565b5f5f829050601f815111156102a1578260405163305a27a960e01b81526004016101449190610b9f565b80516102ac82610bd4565b179392505050565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b0383161580159061033357506001600160a01b0383165f9081526013602052604090205442105b156103515760405163de1af48d60e01b815260040160405180910390fd5b6102728383836104ce565b6001600160a01b0381165f908152602081905260408120546101a7565b816001600160a01b0316836001600160a01b03161415801561039a57505f81115b15610272576001600160a01b03831615610437576001600160a01b0383165f908152600960209081526040822082916103e59190610534901b6119ee176103e086610546565b61057d565b6001600160d01b031691506001600160d01b03169150846001600160a01b03165f5160206144955f395f51905f52838360405161042c929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610272576001600160a01b0382165f9081526009602090815260408220829161047891906105b2901b6119f9176103e086610546565b6001600160d01b031691506001600160d01b03169150836001600160a01b03165f5160206144955f395f51905f5283836040516104bf929190918252602082015260400190565b60405180910390a25050505050565b6104d98383836105bd565b6001600160a01b038316610529575f6104f160025490565b90506001600160d01b038082111561052657604051630e58ae9360e11b81526004810183905260248101829052604401610144565b50505b6102728383836106e3565b5f61053f8284610c0b565b9392505050565b5f6001600160d01b03821115610579576040516306dfcc6560e41b815260d0600482015260248101839052604401610144565b5090565b5f806105a561058a610766565b61059d61059688610774565b868860201c565b8791906107bb565b915091505b935093915050565b5f61053f8284610c2a565b6001600160a01b0383166105e7578060025f8282546105dc9190610c49565b909155506106579050565b6001600160a01b0383165f90815260208190526040902054818110156106395760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610144565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b03821661067357600280548290039055610691565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516106d691815260200190565b60405180910390a3505050565b6001600160a01b03831661070c57610709600a6119f96105b260201b176103e084610546565b50505b6001600160a01b03821661073557610732600a6119ee61053460201b176103e084610546565b50505b6001600160a01b038381165f9081526008602052604080822054858416835291205461027292918216911683610379565b5f61076f6107c8565b905090565b80545f9080156107b35761079a8361078d600184610c5c565b5f91825260209091200190565b54660100000000000090046001600160d01b031661053f565b5f9392505050565b5f806105a58585856107d2565b5f61076f4361092e565b82545f90819080156108d1575f6107ee8761078d600185610c5c565b805490915065ffffffffffff80821691660100000000000090046001600160d01b031690881682111561083457604051632520601d60e01b815260040160405180910390fd5b8765ffffffffffff168265ffffffffffff160361087057825465ffffffffffff1666010000000000006001600160d01b038916021783556108c3565b6040805180820190915265ffffffffffff808a1682526001600160d01b03808a1660208085019182528d54600181018f555f8f815291909120945191519092166601000000000000029216919091179101555b94508593506105aa92505050565b50506040805180820190915265ffffffffffff80851682526001600160d01b0380851660208085019182528854600181018a555f8a81529182209551925190931666010000000000000291909316179201919091559050816105aa565b5f65ffffffffffff821115610579576040516306dfcc6560e41b81526030600482015260248101839052604401610144565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112610983575f5ffd5b81516001600160401b0381111561099c5761099c610960565b604051601f8201601f19908116603f011681016001600160401b03811182821017156109ca576109ca610960565b6040528181528382016020018510156109e1575f5ffd5b8160208501602083015e5f918101602001919091529392505050565b5f5f60408385031215610a0e575f5ffd5b82516001600160401b03811115610a23575f5ffd5b610a2f85828601610974565b602085015190935090506001600160401b03811115610a4c575f5ffd5b610a5885828601610974565b9150509250929050565b600181811c90821680610a7657607f821691505b602082108103610a9457634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561027257805f5260205f20601f840160051c81016020851015610abf5750805b601f840160051c820191505b81811015610ade575f8155600101610acb565b5050505050565b81516001600160401b03811115610afe57610afe610960565b610b1281610b0c8454610a62565b84610a9a565b6020601f821160018114610b44575f8315610b2d5750848201515b5f19600385901b1c1916600184901b178455610ade565b5f84815260208120601f198516915b82811015610b735787850151825560209485019460019092019101610b53565b5084821015610b9057868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610a94575f1960209190910360031b1b16919050565b634e487b7160e01b5f52601160045260245ffd5b6001600160d01b0382811682821603908111156101a7576101a7610bf7565b6001600160d01b0381811683821601908111156101a7576101a7610bf7565b808201808211156101a7576101a7610bf7565b818103818111156101a7576101a7610bf7565b60805160a05160c05160e0516101005161012051610140516137d5610cc05f395f6122d901525f6122ac01525f611ecc01525f611ea401525f611dff01525f611e2901525f611e5301526137d55ff3fe608060405234801561000f575f5ffd5b5060043610610367575f3560e01c806379ba5097116101c9578063a9059cbb116100fe578063d89135cd1161009e578063e30c397811610079578063e30c3978146108bc578063f1127ed8146108cd578063f2fde38b1461090c578063fe0d94c11461091f575f5ffd5b8063d89135cd1461085d578063dd62ed3e14610865578063e2d9edf91461089d575f5ffd5b8063c37e47f5116100d9578063c37e47f51461081a578063c3cda5201461082d578063d505accf14610840578063d6159fe514610853575f5ffd5b8063a9059cbb146107f3578063b1610d7e14610806578063c1a287e214610810575f5ffd5b80638e539e8c116101695780639ab24eb0116101445780639ab24eb0146107ae5780639b5a3e7c146107c15780639bc289f1146107ca578063a6c26603146107e9575f5ffd5b80638e539e8c1461077457806391ddadf41461078757806395d89b41146107a6575f5ffd5b80637ecebe00116101a45780637ecebe001461072d5780638456cb591461074057806384b0196e146107485780638da5cb5b14610763575f5ffd5b806379ba5097146106ff57806379cc6790146107075780637b166f601461071a575f5ffd5b80633f4ba83a1161029f5780635c19a95c1161023f5780636198c3d01161021a5780636198c3d01461069e5780636fcfff45146106a757806370a08231146106cf578063715018a6146106f7575f5ffd5b80635c19a95c1461066b5780635c975abb1461067e5780635f3e849f1461068b575f5ffd5b8063438596321161027a57806343859632146105c55780634bf5d7e91461060157806352ba1da714610609578063587cde1e14610628575f5ffd5b80633f4ba83a1461059757806340e58ee51461059f57806342966c68146105b2575f5ffd5b8063313ce5671161030a57806337f135d7116102e557806337f135d7146105475780633830fdea146105515780633a46b1a8146105645780633e4f49e614610577575f5ffd5b8063313ce5671461052657806332cb6b0c146105345780633644e5151461053f575f5ffd5b806315373e3d1161034557806315373e3d146104e157806318160ddd146104f657806323b872dd146105085780632ff2e9dc1461051b575f5ffd5b8063013cf08b1461036b57806306fdde03146104a9578063095ea7b3146104be575b5f5ffd5b6104166103793660046130dd565b60116020525f9081526040902080546001820154600283015460038401546004909401546001600160401b0380851695600160401b8604821695600160801b808204841696600160c01b909204909316946001600160801b0380831695928590048116949082169360ff918304821693600160881b8404909216926001600160701b03600160901b90910416916001600160a01b0391821691168c565b604080516001600160401b039d8e1681529b8d1660208d0152998c16998b01999099529990961660608901526001600160801b03948516608089015292841660a0880152921660c086015290151560e085015215156101008401526001600160701b03166101208301526001600160a01b0392831661014083015291909116610160820152610180015b60405180910390f35b6104b1610932565b6040516104a09190613122565b6104d16104cc36600461314f565b6109c2565b60405190151581526020016104a0565b6104f46104ef366004613186565b6109db565b005b6002545b6040519081526020016104a0565b6104d16105163660046131b0565b6109ea565b6104fa630bebc20081565b6040515f81526020016104a0565b6104fa633b9aca0081565b6104fa610a0d565b6104fa6202a30081565b6104b161055f3660046130dd565b610a1b565b6104fa61057236600461314f565b610aba565b61058a6105853660046130dd565b610af4565b6040516104a091906131fe565b6104f4610c1a565b6104f46105ad3660046130dd565b610c62565b6104f46105c03660046130dd565b610d7b565b6104d16105d3366004613224565b5f8281526012602090815260408083206001600160a01b038516845260010190915290205460ff1692915050565b6104b1610dd2565b6104fa610617366004613245565b60156020525f908152604090205481565b610653610636366004613245565b6001600160a01b039081165f908152600860205260409020541690565b6040516001600160a01b0390911681526020016104a0565b6104f4610679366004613245565b610e4a565b6010546104d19060ff1681565b6104f46106993660046131b0565b610e55565b6104fa61019081565b6106ba6106b5366004613245565b610eb1565b60405163ffffffff90911681526020016104a0565b6104fa6106dd366004613245565b6001600160a01b03165f9081526020819052604090205490565b6104f4610ebb565b6104f4610ece565b6104f461071536600461314f565b610f14565b6104fa61072836600461325e565b610f72565b6104fa61073b366004613245565b61131c565b6104f4611326565b61075061136b565b6040516104a097969594939291906132df565b600b546001600160a01b0316610653565b6104fa6107823660046130dd565b6113ad565b61078f6113d1565b60405165ffffffffffff90911681526020016104a0565b6104b16113da565b6104fa6107bc366004613245565b6113e9565b6104fa6113ec81565b6104fa6107d8366004613245565b60136020525f908152604090205481565b6104fa620186a081565b6104d161080136600461314f565b611409565b6104fa6203f48081565b6104fa6212750081565b6104f4610828366004613385565b611416565b6104f461083b3660046133d9565b61158c565b6104f461084e366004613413565b611648565b6104fa6201518081565b600f546104fa565b6104fa610873366004613479565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6104fa6108ab366004613245565b60146020525f908152604090205481565b600c546001600160a01b0316610653565b6108e06108db3660046134a1565b61177e565b60408051825165ffffffffffff1681526020928301516001600160d01b031692810192909252016104a0565b6104f461091a366004613245565b6117a2565b6104f461092d3660046130dd565b611813565b606060038054610941906134de565b80601f016020809104026020016040519081016040528092919081815260200182805461096d906134de565b80156109b85780601f1061098f576101008083540402835291602001916109b8565b820191905f5260205f20905b81548152906001019060200180831161099b57829003601f168201915b5050505050905090565b5f336109cf818585611a04565b60019150505b92915050565b6109e6823383611a11565b5050565b5f336109f7858285611d1a565b610a02858585611d96565b506001949350505050565b5f610a16611df3565b905090565b5f818152601260205260409020805460609190610a37906134de565b80601f0160208091040260200160405190810160405280929190818152602001828054610a63906134de565b8015610aae5780601f10610a8557610100808354040283529160200191610aae565b820191905f5260205f20905b815481529060010190602001808311610a9157829003601f168201915b50505050509050919050565b5f610ae4610ac783611f1c565b6001600160a01b0385165f90815260096020526040902090611f6a565b6001600160d01b03169392505050565b5f81815260116020526040812054600160c01b90046001600160401b03168103610b1f57505f919050565b5f8281526011602052604090206002810154600160881b900460ff1615610b495750600392915050565b6002810154600160801b900460ff1615610b665750600892915050565b80546001600160401b0316421015610b815750600192915050565b8054600160401b90046001600160401b03164211610ba25750600292915050565b5f610bac8461201a565b905080610bbd575060049392505050565b8154600160801b90046001600160401b0316421015610be0575060059392505050565b8154610c00906212750090600160801b90046001600160401b031661352a565b4211610c10575060069392505050565b5060079392505050565b610c226120dc565b6010805460ff191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b5f818152601160205260408120548291600160c01b9091046001600160401b03169003610ca257604051631dc0650160e31b815260040160405180910390fd5b5f8281526011602052604090206002810154600160801b900460ff1680610cd457506002810154600160881b900460ff165b15610cf257604051631dc0650160e31b815260040160405180910390fd5b60038101546001600160a01b03163314801590610d1a5750600b546001600160a01b03163314155b15610d37576040516282b42960e81b815260040160405180910390fd5b60028101805460ff60881b1916600160881b17905560405183907f416e669c63d9a3a5e36ee7cc7e2104b8db28ccd286aa18966e98fa230c73b08c905f90a2505050565b80600f5f828254610d8c919061352a565b909155505060405181815233907ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb69060200160405180910390a2610dcf81612109565b50565b6060610ddc612113565b65ffffffffffff16610dec6113d1565b65ffffffffffff1614610e12576040516301bfc1c560e61b815260040160405180910390fd5b5060408051808201909152601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c74000000602082015290565b336109e6818361211d565b610e5d6120dc565b610e6561218e565b306001600160a01b03841603610e8e5760405163b4fa3fb360e01b815260040160405180910390fd5b610ea26001600160a01b03841683836121e7565b610eac6001600d55565b505050565b5f6109d582612239565b610ec36120dc565b610ecc5f61225a565b565b600c5433906001600160a01b03168114610f0b5760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610dcf8161225a565b80600f5f828254610f25919061352a565b90915550506040518181526001600160a01b038316907ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb69060200160405180910390a26109e68282612273565b6010545f9060ff1615610f985760405163ab35696f60e01b815260040160405180910390fd5b6001600160a01b038516610fbf5760405163b4fa3fb360e01b815260040160405180910390fd5b600b546001600160a01b03868116911614610fed57604051631c0adb3f60e21b815260040160405180910390fd5b831580611009575060025461100690633b9aca0061353d565b84115b156110275760405163c30436e960e01b815260040160405180910390fd5b81158061103557506103e882115b156110535760405163b4fa3fb360e01b815260040160405180910390fd5b5f6110633361057260014361353d565b9050620186a08110156110895760405163cabeb65560e01b815260040160405180910390fd5b5f8686868660405161109c929190613550565b604080519182900382206001600160a01b039094166020830152810191909152606081019190915260800160408051601f1981840301815291815281516020928301205f818152601690935291205490915060ff161561110f576040516348606b4b60e11b815260040160405180910390fd5b5f818152601660205260408120805460ff19166001179055600e805482906111369061355f565b91829055505f81815260116020526040902080546001600160c01b0316600160c01b6001600160401b03841602178155909150611176620151804261352a565b815467ffffffffffffffff19166001600160401b03919091161781556203f4806111a3620151804261352a565b6111ad919061352a565b81546001600160401b0391909116600160401b026fffffffffffffffff0000000000000000199091161781556202a3006203f4806111ee620151804261352a565b6111f8919061352a565b611202919061352a565b815467ffffffffffffffff60801b1916600160801b6001600160401b03929092169190910217815560028101805461ffff60801b16600160901b436001600160701b0316026fffffffffffffffffffffffffffffffff1916176001600160801b038a16179055600381018054336001600160a01b0319918216179091556004820180549091166001600160a01b038b161790555f8281526012602052604090206112ad8789836135d6565b5080546040516001600160a01b038b1691339185917f84ddd3c5946a81ad5e6f4ad23b1d2821ca4f2cca331b1f413903e98964f928d191611308918e916001600160401b0380831692600160401b900416908f908f9061368f565b60405180910390a450979650505050505050565b5f6109d582612288565b61132e6120dc565b6010805460ff191660011790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602001610c58565b5f6060805f5f5f606061137c6122a5565b6113846122d2565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b5f6113c26113ba83611f1c565b600a90611f6a565b6001600160d01b031692915050565b5f610a16612113565b606060048054610941906134de565b6001600160a01b0381165f9081526009602052604081206113c2906122ff565b5f336109cf818585611d96565b8342111561143757604051630819bdcd60e01b815260040160405180910390fd5b335f818152601560205260408120805490826114528361355f565b90915550604080517fc3611e7a50558467b0d3698b23d4f555f2f434386283071e3d2ada1eb796ac1760208201529081018a905288151560608201526080810182905260a081018890524660c08201529091505f9060e0016040516020818303038152906040528051906020012090505f6114cc82612336565b604080515f8082526020820180845284905260ff8b169282019290925260608101899052608081018890529192509060019060a0016020604051602081039080840390855afa158015611521573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b03811615806115565750846001600160a01b0316816001600160a01b031614155b156115745760405163b4fa3fb360e01b815260040160405180910390fd5b61157f8b828c611a11565b5050505050505050505050565b834211156115b057604051632341d78760e11b815260048101859052602401610f02565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b0388169181019190915260608101869052608081018590525f90611629906116219060a00160405160208183030381529060405280519060200120612336565b858585612362565b9050611635818761238e565b61163f818861211d565b50505050505050565b8342111561166c5760405163313c898160e11b815260048101859052602401610f02565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886116b78c6001600160a01b03165f90815260076020526040902080546001810190915590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f61171182612336565b90505f61172082878787612362565b9050896001600160a01b0316816001600160a01b031614611767576040516325c0072360e11b81526001600160a01b0380831660048301528b166024820152604401610f02565b6117728a8a8a611a04565b50505050505050505050565b604080518082019091525f808252602082015261179b83836123e0565b9392505050565b6117aa6120dc565b600c80546001600160a01b0383166001600160a01b031990911681179091556117db600b546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60105460ff16156118375760405163ab35696f60e01b815260040160405180910390fd5b61183f61218e565b5f818152601160205260408120548291600160c01b9091046001600160401b0316900361187f57604051631dc0650160e31b815260040160405180910390fd5b5f8281526011602052604090206002810154600160801b900460ff16156118b957604051631dc0650160e31b815260040160405180910390fd5b6002810154600160881b900460ff16156118e657604051631dc0650160e31b815260040160405180910390fd5b8054600160801b90046001600160401b03164210156119185760405163766b0c5b60e11b815260040160405180910390fd5b8054611938906212750090600160801b90046001600160401b031661352a565b421115611958576040516328a7237960e01b815260040160405180910390fd5b6119618361201a565b61197e5760405163feace5cd60e01b815260040160405180910390fd5b60028101805460ff60801b198116600160801b1790915560048201546119b8916001600160a01b03909116906001600160801b0316612414565b60405183907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f905f90a25050610dcf6001600d55565b5f61179b82846136e4565b5f61179b8284613703565b610eac8383836001612448565b611a1961218e565b5f838152601160205260408120548491600160c01b9091046001600160401b03169003611a5957604051631dc0650160e31b815260040160405180910390fd5b6001600160a01b0383165f9081526013602052604090205442108015611a9657506001600160a01b0383165f908152601460205260409020548414155b15611ab45760405163de1af48d60e01b815260040160405180910390fd5b5f848152601160205260409020600b546001600160a01b03166001600160a01b0316846001600160a01b031603611afd576040516282b42960e81b815260040160405180910390fd5b80546001600160401b0316421080611b2557508054600160401b90046001600160401b031642115b15611b4357604051637becc13f60e01b815260040160405180910390fd5b5f8581526012602090815260408083206001600160a01b038816845260010190915290205460ff1615611b8957604051637c9a1cf960e01b815260040160405180910390fd5b60028101545f90611bab908690600160901b90046001600160701b0316610aba565b9050805f03611bcd5760405163cabeb65560e01b815260040160405180910390fd5b5f8681526012602090815260408083206001600160a01b03891684526001908101909252909120805460ff191690911790558315611c4d576001820180548291905f90611c249084906001600160801b0316613722565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550611c98565b808260010160108282829054906101000a90046001600160801b0316611c739190613722565b92506101000a8154816001600160801b0302191690836001600160801b031602179055505b81546001600160a01b0386165f818152601360209081526040808320600160401b9095046001600160401b031690945560148152908390208990558251871515815290810184905288927f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c46910160405180910390a3505050610eac6001600d55565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f19811015611d905781811015611d8257604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610f02565b611d9084848484035f612448565b50505050565b6001600160a01b038316611dbf57604051634b637e8f60e11b81525f6004820152602401610f02565b6001600160a01b038216611de85760405163ec442f0560e01b81525f6004820152602401610f02565b610eac83838361251a565b5f306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015611e4b57507f000000000000000000000000000000000000000000000000000000000000000046145b15611e7557507f000000000000000000000000000000000000000000000000000000000000000090565b610a16604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b5f5f611f266113d1565b90508065ffffffffffff168310611f6157604051637669fc0f60e11b81526004810184905265ffffffffffff82166024820152604401610f02565b61179b83612571565b81545f9081816005811115611fc6575f611f83846125a7565b611f8d908561353d565b5f8881526020902090915081015465ffffffffffff9081169087161015611fb657809150611fc4565b611fc181600161352a565b92505b505b5f611fd3878785856126fa565b9050801561200d57611ff787611fea60018461353d565b5f91825260209091200190565b54600160301b90046001600160d01b031661200f565b5f5b979650505050505050565b5f81815260116020526040812060028101548290612710906101909061204f90600160901b90046001600160701b03166113ad565b6120599190613741565b612063919061376c565b60018301549091505f90612089906001600160801b03600160801b820481169116613722565b6001600160801b03169050818110156120a657505f949350505050565b5f6127106120b66113ec84613741565b6120c0919061376c565b6001909401546001600160801b03169390931195945050505050565b600b546001600160a01b03163314610ecc5760405163118cdaa760e01b8152336004820152602401610f02565b610dcf3382612759565b5f610a1643612571565b6001600160a01b038281165f8181526008602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610eac81836121898661278d565b6127aa565b6002600d54036121e05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610f02565b6002600d55565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610eac908490612913565b6001600160a01b0381165f908152600960205260408120546109d59061297f565b600c80546001600160a01b0319169055610dcf816129af565b61227e823383611d1a565b6109e68282612759565b6001600160a01b0381165f908152600760205260408120546109d5565b6060610a167f00000000000000000000000000000000000000000000000000000000000000006005612a00565b6060610a167f00000000000000000000000000000000000000000000000000000000000000006006612a00565b80545f90801561232e5761231883611fea60018461353d565b54600160301b90046001600160d01b031661179b565b5f9392505050565b5f6109d5612342611df3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f5f5f5f61237288888888612aa9565b9250925092506123828282612b71565b50909695505050505050565b6001600160a01b0382165f908152600760205260409020805460018101909155818114610eac576040516301d4b62360e61b81526001600160a01b038416600482015260248101829052604401610f02565b604080518082019091525f80825260208201526001600160a01b0383165f90815260096020526040902061179b9083612c29565b6001600160a01b03821661243d5760405163ec442f0560e01b81525f6004820152602401610f02565b6109e65f838361251a565b6001600160a01b0384166124715760405163e602df0560e01b81525f6004820152602401610f02565b6001600160a01b03831661249a57604051634a1406b160e11b81525f6004820152602401610f02565b6001600160a01b038085165f9081526001602090815260408083209387168352929052208290558015611d9057826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161250c91815260200190565b60405180910390a350505050565b6001600160a01b0383161580159061254857506001600160a01b0383165f9081526013602052604090205442105b156125665760405163de1af48d60e01b815260040160405180910390fd5b610eac838383612c96565b5f65ffffffffffff8211156125a3576040516306dfcc6560e41b81526030600482015260248101839052604401610f02565b5090565b5f600182116125b4575090565b816001600160801b82106125cd5760809190911c9060401b5b600160401b82106125e35760409190911c9060201b5b64010000000082106125fa5760209190911c9060101b5b62010000821061260f5760109190911c9060081b5b61010082106126235760089190911c9060041b5b601082106126365760049190911c9060021b5b600482106126425760011b5b600302600190811c9081858161265a5761265a613758565b048201901c9050600181858161267257612672613758565b048201901c9050600181858161268a5761268a613758565b048201901c905060018185816126a2576126a2613758565b048201901c905060018185816126ba576126ba613758565b048201901c905060018185816126d2576126d2613758565b048201901c90506126f18185816126eb576126eb613758565b04821190565b90039392505050565b5f5b81831015612751575f61270f8484612cfc565b5f8781526020902090915065ffffffffffff86169082015465ffffffffffff16111561273d5780925061274b565b61274881600161352a565b93505b506126fc565b509392505050565b6001600160a01b03821661278257604051634b637e8f60e11b81525f6004820152602401610f02565b6109e6825f8361251a565b6001600160a01b0381165f908152602081905260408120546109d5565b816001600160a01b0316836001600160a01b0316141580156127cb57505f81115b15610eac576001600160a01b03831615612872576001600160a01b0383165f908152600960205260408120819061280d906119ee61280886612d16565b612d49565b6001600160d01b031691506001600160d01b03169150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612867929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610eac576001600160a01b0382165f90815260096020526040812081906128aa906119f961280886612d16565b6001600160d01b031691506001600160d01b03169150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612904929190918252602082015260400190565b60405180910390a25050505050565b5f5f60205f8451602086015f885af180612932576040513d5f823e3d81fd5b50505f513d91508115612949578060011415612956565b6001600160a01b0384163b155b15611d9057604051635274afe760e01b81526001600160a01b0385166004820152602401610f02565b5f63ffffffff8211156125a3576040516306dfcc6560e41b81526020600482015260248101839052604401610f02565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b606060ff8314612a1a57612a1383612d81565b90506109d5565b818054612a26906134de565b80601f0160208091040260200160405190810160405280929190818152602001828054612a52906134de565b8015612a9d5780601f10612a7457610100808354040283529160200191612a9d565b820191905f5260205f20905b815481529060010190602001808311612a8057829003601f168201915b505050505090506109d5565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115612ae257505f91506003905082612b67565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015612b33573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116612b5e57505f925060019150829050612b67565b92505f91508190505b9450945094915050565b5f826003811115612b8457612b846131ea565b03612b8d575050565b6001826003811115612ba157612ba16131ea565b03612bbf5760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115612bd357612bd36131ea565b03612bf45760405163fce698f760e01b815260048101829052602401610f02565b6003826003811115612c0857612c086131ea565b036109e6576040516335e2f38360e21b815260048101829052602401610f02565b604080518082019091525f8082526020820152825f018263ffffffff1681548110612c5657612c5661378b565b5f9182526020918290206040805180820190915291015465ffffffffffff81168252600160301b90046001600160d01b0316918101919091529392505050565b612ca1838383612dbe565b6001600160a01b038316612cf1575f612cb960025490565b90506001600160d01b0380821115612cee57604051630e58ae9360e11b81526004810183905260248101829052604401610f02565b50505b610eac838383612ee4565b5f612d0a600284841861376c565b61179b9084841661352a565b5f6001600160d01b038211156125a3576040516306dfcc6560e41b815260d0600482015260248101839052604401610f02565b5f5f612d74612d566113d1565b612d6c612d62886122ff565b868863ffffffff16565b879190612f59565b915091505b935093915050565b60605f612d8d83612f66565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b6001600160a01b038316612de8578060025f828254612ddd919061352a565b90915550612e589050565b6001600160a01b0383165f9081526020819052604090205481811015612e3a5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610f02565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b038216612e7457600280548290039055612e92565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ed791815260200190565b60405180910390a3505050565b6001600160a01b038316612f0657612f03600a6119f961280884612d16565b50505b6001600160a01b038216612f2857612f25600a6119ee61280884612d16565b50505b6001600160a01b038381165f90815260086020526040808220548584168352912054610eac929182169116836127aa565b5f80612d74858585612f8d565b5f60ff8216601f8111156109d557604051632cd44ac360e21b815260040160405180910390fd5b82545f9081908015613083575f612fa987611fea60018561353d565b805490915065ffffffffffff80821691600160301b90046001600160d01b0316908816821115612fec57604051632520601d60e01b815260040160405180910390fd5b8765ffffffffffff168265ffffffffffff160361302557825465ffffffffffff16600160301b6001600160d01b03891602178355613075565b6040805180820190915265ffffffffffff808a1682526001600160d01b03808a1660208085019182528d54600181018f555f8f81529190912094519151909216600160301b029216919091179101555b9450859350612d7992505050565b50506040805180820190915265ffffffffffff80851682526001600160d01b0380851660208085019182528854600181018a555f8a815291822095519251909316600160301b029190931617920191909155905081612d79565b5f602082840312156130ed575f5ffd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f61179b60208301846130f4565b80356001600160a01b038116811461314a575f5ffd5b919050565b5f5f60408385031215613160575f5ffd5b61316983613134565b946020939093013593505050565b8035801515811461314a575f5ffd5b5f5f60408385031215613197575f5ffd5b823591506131a760208401613177565b90509250929050565b5f5f5f606084860312156131c2575f5ffd5b6131cb84613134565b92506131d960208501613134565b929592945050506040919091013590565b634e487b7160e01b5f52602160045260245ffd5b602081016009831061321e57634e487b7160e01b5f52602160045260245ffd5b91905290565b5f5f60408385031215613235575f5ffd5b823591506131a760208401613134565b5f60208284031215613255575f5ffd5b61179b82613134565b5f5f5f5f60608587031215613271575f5ffd5b61327a85613134565b93506020850135925060408501356001600160401b0381111561329b575f5ffd5b8501601f810187136132ab575f5ffd5b80356001600160401b038111156132c0575f5ffd5b8760208284010111156132d1575f5ffd5b949793965060200194505050565b60ff60f81b8816815260e060208201525f6132fd60e08301896130f4565b828103604084015261330f81896130f4565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b81811015613364578351835260209384019390920191600101613346565b50909b9a5050505050505050505050565b803560ff8116811461314a575f5ffd5b5f5f5f5f5f5f60c0878903121561339a575f5ffd5b863595506133aa60208801613177565b9450604087013593506133bf60608801613375565b9598949750929560808101359460a0909101359350915050565b5f5f5f5f5f5f60c087890312156133ee575f5ffd5b6133f787613134565b955060208701359450604087013593506133bf60608801613375565b5f5f5f5f5f5f5f60e0888a031215613429575f5ffd5b61343288613134565b965061344060208901613134565b9550604088013594506060880135935061345c60808901613375565b9699959850939692959460a0840135945060c09093013592915050565b5f5f6040838503121561348a575f5ffd5b61349383613134565b91506131a760208401613134565b5f5f604083850312156134b2575f5ffd5b6134bb83613134565b9150602083013563ffffffff811681146134d3575f5ffd5b809150509250929050565b600181811c908216806134f257607f821691505b60208210810361351057634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b808201808211156109d5576109d5613516565b818103818111156109d5576109d5613516565b818382375f9101908152919050565b5f6001820161357057613570613516565b5060010190565b634e487b7160e01b5f52604160045260245ffd5b601f821115610eac57805f5260205f20601f840160051c810160208510156135b05750805b601f840160051c820191505b818110156135cf575f81556001016135bc565b5050505050565b6001600160401b038311156135ed576135ed613577565b613601836135fb83546134de565b8361358b565b5f601f841160018114613632575f851561361b5750838201355b5f19600387901b1c1916600186901b1783556135cf565b5f83815260208120601f198716915b828110156136615786850135825560209485019460019092019101613641565b508682101561367d575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b8581526001600160401b03851660208201526001600160401b038416604082015260806060820152816080820152818360a08301375f81830160a090810191909152601f909201601f19160101949350505050565b6001600160d01b0382811682821603908111156109d5576109d5613516565b6001600160d01b0381811683821601908111156109d5576109d5613516565b6001600160801b0381811683821601908111156109d5576109d5613516565b80820281158282048414176109d5576109d5613516565b634e487b7160e01b5f52601260045260245ffd5b5f8261378657634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffdfea264697066735822122054cc60bf2eae13959362736b309dcd8a96534f391967c1940183fe077379a20964736f6c634300081e0033dec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72400000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000e544354205465737420546f6b656e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045443545400000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561000f575f5ffd5b5060043610610367575f3560e01c806379ba5097116101c9578063a9059cbb116100fe578063d89135cd1161009e578063e30c397811610079578063e30c3978146108bc578063f1127ed8146108cd578063f2fde38b1461090c578063fe0d94c11461091f575f5ffd5b8063d89135cd1461085d578063dd62ed3e14610865578063e2d9edf91461089d575f5ffd5b8063c37e47f5116100d9578063c37e47f51461081a578063c3cda5201461082d578063d505accf14610840578063d6159fe514610853575f5ffd5b8063a9059cbb146107f3578063b1610d7e14610806578063c1a287e214610810575f5ffd5b80638e539e8c116101695780639ab24eb0116101445780639ab24eb0146107ae5780639b5a3e7c146107c15780639bc289f1146107ca578063a6c26603146107e9575f5ffd5b80638e539e8c1461077457806391ddadf41461078757806395d89b41146107a6575f5ffd5b80637ecebe00116101a45780637ecebe001461072d5780638456cb591461074057806384b0196e146107485780638da5cb5b14610763575f5ffd5b806379ba5097146106ff57806379cc6790146107075780637b166f601461071a575f5ffd5b80633f4ba83a1161029f5780635c19a95c1161023f5780636198c3d01161021a5780636198c3d01461069e5780636fcfff45146106a757806370a08231146106cf578063715018a6146106f7575f5ffd5b80635c19a95c1461066b5780635c975abb1461067e5780635f3e849f1461068b575f5ffd5b8063438596321161027a57806343859632146105c55780634bf5d7e91461060157806352ba1da714610609578063587cde1e14610628575f5ffd5b80633f4ba83a1461059757806340e58ee51461059f57806342966c68146105b2575f5ffd5b8063313ce5671161030a57806337f135d7116102e557806337f135d7146105475780633830fdea146105515780633a46b1a8146105645780633e4f49e614610577575f5ffd5b8063313ce5671461052657806332cb6b0c146105345780633644e5151461053f575f5ffd5b806315373e3d1161034557806315373e3d146104e157806318160ddd146104f657806323b872dd146105085780632ff2e9dc1461051b575f5ffd5b8063013cf08b1461036b57806306fdde03146104a9578063095ea7b3146104be575b5f5ffd5b6104166103793660046130dd565b60116020525f9081526040902080546001820154600283015460038401546004909401546001600160401b0380851695600160401b8604821695600160801b808204841696600160c01b909204909316946001600160801b0380831695928590048116949082169360ff918304821693600160881b8404909216926001600160701b03600160901b90910416916001600160a01b0391821691168c565b604080516001600160401b039d8e1681529b8d1660208d0152998c16998b01999099529990961660608901526001600160801b03948516608089015292841660a0880152921660c086015290151560e085015215156101008401526001600160701b03166101208301526001600160a01b0392831661014083015291909116610160820152610180015b60405180910390f35b6104b1610932565b6040516104a09190613122565b6104d16104cc36600461314f565b6109c2565b60405190151581526020016104a0565b6104f46104ef366004613186565b6109db565b005b6002545b6040519081526020016104a0565b6104d16105163660046131b0565b6109ea565b6104fa630bebc20081565b6040515f81526020016104a0565b6104fa633b9aca0081565b6104fa610a0d565b6104fa6202a30081565b6104b161055f3660046130dd565b610a1b565b6104fa61057236600461314f565b610aba565b61058a6105853660046130dd565b610af4565b6040516104a091906131fe565b6104f4610c1a565b6104f46105ad3660046130dd565b610c62565b6104f46105c03660046130dd565b610d7b565b6104d16105d3366004613224565b5f8281526012602090815260408083206001600160a01b038516845260010190915290205460ff1692915050565b6104b1610dd2565b6104fa610617366004613245565b60156020525f908152604090205481565b610653610636366004613245565b6001600160a01b039081165f908152600860205260409020541690565b6040516001600160a01b0390911681526020016104a0565b6104f4610679366004613245565b610e4a565b6010546104d19060ff1681565b6104f46106993660046131b0565b610e55565b6104fa61019081565b6106ba6106b5366004613245565b610eb1565b60405163ffffffff90911681526020016104a0565b6104fa6106dd366004613245565b6001600160a01b03165f9081526020819052604090205490565b6104f4610ebb565b6104f4610ece565b6104f461071536600461314f565b610f14565b6104fa61072836600461325e565b610f72565b6104fa61073b366004613245565b61131c565b6104f4611326565b61075061136b565b6040516104a097969594939291906132df565b600b546001600160a01b0316610653565b6104fa6107823660046130dd565b6113ad565b61078f6113d1565b60405165ffffffffffff90911681526020016104a0565b6104b16113da565b6104fa6107bc366004613245565b6113e9565b6104fa6113ec81565b6104fa6107d8366004613245565b60136020525f908152604090205481565b6104fa620186a081565b6104d161080136600461314f565b611409565b6104fa6203f48081565b6104fa6212750081565b6104f4610828366004613385565b611416565b6104f461083b3660046133d9565b61158c565b6104f461084e366004613413565b611648565b6104fa6201518081565b600f546104fa565b6104fa610873366004613479565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6104fa6108ab366004613245565b60146020525f908152604090205481565b600c546001600160a01b0316610653565b6108e06108db3660046134a1565b61177e565b60408051825165ffffffffffff1681526020928301516001600160d01b031692810192909252016104a0565b6104f461091a366004613245565b6117a2565b6104f461092d3660046130dd565b611813565b606060038054610941906134de565b80601f016020809104026020016040519081016040528092919081815260200182805461096d906134de565b80156109b85780601f1061098f576101008083540402835291602001916109b8565b820191905f5260205f20905b81548152906001019060200180831161099b57829003601f168201915b5050505050905090565b5f336109cf818585611a04565b60019150505b92915050565b6109e6823383611a11565b5050565b5f336109f7858285611d1a565b610a02858585611d96565b506001949350505050565b5f610a16611df3565b905090565b5f818152601260205260409020805460609190610a37906134de565b80601f0160208091040260200160405190810160405280929190818152602001828054610a63906134de565b8015610aae5780601f10610a8557610100808354040283529160200191610aae565b820191905f5260205f20905b815481529060010190602001808311610a9157829003601f168201915b50505050509050919050565b5f610ae4610ac783611f1c565b6001600160a01b0385165f90815260096020526040902090611f6a565b6001600160d01b03169392505050565b5f81815260116020526040812054600160c01b90046001600160401b03168103610b1f57505f919050565b5f8281526011602052604090206002810154600160881b900460ff1615610b495750600392915050565b6002810154600160801b900460ff1615610b665750600892915050565b80546001600160401b0316421015610b815750600192915050565b8054600160401b90046001600160401b03164211610ba25750600292915050565b5f610bac8461201a565b905080610bbd575060049392505050565b8154600160801b90046001600160401b0316421015610be0575060059392505050565b8154610c00906212750090600160801b90046001600160401b031661352a565b4211610c10575060069392505050565b5060079392505050565b610c226120dc565b6010805460ff191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b5f818152601160205260408120548291600160c01b9091046001600160401b03169003610ca257604051631dc0650160e31b815260040160405180910390fd5b5f8281526011602052604090206002810154600160801b900460ff1680610cd457506002810154600160881b900460ff165b15610cf257604051631dc0650160e31b815260040160405180910390fd5b60038101546001600160a01b03163314801590610d1a5750600b546001600160a01b03163314155b15610d37576040516282b42960e81b815260040160405180910390fd5b60028101805460ff60881b1916600160881b17905560405183907f416e669c63d9a3a5e36ee7cc7e2104b8db28ccd286aa18966e98fa230c73b08c905f90a2505050565b80600f5f828254610d8c919061352a565b909155505060405181815233907ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb69060200160405180910390a2610dcf81612109565b50565b6060610ddc612113565b65ffffffffffff16610dec6113d1565b65ffffffffffff1614610e12576040516301bfc1c560e61b815260040160405180910390fd5b5060408051808201909152601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c74000000602082015290565b336109e6818361211d565b610e5d6120dc565b610e6561218e565b306001600160a01b03841603610e8e5760405163b4fa3fb360e01b815260040160405180910390fd5b610ea26001600160a01b03841683836121e7565b610eac6001600d55565b505050565b5f6109d582612239565b610ec36120dc565b610ecc5f61225a565b565b600c5433906001600160a01b03168114610f0b5760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610dcf8161225a565b80600f5f828254610f25919061352a565b90915550506040518181526001600160a01b038316907ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb69060200160405180910390a26109e68282612273565b6010545f9060ff1615610f985760405163ab35696f60e01b815260040160405180910390fd5b6001600160a01b038516610fbf5760405163b4fa3fb360e01b815260040160405180910390fd5b600b546001600160a01b03868116911614610fed57604051631c0adb3f60e21b815260040160405180910390fd5b831580611009575060025461100690633b9aca0061353d565b84115b156110275760405163c30436e960e01b815260040160405180910390fd5b81158061103557506103e882115b156110535760405163b4fa3fb360e01b815260040160405180910390fd5b5f6110633361057260014361353d565b9050620186a08110156110895760405163cabeb65560e01b815260040160405180910390fd5b5f8686868660405161109c929190613550565b604080519182900382206001600160a01b039094166020830152810191909152606081019190915260800160408051601f1981840301815291815281516020928301205f818152601690935291205490915060ff161561110f576040516348606b4b60e11b815260040160405180910390fd5b5f818152601660205260408120805460ff19166001179055600e805482906111369061355f565b91829055505f81815260116020526040902080546001600160c01b0316600160c01b6001600160401b03841602178155909150611176620151804261352a565b815467ffffffffffffffff19166001600160401b03919091161781556203f4806111a3620151804261352a565b6111ad919061352a565b81546001600160401b0391909116600160401b026fffffffffffffffff0000000000000000199091161781556202a3006203f4806111ee620151804261352a565b6111f8919061352a565b611202919061352a565b815467ffffffffffffffff60801b1916600160801b6001600160401b03929092169190910217815560028101805461ffff60801b16600160901b436001600160701b0316026fffffffffffffffffffffffffffffffff1916176001600160801b038a16179055600381018054336001600160a01b0319918216179091556004820180549091166001600160a01b038b161790555f8281526012602052604090206112ad8789836135d6565b5080546040516001600160a01b038b1691339185917f84ddd3c5946a81ad5e6f4ad23b1d2821ca4f2cca331b1f413903e98964f928d191611308918e916001600160401b0380831692600160401b900416908f908f9061368f565b60405180910390a450979650505050505050565b5f6109d582612288565b61132e6120dc565b6010805460ff191660011790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602001610c58565b5f6060805f5f5f606061137c6122a5565b6113846122d2565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b5f6113c26113ba83611f1c565b600a90611f6a565b6001600160d01b031692915050565b5f610a16612113565b606060048054610941906134de565b6001600160a01b0381165f9081526009602052604081206113c2906122ff565b5f336109cf818585611d96565b8342111561143757604051630819bdcd60e01b815260040160405180910390fd5b335f818152601560205260408120805490826114528361355f565b90915550604080517fc3611e7a50558467b0d3698b23d4f555f2f434386283071e3d2ada1eb796ac1760208201529081018a905288151560608201526080810182905260a081018890524660c08201529091505f9060e0016040516020818303038152906040528051906020012090505f6114cc82612336565b604080515f8082526020820180845284905260ff8b169282019290925260608101899052608081018890529192509060019060a0016020604051602081039080840390855afa158015611521573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b03811615806115565750846001600160a01b0316816001600160a01b031614155b156115745760405163b4fa3fb360e01b815260040160405180910390fd5b61157f8b828c611a11565b5050505050505050505050565b834211156115b057604051632341d78760e11b815260048101859052602401610f02565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b0388169181019190915260608101869052608081018590525f90611629906116219060a00160405160208183030381529060405280519060200120612336565b858585612362565b9050611635818761238e565b61163f818861211d565b50505050505050565b8342111561166c5760405163313c898160e11b815260048101859052602401610f02565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886116b78c6001600160a01b03165f90815260076020526040902080546001810190915590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f61171182612336565b90505f61172082878787612362565b9050896001600160a01b0316816001600160a01b031614611767576040516325c0072360e11b81526001600160a01b0380831660048301528b166024820152604401610f02565b6117728a8a8a611a04565b50505050505050505050565b604080518082019091525f808252602082015261179b83836123e0565b9392505050565b6117aa6120dc565b600c80546001600160a01b0383166001600160a01b031990911681179091556117db600b546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60105460ff16156118375760405163ab35696f60e01b815260040160405180910390fd5b61183f61218e565b5f818152601160205260408120548291600160c01b9091046001600160401b0316900361187f57604051631dc0650160e31b815260040160405180910390fd5b5f8281526011602052604090206002810154600160801b900460ff16156118b957604051631dc0650160e31b815260040160405180910390fd5b6002810154600160881b900460ff16156118e657604051631dc0650160e31b815260040160405180910390fd5b8054600160801b90046001600160401b03164210156119185760405163766b0c5b60e11b815260040160405180910390fd5b8054611938906212750090600160801b90046001600160401b031661352a565b421115611958576040516328a7237960e01b815260040160405180910390fd5b6119618361201a565b61197e5760405163feace5cd60e01b815260040160405180910390fd5b60028101805460ff60801b198116600160801b1790915560048201546119b8916001600160a01b03909116906001600160801b0316612414565b60405183907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f905f90a25050610dcf6001600d55565b5f61179b82846136e4565b5f61179b8284613703565b610eac8383836001612448565b611a1961218e565b5f838152601160205260408120548491600160c01b9091046001600160401b03169003611a5957604051631dc0650160e31b815260040160405180910390fd5b6001600160a01b0383165f9081526013602052604090205442108015611a9657506001600160a01b0383165f908152601460205260409020548414155b15611ab45760405163de1af48d60e01b815260040160405180910390fd5b5f848152601160205260409020600b546001600160a01b03166001600160a01b0316846001600160a01b031603611afd576040516282b42960e81b815260040160405180910390fd5b80546001600160401b0316421080611b2557508054600160401b90046001600160401b031642115b15611b4357604051637becc13f60e01b815260040160405180910390fd5b5f8581526012602090815260408083206001600160a01b038816845260010190915290205460ff1615611b8957604051637c9a1cf960e01b815260040160405180910390fd5b60028101545f90611bab908690600160901b90046001600160701b0316610aba565b9050805f03611bcd5760405163cabeb65560e01b815260040160405180910390fd5b5f8681526012602090815260408083206001600160a01b03891684526001908101909252909120805460ff191690911790558315611c4d576001820180548291905f90611c249084906001600160801b0316613722565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550611c98565b808260010160108282829054906101000a90046001600160801b0316611c739190613722565b92506101000a8154816001600160801b0302191690836001600160801b031602179055505b81546001600160a01b0386165f818152601360209081526040808320600160401b9095046001600160401b031690945560148152908390208990558251871515815290810184905288927f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c46910160405180910390a3505050610eac6001600d55565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f19811015611d905781811015611d8257604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610f02565b611d9084848484035f612448565b50505050565b6001600160a01b038316611dbf57604051634b637e8f60e11b81525f6004820152602401610f02565b6001600160a01b038216611de85760405163ec442f0560e01b81525f6004820152602401610f02565b610eac83838361251a565b5f306001600160a01b037f000000000000000000000000726ab81d1d7c69d276d7bbd0ad90290a4d9cc82a16148015611e4b57507f000000000000000000000000000000000000000000000000000000000000000146145b15611e7557507f3f6ca53347d80d41f544b5a9883d293a6427506c04a9cd1963220489d4b1fdea90565b610a16604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527fe258fd05700093b1171b44bf53349cfcad4a0bfc4b0c9a73a922cc80f789ec18918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b5f5f611f266113d1565b90508065ffffffffffff168310611f6157604051637669fc0f60e11b81526004810184905265ffffffffffff82166024820152604401610f02565b61179b83612571565b81545f9081816005811115611fc6575f611f83846125a7565b611f8d908561353d565b5f8881526020902090915081015465ffffffffffff9081169087161015611fb657809150611fc4565b611fc181600161352a565b92505b505b5f611fd3878785856126fa565b9050801561200d57611ff787611fea60018461353d565b5f91825260209091200190565b54600160301b90046001600160d01b031661200f565b5f5b979650505050505050565b5f81815260116020526040812060028101548290612710906101909061204f90600160901b90046001600160701b03166113ad565b6120599190613741565b612063919061376c565b60018301549091505f90612089906001600160801b03600160801b820481169116613722565b6001600160801b03169050818110156120a657505f949350505050565b5f6127106120b66113ec84613741565b6120c0919061376c565b6001909401546001600160801b03169390931195945050505050565b600b546001600160a01b03163314610ecc5760405163118cdaa760e01b8152336004820152602401610f02565b610dcf3382612759565b5f610a1643612571565b6001600160a01b038281165f8181526008602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610eac81836121898661278d565b6127aa565b6002600d54036121e05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610f02565b6002600d55565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610eac908490612913565b6001600160a01b0381165f908152600960205260408120546109d59061297f565b600c80546001600160a01b0319169055610dcf816129af565b61227e823383611d1a565b6109e68282612759565b6001600160a01b0381165f908152600760205260408120546109d5565b6060610a167f544354205465737420546f6b656e00000000000000000000000000000000000e6005612a00565b6060610a167f31000000000000000000000000000000000000000000000000000000000000016006612a00565b80545f90801561232e5761231883611fea60018461353d565b54600160301b90046001600160d01b031661179b565b5f9392505050565b5f6109d5612342611df3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f5f5f5f61237288888888612aa9565b9250925092506123828282612b71565b50909695505050505050565b6001600160a01b0382165f908152600760205260409020805460018101909155818114610eac576040516301d4b62360e61b81526001600160a01b038416600482015260248101829052604401610f02565b604080518082019091525f80825260208201526001600160a01b0383165f90815260096020526040902061179b9083612c29565b6001600160a01b03821661243d5760405163ec442f0560e01b81525f6004820152602401610f02565b6109e65f838361251a565b6001600160a01b0384166124715760405163e602df0560e01b81525f6004820152602401610f02565b6001600160a01b03831661249a57604051634a1406b160e11b81525f6004820152602401610f02565b6001600160a01b038085165f9081526001602090815260408083209387168352929052208290558015611d9057826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161250c91815260200190565b60405180910390a350505050565b6001600160a01b0383161580159061254857506001600160a01b0383165f9081526013602052604090205442105b156125665760405163de1af48d60e01b815260040160405180910390fd5b610eac838383612c96565b5f65ffffffffffff8211156125a3576040516306dfcc6560e41b81526030600482015260248101839052604401610f02565b5090565b5f600182116125b4575090565b816001600160801b82106125cd5760809190911c9060401b5b600160401b82106125e35760409190911c9060201b5b64010000000082106125fa5760209190911c9060101b5b62010000821061260f5760109190911c9060081b5b61010082106126235760089190911c9060041b5b601082106126365760049190911c9060021b5b600482106126425760011b5b600302600190811c9081858161265a5761265a613758565b048201901c9050600181858161267257612672613758565b048201901c9050600181858161268a5761268a613758565b048201901c905060018185816126a2576126a2613758565b048201901c905060018185816126ba576126ba613758565b048201901c905060018185816126d2576126d2613758565b048201901c90506126f18185816126eb576126eb613758565b04821190565b90039392505050565b5f5b81831015612751575f61270f8484612cfc565b5f8781526020902090915065ffffffffffff86169082015465ffffffffffff16111561273d5780925061274b565b61274881600161352a565b93505b506126fc565b509392505050565b6001600160a01b03821661278257604051634b637e8f60e11b81525f6004820152602401610f02565b6109e6825f8361251a565b6001600160a01b0381165f908152602081905260408120546109d5565b816001600160a01b0316836001600160a01b0316141580156127cb57505f81115b15610eac576001600160a01b03831615612872576001600160a01b0383165f908152600960205260408120819061280d906119ee61280886612d16565b612d49565b6001600160d01b031691506001600160d01b03169150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612867929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610eac576001600160a01b0382165f90815260096020526040812081906128aa906119f961280886612d16565b6001600160d01b031691506001600160d01b03169150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612904929190918252602082015260400190565b60405180910390a25050505050565b5f5f60205f8451602086015f885af180612932576040513d5f823e3d81fd5b50505f513d91508115612949578060011415612956565b6001600160a01b0384163b155b15611d9057604051635274afe760e01b81526001600160a01b0385166004820152602401610f02565b5f63ffffffff8211156125a3576040516306dfcc6560e41b81526020600482015260248101839052604401610f02565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b606060ff8314612a1a57612a1383612d81565b90506109d5565b818054612a26906134de565b80601f0160208091040260200160405190810160405280929190818152602001828054612a52906134de565b8015612a9d5780601f10612a7457610100808354040283529160200191612a9d565b820191905f5260205f20905b815481529060010190602001808311612a8057829003601f168201915b505050505090506109d5565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115612ae257505f91506003905082612b67565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015612b33573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116612b5e57505f925060019150829050612b67565b92505f91508190505b9450945094915050565b5f826003811115612b8457612b846131ea565b03612b8d575050565b6001826003811115612ba157612ba16131ea565b03612bbf5760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115612bd357612bd36131ea565b03612bf45760405163fce698f760e01b815260048101829052602401610f02565b6003826003811115612c0857612c086131ea565b036109e6576040516335e2f38360e21b815260048101829052602401610f02565b604080518082019091525f8082526020820152825f018263ffffffff1681548110612c5657612c5661378b565b5f9182526020918290206040805180820190915291015465ffffffffffff81168252600160301b90046001600160d01b0316918101919091529392505050565b612ca1838383612dbe565b6001600160a01b038316612cf1575f612cb960025490565b90506001600160d01b0380821115612cee57604051630e58ae9360e11b81526004810183905260248101829052604401610f02565b50505b610eac838383612ee4565b5f612d0a600284841861376c565b61179b9084841661352a565b5f6001600160d01b038211156125a3576040516306dfcc6560e41b815260d0600482015260248101839052604401610f02565b5f5f612d74612d566113d1565b612d6c612d62886122ff565b868863ffffffff16565b879190612f59565b915091505b935093915050565b60605f612d8d83612f66565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b6001600160a01b038316612de8578060025f828254612ddd919061352a565b90915550612e589050565b6001600160a01b0383165f9081526020819052604090205481811015612e3a5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610f02565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b038216612e7457600280548290039055612e92565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ed791815260200190565b60405180910390a3505050565b6001600160a01b038316612f0657612f03600a6119f961280884612d16565b50505b6001600160a01b038216612f2857612f25600a6119ee61280884612d16565b50505b6001600160a01b038381165f90815260086020526040808220548584168352912054610eac929182169116836127aa565b5f80612d74858585612f8d565b5f60ff8216601f8111156109d557604051632cd44ac360e21b815260040160405180910390fd5b82545f9081908015613083575f612fa987611fea60018561353d565b805490915065ffffffffffff80821691600160301b90046001600160d01b0316908816821115612fec57604051632520601d60e01b815260040160405180910390fd5b8765ffffffffffff168265ffffffffffff160361302557825465ffffffffffff16600160301b6001600160d01b03891602178355613075565b6040805180820190915265ffffffffffff808a1682526001600160d01b03808a1660208085019182528d54600181018f555f8f81529190912094519151909216600160301b029216919091179101555b9450859350612d7992505050565b50506040805180820190915265ffffffffffff80851682526001600160d01b0380851660208085019182528854600181018a555f8a815291822095519251909316600160301b029190931617920191909155905081612d79565b5f602082840312156130ed575f5ffd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f61179b60208301846130f4565b80356001600160a01b038116811461314a575f5ffd5b919050565b5f5f60408385031215613160575f5ffd5b61316983613134565b946020939093013593505050565b8035801515811461314a575f5ffd5b5f5f60408385031215613197575f5ffd5b823591506131a760208401613177565b90509250929050565b5f5f5f606084860312156131c2575f5ffd5b6131cb84613134565b92506131d960208501613134565b929592945050506040919091013590565b634e487b7160e01b5f52602160045260245ffd5b602081016009831061321e57634e487b7160e01b5f52602160045260245ffd5b91905290565b5f5f60408385031215613235575f5ffd5b823591506131a760208401613134565b5f60208284031215613255575f5ffd5b61179b82613134565b5f5f5f5f60608587031215613271575f5ffd5b61327a85613134565b93506020850135925060408501356001600160401b0381111561329b575f5ffd5b8501601f810187136132ab575f5ffd5b80356001600160401b038111156132c0575f5ffd5b8760208284010111156132d1575f5ffd5b949793965060200194505050565b60ff60f81b8816815260e060208201525f6132fd60e08301896130f4565b828103604084015261330f81896130f4565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b81811015613364578351835260209384019390920191600101613346565b50909b9a5050505050505050505050565b803560ff8116811461314a575f5ffd5b5f5f5f5f5f5f60c0878903121561339a575f5ffd5b863595506133aa60208801613177565b9450604087013593506133bf60608801613375565b9598949750929560808101359460a0909101359350915050565b5f5f5f5f5f5f60c087890312156133ee575f5ffd5b6133f787613134565b955060208701359450604087013593506133bf60608801613375565b5f5f5f5f5f5f5f60e0888a031215613429575f5ffd5b61343288613134565b965061344060208901613134565b9550604088013594506060880135935061345c60808901613375565b9699959850939692959460a0840135945060c09093013592915050565b5f5f6040838503121561348a575f5ffd5b61349383613134565b91506131a760208401613134565b5f5f604083850312156134b2575f5ffd5b6134bb83613134565b9150602083013563ffffffff811681146134d3575f5ffd5b809150509250929050565b600181811c908216806134f257607f821691505b60208210810361351057634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b808201808211156109d5576109d5613516565b818103818111156109d5576109d5613516565b818382375f9101908152919050565b5f6001820161357057613570613516565b5060010190565b634e487b7160e01b5f52604160045260245ffd5b601f821115610eac57805f5260205f20601f840160051c810160208510156135b05750805b601f840160051c820191505b818110156135cf575f81556001016135bc565b5050505050565b6001600160401b038311156135ed576135ed613577565b613601836135fb83546134de565b8361358b565b5f601f841160018114613632575f851561361b5750838201355b5f19600387901b1c1916600186901b1783556135cf565b5f83815260208120601f198716915b828110156136615786850135825560209485019460019092019101613641565b508682101561367d575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b8581526001600160401b03851660208201526001600160401b038416604082015260806060820152816080820152818360a08301375f81830160a090810191909152601f909201601f19160101949350505050565b6001600160d01b0382811682821603908111156109d5576109d5613516565b6001600160d01b0381811683821601908111156109d5576109d5613516565b6001600160801b0381811683821601908111156109d5576109d5613516565b80820281158282048414176109d5576109d5613516565b634e487b7160e01b5f52601260045260245ffd5b5f8261378657634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffdfea264697066735822122054cc60bf2eae13959362736b309dcd8a96534f391967c1940183fe077379a20964736f6c634300081e0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000e544354205465737420546f6b656e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045443545400000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name (string): TCT Test Token
Arg [1] : symbol (string): TCTT
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [3] : 544354205465737420546f6b656e000000000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [5] : 5443545400000000000000000000000000000000000000000000000000000000
Deployed Bytecode Sourcemap
222437:13092:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;224492:49;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;224492:49:0;;;;-1:-1:-1;;;224492:49:0;;;;;-1:-1:-1;;;224492:49:0;;;;;;-1:-1:-1;;;224492:49:0;;;;;;;-1:-1:-1;;;;;224492:49:0;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;224492:49:0;;;;;;-1:-1:-1;;;;;;;;224492:49:0;;;;;-1:-1:-1;;;;;224492:49:0;;;;;;;;;;;-1:-1:-1;;;;;1149:31:1;;;1131:50;;1217:31;;;1212:2;1197:18;;1190:59;1285:31;;;1265:18;;;1258:59;;;;1353:31;;;;1348:2;1333:18;;1326:59;-1:-1:-1;;;;;1422:47:1;;;1416:3;1401:19;;1394:76;311:46;;;1521:3;1506:19;;299:59;311:46;;1577:3;1562:19;;299:59;439:13;;432:21;1630:3;1615:19;;420:34;439:13;432:21;1683:3;1668:19;;420:34;-1:-1:-1;;;;;531:42:1;1739:3;1724:19;;519:55;-1:-1:-1;;;;;651:31:1;;;1796:3;1781:19;;639:44;651:31;;;;1853:3;1838:19;;639:44;1118:3;1103:19;224492:49:0;;;;;;;;12986:91;;;:::i;:::-;;;;;;;:::i;15196:190::-;;;;;;:::i;:::-;;:::i;:::-;;;3036:14:1;;3029:22;3011:41;;2999:2;2984:18;15196:190:0;2871:187:1;228731:122:0;;;;;;:::i;:::-;;:::i;:::-;;14059:99;14138:12;;14059:99;;;3673:25:1;;;3661:2;3646:18;14059:99:0;3527:177:1;15996:249:0;;;;;;:::i;:::-;;:::i;222647:52::-;;222688:11;222647:52;;226300:84;;;226350:5;4230:36:1;;4218:2;4203:18;226300:84:0;4088:184:1;222706:50:0;;222743:13;222706:50;;153469:114;;;:::i;222903:48::-;;222945:6;222903:48;;234057:153;;;;;;:::i;:::-;;:::i;188069:200::-;;;;;;:::i;:::-;;:::i;233030:859::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;234479:107::-;;;:::i;232059:402::-;;;;;;:::i;:::-;;:::i;234921:164::-;;;;;;:::i;:::-;;:::i;233897:152::-;;;;;;:::i;:::-;233973:4;233997:28;;;:16;:28;;;;;;;;-1:-1:-1;;;;;233997:44:0;;;;:37;;:44;;;;;;;;233897:152;;;;;186779:278;;;:::i;224794:47::-;;;;;;:::i;:::-;;;;;;;;;;;;;;189384:119;;;;;;:::i;:::-;-1:-1:-1;;;;;189476:19:0;;;189449:7;189476:19;;;:10;:19;;;;;;;;189384:119;;;;-1:-1:-1;;;;;5603:32:1;;;5585:51;;5573:2;5558:18;189384:119:0;5439:203:1;189590:141:0;;;;;;:::i;:::-;;:::i;224465:18::-;;;;;;;;;234594:270;;;;;;:::i;:::-;;:::i;223013:44::-;;223054:3;223013:44;;196829:128;;;;;;:::i;:::-;;:::i;:::-;;;5821:10:1;5809:23;;;5791:42;;5779:2;5764:18;196829:128:0;5647:192:1;14194:118:0;;;;;;:::i;:::-;-1:-1:-1;;;;;14286:18:0;14259:7;14286:18;;;;;;;;;;;;14194:118;199556:103;;;:::i;202684:235::-;;;:::i;235093:195::-;;;;;;:::i;:::-;;:::i;226782:1941::-;;;;;;:::i;:::-;;:::i;235349:177::-;;;;;;:::i;:::-;;:::i;234369:102::-;;;:::i;147918:580::-;;;:::i;:::-;;;;;;;;;;;;;:::i;198881:87::-;198954:6;;-1:-1:-1;;;;;198954:6:0;198881:87;;188919:177;;;;;;:::i;:::-;;:::i;186520:98::-;;;:::i;:::-;;;8041:14:1;8029:27;;;8011:46;;7999:2;7984:18;186520:98:0;7867:196:1;13196:95:0;;;:::i;187537:137::-;;;;;;:::i;:::-;;:::i;223088:52::-;;223136:4;223088:52;;224647:46;;;;;;:::i;:::-;;;;;;;;;;;;;;223166:52;;223211:7;223166:52;;14517:182;;;;;;:::i;:::-;;:::i;222850:46::-;;222890:6;222850:46;;222958;;222997:7;222958:46;;228861:955;;;;;;:::i;:::-;;:::i;189814:573::-;;;;;;:::i;:::-;;:::i;152491:695::-;;;;;;:::i;:::-;;:::i;222798:45::-;;222837:6;222798:45;;234218:93;234291:12;;234218:93;;14735:142;;;;;;:::i;:::-;-1:-1:-1;;;;;14842:18:0;;;14815:7;14842:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;;;;14735:142;224700:49;;;;;;:::i;:::-;;;;;;;;;;;;;;201645:101;201725:13;;-1:-1:-1;;;;;201725:13:0;201645:101;;197039:165;;;;;;:::i;:::-;;:::i;:::-;;;;11362:13:1;;11377:14;11358:34;11340:53;;11453:4;11441:17;;;11435:24;-1:-1:-1;;;;;11431:50:1;11409:20;;;11402:80;;;;11313:18;197039:165:0;11132:356:1;202072:181:0;;;;;;:::i;:::-;;:::i;231329:722::-;;;;;;:::i;:::-;;:::i;12986:91::-;13031:13;13064:5;13057:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12986:91;:::o;15196:190::-;15269:4;4385:10;15325:31;4385:10;15341:7;15350:5;15325:8;:31::i;:::-;15374:4;15367:11;;;15196:190;;;;;:::o;228731:122::-;228803:42;228813:10;228825;228837:7;228803:9;:42::i;:::-;228731:122;;:::o;15996:249::-;16083:4;4385:10;16141:37;16157:4;4385:10;16172:5;16141:15;:37::i;:::-;16189:26;16199:4;16205:2;16209:5;16189:9;:26::i;:::-;-1:-1:-1;16233:4:0;;15996:249;-1:-1:-1;;;;15996:249:0:o;153469:114::-;153528:7;153555:20;:18;:20::i;:::-;153548:27;;153469:114;:::o;234057:153::-;234162:28;;;;:16;:28;;;;;234155:47;;234129:13;;234162:28;234155:47;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;234057:153;;;:::o;188069:200::-;188156:7;188183:78;188231:29;188250:9;188231:18;:29::i;:::-;-1:-1:-1;;;;;188183:29:0;;;;;;:20;:29;;;;;;:47;:78::i;:::-;-1:-1:-1;;;;;188176:85:0;;188069:200;-1:-1:-1;;;188069:200:0:o;233030:859::-;233088:13;233118:21;;;:9;:21;;;;;:32;-1:-1:-1;;;233118:32:0;;-1:-1:-1;;;;;233118:32:0;:37;;233114:71;;-1:-1:-1;233164:21:0;;233030:859;-1:-1:-1;233030:859:0:o;233114:71::-;233198:29;233230:21;;;:9;:21;;;;;233268:18;;;;-1:-1:-1;;;233268:18:0;;;;233264:54;;;-1:-1:-1;233295:23:0;;233030:859;-1:-1:-1;;233030:859:0:o;233264:54::-;233333:17;;;;-1:-1:-1;;;233333:17:0;;;;233329:52;;;-1:-1:-1;233359:22:0;;233030:859;-1:-1:-1;;233030:859:0:o;233329:52::-;233414:18;;-1:-1:-1;;;;;233414:18:0;233396:15;:36;233392:70;;;-1:-1:-1;233441:21:0;;233030:859;-1:-1:-1;;233030:859:0:o;233392:70::-;233496:16;;-1:-1:-1;;;233496:16:0;;-1:-1:-1;;;;;233496:16:0;233477:15;:35;233473:68;;-1:-1:-1;233521:20:0;;233030:859;-1:-1:-1;;233030:859:0:o;233473:68::-;233554:14;233571:30;233590:10;233571:18;:30::i;:::-;233554:47;;233617:9;233612:45;;-1:-1:-1;233635:22:0;;233030:859;-1:-1:-1;;;233030:859:0:o;233612:45::-;233692:21;;-1:-1:-1;;;233692:21:0;;-1:-1:-1;;;;;233692:21:0;233674:15;:39;233670:72;;;-1:-1:-1;233722:20:0;;233030:859;-1:-1:-1;;;233030:859:0:o;233670:72::-;233776:21;;:36;;222997:7;;-1:-1:-1;;;233776:21:0;;-1:-1:-1;;;;;233776:21:0;:36;:::i;:::-;233757:15;:55;233753:87;;-1:-1:-1;233821:19:0;;233030:859;-1:-1:-1;;;233030:859:0:o;233753:87::-;-1:-1:-1;233860:21:0;;233030:859;-1:-1:-1;;;233030:859:0:o;234479:107::-;198767:13;:11;:13::i;:::-;234528:6:::1;:14:::0;;-1:-1:-1;;234528:14:0::1;::::0;;234558:20:::1;::::0;234567:10:::1;5585:51:1::0;;234558:20:0::1;::::0;5573:2:1;5558:18;234558:20:0::1;;;;;;;;234479:107::o:0;232059:402::-;225841:21;;;;:9;:21;;;;;:32;:21;;-1:-1:-1;;;225841:32:0;;;-1:-1:-1;;;;;225841:32:0;:37;;225837:67;;225887:17;;-1:-1:-1;;;225887:17:0;;;;;;;;;;;225837:67;232141:29:::1;232173:21:::0;;;:9:::1;:21;::::0;;;;232211:17:::1;::::0;::::1;::::0;-1:-1:-1;;;232211:17:0;::::1;;;::::0;:39:::1;;-1:-1:-1::0;232232:18:0::1;::::0;::::1;::::0;-1:-1:-1;;;232232:18:0;::::1;;;232211:39;232207:69;;;232259:17;;-1:-1:-1::0;;;232259:17:0::1;;;;;;;;;;;232207:69;232305:17;::::0;::::1;::::0;-1:-1:-1;;;;;232305:17:0::1;232291:10;:31;::::0;::::1;::::0;:56:::1;;-1:-1:-1::0;198954:6:0;;-1:-1:-1;;;;;198954:6:0;232326:10:::1;:21;;232291:56;232287:83;;;232356:14;;-1:-1:-1::0;;;232356:14:0::1;;;;;;;;;;;232287:83;232383:18;::::0;::::1;:25:::0;;-1:-1:-1;;;;232383:25:0::1;-1:-1:-1::0;;;232383:25:0::1;::::0;;232424:29:::1;::::0;232442:10;;232424:29:::1;::::0;232383:25;;232424:29:::1;232130:331;232059:402:::0;;:::o;234921:164::-;234994:6;234978:12;;:22;;;;;;;:::i;:::-;;;;-1:-1:-1;;235016:32:0;;3673:25:1;;;235029:10:0;;235016:32;;3661:2:1;3646:18;235016:32:0;;;;;;;235059:18;235070:6;235059:10;:18::i;:::-;234921:164;:::o;186779:278::-;186830:13;186921:18;:16;:18::i;:::-;186910:29;;:7;:5;:7::i;:::-;:29;;;186906:95;;186963:26;;-1:-1:-1;;;186963:26:0;;;;;;;;;;;186906:95;-1:-1:-1;187011:38:0;;;;;;;;;;;;;;;;;;186779:278::o;189590:141::-;4385:10;189694:29;4385:10;189713:9;189694;:29::i;234594:270::-;198767:13;:11;:13::i;:::-;205271:21:::1;:19;:21::i;:::-;234772:4:::2;-1:-1:-1::0;;;;;234748:29:0;::::2;::::0;234744:56:::2;;234786:14;;-1:-1:-1::0;;;234786:14:0::2;;;;;;;;;;;234744:56;234811:45;-1:-1:-1::0;;;;;234811:33:0;::::2;234845:2:::0;234849:6;234811:33:::2;:45::i;:::-;205315:20:::1;204709:1:::0;205835:7;:22;205652:213;205315:20:::1;234594:270:::0;;;:::o;196829:128::-;196899:6;196925:24;196941:7;196925:15;:24::i;199556:103::-;198767:13;:11;:13::i;:::-;199621:30:::1;199648:1;199621:18;:30::i;:::-;199556:103::o:0;202684:235::-;201725:13;;4385:10;;-1:-1:-1;;;;;201725:13:0;202781:24;;202777:98;;202829:34;;-1:-1:-1;;;202829:34:0;;-1:-1:-1;;;;;5603:32:1;;202829:34:0;;;5585:51:1;5558:18;;202829:34:0;;;;;;;;202777:98;202885:26;202904:6;202885:18;:26::i;235093:195::-;235187:6;235171:12;;:22;;;;;;;:::i;:::-;;;;-1:-1:-1;;235209:29:0;;3673:25:1;;;-1:-1:-1;;;;;235209:29:0;;;;;3661:2:1;3646:18;235209:29:0;;;;;;;235249:31;235264:7;235273:6;235249:14;:31::i;226782:1941::-;225724:6;;226929:7;;225724:6;;225720:35;;;225739:16;;-1:-1:-1;;;225739:16:0;;;;;;;;;;;225720:35;-1:-1:-1;;;;;226977:23:0;::::1;226973:50;;227009:14;;-1:-1:-1::0;;;227009:14:0::1;;;;;;;;;;;226973:50;198954:6:::0;;-1:-1:-1;;;;;227038:20:0;;::::1;198954:6:::0;;227038:20:::1;227034:52;;227067:19;;-1:-1:-1::0;;;227067:19:0::1;;;;;;;;;;;227034:52;227101:11:::0;;;:50:::1;;-1:-1:-1::0;14138:12:0;;227125:26:::1;::::0;222743:13:::1;227125:26;:::i;:::-;227116:6;:35;227101:50;227097:81;;;227160:18;;-1:-1:-1::0;;;227160:18:0::1;;;;;;;;;;;227097:81;227193:30:::0;;;:66:::1;;-1:-1:-1::0;227255:4:0::1;227227:32:::0;::::1;227193:66;227189:93;;;227268:14;;-1:-1:-1::0;;;227268:14:0::1;;;;;;;;;;;227189:93;227335:21;227359:42;227372:10;227384:16;227399:1;227384:12;:16;:::i;227359:42::-;227335:66;;223211:7;227416:13;:34;227412:72;;;227459:25;;-1:-1:-1::0;;;227459:25:0::1;;;;;;;;;;;227412:72;227537:20;227581:9;227592:6;227616:11;;227600:29;;;;;;;:::i;:::-;;::::0;;;;;::::1;::::0;;-1:-1:-1;;;;;12769:32:1;;;227570:60:0::1;::::0;::::1;12751:51:1::0;12818:18;;12811:34;;;;12861:18;;;12854:34;;;;12724:18;;227570:60:0::1;::::0;;-1:-1:-1;;227570:60:0;;::::1;::::0;;;;;;227560:71;;227570:60:::1;227560:71:::0;;::::1;::::0;227646:29:::1;::::0;;;:15:::1;:29:::0;;;;;;227560:71;;-1:-1:-1;227646:29:0::1;;227642:61;;;227684:19;;-1:-1:-1::0;;;227684:19:0::1;;;;;;;;;;;227642:61;227714:29;::::0;;;:15:::1;:29;::::0;;;;:36;;-1:-1:-1;;227714:36:0::1;227746:4;227714:36;::::0;;227786:14:::1;227784:16:::0;;227714:29;;227784:16:::1;::::0;::::1;:::i;:::-;::::0;;;;-1:-1:-1;227841:29:0::1;227873:21:::0;;;:9:::1;:21;::::0;;;;227905:40;;-1:-1:-1;;;;;227905:40:0::1;-1:-1:-1::0;;;;;;;;227905:40:0;::::1;;;::::0;;227784:16;;-1:-1:-1;227984:30:0::1;222837:6;227984:15;:30;:::i;:::-;227956:59:::0;;-1:-1:-1;;227956:59:0::1;-1:-1:-1::0;;;;;227956:59:0;;;::::1;;::::0;;222890:6:::1;228052:30;222837:6;228052:15;:30;:::i;:::-;:46;;;;:::i;:::-;228026:73:::0;;-1:-1:-1;;;;;228026:73:0;;;::::1;-1:-1:-1::0;;;228026:73:0::1;-1:-1:-1::0;;228026:73:0;;::::1;;::::0;;222945:6:::1;222890;228141:30;222837:6;228141:15;:30;:::i;:::-;:46;;;;:::i;:::-;:64;;;;:::i;:::-;228110:96:::0;;-1:-1:-1;;;;228110:96:0::1;-1:-1:-1::0;;;;;;;;228110:96:0;;;::::1;::::0;;;::::1;;::::0;;228217:22:::1;::::0;::::1;:46:::0;;-1:-1:-1;;;228274:33:0;-1:-1:-1;;;228250:12:0::1;-1:-1:-1::0;;;;;228217:46:0::1;;-1:-1:-1::0;;228274:33:0;;-1:-1:-1;;;;;228274:33:0;::::1;;::::0;;228318:17:::1;::::0;::::1;:30:::0;;228338:10:::1;-1:-1:-1::0;;;;;;228318:30:0;;::::1;;::::0;;;228359:18:::1;::::0;::::1;:30:::0;;;;::::1;-1:-1:-1::0;;;;;228359:30:0;::::1;;::::0;;-1:-1:-1;228402:28:0;;;228217:22:::1;228402:28;::::0;;;;:54:::1;228445:11:::0;;228402:28;:54:::1;:::i;:::-;-1:-1:-1::0;228599:18:0;;228474:211:::1;::::0;-1:-1:-1;;;;;228474:211:0;::::1;::::0;228529:10:::1;::::0;228504;;228474:211:::1;::::0;::::1;::::0;228578:6;;-1:-1:-1;;;;;228599:18:0;;::::1;::::0;-1:-1:-1;;;228632:16:0;::::1;;::::0;228663:11;;;;228474:211:::1;:::i;:::-;;;;;;;;-1:-1:-1::0;228705:10:0;226782:1941;-1:-1:-1;;;;;;;226782:1941:0:o;235349:177::-;235467:7;235499:19;235512:5;235499:12;:19::i;234369:102::-;198767:13;:11;:13::i;:::-;234416:6:::1;:13:::0;;-1:-1:-1;;234416:13:0::1;234425:4;234416:13;::::0;;234445:18:::1;::::0;234452:10:::1;5585:51:1::0;;234445:18:0::1;::::0;5573:2:1;5558:18;234445::0::1;5439:203:1::0;147918:580:0;148021:13;148049:18;148082:21;148118:15;148148:25;148188:12;148215:27;148323:13;:11;:13::i;:::-;148351:16;:14;:16::i;:::-;148463;;;148446:1;148463:16;;;;;;;;;-1:-1:-1;;;148270:220:0;;;-1:-1:-1;148270:220:0;;-1:-1:-1;148382:13:0;;-1:-1:-1;148418:4:0;;-1:-1:-1;148446:1:0;-1:-1:-1;148463:16:0;-1:-1:-1;148270:220:0;-1:-1:-1;147918:580:0:o;188919:177::-;188995:7;189022:66;189058:29;189077:9;189058:18;:29::i;:::-;189022:17;;:35;:66::i;:::-;-1:-1:-1;;;;;189015:73:0;;188919:177;-1:-1:-1;;188919:177:0:o;186520:98::-;186566:6;186592:18;:16;:18::i;13196:95::-;13243:13;13276:7;13269:14;;;;;:::i;187537:137::-;-1:-1:-1;;;;;187628:29:0;;187601:7;187628:29;;;:20;:29;;;;;:38;;:36;:38::i;14517:182::-;14586:4;4385:10;14642:27;4385:10;14659:2;14663:5;14642:9;:27::i;228861:955::-;229070:8;229052:15;:26;229048:57;;;229087:18;;-1:-1:-1;;;229087:18:0;;;;;;;;;;;229048:57;229134:10;229118:13;229171:19;;;:12;:19;;;;;:21;;;229118:13;229171:21;;;:::i;:::-;;;;-1:-1:-1;229250:279:0;;;229279:97;229250:279;;;16136:25:1;16177:18;;;16170:34;;;16247:14;;16240:22;16220:18;;;16213:50;16279:18;;;16272:34;;;16322:19;;;16315:35;;;229501:13:0;16366:19:1;;;16359:35;229155:37:0;;-1:-1:-1;229205:18:0;;16108:19:1;;229250:279:0;;;;;;;;;;;;229226:314;;;;;;229205:335;;229553:12;229568:28;229585:10;229568:16;:28::i;:::-;229632:24;;;229607:22;229632:24;;;;;;;;;16632:25:1;;;16705:4;16693:17;;16673:18;;;16666:45;;;;16727:18;;;16720:34;;;16770:18;;;16763:34;;;229553:43:0;;-1:-1:-1;229607:22:0;229632:24;;16604:19:1;;229632:24:0;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;229632:24:0;;-1:-1:-1;;229632:24:0;;;-1:-1:-1;;;;;;;229673:28:0;;;;:55;;;229723:5;-1:-1:-1;;;;;229705:23:0;:14;-1:-1:-1;;;;;229705:23:0;;;229673:55;229669:82;;;229737:14;;-1:-1:-1;;;229737:14:0;;;;;;;;;;;229669:82;229762:46;229772:10;229784:14;229800:7;229762:9;:46::i;:::-;229037:779;;;;;228861:955;;;;;;:::o;189814:573::-;190027:6;190009:15;:24;190005:93;;;190057:29;;-1:-1:-1;;;190057:29:0;;;;;3673:25:1;;;3646:18;;190057:29:0;3527:177:1;190005:93:0;190180:57;;;185772:71;190180:57;;;17039:25:1;-1:-1:-1;;;;;17100:32:1;;17080:18;;;17073:60;;;;17149:18;;;17142:34;;;17192:18;;;17185:34;;;190108:14:0;;190125:173;;190153:86;;17011:19:1;;190180:57:0;;;;;;;;;;;;190170:68;;;;;;190153:16;:86::i;:::-;190254:1;190270;190286;190125:13;:173::i;:::-;190108:190;;190309:31;190326:6;190334:5;190309:16;:31::i;:::-;190351:28;190361:6;190369:9;190351;:28::i;:::-;189994:393;189814:573;;;;;;:::o;152491:695::-;152721:8;152703:15;:26;152699:99;;;152753:33;;-1:-1:-1;;;152753:33:0;;;;;3673:25:1;;;3646:18;;152753:33:0;3527:177:1;152699:99:0;152810:18;151827:95;152869:5;152876:7;152885:5;152892:16;152902:5;-1:-1:-1;;;;;150609:14:0;150302:7;150609:14;;;:7;:14;;;;;:16;;;;;;;;;150242:402;152892:16;152841:78;;;;;;17517:25:1;;;;-1:-1:-1;;;;;17578:32:1;;;17558:18;;;17551:60;17647:32;;;;17627:18;;;17620:60;17696:18;;;17689:34;17739:19;;;17732:35;17783:19;;;17776:35;;;17489:19;;152841:78:0;;;;;;;;;;;;152831:89;;;;;;152810:110;;152933:12;152948:28;152965:10;152948:16;:28::i;:::-;152933:43;;152989:14;153006:28;153020:4;153026:1;153029;153032;153006:13;:28::i;:::-;152989:45;;153059:5;-1:-1:-1;;;;;153049:15:0;:6;-1:-1:-1;;;;;153049:15:0;;153045:90;;153088:35;;-1:-1:-1;;;153088:35:0;;-1:-1:-1;;;;;18014:32:1;;;153088:35:0;;;17996:51:1;18083:32;;18063:18;;;18056:60;17969:18;;153088:35:0;17822:300:1;153045:90:0;153147:31;153156:5;153163:7;153172:5;153147:8;:31::i;:::-;152688:498;;;152491:695;;;;;;;:::o;197039:165::-;-1:-1:-1;;;;;;;;;;;;;;;;;197170:26:0;197183:7;197192:3;197170:12;:26::i;:::-;197163:33;197039:165;-1:-1:-1;;;197039:165:0:o;202072:181::-;198767:13;:11;:13::i;:::-;202162::::1;:24:::0;;-1:-1:-1;;;;;202162:24:0;::::1;-1:-1:-1::0;;;;;;202162:24:0;;::::1;::::0;::::1;::::0;;;202227:7:::1;198954:6:::0;;-1:-1:-1;;;;;198954:6:0;;198881:87;202227:7:::1;-1:-1:-1::0;;;;;202202:43:0::1;;;;;;;;;;;202072:181:::0;:::o;231329:722::-;225724:6;;;;225720:35;;;225739:16;;-1:-1:-1;;;225739:16:0;;;;;;;;;;;225720:35;205271:21:::1;:19;:21::i;:::-;225841::::2;::::0;;;:9:::2;:21;::::0;;;;:32;:21;;-1:-1:-1;;;225841:32:0;;::::2;-1:-1:-1::0;;;;;225841:32:0::2;:37:::0;;225837:67:::2;;225887:17;;-1:-1:-1::0;;;225887:17:0::2;;;;;;;;;;;225837:67;231480:29:::3;231512:21:::0;;;:9:::3;:21;::::0;;;;231550:17:::3;::::0;::::3;::::0;-1:-1:-1;;;231550:17:0;::::3;;;231546:47;;;231576:17;;-1:-1:-1::0;;;231576:17:0::3;;;;;;;;;;;231546:47;231608:18;::::0;::::3;::::0;-1:-1:-1;;;231608:18:0;::::3;;;231604:48;;;231635:17;;-1:-1:-1::0;;;231635:17:0::3;;;;;;;;;;;231604:48;231685:21:::0;;-1:-1:-1;;;231685:21:0;::::3;-1:-1:-1::0;;;;;231685:21:0::3;231667:15;:39;231663:70;;;231715:18;;-1:-1:-1::0;;;231715:18:0::3;;;;;;;;;;;231663:70;231766:21:::0;;:36:::3;::::0;222997:7:::3;::::0;-1:-1:-1;;;231766:21:0;::::3;-1:-1:-1::0;;;;;231766:21:0::3;:36;:::i;:::-;231748:15;:54;231744:84;;;231811:17;;-1:-1:-1::0;;;231811:17:0::3;;;;;;;;;;;231744:84;231846:30;231865:10;231846:18;:30::i;:::-;231841:66;;231885:22;;-1:-1:-1::0;;;231885:22:0::3;;;;;;;;;;;231841:66;231920:17;::::0;::::3;:24:::0;;-1:-1:-1;;;;231920:24:0;::::3;-1:-1:-1::0;;;231920:24:0::3;::::0;;;231961:18:::3;::::0;::::3;::::0;231955:42:::3;::::0;-1:-1:-1;;;;;231961:18:0;;::::3;::::0;-1:-1:-1;;;;;231981:15:0;231955:5:::3;:42::i;:::-;232015:28;::::0;232032:10;;232015:28:::3;::::0;;;::::3;231469:582;205303:1:::2;205315:20:::1;204709:1:::0;205835:7;:22;205652:213;193367:103;193430:7;193457:5;193461:1;193457;:5;:::i;193261:98::-;193319:7;193346:5;193350:1;193346;:5;:::i;20055:130::-;20140:37;20149:5;20156:7;20165:5;20172:4;20140:8;:37::i;229824:1497::-;205271:21;:19;:21::i;:::-;225841::::1;::::0;;;:9:::1;:21;::::0;;;;:32;:21;;-1:-1:-1;;;225841:32:0;;::::1;-1:-1:-1::0;;;;;225841:32:0::1;:37:::0;;225837:67:::1;;225887:17;;-1:-1:-1::0;;;225887:17:0::1;;;;;;;;;;;225837:67;-1:-1:-1::0;;;;;230048:18:0;::::2;;::::0;;;:11:::2;:18;::::0;;;;;230069:15:::2;-1:-1:-1::0;230048:75:0;::::2;;;-1:-1:-1::0;;;;;;230088:21:0;::::2;;::::0;;;:14:::2;:21;::::0;;;;;:35;::::2;;230048:75;230044:129;;;230147:14;;-1:-1:-1::0;;;230147:14:0::2;;;;;;;;;;;230044:129;230185:29;230217:21:::0;;;:9:::2;:21;::::0;;;;198954:6;;-1:-1:-1;;;;;198954:6:0;-1:-1:-1;;;;;230255:16:0::2;:5;-1:-1:-1::0;;;;;230255:16:0::2;::::0;230251:157:::2;;230295:14;;-1:-1:-1::0;;;230295:14:0::2;;;;;;;;;;;230251:157;230474:18:::0;;-1:-1:-1;;;;;230474:18:0::2;230456:15;:36;::::0;:74:::2;;-1:-1:-1::0;230514:16:0;;-1:-1:-1;;;230514:16:0;::::2;-1:-1:-1::0;;;;;230514:16:0::2;230496:15;:34;230456:74;230452:133;;;230554:19;;-1:-1:-1::0;;;230554:19:0::2;;;;;;;;;;;230452:133;230636:28;::::0;;;:16:::2;:28;::::0;;;;;;;-1:-1:-1;;;;;230636:44:0;::::2;::::0;;:37:::2;;:44:::0;;;;;;::::2;;230632:71;;;230689:14;;-1:-1:-1::0;;;230689:14:0::2;;;;;;;;;;;230632:71;230781:22;::::0;::::2;::::0;230745:13:::2;::::0;230761:43:::2;::::0;230774:5;;-1:-1:-1;;;230781:22:0;::::2;-1:-1:-1::0;;;;;230781:22:0::2;230761:12;:43::i;:::-;230745:59;;230819:5;230828:1;230819:10:::0;230815:48:::2;;230838:25;;-1:-1:-1::0;;;230838:25:0::2;;;;;;;;;;;230815:48;230900:28;::::0;;;:16:::2;:28;::::0;;;;;;;-1:-1:-1;;;;;230900:44:0;::::2;::::0;;230947:4:::2;230900:37:::0;;::::2;:44:::0;;;;;;:51;;-1:-1:-1;;230900:51:0::2;::::0;;::::2;::::0;;230964:147;::::2;;;230992:17;::::0;::::2;:35:::0;;231021:5;;230992:17;::::2;::::0;:35:::2;::::0;231021:5;;-1:-1:-1;;;;;230992:35:0::2;;:::i;:::-;;;;;;;;-1:-1:-1::0;;;;;230992:35:0::2;;;;;-1:-1:-1::0;;;;;230992:35:0::2;;;;;;230964:147;;;231093:5;231060:8;:21;;;:39;;;;;;;;;;-1:-1:-1::0;;;;;231060:39:0::2;;;;;:::i;:::-;;;;;;;;-1:-1:-1::0;;;;;231060:39:0::2;;;;;-1:-1:-1::0;;;;;231060:39:0::2;;;;;;230964:147;231191:16:::0;;-1:-1:-1;;;;;231170:18:0;::::2;231191:16;231170:18:::0;;;:11:::2;:18;::::0;;;;;;;-1:-1:-1;;;231191:16:0;;::::2;-1:-1:-1::0;;;;;231191:16:0::2;231170:37:::0;;;231218:14:::2;:21:::0;;;;;;:34;;;231270:43;;18968:14:1;;18961:22;18943:41;;19000:18;;;18993:34;;;231218::0;;231270:43:::2;::::0;18916:18:1;231270:43:0::2;;;;;;;229973:1348;;205303:1:::1;205315:20:::0;204709:1;205835:7;:22;205652:213;21787:486;-1:-1:-1;;;;;14842:18:0;;;21887:24;14842:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;-1:-1:-1;;21954:36:0;;21950:316;;;22030:5;22011:16;:24;22007:132;;;22063:60;;-1:-1:-1;;;22063:60:0;;-1:-1:-1;;;;;12769:32:1;;22063:60:0;;;12751:51:1;12818:18;;;12811:34;;;12861:18;;;12854:34;;;12724:18;;22063:60:0;12549:345:1;22007:132:0;22182:57;22191:5;22198:7;22226:5;22207:16;:24;22233:5;22182:8;:57::i;:::-;21876:397;21787:486;;;:::o;16630:308::-;-1:-1:-1;;;;;16714:18:0;;16710:88;;16756:30;;-1:-1:-1;;;16756:30:0;;16783:1;16756:30;;;5585:51:1;5558:18;;16756:30:0;5439:203:1;16710:88:0;-1:-1:-1;;;;;16812:16:0;;16808:88;;16852:32;;-1:-1:-1;;;16852:32:0;;16881:1;16852:32;;;5585:51:1;5558:18;;16852:32:0;5439:203:1;16808:88:0;16906:24;16914:4;16920:2;16924:5;16906:7;:24::i;146603:268::-;146656:7;146688:4;-1:-1:-1;;;;;146697:11:0;146680:28;;:63;;;;;146729:14;146712:13;:31;146680:63;146676:188;;;-1:-1:-1;146767:22:0;;146603:268::o;146676:188::-;146829:23;146971:80;;;144693:95;146971:80;;;21085:25:1;146993:11:0;21126:18:1;;;21119:34;;;;147006:14:0;21169:18:1;;;21162:34;147022:13:0;21212:18:1;;;21205:34;147045:4:0;21255:19:1;;;21248:61;146934:7:0;;21057:19:1;;146971:80:0;;;;;;;;;;;;146961:91;;;;;;146954:98;;146879:181;;187165:277;187235:6;187254:23;187280:7;:5;:7::i;:::-;187254:33;;187315:16;187302:29;;:9;:29;187298:90;;187340:48;;-1:-1:-1;;;187340:48:0;;;;;19560:25:1;;;19633:14;19621:27;;19601:18;;;19594:55;19533:18;;187340:48:0;19388:267:1;187298:90:0;187406:28;187424:9;187406:17;:28::i;166646:624::-;166765:24;;166731:7;;;166765:24;166869:1;166863:7;;166859:241;;;166887:11;166907:14;166917:3;166907:9;:14::i;:::-;166901:20;;:3;:20;:::i;:::-;171606:28;171671:20;;;171737:4;171724:18;;166887:34;;-1:-1:-1;171720:28:0;;166946:42;;;;;166940:48;;;;166936:153;;;167016:3;167009:10;;166936:153;;;167066:7;:3;167072:1;167066:7;:::i;:::-;167060:13;;166936:153;166872:228;166859:241;167112:11;167126:53;167145:4;167164:3;167169;167174:4;167126:18;:53::i;:::-;167112:67;-1:-1:-1;167199:8:0;;:63;;167214:41;167228:4;167247:7;167253:1;167247:3;:7;:::i;:::-;171606:28;171671:20;;;171737:4;171724:18;;;171720:28;;171493:273;167214:41;:48;-1:-1:-1;;;167214:48:0;;-1:-1:-1;;;;;167214:48:0;167199:63;;;167210:1;167199:63;167192:70;166646:624;-1:-1:-1;;;;;;;166646:624:0:o;232518:504::-;232588:4;232637:21;;;:9;:21;;;;;232708:22;;;;232588:4;;232752:5;;223054:3;;232689:42;;-1:-1:-1;;;232708:22:0;;-1:-1:-1;;;;;232708:22:0;232689:18;:42::i;:::-;:59;;;;:::i;:::-;232688:69;;;;:::i;:::-;232809:21;;;;232671:86;;-1:-1:-1;232768:18:0;;232789:41;;-1:-1:-1;;;;;;;;232809:21:0;;;;;232789:17;:41;:::i;:::-;-1:-1:-1;;;;;232768:62:0;;;232860:6;232847:10;:19;232843:37;;;-1:-1:-1;232875:5:0;;232518:504;-1:-1:-1;;;;232518:504:0:o;232843:37::-;232893:22;232957:5;232919:34;223136:4;232919:10;:34;:::i;:::-;232918:44;;;;:::i;:::-;232980:17;;;;;-1:-1:-1;;;;;232980:17:0;:34;;;;;232518:504;-1:-1:-1;;;;;232518:504:0:o;199046:166::-;198954:6;;-1:-1:-1;;;;;198954:6:0;4385:10;199106:23;199102:103;;199153:40;;-1:-1:-1;;;199153:40:0;;4385:10;199153:40;;;5585:51:1;5558:18;;199153:40:0;5439:203:1;22875:89:0;22930:26;4385:10;22950:5;22930;:26::i;179748:111::-;179794:6;179820:31;179838:12;179820:17;:31::i;190572:318::-;-1:-1:-1;;;;;189476:19:0;;;190655;189476;;;:10;:19;;;;;;;;190706:31;;;-1:-1:-1;;;;;;190706:31:0;;;;;;;190755:48;;189476:19;;;;;190706:31;189476:19;;;;190755:48;;190655:19;190755:48;190814:68;190833:11;190846:9;190857:24;190873:7;190857:15;:24::i;:::-;190814:18;:68::i;205351:293::-;204753:1;205485:7;;:19;205477:63;;;;-1:-1:-1;;;205477:63:0;;20389:2:1;205477:63:0;;;20371:21:1;20428:2;20408:18;;;20401:30;20467:33;20447:18;;;20440:61;20518:18;;205477:63:0;20187:355:1;205477:63:0;204753:1;205618:7;:18;205351:293::o;213121:162::-;213231:43;;;-1:-1:-1;;;;;20739:32:1;;213231:43:0;;;20721:51:1;20788:18;;;;20781:34;;;213231:43:0;;;;;;;;;;20694:18:1;;;;213231:43:0;;;;;;;;-1:-1:-1;;;;;213231:43:0;-1:-1:-1;;;213231:43:0;;;213204:71;;213224:5;;213204:19;:71::i;192516:164::-;-1:-1:-1;;;;;192633:29:0;;192589:6;192633:29;;;:20;:29;;;;;168349:24;192615:57;;:17;:57::i;202443:156::-;202533:13;202526:20;;-1:-1:-1;;;;;;202526:20:0;;;202557:34;202582:8;202557:24;:34::i;23293:161::-;23369:45;23385:7;4385:10;23408:5;23369:15;:45::i;:::-;23425:21;23431:7;23440:5;23425;:21::i;153228:145::-;-1:-1:-1;;;;;150099:14:0;;153319:7;150099:14;;;:7;:14;;;;;;153346:19;150012:109;148827:128;148873:13;148906:41;:5;148933:13;148906:26;:41::i;149290:137::-;149339:13;149372:47;:8;149402:16;149372:29;:47::i;167395:209::-;167491:24;;167457:7;;167533:8;;:63;;167548:41;167562:4;167581:7;167587:1;167581:3;:7;:::i;167548:41::-;:48;-1:-1:-1;;;167548:48:0;;-1:-1:-1;;;;;167548:48:0;167533:63;;;167544:1;167526:70;167395:209;-1:-1:-1;;;167395:209:0:o;147702:178::-;147779:7;147806:66;147839:20;:18;:20::i;:::-;147861:10;132946:4;132940:11;-1:-1:-1;;;132965:23:0;;133018:4;133009:14;;133002:39;;;;133071:4;133062:14;;133055:34;133128:4;133113:20;;;132769:382;34484:264;34569:7;34590:17;34609:18;34629:16;34649:25;34660:4;34666:1;34669;34672;34649:10;:25::i;:::-;34589:85;;;;;;34685:28;34697:5;34704:8;34685:11;:28::i;:::-;-1:-1:-1;34731:9:0;;34484:264;-1:-1:-1;;;;;;34484:264:0:o;150760:227::-;-1:-1:-1;;;;;150609:14:0;;150844:15;150609:14;;;:7;:14;;;;;:16;;;;;;;;150893;;;150889:91;;150933:35;;-1:-1:-1;;;150933:35:0;;-1:-1:-1;;;;;20739:32:1;;150933:35:0;;;20721:51:1;20788:18;;;20781:34;;;20694:18;;150933:35:0;20547:274:1;192762:204:0;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;192921:29:0;;;;;;:20;:29;;;;;:37;;192954:3;192921:32;:37::i;18750:213::-;-1:-1:-1;;;;;18821:21:0;;18817:93;;18866:32;;-1:-1:-1;;;18866:32:0;;18895:1;18866:32;;;5585:51:1;5558:18;;18866:32:0;5439:203:1;18817:93:0;18920:35;18936:1;18940:7;18949:5;18920:7;:35::i;21052:443::-;-1:-1:-1;;;;;21165:19:0;;21161:91;;21208:32;;-1:-1:-1;;;21208:32:0;;21237:1;21208:32;;;5585:51:1;5558:18;;21208:32:0;5439:203:1;21161:91:0;-1:-1:-1;;;;;21266:21:0;;21262:92;;21311:31;;-1:-1:-1;;;21311:31:0;;21339:1;21311:31;;;5585:51:1;5558:18;;21311:31:0;5439:203:1;21262:92:0;-1:-1:-1;;;;;21364:18:0;;;;;;;:11;:18;;;;;;;;:27;;;;;;;;;:35;;;21410:78;;;;21461:7;-1:-1:-1;;;;;21445:31:0;21454:5;-1:-1:-1;;;;;21445:31:0;;21470:5;21445:31;;;;3673:25:1;;3661:2;3646:18;;3527:177;21445:31:0;;;;;;;;21052:443;;;;:::o;226392:329::-;-1:-1:-1;;;;;226565:18:0;;;;;;:57;;-1:-1:-1;;;;;;226587:17:0;;;;;;:11;:17;;;;;;226607:15;-1:-1:-1;226565:57:0;226561:111;;;226646:14;;-1:-1:-1;;;226646:14:0;;;;;;;;;;;226561:111;226682:31;226696:4;226702:2;226706:6;226682:13;:31::i;52287:218::-;52343:6;52374:16;52366:24;;52362:105;;;52414:41;;-1:-1:-1;;;52414:41:0;;52445:2;52414:41;;;21501:36:1;21553:18;;;21546:34;;;21474:18;;52414:41:0;21320:266:1;52362:105:0;-1:-1:-1;52491:5:0;52287:218::o;94630:5285::-;94678:7;94799:1;94794;:6;94790:55;;-1:-1:-1;94828:1:0;94630:5285::o;94790:55::-;95799:1;95828;-1:-1:-1;;;95850:16:0;;95846:95;;95894:3;95887:10;;;;;95923:2;95916:9;95846:95;-1:-1:-1;;;95959:2:0;:15;95955:93;;96002:2;95995:9;;;;;96030:2;96023:9;95955:93;96073:7;96066:2;:15;96062:93;;96109:2;96102:9;;;;;96137:2;96130:9;96062:93;96180:7;96173:2;:15;96169:92;;96216:2;96209:9;;;;;96244:1;96237:8;96169:92;96286:6;96279:2;:14;96275:90;;96321:1;96314:8;;;;;96348:1;96341:8;96275:90;96390:6;96383:2;:14;96379:90;;96425:1;96418:8;;;;;96452:1;96445:8;96379:90;96494:6;96487:2;:14;96483:63;;96529:1;96522:8;96483:63;96979:1;:6;96990:1;96978:13;;;;;98926:1;96978:13;98926:6;;;;:::i;:::-;;98921:2;:11;98920:18;;98915:23;;99047:1;99040:2;99036:1;:6;;;;;:::i;:::-;;99031:2;:11;99030:18;;99025:23;;99159:1;99152:2;99148:1;:6;;;;;:::i;:::-;;99143:2;:11;99142:18;;99137:23;;99269:1;99262:2;99258:1;:6;;;;;:::i;:::-;;99253:2;:11;99252:18;;99247:23;;99380:1;99373:2;99369:1;:6;;;;;:::i;:::-;;99364:2;:11;99363:18;;99358:23;;99491:1;99484:2;99480:1;:6;;;;;:::i;:::-;;99475:2;:11;99474:18;;99469:23;;99868:28;99893:2;99889:1;:6;;;;;:::i;:::-;;99884:11;;;73468:149;99868:28;99863:33;;;94630:5285;-1:-1:-1;;;94630:5285:0:o;170089:448::-;170251:7;170271:237;170284:4;170278:3;:10;170271:237;;;170305:11;170319:23;170332:3;170337:4;170319:12;:23::i;:::-;171606:28;171671:20;;;171737:4;171724:18;;170305:37;;-1:-1:-1;170361:35:0;;;;171720:28;;170361:29;;;:35;170357:140;;;170424:3;170417:10;;170357:140;;;170474:7;:3;170480:1;170474:7;:::i;:::-;170468:13;;170357:140;170290:218;170271:237;;;-1:-1:-1;170525:4:0;170089:448;-1:-1:-1;;;170089:448:0:o;19291:211::-;-1:-1:-1;;;;;19362:21:0;;19358:91;;19407:30;;-1:-1:-1;;;19407:30:0;;19434:1;19407:30;;;5585:51:1;5558:18;;19407:30:0;5439:203:1;19358:91:0;19459:35;19467:7;19484:1;19488:5;19459:7;:35::i;196614:135::-;-1:-1:-1;;;;;14286:18:0;;196696:7;14286:18;;;;;;;;;;;196723;14194:118;191628:808;191738:2;-1:-1:-1;;;;;191730:10:0;:4;-1:-1:-1;;;;;191730:10:0;;;:24;;;;;191753:1;191744:6;:10;191730:24;191726:703;;;-1:-1:-1;;;;;191775:18:0;;;191771:322;;-1:-1:-1;;;;;191881:26:0;;191815:16;191881:26;;;:20;:26;;;;;191815:16;;191853:154;;191930:9;191962:26;191981:6;191962:18;:26::i;:::-;191853:5;:154::i;:::-;-1:-1:-1;;;;;191814:193:0;;;-1:-1:-1;;;;;191814:193:0;;;192052:4;-1:-1:-1;;;;;192031:46:0;;192058:8;192068;192031:46;;;;;;21765:25:1;;;21821:2;21806:18;;21799:34;21753:2;21738:18;;21591:248;192031:46:0;;;;;;;;191795:298;;191771:322;-1:-1:-1;;;;;192111:16:0;;;192107:311;;-1:-1:-1;;;;;192215:24:0;;192149:16;192215:24;;;:20;:24;;;;;192149:16;;192187:147;;192262:4;192289:26;192308:6;192289:18;:26::i;192187:147::-;-1:-1:-1;;;;;192148:186:0;;;-1:-1:-1;;;;;192148:186:0;;;192379:2;-1:-1:-1;;;;;192358:44:0;;192383:8;192393;192358:44;;;;;;21765:25:1;;;21821:2;21806:18;;21799:34;21753:2;21738:18;;21591:248;192358:44:0;;;;;;;;192129:289;;191628:808;;;:::o;220412:738::-;220493:18;220522:19;220662:4;220659:1;220652:4;220646:11;220639:4;220633;220629:15;220626:1;220619:5;220612;220607:60;220721:7;220711:180;;220766:4;220760:11;220812:16;220809:1;220804:3;220789:40;220859:16;220854:3;220847:29;220711:180;-1:-1:-1;;220970:1:0;220964:8;220919:16;;-1:-1:-1;220999:15:0;;:68;;221051:11;221066:1;221051:16;;220999:68;;;-1:-1:-1;;;;;221017:26:0;;;:31;220999:68;220995:148;;;221091:40;;-1:-1:-1;;;221091:40:0;;-1:-1:-1;;;;;5603:32:1;;221091:40:0;;;5585:51:1;5558:18;;221091:40:0;5439:203:1;53321:218:0;53377:6;53408:16;53400:24;;53396:105;;;53448:41;;-1:-1:-1;;;53448:41:0;;53479:2;53448:41;;;21501:36:1;21553:18;;;21546:34;;;21474:18;;53448:41:0;21320:266:1;200194:191:0;200287:6;;;-1:-1:-1;;;;;200304:17:0;;;-1:-1:-1;;;;;;200304:17:0;;;;;;;200337:40;;200287:6;;;200304:17;200287:6;;200337:40;;200268:16;;200337:40;200257:128;200194:191;:::o;140959:273::-;141053:13;138923:66;141083:46;;141079:146;;141153:15;141162:5;141153:8;:15::i;:::-;141146:22;;;;141079:146;141208:5;141201:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;32768:1577;32899:17;;;33863:66;33850:79;;33846:166;;;-1:-1:-1;33962:1:0;;-1:-1:-1;33966:30:0;;-1:-1:-1;33998:1:0;33946:54;;33846:166;34126:24;;;34109:14;34126:24;;;;;;;;;16632:25:1;;;16705:4;16693:17;;16673:18;;;16666:45;;;;16727:18;;;16720:34;;;16770:18;;;16763:34;;;34126:24:0;;16604:19:1;;34126:24:0;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;34126:24:0;;-1:-1:-1;;34126:24:0;;;-1:-1:-1;;;;;;;34165:20:0;;34161:115;;-1:-1:-1;34218:1:0;;-1:-1:-1;34222:29:0;;-1:-1:-1;34218:1:0;;-1:-1:-1;34202:62:0;;34161:115;34296:6;-1:-1:-1;34304:20:0;;-1:-1:-1;34304:20:0;;-1:-1:-1;32768:1577:0;;;;;;;;;:::o;34886:542::-;34982:20;34973:5;:29;;;;;;;;:::i;:::-;;34969:452;;34886:542;;:::o;34969:452::-;35080:29;35071:5;:38;;;;;;;;:::i;:::-;;35067:354;;35133:23;;-1:-1:-1;;;35133:23:0;;;;;;;;;;;35067:354;35187:35;35178:5;:44;;;;;;;;:::i;:::-;;35174:247;;35246:46;;-1:-1:-1;;;35246:46:0;;;;;3673:25:1;;;3646:18;;35246:46:0;3527:177:1;35174:247:0;35323:30;35314:5;:39;;;;;;;;:::i;:::-;;35310:111;;35377:32;;-1:-1:-1;;;35377:32:0;;;;;3673:25:1;;;3646:18;;35377:32:0;3527:177:1;168458:140:0;-1:-1:-1;;;;;;;;;;;;;;;;;168568:4:0;:17;;168586:3;168568:22;;;;;;;;;;:::i;:::-;;;;;;;;;;168561:29;;;;;;;;;168568:22;;168561:29;;;;;;-1:-1:-1;;;168561:29:0;;-1:-1:-1;;;;;168561:29:0;;;;;;;;;168458:140;-1:-1:-1;;;168458:140:0:o;195923:423::-;196018:30;196032:4;196038:2;196042:5;196018:13;:30::i;:::-;-1:-1:-1;;;;;196063:18:0;;196059:232;;196098:14;196115:13;14138:12;;;14059:99;196115:13;196098:30;-1:-1:-1;;;;;;196188:12:0;;;196184:96;;;196228:36;;-1:-1:-1;;;196228:36:0;;;;;21765:25:1;;;21806:18;;;21799:34;;;21738:18;;196228:36:0;21591:248:1;196184:96:0;196083:208;;196059:232;196301:37;196322:4;196328:2;196332:5;196301:20;:37::i;79582:156::-;79644:7;79719:11;79729:1;79720:5;;;79719:11;:::i;:::-;79709:21;;79710:5;;;79709:21;:::i;41825:223::-;41882:7;-1:-1:-1;;;;;41906:25:0;;41902:107;;;41955:42;;-1:-1:-1;;;41955:42:0;;41986:3;41955:42;;;21501:36:1;21553:18;;;21546:34;;;21474:18;;41955:42:0;21320:266:1;192974:279:0;193145:16;193163;193199:46;193210:7;:5;:7::i;:::-;193219:25;193222:14;:5;:12;:14::i;:::-;193238:5;193219:2;:25;;:::i;:::-;193199:5;;:46;:10;:46::i;:::-;193192:53;;;;192974:279;;;;;;;:::o;139632:387::-;139691:13;139717:11;139731:16;139742:4;139731:10;:16::i;:::-;139857:14;;;139868:2;139857:14;;;;;;;;;139717:30;;-1:-1:-1;139837:17:0;;139857:14;;;;;;;;;-1:-1:-1;;;139922:16:0;;;-1:-1:-1;139968:4:0;139959:14;;139952:28;;;;-1:-1:-1;139922:16:0;139632:387::o;17262:1135::-;-1:-1:-1;;;;;17352:18:0;;17348:552;;17506:5;17490:12;;:21;;;;;;;:::i;:::-;;;;-1:-1:-1;17348:552:0;;-1:-1:-1;17348:552:0;;-1:-1:-1;;;;;17566:15:0;;17544:19;17566:15;;;;;;;;;;;17600:19;;;17596:117;;;17647:50;;-1:-1:-1;;;17647:50:0;;-1:-1:-1;;;;;12769:32:1;;17647:50:0;;;12751:51:1;12818:18;;;12811:34;;;12861:18;;;12854:34;;;12724:18;;17647:50:0;12549:345:1;17596:117:0;-1:-1:-1;;;;;17836:15:0;;:9;:15;;;;;;;;;;17854:19;;;;17836:37;;17348:552;-1:-1:-1;;;;;17916:16:0;;17912:435;;18082:12;:21;;;;;;;17912:435;;;-1:-1:-1;;;;;18298:13:0;;:9;:13;;;;;;;;;;:22;;;;;;17912:435;18379:2;-1:-1:-1;;;;;18364:25:0;18373:4;-1:-1:-1;;;;;18364:25:0;;18383:5;18364:25;;;;3673::1;;3661:2;3646:18;;3527:177;18364:25:0;;;;;;;;17262:1135;;;:::o;191130:407::-;-1:-1:-1;;;;;191234:18:0;;191230:109;;191269:58;191275:17;191294:4;191300:26;191319:6;191300:18;:26::i;191269:58::-;;;191230:109;-1:-1:-1;;;;;191353:16:0;;191349:112;;191386:63;191392:17;191411:9;191422:26;191441:6;191422:18;:26::i;191386:63::-;;;191349:112;-1:-1:-1;;;;;189476:19:0;;;189449:7;189476:19;;;:10;:19;;;;;;;;;;;;;;;191471:58;;189476:19;;;;;191522:6;191471:18;:58::i;165172:216::-;165288:16;;165342:38;165350:4;165369:3;165374:5;165342:7;:38::i;140096:251::-;140157:7;140230:4;140194:40;;140258:2;140249:11;;140245:71;;;140284:20;;-1:-1:-1;;;140284:20:0;;;;;;;;;;;168780:950;168966:11;;168905:16;;;;168994:7;;168990:733;;169018:26;169047:28;169061:4;169067:7;169073:1;169067:3;:7;:::i;169047:28::-;169107:9;;;;-1:-1:-1;169107:9:0;;;;;-1:-1:-1;;;169151:11:0;;-1:-1:-1;;;;;169151:11:0;;169239:13;;;;169235:91;;;169280:30;;-1:-1:-1;;;169280:30:0;;;;;;;;;;;169235:91;169403:3;169392:14;;:7;:14;;;169388:167;;169427:19;;;;-1:-1:-1;;;;;;;;169427:19:0;;;;;;169388:167;;;169497:41;;;;;;;;;;;;;;;-1:-1:-1;;;;;169497:41:0;;;;;;;;;;169487:52;;;;;;;-1:-1:-1;169487:52:0;;;;;;;;;;;;;;-1:-1:-1;;;169487:52:0;;;;;;;;;;169388:167;169577:9;-1:-1:-1;169588:5:0;;-1:-1:-1;169569:25:0;;-1:-1:-1;;;169569:25:0;168990:733;-1:-1:-1;;169637:41:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;169637:41:0;;;;;;;;;;169627:52;;;;;;;-1:-1:-1;169627:52:0;;;;;;;;;;;;;-1:-1:-1;;;169627:52:0;;;;;;;;;;;;-1:-1:-1;;169671:5:0;169694:17;;14:226:1;73:6;126:2;114:9;105:7;101:23;97:32;94:52;;;142:1;139;132:12;94:52;-1:-1:-1;187:23:1;;14:226;-1:-1:-1;14:226:1:o;1869:289::-;1911:3;1949:5;1943:12;1976:6;1971:3;1964:19;2032:6;2025:4;2018:5;2014:16;2007:4;2002:3;1998:14;1992:47;2084:1;2077:4;2068:6;2063:3;2059:16;2055:27;2048:38;2147:4;2140:2;2136:7;2131:2;2123:6;2119:15;2115:29;2110:3;2106:39;2102:50;2095:57;;;1869:289;;;;:::o;2163:220::-;2312:2;2301:9;2294:21;2275:4;2332:45;2373:2;2362:9;2358:18;2350:6;2332:45;:::i;2388:173::-;2456:20;;-1:-1:-1;;;;;2505:31:1;;2495:42;;2485:70;;2551:1;2548;2541:12;2485:70;2388:173;;;:::o;2566:300::-;2634:6;2642;2695:2;2683:9;2674:7;2670:23;2666:32;2663:52;;;2711:1;2708;2701:12;2663:52;2734:29;2753:9;2734:29;:::i;:::-;2724:39;2832:2;2817:18;;;;2804:32;;-1:-1:-1;;;2566:300:1:o;3063:160::-;3128:20;;3184:13;;3177:21;3167:32;;3157:60;;3213:1;3210;3203:12;3228:294;3293:6;3301;3354:2;3342:9;3333:7;3329:23;3325:32;3322:52;;;3370:1;3367;3360:12;3322:52;3415:23;;;-1:-1:-1;3481:35:1;3512:2;3497:18;;3481:35;:::i;:::-;3471:45;;3228:294;;;;;:::o;3709:374::-;3786:6;3794;3802;3855:2;3843:9;3834:7;3830:23;3826:32;3823:52;;;3871:1;3868;3861:12;3823:52;3894:29;3913:9;3894:29;:::i;:::-;3884:39;;3942:38;3976:2;3965:9;3961:18;3942:38;:::i;:::-;3709:374;;3932:48;;-1:-1:-1;;;4049:2:1;4034:18;;;;4021:32;;3709:374::o;4459:127::-;4520:10;4515:3;4511:20;4508:1;4501:31;4551:4;4548:1;4541:15;4575:4;4572:1;4565:15;4591:347;4742:2;4727:18;;4775:1;4764:13;;4754:144;;4820:10;4815:3;4811:20;4808:1;4801:31;4855:4;4852:1;4845:15;4883:4;4880:1;4873:15;4754:144;4907:25;;;4591:347;:::o;4943:300::-;5011:6;5019;5072:2;5060:9;5051:7;5047:23;5043:32;5040:52;;;5088:1;5085;5078:12;5040:52;5133:23;;;-1:-1:-1;5199:38:1;5233:2;5218:18;;5199:38;:::i;5248:186::-;5307:6;5360:2;5348:9;5339:7;5335:23;5331:32;5328:52;;;5376:1;5373;5366:12;5328:52;5399:29;5418:9;5399:29;:::i;5844:775::-;5933:6;5941;5949;5957;6010:2;5998:9;5989:7;5985:23;5981:32;5978:52;;;6026:1;6023;6016:12;5978:52;6049:29;6068:9;6049:29;:::i;:::-;6039:39;-1:-1:-1;6147:2:1;6132:18;;6119:32;;-1:-1:-1;6226:2:1;6211:18;;6198:32;-1:-1:-1;;;;;6242:30:1;;6239:50;;;6285:1;6282;6275:12;6239:50;6308:22;;6361:4;6353:13;;6349:27;-1:-1:-1;6339:55:1;;6390:1;6387;6380:12;6339:55;6430:2;6417:16;-1:-1:-1;;;;;6448:6:1;6445:30;6442:50;;;6488:1;6485;6478:12;6442:50;6533:7;6528:2;6519:6;6515:2;6511:15;6507:24;6504:37;6501:57;;;6554:1;6551;6544:12;6501:57;5844:775;;;;-1:-1:-1;6585:2:1;6577:11;;-1:-1:-1;;;5844:775:1:o;6624:1238::-;7030:3;7025;7021:13;7013:6;7009:26;6998:9;6991:45;7072:3;7067:2;7056:9;7052:18;7045:31;6972:4;7099:46;7140:3;7129:9;7125:19;7117:6;7099:46;:::i;:::-;7193:9;7185:6;7181:22;7176:2;7165:9;7161:18;7154:50;7227:33;7253:6;7245;7227:33;:::i;:::-;7291:2;7276:18;;7269:34;;;-1:-1:-1;;;;;7340:32:1;;7334:3;7319:19;;7312:61;7360:3;7389:19;;7382:35;;;7454:22;;;7448:3;7433:19;;7426:51;7526:13;;7548:22;;;7598:2;7624:15;;;;-1:-1:-1;7586:15:1;;;;-1:-1:-1;7667:169:1;7681:6;7678:1;7675:13;7667:169;;;7742:13;;7730:26;;7785:2;7811:15;;;;7776:12;;;;7703:1;7696:9;7667:169;;;-1:-1:-1;7853:3:1;;6624:1238;-1:-1:-1;;;;;;;;;;;6624:1238:1:o;8068:156::-;8134:20;;8194:4;8183:16;;8173:27;;8163:55;;8214:1;8211;8204:12;8229:727;8328:6;8336;8344;8352;8360;8368;8421:3;8409:9;8400:7;8396:23;8392:33;8389:53;;;8438:1;8435;8428:12;8389:53;8483:23;;;-1:-1:-1;8549:35:1;8580:2;8565:18;;8549:35;:::i;:::-;8539:45;-1:-1:-1;8657:2:1;8642:18;;8629:32;;-1:-1:-1;8706:36:1;8738:2;8723:18;;8706:36;:::i;:::-;8229:727;;;;-1:-1:-1;8229:727:1;;8815:3;8800:19;;8787:33;;8919:3;8904:19;;;8891:33;;-1:-1:-1;8229:727:1;-1:-1:-1;;8229:727:1:o;8961:733::-;9063:6;9071;9079;9087;9095;9103;9156:3;9144:9;9135:7;9131:23;9127:33;9124:53;;;9173:1;9170;9163:12;9124:53;9196:29;9215:9;9196:29;:::i;:::-;9186:39;-1:-1:-1;9294:2:1;9279:18;;9266:32;;-1:-1:-1;9395:2:1;9380:18;;9367:32;;-1:-1:-1;9444:36:1;9476:2;9461:18;;9444:36;:::i;9699:808::-;9810:6;9818;9826;9834;9842;9850;9858;9911:3;9899:9;9890:7;9886:23;9882:33;9879:53;;;9928:1;9925;9918:12;9879:53;9951:29;9970:9;9951:29;:::i;:::-;9941:39;;9999:38;10033:2;10022:9;10018:18;9999:38;:::i;:::-;9989:48;-1:-1:-1;10106:2:1;10091:18;;10078:32;;-1:-1:-1;10207:2:1;10192:18;;10179:32;;-1:-1:-1;10256:37:1;10288:3;10273:19;;10256:37;:::i;:::-;9699:808;;;;-1:-1:-1;9699:808:1;;;;10246:47;10366:3;10351:19;;10338:33;;-1:-1:-1;10470:3:1;10455:19;;;10442:33;;9699:808;-1:-1:-1;;9699:808:1:o;10512:260::-;10580:6;10588;10641:2;10629:9;10620:7;10616:23;10612:32;10609:52;;;10657:1;10654;10647:12;10609:52;10680:29;10699:9;10680:29;:::i;:::-;10670:39;;10728:38;10762:2;10751:9;10747:18;10728:38;:::i;10777:350::-;10844:6;10852;10905:2;10893:9;10884:7;10880:23;10876:32;10873:52;;;10921:1;10918;10911:12;10873:52;10944:29;10963:9;10944:29;:::i;:::-;10934:39;;11023:2;11012:9;11008:18;10995:32;11067:10;11060:5;11056:22;11049:5;11046:33;11036:61;;11093:1;11090;11083:12;11036:61;11116:5;11106:15;;;10777:350;;;;;:::o;11493:380::-;11572:1;11568:12;;;;11615;;;11636:61;;11690:4;11682:6;11678:17;11668:27;;11636:61;11743:2;11735:6;11732:14;11712:18;11709:38;11706:161;;11789:10;11784:3;11780:20;11777:1;11770:31;11824:4;11821:1;11814:15;11852:4;11849:1;11842:15;11706:161;;11493:380;;;:::o;11878:127::-;11939:10;11934:3;11930:20;11927:1;11920:31;11970:4;11967:1;11960:15;11994:4;11991:1;11984:15;12010:125;12075:9;;;12096:10;;;12093:36;;;12109:18;;:::i;12140:128::-;12207:9;;;12228:11;;;12225:37;;;12242:18;;:::i;12273:271::-;12456:6;12448;12443:3;12430:33;12412:3;12482:16;;12507:13;;;12482:16;12273:271;-1:-1:-1;12273:271:1:o;12899:135::-;12938:3;12959:17;;;12956:43;;12979:18;;:::i;:::-;-1:-1:-1;13026:1:1;13015:13;;12899:135::o;13039:127::-;13100:10;13095:3;13091:20;13088:1;13081:31;13131:4;13128:1;13121:15;13155:4;13152:1;13145:15;13297:518;13399:2;13394:3;13391:11;13388:421;;;13435:5;13432:1;13425:16;13479:4;13476:1;13466:18;13549:2;13537:10;13533:19;13530:1;13526:27;13520:4;13516:38;13585:4;13573:10;13570:20;13567:47;;;-1:-1:-1;13608:4:1;13567:47;13663:2;13658:3;13654:12;13651:1;13647:20;13641:4;13637:31;13627:41;;13718:81;13736:2;13729:5;13726:13;13718:81;;;13795:1;13781:16;;13762:1;13751:13;13718:81;;;13722:3;;13297:518;;;:::o;13991:1198::-;-1:-1:-1;;;;;14110:3:1;14107:27;14104:53;;;14137:18;;:::i;:::-;14166:94;14256:3;14216:38;14248:4;14242:11;14216:38;:::i;:::-;14210:4;14166:94;:::i;:::-;14286:1;14311:2;14306:3;14303:11;14328:1;14323:608;;;;14975:1;14992:3;14989:93;;;-1:-1:-1;15048:19:1;;;15035:33;14989:93;-1:-1:-1;;13948:1:1;13944:11;;;13940:24;13936:29;13926:40;13972:1;13968:11;;;13923:57;15095:78;;14296:887;;14323:608;13244:1;13237:14;;;13281:4;13268:18;;-1:-1:-1;;14359:17:1;;;14474:229;14488:7;14485:1;14482:14;14474:229;;;14577:19;;;14564:33;14549:49;;14684:4;14669:20;;;;14637:1;14625:14;;;;14504:12;14474:229;;;14478:3;14731;14722:7;14719:16;14716:159;;;14855:1;14851:6;14845:3;14839;14836:1;14832:11;14828:21;14824:34;14820:39;14807:9;14802:3;14798:19;14785:33;14781:79;14773:6;14766:95;14716:159;;;14918:1;14912:3;14909:1;14905:11;14901:19;14895:4;14888:33;14296:887;;13991:1198;;;:::o;15194:656::-;15435:6;15424:9;15417:25;-1:-1:-1;;;;;15482:6:1;15478:31;15473:2;15462:9;15458:18;15451:59;-1:-1:-1;;;;;15550:6:1;15546:31;15541:2;15530:9;15526:18;15519:59;15614:3;15609:2;15598:9;15594:18;15587:31;15655:6;15649:3;15638:9;15634:19;15627:35;15713:6;15705;15699:3;15688:9;15684:19;15671:49;15770:1;15740:22;;;15764:3;15736:32;;;15729:43;;;;15833:2;15812:15;;;-1:-1:-1;;15808:29:1;15793:45;15789:55;;15194:656;-1:-1:-1;;;;15194:656:1:o;18127:198::-;-1:-1:-1;;;;;18227:27:1;;;18198;;;18194:61;;18267:29;;18264:55;;;18299:18;;:::i;18330:195::-;-1:-1:-1;;;;;18399:27:1;;;18428;;;18395:61;;18468:28;;18465:54;;;18499:18;;:::i;18530:240::-;-1:-1:-1;;;;;18599:42:1;;;18643;;;18595:91;;18698:43;;18695:69;;;18744:18;;:::i;19660:168::-;19733:9;;;19764;;19781:15;;;19775:22;;19761:37;19751:71;;19802:18;;:::i;19833:127::-;19894:10;19889:3;19885:20;19882:1;19875:31;19925:4;19922:1;19915:15;19949:4;19946:1;19939:15;19965:217;20005:1;20031;20021:132;;20075:10;20070:3;20066:20;20063:1;20056:31;20110:4;20107:1;20100:15;20138:4;20135:1;20128:15;20021:132;-1:-1:-1;20167:9:1;;19965:217::o;22115:127::-;22176:10;22171:3;22167:20;22164:1;22157:31;22207:4;22204:1;22197:15;22231:4;22228:1;22221:15
Swarm Source
ipfs://54cc60bf2eae13959362736b309dcd8a96534f391967c1940183fe077379a209
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.