Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save yann300/727bff2cfa792bbee1c29821de365b45 to your computer and use it in GitHub Desktop.

Select an option

Save yann300/727bff2cfa792bbee1c29821de365b45 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.30+commit.73712a01.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
// 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;
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (governance/utils/Votes.sol)
pragma solidity ^0.8.20;
import {IERC5805} from "../../interfaces/IERC5805.sol";
import {Context} from "../../utils/Context.sol";
import {Nonces} from "../../utils/Nonces.sol";
import {EIP712} from "../../utils/cryptography/EIP712.sol";
import {Checkpoints} from "../../utils/structs/Checkpoints.sol";
import {SafeCast} from "../../utils/math/SafeCast.sol";
import {ECDSA} from "../../utils/cryptography/ECDSA.sol";
import {Time} from "../../utils/types/Time.sol";
/**
* @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);
}
// SPDX-License-Identifier: MIT
// 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);
}
// SPDX-License-Identifier: MIT
// 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
);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC5805.sol)
pragma solidity >=0.8.4;
import {IVotes} from "../governance/utils/IVotes.sol";
import {IERC6372} from "./IERC6372.sol";
interface IERC5805 is IERC6372, IVotes {}
// SPDX-License-Identifier: MIT
// 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);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* 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);
}
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/ERC20Permit.sol)
pragma solidity ^0.8.20;
import {IERC20Permit} from "./IERC20Permit.sol";
import {ERC20} from "../ERC20.sol";
import {ECDSA} from "../../../utils/cryptography/ECDSA.sol";
import {EIP712} from "../../../utils/cryptography/EIP712.sol";
import {Nonces} from "../../../utils/Nonces.sol";
/**
* @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();
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/ERC20Votes.sol)
pragma solidity ^0.8.20;
import {ERC20} from "../ERC20.sol";
import {Votes} from "../../../governance/utils/Votes.sol";
import {Checkpoints} from "../../../utils/structs/Checkpoints.sol";
/**
* @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);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity >=0.6.2;
import {IERC20} from "../IERC20.sol";
/**
* @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);
}
// SPDX-License-Identifier: MIT
// 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);
}
// SPDX-License-Identifier: MIT
// 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);
}
// SPDX-License-Identifier: MIT
// 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;
}
}
// SPDX-License-Identifier: MIT
// 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);
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.20;
import {MessageHashUtils} from "./MessageHashUtils.sol";
import {ShortStrings, ShortString} from "../ShortStrings.sol";
import {IERC5267} from "../../interfaces/IERC5267.sol";
/**
* @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);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/cryptography/MessageHashUtils.sol)
pragma solidity ^0.8.20;
import {Strings} from "../Strings.sol";
/**
* @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)
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";
/**
* @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;
}
}
// SPDX-License-Identifier: MIT
// 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))
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
import {SafeCast} from "./SafeCast.sol";
/**
* @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);
}
}
}
// SPDX-License-Identifier: MIT
// 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);
}
}
}
// SPDX-License-Identifier: MIT
// 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)
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/ShortStrings.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
// | 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;
}
}
}
// SPDX-License-Identifier: MIT
// 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
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SafeCast} from "./math/SafeCast.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @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))
}
}
}
// SPDX-License-Identifier: MIT
// 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;
import {Math} from "../math/Math.sol";
/**
* @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)
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/types/Time.sol)
pragma solidity ^0.8.20;
import {Math} from "../math/Math.sol";
import {SafeCast} from "../math/SafeCast.sol";
/**
* @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));
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {IERC165, ERC165} from "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` from `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (access/IAccessControl.sol)
pragma solidity >=0.8.4;
/**
* @dev External interface of AccessControl declared to support ERC-165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted to signal this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
* Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (governance/extensions/GovernorCountingSimple.sol)
pragma solidity ^0.8.24;
import {IGovernor, Governor} from "../Governor.sol";
/**
* @dev Extension of {Governor} for simple, 3 options, vote counting.
*/
abstract contract GovernorCountingSimple is Governor {
/**
* @dev Supported vote types. Matches Governor Bravo ordering.
*/
enum VoteType {
Against,
For,
Abstain
}
struct ProposalVote {
uint256 againstVotes;
uint256 forVotes;
uint256 abstainVotes;
mapping(address voter => bool) hasVoted;
}
mapping(uint256 proposalId => ProposalVote) private _proposalVotes;
/// @inheritdoc IGovernor
// solhint-disable-next-line func-name-mixedcase
function COUNTING_MODE() public pure virtual override returns (string memory) {
return "support=bravo&quorum=for,abstain";
}
/// @inheritdoc IGovernor
function hasVoted(uint256 proposalId, address account) public view virtual override returns (bool) {
return _proposalVotes[proposalId].hasVoted[account];
}
/**
* @dev Accessor to the internal vote counts.
*/
function proposalVotes(
uint256 proposalId
) public view virtual returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes) {
ProposalVote storage proposalVote = _proposalVotes[proposalId];
return (proposalVote.againstVotes, proposalVote.forVotes, proposalVote.abstainVotes);
}
/// @inheritdoc Governor
function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) {
ProposalVote storage proposalVote = _proposalVotes[proposalId];
return quorum(proposalSnapshot(proposalId)) <= proposalVote.forVotes + proposalVote.abstainVotes;
}
/**
* @dev See {Governor-_voteSucceeded}. In this module, the forVotes must be strictly over the againstVotes.
*/
function _voteSucceeded(uint256 proposalId) internal view virtual override returns (bool) {
ProposalVote storage proposalVote = _proposalVotes[proposalId];
return proposalVote.forVotes > proposalVote.againstVotes;
}
/**
* @dev See {Governor-_countVote}. In this module, the support follows the `VoteType` enum (from Governor Bravo).
*/
function _countVote(
uint256 proposalId,
address account,
uint8 support,
uint256 totalWeight,
bytes memory // params
) internal virtual override returns (uint256) {
ProposalVote storage proposalVote = _proposalVotes[proposalId];
if (proposalVote.hasVoted[account]) {
revert GovernorAlreadyCastVote(account);
}
proposalVote.hasVoted[account] = true;
if (support == uint8(VoteType.Against)) {
proposalVote.againstVotes += totalWeight;
} else if (support == uint8(VoteType.For)) {
proposalVote.forVotes += totalWeight;
} else if (support == uint8(VoteType.Abstain)) {
proposalVote.abstainVotes += totalWeight;
} else {
revert GovernorInvalidVoteType();
}
return totalWeight;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (governance/extensions/GovernorSettings.sol)
pragma solidity ^0.8.24;
import {IGovernor, Governor} from "../Governor.sol";
/**
* @dev Extension of {Governor} for settings updatable through governance.
*/
abstract contract GovernorSettings is Governor {
// amount of token
uint256 private _proposalThreshold;
// timepoint: limited to uint48 in core (same as clock() type)
uint48 private _votingDelay;
// duration: limited to uint32 in core
uint32 private _votingPeriod;
event VotingDelaySet(uint256 oldVotingDelay, uint256 newVotingDelay);
event VotingPeriodSet(uint256 oldVotingPeriod, uint256 newVotingPeriod);
event ProposalThresholdSet(uint256 oldProposalThreshold, uint256 newProposalThreshold);
/**
* @dev Initialize the governance parameters.
*/
constructor(uint48 initialVotingDelay, uint32 initialVotingPeriod, uint256 initialProposalThreshold) {
_setVotingDelay(initialVotingDelay);
_setVotingPeriod(initialVotingPeriod);
_setProposalThreshold(initialProposalThreshold);
}
/// @inheritdoc IGovernor
function votingDelay() public view virtual override returns (uint256) {
return _votingDelay;
}
/// @inheritdoc IGovernor
function votingPeriod() public view virtual override returns (uint256) {
return _votingPeriod;
}
/// @inheritdoc Governor
function proposalThreshold() public view virtual override returns (uint256) {
return _proposalThreshold;
}
/**
* @dev Update the voting delay. This operation can only be performed through a governance proposal.
*
* Emits a {VotingDelaySet} event.
*/
function setVotingDelay(uint48 newVotingDelay) public virtual onlyGovernance {
_setVotingDelay(newVotingDelay);
}
/**
* @dev Update the voting period. This operation can only be performed through a governance proposal.
*
* Emits a {VotingPeriodSet} event.
*/
function setVotingPeriod(uint32 newVotingPeriod) public virtual onlyGovernance {
_setVotingPeriod(newVotingPeriod);
}
/**
* @dev Update the proposal threshold. This operation can only be performed through a governance proposal.
*
* Emits a {ProposalThresholdSet} event.
*/
function setProposalThreshold(uint256 newProposalThreshold) public virtual onlyGovernance {
_setProposalThreshold(newProposalThreshold);
}
/**
* @dev Internal setter for the voting delay.
*
* Emits a {VotingDelaySet} event.
*/
function _setVotingDelay(uint48 newVotingDelay) internal virtual {
emit VotingDelaySet(_votingDelay, newVotingDelay);
_votingDelay = newVotingDelay;
}
/**
* @dev Internal setter for the voting period.
*
* Emits a {VotingPeriodSet} event.
*/
function _setVotingPeriod(uint32 newVotingPeriod) internal virtual {
if (newVotingPeriod == 0) {
revert GovernorInvalidVotingPeriod(0);
}
emit VotingPeriodSet(_votingPeriod, newVotingPeriod);
_votingPeriod = newVotingPeriod;
}
/**
* @dev Internal setter for the proposal threshold.
*
* Emits a {ProposalThresholdSet} event.
*/
function _setProposalThreshold(uint256 newProposalThreshold) internal virtual {
emit ProposalThresholdSet(_proposalThreshold, newProposalThreshold);
_proposalThreshold = newProposalThreshold;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (governance/extensions/GovernorTimelockControl.sol)
pragma solidity ^0.8.24;
import {IGovernor, Governor} from "../Governor.sol";
import {TimelockController} from "../TimelockController.sol";
import {SafeCast} from "../../utils/math/SafeCast.sol";
/**
* @dev Extension of {Governor} that binds the execution process to an instance of {TimelockController}. This adds a
* delay, enforced by the {TimelockController} to all successful proposal (in addition to the voting duration). The
* {Governor} needs the proposer (and ideally the executor and canceller) roles for the {Governor} to work properly.
*
* Using this model means the proposal will be operated by the {TimelockController} and not by the {Governor}. Thus,
* the assets and permissions must be attached to the {TimelockController}. Any asset sent to the {Governor} will be
* inaccessible from a proposal, unless executed via {Governor-relay}.
*
* WARNING: Setting up the TimelockController to have additional proposers or cancelers besides the governor is very
* risky, as it grants them the ability to: 1) execute operations as the timelock, and thus possibly performing
* operations or accessing funds that are expected to only be accessible through a vote, and 2) block governance
* proposals that have been approved by the voters, effectively executing a Denial of Service attack.
*/
abstract contract GovernorTimelockControl is Governor {
TimelockController private _timelock;
mapping(uint256 proposalId => bytes32) private _timelockIds;
/**
* @dev Emitted when the timelock controller used for proposal execution is modified.
*/
event TimelockChange(address oldTimelock, address newTimelock);
/**
* @dev Set the timelock.
*/
constructor(TimelockController timelockAddress) {
_updateTimelock(timelockAddress);
}
/**
* @dev Overridden version of the {Governor-state} function that considers the status reported by the timelock.
*/
function state(uint256 proposalId) public view virtual override returns (ProposalState) {
ProposalState currentState = super.state(proposalId);
if (currentState != ProposalState.Queued) {
return currentState;
}
bytes32 queueid = _timelockIds[proposalId];
if (_timelock.isOperationPending(queueid)) {
return ProposalState.Queued;
} else if (_timelock.isOperationDone(queueid)) {
// This can happen if the proposal is executed directly on the timelock.
return ProposalState.Executed;
} else {
// This can happen if the proposal is canceled directly on the timelock.
return ProposalState.Canceled;
}
}
/**
* @dev Public accessor to check the address of the timelock
*/
function timelock() public view virtual returns (address) {
return address(_timelock);
}
/// @inheritdoc IGovernor
function proposalNeedsQueuing(uint256) public view virtual override returns (bool) {
return true;
}
/**
* @dev Function to queue a proposal to the timelock.
*/
function _queueOperations(
uint256 proposalId,
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) internal virtual override returns (uint48) {
uint256 delay = _timelock.getMinDelay();
bytes32 salt = _timelockSalt(descriptionHash);
_timelockIds[proposalId] = _timelock.hashOperationBatch(targets, values, calldatas, 0, salt);
_timelock.scheduleBatch(targets, values, calldatas, 0, salt, delay);
return SafeCast.toUint48(block.timestamp + delay);
}
/**
* @dev Overridden version of the {Governor-_executeOperations} function that runs the already queued proposal
* through the timelock.
*/
function _executeOperations(
uint256 proposalId,
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) internal virtual override {
// execute
_timelock.executeBatch{value: msg.value}(targets, values, calldatas, 0, _timelockSalt(descriptionHash));
// cleanup for refund
delete _timelockIds[proposalId];
}
/**
* @dev Overridden version of the {Governor-_cancel} function to cancel the timelocked proposal if it has already
* been queued.
*/
// This function can reenter through the external call to the timelock, but we assume the timelock is trusted and
// well behaved (according to TimelockController) and this will not happen.
// slither-disable-next-line reentrancy-no-eth
function _cancel(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) internal virtual override returns (uint256) {
uint256 proposalId = super._cancel(targets, values, calldatas, descriptionHash);
bytes32 timelockId = _timelockIds[proposalId];
if (timelockId != 0) {
// cancel
_timelock.cancel(timelockId);
// cleanup
delete _timelockIds[proposalId];
}
return proposalId;
}
/**
* @dev Address through which the governor executes action. In this case, the timelock.
*/
function _executor() internal view virtual override returns (address) {
return address(_timelock);
}
/**
* @dev Public endpoint to update the underlying timelock instance. Restricted to the timelock itself, so updates
* must be proposed, scheduled, and executed through governance proposals.
*
* CAUTION: It is not recommended to change the timelock while there are other queued governance proposals.
*/
function updateTimelock(TimelockController newTimelock) external virtual onlyGovernance {
_updateTimelock(newTimelock);
}
function _updateTimelock(TimelockController newTimelock) private {
emit TimelockChange(address(_timelock), address(newTimelock));
_timelock = newTimelock;
}
/**
* @dev Computes the {TimelockController} operation salt.
*
* It is computed with the governor address itself to avoid collisions across governor instances using the
* same timelock.
*/
function _timelockSalt(bytes32 descriptionHash) private view returns (bytes32) {
return bytes20(address(this)) ^ descriptionHash;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (governance/extensions/GovernorVotes.sol)
pragma solidity ^0.8.24;
import {Governor} from "../Governor.sol";
import {IVotes} from "../utils/IVotes.sol";
import {IERC5805} from "../../interfaces/IERC5805.sol";
import {Time} from "../../utils/types/Time.sol";
/**
* @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token, or since v4.5 an {ERC721Votes}
* token.
*/
abstract contract GovernorVotes is Governor {
IERC5805 private immutable _token;
constructor(IVotes tokenAddress) {
_token = IERC5805(address(tokenAddress));
}
/**
* @dev The token that voting power is sourced from.
*/
function token() public view virtual returns (IERC5805) {
return _token;
}
/**
* @dev Clock (as specified in ERC-6372) is set to match the token's clock. Fallback to block numbers if the token
* does not implement ERC-6372.
*/
function clock() public view virtual override returns (uint48) {
try token().clock() returns (uint48 timepoint) {
return timepoint;
} catch {
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 override returns (string memory) {
try token().CLOCK_MODE() returns (string memory clockmode) {
return clockmode;
} catch {
return "mode=blocknumber&from=default";
}
}
/**
* Read the voting weight from the token's built in snapshot mechanism (see {Governor-_getVotes}).
*/
function _getVotes(
address account,
uint256 timepoint,
bytes memory /*params*/
) internal view virtual override returns (uint256) {
return token().getPastVotes(account, timepoint);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (governance/extensions/GovernorVotesQuorumFraction.sol)
pragma solidity ^0.8.24;
import {GovernorVotes} from "./GovernorVotes.sol";
import {Math} from "../../utils/math/Math.sol";
import {SafeCast} from "../../utils/math/SafeCast.sol";
import {Checkpoints} from "../../utils/structs/Checkpoints.sol";
/**
* @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token and a quorum expressed as a
* fraction of the total supply.
*/
abstract contract GovernorVotesQuorumFraction is GovernorVotes {
using Checkpoints for Checkpoints.Trace208;
Checkpoints.Trace208 private _quorumNumeratorHistory;
event QuorumNumeratorUpdated(uint256 oldQuorumNumerator, uint256 newQuorumNumerator);
/**
* @dev The quorum set is not a valid fraction.
*/
error GovernorInvalidQuorumFraction(uint256 quorumNumerator, uint256 quorumDenominator);
/**
* @dev Initialize quorum as a fraction of the token's total supply.
*
* The fraction is specified as `numerator / denominator`. By default the denominator is 100, so quorum is
* specified as a percent: a numerator of 10 corresponds to quorum being 10% of total supply. The denominator can be
* customized by overriding {quorumDenominator}.
*/
constructor(uint256 quorumNumeratorValue) {
_updateQuorumNumerator(quorumNumeratorValue);
}
/**
* @dev Returns the current quorum numerator. See {quorumDenominator}.
*/
function quorumNumerator() public view virtual returns (uint256) {
return _quorumNumeratorHistory.latest();
}
/**
* @dev Returns the quorum numerator at a specific timepoint. See {quorumDenominator}.
*/
function quorumNumerator(uint256 timepoint) public view virtual returns (uint256) {
return _optimisticUpperLookupRecent(_quorumNumeratorHistory, timepoint);
}
/**
* @dev Returns the quorum denominator. Defaults to 100, but may be overridden.
*/
function quorumDenominator() public view virtual returns (uint256) {
return 100;
}
/**
* @dev Returns the quorum for a timepoint, in terms of number of votes: `supply * numerator / denominator`.
*/
function quorum(uint256 timepoint) public view virtual override returns (uint256) {
return Math.mulDiv(token().getPastTotalSupply(timepoint), quorumNumerator(timepoint), quorumDenominator());
}
/**
* @dev Changes the quorum numerator.
*
* Emits a {QuorumNumeratorUpdated} event.
*
* Requirements:
*
* - Must be called through a governance proposal.
* - New numerator must be smaller or equal to the denominator.
*/
function updateQuorumNumerator(uint256 newQuorumNumerator) external virtual onlyGovernance {
_updateQuorumNumerator(newQuorumNumerator);
}
/**
* @dev Changes the quorum numerator.
*
* Emits a {QuorumNumeratorUpdated} event.
*
* Requirements:
*
* - New numerator must be smaller or equal to the denominator.
*/
function _updateQuorumNumerator(uint256 newQuorumNumerator) internal virtual {
uint256 denominator = quorumDenominator();
if (newQuorumNumerator > denominator) {
revert GovernorInvalidQuorumFraction(newQuorumNumerator, denominator);
}
uint256 oldQuorumNumerator = quorumNumerator();
_quorumNumeratorHistory.push(clock(), SafeCast.toUint208(newQuorumNumerator));
emit QuorumNumeratorUpdated(oldQuorumNumerator, newQuorumNumerator);
}
/**
* @dev Returns the numerator at a specific timepoint.
*/
function _optimisticUpperLookupRecent(
Checkpoints.Trace208 storage ckpts,
uint256 timepoint
) internal view returns (uint256) {
// If trace is empty, key and value are both equal to 0.
// In that case `key <= timepoint` is true, and it is ok to return 0.
(, uint48 key, uint208 value) = ckpts.latestCheckpoint();
return key <= timepoint ? value : ckpts.upperLookupRecent(SafeCast.toUint48(timepoint));
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (governance/Governor.sol)
pragma solidity ^0.8.24;
import {IERC721Receiver} from "../token/ERC721/IERC721Receiver.sol";
import {IERC1155Receiver} from "../token/ERC1155/IERC1155Receiver.sol";
import {EIP712} from "../utils/cryptography/EIP712.sol";
import {SignatureChecker} from "../utils/cryptography/SignatureChecker.sol";
import {IERC165, ERC165} from "../utils/introspection/ERC165.sol";
import {SafeCast} from "../utils/math/SafeCast.sol";
import {DoubleEndedQueue} from "../utils/structs/DoubleEndedQueue.sol";
import {Address} from "../utils/Address.sol";
import {Context} from "../utils/Context.sol";
import {Nonces} from "../utils/Nonces.sol";
import {Strings} from "../utils/Strings.sol";
import {IGovernor, IERC6372} from "./IGovernor.sol";
/**
* @dev Core of the governance system, designed to be extended through various modules.
*
* This contract is abstract and requires several functions to be implemented in various modules:
*
* - A counting module must implement {_quorumReached}, {_voteSucceeded} and {_countVote}
* - A voting module must implement {_getVotes}
* - Additionally, {votingPeriod}, {votingDelay}, and {quorum} must also be implemented
*/
abstract contract Governor is Context, ERC165, EIP712, Nonces, IGovernor, IERC721Receiver, IERC1155Receiver {
using DoubleEndedQueue for DoubleEndedQueue.Bytes32Deque;
bytes32 public constant BALLOT_TYPEHASH =
keccak256("Ballot(uint256 proposalId,uint8 support,address voter,uint256 nonce)");
bytes32 public constant EXTENDED_BALLOT_TYPEHASH =
keccak256(
"ExtendedBallot(uint256 proposalId,uint8 support,address voter,uint256 nonce,string reason,bytes params)"
);
struct ProposalCore {
address proposer;
uint48 voteStart;
uint32 voteDuration;
bool executed;
bool canceled;
uint48 etaSeconds;
}
bytes32 private constant ALL_PROPOSAL_STATES_BITMAP = bytes32((2 ** (uint8(type(ProposalState).max) + 1)) - 1);
string private _name;
mapping(uint256 proposalId => ProposalCore) private _proposals;
// This queue keeps track of the governor operating on itself. Calls to functions protected by the {onlyGovernance}
// modifier needs to be whitelisted in this queue. Whitelisting is set in {execute}, consumed by the
// {onlyGovernance} modifier and eventually reset after {_executeOperations} completes. This ensures that the
// execution of {onlyGovernance} protected calls can only be achieved through successful proposals.
DoubleEndedQueue.Bytes32Deque private _governanceCall;
/**
* @dev Restricts a function so it can only be executed through governance proposals. For example, governance
* parameter setters in {GovernorSettings} are protected using this modifier.
*
* The governance executing address may be different from the Governor's own address, for example it could be a
* timelock. This can be customized by modules by overriding {_executor}. The executor is only able to invoke these
* functions during the execution of the governor's {execute} function, and not under any other circumstances. Thus,
* for example, additional timelock proposers are not able to change governance parameters without going through the
* governance protocol (since v4.6).
*/
modifier onlyGovernance() {
_checkGovernance();
_;
}
/**
* @dev Sets the value for {name} and {version}
*/
constructor(string memory name_) EIP712(name_, version()) {
_name = name_;
}
/**
* @dev Function to receive ETH that will be handled by the governor (disabled if executor is a third party contract)
*/
receive() external payable virtual {
if (_executor() != address(this)) {
revert GovernorDisabledDeposit();
}
}
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return
interfaceId == type(IGovernor).interfaceId ||
interfaceId == type(IGovernor).interfaceId ^ IGovernor.getProposalId.selector ||
interfaceId == type(IERC1155Receiver).interfaceId ||
super.supportsInterface(interfaceId);
}
/// @inheritdoc IGovernor
function name() public view virtual returns (string memory) {
return _name;
}
/// @inheritdoc IGovernor
function version() public view virtual returns (string memory) {
return "1";
}
/**
* @dev See {IGovernor-hashProposal}.
*
* The proposal id is produced by hashing the ABI encoded `targets` array, the `values` array, the `calldatas` array
* and the descriptionHash (bytes32 which itself is the keccak256 hash of the description string). This proposal id
* can be produced from the proposal data which is part of the {ProposalCreated} event. It can even be computed in
* advance, before the proposal is submitted.
*
* Note that the chainId and the governor address are not part of the proposal id computation. Consequently, the
* same proposal (with same operation and same description) will have the same id if submitted on multiple governors
* across multiple networks. This also means that in order to execute the same operation twice (on the same
* governor) the proposer will have to change the description in order to avoid proposal id conflicts.
*/
function hashProposal(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) public pure virtual returns (uint256) {
return uint256(keccak256(abi.encode(targets, values, calldatas, descriptionHash)));
}
/// @inheritdoc IGovernor
function getProposalId(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) public view virtual returns (uint256) {
return hashProposal(targets, values, calldatas, descriptionHash);
}
/// @inheritdoc IGovernor
function state(uint256 proposalId) public view virtual returns (ProposalState) {
// We read the struct fields into the stack at once so Solidity emits a single SLOAD
ProposalCore storage proposal = _proposals[proposalId];
bool proposalExecuted = proposal.executed;
bool proposalCanceled = proposal.canceled;
if (proposalExecuted) {
return ProposalState.Executed;
}
if (proposalCanceled) {
return ProposalState.Canceled;
}
uint256 snapshot = proposalSnapshot(proposalId);
if (snapshot == 0) {
revert GovernorNonexistentProposal(proposalId);
}
uint256 currentTimepoint = clock();
if (snapshot >= currentTimepoint) {
return ProposalState.Pending;
}
uint256 deadline = proposalDeadline(proposalId);
if (deadline >= currentTimepoint) {
return ProposalState.Active;
} else if (!_quorumReached(proposalId) || !_voteSucceeded(proposalId)) {
return ProposalState.Defeated;
} else if (proposalEta(proposalId) == 0) {
return ProposalState.Succeeded;
} else {
return ProposalState.Queued;
}
}
/// @inheritdoc IGovernor
function proposalThreshold() public view virtual returns (uint256) {
return 0;
}
/// @inheritdoc IGovernor
function proposalSnapshot(uint256 proposalId) public view virtual returns (uint256) {
return _proposals[proposalId].voteStart;
}
/// @inheritdoc IGovernor
function proposalDeadline(uint256 proposalId) public view virtual returns (uint256) {
return _proposals[proposalId].voteStart + _proposals[proposalId].voteDuration;
}
/// @inheritdoc IGovernor
function proposalProposer(uint256 proposalId) public view virtual returns (address) {
return _proposals[proposalId].proposer;
}
/// @inheritdoc IGovernor
function proposalEta(uint256 proposalId) public view virtual returns (uint256) {
return _proposals[proposalId].etaSeconds;
}
/// @inheritdoc IGovernor
function proposalNeedsQueuing(uint256) public view virtual returns (bool) {
return false;
}
/**
* @dev Reverts if the `msg.sender` is not the executor. In case the executor is not this contract
* itself, the function reverts if `msg.data` is not whitelisted as a result of an {execute}
* operation. See {onlyGovernance}.
*/
function _checkGovernance() internal virtual {
if (_executor() != _msgSender()) {
revert GovernorOnlyExecutor(_msgSender());
}
if (_executor() != address(this)) {
bytes32 msgDataHash = keccak256(_msgData());
// loop until popping the expected operation - throw if deque is empty (operation not authorized)
while (_governanceCall.popFront() != msgDataHash) {}
}
}
/**
* @dev Amount of votes already cast passes the threshold limit.
*/
function _quorumReached(uint256 proposalId) internal view virtual returns (bool);
/**
* @dev Is the proposal successful or not.
*/
function _voteSucceeded(uint256 proposalId) internal view virtual returns (bool);
/**
* @dev Get the voting weight of `account` at a specific `timepoint`, for a vote as described by `params`.
*/
function _getVotes(address account, uint256 timepoint, bytes memory params) internal view virtual returns (uint256);
/**
* @dev Register a vote for `proposalId` by `account` with a given `support`, voting `weight` and voting `params`.
*
* Note: Support is generic and can represent various things depending on the voting system used.
*/
function _countVote(
uint256 proposalId,
address account,
uint8 support,
uint256 totalWeight,
bytes memory params
) internal virtual returns (uint256);
/**
* @dev Hook that should be called every time the tally for a proposal is updated.
*
* Note: This function must run successfully. Reverts will result in the bricking of governance
*/
function _tallyUpdated(uint256 proposalId) internal virtual {}
/**
* @dev Default additional encoded parameters used by castVote methods that don't include them
*
* Note: Should be overridden by specific implementations to use an appropriate value, the
* meaning of the additional params, in the context of that implementation
*/
function _defaultParams() internal view virtual returns (bytes memory) {
return "";
}
/**
* @dev See {IGovernor-propose}. This function has opt-in frontrunning protection, described in {_isValidDescriptionForProposer}.
*/
function propose(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
string memory description
) public virtual returns (uint256) {
address proposer = _msgSender();
// check description restriction
if (!_isValidDescriptionForProposer(proposer, description)) {
revert GovernorRestrictedProposer(proposer);
}
// check proposal threshold
uint256 votesThreshold = proposalThreshold();
if (votesThreshold > 0) {
uint256 proposerVotes = getVotes(proposer, clock() - 1);
if (proposerVotes < votesThreshold) {
revert GovernorInsufficientProposerVotes(proposer, proposerVotes, votesThreshold);
}
}
return _propose(targets, values, calldatas, description, proposer);
}
/**
* @dev Internal propose mechanism. Can be overridden to add more logic on proposal creation.
*
* Emits a {IGovernor-ProposalCreated} event.
*/
function _propose(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
string memory description,
address proposer
) internal virtual returns (uint256 proposalId) {
proposalId = getProposalId(targets, values, calldatas, keccak256(bytes(description)));
if (targets.length != values.length || targets.length != calldatas.length || targets.length == 0) {
revert GovernorInvalidProposalLength(targets.length, calldatas.length, values.length);
}
if (_proposals[proposalId].voteStart != 0) {
revert GovernorUnexpectedProposalState(proposalId, state(proposalId), bytes32(0));
}
uint256 snapshot = clock() + votingDelay();
uint256 duration = votingPeriod();
ProposalCore storage proposal = _proposals[proposalId];
proposal.proposer = proposer;
proposal.voteStart = SafeCast.toUint48(snapshot);
proposal.voteDuration = SafeCast.toUint32(duration);
emit ProposalCreated(
proposalId,
proposer,
targets,
values,
new string[](targets.length),
calldatas,
snapshot,
snapshot + duration,
description
);
// Using a named return variable to avoid stack too deep errors
}
/// @inheritdoc IGovernor
function queue(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) public virtual returns (uint256) {
uint256 proposalId = getProposalId(targets, values, calldatas, descriptionHash);
_validateStateBitmap(proposalId, _encodeStateBitmap(ProposalState.Succeeded));
uint48 etaSeconds = _queueOperations(proposalId, targets, values, calldatas, descriptionHash);
if (etaSeconds != 0) {
_proposals[proposalId].etaSeconds = etaSeconds;
emit ProposalQueued(proposalId, etaSeconds);
} else {
revert GovernorQueueNotImplemented();
}
return proposalId;
}
/**
* @dev Internal queuing mechanism. Can be overridden (without a super call) to modify the way queuing is
* performed (for example adding a vault/timelock).
*
* This is empty by default, and must be overridden to implement queuing.
*
* This function returns a timestamp that describes the expected ETA for execution. If the returned value is 0
* (which is the default value), the core will consider queueing did not succeed, and the public {queue} function
* will revert.
*
* NOTE: Calling this function directly will NOT check the current state of the proposal, or emit the
* `ProposalQueued` event. Queuing a proposal should be done using {queue}.
*/
function _queueOperations(
uint256 /*proposalId*/,
address[] memory /*targets*/,
uint256[] memory /*values*/,
bytes[] memory /*calldatas*/,
bytes32 /*descriptionHash*/
) internal virtual returns (uint48) {
return 0;
}
/// @inheritdoc IGovernor
function execute(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) public payable virtual returns (uint256) {
uint256 proposalId = getProposalId(targets, values, calldatas, descriptionHash);
_validateStateBitmap(
proposalId,
_encodeStateBitmap(ProposalState.Succeeded) | _encodeStateBitmap(ProposalState.Queued)
);
// mark as executed before calls to avoid reentrancy
_proposals[proposalId].executed = true;
// before execute: register governance call in queue.
if (_executor() != address(this)) {
for (uint256 i = 0; i < targets.length; ++i) {
if (targets[i] == address(this)) {
_governanceCall.pushBack(keccak256(calldatas[i]));
}
}
}
_executeOperations(proposalId, targets, values, calldatas, descriptionHash);
// after execute: cleanup governance call queue.
if (_executor() != address(this) && !_governanceCall.empty()) {
_governanceCall.clear();
}
emit ProposalExecuted(proposalId);
return proposalId;
}
/**
* @dev Internal execution mechanism. Can be overridden (without a super call) to modify the way execution is
* performed (for example adding a vault/timelock).
*
* NOTE: Calling this function directly will NOT check the current state of the proposal, set the executed flag to
* true or emit the `ProposalExecuted` event. Executing a proposal should be done using {execute}.
*/
function _executeOperations(
uint256 /* proposalId */,
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 /*descriptionHash*/
) internal virtual {
for (uint256 i = 0; i < targets.length; ++i) {
(bool success, bytes memory returndata) = targets[i].call{value: values[i]}(calldatas[i]);
Address.verifyCallResult(success, returndata);
}
}
/// @inheritdoc IGovernor
function cancel(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) public virtual returns (uint256) {
// The proposalId will be recomputed in the `_cancel` call further down. However we need the value before we
// do the internal call, because we need to check the proposal state BEFORE the internal `_cancel` call
// changes it. The `getProposalId` duplication has a cost that is limited, and that we accept.
uint256 proposalId = getProposalId(targets, values, calldatas, descriptionHash);
address caller = _msgSender();
if (!_validateCancel(proposalId, caller)) revert GovernorUnableToCancel(proposalId, caller);
return _cancel(targets, values, calldatas, descriptionHash);
}
/**
* @dev Internal cancel mechanism with minimal restrictions. A proposal can be cancelled in any state other than
* Canceled, Expired, or Executed. Once cancelled a proposal can't be re-submitted.
*
* Emits a {IGovernor-ProposalCanceled} event.
*/
function _cancel(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) internal virtual returns (uint256) {
uint256 proposalId = getProposalId(targets, values, calldatas, descriptionHash);
_validateStateBitmap(
proposalId,
ALL_PROPOSAL_STATES_BITMAP ^
_encodeStateBitmap(ProposalState.Canceled) ^
_encodeStateBitmap(ProposalState.Expired) ^
_encodeStateBitmap(ProposalState.Executed)
);
_proposals[proposalId].canceled = true;
emit ProposalCanceled(proposalId);
return proposalId;
}
/// @inheritdoc IGovernor
function getVotes(address account, uint256 timepoint) public view virtual returns (uint256) {
return _getVotes(account, timepoint, _defaultParams());
}
/// @inheritdoc IGovernor
function getVotesWithParams(
address account,
uint256 timepoint,
bytes memory params
) public view virtual returns (uint256) {
return _getVotes(account, timepoint, params);
}
/// @inheritdoc IGovernor
function castVote(uint256 proposalId, uint8 support) public virtual returns (uint256) {
address voter = _msgSender();
return _castVote(proposalId, voter, support, "");
}
/// @inheritdoc IGovernor
function castVoteWithReason(
uint256 proposalId,
uint8 support,
string calldata reason
) public virtual returns (uint256) {
address voter = _msgSender();
return _castVote(proposalId, voter, support, reason);
}
/// @inheritdoc IGovernor
function castVoteWithReasonAndParams(
uint256 proposalId,
uint8 support,
string calldata reason,
bytes memory params
) public virtual returns (uint256) {
address voter = _msgSender();
return _castVote(proposalId, voter, support, reason, params);
}
/// @inheritdoc IGovernor
function castVoteBySig(
uint256 proposalId,
uint8 support,
address voter,
bytes memory signature
) public virtual returns (uint256) {
if (!_validateVoteSig(proposalId, support, voter, signature)) {
revert GovernorInvalidSignature(voter);
}
return _castVote(proposalId, voter, support, "");
}
/// @inheritdoc IGovernor
function castVoteWithReasonAndParamsBySig(
uint256 proposalId,
uint8 support,
address voter,
string calldata reason,
bytes memory params,
bytes memory signature
) public virtual returns (uint256) {
if (!_validateExtendedVoteSig(proposalId, support, voter, reason, params, signature)) {
revert GovernorInvalidSignature(voter);
}
return _castVote(proposalId, voter, support, reason, params);
}
/// @dev Validate the `signature` used in {castVoteBySig} function.
function _validateVoteSig(
uint256 proposalId,
uint8 support,
address voter,
bytes memory signature
) internal virtual returns (bool) {
return
SignatureChecker.isValidSignatureNow(
voter,
_hashTypedDataV4(keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support, voter, _useNonce(voter)))),
signature
);
}
/// @dev Validate the `signature` used in {castVoteWithReasonAndParamsBySig} function.
function _validateExtendedVoteSig(
uint256 proposalId,
uint8 support,
address voter,
string memory reason,
bytes memory params,
bytes memory signature
) internal virtual returns (bool) {
return
SignatureChecker.isValidSignatureNow(
voter,
_hashTypedDataV4(
keccak256(
abi.encode(
EXTENDED_BALLOT_TYPEHASH,
proposalId,
support,
voter,
_useNonce(voter),
keccak256(bytes(reason)),
keccak256(params)
)
)
),
signature
);
}
/**
* @dev Internal vote casting mechanism: Check that the vote is pending, that it has not been cast yet, retrieve
* voting weight using {IGovernor-getVotes} and call the {_countVote} internal function. Uses the _defaultParams().
*
* Emits a {IGovernor-VoteCast} event.
*/
function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason
) internal virtual returns (uint256) {
return _castVote(proposalId, account, support, reason, _defaultParams());
}
/**
* @dev Internal vote casting mechanism: Check that the vote is pending, that it has not been cast yet, retrieve
* voting weight using {IGovernor-getVotes} and call the {_countVote} internal function.
*
* Emits a {IGovernor-VoteCast} event.
*/
function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason,
bytes memory params
) internal virtual returns (uint256) {
_validateStateBitmap(proposalId, _encodeStateBitmap(ProposalState.Active));
uint256 totalWeight = _getVotes(account, proposalSnapshot(proposalId), params);
uint256 votedWeight = _countVote(proposalId, account, support, totalWeight, params);
if (params.length == 0) {
emit VoteCast(account, proposalId, support, votedWeight, reason);
} else {
emit VoteCastWithParams(account, proposalId, support, votedWeight, reason, params);
}
_tallyUpdated(proposalId);
return votedWeight;
}
/**
* @dev Relays a transaction or function call to an arbitrary target. In cases where the governance executor
* is some contract other than the governor itself, like when using a timelock, this function can be invoked
* in a governance proposal to recover tokens or Ether that was sent to the governor contract by mistake.
* Note that if the executor is simply the governor itself, use of `relay` is redundant.
*/
function relay(address target, uint256 value, bytes calldata data) external payable virtual onlyGovernance {
(bool success, bytes memory returndata) = target.call{value: value}(data);
Address.verifyCallResult(success, returndata);
}
/**
* @dev Address through which the governor executes action. Will be overloaded by module that execute actions
* through another contract such as a timelock.
*/
function _executor() internal view virtual returns (address) {
return address(this);
}
/**
* @dev See {IERC721Receiver-onERC721Received}.
* Receiving tokens is disabled if the governance executor is other than the governor itself (eg. when using with a timelock).
*/
function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
if (_executor() != address(this)) {
revert GovernorDisabledDeposit();
}
return this.onERC721Received.selector;
}
/**
* @dev See {IERC1155Receiver-onERC1155Received}.
* Receiving tokens is disabled if the governance executor is other than the governor itself (eg. when using with a timelock).
*/
function onERC1155Received(address, address, uint256, uint256, bytes memory) public virtual returns (bytes4) {
if (_executor() != address(this)) {
revert GovernorDisabledDeposit();
}
return this.onERC1155Received.selector;
}
/**
* @dev See {IERC1155Receiver-onERC1155BatchReceived}.
* Receiving tokens is disabled if the governance executor is other than the governor itself (eg. when using with a timelock).
*/
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual returns (bytes4) {
if (_executor() != address(this)) {
revert GovernorDisabledDeposit();
}
return this.onERC1155BatchReceived.selector;
}
/**
* @dev Encodes a `ProposalState` into a `bytes32` representation where each bit enabled corresponds to
* the underlying position in the `ProposalState` enum. For example:
*
* 0x000...10000
* ^^^^^^------ ...
* ^----- Succeeded
* ^---- Defeated
* ^--- Canceled
* ^-- Active
* ^- Pending
*/
function _encodeStateBitmap(ProposalState proposalState) internal pure returns (bytes32) {
return bytes32(1 << uint8(proposalState));
}
/**
* @dev Check that the current state of a proposal matches the requirements described by the `allowedStates` bitmap.
* This bitmap should be built using `_encodeStateBitmap`.
*
* If requirements are not met, reverts with a {GovernorUnexpectedProposalState} error.
*/
function _validateStateBitmap(uint256 proposalId, bytes32 allowedStates) internal view returns (ProposalState) {
ProposalState currentState = state(proposalId);
if (_encodeStateBitmap(currentState) & allowedStates == bytes32(0)) {
revert GovernorUnexpectedProposalState(proposalId, currentState, allowedStates);
}
return currentState;
}
/*
* @dev Check if the proposer is authorized to submit a proposal with the given description.
*
* If the proposal description ends with `#proposer=0x???`, where `0x???` is an address written as a hex string
* (case insensitive), then the submission of this proposal will only be authorized to said address.
*
* This is used for frontrunning protection. By adding this pattern at the end of their proposal, one can ensure
* that no other address can submit the same proposal. An attacker would have to either remove or change that part,
* which would result in a different proposal id.
*
* If the description does not match this pattern, it is unrestricted and anyone can submit it. This includes:
* - If the `0x???` part is not a valid hex string.
* - If the `0x???` part is a valid hex string, but does not contain exactly 40 hex digits.
* - If it ends with the expected suffix followed by newlines or other whitespace.
* - If it ends with some other similar suffix, e.g. `#other=abc`.
* - If it does not end with any such suffix.
*/
function _isValidDescriptionForProposer(
address proposer,
string memory description
) internal view virtual returns (bool) {
unchecked {
uint256 length = bytes(description).length;
// Length is too short to contain a valid proposer suffix
if (length < 52) {
return true;
}
// Extract what would be the `#proposer=` marker beginning the suffix
bytes10 marker = bytes10(_unsafeReadBytesOffset(bytes(description), length - 52));
// If the marker is not found, there is no proposer suffix to check
if (marker != bytes10("#proposer=")) {
return true;
}
// Check that the last 42 characters (after the marker) are a properly formatted address.
(bool success, address recovered) = Strings.tryParseAddress(description, length - 42, length);
return !success || recovered == proposer;
}
}
/**
* @dev Check if the `caller` can cancel the proposal with the given `proposalId`.
*
* The default implementation allows the proposal proposer to cancel the proposal during the pending state.
*/
function _validateCancel(uint256 proposalId, address caller) internal view virtual returns (bool) {
return (state(proposalId) == ProposalState.Pending) && caller == proposalProposer(proposalId);
}
/// @inheritdoc IERC6372
function clock() public view virtual returns (uint48);
/// @inheritdoc IERC6372
// solhint-disable-next-line func-name-mixedcase
function CLOCK_MODE() public view virtual returns (string memory);
/// @inheritdoc IGovernor
function votingDelay() public view virtual returns (uint256);
/// @inheritdoc IGovernor
function votingPeriod() public view virtual returns (uint256);
/// @inheritdoc IGovernor
function quorum(uint256 timepoint) public view virtual returns (uint256);
/**
* @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))
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (governance/IGovernor.sol)
pragma solidity >=0.8.4;
import {IERC165} from "../interfaces/IERC165.sol";
import {IERC6372} from "../interfaces/IERC6372.sol";
/**
* @dev Interface of the {Governor} core.
*
* NOTE: Event parameters lack the `indexed` keyword for compatibility with GovernorBravo events.
* Making event parameters `indexed` affects how events are decoded, potentially breaking existing indexers.
*/
interface IGovernor is IERC165, IERC6372 {
enum ProposalState {
Pending,
Active,
Canceled,
Defeated,
Succeeded,
Queued,
Expired,
Executed
}
/**
* @dev Empty proposal or a mismatch between the parameters length for a proposal call.
*/
error GovernorInvalidProposalLength(uint256 targets, uint256 calldatas, uint256 values);
/**
* @dev The vote was already cast.
*/
error GovernorAlreadyCastVote(address voter);
/**
* @dev Token deposits are disabled in this contract.
*/
error GovernorDisabledDeposit();
/**
* @dev The `account` is not the governance executor.
*/
error GovernorOnlyExecutor(address account);
/**
* @dev The `proposalId` doesn't exist.
*/
error GovernorNonexistentProposal(uint256 proposalId);
/**
* @dev The current state of a proposal is not the required for performing an operation.
* The `expectedStates` is a bitmap with the bits enabled for each ProposalState enum position
* counting from right to left.
*
* NOTE: If `expectedState` is `bytes32(0)`, the proposal is expected to not be in any state (i.e. not exist).
* This is the case when a proposal that is expected to be unset is already initiated (the proposal is duplicated).
*
* See {Governor-_encodeStateBitmap}.
*/
error GovernorUnexpectedProposalState(uint256 proposalId, ProposalState current, bytes32 expectedStates);
/**
* @dev The voting period set is not a valid period.
*/
error GovernorInvalidVotingPeriod(uint256 votingPeriod);
/**
* @dev The `proposer` does not have the required votes to create a proposal.
*/
error GovernorInsufficientProposerVotes(address proposer, uint256 votes, uint256 threshold);
/**
* @dev The `proposer` is not allowed to create a proposal.
*/
error GovernorRestrictedProposer(address proposer);
/**
* @dev The vote type used is not valid for the corresponding counting module.
*/
error GovernorInvalidVoteType();
/**
* @dev The provided params buffer is not supported by the counting module.
*/
error GovernorInvalidVoteParams();
/**
* @dev Queue operation is not implemented for this governor. Execute should be called directly.
*/
error GovernorQueueNotImplemented();
/**
* @dev The proposal hasn't been queued yet.
*/
error GovernorNotQueuedProposal(uint256 proposalId);
/**
* @dev The proposal has already been queued.
*/
error GovernorAlreadyQueuedProposal(uint256 proposalId);
/**
* @dev The provided signature is not valid for the expected `voter`.
* If the `voter` is a contract, the signature is not valid using {IERC1271-isValidSignature}.
*/
error GovernorInvalidSignature(address voter);
/**
* @dev The given `account` is unable to cancel the proposal with given `proposalId`.
*/
error GovernorUnableToCancel(uint256 proposalId, address account);
/**
* @dev Emitted when a proposal is created.
*/
event ProposalCreated(
uint256 proposalId,
address proposer,
address[] targets,
uint256[] values,
string[] signatures,
bytes[] calldatas,
uint256 voteStart,
uint256 voteEnd,
string description
);
/**
* @dev Emitted when a proposal is queued.
*/
event ProposalQueued(uint256 proposalId, uint256 etaSeconds);
/**
* @dev Emitted when a proposal is executed.
*/
event ProposalExecuted(uint256 proposalId);
/**
* @dev Emitted when a proposal is canceled.
*/
event ProposalCanceled(uint256 proposalId);
/**
* @dev Emitted when a vote is cast without params.
*
* Note: `support` values should be seen as buckets. Their interpretation depends on the voting module used.
*/
event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason);
/**
* @dev Emitted when a vote is cast with params.
*
* Note: `support` values should be seen as buckets. Their interpretation depends on the voting module used.
* `params` are additional encoded parameters. Their interpretation also depends on the voting module used.
*/
event VoteCastWithParams(
address indexed voter,
uint256 proposalId,
uint8 support,
uint256 weight,
string reason,
bytes params
);
/**
* @notice module:core
* @dev Name of the governor instance (used in building the EIP-712 domain separator).
*/
function name() external view returns (string memory);
/**
* @notice module:core
* @dev Version of the governor instance (used in building the EIP-712 domain separator). Default: "1"
*/
function version() external view returns (string memory);
/**
* @notice module:voting
* @dev A description of the possible `support` values for {castVote} and the way these votes are counted, meant to
* be consumed by UIs to show correct vote options and interpret the results. The string is a URL-encoded sequence of
* key-value pairs that each describe one aspect, for example `support=bravo&quorum=for,abstain`.
*
* There are 2 standard keys: `support` and `quorum`.
*
* - `support=bravo` refers to the vote options 0 = Against, 1 = For, 2 = Abstain, as in `GovernorBravo`.
* - `quorum=bravo` means that only For votes are counted towards quorum.
* - `quorum=for,abstain` means that both For and Abstain votes are counted towards quorum.
*
* If a counting module makes use of encoded `params`, it should include this under a `params` key with a unique
* name that describes the behavior. For example:
*
* - `params=fractional` might refer to a scheme where votes are divided fractionally between for/against/abstain.
* - `params=erc721` might refer to a scheme where specific NFTs are delegated to vote.
*
* NOTE: The string can be decoded by the standard
* https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams[`URLSearchParams`]
* JavaScript class.
*/
// solhint-disable-next-line func-name-mixedcase
function COUNTING_MODE() external view returns (string memory);
/**
* @notice module:core
* @dev Hashing function used to (re)build the proposal id from the proposal details.
*
* NOTE: For all off-chain and external calls, use {getProposalId}.
*/
function hashProposal(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) external pure returns (uint256);
/**
* @notice module:core
* @dev Function used to get the proposal id from the proposal details.
*/
function getProposalId(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) external view returns (uint256);
/**
* @notice module:core
* @dev Current state of a proposal, following Compound's convention
*/
function state(uint256 proposalId) external view returns (ProposalState);
/**
* @notice module:core
* @dev The number of votes required in order for a voter to become a proposer.
*/
function proposalThreshold() external view returns (uint256);
/**
* @notice module:core
* @dev Timepoint used to retrieve user's votes and quorum. If using block number (as per Compound's Comp), the
* snapshot is performed at the end of this block. Hence, voting for this proposal starts at the beginning of the
* following block.
*/
function proposalSnapshot(uint256 proposalId) external view returns (uint256);
/**
* @notice module:core
* @dev Timepoint at which votes close. If using block number, votes close at the end of this block, so it is
* possible to cast a vote during this block.
*/
function proposalDeadline(uint256 proposalId) external view returns (uint256);
/**
* @notice module:core
* @dev The account that created a proposal.
*/
function proposalProposer(uint256 proposalId) external view returns (address);
/**
* @notice module:core
* @dev The time when a queued proposal becomes executable ("ETA"). Unlike {proposalSnapshot} and
* {proposalDeadline}, this doesn't use the governor clock, and instead relies on the executor's clock which may be
* different. In most cases this will be a timestamp.
*/
function proposalEta(uint256 proposalId) external view returns (uint256);
/**
* @notice module:core
* @dev Whether a proposal needs to be queued before execution.
*/
function proposalNeedsQueuing(uint256 proposalId) external view returns (bool);
/**
* @notice module:user-config
* @dev Delay, between the proposal is created and the vote starts. The unit this duration is expressed in depends
* on the clock (see ERC-6372) this contract uses.
*
* This can be increased to leave time for users to buy voting power, or delegate it, before the voting of a
* proposal starts.
*
* NOTE: While this interface returns a uint256, timepoints are stored as uint48 following the ERC-6372 clock type.
* Consequently this value must fit in a uint48 (when added to the current clock). See {IERC6372-clock}.
*/
function votingDelay() external view returns (uint256);
/**
* @notice module:user-config
* @dev Delay between the vote start and vote end. The unit this duration is expressed in depends on the clock
* (see ERC-6372) this contract uses.
*
* NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the voting
* duration compared to the voting delay.
*
* NOTE: This value is stored when the proposal is submitted so that possible changes to the value do not affect
* proposals that have already been submitted. The type used to save it is a uint32. Consequently, while this
* interface returns a uint256, the value it returns should fit in a uint32.
*/
function votingPeriod() external view returns (uint256);
/**
* @notice module:user-config
* @dev Minimum number of cast voted required for a proposal to be successful.
*
* NOTE: The `timepoint` parameter corresponds to the snapshot used for counting vote. This allows to scale the
* quorum depending on values such as the totalSupply of a token at this timepoint (see {ERC20Votes}).
*/
function quorum(uint256 timepoint) external view returns (uint256);
/**
* @notice module:reputation
* @dev Voting power of an `account` at a specific `timepoint`.
*
* Note: this can be implemented in a number of ways, for example by reading the delegated balance from one (or
* multiple), {ERC20Votes} tokens.
*/
function getVotes(address account, uint256 timepoint) external view returns (uint256);
/**
* @notice module:reputation
* @dev Voting power of an `account` at a specific `timepoint` given additional encoded parameters.
*/
function getVotesWithParams(
address account,
uint256 timepoint,
bytes memory params
) external view returns (uint256);
/**
* @notice module:voting
* @dev Returns whether `account` has cast a vote on `proposalId`.
*/
function hasVoted(uint256 proposalId, address account) external view returns (bool);
/**
* @dev Create a new proposal. Vote start after a delay specified by {IGovernor-votingDelay} and lasts for a
* duration specified by {IGovernor-votingPeriod}.
*
* Emits a {ProposalCreated} event.
*
* NOTE: The state of the Governor and `targets` may change between the proposal creation and its execution.
* This may be the result of third party actions on the targeted contracts, or other governor proposals.
* For example, the balance of this contract could be updated or its access control permissions may be modified,
* possibly compromising the proposal's ability to execute successfully (e.g. the governor doesn't have enough
* value to cover a proposal with multiple transfers).
*/
function propose(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
string memory description
) external returns (uint256 proposalId);
/**
* @dev Queue a proposal. Some governors require this step to be performed before execution can happen. If queuing
* is not necessary, this function may revert.
* Queuing a proposal requires the quorum to be reached, the vote to be successful, and the deadline to be reached.
*
* Emits a {ProposalQueued} event.
*/
function queue(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) external returns (uint256 proposalId);
/**
* @dev Execute a successful proposal. This requires the quorum to be reached, the vote to be successful, and the
* deadline to be reached. Depending on the governor it might also be required that the proposal was queued and
* that some delay passed.
*
* Emits a {ProposalExecuted} event.
*
* NOTE: Some modules can modify the requirements for execution, for example by adding an additional timelock.
*/
function execute(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) external payable returns (uint256 proposalId);
/**
* @dev Cancel a proposal. A proposal is cancellable by the proposer, but only while it is Pending state, i.e.
* before the vote starts.
*
* Emits a {ProposalCanceled} event.
*/
function cancel(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) external returns (uint256 proposalId);
/**
* @dev Cast a vote
*
* Emits a {VoteCast} event.
*/
function castVote(uint256 proposalId, uint8 support) external returns (uint256 balance);
/**
* @dev Cast a vote with a reason
*
* Emits a {VoteCast} event.
*/
function castVoteWithReason(
uint256 proposalId,
uint8 support,
string calldata reason
) external returns (uint256 balance);
/**
* @dev Cast a vote with a reason and additional encoded parameters
*
* Emits a {VoteCast} or {VoteCastWithParams} event depending on the length of params.
*/
function castVoteWithReasonAndParams(
uint256 proposalId,
uint8 support,
string calldata reason,
bytes memory params
) external returns (uint256 balance);
/**
* @dev Cast a vote using the voter's signature, including ERC-1271 signature support.
*
* Emits a {VoteCast} event.
*/
function castVoteBySig(
uint256 proposalId,
uint8 support,
address voter,
bytes memory signature
) external returns (uint256 balance);
/**
* @dev Cast a vote with a reason and additional encoded parameters using the voter's signature,
* including ERC-1271 signature support.
*
* Emits a {VoteCast} or {VoteCastWithParams} event depending on the length of params.
*/
function castVoteWithReasonAndParamsBySig(
uint256 proposalId,
uint8 support,
address voter,
string calldata reason,
bytes memory params,
bytes memory signature
) external returns (uint256 balance);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (governance/TimelockController.sol)
pragma solidity ^0.8.20;
import {AccessControl} from "../access/AccessControl.sol";
import {ERC721Holder} from "../token/ERC721/utils/ERC721Holder.sol";
import {ERC1155Holder} from "../token/ERC1155/utils/ERC1155Holder.sol";
import {Address} from "../utils/Address.sol";
import {IERC165} from "../utils/introspection/ERC165.sol";
/**
* @dev Contract module which acts as a timelocked controller. When set as the
* owner of an `Ownable` smart contract, it enforces a timelock on all
* `onlyOwner` maintenance operations. This gives time for users of the
* controlled contract to exit before a potentially dangerous maintenance
* operation is applied.
*
* By default, this contract is self administered, meaning administration tasks
* have to go through the timelock process. The proposer (resp executor) role
* is in charge of proposing (resp executing) operations. A common use case is
* to position this {TimelockController} as the owner of a smart contract, with
* a multisig or a DAO as the sole proposer.
*/
contract TimelockController is AccessControl, ERC721Holder, ERC1155Holder {
bytes32 public constant PROPOSER_ROLE = keccak256("PROPOSER_ROLE");
bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE");
bytes32 public constant CANCELLER_ROLE = keccak256("CANCELLER_ROLE");
uint256 internal constant _DONE_TIMESTAMP = uint256(1);
mapping(bytes32 id => uint256) private _timestamps;
uint256 private _minDelay;
enum OperationState {
Unset,
Waiting,
Ready,
Done
}
/**
* @dev Mismatch between the parameters length for an operation call.
*/
error TimelockInvalidOperationLength(uint256 targets, uint256 payloads, uint256 values);
/**
* @dev The schedule operation doesn't meet the minimum delay.
*/
error TimelockInsufficientDelay(uint256 delay, uint256 minDelay);
/**
* @dev The current state of an operation is not as required.
* The `expectedStates` is a bitmap with the bits enabled for each OperationState enum position
* counting from right to left.
*
* See {_encodeStateBitmap}.
*/
error TimelockUnexpectedOperationState(bytes32 operationId, bytes32 expectedStates);
/**
* @dev The predecessor to an operation not yet done.
*/
error TimelockUnexecutedPredecessor(bytes32 predecessorId);
/**
* @dev The caller account is not authorized.
*/
error TimelockUnauthorizedCaller(address caller);
/**
* @dev Emitted when a call is scheduled as part of operation `id`.
*/
event CallScheduled(
bytes32 indexed id,
uint256 indexed index,
address target,
uint256 value,
bytes data,
bytes32 predecessor,
uint256 delay
);
/**
* @dev Emitted when a call is performed as part of operation `id`.
*/
event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data);
/**
* @dev Emitted when new proposal is scheduled with non-zero salt.
*/
event CallSalt(bytes32 indexed id, bytes32 salt);
/**
* @dev Emitted when operation `id` is cancelled.
*/
event Cancelled(bytes32 indexed id);
/**
* @dev Emitted when the minimum delay for future operations is modified.
*/
event MinDelayChange(uint256 oldDuration, uint256 newDuration);
/**
* @dev Initializes the contract with the following parameters:
*
* - `minDelay`: initial minimum delay in seconds for operations
* - `proposers`: accounts to be granted proposer and canceller roles
* - `executors`: accounts to be granted executor role
* - `admin`: optional account to be granted admin role; disable with zero address
*
* IMPORTANT: The optional admin can aid with initial configuration of roles after deployment
* without being subject to delay, but this role should be subsequently renounced in favor of
* administration through timelocked proposals. Previous versions of this contract would assign
* this admin to the deployer automatically and should be renounced as well.
*/
constructor(uint256 minDelay, address[] memory proposers, address[] memory executors, address admin) {
// self administration
_grantRole(DEFAULT_ADMIN_ROLE, address(this));
// optional admin
if (admin != address(0)) {
_grantRole(DEFAULT_ADMIN_ROLE, admin);
}
// register proposers and cancellers
for (uint256 i = 0; i < proposers.length; ++i) {
_grantRole(PROPOSER_ROLE, proposers[i]);
_grantRole(CANCELLER_ROLE, proposers[i]);
}
// register executors
for (uint256 i = 0; i < executors.length; ++i) {
_grantRole(EXECUTOR_ROLE, executors[i]);
}
_minDelay = minDelay;
emit MinDelayChange(0, minDelay);
}
/**
* @dev Modifier to make a function callable only by a certain role. In
* addition to checking the sender's role, `address(0)` 's role is also
* considered. Granting a role to `address(0)` is equivalent to enabling
* this role for everyone.
*/
modifier onlyRoleOrOpenRole(bytes32 role) {
if (!hasRole(role, address(0))) {
_checkRole(role, _msgSender());
}
_;
}
/**
* @dev Contract might receive/hold ETH as part of the maintenance process.
*/
receive() external payable virtual {}
/// @inheritdoc IERC165
function supportsInterface(
bytes4 interfaceId
) public view virtual override(AccessControl, ERC1155Holder) returns (bool) {
return super.supportsInterface(interfaceId);
}
/**
* @dev Returns whether an id corresponds to a registered operation. This
* includes both Waiting, Ready, and Done operations.
*/
function isOperation(bytes32 id) public view returns (bool) {
return getOperationState(id) != OperationState.Unset;
}
/**
* @dev Returns whether an operation is pending or not. Note that a "pending" operation may also be "ready".
*/
function isOperationPending(bytes32 id) public view returns (bool) {
OperationState state = getOperationState(id);
return state == OperationState.Waiting || state == OperationState.Ready;
}
/**
* @dev Returns whether an operation is ready for execution. Note that a "ready" operation is also "pending".
*/
function isOperationReady(bytes32 id) public view returns (bool) {
return getOperationState(id) == OperationState.Ready;
}
/**
* @dev Returns whether an operation is done or not.
*/
function isOperationDone(bytes32 id) public view returns (bool) {
return getOperationState(id) == OperationState.Done;
}
/**
* @dev Returns the timestamp at which an operation becomes ready (0 for
* unset operations, 1 for done operations).
*/
function getTimestamp(bytes32 id) public view virtual returns (uint256) {
return _timestamps[id];
}
/**
* @dev Returns operation state.
*/
function getOperationState(bytes32 id) public view virtual returns (OperationState) {
uint256 timestamp = getTimestamp(id);
if (timestamp == 0) {
return OperationState.Unset;
} else if (timestamp == _DONE_TIMESTAMP) {
return OperationState.Done;
} else if (timestamp > block.timestamp) {
return OperationState.Waiting;
} else {
return OperationState.Ready;
}
}
/**
* @dev Returns the minimum delay in seconds for an operation to become valid.
*
* This value can be changed by executing an operation that calls `updateDelay`.
*/
function getMinDelay() public view virtual returns (uint256) {
return _minDelay;
}
/**
* @dev Returns the identifier of an operation containing a single
* transaction.
*/
function hashOperation(
address target,
uint256 value,
bytes calldata data,
bytes32 predecessor,
bytes32 salt
) public pure virtual returns (bytes32) {
return keccak256(abi.encode(target, value, data, predecessor, salt));
}
/**
* @dev Returns the identifier of an operation containing a batch of
* transactions.
*/
function hashOperationBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt
) public pure virtual returns (bytes32) {
return keccak256(abi.encode(targets, values, payloads, predecessor, salt));
}
/**
* @dev Schedule an operation containing a single transaction.
*
* Emits {CallSalt} if salt is nonzero, and {CallScheduled}.
*
* Requirements:
*
* - the caller must have the 'proposer' role.
*/
function schedule(
address target,
uint256 value,
bytes calldata data,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) public virtual onlyRole(PROPOSER_ROLE) {
bytes32 id = hashOperation(target, value, data, predecessor, salt);
_schedule(id, delay);
emit CallScheduled(id, 0, target, value, data, predecessor, delay);
if (salt != bytes32(0)) {
emit CallSalt(id, salt);
}
}
/**
* @dev Schedule an operation containing a batch of transactions.
*
* Emits {CallSalt} if salt is nonzero, and one {CallScheduled} event per transaction in the batch.
*
* Requirements:
*
* - the caller must have the 'proposer' role.
*/
function scheduleBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) public virtual onlyRole(PROPOSER_ROLE) {
if (targets.length != values.length || targets.length != payloads.length) {
revert TimelockInvalidOperationLength(targets.length, payloads.length, values.length);
}
bytes32 id = hashOperationBatch(targets, values, payloads, predecessor, salt);
_schedule(id, delay);
for (uint256 i = 0; i < targets.length; ++i) {
emit CallScheduled(id, i, targets[i], values[i], payloads[i], predecessor, delay);
}
if (salt != bytes32(0)) {
emit CallSalt(id, salt);
}
}
/**
* @dev Schedule an operation that is to become valid after a given delay.
*/
function _schedule(bytes32 id, uint256 delay) private {
if (isOperation(id)) {
revert TimelockUnexpectedOperationState(id, _encodeStateBitmap(OperationState.Unset));
}
uint256 minDelay = getMinDelay();
if (delay < minDelay) {
revert TimelockInsufficientDelay(delay, minDelay);
}
_timestamps[id] = block.timestamp + delay;
}
/**
* @dev Cancel an operation.
*
* Requirements:
*
* - the caller must have the 'canceller' role.
*/
function cancel(bytes32 id) public virtual onlyRole(CANCELLER_ROLE) {
if (!isOperationPending(id)) {
revert TimelockUnexpectedOperationState(
id,
_encodeStateBitmap(OperationState.Waiting) | _encodeStateBitmap(OperationState.Ready)
);
}
delete _timestamps[id];
emit Cancelled(id);
}
/**
* @dev Execute an (ready) operation containing a single transaction.
*
* Emits a {CallExecuted} event.
*
* Requirements:
*
* - the caller must have the 'executor' role.
*/
// This function can reenter, but it doesn't pose a risk because _afterCall checks that the proposal is pending,
// thus any modifications to the operation during reentrancy should be caught.
// slither-disable-next-line reentrancy-eth
function execute(
address target,
uint256 value,
bytes calldata payload,
bytes32 predecessor,
bytes32 salt
) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {
bytes32 id = hashOperation(target, value, payload, predecessor, salt);
_beforeCall(id, predecessor);
_execute(target, value, payload);
emit CallExecuted(id, 0, target, value, payload);
_afterCall(id);
}
/**
* @dev Execute an (ready) operation containing a batch of transactions.
*
* Emits one {CallExecuted} event per transaction in the batch.
*
* Requirements:
*
* - the caller must have the 'executor' role.
*/
// This function can reenter, but it doesn't pose a risk because _afterCall checks that the proposal is pending,
// thus any modifications to the operation during reentrancy should be caught.
// slither-disable-next-line reentrancy-eth
function executeBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt
) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {
if (targets.length != values.length || targets.length != payloads.length) {
revert TimelockInvalidOperationLength(targets.length, payloads.length, values.length);
}
bytes32 id = hashOperationBatch(targets, values, payloads, predecessor, salt);
_beforeCall(id, predecessor);
for (uint256 i = 0; i < targets.length; ++i) {
address target = targets[i];
uint256 value = values[i];
bytes calldata payload = payloads[i];
_execute(target, value, payload);
emit CallExecuted(id, i, target, value, payload);
}
_afterCall(id);
}
/**
* @dev Execute an operation's call.
*/
function _execute(address target, uint256 value, bytes calldata data) internal virtual {
(bool success, bytes memory returndata) = target.call{value: value}(data);
Address.verifyCallResult(success, returndata);
}
/**
* @dev Checks before execution of an operation's calls.
*/
function _beforeCall(bytes32 id, bytes32 predecessor) private view {
if (!isOperationReady(id)) {
revert TimelockUnexpectedOperationState(id, _encodeStateBitmap(OperationState.Ready));
}
if (predecessor != bytes32(0) && !isOperationDone(predecessor)) {
revert TimelockUnexecutedPredecessor(predecessor);
}
}
/**
* @dev Checks after execution of an operation's calls.
*/
function _afterCall(bytes32 id) private {
if (!isOperationReady(id)) {
revert TimelockUnexpectedOperationState(id, _encodeStateBitmap(OperationState.Ready));
}
_timestamps[id] = _DONE_TIMESTAMP;
}
/**
* @dev Changes the minimum timelock duration for future operations.
*
* Emits a {MinDelayChange} event.
*
* Requirements:
*
* - the caller must be the timelock itself. This can only be achieved by scheduling and later executing
* an operation where the timelock is the target and the data is the ABI-encoded call to this function.
*/
function updateDelay(uint256 newDelay) external virtual {
address sender = _msgSender();
if (sender != address(this)) {
revert TimelockUnauthorizedCaller(sender);
}
emit MinDelayChange(_minDelay, newDelay);
_minDelay = newDelay;
}
/**
* @dev Encodes a `OperationState` into a `bytes32` representation where each bit enabled corresponds to
* the underlying position in the `OperationState` enum. For example:
*
* 0x000...1000
* ^^^^^^----- ...
* ^---- Done
* ^--- Ready
* ^-- Waiting
* ^- Unset
*/
function _encodeStateBitmap(OperationState operationState) internal pure returns (bytes32) {
return bytes32(1 << uint8(operationState));
}
}
// SPDX-License-Identifier: MIT
// 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;
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1271.sol)
pragma solidity >=0.5.0;
/**
* @dev Interface of the ERC-1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*/
interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with `hash`
*/
function isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4 magicValue);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT
// 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
);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC5805.sol)
pragma solidity >=0.8.4;
import {IVotes} from "../governance/utils/IVotes.sol";
import {IERC6372} from "./IERC6372.sol";
interface IERC5805 is IERC6372, IVotes {}
// SPDX-License-Identifier: MIT
// 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);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC7913.sol)
pragma solidity >=0.5.0;
/**
* @dev Signature verifier interface.
*/
interface IERC7913SignatureVerifier {
/**
* @dev Verifies `signature` as a valid signature of `hash` by `key`.
*
* MUST return the bytes4 magic value IERC7913SignatureVerifier.verify.selector if the signature is valid.
* SHOULD return 0xffffffff or revert if the signature is not valid.
* SHOULD return 0xffffffff or revert if the key is empty
*/
function verify(bytes calldata key, bytes32 hash, bytes calldata signature) external view returns (bytes4);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity >=0.6.2;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Interface that must be implemented by smart contracts in order to receive
* ERC-1155 token transfers.
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC-1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC-1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/utils/ERC1155Holder.sol)
pragma solidity ^0.8.20;
import {IERC165, ERC165} from "../../../utils/introspection/ERC165.sol";
import {IERC1155Receiver} from "../IERC1155Receiver.sol";
/**
* @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC-1155 tokens.
*
* IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
* stuck.
*/
abstract contract ERC1155Holder is ERC165, IERC1155Receiver {
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity >=0.5.0;
/**
* @title ERC-721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC-721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be
* reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/utils/ERC721Holder.sol)
pragma solidity ^0.8.20;
import {IERC721Receiver} from "../IERC721Receiver.sol";
/**
* @dev Implementation of the {IERC721Receiver} interface.
*
* Accepts all token transfers.
* Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or
* {IERC721-setApprovalForAll}.
*/
abstract contract ERC721Holder is IERC721Receiver {
/**
* @dev See {IERC721Receiver-onERC721Received}.
*
* Always returns `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
return this.onERC721Received.selector;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, bytes memory returndata) = recipient.call{value: amount}("");
if (!success) {
_revert(returndata);
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert Errors.InsufficientBalance(address(this).balance, value);
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly ("memory-safe") {
revert(add(returndata, 0x20), mload(returndata))
}
} else {
revert Errors.FailedCall();
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Bytes.sol)
pragma solidity ^0.8.24;
import {Math} from "./math/Math.sol";
/**
* @dev Bytes operations.
*/
library Bytes {
/**
* @dev Forward search for `s` in `buffer`
* * If `s` is present in the buffer, returns the index of the first instance
* * If `s` is not present in the buffer, returns type(uint256).max
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]
*/
function indexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {
return indexOf(buffer, s, 0);
}
/**
* @dev Forward search for `s` in `buffer` starting at position `pos`
* * If `s` is present in the buffer (at or after `pos`), returns the index of the next instance
* * If `s` is not present in the buffer (at or after `pos`), returns type(uint256).max
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]
*/
function indexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {
uint256 length = buffer.length;
for (uint256 i = pos; i < length; ++i) {
if (bytes1(_unsafeReadBytesOffset(buffer, i)) == s) {
return i;
}
}
return type(uint256).max;
}
/**
* @dev Backward search for `s` in `buffer`
* * If `s` is present in the buffer, returns the index of the last instance
* * If `s` is not present in the buffer, returns type(uint256).max
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]
*/
function lastIndexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {
return lastIndexOf(buffer, s, type(uint256).max);
}
/**
* @dev Backward search for `s` in `buffer` starting at position `pos`
* * If `s` is present in the buffer (at or before `pos`), returns the index of the previous instance
* * If `s` is not present in the buffer (at or before `pos`), returns type(uint256).max
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]
*/
function lastIndexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {
unchecked {
uint256 length = buffer.length;
for (uint256 i = Math.min(Math.saturatingAdd(pos, 1), length); i > 0; --i) {
if (bytes1(_unsafeReadBytesOffset(buffer, i - 1)) == s) {
return i - 1;
}
}
return type(uint256).max;
}
}
/**
* @dev Copies the content of `buffer`, from `start` (included) to the end of `buffer` into a new bytes object in
* memory.
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
*/
function slice(bytes memory buffer, uint256 start) internal pure returns (bytes memory) {
return slice(buffer, start, buffer.length);
}
/**
* @dev Copies the content of `buffer`, from `start` (included) to `end` (excluded) into a new bytes object in
* memory.
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
*/
function slice(bytes memory buffer, uint256 start, uint256 end) internal pure returns (bytes memory) {
// sanitize
uint256 length = buffer.length;
end = Math.min(end, length);
start = Math.min(start, end);
// allocate and copy
bytes memory result = new bytes(end - start);
assembly ("memory-safe") {
mcopy(add(result, 0x20), add(add(buffer, 0x20), start), sub(end, start))
}
return result;
}
/**
* @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))
}
}
}
// SPDX-License-Identifier: MIT
// 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;
}
}
// SPDX-License-Identifier: MIT
// 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);
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.20;
import {MessageHashUtils} from "./MessageHashUtils.sol";
import {ShortStrings, ShortString} from "../ShortStrings.sol";
import {IERC5267} from "../../interfaces/IERC5267.sol";
/**
* @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);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/cryptography/MessageHashUtils.sol)
pragma solidity ^0.8.20;
import {Strings} from "../Strings.sol";
/**
* @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)
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/cryptography/SignatureChecker.sol)
pragma solidity ^0.8.24;
import {ECDSA} from "./ECDSA.sol";
import {IERC1271} from "../../interfaces/IERC1271.sol";
import {IERC7913SignatureVerifier} from "../../interfaces/IERC7913.sol";
import {Bytes} from "../../utils/Bytes.sol";
/**
* @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support:
*
* * ECDSA signatures from externally owned accounts (EOAs)
* * ERC-1271 signatures from smart contract wallets like Argent and Safe Wallet (previously Gnosis Safe)
* * ERC-7913 signatures from keys that do not have an Ethereum address of their own
*
* See https://eips.ethereum.org/EIPS/eip-1271[ERC-1271] and https://eips.ethereum.org/EIPS/eip-7913[ERC-7913].
*/
library SignatureChecker {
using Bytes for bytes;
/**
* @dev Checks if a signature is valid for a given signer and data hash. If the signer has code, the
* signature is validated against it using ERC-1271, otherwise it's validated using `ECDSA.recover`.
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*
* NOTE: For an extended version of this function that supports ERC-7913 signatures, see {isValidSignatureNow-bytes-bytes32-bytes-}.
*/
function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
if (signer.code.length == 0) {
(address recovered, ECDSA.RecoverError err, ) = ECDSA.tryRecover(hash, signature);
return err == ECDSA.RecoverError.NoError && recovered == signer;
} else {
return isValidERC1271SignatureNow(signer, hash, signature);
}
}
/**
* @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
* against the signer smart contract using ERC-1271.
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*/
function isValidERC1271SignatureNow(
address signer,
bytes32 hash,
bytes memory signature
) internal view returns (bool) {
(bool success, bytes memory result) = signer.staticcall(
abi.encodeCall(IERC1271.isValidSignature, (hash, signature))
);
return (success &&
result.length >= 32 &&
abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
}
/**
* @dev Verifies a signature for a given ERC-7913 signer and hash.
*
* The signer is a `bytes` object that is the concatenation of an address and optionally a key:
* `verifier || key`. A signer must be at least 20 bytes long.
*
* Verification is done as follows:
*
* * If `signer.length < 20`: verification fails
* * If `signer.length == 20`: verification is done using {isValidSignatureNow}
* * Otherwise: verification is done using {IERC7913SignatureVerifier}
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*/
function isValidSignatureNow(
bytes memory signer,
bytes32 hash,
bytes memory signature
) internal view returns (bool) {
if (signer.length < 20) {
return false;
} else if (signer.length == 20) {
return isValidSignatureNow(address(bytes20(signer)), hash, signature);
} else {
(bool success, bytes memory result) = address(bytes20(signer)).staticcall(
abi.encodeCall(IERC7913SignatureVerifier.verify, (signer.slice(20), hash, signature))
);
return (success &&
result.length >= 32 &&
abi.decode(result, (bytes32)) == bytes32(IERC7913SignatureVerifier.verify.selector));
}
}
/**
* @dev Verifies multiple ERC-7913 `signatures` for a given `hash` using a set of `signers`.
* Returns `false` if the number of signers and signatures is not the same.
*
* The signers should be ordered by their `keccak256` hash to ensure efficient duplication check. Unordered
* signers are supported, but the uniqueness check will be more expensive.
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*/
function areValidSignaturesNow(
bytes32 hash,
bytes[] memory signers,
bytes[] memory signatures
) internal view returns (bool) {
if (signers.length != signatures.length) return false;
bytes32 lastId = bytes32(0);
for (uint256 i = 0; i < signers.length; ++i) {
bytes memory signer = signers[i];
// If one of the signatures is invalid, reject the batch
if (!isValidSignatureNow(signer, hash, signatures[i])) return false;
bytes32 id = keccak256(signer);
// If the current signer ID is greater than all previous IDs, then this is a new signer.
if (lastId < id) {
lastId = id;
} else {
// If this signer id is not greater than all the previous ones, verify that it is not a duplicate of a previous one
// This loop is never executed if the signers are ordered by id.
for (uint256 j = 0; j < i; ++j) {
if (id == keccak256(signers[j])) return false;
}
}
}
return true;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// SPDX-License-Identifier: MIT
// 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);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";
/**
* @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;
}
}
// SPDX-License-Identifier: MIT
// 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))
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
import {SafeCast} from "./SafeCast.sol";
/**
* @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);
}
}
}
// SPDX-License-Identifier: MIT
// 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);
}
}
}
// SPDX-License-Identifier: MIT
// 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)
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/ShortStrings.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
// | 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;
}
}
}
// SPDX-License-Identifier: MIT
// 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
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SafeCast} from "./math/SafeCast.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @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))
}
}
}
// SPDX-License-Identifier: MIT
// 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;
import {Math} from "../math/Math.sol";
/**
* @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)
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/structs/DoubleEndedQueue.sol)
pragma solidity ^0.8.20;
import {Panic} from "../Panic.sol";
/**
* @dev A sequence of items with the ability to efficiently push and pop items (i.e. insert and remove) on both ends of
* the sequence (called front and back). Among other access patterns, it can be used to implement efficient LIFO and
* FIFO queues. Storage use is optimized, and all operations are O(1) constant time. This includes {clear}, given that
* the existing queue contents are left in storage.
*
* The struct is called `Bytes32Deque`. Other types can be cast to and from `bytes32`. This data structure can only be
* used in storage, and not in memory.
* ```solidity
* DoubleEndedQueue.Bytes32Deque queue;
* ```
*/
library DoubleEndedQueue {
/**
* @dev Indices are 128 bits so begin and end are packed in a single storage slot for efficient access.
*
* Struct members have an underscore prefix indicating that they are "private" and should not be read or written to
* directly. Use the functions provided below instead. Modifying the struct manually may violate assumptions and
* lead to unexpected behavior.
*
* The first item is at data[begin] and the last item is at data[end - 1]. This range can wrap around.
*/
struct Bytes32Deque {
uint128 _begin;
uint128 _end;
mapping(uint128 index => bytes32) _data;
}
/**
* @dev Inserts an item at the end of the queue.
*
* Reverts with {Panic-RESOURCE_ERROR} if the queue is full.
*/
function pushBack(Bytes32Deque storage deque, bytes32 value) internal {
unchecked {
uint128 backIndex = deque._end;
if (backIndex + 1 == deque._begin) Panic.panic(Panic.RESOURCE_ERROR);
deque._data[backIndex] = value;
deque._end = backIndex + 1;
}
}
/**
* @dev Removes the item at the end of the queue and returns it.
*
* Reverts with {Panic-EMPTY_ARRAY_POP} if the queue is empty.
*/
function popBack(Bytes32Deque storage deque) internal returns (bytes32 value) {
unchecked {
uint128 backIndex = deque._end;
if (backIndex == deque._begin) Panic.panic(Panic.EMPTY_ARRAY_POP);
--backIndex;
value = deque._data[backIndex];
delete deque._data[backIndex];
deque._end = backIndex;
}
}
/**
* @dev Inserts an item at the beginning of the queue.
*
* Reverts with {Panic-RESOURCE_ERROR} if the queue is full.
*/
function pushFront(Bytes32Deque storage deque, bytes32 value) internal {
unchecked {
uint128 frontIndex = deque._begin - 1;
if (frontIndex == deque._end) Panic.panic(Panic.RESOURCE_ERROR);
deque._data[frontIndex] = value;
deque._begin = frontIndex;
}
}
/**
* @dev Removes the item at the beginning of the queue and returns it.
*
* Reverts with {Panic-EMPTY_ARRAY_POP} if the queue is empty.
*/
function popFront(Bytes32Deque storage deque) internal returns (bytes32 value) {
unchecked {
uint128 frontIndex = deque._begin;
if (frontIndex == deque._end) Panic.panic(Panic.EMPTY_ARRAY_POP);
value = deque._data[frontIndex];
delete deque._data[frontIndex];
deque._begin = frontIndex + 1;
}
}
/**
* @dev Returns the item at the beginning of the queue.
*
* Reverts with {Panic-ARRAY_OUT_OF_BOUNDS} if the queue is empty.
*/
function front(Bytes32Deque storage deque) internal view returns (bytes32 value) {
if (empty(deque)) Panic.panic(Panic.ARRAY_OUT_OF_BOUNDS);
return deque._data[deque._begin];
}
/**
* @dev Returns the item at the end of the queue.
*
* Reverts with {Panic-ARRAY_OUT_OF_BOUNDS} if the queue is empty.
*/
function back(Bytes32Deque storage deque) internal view returns (bytes32 value) {
if (empty(deque)) Panic.panic(Panic.ARRAY_OUT_OF_BOUNDS);
unchecked {
return deque._data[deque._end - 1];
}
}
/**
* @dev Return the item at a position in the queue given by `index`, with the first item at 0 and last item at
* `length(deque) - 1`.
*
* Reverts with {Panic-ARRAY_OUT_OF_BOUNDS} if the index is out of bounds.
*/
function at(Bytes32Deque storage deque, uint256 index) internal view returns (bytes32 value) {
if (index >= length(deque)) Panic.panic(Panic.ARRAY_OUT_OF_BOUNDS);
// By construction, length is a uint128, so the check above ensures that index can be safely downcast to uint128
unchecked {
return deque._data[deque._begin + uint128(index)];
}
}
/**
* @dev Resets the queue back to being empty.
*
* NOTE: The current items are left behind in storage. This does not affect the functioning of the queue, but misses
* out on potential gas refunds.
*/
function clear(Bytes32Deque storage deque) internal {
deque._begin = 0;
deque._end = 0;
}
/**
* @dev Returns the number of items in the queue.
*/
function length(Bytes32Deque storage deque) internal view returns (uint256) {
unchecked {
return uint256(deque._end - deque._begin);
}
}
/**
* @dev Returns true if the queue is empty.
*/
function empty(Bytes32Deque storage deque) internal view returns (bool) {
return deque._end == deque._begin;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/types/Time.sol)
pragma solidity ^0.8.20;
import {Math} from "../math/Math.sol";
import {SafeCast} from "../math/SafeCast.sol";
/**
* @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));
}
}
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

This file has been truncated, but you can view the full file.
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"goerli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {
"@_14332": {
"entryPoint": null,
"id": 14332,
"parameterSlots": 2,
"returnSlots": 0
},
"@_4016": {
"entryPoint": null,
"id": 4016,
"parameterSlots": 3,
"returnSlots": 0
},
"@_4181": {
"entryPoint": null,
"id": 4181,
"parameterSlots": 1,
"returnSlots": 0
},
"@_4518": {
"entryPoint": null,
"id": 4518,
"parameterSlots": 1,
"returnSlots": 0
},
"@_4644": {
"entryPoint": null,
"id": 4644,
"parameterSlots": 1,
"returnSlots": 0
},
"@_503": {
"entryPoint": null,
"id": 503,
"parameterSlots": 1,
"returnSlots": 0
},
"@_7979": {
"entryPoint": null,
"id": 7979,
"parameterSlots": 2,
"returnSlots": 0
},
"@_buildDomainSeparator_8026": {
"entryPoint": null,
"id": 8026,
"parameterSlots": 0,
"returnSlots": 1
},
"@_insert_13002": {
"entryPoint": 1400,
"id": 13002,
"parameterSlots": 3,
"returnSlots": 2
},
"@_setProposalThreshold_4142": {
"entryPoint": 710,
"id": 4142,
"parameterSlots": 1,
"returnSlots": 0
},
"@_setVotingDelay_4101": {
"entryPoint": 444,
"id": 4101,
"parameterSlots": 1,
"returnSlots": 0
},
"@_setVotingPeriod_4126": {
"entryPoint": 546,
"id": 4126,
"parameterSlots": 1,
"returnSlots": 0
},
"@_unsafeAccess_13121": {
"entryPoint": null,
"id": 13121,
"parameterSlots": 2,
"returnSlots": 1
},
"@_updateQuorumNumerator_4758": {
"entryPoint": 775,
"id": 4758,
"parameterSlots": 1,
"returnSlots": 0
},
"@_updateTimelock_4466": {
"entryPoint": 924,
"id": 4466,
"parameterSlots": 1,
"returnSlots": 0
},
"@blockNumber_14036": {
"entryPoint": 1390,
"id": 14036,
"parameterSlots": 0,
"returnSlots": 1
},
"@clock_4554": {
"entryPoint": 1115,
"id": 4554,
"parameterSlots": 0,
"returnSlots": 1
},
"@getStringSlot_6109": {
"entryPoint": null,
"id": 6109,
"parameterSlots": 1,
"returnSlots": 1
},
"@latest_12827": {
"entryPoint": 1318,
"id": 12827,
"parameterSlots": 1,
"returnSlots": 1
},
"@push_12630": {
"entryPoint": 1292,
"id": 12630,
"parameterSlots": 3,
"returnSlots": 2
},
"@quorumDenominator_4678": {
"entryPoint": null,
"id": 4678,
"parameterSlots": 0,
"returnSlots": 1
},
"@quorumNumerator_4655": {
"entryPoint": 1090,
"id": 4655,
"parameterSlots": 0,
"returnSlots": 1
},
"@toShortStringWithFallback_5949": {
"entryPoint": 394,
"id": 5949,
"parameterSlots": 2,
"returnSlots": 1
},
"@toShortString_5851": {
"entryPoint": 1029,
"id": 5851,
"parameterSlots": 1,
"returnSlots": 1
},
"@toUint208_10351": {
"entryPoint": 1237,
"id": 10351,
"parameterSlots": 1,
"returnSlots": 1
},
"@toUint48_10911": {
"entryPoint": 1748,
"id": 10911,
"parameterSlots": 1,
"returnSlots": 1
},
"@token_4528": {
"entryPoint": null,
"id": 4528,
"parameterSlots": 0,
"returnSlots": 1
},
"@version_580": {
"entryPoint": 367,
"id": 580,
"parameterSlots": 0,
"returnSlots": 1
},
"abi_decode_tuple_t_contract$_IVotes_$4875t_contract$_TimelockController_$3728_fromMemory": {
"entryPoint": 1821,
"id": null,
"parameterSlots": 2,
"returnSlots": 2
},
"abi_decode_tuple_t_uint48_fromMemory": {
"entryPoint": 2303,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 6,
"returnSlots": 1
},
"abi_encode_tuple_t_rational_0_by_1__to_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_rational_208_by_1_t_uint256__to_t_uint8_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_rational_48_by_1_t_uint256__to_t_uint8_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 2215,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_uint256__to_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_uint32_t_uint32__to_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_uint48_t_uint48__to_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"array_dataslot_string_storage": {
"entryPoint": null,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"checked_sub_t_uint256": {
"entryPoint": 2340,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"clean_up_bytearray_end_slots_string_storage": {
"entryPoint": 1953,
"id": null,
"parameterSlots": 3,
"returnSlots": 0
},
"convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32": {
"entryPoint": 2268,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage": {
"entryPoint": 2029,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"extract_byte_array_length": {
"entryPoint": 1897,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"extract_used_part_and_set_length_of_short_byte_array": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"panic_error_0x41": {
"entryPoint": 1877,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"validator_revert_contract_IVotes": {
"entryPoint": 1798,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
}
},
"generatedSources": [
{
"ast": {
"nativeSrc": "0:6851:43",
"nodeType": "YulBlock",
"src": "0:6851:43",
"statements": [
{
"nativeSrc": "6:3:43",
"nodeType": "YulBlock",
"src": "6:3:43",
"statements": []
},
{
"body": {
"nativeSrc": "67:86:43",
"nodeType": "YulBlock",
"src": "67:86:43",
"statements": [
{
"body": {
"nativeSrc": "131:16:43",
"nodeType": "YulBlock",
"src": "131:16:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "140:1:43",
"nodeType": "YulLiteral",
"src": "140:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "143:1:43",
"nodeType": "YulLiteral",
"src": "143:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "133:6:43",
"nodeType": "YulIdentifier",
"src": "133:6:43"
},
"nativeSrc": "133:12:43",
"nodeType": "YulFunctionCall",
"src": "133:12:43"
},
"nativeSrc": "133:12:43",
"nodeType": "YulExpressionStatement",
"src": "133:12:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nativeSrc": "90:5:43",
"nodeType": "YulIdentifier",
"src": "90:5:43"
},
{
"arguments": [
{
"name": "value",
"nativeSrc": "101:5:43",
"nodeType": "YulIdentifier",
"src": "101:5:43"
},
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "116:3:43",
"nodeType": "YulLiteral",
"src": "116:3:43",
"type": "",
"value": "160"
},
{
"kind": "number",
"nativeSrc": "121:1:43",
"nodeType": "YulLiteral",
"src": "121:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "112:3:43",
"nodeType": "YulIdentifier",
"src": "112:3:43"
},
"nativeSrc": "112:11:43",
"nodeType": "YulFunctionCall",
"src": "112:11:43"
},
{
"kind": "number",
"nativeSrc": "125:1:43",
"nodeType": "YulLiteral",
"src": "125:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "108:3:43",
"nodeType": "YulIdentifier",
"src": "108:3:43"
},
"nativeSrc": "108:19:43",
"nodeType": "YulFunctionCall",
"src": "108:19:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "97:3:43",
"nodeType": "YulIdentifier",
"src": "97:3:43"
},
"nativeSrc": "97:31:43",
"nodeType": "YulFunctionCall",
"src": "97:31:43"
}
],
"functionName": {
"name": "eq",
"nativeSrc": "87:2:43",
"nodeType": "YulIdentifier",
"src": "87:2:43"
},
"nativeSrc": "87:42:43",
"nodeType": "YulFunctionCall",
"src": "87:42:43"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "80:6:43",
"nodeType": "YulIdentifier",
"src": "80:6:43"
},
"nativeSrc": "80:50:43",
"nodeType": "YulFunctionCall",
"src": "80:50:43"
},
"nativeSrc": "77:70:43",
"nodeType": "YulIf",
"src": "77:70:43"
}
]
},
"name": "validator_revert_contract_IVotes",
"nativeSrc": "14:139:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "56:5:43",
"nodeType": "YulTypedName",
"src": "56:5:43",
"type": ""
}
],
"src": "14:139:43"
},
{
"body": {
"nativeSrc": "298:303:43",
"nodeType": "YulBlock",
"src": "298:303:43",
"statements": [
{
"body": {
"nativeSrc": "344:16:43",
"nodeType": "YulBlock",
"src": "344:16:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "353:1:43",
"nodeType": "YulLiteral",
"src": "353:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "356:1:43",
"nodeType": "YulLiteral",
"src": "356:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "346:6:43",
"nodeType": "YulIdentifier",
"src": "346:6:43"
},
"nativeSrc": "346:12:43",
"nodeType": "YulFunctionCall",
"src": "346:12:43"
},
"nativeSrc": "346:12:43",
"nodeType": "YulExpressionStatement",
"src": "346:12:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nativeSrc": "319:7:43",
"nodeType": "YulIdentifier",
"src": "319:7:43"
},
{
"name": "headStart",
"nativeSrc": "328:9:43",
"nodeType": "YulIdentifier",
"src": "328:9:43"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "315:3:43",
"nodeType": "YulIdentifier",
"src": "315:3:43"
},
"nativeSrc": "315:23:43",
"nodeType": "YulFunctionCall",
"src": "315:23:43"
},
{
"kind": "number",
"nativeSrc": "340:2:43",
"nodeType": "YulLiteral",
"src": "340:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "slt",
"nativeSrc": "311:3:43",
"nodeType": "YulIdentifier",
"src": "311:3:43"
},
"nativeSrc": "311:32:43",
"nodeType": "YulFunctionCall",
"src": "311:32:43"
},
"nativeSrc": "308:52:43",
"nodeType": "YulIf",
"src": "308:52:43"
},
{
"nativeSrc": "369:29:43",
"nodeType": "YulVariableDeclaration",
"src": "369:29:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "388:9:43",
"nodeType": "YulIdentifier",
"src": "388:9:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "382:5:43",
"nodeType": "YulIdentifier",
"src": "382:5:43"
},
"nativeSrc": "382:16:43",
"nodeType": "YulFunctionCall",
"src": "382:16:43"
},
"variables": [
{
"name": "value",
"nativeSrc": "373:5:43",
"nodeType": "YulTypedName",
"src": "373:5:43",
"type": ""
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nativeSrc": "440:5:43",
"nodeType": "YulIdentifier",
"src": "440:5:43"
}
],
"functionName": {
"name": "validator_revert_contract_IVotes",
"nativeSrc": "407:32:43",
"nodeType": "YulIdentifier",
"src": "407:32:43"
},
"nativeSrc": "407:39:43",
"nodeType": "YulFunctionCall",
"src": "407:39:43"
},
"nativeSrc": "407:39:43",
"nodeType": "YulExpressionStatement",
"src": "407:39:43"
},
{
"nativeSrc": "455:15:43",
"nodeType": "YulAssignment",
"src": "455:15:43",
"value": {
"name": "value",
"nativeSrc": "465:5:43",
"nodeType": "YulIdentifier",
"src": "465:5:43"
},
"variableNames": [
{
"name": "value0",
"nativeSrc": "455:6:43",
"nodeType": "YulIdentifier",
"src": "455:6:43"
}
]
},
{
"nativeSrc": "479:40:43",
"nodeType": "YulVariableDeclaration",
"src": "479:40:43",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "504:9:43",
"nodeType": "YulIdentifier",
"src": "504:9:43"
},
{
"kind": "number",
"nativeSrc": "515:2:43",
"nodeType": "YulLiteral",
"src": "515:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "500:3:43",
"nodeType": "YulIdentifier",
"src": "500:3:43"
},
"nativeSrc": "500:18:43",
"nodeType": "YulFunctionCall",
"src": "500:18:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "494:5:43",
"nodeType": "YulIdentifier",
"src": "494:5:43"
},
"nativeSrc": "494:25:43",
"nodeType": "YulFunctionCall",
"src": "494:25:43"
},
"variables": [
{
"name": "value_1",
"nativeSrc": "483:7:43",
"nodeType": "YulTypedName",
"src": "483:7:43",
"type": ""
}
]
},
{
"expression": {
"arguments": [
{
"name": "value_1",
"nativeSrc": "561:7:43",
"nodeType": "YulIdentifier",
"src": "561:7:43"
}
],
"functionName": {
"name": "validator_revert_contract_IVotes",
"nativeSrc": "528:32:43",
"nodeType": "YulIdentifier",
"src": "528:32:43"
},
"nativeSrc": "528:41:43",
"nodeType": "YulFunctionCall",
"src": "528:41:43"
},
"nativeSrc": "528:41:43",
"nodeType": "YulExpressionStatement",
"src": "528:41:43"
},
{
"nativeSrc": "578:17:43",
"nodeType": "YulAssignment",
"src": "578:17:43",
"value": {
"name": "value_1",
"nativeSrc": "588:7:43",
"nodeType": "YulIdentifier",
"src": "588:7:43"
},
"variableNames": [
{
"name": "value1",
"nativeSrc": "578:6:43",
"nodeType": "YulIdentifier",
"src": "578:6:43"
}
]
}
]
},
"name": "abi_decode_tuple_t_contract$_IVotes_$4875t_contract$_TimelockController_$3728_fromMemory",
"nativeSrc": "158:443:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "256:9:43",
"nodeType": "YulTypedName",
"src": "256:9:43",
"type": ""
},
{
"name": "dataEnd",
"nativeSrc": "267:7:43",
"nodeType": "YulTypedName",
"src": "267:7:43",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nativeSrc": "279:6:43",
"nodeType": "YulTypedName",
"src": "279:6:43",
"type": ""
},
{
"name": "value1",
"nativeSrc": "287:6:43",
"nodeType": "YulTypedName",
"src": "287:6:43",
"type": ""
}
],
"src": "158:443:43"
},
{
"body": {
"nativeSrc": "638:95:43",
"nodeType": "YulBlock",
"src": "638:95:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "655:1:43",
"nodeType": "YulLiteral",
"src": "655:1:43",
"type": "",
"value": "0"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "662:3:43",
"nodeType": "YulLiteral",
"src": "662:3:43",
"type": "",
"value": "224"
},
{
"kind": "number",
"nativeSrc": "667:10:43",
"nodeType": "YulLiteral",
"src": "667:10:43",
"type": "",
"value": "0x4e487b71"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "658:3:43",
"nodeType": "YulIdentifier",
"src": "658:3:43"
},
"nativeSrc": "658:20:43",
"nodeType": "YulFunctionCall",
"src": "658:20:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "648:6:43",
"nodeType": "YulIdentifier",
"src": "648:6:43"
},
"nativeSrc": "648:31:43",
"nodeType": "YulFunctionCall",
"src": "648:31:43"
},
"nativeSrc": "648:31:43",
"nodeType": "YulExpressionStatement",
"src": "648:31:43"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "695:1:43",
"nodeType": "YulLiteral",
"src": "695:1:43",
"type": "",
"value": "4"
},
{
"kind": "number",
"nativeSrc": "698:4:43",
"nodeType": "YulLiteral",
"src": "698:4:43",
"type": "",
"value": "0x41"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "688:6:43",
"nodeType": "YulIdentifier",
"src": "688:6:43"
},
"nativeSrc": "688:15:43",
"nodeType": "YulFunctionCall",
"src": "688:15:43"
},
"nativeSrc": "688:15:43",
"nodeType": "YulExpressionStatement",
"src": "688:15:43"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "719:1:43",
"nodeType": "YulLiteral",
"src": "719:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "722:4:43",
"nodeType": "YulLiteral",
"src": "722:4:43",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "712:6:43",
"nodeType": "YulIdentifier",
"src": "712:6:43"
},
"nativeSrc": "712:15:43",
"nodeType": "YulFunctionCall",
"src": "712:15:43"
},
"nativeSrc": "712:15:43",
"nodeType": "YulExpressionStatement",
"src": "712:15:43"
}
]
},
"name": "panic_error_0x41",
"nativeSrc": "606:127:43",
"nodeType": "YulFunctionDefinition",
"src": "606:127:43"
},
{
"body": {
"nativeSrc": "793:325:43",
"nodeType": "YulBlock",
"src": "793:325:43",
"statements": [
{
"nativeSrc": "803:22:43",
"nodeType": "YulAssignment",
"src": "803:22:43",
"value": {
"arguments": [
{
"kind": "number",
"nativeSrc": "817:1:43",
"nodeType": "YulLiteral",
"src": "817:1:43",
"type": "",
"value": "1"
},
{
"name": "data",
"nativeSrc": "820:4:43",
"nodeType": "YulIdentifier",
"src": "820:4:43"
}
],
"functionName": {
"name": "shr",
"nativeSrc": "813:3:43",
"nodeType": "YulIdentifier",
"src": "813:3:43"
},
"nativeSrc": "813:12:43",
"nodeType": "YulFunctionCall",
"src": "813:12:43"
},
"variableNames": [
{
"name": "length",
"nativeSrc": "803:6:43",
"nodeType": "YulIdentifier",
"src": "803:6:43"
}
]
},
{
"nativeSrc": "834:38:43",
"nodeType": "YulVariableDeclaration",
"src": "834:38:43",
"value": {
"arguments": [
{
"name": "data",
"nativeSrc": "864:4:43",
"nodeType": "YulIdentifier",
"src": "864:4:43"
},
{
"kind": "number",
"nativeSrc": "870:1:43",
"nodeType": "YulLiteral",
"src": "870:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "and",
"nativeSrc": "860:3:43",
"nodeType": "YulIdentifier",
"src": "860:3:43"
},
"nativeSrc": "860:12:43",
"nodeType": "YulFunctionCall",
"src": "860:12:43"
},
"variables": [
{
"name": "outOfPlaceEncoding",
"nativeSrc": "838:18:43",
"nodeType": "YulTypedName",
"src": "838:18:43",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "911:31:43",
"nodeType": "YulBlock",
"src": "911:31:43",
"statements": [
{
"nativeSrc": "913:27:43",
"nodeType": "YulAssignment",
"src": "913:27:43",
"value": {
"arguments": [
{
"name": "length",
"nativeSrc": "927:6:43",
"nodeType": "YulIdentifier",
"src": "927:6:43"
},
{
"kind": "number",
"nativeSrc": "935:4:43",
"nodeType": "YulLiteral",
"src": "935:4:43",
"type": "",
"value": "0x7f"
}
],
"functionName": {
"name": "and",
"nativeSrc": "923:3:43",
"nodeType": "YulIdentifier",
"src": "923:3:43"
},
"nativeSrc": "923:17:43",
"nodeType": "YulFunctionCall",
"src": "923:17:43"
},
"variableNames": [
{
"name": "length",
"nativeSrc": "913:6:43",
"nodeType": "YulIdentifier",
"src": "913:6:43"
}
]
}
]
},
"condition": {
"arguments": [
{
"name": "outOfPlaceEncoding",
"nativeSrc": "891:18:43",
"nodeType": "YulIdentifier",
"src": "891:18:43"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "884:6:43",
"nodeType": "YulIdentifier",
"src": "884:6:43"
},
"nativeSrc": "884:26:43",
"nodeType": "YulFunctionCall",
"src": "884:26:43"
},
"nativeSrc": "881:61:43",
"nodeType": "YulIf",
"src": "881:61:43"
},
{
"body": {
"nativeSrc": "1001:111:43",
"nodeType": "YulBlock",
"src": "1001:111:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1022:1:43",
"nodeType": "YulLiteral",
"src": "1022:1:43",
"type": "",
"value": "0"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "1029:3:43",
"nodeType": "YulLiteral",
"src": "1029:3:43",
"type": "",
"value": "224"
},
{
"kind": "number",
"nativeSrc": "1034:10:43",
"nodeType": "YulLiteral",
"src": "1034:10:43",
"type": "",
"value": "0x4e487b71"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "1025:3:43",
"nodeType": "YulIdentifier",
"src": "1025:3:43"
},
"nativeSrc": "1025:20:43",
"nodeType": "YulFunctionCall",
"src": "1025:20:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1015:6:43",
"nodeType": "YulIdentifier",
"src": "1015:6:43"
},
"nativeSrc": "1015:31:43",
"nodeType": "YulFunctionCall",
"src": "1015:31:43"
},
"nativeSrc": "1015:31:43",
"nodeType": "YulExpressionStatement",
"src": "1015:31:43"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1066:1:43",
"nodeType": "YulLiteral",
"src": "1066:1:43",
"type": "",
"value": "4"
},
{
"kind": "number",
"nativeSrc": "1069:4:43",
"nodeType": "YulLiteral",
"src": "1069:4:43",
"type": "",
"value": "0x22"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1059:6:43",
"nodeType": "YulIdentifier",
"src": "1059:6:43"
},
"nativeSrc": "1059:15:43",
"nodeType": "YulFunctionCall",
"src": "1059:15:43"
},
"nativeSrc": "1059:15:43",
"nodeType": "YulExpressionStatement",
"src": "1059:15:43"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1094:1:43",
"nodeType": "YulLiteral",
"src": "1094:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "1097:4:43",
"nodeType": "YulLiteral",
"src": "1097:4:43",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "1087:6:43",
"nodeType": "YulIdentifier",
"src": "1087:6:43"
},
"nativeSrc": "1087:15:43",
"nodeType": "YulFunctionCall",
"src": "1087:15:43"
},
"nativeSrc": "1087:15:43",
"nodeType": "YulExpressionStatement",
"src": "1087:15:43"
}
]
},
"condition": {
"arguments": [
{
"name": "outOfPlaceEncoding",
"nativeSrc": "957:18:43",
"nodeType": "YulIdentifier",
"src": "957:18:43"
},
{
"arguments": [
{
"name": "length",
"nativeSrc": "980:6:43",
"nodeType": "YulIdentifier",
"src": "980:6:43"
},
{
"kind": "number",
"nativeSrc": "988:2:43",
"nodeType": "YulLiteral",
"src": "988:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "lt",
"nativeSrc": "977:2:43",
"nodeType": "YulIdentifier",
"src": "977:2:43"
},
"nativeSrc": "977:14:43",
"nodeType": "YulFunctionCall",
"src": "977:14:43"
}
],
"functionName": {
"name": "eq",
"nativeSrc": "954:2:43",
"nodeType": "YulIdentifier",
"src": "954:2:43"
},
"nativeSrc": "954:38:43",
"nodeType": "YulFunctionCall",
"src": "954:38:43"
},
"nativeSrc": "951:161:43",
"nodeType": "YulIf",
"src": "951:161:43"
}
]
},
"name": "extract_byte_array_length",
"nativeSrc": "738:380:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "data",
"nativeSrc": "773:4:43",
"nodeType": "YulTypedName",
"src": "773:4:43",
"type": ""
}
],
"returnVariables": [
{
"name": "length",
"nativeSrc": "782:6:43",
"nodeType": "YulTypedName",
"src": "782:6:43",
"type": ""
}
],
"src": "738:380:43"
},
{
"body": {
"nativeSrc": "1179:65:43",
"nodeType": "YulBlock",
"src": "1179:65:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1196:1:43",
"nodeType": "YulLiteral",
"src": "1196:1:43",
"type": "",
"value": "0"
},
{
"name": "ptr",
"nativeSrc": "1199:3:43",
"nodeType": "YulIdentifier",
"src": "1199:3:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1189:6:43",
"nodeType": "YulIdentifier",
"src": "1189:6:43"
},
"nativeSrc": "1189:14:43",
"nodeType": "YulFunctionCall",
"src": "1189:14:43"
},
"nativeSrc": "1189:14:43",
"nodeType": "YulExpressionStatement",
"src": "1189:14:43"
},
{
"nativeSrc": "1212:26:43",
"nodeType": "YulAssignment",
"src": "1212:26:43",
"value": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1230:1:43",
"nodeType": "YulLiteral",
"src": "1230:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "1233:4:43",
"nodeType": "YulLiteral",
"src": "1233:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "keccak256",
"nativeSrc": "1220:9:43",
"nodeType": "YulIdentifier",
"src": "1220:9:43"
},
"nativeSrc": "1220:18:43",
"nodeType": "YulFunctionCall",
"src": "1220:18:43"
},
"variableNames": [
{
"name": "data",
"nativeSrc": "1212:4:43",
"nodeType": "YulIdentifier",
"src": "1212:4:43"
}
]
}
]
},
"name": "array_dataslot_string_storage",
"nativeSrc": "1123:121:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "ptr",
"nativeSrc": "1162:3:43",
"nodeType": "YulTypedName",
"src": "1162:3:43",
"type": ""
}
],
"returnVariables": [
{
"name": "data",
"nativeSrc": "1170:4:43",
"nodeType": "YulTypedName",
"src": "1170:4:43",
"type": ""
}
],
"src": "1123:121:43"
},
{
"body": {
"nativeSrc": "1330:437:43",
"nodeType": "YulBlock",
"src": "1330:437:43",
"statements": [
{
"body": {
"nativeSrc": "1363:398:43",
"nodeType": "YulBlock",
"src": "1363:398:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1384:1:43",
"nodeType": "YulLiteral",
"src": "1384:1:43",
"type": "",
"value": "0"
},
{
"name": "array",
"nativeSrc": "1387:5:43",
"nodeType": "YulIdentifier",
"src": "1387:5:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1377:6:43",
"nodeType": "YulIdentifier",
"src": "1377:6:43"
},
"nativeSrc": "1377:16:43",
"nodeType": "YulFunctionCall",
"src": "1377:16:43"
},
"nativeSrc": "1377:16:43",
"nodeType": "YulExpressionStatement",
"src": "1377:16:43"
},
{
"nativeSrc": "1406:30:43",
"nodeType": "YulVariableDeclaration",
"src": "1406:30:43",
"value": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1428:1:43",
"nodeType": "YulLiteral",
"src": "1428:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "1431:4:43",
"nodeType": "YulLiteral",
"src": "1431:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "keccak256",
"nativeSrc": "1418:9:43",
"nodeType": "YulIdentifier",
"src": "1418:9:43"
},
"nativeSrc": "1418:18:43",
"nodeType": "YulFunctionCall",
"src": "1418:18:43"
},
"variables": [
{
"name": "data",
"nativeSrc": "1410:4:43",
"nodeType": "YulTypedName",
"src": "1410:4:43",
"type": ""
}
]
},
{
"nativeSrc": "1449:57:43",
"nodeType": "YulVariableDeclaration",
"src": "1449:57:43",
"value": {
"arguments": [
{
"name": "data",
"nativeSrc": "1472:4:43",
"nodeType": "YulIdentifier",
"src": "1472:4:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "1482:1:43",
"nodeType": "YulLiteral",
"src": "1482:1:43",
"type": "",
"value": "5"
},
{
"arguments": [
{
"name": "startIndex",
"nativeSrc": "1489:10:43",
"nodeType": "YulIdentifier",
"src": "1489:10:43"
},
{
"kind": "number",
"nativeSrc": "1501:2:43",
"nodeType": "YulLiteral",
"src": "1501:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1485:3:43",
"nodeType": "YulIdentifier",
"src": "1485:3:43"
},
"nativeSrc": "1485:19:43",
"nodeType": "YulFunctionCall",
"src": "1485:19:43"
}
],
"functionName": {
"name": "shr",
"nativeSrc": "1478:3:43",
"nodeType": "YulIdentifier",
"src": "1478:3:43"
},
"nativeSrc": "1478:27:43",
"nodeType": "YulFunctionCall",
"src": "1478:27:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1468:3:43",
"nodeType": "YulIdentifier",
"src": "1468:3:43"
},
"nativeSrc": "1468:38:43",
"nodeType": "YulFunctionCall",
"src": "1468:38:43"
},
"variables": [
{
"name": "deleteStart",
"nativeSrc": "1453:11:43",
"nodeType": "YulTypedName",
"src": "1453:11:43",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "1543:23:43",
"nodeType": "YulBlock",
"src": "1543:23:43",
"statements": [
{
"nativeSrc": "1545:19:43",
"nodeType": "YulAssignment",
"src": "1545:19:43",
"value": {
"name": "data",
"nativeSrc": "1560:4:43",
"nodeType": "YulIdentifier",
"src": "1560:4:43"
},
"variableNames": [
{
"name": "deleteStart",
"nativeSrc": "1545:11:43",
"nodeType": "YulIdentifier",
"src": "1545:11:43"
}
]
}
]
},
"condition": {
"arguments": [
{
"name": "startIndex",
"nativeSrc": "1525:10:43",
"nodeType": "YulIdentifier",
"src": "1525:10:43"
},
{
"kind": "number",
"nativeSrc": "1537:4:43",
"nodeType": "YulLiteral",
"src": "1537:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "lt",
"nativeSrc": "1522:2:43",
"nodeType": "YulIdentifier",
"src": "1522:2:43"
},
"nativeSrc": "1522:20:43",
"nodeType": "YulFunctionCall",
"src": "1522:20:43"
},
"nativeSrc": "1519:47:43",
"nodeType": "YulIf",
"src": "1519:47:43"
},
{
"nativeSrc": "1579:41:43",
"nodeType": "YulVariableDeclaration",
"src": "1579:41:43",
"value": {
"arguments": [
{
"name": "data",
"nativeSrc": "1593:4:43",
"nodeType": "YulIdentifier",
"src": "1593:4:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "1603:1:43",
"nodeType": "YulLiteral",
"src": "1603:1:43",
"type": "",
"value": "5"
},
{
"arguments": [
{
"name": "len",
"nativeSrc": "1610:3:43",
"nodeType": "YulIdentifier",
"src": "1610:3:43"
},
{
"kind": "number",
"nativeSrc": "1615:2:43",
"nodeType": "YulLiteral",
"src": "1615:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1606:3:43",
"nodeType": "YulIdentifier",
"src": "1606:3:43"
},
"nativeSrc": "1606:12:43",
"nodeType": "YulFunctionCall",
"src": "1606:12:43"
}
],
"functionName": {
"name": "shr",
"nativeSrc": "1599:3:43",
"nodeType": "YulIdentifier",
"src": "1599:3:43"
},
"nativeSrc": "1599:20:43",
"nodeType": "YulFunctionCall",
"src": "1599:20:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1589:3:43",
"nodeType": "YulIdentifier",
"src": "1589:3:43"
},
"nativeSrc": "1589:31:43",
"nodeType": "YulFunctionCall",
"src": "1589:31:43"
},
"variables": [
{
"name": "_1",
"nativeSrc": "1583:2:43",
"nodeType": "YulTypedName",
"src": "1583:2:43",
"type": ""
}
]
},
{
"nativeSrc": "1633:24:43",
"nodeType": "YulVariableDeclaration",
"src": "1633:24:43",
"value": {
"name": "deleteStart",
"nativeSrc": "1646:11:43",
"nodeType": "YulIdentifier",
"src": "1646:11:43"
},
"variables": [
{
"name": "start",
"nativeSrc": "1637:5:43",
"nodeType": "YulTypedName",
"src": "1637:5:43",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "1731:20:43",
"nodeType": "YulBlock",
"src": "1731:20:43",
"statements": [
{
"expression": {
"arguments": [
{
"name": "start",
"nativeSrc": "1740:5:43",
"nodeType": "YulIdentifier",
"src": "1740:5:43"
},
{
"kind": "number",
"nativeSrc": "1747:1:43",
"nodeType": "YulLiteral",
"src": "1747:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "sstore",
"nativeSrc": "1733:6:43",
"nodeType": "YulIdentifier",
"src": "1733:6:43"
},
"nativeSrc": "1733:16:43",
"nodeType": "YulFunctionCall",
"src": "1733:16:43"
},
"nativeSrc": "1733:16:43",
"nodeType": "YulExpressionStatement",
"src": "1733:16:43"
}
]
},
"condition": {
"arguments": [
{
"name": "start",
"nativeSrc": "1681:5:43",
"nodeType": "YulIdentifier",
"src": "1681:5:43"
},
{
"name": "_1",
"nativeSrc": "1688:2:43",
"nodeType": "YulIdentifier",
"src": "1688:2:43"
}
],
"functionName": {
"name": "lt",
"nativeSrc": "1678:2:43",
"nodeType": "YulIdentifier",
"src": "1678:2:43"
},
"nativeSrc": "1678:13:43",
"nodeType": "YulFunctionCall",
"src": "1678:13:43"
},
"nativeSrc": "1670:81:43",
"nodeType": "YulForLoop",
"post": {
"nativeSrc": "1692:26:43",
"nodeType": "YulBlock",
"src": "1692:26:43",
"statements": [
{
"nativeSrc": "1694:22:43",
"nodeType": "YulAssignment",
"src": "1694:22:43",
"value": {
"arguments": [
{
"name": "start",
"nativeSrc": "1707:5:43",
"nodeType": "YulIdentifier",
"src": "1707:5:43"
},
{
"kind": "number",
"nativeSrc": "1714:1:43",
"nodeType": "YulLiteral",
"src": "1714:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1703:3:43",
"nodeType": "YulIdentifier",
"src": "1703:3:43"
},
"nativeSrc": "1703:13:43",
"nodeType": "YulFunctionCall",
"src": "1703:13:43"
},
"variableNames": [
{
"name": "start",
"nativeSrc": "1694:5:43",
"nodeType": "YulIdentifier",
"src": "1694:5:43"
}
]
}
]
},
"pre": {
"nativeSrc": "1674:3:43",
"nodeType": "YulBlock",
"src": "1674:3:43",
"statements": []
},
"src": "1670:81:43"
}
]
},
"condition": {
"arguments": [
{
"name": "len",
"nativeSrc": "1346:3:43",
"nodeType": "YulIdentifier",
"src": "1346:3:43"
},
{
"kind": "number",
"nativeSrc": "1351:2:43",
"nodeType": "YulLiteral",
"src": "1351:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "gt",
"nativeSrc": "1343:2:43",
"nodeType": "YulIdentifier",
"src": "1343:2:43"
},
"nativeSrc": "1343:11:43",
"nodeType": "YulFunctionCall",
"src": "1343:11:43"
},
"nativeSrc": "1340:421:43",
"nodeType": "YulIf",
"src": "1340:421:43"
}
]
},
"name": "clean_up_bytearray_end_slots_string_storage",
"nativeSrc": "1249:518:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "array",
"nativeSrc": "1302:5:43",
"nodeType": "YulTypedName",
"src": "1302:5:43",
"type": ""
},
{
"name": "len",
"nativeSrc": "1309:3:43",
"nodeType": "YulTypedName",
"src": "1309:3:43",
"type": ""
},
{
"name": "startIndex",
"nativeSrc": "1314:10:43",
"nodeType": "YulTypedName",
"src": "1314:10:43",
"type": ""
}
],
"src": "1249:518:43"
},
{
"body": {
"nativeSrc": "1857:81:43",
"nodeType": "YulBlock",
"src": "1857:81:43",
"statements": [
{
"nativeSrc": "1867:65:43",
"nodeType": "YulAssignment",
"src": "1867:65:43",
"value": {
"arguments": [
{
"arguments": [
{
"name": "data",
"nativeSrc": "1882:4:43",
"nodeType": "YulIdentifier",
"src": "1882:4:43"
},
{
"arguments": [
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "1900:1:43",
"nodeType": "YulLiteral",
"src": "1900:1:43",
"type": "",
"value": "3"
},
{
"name": "len",
"nativeSrc": "1903:3:43",
"nodeType": "YulIdentifier",
"src": "1903:3:43"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "1896:3:43",
"nodeType": "YulIdentifier",
"src": "1896:3:43"
},
"nativeSrc": "1896:11:43",
"nodeType": "YulFunctionCall",
"src": "1896:11:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "1913:1:43",
"nodeType": "YulLiteral",
"src": "1913:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "not",
"nativeSrc": "1909:3:43",
"nodeType": "YulIdentifier",
"src": "1909:3:43"
},
"nativeSrc": "1909:6:43",
"nodeType": "YulFunctionCall",
"src": "1909:6:43"
}
],
"functionName": {
"name": "shr",
"nativeSrc": "1892:3:43",
"nodeType": "YulIdentifier",
"src": "1892:3:43"
},
"nativeSrc": "1892:24:43",
"nodeType": "YulFunctionCall",
"src": "1892:24:43"
}
],
"functionName": {
"name": "not",
"nativeSrc": "1888:3:43",
"nodeType": "YulIdentifier",
"src": "1888:3:43"
},
"nativeSrc": "1888:29:43",
"nodeType": "YulFunctionCall",
"src": "1888:29:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "1878:3:43",
"nodeType": "YulIdentifier",
"src": "1878:3:43"
},
"nativeSrc": "1878:40:43",
"nodeType": "YulFunctionCall",
"src": "1878:40:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "1924:1:43",
"nodeType": "YulLiteral",
"src": "1924:1:43",
"type": "",
"value": "1"
},
{
"name": "len",
"nativeSrc": "1927:3:43",
"nodeType": "YulIdentifier",
"src": "1927:3:43"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "1920:3:43",
"nodeType": "YulIdentifier",
"src": "1920:3:43"
},
"nativeSrc": "1920:11:43",
"nodeType": "YulFunctionCall",
"src": "1920:11:43"
}
],
"functionName": {
"name": "or",
"nativeSrc": "1875:2:43",
"nodeType": "YulIdentifier",
"src": "1875:2:43"
},
"nativeSrc": "1875:57:43",
"nodeType": "YulFunctionCall",
"src": "1875:57:43"
},
"variableNames": [
{
"name": "used",
"nativeSrc": "1867:4:43",
"nodeType": "YulIdentifier",
"src": "1867:4:43"
}
]
}
]
},
"name": "extract_used_part_and_set_length_of_short_byte_array",
"nativeSrc": "1772:166:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "data",
"nativeSrc": "1834:4:43",
"nodeType": "YulTypedName",
"src": "1834:4:43",
"type": ""
},
{
"name": "len",
"nativeSrc": "1840:3:43",
"nodeType": "YulTypedName",
"src": "1840:3:43",
"type": ""
}
],
"returnVariables": [
{
"name": "used",
"nativeSrc": "1848:4:43",
"nodeType": "YulTypedName",
"src": "1848:4:43",
"type": ""
}
],
"src": "1772:166:43"
},
{
"body": {
"nativeSrc": "2039:1203:43",
"nodeType": "YulBlock",
"src": "2039:1203:43",
"statements": [
{
"nativeSrc": "2049:24:43",
"nodeType": "YulVariableDeclaration",
"src": "2049:24:43",
"value": {
"arguments": [
{
"name": "src",
"nativeSrc": "2069:3:43",
"nodeType": "YulIdentifier",
"src": "2069:3:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "2063:5:43",
"nodeType": "YulIdentifier",
"src": "2063:5:43"
},
"nativeSrc": "2063:10:43",
"nodeType": "YulFunctionCall",
"src": "2063:10:43"
},
"variables": [
{
"name": "newLen",
"nativeSrc": "2053:6:43",
"nodeType": "YulTypedName",
"src": "2053:6:43",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "2116:22:43",
"nodeType": "YulBlock",
"src": "2116:22:43",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x41",
"nativeSrc": "2118:16:43",
"nodeType": "YulIdentifier",
"src": "2118:16:43"
},
"nativeSrc": "2118:18:43",
"nodeType": "YulFunctionCall",
"src": "2118:18:43"
},
"nativeSrc": "2118:18:43",
"nodeType": "YulExpressionStatement",
"src": "2118:18:43"
}
]
},
"condition": {
"arguments": [
{
"name": "newLen",
"nativeSrc": "2088:6:43",
"nodeType": "YulIdentifier",
"src": "2088:6:43"
},
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "2104:2:43",
"nodeType": "YulLiteral",
"src": "2104:2:43",
"type": "",
"value": "64"
},
{
"kind": "number",
"nativeSrc": "2108:1:43",
"nodeType": "YulLiteral",
"src": "2108:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "2100:3:43",
"nodeType": "YulIdentifier",
"src": "2100:3:43"
},
"nativeSrc": "2100:10:43",
"nodeType": "YulFunctionCall",
"src": "2100:10:43"
},
{
"kind": "number",
"nativeSrc": "2112:1:43",
"nodeType": "YulLiteral",
"src": "2112:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "2096:3:43",
"nodeType": "YulIdentifier",
"src": "2096:3:43"
},
"nativeSrc": "2096:18:43",
"nodeType": "YulFunctionCall",
"src": "2096:18:43"
}
],
"functionName": {
"name": "gt",
"nativeSrc": "2085:2:43",
"nodeType": "YulIdentifier",
"src": "2085:2:43"
},
"nativeSrc": "2085:30:43",
"nodeType": "YulFunctionCall",
"src": "2085:30:43"
},
"nativeSrc": "2082:56:43",
"nodeType": "YulIf",
"src": "2082:56:43"
},
{
"expression": {
"arguments": [
{
"name": "slot",
"nativeSrc": "2191:4:43",
"nodeType": "YulIdentifier",
"src": "2191:4:43"
},
{
"arguments": [
{
"arguments": [
{
"name": "slot",
"nativeSrc": "2229:4:43",
"nodeType": "YulIdentifier",
"src": "2229:4:43"
}
],
"functionName": {
"name": "sload",
"nativeSrc": "2223:5:43",
"nodeType": "YulIdentifier",
"src": "2223:5:43"
},
"nativeSrc": "2223:11:43",
"nodeType": "YulFunctionCall",
"src": "2223:11:43"
}
],
"functionName": {
"name": "extract_byte_array_length",
"nativeSrc": "2197:25:43",
"nodeType": "YulIdentifier",
"src": "2197:25:43"
},
"nativeSrc": "2197:38:43",
"nodeType": "YulFunctionCall",
"src": "2197:38:43"
},
{
"name": "newLen",
"nativeSrc": "2237:6:43",
"nodeType": "YulIdentifier",
"src": "2237:6:43"
}
],
"functionName": {
"name": "clean_up_bytearray_end_slots_string_storage",
"nativeSrc": "2147:43:43",
"nodeType": "YulIdentifier",
"src": "2147:43:43"
},
"nativeSrc": "2147:97:43",
"nodeType": "YulFunctionCall",
"src": "2147:97:43"
},
"nativeSrc": "2147:97:43",
"nodeType": "YulExpressionStatement",
"src": "2147:97:43"
},
{
"nativeSrc": "2253:18:43",
"nodeType": "YulVariableDeclaration",
"src": "2253:18:43",
"value": {
"kind": "number",
"nativeSrc": "2270:1:43",
"nodeType": "YulLiteral",
"src": "2270:1:43",
"type": "",
"value": "0"
},
"variables": [
{
"name": "srcOffset",
"nativeSrc": "2257:9:43",
"nodeType": "YulTypedName",
"src": "2257:9:43",
"type": ""
}
]
},
{
"nativeSrc": "2280:17:43",
"nodeType": "YulAssignment",
"src": "2280:17:43",
"value": {
"kind": "number",
"nativeSrc": "2293:4:43",
"nodeType": "YulLiteral",
"src": "2293:4:43",
"type": "",
"value": "0x20"
},
"variableNames": [
{
"name": "srcOffset",
"nativeSrc": "2280:9:43",
"nodeType": "YulIdentifier",
"src": "2280:9:43"
}
]
},
{
"cases": [
{
"body": {
"nativeSrc": "2343:642:43",
"nodeType": "YulBlock",
"src": "2343:642:43",
"statements": [
{
"nativeSrc": "2357:35:43",
"nodeType": "YulVariableDeclaration",
"src": "2357:35:43",
"value": {
"arguments": [
{
"name": "newLen",
"nativeSrc": "2376:6:43",
"nodeType": "YulIdentifier",
"src": "2376:6:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "2388:2:43",
"nodeType": "YulLiteral",
"src": "2388:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "not",
"nativeSrc": "2384:3:43",
"nodeType": "YulIdentifier",
"src": "2384:3:43"
},
"nativeSrc": "2384:7:43",
"nodeType": "YulFunctionCall",
"src": "2384:7:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "2372:3:43",
"nodeType": "YulIdentifier",
"src": "2372:3:43"
},
"nativeSrc": "2372:20:43",
"nodeType": "YulFunctionCall",
"src": "2372:20:43"
},
"variables": [
{
"name": "loopEnd",
"nativeSrc": "2361:7:43",
"nodeType": "YulTypedName",
"src": "2361:7:43",
"type": ""
}
]
},
{
"nativeSrc": "2405:49:43",
"nodeType": "YulVariableDeclaration",
"src": "2405:49:43",
"value": {
"arguments": [
{
"name": "slot",
"nativeSrc": "2449:4:43",
"nodeType": "YulIdentifier",
"src": "2449:4:43"
}
],
"functionName": {
"name": "array_dataslot_string_storage",
"nativeSrc": "2419:29:43",
"nodeType": "YulIdentifier",
"src": "2419:29:43"
},
"nativeSrc": "2419:35:43",
"nodeType": "YulFunctionCall",
"src": "2419:35:43"
},
"variables": [
{
"name": "dstPtr",
"nativeSrc": "2409:6:43",
"nodeType": "YulTypedName",
"src": "2409:6:43",
"type": ""
}
]
},
{
"nativeSrc": "2467:10:43",
"nodeType": "YulVariableDeclaration",
"src": "2467:10:43",
"value": {
"kind": "number",
"nativeSrc": "2476:1:43",
"nodeType": "YulLiteral",
"src": "2476:1:43",
"type": "",
"value": "0"
},
"variables": [
{
"name": "i",
"nativeSrc": "2471:1:43",
"nodeType": "YulTypedName",
"src": "2471:1:43",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "2547:165:43",
"nodeType": "YulBlock",
"src": "2547:165:43",
"statements": [
{
"expression": {
"arguments": [
{
"name": "dstPtr",
"nativeSrc": "2572:6:43",
"nodeType": "YulIdentifier",
"src": "2572:6:43"
},
{
"arguments": [
{
"arguments": [
{
"name": "src",
"nativeSrc": "2590:3:43",
"nodeType": "YulIdentifier",
"src": "2590:3:43"
},
{
"name": "srcOffset",
"nativeSrc": "2595:9:43",
"nodeType": "YulIdentifier",
"src": "2595:9:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2586:3:43",
"nodeType": "YulIdentifier",
"src": "2586:3:43"
},
"nativeSrc": "2586:19:43",
"nodeType": "YulFunctionCall",
"src": "2586:19:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "2580:5:43",
"nodeType": "YulIdentifier",
"src": "2580:5:43"
},
"nativeSrc": "2580:26:43",
"nodeType": "YulFunctionCall",
"src": "2580:26:43"
}
],
"functionName": {
"name": "sstore",
"nativeSrc": "2565:6:43",
"nodeType": "YulIdentifier",
"src": "2565:6:43"
},
"nativeSrc": "2565:42:43",
"nodeType": "YulFunctionCall",
"src": "2565:42:43"
},
"nativeSrc": "2565:42:43",
"nodeType": "YulExpressionStatement",
"src": "2565:42:43"
},
{
"nativeSrc": "2624:24:43",
"nodeType": "YulAssignment",
"src": "2624:24:43",
"value": {
"arguments": [
{
"name": "dstPtr",
"nativeSrc": "2638:6:43",
"nodeType": "YulIdentifier",
"src": "2638:6:43"
},
{
"kind": "number",
"nativeSrc": "2646:1:43",
"nodeType": "YulLiteral",
"src": "2646:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2634:3:43",
"nodeType": "YulIdentifier",
"src": "2634:3:43"
},
"nativeSrc": "2634:14:43",
"nodeType": "YulFunctionCall",
"src": "2634:14:43"
},
"variableNames": [
{
"name": "dstPtr",
"nativeSrc": "2624:6:43",
"nodeType": "YulIdentifier",
"src": "2624:6:43"
}
]
},
{
"nativeSrc": "2665:33:43",
"nodeType": "YulAssignment",
"src": "2665:33:43",
"value": {
"arguments": [
{
"name": "srcOffset",
"nativeSrc": "2682:9:43",
"nodeType": "YulIdentifier",
"src": "2682:9:43"
},
{
"kind": "number",
"nativeSrc": "2693:4:43",
"nodeType": "YulLiteral",
"src": "2693:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2678:3:43",
"nodeType": "YulIdentifier",
"src": "2678:3:43"
},
"nativeSrc": "2678:20:43",
"nodeType": "YulFunctionCall",
"src": "2678:20:43"
},
"variableNames": [
{
"name": "srcOffset",
"nativeSrc": "2665:9:43",
"nodeType": "YulIdentifier",
"src": "2665:9:43"
}
]
}
]
},
"condition": {
"arguments": [
{
"name": "i",
"nativeSrc": "2501:1:43",
"nodeType": "YulIdentifier",
"src": "2501:1:43"
},
{
"name": "loopEnd",
"nativeSrc": "2504:7:43",
"nodeType": "YulIdentifier",
"src": "2504:7:43"
}
],
"functionName": {
"name": "lt",
"nativeSrc": "2498:2:43",
"nodeType": "YulIdentifier",
"src": "2498:2:43"
},
"nativeSrc": "2498:14:43",
"nodeType": "YulFunctionCall",
"src": "2498:14:43"
},
"nativeSrc": "2490:222:43",
"nodeType": "YulForLoop",
"post": {
"nativeSrc": "2513:21:43",
"nodeType": "YulBlock",
"src": "2513:21:43",
"statements": [
{
"nativeSrc": "2515:17:43",
"nodeType": "YulAssignment",
"src": "2515:17:43",
"value": {
"arguments": [
{
"name": "i",
"nativeSrc": "2524:1:43",
"nodeType": "YulIdentifier",
"src": "2524:1:43"
},
{
"kind": "number",
"nativeSrc": "2527:4:43",
"nodeType": "YulLiteral",
"src": "2527:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2520:3:43",
"nodeType": "YulIdentifier",
"src": "2520:3:43"
},
"nativeSrc": "2520:12:43",
"nodeType": "YulFunctionCall",
"src": "2520:12:43"
},
"variableNames": [
{
"name": "i",
"nativeSrc": "2515:1:43",
"nodeType": "YulIdentifier",
"src": "2515:1:43"
}
]
}
]
},
"pre": {
"nativeSrc": "2494:3:43",
"nodeType": "YulBlock",
"src": "2494:3:43",
"statements": []
},
"src": "2490:222:43"
},
{
"body": {
"nativeSrc": "2760:166:43",
"nodeType": "YulBlock",
"src": "2760:166:43",
"statements": [
{
"nativeSrc": "2778:43:43",
"nodeType": "YulVariableDeclaration",
"src": "2778:43:43",
"value": {
"arguments": [
{
"arguments": [
{
"name": "src",
"nativeSrc": "2805:3:43",
"nodeType": "YulIdentifier",
"src": "2805:3:43"
},
{
"name": "srcOffset",
"nativeSrc": "2810:9:43",
"nodeType": "YulIdentifier",
"src": "2810:9:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2801:3:43",
"nodeType": "YulIdentifier",
"src": "2801:3:43"
},
"nativeSrc": "2801:19:43",
"nodeType": "YulFunctionCall",
"src": "2801:19:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "2795:5:43",
"nodeType": "YulIdentifier",
"src": "2795:5:43"
},
"nativeSrc": "2795:26:43",
"nodeType": "YulFunctionCall",
"src": "2795:26:43"
},
"variables": [
{
"name": "lastValue",
"nativeSrc": "2782:9:43",
"nodeType": "YulTypedName",
"src": "2782:9:43",
"type": ""
}
]
},
{
"expression": {
"arguments": [
{
"name": "dstPtr",
"nativeSrc": "2845:6:43",
"nodeType": "YulIdentifier",
"src": "2845:6:43"
},
{
"arguments": [
{
"name": "lastValue",
"nativeSrc": "2857:9:43",
"nodeType": "YulIdentifier",
"src": "2857:9:43"
},
{
"arguments": [
{
"arguments": [
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "2884:1:43",
"nodeType": "YulLiteral",
"src": "2884:1:43",
"type": "",
"value": "3"
},
{
"name": "newLen",
"nativeSrc": "2887:6:43",
"nodeType": "YulIdentifier",
"src": "2887:6:43"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "2880:3:43",
"nodeType": "YulIdentifier",
"src": "2880:3:43"
},
"nativeSrc": "2880:14:43",
"nodeType": "YulFunctionCall",
"src": "2880:14:43"
},
{
"kind": "number",
"nativeSrc": "2896:3:43",
"nodeType": "YulLiteral",
"src": "2896:3:43",
"type": "",
"value": "248"
}
],
"functionName": {
"name": "and",
"nativeSrc": "2876:3:43",
"nodeType": "YulIdentifier",
"src": "2876:3:43"
},
"nativeSrc": "2876:24:43",
"nodeType": "YulFunctionCall",
"src": "2876:24:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "2906:1:43",
"nodeType": "YulLiteral",
"src": "2906:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "not",
"nativeSrc": "2902:3:43",
"nodeType": "YulIdentifier",
"src": "2902:3:43"
},
"nativeSrc": "2902:6:43",
"nodeType": "YulFunctionCall",
"src": "2902:6:43"
}
],
"functionName": {
"name": "shr",
"nativeSrc": "2872:3:43",
"nodeType": "YulIdentifier",
"src": "2872:3:43"
},
"nativeSrc": "2872:37:43",
"nodeType": "YulFunctionCall",
"src": "2872:37:43"
}
],
"functionName": {
"name": "not",
"nativeSrc": "2868:3:43",
"nodeType": "YulIdentifier",
"src": "2868:3:43"
},
"nativeSrc": "2868:42:43",
"nodeType": "YulFunctionCall",
"src": "2868:42:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "2853:3:43",
"nodeType": "YulIdentifier",
"src": "2853:3:43"
},
"nativeSrc": "2853:58:43",
"nodeType": "YulFunctionCall",
"src": "2853:58:43"
}
],
"functionName": {
"name": "sstore",
"nativeSrc": "2838:6:43",
"nodeType": "YulIdentifier",
"src": "2838:6:43"
},
"nativeSrc": "2838:74:43",
"nodeType": "YulFunctionCall",
"src": "2838:74:43"
},
"nativeSrc": "2838:74:43",
"nodeType": "YulExpressionStatement",
"src": "2838:74:43"
}
]
},
"condition": {
"arguments": [
{
"name": "loopEnd",
"nativeSrc": "2731:7:43",
"nodeType": "YulIdentifier",
"src": "2731:7:43"
},
{
"name": "newLen",
"nativeSrc": "2740:6:43",
"nodeType": "YulIdentifier",
"src": "2740:6:43"
}
],
"functionName": {
"name": "lt",
"nativeSrc": "2728:2:43",
"nodeType": "YulIdentifier",
"src": "2728:2:43"
},
"nativeSrc": "2728:19:43",
"nodeType": "YulFunctionCall",
"src": "2728:19:43"
},
"nativeSrc": "2725:201:43",
"nodeType": "YulIf",
"src": "2725:201:43"
},
{
"expression": {
"arguments": [
{
"name": "slot",
"nativeSrc": "2946:4:43",
"nodeType": "YulIdentifier",
"src": "2946:4:43"
},
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "2960:1:43",
"nodeType": "YulLiteral",
"src": "2960:1:43",
"type": "",
"value": "1"
},
{
"name": "newLen",
"nativeSrc": "2963:6:43",
"nodeType": "YulIdentifier",
"src": "2963:6:43"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "2956:3:43",
"nodeType": "YulIdentifier",
"src": "2956:3:43"
},
"nativeSrc": "2956:14:43",
"nodeType": "YulFunctionCall",
"src": "2956:14:43"
},
{
"kind": "number",
"nativeSrc": "2972:1:43",
"nodeType": "YulLiteral",
"src": "2972:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2952:3:43",
"nodeType": "YulIdentifier",
"src": "2952:3:43"
},
"nativeSrc": "2952:22:43",
"nodeType": "YulFunctionCall",
"src": "2952:22:43"
}
],
"functionName": {
"name": "sstore",
"nativeSrc": "2939:6:43",
"nodeType": "YulIdentifier",
"src": "2939:6:43"
},
"nativeSrc": "2939:36:43",
"nodeType": "YulFunctionCall",
"src": "2939:36:43"
},
"nativeSrc": "2939:36:43",
"nodeType": "YulExpressionStatement",
"src": "2939:36:43"
}
]
},
"nativeSrc": "2336:649:43",
"nodeType": "YulCase",
"src": "2336:649:43",
"value": {
"kind": "number",
"nativeSrc": "2341:1:43",
"nodeType": "YulLiteral",
"src": "2341:1:43",
"type": "",
"value": "1"
}
},
{
"body": {
"nativeSrc": "3002:234:43",
"nodeType": "YulBlock",
"src": "3002:234:43",
"statements": [
{
"nativeSrc": "3016:14:43",
"nodeType": "YulVariableDeclaration",
"src": "3016:14:43",
"value": {
"kind": "number",
"nativeSrc": "3029:1:43",
"nodeType": "YulLiteral",
"src": "3029:1:43",
"type": "",
"value": "0"
},
"variables": [
{
"name": "value",
"nativeSrc": "3020:5:43",
"nodeType": "YulTypedName",
"src": "3020:5:43",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "3065:67:43",
"nodeType": "YulBlock",
"src": "3065:67:43",
"statements": [
{
"nativeSrc": "3083:35:43",
"nodeType": "YulAssignment",
"src": "3083:35:43",
"value": {
"arguments": [
{
"arguments": [
{
"name": "src",
"nativeSrc": "3102:3:43",
"nodeType": "YulIdentifier",
"src": "3102:3:43"
},
{
"name": "srcOffset",
"nativeSrc": "3107:9:43",
"nodeType": "YulIdentifier",
"src": "3107:9:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "3098:3:43",
"nodeType": "YulIdentifier",
"src": "3098:3:43"
},
"nativeSrc": "3098:19:43",
"nodeType": "YulFunctionCall",
"src": "3098:19:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "3092:5:43",
"nodeType": "YulIdentifier",
"src": "3092:5:43"
},
"nativeSrc": "3092:26:43",
"nodeType": "YulFunctionCall",
"src": "3092:26:43"
},
"variableNames": [
{
"name": "value",
"nativeSrc": "3083:5:43",
"nodeType": "YulIdentifier",
"src": "3083:5:43"
}
]
}
]
},
"condition": {
"name": "newLen",
"nativeSrc": "3046:6:43",
"nodeType": "YulIdentifier",
"src": "3046:6:43"
},
"nativeSrc": "3043:89:43",
"nodeType": "YulIf",
"src": "3043:89:43"
},
{
"expression": {
"arguments": [
{
"name": "slot",
"nativeSrc": "3152:4:43",
"nodeType": "YulIdentifier",
"src": "3152:4:43"
},
{
"arguments": [
{
"name": "value",
"nativeSrc": "3211:5:43",
"nodeType": "YulIdentifier",
"src": "3211:5:43"
},
{
"name": "newLen",
"nativeSrc": "3218:6:43",
"nodeType": "YulIdentifier",
"src": "3218:6:43"
}
],
"functionName": {
"name": "extract_used_part_and_set_length_of_short_byte_array",
"nativeSrc": "3158:52:43",
"nodeType": "YulIdentifier",
"src": "3158:52:43"
},
"nativeSrc": "3158:67:43",
"nodeType": "YulFunctionCall",
"src": "3158:67:43"
}
],
"functionName": {
"name": "sstore",
"nativeSrc": "3145:6:43",
"nodeType": "YulIdentifier",
"src": "3145:6:43"
},
"nativeSrc": "3145:81:43",
"nodeType": "YulFunctionCall",
"src": "3145:81:43"
},
"nativeSrc": "3145:81:43",
"nodeType": "YulExpressionStatement",
"src": "3145:81:43"
}
]
},
"nativeSrc": "2994:242:43",
"nodeType": "YulCase",
"src": "2994:242:43",
"value": "default"
}
],
"expression": {
"arguments": [
{
"name": "newLen",
"nativeSrc": "2316:6:43",
"nodeType": "YulIdentifier",
"src": "2316:6:43"
},
{
"kind": "number",
"nativeSrc": "2324:2:43",
"nodeType": "YulLiteral",
"src": "2324:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "gt",
"nativeSrc": "2313:2:43",
"nodeType": "YulIdentifier",
"src": "2313:2:43"
},
"nativeSrc": "2313:14:43",
"nodeType": "YulFunctionCall",
"src": "2313:14:43"
},
"nativeSrc": "2306:930:43",
"nodeType": "YulSwitch",
"src": "2306:930:43"
}
]
},
"name": "copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage",
"nativeSrc": "1943:1299:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "slot",
"nativeSrc": "2024:4:43",
"nodeType": "YulTypedName",
"src": "2024:4:43",
"type": ""
},
{
"name": "src",
"nativeSrc": "2030:3:43",
"nodeType": "YulTypedName",
"src": "2030:3:43",
"type": ""
}
],
"src": "1943:1299:43"
},
{
"body": {
"nativeSrc": "3460:276:43",
"nodeType": "YulBlock",
"src": "3460:276:43",
"statements": [
{
"nativeSrc": "3470:27:43",
"nodeType": "YulAssignment",
"src": "3470:27:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "3482:9:43",
"nodeType": "YulIdentifier",
"src": "3482:9:43"
},
{
"kind": "number",
"nativeSrc": "3493:3:43",
"nodeType": "YulLiteral",
"src": "3493:3:43",
"type": "",
"value": "160"
}
],
"functionName": {
"name": "add",
"nativeSrc": "3478:3:43",
"nodeType": "YulIdentifier",
"src": "3478:3:43"
},
"nativeSrc": "3478:19:43",
"nodeType": "YulFunctionCall",
"src": "3478:19:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "3470:4:43",
"nodeType": "YulIdentifier",
"src": "3470:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "3513:9:43",
"nodeType": "YulIdentifier",
"src": "3513:9:43"
},
{
"name": "value0",
"nativeSrc": "3524:6:43",
"nodeType": "YulIdentifier",
"src": "3524:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "3506:6:43",
"nodeType": "YulIdentifier",
"src": "3506:6:43"
},
"nativeSrc": "3506:25:43",
"nodeType": "YulFunctionCall",
"src": "3506:25:43"
},
"nativeSrc": "3506:25:43",
"nodeType": "YulExpressionStatement",
"src": "3506:25:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "3551:9:43",
"nodeType": "YulIdentifier",
"src": "3551:9:43"
},
{
"kind": "number",
"nativeSrc": "3562:2:43",
"nodeType": "YulLiteral",
"src": "3562:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "3547:3:43",
"nodeType": "YulIdentifier",
"src": "3547:3:43"
},
"nativeSrc": "3547:18:43",
"nodeType": "YulFunctionCall",
"src": "3547:18:43"
},
{
"name": "value1",
"nativeSrc": "3567:6:43",
"nodeType": "YulIdentifier",
"src": "3567:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "3540:6:43",
"nodeType": "YulIdentifier",
"src": "3540:6:43"
},
"nativeSrc": "3540:34:43",
"nodeType": "YulFunctionCall",
"src": "3540:34:43"
},
"nativeSrc": "3540:34:43",
"nodeType": "YulExpressionStatement",
"src": "3540:34:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "3594:9:43",
"nodeType": "YulIdentifier",
"src": "3594:9:43"
},
{
"kind": "number",
"nativeSrc": "3605:2:43",
"nodeType": "YulLiteral",
"src": "3605:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nativeSrc": "3590:3:43",
"nodeType": "YulIdentifier",
"src": "3590:3:43"
},
"nativeSrc": "3590:18:43",
"nodeType": "YulFunctionCall",
"src": "3590:18:43"
},
{
"name": "value2",
"nativeSrc": "3610:6:43",
"nodeType": "YulIdentifier",
"src": "3610:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "3583:6:43",
"nodeType": "YulIdentifier",
"src": "3583:6:43"
},
"nativeSrc": "3583:34:43",
"nodeType": "YulFunctionCall",
"src": "3583:34:43"
},
"nativeSrc": "3583:34:43",
"nodeType": "YulExpressionStatement",
"src": "3583:34:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "3637:9:43",
"nodeType": "YulIdentifier",
"src": "3637:9:43"
},
{
"kind": "number",
"nativeSrc": "3648:2:43",
"nodeType": "YulLiteral",
"src": "3648:2:43",
"type": "",
"value": "96"
}
],
"functionName": {
"name": "add",
"nativeSrc": "3633:3:43",
"nodeType": "YulIdentifier",
"src": "3633:3:43"
},
"nativeSrc": "3633:18:43",
"nodeType": "YulFunctionCall",
"src": "3633:18:43"
},
{
"name": "value3",
"nativeSrc": "3653:6:43",
"nodeType": "YulIdentifier",
"src": "3653:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "3626:6:43",
"nodeType": "YulIdentifier",
"src": "3626:6:43"
},
"nativeSrc": "3626:34:43",
"nodeType": "YulFunctionCall",
"src": "3626:34:43"
},
"nativeSrc": "3626:34:43",
"nodeType": "YulExpressionStatement",
"src": "3626:34:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "3680:9:43",
"nodeType": "YulIdentifier",
"src": "3680:9:43"
},
{
"kind": "number",
"nativeSrc": "3691:3:43",
"nodeType": "YulLiteral",
"src": "3691:3:43",
"type": "",
"value": "128"
}
],
"functionName": {
"name": "add",
"nativeSrc": "3676:3:43",
"nodeType": "YulIdentifier",
"src": "3676:3:43"
},
"nativeSrc": "3676:19:43",
"nodeType": "YulFunctionCall",
"src": "3676:19:43"
},
{
"arguments": [
{
"name": "value4",
"nativeSrc": "3701:6:43",
"nodeType": "YulIdentifier",
"src": "3701:6:43"
},
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "3717:3:43",
"nodeType": "YulLiteral",
"src": "3717:3:43",
"type": "",
"value": "160"
},
{
"kind": "number",
"nativeSrc": "3722:1:43",
"nodeType": "YulLiteral",
"src": "3722:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "3713:3:43",
"nodeType": "YulIdentifier",
"src": "3713:3:43"
},
"nativeSrc": "3713:11:43",
"nodeType": "YulFunctionCall",
"src": "3713:11:43"
},
{
"kind": "number",
"nativeSrc": "3726:1:43",
"nodeType": "YulLiteral",
"src": "3726:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "3709:3:43",
"nodeType": "YulIdentifier",
"src": "3709:3:43"
},
"nativeSrc": "3709:19:43",
"nodeType": "YulFunctionCall",
"src": "3709:19:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "3697:3:43",
"nodeType": "YulIdentifier",
"src": "3697:3:43"
},
"nativeSrc": "3697:32:43",
"nodeType": "YulFunctionCall",
"src": "3697:32:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "3669:6:43",
"nodeType": "YulIdentifier",
"src": "3669:6:43"
},
"nativeSrc": "3669:61:43",
"nodeType": "YulFunctionCall",
"src": "3669:61:43"
},
"nativeSrc": "3669:61:43",
"nodeType": "YulExpressionStatement",
"src": "3669:61:43"
}
]
},
"name": "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed",
"nativeSrc": "3247:489:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "3397:9:43",
"nodeType": "YulTypedName",
"src": "3397:9:43",
"type": ""
},
{
"name": "value4",
"nativeSrc": "3408:6:43",
"nodeType": "YulTypedName",
"src": "3408:6:43",
"type": ""
},
{
"name": "value3",
"nativeSrc": "3416:6:43",
"nodeType": "YulTypedName",
"src": "3416:6:43",
"type": ""
},
{
"name": "value2",
"nativeSrc": "3424:6:43",
"nodeType": "YulTypedName",
"src": "3424:6:43",
"type": ""
},
{
"name": "value1",
"nativeSrc": "3432:6:43",
"nodeType": "YulTypedName",
"src": "3432:6:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "3440:6:43",
"nodeType": "YulTypedName",
"src": "3440:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "3451:4:43",
"nodeType": "YulTypedName",
"src": "3451:4:43",
"type": ""
}
],
"src": "3247:489:43"
},
{
"body": {
"nativeSrc": "3868:161:43",
"nodeType": "YulBlock",
"src": "3868:161:43",
"statements": [
{
"nativeSrc": "3878:26:43",
"nodeType": "YulAssignment",
"src": "3878:26:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "3890:9:43",
"nodeType": "YulIdentifier",
"src": "3890:9:43"
},
{
"kind": "number",
"nativeSrc": "3901:2:43",
"nodeType": "YulLiteral",
"src": "3901:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nativeSrc": "3886:3:43",
"nodeType": "YulIdentifier",
"src": "3886:3:43"
},
"nativeSrc": "3886:18:43",
"nodeType": "YulFunctionCall",
"src": "3886:18:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "3878:4:43",
"nodeType": "YulIdentifier",
"src": "3878:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "3920:9:43",
"nodeType": "YulIdentifier",
"src": "3920:9:43"
},
{
"arguments": [
{
"name": "value0",
"nativeSrc": "3935:6:43",
"nodeType": "YulIdentifier",
"src": "3935:6:43"
},
{
"kind": "number",
"nativeSrc": "3943:14:43",
"nodeType": "YulLiteral",
"src": "3943:14:43",
"type": "",
"value": "0xffffffffffff"
}
],
"functionName": {
"name": "and",
"nativeSrc": "3931:3:43",
"nodeType": "YulIdentifier",
"src": "3931:3:43"
},
"nativeSrc": "3931:27:43",
"nodeType": "YulFunctionCall",
"src": "3931:27:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "3913:6:43",
"nodeType": "YulIdentifier",
"src": "3913:6:43"
},
"nativeSrc": "3913:46:43",
"nodeType": "YulFunctionCall",
"src": "3913:46:43"
},
"nativeSrc": "3913:46:43",
"nodeType": "YulExpressionStatement",
"src": "3913:46:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "3979:9:43",
"nodeType": "YulIdentifier",
"src": "3979:9:43"
},
{
"kind": "number",
"nativeSrc": "3990:2:43",
"nodeType": "YulLiteral",
"src": "3990:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "3975:3:43",
"nodeType": "YulIdentifier",
"src": "3975:3:43"
},
"nativeSrc": "3975:18:43",
"nodeType": "YulFunctionCall",
"src": "3975:18:43"
},
{
"arguments": [
{
"name": "value1",
"nativeSrc": "3999:6:43",
"nodeType": "YulIdentifier",
"src": "3999:6:43"
},
{
"kind": "number",
"nativeSrc": "4007:14:43",
"nodeType": "YulLiteral",
"src": "4007:14:43",
"type": "",
"value": "0xffffffffffff"
}
],
"functionName": {
"name": "and",
"nativeSrc": "3995:3:43",
"nodeType": "YulIdentifier",
"src": "3995:3:43"
},
"nativeSrc": "3995:27:43",
"nodeType": "YulFunctionCall",
"src": "3995:27:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "3968:6:43",
"nodeType": "YulIdentifier",
"src": "3968:6:43"
},
"nativeSrc": "3968:55:43",
"nodeType": "YulFunctionCall",
"src": "3968:55:43"
},
"nativeSrc": "3968:55:43",
"nodeType": "YulExpressionStatement",
"src": "3968:55:43"
}
]
},
"name": "abi_encode_tuple_t_uint48_t_uint48__to_t_uint256_t_uint256__fromStack_reversed",
"nativeSrc": "3741:288:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "3829:9:43",
"nodeType": "YulTypedName",
"src": "3829:9:43",
"type": ""
},
{
"name": "value1",
"nativeSrc": "3840:6:43",
"nodeType": "YulTypedName",
"src": "3840:6:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "3848:6:43",
"nodeType": "YulTypedName",
"src": "3848:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "3859:4:43",
"nodeType": "YulTypedName",
"src": "3859:4:43",
"type": ""
}
],
"src": "3741:288:43"
},
{
"body": {
"nativeSrc": "4143:76:43",
"nodeType": "YulBlock",
"src": "4143:76:43",
"statements": [
{
"nativeSrc": "4153:26:43",
"nodeType": "YulAssignment",
"src": "4153:26:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "4165:9:43",
"nodeType": "YulIdentifier",
"src": "4165:9:43"
},
{
"kind": "number",
"nativeSrc": "4176:2:43",
"nodeType": "YulLiteral",
"src": "4176:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "4161:3:43",
"nodeType": "YulIdentifier",
"src": "4161:3:43"
},
"nativeSrc": "4161:18:43",
"nodeType": "YulFunctionCall",
"src": "4161:18:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "4153:4:43",
"nodeType": "YulIdentifier",
"src": "4153:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "4195:9:43",
"nodeType": "YulIdentifier",
"src": "4195:9:43"
},
{
"name": "value0",
"nativeSrc": "4206:6:43",
"nodeType": "YulIdentifier",
"src": "4206:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "4188:6:43",
"nodeType": "YulIdentifier",
"src": "4188:6:43"
},
"nativeSrc": "4188:25:43",
"nodeType": "YulFunctionCall",
"src": "4188:25:43"
},
"nativeSrc": "4188:25:43",
"nodeType": "YulExpressionStatement",
"src": "4188:25:43"
}
]
},
"name": "abi_encode_tuple_t_rational_0_by_1__to_t_uint256__fromStack_reversed",
"nativeSrc": "4034:185:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "4112:9:43",
"nodeType": "YulTypedName",
"src": "4112:9:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "4123:6:43",
"nodeType": "YulTypedName",
"src": "4123:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "4134:4:43",
"nodeType": "YulTypedName",
"src": "4134:4:43",
"type": ""
}
],
"src": "4034:185:43"
},
{
"body": {
"nativeSrc": "4351:153:43",
"nodeType": "YulBlock",
"src": "4351:153:43",
"statements": [
{
"nativeSrc": "4361:26:43",
"nodeType": "YulAssignment",
"src": "4361:26:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "4373:9:43",
"nodeType": "YulIdentifier",
"src": "4373:9:43"
},
{
"kind": "number",
"nativeSrc": "4384:2:43",
"nodeType": "YulLiteral",
"src": "4384:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nativeSrc": "4369:3:43",
"nodeType": "YulIdentifier",
"src": "4369:3:43"
},
"nativeSrc": "4369:18:43",
"nodeType": "YulFunctionCall",
"src": "4369:18:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "4361:4:43",
"nodeType": "YulIdentifier",
"src": "4361:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "4403:9:43",
"nodeType": "YulIdentifier",
"src": "4403:9:43"
},
{
"arguments": [
{
"name": "value0",
"nativeSrc": "4418:6:43",
"nodeType": "YulIdentifier",
"src": "4418:6:43"
},
{
"kind": "number",
"nativeSrc": "4426:10:43",
"nodeType": "YulLiteral",
"src": "4426:10:43",
"type": "",
"value": "0xffffffff"
}
],
"functionName": {
"name": "and",
"nativeSrc": "4414:3:43",
"nodeType": "YulIdentifier",
"src": "4414:3:43"
},
"nativeSrc": "4414:23:43",
"nodeType": "YulFunctionCall",
"src": "4414:23:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "4396:6:43",
"nodeType": "YulIdentifier",
"src": "4396:6:43"
},
"nativeSrc": "4396:42:43",
"nodeType": "YulFunctionCall",
"src": "4396:42:43"
},
"nativeSrc": "4396:42:43",
"nodeType": "YulExpressionStatement",
"src": "4396:42:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "4458:9:43",
"nodeType": "YulIdentifier",
"src": "4458:9:43"
},
{
"kind": "number",
"nativeSrc": "4469:2:43",
"nodeType": "YulLiteral",
"src": "4469:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "4454:3:43",
"nodeType": "YulIdentifier",
"src": "4454:3:43"
},
"nativeSrc": "4454:18:43",
"nodeType": "YulFunctionCall",
"src": "4454:18:43"
},
{
"arguments": [
{
"name": "value1",
"nativeSrc": "4478:6:43",
"nodeType": "YulIdentifier",
"src": "4478:6:43"
},
{
"kind": "number",
"nativeSrc": "4486:10:43",
"nodeType": "YulLiteral",
"src": "4486:10:43",
"type": "",
"value": "0xffffffff"
}
],
"functionName": {
"name": "and",
"nativeSrc": "4474:3:43",
"nodeType": "YulIdentifier",
"src": "4474:3:43"
},
"nativeSrc": "4474:23:43",
"nodeType": "YulFunctionCall",
"src": "4474:23:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "4447:6:43",
"nodeType": "YulIdentifier",
"src": "4447:6:43"
},
"nativeSrc": "4447:51:43",
"nodeType": "YulFunctionCall",
"src": "4447:51:43"
},
"nativeSrc": "4447:51:43",
"nodeType": "YulExpressionStatement",
"src": "4447:51:43"
}
]
},
"name": "abi_encode_tuple_t_uint32_t_uint32__to_t_uint256_t_uint256__fromStack_reversed",
"nativeSrc": "4224:280:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "4312:9:43",
"nodeType": "YulTypedName",
"src": "4312:9:43",
"type": ""
},
{
"name": "value1",
"nativeSrc": "4323:6:43",
"nodeType": "YulTypedName",
"src": "4323:6:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "4331:6:43",
"nodeType": "YulTypedName",
"src": "4331:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "4342:4:43",
"nodeType": "YulTypedName",
"src": "4342:4:43",
"type": ""
}
],
"src": "4224:280:43"
},
{
"body": {
"nativeSrc": "4638:119:43",
"nodeType": "YulBlock",
"src": "4638:119:43",
"statements": [
{
"nativeSrc": "4648:26:43",
"nodeType": "YulAssignment",
"src": "4648:26:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "4660:9:43",
"nodeType": "YulIdentifier",
"src": "4660:9:43"
},
{
"kind": "number",
"nativeSrc": "4671:2:43",
"nodeType": "YulLiteral",
"src": "4671:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nativeSrc": "4656:3:43",
"nodeType": "YulIdentifier",
"src": "4656:3:43"
},
"nativeSrc": "4656:18:43",
"nodeType": "YulFunctionCall",
"src": "4656:18:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "4648:4:43",
"nodeType": "YulIdentifier",
"src": "4648:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "4690:9:43",
"nodeType": "YulIdentifier",
"src": "4690:9:43"
},
{
"name": "value0",
"nativeSrc": "4701:6:43",
"nodeType": "YulIdentifier",
"src": "4701:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "4683:6:43",
"nodeType": "YulIdentifier",
"src": "4683:6:43"
},
"nativeSrc": "4683:25:43",
"nodeType": "YulFunctionCall",
"src": "4683:25:43"
},
"nativeSrc": "4683:25:43",
"nodeType": "YulExpressionStatement",
"src": "4683:25:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "4728:9:43",
"nodeType": "YulIdentifier",
"src": "4728:9:43"
},
{
"kind": "number",
"nativeSrc": "4739:2:43",
"nodeType": "YulLiteral",
"src": "4739:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "4724:3:43",
"nodeType": "YulIdentifier",
"src": "4724:3:43"
},
"nativeSrc": "4724:18:43",
"nodeType": "YulFunctionCall",
"src": "4724:18:43"
},
{
"name": "value1",
"nativeSrc": "4744:6:43",
"nodeType": "YulIdentifier",
"src": "4744:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "4717:6:43",
"nodeType": "YulIdentifier",
"src": "4717:6:43"
},
"nativeSrc": "4717:34:43",
"nodeType": "YulFunctionCall",
"src": "4717:34:43"
},
"nativeSrc": "4717:34:43",
"nodeType": "YulExpressionStatement",
"src": "4717:34:43"
}
]
},
"name": "abi_encode_tuple_t_uint256_t_uint256__to_t_uint256_t_uint256__fromStack_reversed",
"nativeSrc": "4509:248:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "4599:9:43",
"nodeType": "YulTypedName",
"src": "4599:9:43",
"type": ""
},
{
"name": "value1",
"nativeSrc": "4610:6:43",
"nodeType": "YulTypedName",
"src": "4610:6:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "4618:6:43",
"nodeType": "YulTypedName",
"src": "4618:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "4629:4:43",
"nodeType": "YulTypedName",
"src": "4629:4:43",
"type": ""
}
],
"src": "4509:248:43"
},
{
"body": {
"nativeSrc": "4891:171:43",
"nodeType": "YulBlock",
"src": "4891:171:43",
"statements": [
{
"nativeSrc": "4901:26:43",
"nodeType": "YulAssignment",
"src": "4901:26:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "4913:9:43",
"nodeType": "YulIdentifier",
"src": "4913:9:43"
},
{
"kind": "number",
"nativeSrc": "4924:2:43",
"nodeType": "YulLiteral",
"src": "4924:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nativeSrc": "4909:3:43",
"nodeType": "YulIdentifier",
"src": "4909:3:43"
},
"nativeSrc": "4909:18:43",
"nodeType": "YulFunctionCall",
"src": "4909:18:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "4901:4:43",
"nodeType": "YulIdentifier",
"src": "4901:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "4943:9:43",
"nodeType": "YulIdentifier",
"src": "4943:9:43"
},
{
"arguments": [
{
"name": "value0",
"nativeSrc": "4958:6:43",
"nodeType": "YulIdentifier",
"src": "4958:6:43"
},
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "4974:3:43",
"nodeType": "YulLiteral",
"src": "4974:3:43",
"type": "",
"value": "160"
},
{
"kind": "number",
"nativeSrc": "4979:1:43",
"nodeType": "YulLiteral",
"src": "4979:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "4970:3:43",
"nodeType": "YulIdentifier",
"src": "4970:3:43"
},
"nativeSrc": "4970:11:43",
"nodeType": "YulFunctionCall",
"src": "4970:11:43"
},
{
"kind": "number",
"nativeSrc": "4983:1:43",
"nodeType": "YulLiteral",
"src": "4983:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "4966:3:43",
"nodeType": "YulIdentifier",
"src": "4966:3:43"
},
"nativeSrc": "4966:19:43",
"nodeType": "YulFunctionCall",
"src": "4966:19:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "4954:3:43",
"nodeType": "YulIdentifier",
"src": "4954:3:43"
},
"nativeSrc": "4954:32:43",
"nodeType": "YulFunctionCall",
"src": "4954:32:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "4936:6:43",
"nodeType": "YulIdentifier",
"src": "4936:6:43"
},
"nativeSrc": "4936:51:43",
"nodeType": "YulFunctionCall",
"src": "4936:51:43"
},
"nativeSrc": "4936:51:43",
"nodeType": "YulExpressionStatement",
"src": "4936:51:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "5007:9:43",
"nodeType": "YulIdentifier",
"src": "5007:9:43"
},
{
"kind": "number",
"nativeSrc": "5018:2:43",
"nodeType": "YulLiteral",
"src": "5018:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "5003:3:43",
"nodeType": "YulIdentifier",
"src": "5003:3:43"
},
"nativeSrc": "5003:18:43",
"nodeType": "YulFunctionCall",
"src": "5003:18:43"
},
{
"arguments": [
{
"name": "value1",
"nativeSrc": "5027:6:43",
"nodeType": "YulIdentifier",
"src": "5027:6:43"
},
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "5043:3:43",
"nodeType": "YulLiteral",
"src": "5043:3:43",
"type": "",
"value": "160"
},
{
"kind": "number",
"nativeSrc": "5048:1:43",
"nodeType": "YulLiteral",
"src": "5048:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "5039:3:43",
"nodeType": "YulIdentifier",
"src": "5039:3:43"
},
"nativeSrc": "5039:11:43",
"nodeType": "YulFunctionCall",
"src": "5039:11:43"
},
{
"kind": "number",
"nativeSrc": "5052:1:43",
"nodeType": "YulLiteral",
"src": "5052:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "5035:3:43",
"nodeType": "YulIdentifier",
"src": "5035:3:43"
},
"nativeSrc": "5035:19:43",
"nodeType": "YulFunctionCall",
"src": "5035:19:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "5023:3:43",
"nodeType": "YulIdentifier",
"src": "5023:3:43"
},
"nativeSrc": "5023:32:43",
"nodeType": "YulFunctionCall",
"src": "5023:32:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "4996:6:43",
"nodeType": "YulIdentifier",
"src": "4996:6:43"
},
"nativeSrc": "4996:60:43",
"nodeType": "YulFunctionCall",
"src": "4996:60:43"
},
"nativeSrc": "4996:60:43",
"nodeType": "YulExpressionStatement",
"src": "4996:60:43"
}
]
},
"name": "abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed",
"nativeSrc": "4762:300:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "4852:9:43",
"nodeType": "YulTypedName",
"src": "4852:9:43",
"type": ""
},
{
"name": "value1",
"nativeSrc": "4863:6:43",
"nodeType": "YulTypedName",
"src": "4863:6:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "4871:6:43",
"nodeType": "YulTypedName",
"src": "4871:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "4882:4:43",
"nodeType": "YulTypedName",
"src": "4882:4:43",
"type": ""
}
],
"src": "4762:300:43"
},
{
"body": {
"nativeSrc": "5188:297:43",
"nodeType": "YulBlock",
"src": "5188:297:43",
"statements": [
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "5205:9:43",
"nodeType": "YulIdentifier",
"src": "5205:9:43"
},
{
"kind": "number",
"nativeSrc": "5216:2:43",
"nodeType": "YulLiteral",
"src": "5216:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "5198:6:43",
"nodeType": "YulIdentifier",
"src": "5198:6:43"
},
"nativeSrc": "5198:21:43",
"nodeType": "YulFunctionCall",
"src": "5198:21:43"
},
"nativeSrc": "5198:21:43",
"nodeType": "YulExpressionStatement",
"src": "5198:21:43"
},
{
"nativeSrc": "5228:27:43",
"nodeType": "YulVariableDeclaration",
"src": "5228:27:43",
"value": {
"arguments": [
{
"name": "value0",
"nativeSrc": "5248:6:43",
"nodeType": "YulIdentifier",
"src": "5248:6:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "5242:5:43",
"nodeType": "YulIdentifier",
"src": "5242:5:43"
},
"nativeSrc": "5242:13:43",
"nodeType": "YulFunctionCall",
"src": "5242:13:43"
},
"variables": [
{
"name": "length",
"nativeSrc": "5232:6:43",
"nodeType": "YulTypedName",
"src": "5232:6:43",
"type": ""
}
]
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "5275:9:43",
"nodeType": "YulIdentifier",
"src": "5275:9:43"
},
{
"kind": "number",
"nativeSrc": "5286:2:43",
"nodeType": "YulLiteral",
"src": "5286:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "5271:3:43",
"nodeType": "YulIdentifier",
"src": "5271:3:43"
},
"nativeSrc": "5271:18:43",
"nodeType": "YulFunctionCall",
"src": "5271:18:43"
},
{
"name": "length",
"nativeSrc": "5291:6:43",
"nodeType": "YulIdentifier",
"src": "5291:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "5264:6:43",
"nodeType": "YulIdentifier",
"src": "5264:6:43"
},
"nativeSrc": "5264:34:43",
"nodeType": "YulFunctionCall",
"src": "5264:34:43"
},
"nativeSrc": "5264:34:43",
"nodeType": "YulExpressionStatement",
"src": "5264:34:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "5317:9:43",
"nodeType": "YulIdentifier",
"src": "5317:9:43"
},
{
"kind": "number",
"nativeSrc": "5328:2:43",
"nodeType": "YulLiteral",
"src": "5328:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nativeSrc": "5313:3:43",
"nodeType": "YulIdentifier",
"src": "5313:3:43"
},
"nativeSrc": "5313:18:43",
"nodeType": "YulFunctionCall",
"src": "5313:18:43"
},
{
"arguments": [
{
"name": "value0",
"nativeSrc": "5337:6:43",
"nodeType": "YulIdentifier",
"src": "5337:6:43"
},
{
"kind": "number",
"nativeSrc": "5345:2:43",
"nodeType": "YulLiteral",
"src": "5345:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "5333:3:43",
"nodeType": "YulIdentifier",
"src": "5333:3:43"
},
"nativeSrc": "5333:15:43",
"nodeType": "YulFunctionCall",
"src": "5333:15:43"
},
{
"name": "length",
"nativeSrc": "5350:6:43",
"nodeType": "YulIdentifier",
"src": "5350:6:43"
}
],
"functionName": {
"name": "mcopy",
"nativeSrc": "5307:5:43",
"nodeType": "YulIdentifier",
"src": "5307:5:43"
},
"nativeSrc": "5307:50:43",
"nodeType": "YulFunctionCall",
"src": "5307:50:43"
},
"nativeSrc": "5307:50:43",
"nodeType": "YulExpressionStatement",
"src": "5307:50:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "5381:9:43",
"nodeType": "YulIdentifier",
"src": "5381:9:43"
},
{
"name": "length",
"nativeSrc": "5392:6:43",
"nodeType": "YulIdentifier",
"src": "5392:6:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "5377:3:43",
"nodeType": "YulIdentifier",
"src": "5377:3:43"
},
"nativeSrc": "5377:22:43",
"nodeType": "YulFunctionCall",
"src": "5377:22:43"
},
{
"kind": "number",
"nativeSrc": "5401:2:43",
"nodeType": "YulLiteral",
"src": "5401:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nativeSrc": "5373:3:43",
"nodeType": "YulIdentifier",
"src": "5373:3:43"
},
"nativeSrc": "5373:31:43",
"nodeType": "YulFunctionCall",
"src": "5373:31:43"
},
{
"kind": "number",
"nativeSrc": "5406:1:43",
"nodeType": "YulLiteral",
"src": "5406:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "5366:6:43",
"nodeType": "YulIdentifier",
"src": "5366:6:43"
},
"nativeSrc": "5366:42:43",
"nodeType": "YulFunctionCall",
"src": "5366:42:43"
},
"nativeSrc": "5366:42:43",
"nodeType": "YulExpressionStatement",
"src": "5366:42:43"
},
{
"nativeSrc": "5417:62:43",
"nodeType": "YulAssignment",
"src": "5417:62:43",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "5433:9:43",
"nodeType": "YulIdentifier",
"src": "5433:9:43"
},
{
"arguments": [
{
"arguments": [
{
"name": "length",
"nativeSrc": "5452:6:43",
"nodeType": "YulIdentifier",
"src": "5452:6:43"
},
{
"kind": "number",
"nativeSrc": "5460:2:43",
"nodeType": "YulLiteral",
"src": "5460:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "add",
"nativeSrc": "5448:3:43",
"nodeType": "YulIdentifier",
"src": "5448:3:43"
},
"nativeSrc": "5448:15:43",
"nodeType": "YulFunctionCall",
"src": "5448:15:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "5469:2:43",
"nodeType": "YulLiteral",
"src": "5469:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "not",
"nativeSrc": "5465:3:43",
"nodeType": "YulIdentifier",
"src": "5465:3:43"
},
"nativeSrc": "5465:7:43",
"nodeType": "YulFunctionCall",
"src": "5465:7:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "5444:3:43",
"nodeType": "YulIdentifier",
"src": "5444:3:43"
},
"nativeSrc": "5444:29:43",
"nodeType": "YulFunctionCall",
"src": "5444:29:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "5429:3:43",
"nodeType": "YulIdentifier",
"src": "5429:3:43"
},
"nativeSrc": "5429:45:43",
"nodeType": "YulFunctionCall",
"src": "5429:45:43"
},
{
"kind": "number",
"nativeSrc": "5476:2:43",
"nodeType": "YulLiteral",
"src": "5476:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nativeSrc": "5425:3:43",
"nodeType": "YulIdentifier",
"src": "5425:3:43"
},
"nativeSrc": "5425:54:43",
"nodeType": "YulFunctionCall",
"src": "5425:54:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "5417:4:43",
"nodeType": "YulIdentifier",
"src": "5417:4:43"
}
]
}
]
},
"name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed",
"nativeSrc": "5067:418:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "5157:9:43",
"nodeType": "YulTypedName",
"src": "5157:9:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "5168:6:43",
"nodeType": "YulTypedName",
"src": "5168:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "5179:4:43",
"nodeType": "YulTypedName",
"src": "5179:4:43",
"type": ""
}
],
"src": "5067:418:43"
},
{
"body": {
"nativeSrc": "5584:203:43",
"nodeType": "YulBlock",
"src": "5584:203:43",
"statements": [
{
"nativeSrc": "5594:26:43",
"nodeType": "YulVariableDeclaration",
"src": "5594:26:43",
"value": {
"arguments": [
{
"name": "array",
"nativeSrc": "5614:5:43",
"nodeType": "YulIdentifier",
"src": "5614:5:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "5608:5:43",
"nodeType": "YulIdentifier",
"src": "5608:5:43"
},
"nativeSrc": "5608:12:43",
"nodeType": "YulFunctionCall",
"src": "5608:12:43"
},
"variables": [
{
"name": "length",
"nativeSrc": "5598:6:43",
"nodeType": "YulTypedName",
"src": "5598:6:43",
"type": ""
}
]
},
{
"nativeSrc": "5629:32:43",
"nodeType": "YulAssignment",
"src": "5629:32:43",
"value": {
"arguments": [
{
"arguments": [
{
"name": "array",
"nativeSrc": "5648:5:43",
"nodeType": "YulIdentifier",
"src": "5648:5:43"
},
{
"kind": "number",
"nativeSrc": "5655:4:43",
"nodeType": "YulLiteral",
"src": "5655:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "5644:3:43",
"nodeType": "YulIdentifier",
"src": "5644:3:43"
},
"nativeSrc": "5644:16:43",
"nodeType": "YulFunctionCall",
"src": "5644:16:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "5638:5:43",
"nodeType": "YulIdentifier",
"src": "5638:5:43"
},
"nativeSrc": "5638:23:43",
"nodeType": "YulFunctionCall",
"src": "5638:23:43"
},
"variableNames": [
{
"name": "value",
"nativeSrc": "5629:5:43",
"nodeType": "YulIdentifier",
"src": "5629:5:43"
}
]
},
{
"body": {
"nativeSrc": "5698:83:43",
"nodeType": "YulBlock",
"src": "5698:83:43",
"statements": [
{
"nativeSrc": "5712:59:43",
"nodeType": "YulAssignment",
"src": "5712:59:43",
"value": {
"arguments": [
{
"name": "value",
"nativeSrc": "5725:5:43",
"nodeType": "YulIdentifier",
"src": "5725:5:43"
},
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "5740:1:43",
"nodeType": "YulLiteral",
"src": "5740:1:43",
"type": "",
"value": "3"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "5747:4:43",
"nodeType": "YulLiteral",
"src": "5747:4:43",
"type": "",
"value": "0x20"
},
{
"name": "length",
"nativeSrc": "5753:6:43",
"nodeType": "YulIdentifier",
"src": "5753:6:43"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "5743:3:43",
"nodeType": "YulIdentifier",
"src": "5743:3:43"
},
"nativeSrc": "5743:17:43",
"nodeType": "YulFunctionCall",
"src": "5743:17:43"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "5736:3:43",
"nodeType": "YulIdentifier",
"src": "5736:3:43"
},
"nativeSrc": "5736:25:43",
"nodeType": "YulFunctionCall",
"src": "5736:25:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "5767:1:43",
"nodeType": "YulLiteral",
"src": "5767:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "not",
"nativeSrc": "5763:3:43",
"nodeType": "YulIdentifier",
"src": "5763:3:43"
},
"nativeSrc": "5763:6:43",
"nodeType": "YulFunctionCall",
"src": "5763:6:43"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "5732:3:43",
"nodeType": "YulIdentifier",
"src": "5732:3:43"
},
"nativeSrc": "5732:38:43",
"nodeType": "YulFunctionCall",
"src": "5732:38:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "5721:3:43",
"nodeType": "YulIdentifier",
"src": "5721:3:43"
},
"nativeSrc": "5721:50:43",
"nodeType": "YulFunctionCall",
"src": "5721:50:43"
},
"variableNames": [
{
"name": "value",
"nativeSrc": "5712:5:43",
"nodeType": "YulIdentifier",
"src": "5712:5:43"
}
]
}
]
},
"condition": {
"arguments": [
{
"name": "length",
"nativeSrc": "5676:6:43",
"nodeType": "YulIdentifier",
"src": "5676:6:43"
},
{
"kind": "number",
"nativeSrc": "5684:4:43",
"nodeType": "YulLiteral",
"src": "5684:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "lt",
"nativeSrc": "5673:2:43",
"nodeType": "YulIdentifier",
"src": "5673:2:43"
},
"nativeSrc": "5673:16:43",
"nodeType": "YulFunctionCall",
"src": "5673:16:43"
},
"nativeSrc": "5670:111:43",
"nodeType": "YulIf",
"src": "5670:111:43"
}
]
},
"name": "convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32",
"nativeSrc": "5490:297:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "array",
"nativeSrc": "5564:5:43",
"nodeType": "YulTypedName",
"src": "5564:5:43",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nativeSrc": "5574:5:43",
"nodeType": "YulTypedName",
"src": "5574:5:43",
"type": ""
}
],
"src": "5490:297:43"
},
{
"body": {
"nativeSrc": "5872:204:43",
"nodeType": "YulBlock",
"src": "5872:204:43",
"statements": [
{
"body": {
"nativeSrc": "5918:16:43",
"nodeType": "YulBlock",
"src": "5918:16:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "5927:1:43",
"nodeType": "YulLiteral",
"src": "5927:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "5930:1:43",
"nodeType": "YulLiteral",
"src": "5930:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "5920:6:43",
"nodeType": "YulIdentifier",
"src": "5920:6:43"
},
"nativeSrc": "5920:12:43",
"nodeType": "YulFunctionCall",
"src": "5920:12:43"
},
"nativeSrc": "5920:12:43",
"nodeType": "YulExpressionStatement",
"src": "5920:12:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nativeSrc": "5893:7:43",
"nodeType": "YulIdentifier",
"src": "5893:7:43"
},
{
"name": "headStart",
"nativeSrc": "5902:9:43",
"nodeType": "YulIdentifier",
"src": "5902:9:43"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "5889:3:43",
"nodeType": "YulIdentifier",
"src": "5889:3:43"
},
"nativeSrc": "5889:23:43",
"nodeType": "YulFunctionCall",
"src": "5889:23:43"
},
{
"kind": "number",
"nativeSrc": "5914:2:43",
"nodeType": "YulLiteral",
"src": "5914:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nativeSrc": "5885:3:43",
"nodeType": "YulIdentifier",
"src": "5885:3:43"
},
"nativeSrc": "5885:32:43",
"nodeType": "YulFunctionCall",
"src": "5885:32:43"
},
"nativeSrc": "5882:52:43",
"nodeType": "YulIf",
"src": "5882:52:43"
},
{
"nativeSrc": "5943:29:43",
"nodeType": "YulVariableDeclaration",
"src": "5943:29:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "5962:9:43",
"nodeType": "YulIdentifier",
"src": "5962:9:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "5956:5:43",
"nodeType": "YulIdentifier",
"src": "5956:5:43"
},
"nativeSrc": "5956:16:43",
"nodeType": "YulFunctionCall",
"src": "5956:16:43"
},
"variables": [
{
"name": "value",
"nativeSrc": "5947:5:43",
"nodeType": "YulTypedName",
"src": "5947:5:43",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "6030:16:43",
"nodeType": "YulBlock",
"src": "6030:16:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "6039:1:43",
"nodeType": "YulLiteral",
"src": "6039:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "6042:1:43",
"nodeType": "YulLiteral",
"src": "6042:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "6032:6:43",
"nodeType": "YulIdentifier",
"src": "6032:6:43"
},
"nativeSrc": "6032:12:43",
"nodeType": "YulFunctionCall",
"src": "6032:12:43"
},
"nativeSrc": "6032:12:43",
"nodeType": "YulExpressionStatement",
"src": "6032:12:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nativeSrc": "5994:5:43",
"nodeType": "YulIdentifier",
"src": "5994:5:43"
},
{
"arguments": [
{
"name": "value",
"nativeSrc": "6005:5:43",
"nodeType": "YulIdentifier",
"src": "6005:5:43"
},
{
"kind": "number",
"nativeSrc": "6012:14:43",
"nodeType": "YulLiteral",
"src": "6012:14:43",
"type": "",
"value": "0xffffffffffff"
}
],
"functionName": {
"name": "and",
"nativeSrc": "6001:3:43",
"nodeType": "YulIdentifier",
"src": "6001:3:43"
},
"nativeSrc": "6001:26:43",
"nodeType": "YulFunctionCall",
"src": "6001:26:43"
}
],
"functionName": {
"name": "eq",
"nativeSrc": "5991:2:43",
"nodeType": "YulIdentifier",
"src": "5991:2:43"
},
"nativeSrc": "5991:37:43",
"nodeType": "YulFunctionCall",
"src": "5991:37:43"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "5984:6:43",
"nodeType": "YulIdentifier",
"src": "5984:6:43"
},
"nativeSrc": "5984:45:43",
"nodeType": "YulFunctionCall",
"src": "5984:45:43"
},
"nativeSrc": "5981:65:43",
"nodeType": "YulIf",
"src": "5981:65:43"
},
{
"nativeSrc": "6055:15:43",
"nodeType": "YulAssignment",
"src": "6055:15:43",
"value": {
"name": "value",
"nativeSrc": "6065:5:43",
"nodeType": "YulIdentifier",
"src": "6065:5:43"
},
"variableNames": [
{
"name": "value0",
"nativeSrc": "6055:6:43",
"nodeType": "YulIdentifier",
"src": "6055:6:43"
}
]
}
]
},
"name": "abi_decode_tuple_t_uint48_fromMemory",
"nativeSrc": "5792:284:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "5838:9:43",
"nodeType": "YulTypedName",
"src": "5838:9:43",
"type": ""
},
{
"name": "dataEnd",
"nativeSrc": "5849:7:43",
"nodeType": "YulTypedName",
"src": "5849:7:43",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nativeSrc": "5861:6:43",
"nodeType": "YulTypedName",
"src": "5861:6:43",
"type": ""
}
],
"src": "5792:284:43"
},
{
"body": {
"nativeSrc": "6218:130:43",
"nodeType": "YulBlock",
"src": "6218:130:43",
"statements": [
{
"nativeSrc": "6228:26:43",
"nodeType": "YulAssignment",
"src": "6228:26:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "6240:9:43",
"nodeType": "YulIdentifier",
"src": "6240:9:43"
},
{
"kind": "number",
"nativeSrc": "6251:2:43",
"nodeType": "YulLiteral",
"src": "6251:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nativeSrc": "6236:3:43",
"nodeType": "YulIdentifier",
"src": "6236:3:43"
},
"nativeSrc": "6236:18:43",
"nodeType": "YulFunctionCall",
"src": "6236:18:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "6228:4:43",
"nodeType": "YulIdentifier",
"src": "6228:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "6270:9:43",
"nodeType": "YulIdentifier",
"src": "6270:9:43"
},
{
"arguments": [
{
"name": "value0",
"nativeSrc": "6285:6:43",
"nodeType": "YulIdentifier",
"src": "6285:6:43"
},
{
"kind": "number",
"nativeSrc": "6293:4:43",
"nodeType": "YulLiteral",
"src": "6293:4:43",
"type": "",
"value": "0xff"
}
],
"functionName": {
"name": "and",
"nativeSrc": "6281:3:43",
"nodeType": "YulIdentifier",
"src": "6281:3:43"
},
"nativeSrc": "6281:17:43",
"nodeType": "YulFunctionCall",
"src": "6281:17:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "6263:6:43",
"nodeType": "YulIdentifier",
"src": "6263:6:43"
},
"nativeSrc": "6263:36:43",
"nodeType": "YulFunctionCall",
"src": "6263:36:43"
},
"nativeSrc": "6263:36:43",
"nodeType": "YulExpressionStatement",
"src": "6263:36:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "6319:9:43",
"nodeType": "YulIdentifier",
"src": "6319:9:43"
},
{
"kind": "number",
"nativeSrc": "6330:2:43",
"nodeType": "YulLiteral",
"src": "6330:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "6315:3:43",
"nodeType": "YulIdentifier",
"src": "6315:3:43"
},
"nativeSrc": "6315:18:43",
"nodeType": "YulFunctionCall",
"src": "6315:18:43"
},
{
"name": "value1",
"nativeSrc": "6335:6:43",
"nodeType": "YulIdentifier",
"src": "6335:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "6308:6:43",
"nodeType": "YulIdentifier",
"src": "6308:6:43"
},
"nativeSrc": "6308:34:43",
"nodeType": "YulFunctionCall",
"src": "6308:34:43"
},
"nativeSrc": "6308:34:43",
"nodeType": "YulExpressionStatement",
"src": "6308:34:43"
}
]
},
"name": "abi_encode_tuple_t_rational_208_by_1_t_uint256__to_t_uint8_t_uint256__fromStack_reversed",
"nativeSrc": "6081:267:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "6179:9:43",
"nodeType": "YulTypedName",
"src": "6179:9:43",
"type": ""
},
{
"name": "value1",
"nativeSrc": "6190:6:43",
"nodeType": "YulTypedName",
"src": "6190:6:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "6198:6:43",
"nodeType": "YulTypedName",
"src": "6198:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "6209:4:43",
"nodeType": "YulTypedName",
"src": "6209:4:43",
"type": ""
}
],
"src": "6081:267:43"
},
{
"body": {
"nativeSrc": "6402:176:43",
"nodeType": "YulBlock",
"src": "6402:176:43",
"statements": [
{
"nativeSrc": "6412:17:43",
"nodeType": "YulAssignment",
"src": "6412:17:43",
"value": {
"arguments": [
{
"name": "x",
"nativeSrc": "6424:1:43",
"nodeType": "YulIdentifier",
"src": "6424:1:43"
},
{
"name": "y",
"nativeSrc": "6427:1:43",
"nodeType": "YulIdentifier",
"src": "6427:1:43"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "6420:3:43",
"nodeType": "YulIdentifier",
"src": "6420:3:43"
},
"nativeSrc": "6420:9:43",
"nodeType": "YulFunctionCall",
"src": "6420:9:43"
},
"variableNames": [
{
"name": "diff",
"nativeSrc": "6412:4:43",
"nodeType": "YulIdentifier",
"src": "6412:4:43"
}
]
},
{
"body": {
"nativeSrc": "6461:111:43",
"nodeType": "YulBlock",
"src": "6461:111:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "6482:1:43",
"nodeType": "YulLiteral",
"src": "6482:1:43",
"type": "",
"value": "0"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "6489:3:43",
"nodeType": "YulLiteral",
"src": "6489:3:43",
"type": "",
"value": "224"
},
{
"kind": "number",
"nativeSrc": "6494:10:43",
"nodeType": "YulLiteral",
"src": "6494:10:43",
"type": "",
"value": "0x4e487b71"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "6485:3:43",
"nodeType": "YulIdentifier",
"src": "6485:3:43"
},
"nativeSrc": "6485:20:43",
"nodeType": "YulFunctionCall",
"src": "6485:20:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "6475:6:43",
"nodeType": "YulIdentifier",
"src": "6475:6:43"
},
"nativeSrc": "6475:31:43",
"nodeType": "YulFunctionCall",
"src": "6475:31:43"
},
"nativeSrc": "6475:31:43",
"nodeType": "YulExpressionStatement",
"src": "6475:31:43"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "6526:1:43",
"nodeType": "YulLiteral",
"src": "6526:1:43",
"type": "",
"value": "4"
},
{
"kind": "number",
"nativeSrc": "6529:4:43",
"nodeType": "YulLiteral",
"src": "6529:4:43",
"type": "",
"value": "0x11"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "6519:6:43",
"nodeType": "YulIdentifier",
"src": "6519:6:43"
},
"nativeSrc": "6519:15:43",
"nodeType": "YulFunctionCall",
"src": "6519:15:43"
},
"nativeSrc": "6519:15:43",
"nodeType": "YulExpressionStatement",
"src": "6519:15:43"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "6554:1:43",
"nodeType": "YulLiteral",
"src": "6554:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "6557:4:43",
"nodeType": "YulLiteral",
"src": "6557:4:43",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "6547:6:43",
"nodeType": "YulIdentifier",
"src": "6547:6:43"
},
"nativeSrc": "6547:15:43",
"nodeType": "YulFunctionCall",
"src": "6547:15:43"
},
"nativeSrc": "6547:15:43",
"nodeType": "YulExpressionStatement",
"src": "6547:15:43"
}
]
},
"condition": {
"arguments": [
{
"name": "diff",
"nativeSrc": "6444:4:43",
"nodeType": "YulIdentifier",
"src": "6444:4:43"
},
{
"name": "x",
"nativeSrc": "6450:1:43",
"nodeType": "YulIdentifier",
"src": "6450:1:43"
}
],
"functionName": {
"name": "gt",
"nativeSrc": "6441:2:43",
"nodeType": "YulIdentifier",
"src": "6441:2:43"
},
"nativeSrc": "6441:11:43",
"nodeType": "YulFunctionCall",
"src": "6441:11:43"
},
"nativeSrc": "6438:134:43",
"nodeType": "YulIf",
"src": "6438:134:43"
}
]
},
"name": "checked_sub_t_uint256",
"nativeSrc": "6353:225:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "x",
"nativeSrc": "6384:1:43",
"nodeType": "YulTypedName",
"src": "6384:1:43",
"type": ""
},
{
"name": "y",
"nativeSrc": "6387:1:43",
"nodeType": "YulTypedName",
"src": "6387:1:43",
"type": ""
}
],
"returnVariables": [
{
"name": "diff",
"nativeSrc": "6393:4:43",
"nodeType": "YulTypedName",
"src": "6393:4:43",
"type": ""
}
],
"src": "6353:225:43"
},
{
"body": {
"nativeSrc": "6719:130:43",
"nodeType": "YulBlock",
"src": "6719:130:43",
"statements": [
{
"nativeSrc": "6729:26:43",
"nodeType": "YulAssignment",
"src": "6729:26:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "6741:9:43",
"nodeType": "YulIdentifier",
"src": "6741:9:43"
},
{
"kind": "number",
"nativeSrc": "6752:2:43",
"nodeType": "YulLiteral",
"src": "6752:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nativeSrc": "6737:3:43",
"nodeType": "YulIdentifier",
"src": "6737:3:43"
},
"nativeSrc": "6737:18:43",
"nodeType": "YulFunctionCall",
"src": "6737:18:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "6729:4:43",
"nodeType": "YulIdentifier",
"src": "6729:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "6771:9:43",
"nodeType": "YulIdentifier",
"src": "6771:9:43"
},
{
"arguments": [
{
"name": "value0",
"nativeSrc": "6786:6:43",
"nodeType": "YulIdentifier",
"src": "6786:6:43"
},
{
"kind": "number",
"nativeSrc": "6794:4:43",
"nodeType": "YulLiteral",
"src": "6794:4:43",
"type": "",
"value": "0xff"
}
],
"functionName": {
"name": "and",
"nativeSrc": "6782:3:43",
"nodeType": "YulIdentifier",
"src": "6782:3:43"
},
"nativeSrc": "6782:17:43",
"nodeType": "YulFunctionCall",
"src": "6782:17:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "6764:6:43",
"nodeType": "YulIdentifier",
"src": "6764:6:43"
},
"nativeSrc": "6764:36:43",
"nodeType": "YulFunctionCall",
"src": "6764:36:43"
},
"nativeSrc": "6764:36:43",
"nodeType": "YulExpressionStatement",
"src": "6764:36:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "6820:9:43",
"nodeType": "YulIdentifier",
"src": "6820:9:43"
},
{
"kind": "number",
"nativeSrc": "6831:2:43",
"nodeType": "YulLiteral",
"src": "6831:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "6816:3:43",
"nodeType": "YulIdentifier",
"src": "6816:3:43"
},
"nativeSrc": "6816:18:43",
"nodeType": "YulFunctionCall",
"src": "6816:18:43"
},
{
"name": "value1",
"nativeSrc": "6836:6:43",
"nodeType": "YulIdentifier",
"src": "6836:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "6809:6:43",
"nodeType": "YulIdentifier",
"src": "6809:6:43"
},
"nativeSrc": "6809:34:43",
"nodeType": "YulFunctionCall",
"src": "6809:34:43"
},
"nativeSrc": "6809:34:43",
"nodeType": "YulExpressionStatement",
"src": "6809:34:43"
}
]
},
"name": "abi_encode_tuple_t_rational_48_by_1_t_uint256__to_t_uint8_t_uint256__fromStack_reversed",
"nativeSrc": "6583:266:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "6680:9:43",
"nodeType": "YulTypedName",
"src": "6680:9:43",
"type": ""
},
{
"name": "value1",
"nativeSrc": "6691:6:43",
"nodeType": "YulTypedName",
"src": "6691:6:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "6699:6:43",
"nodeType": "YulTypedName",
"src": "6699:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "6710:4:43",
"nodeType": "YulTypedName",
"src": "6710:4:43",
"type": ""
}
],
"src": "6583:266:43"
}
]
},
"contents": "{\n { }\n function validator_revert_contract_IVotes(value)\n {\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(0, 0) }\n }\n function abi_decode_tuple_t_contract$_IVotes_$4875t_contract$_TimelockController_$3728_fromMemory(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(0, 0) }\n let value := mload(headStart)\n validator_revert_contract_IVotes(value)\n value0 := value\n let value_1 := mload(add(headStart, 32))\n validator_revert_contract_IVotes(value_1)\n value1 := value_1\n }\n function panic_error_0x41()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n function array_dataslot_string_storage(ptr) -> data\n {\n mstore(0, ptr)\n data := keccak256(0, 0x20)\n }\n function clean_up_bytearray_end_slots_string_storage(array, len, startIndex)\n {\n if gt(len, 31)\n {\n mstore(0, array)\n let data := keccak256(0, 0x20)\n let deleteStart := add(data, shr(5, add(startIndex, 31)))\n if lt(startIndex, 0x20) { deleteStart := data }\n let _1 := add(data, shr(5, add(len, 31)))\n let start := deleteStart\n for { } lt(start, _1) { start := add(start, 1) }\n { sstore(start, 0) }\n }\n }\n function extract_used_part_and_set_length_of_short_byte_array(data, len) -> used\n {\n used := or(and(data, not(shr(shl(3, len), not(0)))), shl(1, len))\n }\n function copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage(slot, src)\n {\n let newLen := mload(src)\n if gt(newLen, sub(shl(64, 1), 1)) { panic_error_0x41() }\n clean_up_bytearray_end_slots_string_storage(slot, extract_byte_array_length(sload(slot)), newLen)\n let srcOffset := 0\n srcOffset := 0x20\n switch gt(newLen, 31)\n case 1 {\n let loopEnd := and(newLen, not(31))\n let dstPtr := array_dataslot_string_storage(slot)\n let i := 0\n for { } lt(i, loopEnd) { i := add(i, 0x20) }\n {\n sstore(dstPtr, mload(add(src, srcOffset)))\n dstPtr := add(dstPtr, 1)\n srcOffset := add(srcOffset, 0x20)\n }\n if lt(loopEnd, newLen)\n {\n let lastValue := mload(add(src, srcOffset))\n sstore(dstPtr, and(lastValue, not(shr(and(shl(3, newLen), 248), not(0)))))\n }\n sstore(slot, add(shl(1, newLen), 1))\n }\n default {\n let value := 0\n if newLen\n {\n value := mload(add(src, srcOffset))\n }\n sstore(slot, extract_used_part_and_set_length_of_short_byte_array(value, newLen))\n }\n }\n function abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed(headStart, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 160)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_uint48_t_uint48__to_t_uint256_t_uint256__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, and(value0, 0xffffffffffff))\n mstore(add(headStart, 32), and(value1, 0xffffffffffff))\n }\n function abi_encode_tuple_t_rational_0_by_1__to_t_uint256__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function abi_encode_tuple_t_uint32_t_uint32__to_t_uint256_t_uint256__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, and(value0, 0xffffffff))\n mstore(add(headStart, 32), and(value1, 0xffffffff))\n }\n function abi_encode_tuple_t_uint256_t_uint256__to_t_uint256_t_uint256__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n }\n function abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart, value0) -> tail\n {\n mstore(headStart, 32)\n let length := mload(value0)\n mstore(add(headStart, 32), length)\n mcopy(add(headStart, 64), add(value0, 32), length)\n mstore(add(add(headStart, length), 64), 0)\n tail := add(add(headStart, and(add(length, 31), not(31))), 64)\n }\n function convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32(array) -> value\n {\n let length := mload(array)\n value := mload(add(array, 0x20))\n if lt(length, 0x20)\n {\n value := and(value, shl(shl(3, sub(0x20, length)), not(0)))\n }\n }\n function abi_decode_tuple_t_uint48_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let value := mload(headStart)\n if iszero(eq(value, and(value, 0xffffffffffff))) { revert(0, 0) }\n value0 := value\n }\n function abi_encode_tuple_t_rational_208_by_1_t_uint256__to_t_uint8_t_uint256__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, and(value0, 0xff))\n mstore(add(headStart, 32), value1)\n }\n function checked_sub_t_uint256(x, y) -> diff\n {\n diff := sub(x, y)\n if gt(diff, x)\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n }\n function abi_encode_tuple_t_rational_48_by_1_t_uint256__to_t_uint8_t_uint256__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, and(value0, 0xff))\n mstore(add(headStart, 32), value1)\n }\n}",
"id": 43,
"language": "Yul",
"name": "#utility.yul"
}
],
"linkReferences": {},
"object": "610180604052348015610010575f5ffd5b50604051614d6a380380614d6a83398101604081905261002f9161071d565b80600483611c2061c4e05f6040518060400160405280600a81526020016926bca3b7bb32b93737b960b11b8152508061006c61016f60201b60201c565b610076825f61018a565b6101205261008581600161018a565b61014052815160208084019190912060e052815190820120610100524660a05261011160e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c052600361012682826107ed565b506101329050836101bc565b61013b82610222565b610144816102c6565b5050506001600160a01b03166101605261015d81610307565b506101678161039c565b505050610943565b6040805180820190915260018152603160f81b602082015290565b5f6020835110156101a55761019e83610405565b90506101b6565b816101b084826107ed565b5060ff90505b92915050565b6008546040805165ffffffffffff928316815291831660208301527fc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a93910160405180910390a16008805465ffffffffffff191665ffffffffffff92909216919091179055565b8063ffffffff165f0361024f5760405163f1cfbf0560e01b81525f60048201526024015b60405180910390fd5b6008546040805163ffffffff66010000000000009093048316815291831660208301527f7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e8828910160405180910390a16008805463ffffffff90921666010000000000000263ffffffff60301b19909216919091179055565b60075460408051918252602082018390527fccb45da8d5717e6c4544694297c4ba5cf151d455c9bb0ed4fc7a38411bc05461910160405180910390a1600755565b6064808211156103345760405163243e544560e01b81526004810183905260248101829052604401610246565b5f61033d610442565b905061035c61034a61045b565b610353856104d5565b600a919061050c565b505060408051828152602081018590527f0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b4633997910160405180910390a1505050565b600b54604080516001600160a01b03928316815291831660208301527f08f74ea46ef7894f65eabfb5e6e695de773a000b47c529ab559178069b226401910160405180910390a1600b80546001600160a01b0319166001600160a01b0392909216919091179055565b5f5f829050601f8151111561042f578260405163305a27a960e01b815260040161024691906108a7565b805161043a826108dc565b179392505050565b5f61044d600a610526565b6001600160d01b0316905090565b5f6104666101605190565b6001600160a01b03166391ddadf46040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156104bf575060408051601f3d908101601f191682019092526104bc918101906108ff565b60015b6104d0576104cb61056e565b905090565b919050565b5f6001600160d01b03821115610508576040516306dfcc6560e41b815260d0600482015260248101839052604401610246565b5090565b5f80610519858585610578565b915091505b935093915050565b80545f9080156105655761054c8361053f600184610924565b5f91825260209091200190565b54660100000000000090046001600160d01b0316610567565b5f5b9392505050565b5f6104cb436106d4565b82545f9081908015610677575f6105948761053f600185610924565b805490915065ffffffffffff80821691660100000000000090046001600160d01b03169088168211156105da57604051632520601d60e01b815260040160405180910390fd5b8765ffffffffffff168265ffffffffffff160361061657825465ffffffffffff1666010000000000006001600160d01b03891602178355610669565b6040805180820190915265ffffffffffff808a1682526001600160d01b03808a1660208085019182528d54600181018f555f8f815291909120945191519092166601000000000000029216919091179101555b945085935061051e92505050565b50506040805180820190915265ffffffffffff80851682526001600160d01b0380851660208085019182528854600181018a555f8a815291822095519251909316660100000000000002919093161792019190915590508161051e565b5f65ffffffffffff821115610508576040516306dfcc6560e41b81526030600482015260248101839052604401610246565b6001600160a01b038116811461071a575f5ffd5b50565b5f5f6040838503121561072e575f5ffd5b825161073981610706565b602084015190925061074a81610706565b809150509250929050565b634e487b7160e01b5f52604160045260245ffd5b600181811c9082168061077d57607f821691505b60208210810361079b57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156107e857805f5260205f20601f840160051c810160208510156107c65750805b601f840160051c820191505b818110156107e5575f81556001016107d2565b50505b505050565b81516001600160401b0381111561080657610806610755565b61081a816108148454610769565b846107a1565b6020601f82116001811461084c575f83156108355750848201515b5f19600385901b1c1916600184901b1784556107e5565b5f84815260208120601f198516915b8281101561087b578785015182556020948501946001909201910161085b565b508482101561089857868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b8051602080830151919081101561079b575f1960209190910360031b1b16919050565b5f6020828403121561090f575f5ffd5b815165ffffffffffff81168114610567575f5ffd5b818103818111156101b657634e487b7160e01b5f52601160045260245ffd5b60805160a05160c05160e051610100516101205161014051610160516143b06109ba5f395f81816109c901528181610e1f015281816111ec015281816114b10152611eba01525f611dfe01525f611dd201525f612df001525f612dc801525f612d2301525f612d4d01525f612d7701526143b05ff3fe6080604052600436106102a8575f3560e01c80637ecebe001161016f578063bc197c81116100d8578063deaaa7cc11610092578063ece40cc11161006d578063ece40cc11461095e578063f23a6e611461097d578063f8ce560a1461099c578063fc0c546a146109bb575f5ffd5b8063deaaa7cc146108ed578063e540d01d14610920578063eb9019d41461093f575f5ffd5b8063bc197c811461081b578063c01f9e371461083a578063c28bc2fa14610859578063c59057e41461086c578063d33219b41461088b578063dd4e2ba5146108a8575f5ffd5b8063a7713a7011610129578063a7713a7014610760578063a890c91014610774578063a8f8a66814610793578063a9a95294146107b2578063ab58fb8e146107d1578063b58131b014610807575f5ffd5b80637ecebe001461068957806384b0196e146106bd5780638ff262e3146106e457806391ddadf41461070357806397c3d3341461072e5780639a802a6d14610741575f5ffd5b806343859632116102115780635b8d0e0d116101cb5780635b8d0e0d146105cf5780635f398a14146105ee57806360c4247f1461060d578063790518871461062c5780637b3c71d31461064b5780637d5e81e21461066a575f5ffd5b806343859632146104d2578063452115d61461051a5780634bf5d7e914610539578063544ffc9c1461054d57806354fd4d501461058757806356781388146105b0575f5ffd5b8063160cbed711610262578063160cbed7146104065780632656227d146104255780632d63f693146104385780632fe3e261146104575780633932abb11461048a5780633e4f49e6146104a6575f5ffd5b806301ffc9a7146102e357806302a251a31461031757806306f3f9e61461034257806306fdde0314610361578063143489d014610382578063150b7a02146103ce575f5ffd5b366102df57306102b66109ed565b6001600160a01b0316146102dd57604051637485328f60e11b815260040160405180910390fd5b005b5f5ffd5b3480156102ee575f5ffd5b506103026102fd366004613395565b610a05565b60405190151581526020015b60405180910390f35b348015610322575f5ffd5b50600854600160301b900463ffffffff165b60405190815260200161030e565b34801561034d575f5ffd5b506102dd61035c3660046133bc565b610a71565b34801561036c575f5ffd5b50610375610a85565b60405161030e9190613401565b34801561038d575f5ffd5b506103b661039c3660046133bc565b5f908152600460205260409020546001600160a01b031690565b6040516001600160a01b03909116815260200161030e565b3480156103d9575f5ffd5b506103ed6103e83660046134ea565b610b15565b6040516001600160e01b0319909116815260200161030e565b348015610411575f5ffd5b506103346104203660046136b0565b610b57565b6103346104333660046136b0565b610c23565b348015610443575f5ffd5b506103346104523660046133bc565b610d8b565b348015610462575f5ffd5b506103347f3e83946653575f9a39005e1545185629e92736b7528ab20ca3816f315424a81181565b348015610495575f5ffd5b5060085465ffffffffffff16610334565b3480156104b1575f5ffd5b506104c56104c03660046133bc565b610dab565b60405161030e9190613777565b3480156104dd575f5ffd5b506103026104ec366004613785565b5f8281526009602090815260408083206001600160a01b038516845260030190915290205460ff1692915050565b348015610525575f5ffd5b506103346105343660046136b0565b610db5565b348015610544575f5ffd5b50610375610e1b565b348015610558575f5ffd5b5061056c6105673660046133bc565b610edb565b6040805193845260208401929092529082015260600161030e565b348015610592575f5ffd5b506040805180820190915260018152603160f81b6020820152610375565b3480156105bb575f5ffd5b506103346105ca3660046137c3565b610f00565b3480156105da575f5ffd5b506103346105e9366004613831565b610f27565b3480156105f9575f5ffd5b506103346106083660046138ed565b610fe4565b348015610618575f5ffd5b506103346106273660046133bc565b61102c565b348015610637575f5ffd5b506102dd610646366004613981565b611038565b348015610656575f5ffd5b5061033461066536600461399c565b611049565b348015610675575f5ffd5b506103346106843660046139f1565b611099565b348015610694575f5ffd5b506103346106a3366004613aad565b6001600160a01b03165f9081526002602052604090205490565b3480156106c8575f5ffd5b506106d161114f565b60405161030e9796959493929190613b02565b3480156106ef575f5ffd5b506103346106fe366004613b71565b611191565b34801561070e575f5ffd5b506107176111e9565b60405165ffffffffffff909116815260200161030e565b348015610739575f5ffd5b506064610334565b34801561074c575f5ffd5b5061033461075b366004613bbe565b611270565b34801561076b575f5ffd5b50610334611286565b34801561077f575f5ffd5b506102dd61078e366004613aad565b61129f565b34801561079e575f5ffd5b506103346107ad3660046136b0565b6112b0565b3480156107bd575f5ffd5b506103026107cc3660046133bc565b6112bd565b3480156107dc575f5ffd5b506103346107eb3660046133bc565b5f9081526004602052604090206001015465ffffffffffff1690565b348015610812575f5ffd5b506103346112c5565b348015610826575f5ffd5b506103ed610835366004613c12565b6112cf565b348015610845575f5ffd5b506103346108543660046133bc565b611312565b6102dd610867366004613ca9565b611354565b348015610877575f5ffd5b506103346108863660046136b0565b6113d0565b348015610896575f5ffd5b50600b546001600160a01b03166103b6565b3480156108b3575f5ffd5b506040805180820190915260208082527f737570706f72743d627261766f2671756f72756d3d666f722c6162737461696e90820152610375565b3480156108f8575f5ffd5b506103347ff2aad550cf55f045cb27e9c559f9889fdfb6e6cdaa032301d6ea397784ae51d781565b34801561092b575f5ffd5b506102dd61093a366004613ce8565b611409565b34801561094a575f5ffd5b50610334610959366004613d0b565b61141a565b348015610969575f5ffd5b506102dd6109783660046133bc565b611439565b348015610988575f5ffd5b506103ed610997366004613d35565b61144a565b3480156109a7575f5ffd5b506103346109b63660046133bc565b61148d565b3480156109c6575f5ffd5b507f00000000000000000000000000000000000000000000000000000000000000006103b6565b5f610a00600b546001600160a01b031690565b905090565b5f6001600160e01b031982166366defe7760e11b1480610a3557506001600160e01b031982166332a2ad4360e11b145b80610a5057506001600160e01b03198216630271189760e51b145b80610a6b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b610a7961152a565b610a82816115a3565b50565b606060038054610a9490613d8c565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac090613d8c565b8015610b0b5780601f10610ae257610100808354040283529160200191610b0b565b820191905f5260205f20905b815481529060010190602001808311610aee57829003601f168201915b5050505050905090565b5f30610b1f6109ed565b6001600160a01b031614610b4657604051637485328f60e11b815260040160405180910390fd5b50630a85bd0160e11b949350505050565b5f5f610b65868686866112b0565b9050610b7a81610b756004611638565b61165a565b505f610b898288888888611697565b905065ffffffffffff811615610c00575f82815260046020908152604091829020600101805465ffffffffffff191665ffffffffffff85169081179091558251858152918201527f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda2892910160405180910390a1610c19565b604051634844252360e11b815260040160405180910390fd5b5095945050505050565b5f5f610c31868686866112b0565b9050610c5181610c416005611638565b610c4b6004611638565b1761165a565b505f818152600460205260409020805460ff60f01b1916600160f01b17905530610c796109ed565b6001600160a01b031614610d02575f5b8651811015610d0057306001600160a01b0316878281518110610cae57610cae613dc4565b60200260200101516001600160a01b031603610cf857610cf8858281518110610cd957610cd9613dc4565b60200260200101518051906020012060056116a590919063ffffffff16565b600101610c89565b505b610d0f8187878787611706565b30610d186109ed565b6001600160a01b031614158015610d4457506005546001600160801b03808216600160801b9092041614155b15610d4e575f6005555b6040518181527f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f906020015b60405180910390a195945050505050565b5f90815260046020526040902054600160a01b900465ffffffffffff1690565b5f610a6b8261171a565b5f5f610dc3868686866112b0565b905033610dd08282611853565b610e0457604051638fe5d8a960e01b8152600481018390526001600160a01b03821660248201526044015b60405180910390fd5b610e1087878787611898565b979650505050505050565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634bf5d7e96040518163ffffffff1660e01b81526004015f60405180830381865afa925050508015610e9a57506040513d5f823e601f3d908101601f19168201604052610e979190810190613dd8565b60015b610ed6575060408051808201909152601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c74000000602082015290565b919050565b5f818152600960205260409020805460018201546002909201549091905b9193909250565b5f80339050610f1f84828560405180602001604052805f8152506118a5565b949350505050565b5f610f6d88888888888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152508a92508991506118c69050565b610f95576040516394ab6c0760e01b81526001600160a01b0387166004820152602401610dfb565b610fd888878988888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152508a9250611993915050565b98975050505050505050565b5f80339050610e1087828888888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152508a9250611993915050565b5f610a6b600a83611a71565b61104061152a565b610a8281611abe565b5f8033905061108f86828787878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506118a592505050565b9695505050505050565b5f336110a58184611b24565b6110cd5760405163d9b3955760e01b81526001600160a01b0382166004820152602401610dfb565b5f6110d66112c5565b90508015611142575f6111048360016110ed6111e9565b6110f79190613e60565b65ffffffffffff1661141a565b90508181101561114057604051636121770b60e11b81526001600160a01b03841660048201526024810182905260448101839052606401610dfb565b505b610e108787878786611ba8565b5f6060805f5f5f6060611160611dcb565b611168611df7565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b5f61119e85858585611e24565b6111c6576040516394ab6c0760e01b81526001600160a01b0384166004820152602401610dfb565b6111e085848660405180602001604052805f8152506118a5565b95945050505050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166391ddadf46040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611264575060408051601f3d908101601f1916820190925261126191810190613e7e565b60015b610ed657610a00611ead565b5f61127c848484611eb7565b90505b9392505050565b5f611291600a611f4a565b6001600160d01b0316905090565b6112a761152a565b610a8281611f8e565b5f6111e0858585856113d0565b5f6001610a6b565b5f610a0060075490565b5f306112d96109ed565b6001600160a01b03161461130057604051637485328f60e11b815260040160405180910390fd5b5063bc197c8160e01b95945050505050565b5f8181526004602052604081205461134690600160d01b810463ffffffff1690600160a01b900465ffffffffffff16613e99565b65ffffffffffff1692915050565b61135c61152a565b5f5f856001600160a01b0316858585604051611379929190613eb7565b5f6040518083038185875af1925050503d805f81146113b3576040519150601f19603f3d011682016040523d82523d5f602084013e6113b8565b606091505b50915091506113c78282611ff7565b50505050505050565b5f848484846040516020016113e89493929190613f59565b60408051601f19818403018152919052805160209091012095945050505050565b61141161152a565b610a8281612013565b5f61127f838361143460408051602081019091525f815290565b611eb7565b61144161152a565b610a82816120af565b5f306114546109ed565b6001600160a01b03161461147b57604051637485328f60e11b815260040160405180910390fd5b5063f23a6e6160e01b95945050505050565b604051632394e7a360e21b8152600481018290525f90610a6b906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690638e539e8c90602401602060405180830381865afa1580156114f6573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061151a9190613fa3565b6115238461102c565b60646120f0565b336115336109ed565b6001600160a01b03161461155c576040516347096e4760e01b8152336004820152602401610dfb565b306115656109ed565b6001600160a01b0316146115a1575f8036604051611584929190613eb7565b604051809103902090505b8061159a60056121a0565b0361158f57505b565b6064808211156115d05760405163243e544560e01b81526004810183905260248101829052604401610dfb565b5f6115d9611286565b90506115f86115e66111e9565b6115ef8561220d565b600a9190612244565b505060408051828152602081018590527f0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b4633997910160405180910390a1505050565b5f81600781111561164b5761164b613743565b600160ff919091161b92915050565b5f5f61166584610dab565b90505f8361167283611638565b160361127f578381846040516331b75e4d60e01b8152600401610dfb93929190613fba565b5f61108f868686868661225e565b81546001600160801b03600160801b8204811691811660018301909116036116d1576116d160416123ef565b6001600160801b038082165f90815260018086016020526040909120939093558354919092018216600160801b029116179055565b6117138585858585612400565b5050505050565b5f5f61172583612490565b9050600581600781111561173b5761173b613743565b146117465792915050565b5f838152600c60205260409081902054600b549151632c258a9f60e11b81526004810182905290916001600160a01b03169063584b153e90602401602060405180830381865afa15801561179c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117c09190613fdc565b156117cf575060059392505050565b600b54604051632ab0f52960e01b8152600481018390526001600160a01b0390911690632ab0f52990602401602060405180830381865afa158015611816573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061183a9190613fdc565b15611849575060079392505050565b5060029392505050565b5f8061185e84610dab565b600781111561186f5761186f613743565b14801561127f5750505f91825260046020526040909120546001600160a01b0391821691161490565b5f6111e0858585856125c1565b5f6111e0858585856118c160408051602081019091525f815290565b611993565b5f610e108561198d7f3e83946653575f9a39005e1545185629e92736b7528ab20ca3816f315424a8118a8a8a6119188c6001600160a01b03165f90815260026020526040902080546001810190915590565b8b516020808e01919091208c518d83012060405161197298979695949301968752602087019590955260ff9390931660408601526001600160a01b03919091166060850152608084015260a083015260c082015260e00190565b60405160208183030381529060405280519060200120612658565b84612684565b5f6119a286610b756001611638565b505f6119b7866119b189610d8b565b85611eb7565b90505f6119c788888885886126f4565b905083515f03611a1d57866001600160a01b03167fb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda489888489604051611a109493929190613ffb565b60405180910390a2610e10565b866001600160a01b03167fe2babfbac5889a709b63bb7f598b324e08bc5a4fb9ec647fb3cbc9ec07eb87128988848989604051611a5e959493929190614022565b60405180910390a2979650505050505050565b5f5f5f611a7d856127f0565b9250925050838265ffffffffffff161115611aaa57611aa5611a9e85612848565b869061287a565b611aac565b805b6001600160d01b031695945050505050565b6008546040805165ffffffffffff928316815291831660208301527fc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a93910160405180910390a16008805465ffffffffffff191665ffffffffffff92909216919091179055565b80515f906034811015611b3b576001915050610a6b565b60131981840101516001600160b01b03198116692370726f706f7365723d60b01b14611b6c57600192505050610a6b565b5f5f611b7c86602a86038661291c565b91509150811580610e105750866001600160a01b0316816001600160a01b031614979650505050505050565b5f611bbc86868686805190602001206112b0565b905084518651141580611bd157508351865114155b80611bdb57508551155b15611c1057855184518651604051630447b05d60e41b8152600481019390935260248301919091526044820152606401610dfb565b5f81815260046020526040902054600160a01b900465ffffffffffff1615611c595780611c3c82610dab565b6040516331b75e4d60e01b8152610dfb9291905f90600401613fba565b5f611c6b60085465ffffffffffff1690565b611c736111e9565b65ffffffffffff16611c85919061405b565b90505f611c9f60085463ffffffff600160301b9091041690565b5f84815260046020526040902080546001600160a01b0319166001600160a01b038716178155909150611cd183612848565b815465ffffffffffff91909116600160a01b0265ffffffffffff60a01b19909116178155611cfe826129c5565b815463ffffffff91909116600160d01b0263ffffffff60d01b1990911617815588517f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e090859087908c908c906001600160401b03811115611d6157611d61613427565b604051908082528060200260200182016040528015611d9457816020015b6060815260200190600190039081611d7f5790505b508c89611da18a8261405b565b8e604051611db79998979695949392919061406e565b60405180910390a150505095945050505050565b6060610a007f00000000000000000000000000000000000000000000000000000000000000005f6129f5565b6060610a007f000000000000000000000000000000000000000000000000000000000000000060016129f5565b5f6111e08361198d7ff2aad550cf55f045cb27e9c559f9889fdfb6e6cdaa032301d6ea397784ae51d7888888611e768a6001600160a01b03165f90815260026020526040902080546001810190915590565b60408051602081019690965285019390935260ff90911660608401526001600160a01b0316608083015260a082015260c001611972565b5f610a0043612848565b5f7f0000000000000000000000000000000000000000000000000000000000000000604051630748d63560e31b81526001600160a01b038681166004830152602482018690529190911690633a46b1a890604401602060405180830381865afa158015611f26573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061127c9190613fa3565b80545f908015611f8657611f7083611f63600184614149565b5f91825260209091200190565b54600160301b90046001600160d01b031661127f565b5f9392505050565b600b54604080516001600160a01b03928316815291831660208301527f08f74ea46ef7894f65eabfb5e6e695de773a000b47c529ab559178069b226401910160405180910390a1600b80546001600160a01b0319166001600160a01b0392909216919091179055565b60608261200c5761200782612a9e565b610a6b565b5080610a6b565b8063ffffffff165f0361203b5760405163f1cfbf0560e01b81525f6004820152602401610dfb565b6008546040805163ffffffff600160301b9093048316815291831660208301527f7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e8828910160405180910390a16008805463ffffffff909216600160301b0269ffffffff00000000000019909216919091179055565b60075460408051918252602082018390527fccb45da8d5717e6c4544694297c4ba5cf151d455c9bb0ed4fc7a38411bc05461910160405180910390a1600755565b5f5f5f6120fd8686612ac6565b91509150815f03612121578381816121175761211761415c565b049250505061127f565b8184116121385761213860038515026011186123ef565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010185841190960395909502919093039390930492909217029150509392505050565b80545f906001600160801b0380821691600160801b90041681036121c8576121c860316123ef565b6001600160801b038181165f908152600185810160205260408220805492905585546fffffffffffffffffffffffffffffffff19169301909116919091179092555090565b5f6001600160d01b03821115612240576040516306dfcc6560e41b815260d0600482015260248101839052604401610dfb565b5090565b5f80612251858585612ae2565b915091505b935093915050565b5f5f600b5f9054906101000a90046001600160a01b03166001600160a01b031663f27a0c926040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122b0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122d49190613fa3565b90505f3060601b6bffffffffffffffffffffffff19168418600b5460405163b1c5f42760e01b81529192506001600160a01b03169063b1c5f42790612325908a908a908a905f908890600401614170565b602060405180830381865afa158015612340573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123649190613fa3565b5f898152600c602052604080822092909255600b5491516308f2a0bb60e41b81526001600160a01b0390921691638f2a0bb0916123ae918b918b918b919088908a906004016141bd565b5f604051808303815f87803b1580156123c5575f5ffd5b505af11580156123d7573d5f5f3e3d5ffd5b50505050610fd882426123ea919061405b565b612848565b634e487b715f52806020526024601cfd5b600b546001600160a01b031663e38335e5348686865f3060601b6bffffffffffffffffffffffff191688186040518763ffffffff1660e01b815260040161244b959493929190614170565b5f604051808303818588803b158015612462575f5ffd5b505af1158015612474573d5f5f3e3d5ffd5b5050505f9687525050600c602052505060408320929092555050565b5f818152600460205260408120805460ff600160f01b8204811691600160f81b90041681156124c457506007949350505050565b80156124d557506002949350505050565b5f6124df86610d8b565b9050805f0361250457604051636ad0607560e01b815260048101879052602401610dfb565b5f61250d6111e9565b65ffffffffffff16905080821061252a57505f9695505050505050565b5f61253488611312565b905081811061254b57506001979650505050505050565b61255488612c32565b158061257357505f888152600960205260409020805460019091015411155b1561258657506003979650505050505050565b5f8881526004602052604090206001015465ffffffffffff165f036125b357506004979650505050505050565b506005979650505050505050565b5f5f6125cf86868686612c68565b5f818152600c60205260409020549091508015610c1957600b5460405163c4d252f560e01b8152600481018390526001600160a01b039091169063c4d252f5906024015f604051808303815f87803b158015612629575f5ffd5b505af115801561263b573d5f5f3e3d5ffd5b5050505f838152600c602052604081205550509050949350505050565b5f610a6b612664612d17565b8360405161190160f01b8152600281019290925260228201526042902090565b5f836001600160a01b03163b5f036126e2575f5f6126a28585612e40565b5090925090505f8160038111156126bb576126bb613743565b1480156126d95750856001600160a01b0316826001600160a01b0316145b9250505061127f565b6126ed848484612e89565b905061127f565b5f8581526009602090815260408083206001600160a01b03881684526003810190925282205460ff1615612746576040516371c6af4960e01b81526001600160a01b0387166004820152602401610dfb565b6001600160a01b0386165f9081526003820160205260409020805460ff1916600117905560ff851661278f5783815f015f828254612784919061405b565b909155506127e59050565b5f1960ff8616016127ad5783816001015f828254612784919061405b565b60011960ff8616016127cc5783816002015f828254612784919061405b565b6040516303599be160e11b815260040160405180910390fd5b509195945050505050565b80545f908190819080820361280e575f5f5f93509350935050610ef9565b5f61281e86611f63600185614149565b546001955065ffffffffffff81169450600160301b90046001600160d01b03169250610ef9915050565b5f65ffffffffffff821115612240576040516306dfcc6560e41b81526030600482015260248101839052604401610dfb565b81545f90818160058111156128d6575f61289384612f5f565b61289d9085614149565b5f8881526020902090915081015465ffffffffffff90811690871610156128c6578091506128d4565b6128d181600161405b565b92505b505b5f6128e3878785856130b7565b90508015612910576128fa87611f63600184614149565b54600160301b90046001600160d01b0316610e10565b505f9695505050505050565b5f5f845183118061292c57508284115b1561293b57505f905080612256565b5f61294785600161405b565b8411801561296f575061060f60f31b6129638787016020015190565b6001600160f01b031916145b90505f61297f8215156002614214565b61298a90602861405b565b9050806129978787614149565b036129b8575f5f6129a9898989613116565b90965094506122569350505050565b5f5f935093505050612256565b5f63ffffffff821115612240576040516306dfcc6560e41b81526020600482015260248101839052604401610dfb565b606060ff8314612a0f57612a08836131d7565b9050610a6b565b818054612a1b90613d8c565b80601f0160208091040260200160405190810160405280929190818152602001828054612a4790613d8c565b8015612a925780601f10612a6957610100808354040283529160200191612a92565b820191905f5260205f20905b815481529060010190602001808311612a7557829003601f168201915b50505050509050610a6b565b805115612aad57805160208201fd5b60405163d6bda27560e01b815260040160405180910390fd5b5f805f1983850993909202808410938190039390930393915050565b82545f9081908015612bd8575f612afe87611f63600185614149565b805490915065ffffffffffff80821691600160301b90046001600160d01b0316908816821115612b4157604051632520601d60e01b815260040160405180910390fd5b8765ffffffffffff168265ffffffffffff1603612b7a57825465ffffffffffff16600160301b6001600160d01b03891602178355612bca565b6040805180820190915265ffffffffffff808a1682526001600160d01b03808a1660208085019182528d54600181018f555f8f81529190912094519151909216600160301b029216919091179101555b945085935061225692505050565b50506040805180820190915265ffffffffffff80851682526001600160d01b0380851660208085019182528854600181018a555f8a815291822095519251909316600160301b029190931617920191909155905081612256565b5f81815260096020526040812060028101546001820154612c53919061405b565b612c5f6109b685610d8b565b11159392505050565b5f5f612c76868686866112b0565b9050612cc481612c866007611638565b612c906006611638565b612c9a6002611638565b6001612ca760078261422b565b612cb290600261431f565b612cbc9190614149565b18181861165a565b505f818152600460205260409081902080546001600160f81b0316600160f81b179055517f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c90610d7a9083815260200190565b5f306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015612d6f57507f000000000000000000000000000000000000000000000000000000000000000046145b15612d9957507f000000000000000000000000000000000000000000000000000000000000000090565b610a00604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b5f5f5f8351604103612e77576020840151604085015160608601515f1a612e6988828585613214565b955095509550505050612e82565b505081515f91506002905b9250925092565b5f5f5f856001600160a01b03168585604051602401612ea992919061432d565b60408051601f198184030181529181526020820180516001600160e01b0316630b135d3f60e11b17905251612ede9190614345565b5f60405180830381855afa9150503d805f8114612f16576040519150601f19603f3d011682016040523d82523d5f602084013e612f1b565b606091505b5091509150818015612f2f57506020815110155b801561108f57508051630b135d3f60e11b90612f549083016020908101908401613fa3565b149695505050505050565b5f60018211612f6c575090565b816001600160801b8210612f855760809190911c9060401b5b680100000000000000008210612fa05760409190911c9060201b5b6401000000008210612fb75760209190911c9060101b5b620100008210612fcc5760109190911c9060081b5b6101008210612fe05760089190911c9060041b5b60108210612ff35760049190911c9060021b5b60048210612fff5760011b5b600302600190811c908185816130175761301761415c565b048201901c9050600181858161302f5761302f61415c565b048201901c905060018185816130475761304761415c565b048201901c9050600181858161305f5761305f61415c565b048201901c905060018185816130775761307761415c565b048201901c9050600181858161308f5761308f61415c565b048201901c90506130ae8185816130a8576130a861415c565b04821190565b90039392505050565b5f5b8183101561310e575f6130cc84846132dc565b5f8781526020902090915065ffffffffffff86169082015465ffffffffffff1611156130fa57809250613108565b61310581600161405b565b93505b506130b9565b509392505050565b5f80848161312586600161405b565b8511801561314d575061060f60f31b6131418388016020015190565b6001600160f01b031916145b90505f61315d8215156002614214565b90505f8061316b838a61405b565b90505b878110156131c6575f61318c6131878784016020015190565b6132f6565b9050600f8160ff1611156131ab575f5f97509750505050505050612256565b6131b6601084614214565b60ff90911601915060010161316e565b506001999098509650505050505050565b60605f6131e38361336e565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111561324d57505f915060039050826132d2565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa15801561329e573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b0381166132c957505f9250600191508290506132d2565b92505f91508190505b9450945094915050565b5f6132ea600284841861435b565b61127f9084841661405b565b5f60f882901c602f8111801561330f5750603a8160ff16105b1561331d57602f1901610a6b565b60608160ff16118015613333575060678160ff16105b156133415760561901610a6b565b60408160ff16118015613357575060478160ff16105b156133655760361901610a6b565b5060ff92915050565b5f60ff8216601f811115610a6b57604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156133a5575f5ffd5b81356001600160e01b03198116811461127f575f5ffd5b5f602082840312156133cc575f5ffd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f61127f60208301846133d3565b6001600160a01b0381168114610a82575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561346357613463613427565b604052919050565b5f6001600160401b0382111561348357613483613427565b50601f01601f191660200190565b5f6134a361349e8461346b565b61343b565b90508281528383830111156134b6575f5ffd5b828260208301375f602084830101529392505050565b5f82601f8301126134db575f5ffd5b61127f83833560208501613491565b5f5f5f5f608085870312156134fd575f5ffd5b843561350881613413565b9350602085013561351881613413565b92506040850135915060608501356001600160401b03811115613539575f5ffd5b613545878288016134cc565b91505092959194509250565b5f6001600160401b0382111561356957613569613427565b5060051b60200190565b5f82601f830112613582575f5ffd5b813561359061349e82613551565b8082825260208201915060208360051b8601019250858311156135b1575f5ffd5b602085015b83811015610c195780356135c981613413565b8352602092830192016135b6565b5f82601f8301126135e6575f5ffd5b81356135f461349e82613551565b8082825260208201915060208360051b860101925085831115613615575f5ffd5b602085015b83811015610c1957803583526020928301920161361a565b5f82601f830112613641575f5ffd5b813561364f61349e82613551565b8082825260208201915060208360051b860101925085831115613670575f5ffd5b602085015b83811015610c195780356001600160401b03811115613692575f5ffd5b6136a1886020838a01016134cc565b84525060209283019201613675565b5f5f5f5f608085870312156136c3575f5ffd5b84356001600160401b038111156136d8575f5ffd5b6136e487828801613573565b94505060208501356001600160401b038111156136ff575f5ffd5b61370b878288016135d7565b93505060408501356001600160401b03811115613726575f5ffd5b61373287828801613632565b949793965093946060013593505050565b634e487b7160e01b5f52602160045260245ffd5b6008811061377357634e487b7160e01b5f52602160045260245ffd5b9052565b60208101610a6b8284613757565b5f5f60408385031215613796575f5ffd5b8235915060208301356137a881613413565b809150509250929050565b803560ff81168114610ed6575f5ffd5b5f5f604083850312156137d4575f5ffd5b823591506137e4602084016137b3565b90509250929050565b5f5f83601f8401126137fd575f5ffd5b5081356001600160401b03811115613813575f5ffd5b60208301915083602082850101111561382a575f5ffd5b9250929050565b5f5f5f5f5f5f5f60c0888a031215613847575f5ffd5b87359650613857602089016137b3565b9550604088013561386781613413565b945060608801356001600160401b03811115613881575f5ffd5b61388d8a828b016137ed565b90955093505060808801356001600160401b038111156138ab575f5ffd5b6138b78a828b016134cc565b92505060a08801356001600160401b038111156138d2575f5ffd5b6138de8a828b016134cc565b91505092959891949750929550565b5f5f5f5f5f60808688031215613901575f5ffd5b85359450613911602087016137b3565b935060408601356001600160401b0381111561392b575f5ffd5b613937888289016137ed565b90945092505060608601356001600160401b03811115613955575f5ffd5b613961888289016134cc565b9150509295509295909350565b65ffffffffffff81168114610a82575f5ffd5b5f60208284031215613991575f5ffd5b813561127f8161396e565b5f5f5f5f606085870312156139af575f5ffd5b843593506139bf602086016137b3565b925060408501356001600160401b038111156139d9575f5ffd5b6139e5878288016137ed565b95989497509550505050565b5f5f5f5f60808587031215613a04575f5ffd5b84356001600160401b03811115613a19575f5ffd5b613a2587828801613573565b94505060208501356001600160401b03811115613a40575f5ffd5b613a4c878288016135d7565b93505060408501356001600160401b03811115613a67575f5ffd5b613a7387828801613632565b92505060608501356001600160401b03811115613a8e575f5ffd5b8501601f81018713613a9e575f5ffd5b61354587823560208401613491565b5f60208284031215613abd575f5ffd5b813561127f81613413565b5f8151808452602084019350602083015f5b82811015613af8578151865260209586019590910190600101613ada565b5093949350505050565b60ff60f81b8816815260e060208201525f613b2060e08301896133d3565b8281036040840152613b3281896133d3565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501529050613b638185613ac8565b9a9950505050505050505050565b5f5f5f5f60808587031215613b84575f5ffd5b84359350613b94602086016137b3565b92506040850135613ba481613413565b915060608501356001600160401b03811115613539575f5ffd5b5f5f5f60608486031215613bd0575f5ffd5b8335613bdb81613413565b92506020840135915060408401356001600160401b03811115613bfc575f5ffd5b613c08868287016134cc565b9150509250925092565b5f5f5f5f5f60a08688031215613c26575f5ffd5b8535613c3181613413565b94506020860135613c4181613413565b935060408601356001600160401b03811115613c5b575f5ffd5b613c67888289016135d7565b93505060608601356001600160401b03811115613c82575f5ffd5b613c8e888289016135d7565b92505060808601356001600160401b03811115613955575f5ffd5b5f5f5f5f60608587031215613cbc575f5ffd5b8435613cc781613413565b93506020850135925060408501356001600160401b038111156139d9575f5ffd5b5f60208284031215613cf8575f5ffd5b813563ffffffff8116811461127f575f5ffd5b5f5f60408385031215613d1c575f5ffd5b8235613d2781613413565b946020939093013593505050565b5f5f5f5f5f60a08688031215613d49575f5ffd5b8535613d5481613413565b94506020860135613d6481613413565b9350604086013592506060860135915060808601356001600160401b03811115613955575f5ffd5b600181811c90821680613da057607f821691505b602082108103613dbe57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215613de8575f5ffd5b81516001600160401b03811115613dfd575f5ffd5b8201601f81018413613e0d575f5ffd5b8051613e1b61349e8261346b565b818152856020838501011115613e2f575f5ffd5b8160208401602083015e5f91810160200191909152949350505050565b634e487b7160e01b5f52601160045260245ffd5b65ffffffffffff8281168282160390811115610a6b57610a6b613e4c565b5f60208284031215613e8e575f5ffd5b815161127f8161396e565b65ffffffffffff8181168382160190811115610a6b57610a6b613e4c565b818382375f9101908152919050565b5f8151808452602084019350602083015f5b82811015613af85781516001600160a01b0316865260209586019590910190600101613ed8565b5f82825180855260208501945060208160051b830101602085015f5b83811015613f4d57601f19858403018852613f378383516133d3565b6020988901989093509190910190600101613f1b565b50909695505050505050565b608081525f613f6b6080830187613ec6565b8281036020840152613f7d8187613ac8565b90508281036040840152613f918186613eff565b91505082606083015295945050505050565b5f60208284031215613fb3575f5ffd5b5051919050565b83815260608101613fce6020830185613757565b826040830152949350505050565b5f60208284031215613fec575f5ffd5b8151801515811461127f575f5ffd5b84815260ff84166020820152826040820152608060608201525f61108f60808301846133d3565b85815260ff8516602082015283604082015260a060608201525f61404960a08301856133d3565b8281036080840152610fd881856133d3565b80820180821115610a6b57610a6b613e4c565b8981526001600160a01b0389166020820152610120604082018190525f906140989083018a613ec6565b82810360608401526140aa818a613ac8565b9050828103608084015280885180835260208301915060208160051b84010160208b015f5b8381101561410157601f198684030185526140eb8383516133d3565b60209586019590935091909101906001016140cf565b505085810360a0870152614115818b613eff565b93505050508560c08401528460e084015282810361010084015261413981856133d3565b9c9b505050505050505050505050565b81810381811115610a6b57610a6b613e4c565b634e487b7160e01b5f52601260045260245ffd5b60a081525f61418260a0830188613ec6565b82810360208401526141948188613ac8565b905082810360408401526141a88187613eff565b60608401959095525050608001529392505050565b60c081525f6141cf60c0830189613ec6565b82810360208401526141e18189613ac8565b905082810360408401526141f58188613eff565b60608401969096525050608081019290925260a0909101529392505050565b8082028115828204841417610a6b57610a6b613e4c565b60ff8181168382160190811115610a6b57610a6b613e4c565b6001815b60018411156122565780850481111561426357614263613e4c565b600184161561427157908102905b60019390931c928002614248565b5f8261428d57506001610a6b565b8161429957505f610a6b565b81600181146142af57600281146142b9576142d5565b6001915050610a6b565b60ff8411156142ca576142ca613e4c565b50506001821b610a6b565b5060208310610133831016604e8410600b84101617156142f8575081810a610a6b565b6143045f198484614244565b805f190482111561431757614317613e4c565b029392505050565b5f61127f60ff84168361427f565b828152604060208201525f61127c60408301846133d3565b5f82518060208501845e5f920191825250919050565b5f8261437557634e487b7160e01b5f52601260045260245ffd5b50049056fea264697066735822122030c8f06becf19a0a8d6ad0c9a6f53a892e61e375051426021363a7ad529dd34064736f6c634300081e0033",
"opcodes": "PUSH2 0x180 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x4D6A CODESIZE SUB DUP1 PUSH2 0x4D6A DUP4 CODECOPY DUP2 ADD PUSH1 0x40 DUP2 SWAP1 MSTORE PUSH2 0x2F SWAP2 PUSH2 0x71D JUMP JUMPDEST DUP1 PUSH1 0x4 DUP4 PUSH2 0x1C20 PUSH2 0xC4E0 PUSH0 PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0xA DUP2 MSTORE PUSH1 0x20 ADD PUSH10 0x26BCA3B7BB32B93737B9 PUSH1 0xB1 SHL DUP2 MSTORE POP DUP1 PUSH2 0x6C PUSH2 0x16F PUSH1 0x20 SHL PUSH1 0x20 SHR JUMP JUMPDEST PUSH2 0x76 DUP3 PUSH0 PUSH2 0x18A JUMP JUMPDEST PUSH2 0x120 MSTORE PUSH2 0x85 DUP2 PUSH1 0x1 PUSH2 0x18A JUMP JUMPDEST PUSH2 0x140 MSTORE DUP2 MLOAD PUSH1 0x20 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0xE0 MSTORE DUP2 MLOAD SWAP1 DUP3 ADD KECCAK256 PUSH2 0x100 MSTORE CHAINID PUSH1 0xA0 MSTORE PUSH2 0x111 PUSH1 0xE0 MLOAD PUSH2 0x100 MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE SWAP1 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x80 MSTORE POP POP ADDRESS PUSH1 0xC0 MSTORE PUSH1 0x3 PUSH2 0x126 DUP3 DUP3 PUSH2 0x7ED JUMP JUMPDEST POP PUSH2 0x132 SWAP1 POP DUP4 PUSH2 0x1BC JUMP JUMPDEST PUSH2 0x13B DUP3 PUSH2 0x222 JUMP JUMPDEST PUSH2 0x144 DUP2 PUSH2 0x2C6 JUMP JUMPDEST POP POP POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0x160 MSTORE PUSH2 0x15D DUP2 PUSH2 0x307 JUMP JUMPDEST POP PUSH2 0x167 DUP2 PUSH2 0x39C JUMP JUMPDEST POP POP POP PUSH2 0x943 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x1 DUP2 MSTORE PUSH1 0x31 PUSH1 0xF8 SHL PUSH1 0x20 DUP3 ADD MSTORE SWAP1 JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP4 MLOAD LT ISZERO PUSH2 0x1A5 JUMPI PUSH2 0x19E DUP4 PUSH2 0x405 JUMP JUMPDEST SWAP1 POP PUSH2 0x1B6 JUMP JUMPDEST DUP2 PUSH2 0x1B0 DUP5 DUP3 PUSH2 0x7ED JUMP JUMPDEST POP PUSH1 0xFF SWAP1 POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x8 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH6 0xFFFFFFFFFFFF SWAP3 DUP4 AND DUP2 MSTORE SWAP2 DUP4 AND PUSH1 0x20 DUP4 ADD MSTORE PUSH32 0xC565B045403DC03C2EEA82B81A0465EDAD9E2E7FC4D97E11421C209DA93D7A93 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH1 0x8 DUP1 SLOAD PUSH6 0xFFFFFFFFFFFF NOT AND PUSH6 0xFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST DUP1 PUSH4 0xFFFFFFFF AND PUSH0 SUB PUSH2 0x24F JUMPI PUSH1 0x40 MLOAD PUSH4 0xF1CFBF05 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x8 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0xFFFFFFFF PUSH7 0x1000000000000 SWAP1 SWAP4 DIV DUP4 AND DUP2 MSTORE SWAP2 DUP4 AND PUSH1 0x20 DUP4 ADD MSTORE PUSH32 0x7E3F7F0708A84DE9203036ABAA450DCCC85AD5FF52F78C170F3EDB55CF5E8828 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH1 0x8 DUP1 SLOAD PUSH4 0xFFFFFFFF SWAP1 SWAP3 AND PUSH7 0x1000000000000 MUL PUSH4 0xFFFFFFFF PUSH1 0x30 SHL NOT SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x7 SLOAD PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP4 SWAP1 MSTORE PUSH32 0xCCB45DA8D5717E6C4544694297C4BA5CF151D455C9BB0ED4FC7A38411BC05461 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH1 0x7 SSTORE JUMP JUMPDEST PUSH1 0x64 DUP1 DUP3 GT ISZERO PUSH2 0x334 JUMPI PUSH1 0x40 MLOAD PUSH4 0x243E5445 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x24 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x44 ADD PUSH2 0x246 JUMP JUMPDEST PUSH0 PUSH2 0x33D PUSH2 0x442 JUMP JUMPDEST SWAP1 POP PUSH2 0x35C PUSH2 0x34A PUSH2 0x45B JUMP JUMPDEST PUSH2 0x353 DUP6 PUSH2 0x4D5 JUMP JUMPDEST PUSH1 0xA SWAP2 SWAP1 PUSH2 0x50C JUMP JUMPDEST POP POP PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 ADD DUP6 SWAP1 MSTORE PUSH32 0x553476BF02EF2726E8CE5CED78D63E26E602E4A2257B1F559418E24B4633997 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 POP POP POP JUMP JUMPDEST PUSH1 0xB SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP3 DUP4 AND DUP2 MSTORE SWAP2 DUP4 AND PUSH1 0x20 DUP4 ADD MSTORE PUSH32 0x8F74EA46EF7894F65EABFB5E6E695DE773A000B47C529AB559178069B226401 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH1 0xB DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST PUSH0 PUSH0 DUP3 SWAP1 POP PUSH1 0x1F DUP2 MLOAD GT ISZERO PUSH2 0x42F JUMPI DUP3 PUSH1 0x40 MLOAD PUSH4 0x305A27A9 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x246 SWAP2 SWAP1 PUSH2 0x8A7 JUMP JUMPDEST DUP1 MLOAD PUSH2 0x43A DUP3 PUSH2 0x8DC JUMP JUMPDEST OR SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 PUSH2 0x44D PUSH1 0xA PUSH2 0x526 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB AND SWAP1 POP SWAP1 JUMP JUMPDEST PUSH0 PUSH2 0x466 PUSH2 0x160 MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH4 0x91DDADF4 PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL SWAP3 POP POP POP DUP1 ISZERO PUSH2 0x4BF JUMPI POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x1F RETURNDATASIZE SWAP1 DUP2 ADD PUSH1 0x1F NOT AND DUP3 ADD SWAP1 SWAP3 MSTORE PUSH2 0x4BC SWAP2 DUP2 ADD SWAP1 PUSH2 0x8FF JUMP JUMPDEST PUSH1 0x1 JUMPDEST PUSH2 0x4D0 JUMPI PUSH2 0x4CB PUSH2 0x56E JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB DUP3 GT ISZERO PUSH2 0x508 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6DFCC65 PUSH1 0xE4 SHL DUP2 MSTORE PUSH1 0xD0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x44 ADD PUSH2 0x246 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH0 DUP1 PUSH2 0x519 DUP6 DUP6 DUP6 PUSH2 0x578 JUMP JUMPDEST SWAP2 POP SWAP2 POP JUMPDEST SWAP4 POP SWAP4 SWAP2 POP POP JUMP JUMPDEST DUP1 SLOAD PUSH0 SWAP1 DUP1 ISZERO PUSH2 0x565 JUMPI PUSH2 0x54C DUP4 PUSH2 0x53F PUSH1 0x1 DUP5 PUSH2 0x924 JUMP JUMPDEST PUSH0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SWAP1 JUMP JUMPDEST SLOAD PUSH7 0x1000000000000 SWAP1 DIV PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB AND PUSH2 0x567 JUMP JUMPDEST PUSH0 JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 PUSH2 0x4CB NUMBER PUSH2 0x6D4 JUMP JUMPDEST DUP3 SLOAD PUSH0 SWAP1 DUP2 SWAP1 DUP1 ISZERO PUSH2 0x677 JUMPI PUSH0 PUSH2 0x594 DUP8 PUSH2 0x53F PUSH1 0x1 DUP6 PUSH2 0x924 JUMP JUMPDEST DUP1 SLOAD SWAP1 SWAP2 POP PUSH6 0xFFFFFFFFFFFF DUP1 DUP3 AND SWAP2 PUSH7 0x1000000000000 SWAP1 DIV PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB AND SWAP1 DUP9 AND DUP3 GT ISZERO PUSH2 0x5DA JUMPI PUSH1 0x40 MLOAD PUSH4 0x2520601D PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP8 PUSH6 0xFFFFFFFFFFFF AND DUP3 PUSH6 0xFFFFFFFFFFFF AND SUB PUSH2 0x616 JUMPI DUP3 SLOAD PUSH6 0xFFFFFFFFFFFF AND PUSH7 0x1000000000000 PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB DUP10 AND MUL OR DUP4 SSTORE PUSH2 0x669 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH6 0xFFFFFFFFFFFF DUP1 DUP11 AND DUP3 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB DUP1 DUP11 AND PUSH1 0x20 DUP1 DUP6 ADD SWAP2 DUP3 MSTORE DUP14 SLOAD PUSH1 0x1 DUP2 ADD DUP16 SSTORE PUSH0 DUP16 DUP2 MSTORE SWAP2 SWAP1 SWAP2 KECCAK256 SWAP5 MLOAD SWAP2 MLOAD SWAP1 SWAP3 AND PUSH7 0x1000000000000 MUL SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP2 ADD SSTORE JUMPDEST SWAP5 POP DUP6 SWAP4 POP PUSH2 0x51E SWAP3 POP POP POP JUMP JUMPDEST POP POP PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH6 0xFFFFFFFFFFFF DUP1 DUP6 AND DUP3 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB DUP1 DUP6 AND PUSH1 0x20 DUP1 DUP6 ADD SWAP2 DUP3 MSTORE DUP9 SLOAD PUSH1 0x1 DUP2 ADD DUP11 SSTORE PUSH0 DUP11 DUP2 MSTORE SWAP2 DUP3 KECCAK256 SWAP6 MLOAD SWAP3 MLOAD SWAP1 SWAP4 AND PUSH7 0x1000000000000 MUL SWAP2 SWAP1 SWAP4 AND OR SWAP3 ADD SWAP2 SWAP1 SWAP2 SSTORE SWAP1 POP DUP2 PUSH2 0x51E JUMP JUMPDEST PUSH0 PUSH6 0xFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x508 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6DFCC65 PUSH1 0xE4 SHL DUP2 MSTORE PUSH1 0x30 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x44 ADD PUSH2 0x246 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x71A JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP JUMP JUMPDEST PUSH0 PUSH0 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x72E JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 MLOAD PUSH2 0x739 DUP2 PUSH2 0x706 JUMP JUMPDEST PUSH1 0x20 DUP5 ADD MLOAD SWAP1 SWAP3 POP PUSH2 0x74A DUP2 PUSH2 0x706 JUMP JUMPDEST DUP1 SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x77D JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x79B JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x1F DUP3 GT ISZERO PUSH2 0x7E8 JUMPI DUP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 PUSH1 0x1F DUP5 ADD PUSH1 0x5 SHR DUP2 ADD PUSH1 0x20 DUP6 LT ISZERO PUSH2 0x7C6 JUMPI POP DUP1 JUMPDEST PUSH1 0x1F DUP5 ADD PUSH1 0x5 SHR DUP3 ADD SWAP2 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x7E5 JUMPI PUSH0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x7D2 JUMP JUMPDEST POP POP JUMPDEST POP POP POP JUMP JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x806 JUMPI PUSH2 0x806 PUSH2 0x755 JUMP JUMPDEST PUSH2 0x81A DUP2 PUSH2 0x814 DUP5 SLOAD PUSH2 0x769 JUMP JUMPDEST DUP5 PUSH2 0x7A1 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x1F DUP3 GT PUSH1 0x1 DUP2 EQ PUSH2 0x84C JUMPI PUSH0 DUP4 ISZERO PUSH2 0x835 JUMPI POP DUP5 DUP3 ADD MLOAD JUMPDEST PUSH0 NOT PUSH1 0x3 DUP6 SWAP1 SHL SHR NOT AND PUSH1 0x1 DUP5 SWAP1 SHL OR DUP5 SSTORE PUSH2 0x7E5 JUMP JUMPDEST PUSH0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 KECCAK256 PUSH1 0x1F NOT DUP6 AND SWAP2 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x87B JUMPI DUP8 DUP6 ADD MLOAD DUP3 SSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 ADD PUSH2 0x85B JUMP JUMPDEST POP DUP5 DUP3 LT ISZERO PUSH2 0x898 JUMPI DUP7 DUP5 ADD MLOAD PUSH0 NOT PUSH1 0x3 DUP8 SWAP1 SHL PUSH1 0xF8 AND SHR NOT AND DUP2 SSTORE JUMPDEST POP POP POP POP PUSH1 0x1 SWAP1 DUP2 SHL ADD SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x20 DUP2 MSTORE PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP5 ADD MSTORE DUP1 PUSH1 0x20 DUP6 ADD PUSH1 0x40 DUP6 ADD MCOPY PUSH0 PUSH1 0x40 DUP3 DUP6 ADD ADD MSTORE PUSH1 0x40 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP5 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP2 SWAP1 DUP2 LT ISZERO PUSH2 0x79B JUMPI PUSH0 NOT PUSH1 0x20 SWAP2 SWAP1 SWAP2 SUB PUSH1 0x3 SHL SHL AND SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x90F JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 MLOAD PUSH6 0xFFFFFFFFFFFF DUP2 AND DUP2 EQ PUSH2 0x567 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 DUP2 SUB DUP2 DUP2 GT ISZERO PUSH2 0x1B6 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x80 MLOAD PUSH1 0xA0 MLOAD PUSH1 0xC0 MLOAD PUSH1 0xE0 MLOAD PUSH2 0x100 MLOAD PUSH2 0x120 MLOAD PUSH2 0x140 MLOAD PUSH2 0x160 MLOAD PUSH2 0x43B0 PUSH2 0x9BA PUSH0 CODECOPY PUSH0 DUP2 DUP2 PUSH2 0x9C9 ADD MSTORE DUP2 DUP2 PUSH2 0xE1F ADD MSTORE DUP2 DUP2 PUSH2 0x11EC ADD MSTORE DUP2 DUP2 PUSH2 0x14B1 ADD MSTORE PUSH2 0x1EBA ADD MSTORE PUSH0 PUSH2 0x1DFE ADD MSTORE PUSH0 PUSH2 0x1DD2 ADD MSTORE PUSH0 PUSH2 0x2DF0 ADD MSTORE PUSH0 PUSH2 0x2DC8 ADD MSTORE PUSH0 PUSH2 0x2D23 ADD MSTORE PUSH0 PUSH2 0x2D4D ADD MSTORE PUSH0 PUSH2 0x2D77 ADD MSTORE PUSH2 0x43B0 PUSH0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x2A8 JUMPI PUSH0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7ECEBE00 GT PUSH2 0x16F JUMPI DUP1 PUSH4 0xBC197C81 GT PUSH2 0xD8 JUMPI DUP1 PUSH4 0xDEAAA7CC GT PUSH2 0x92 JUMPI DUP1 PUSH4 0xECE40CC1 GT PUSH2 0x6D JUMPI DUP1 PUSH4 0xECE40CC1 EQ PUSH2 0x95E JUMPI DUP1 PUSH4 0xF23A6E61 EQ PUSH2 0x97D JUMPI DUP1 PUSH4 0xF8CE560A EQ PUSH2 0x99C JUMPI DUP1 PUSH4 0xFC0C546A EQ PUSH2 0x9BB JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0xDEAAA7CC EQ PUSH2 0x8ED JUMPI DUP1 PUSH4 0xE540D01D EQ PUSH2 0x920 JUMPI DUP1 PUSH4 0xEB9019D4 EQ PUSH2 0x93F JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0xBC197C81 EQ PUSH2 0x81B JUMPI DUP1 PUSH4 0xC01F9E37 EQ PUSH2 0x83A JUMPI DUP1 PUSH4 0xC28BC2FA EQ PUSH2 0x859 JUMPI DUP1 PUSH4 0xC59057E4 EQ PUSH2 0x86C JUMPI DUP1 PUSH4 0xD33219B4 EQ PUSH2 0x88B JUMPI DUP1 PUSH4 0xDD4E2BA5 EQ PUSH2 0x8A8 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0xA7713A70 GT PUSH2 0x129 JUMPI DUP1 PUSH4 0xA7713A70 EQ PUSH2 0x760 JUMPI DUP1 PUSH4 0xA890C910 EQ PUSH2 0x774 JUMPI DUP1 PUSH4 0xA8F8A668 EQ PUSH2 0x793 JUMPI DUP1 PUSH4 0xA9A95294 EQ PUSH2 0x7B2 JUMPI DUP1 PUSH4 0xAB58FB8E EQ PUSH2 0x7D1 JUMPI DUP1 PUSH4 0xB58131B0 EQ PUSH2 0x807 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x7ECEBE00 EQ PUSH2 0x689 JUMPI DUP1 PUSH4 0x84B0196E EQ PUSH2 0x6BD JUMPI DUP1 PUSH4 0x8FF262E3 EQ PUSH2 0x6E4 JUMPI DUP1 PUSH4 0x91DDADF4 EQ PUSH2 0x703 JUMPI DUP1 PUSH4 0x97C3D334 EQ PUSH2 0x72E JUMPI DUP1 PUSH4 0x9A802A6D EQ PUSH2 0x741 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x43859632 GT PUSH2 0x211 JUMPI DUP1 PUSH4 0x5B8D0E0D GT PUSH2 0x1CB JUMPI DUP1 PUSH4 0x5B8D0E0D EQ PUSH2 0x5CF JUMPI DUP1 PUSH4 0x5F398A14 EQ PUSH2 0x5EE JUMPI DUP1 PUSH4 0x60C4247F EQ PUSH2 0x60D JUMPI DUP1 PUSH4 0x79051887 EQ PUSH2 0x62C JUMPI DUP1 PUSH4 0x7B3C71D3 EQ PUSH2 0x64B JUMPI DUP1 PUSH4 0x7D5E81E2 EQ PUSH2 0x66A JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x43859632 EQ PUSH2 0x4D2 JUMPI DUP1 PUSH4 0x452115D6 EQ PUSH2 0x51A JUMPI DUP1 PUSH4 0x4BF5D7E9 EQ PUSH2 0x539 JUMPI DUP1 PUSH4 0x544FFC9C EQ PUSH2 0x54D JUMPI DUP1 PUSH4 0x54FD4D50 EQ PUSH2 0x587 JUMPI DUP1 PUSH4 0x56781388 EQ PUSH2 0x5B0 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x160CBED7 GT PUSH2 0x262 JUMPI DUP1 PUSH4 0x160CBED7 EQ PUSH2 0x406 JUMPI DUP1 PUSH4 0x2656227D EQ PUSH2 0x425 JUMPI DUP1 PUSH4 0x2D63F693 EQ PUSH2 0x438 JUMPI DUP1 PUSH4 0x2FE3E261 EQ PUSH2 0x457 JUMPI DUP1 PUSH4 0x3932ABB1 EQ PUSH2 0x48A JUMPI DUP1 PUSH4 0x3E4F49E6 EQ PUSH2 0x4A6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x1FFC9A7 EQ PUSH2 0x2E3 JUMPI DUP1 PUSH4 0x2A251A3 EQ PUSH2 0x317 JUMPI DUP1 PUSH4 0x6F3F9E6 EQ PUSH2 0x342 JUMPI DUP1 PUSH4 0x6FDDE03 EQ PUSH2 0x361 JUMPI DUP1 PUSH4 0x143489D0 EQ PUSH2 0x382 JUMPI DUP1 PUSH4 0x150B7A02 EQ PUSH2 0x3CE JUMPI PUSH0 PUSH0 REVERT JUMPDEST CALLDATASIZE PUSH2 0x2DF JUMPI ADDRESS PUSH2 0x2B6 PUSH2 0x9ED JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x2DD JUMPI PUSH1 0x40 MLOAD PUSH4 0x7485328F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST STOP JUMPDEST PUSH0 PUSH0 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2EE JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x302 PUSH2 0x2FD CALLDATASIZE PUSH1 0x4 PUSH2 0x3395 JUMP JUMPDEST PUSH2 0xA05 JUMP JUMPDEST PUSH1 0x40 MLOAD SWAP1 ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x322 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH1 0x8 SLOAD PUSH1 0x1 PUSH1 0x30 SHL SWAP1 DIV PUSH4 0xFFFFFFFF AND JUMPDEST PUSH1 0x40 MLOAD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x30E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x34D JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x35C CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH2 0xA71 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x36C JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x375 PUSH2 0xA85 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x30E SWAP2 SWAP1 PUSH2 0x3401 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x38D JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x3B6 PUSH2 0x39C CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x30E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3D9 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x3ED PUSH2 0x3E8 CALLDATASIZE PUSH1 0x4 PUSH2 0x34EA JUMP JUMPDEST PUSH2 0xB15 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xE0 SHL SUB NOT SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x30E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x411 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x420 CALLDATASIZE PUSH1 0x4 PUSH2 0x36B0 JUMP JUMPDEST PUSH2 0xB57 JUMP JUMPDEST PUSH2 0x334 PUSH2 0x433 CALLDATASIZE PUSH1 0x4 PUSH2 0x36B0 JUMP JUMPDEST PUSH2 0xC23 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x443 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x452 CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH2 0xD8B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x462 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH32 0x3E83946653575F9A39005E1545185629E92736B7528AB20CA3816F315424A811 DUP2 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x495 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH1 0x8 SLOAD PUSH6 0xFFFFFFFFFFFF AND PUSH2 0x334 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4B1 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x4C5 PUSH2 0x4C0 CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH2 0xDAB JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x30E SWAP2 SWAP1 PUSH2 0x3777 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4DD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x302 PUSH2 0x4EC CALLDATASIZE PUSH1 0x4 PUSH2 0x3785 JUMP JUMPDEST PUSH0 DUP3 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP6 AND DUP5 MSTORE PUSH1 0x3 ADD SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND SWAP3 SWAP2 POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x525 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x534 CALLDATASIZE PUSH1 0x4 PUSH2 0x36B0 JUMP JUMPDEST PUSH2 0xDB5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x544 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x375 PUSH2 0xE1B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x558 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x56C PUSH2 0x567 CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH2 0xEDB JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP4 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP3 SWAP1 SWAP3 MSTORE SWAP1 DUP3 ADD MSTORE PUSH1 0x60 ADD PUSH2 0x30E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x592 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x1 DUP2 MSTORE PUSH1 0x31 PUSH1 0xF8 SHL PUSH1 0x20 DUP3 ADD MSTORE PUSH2 0x375 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5BB JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x5CA CALLDATASIZE PUSH1 0x4 PUSH2 0x37C3 JUMP JUMPDEST PUSH2 0xF00 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5DA JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x5E9 CALLDATASIZE PUSH1 0x4 PUSH2 0x3831 JUMP JUMPDEST PUSH2 0xF27 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5F9 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x608 CALLDATASIZE PUSH1 0x4 PUSH2 0x38ED JUMP JUMPDEST PUSH2 0xFE4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x618 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x627 CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH2 0x102C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x637 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x646 CALLDATASIZE PUSH1 0x4 PUSH2 0x3981 JUMP JUMPDEST PUSH2 0x1038 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x656 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x665 CALLDATASIZE PUSH1 0x4 PUSH2 0x399C JUMP JUMPDEST PUSH2 0x1049 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x675 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x684 CALLDATASIZE PUSH1 0x4 PUSH2 0x39F1 JUMP JUMPDEST PUSH2 0x1099 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x694 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x6A3 CALLDATASIZE PUSH1 0x4 PUSH2 0x3AAD JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6C8 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x6D1 PUSH2 0x114F JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x30E SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x3B02 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6EF JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x6FE CALLDATASIZE PUSH1 0x4 PUSH2 0x3B71 JUMP JUMPDEST PUSH2 0x1191 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x70E JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x717 PUSH2 0x11E9 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH6 0xFFFFFFFFFFFF SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x30E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x739 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH1 0x64 PUSH2 0x334 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x74C JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x75B CALLDATASIZE PUSH1 0x4 PUSH2 0x3BBE JUMP JUMPDEST PUSH2 0x1270 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x76B JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x1286 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x77F JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x78E CALLDATASIZE PUSH1 0x4 PUSH2 0x3AAD JUMP JUMPDEST PUSH2 0x129F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x79E JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x7AD CALLDATASIZE PUSH1 0x4 PUSH2 0x36B0 JUMP JUMPDEST PUSH2 0x12B0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7BD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x302 PUSH2 0x7CC CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH2 0x12BD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7DC JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x7EB CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x1 ADD SLOAD PUSH6 0xFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x812 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x12C5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x826 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x3ED PUSH2 0x835 CALLDATASIZE PUSH1 0x4 PUSH2 0x3C12 JUMP JUMPDEST PUSH2 0x12CF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x845 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x854 CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH2 0x1312 JUMP JUMPDEST PUSH2 0x2DD PUSH2 0x867 CALLDATASIZE PUSH1 0x4 PUSH2 0x3CA9 JUMP JUMPDEST PUSH2 0x1354 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x877 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x886 CALLDATASIZE PUSH1 0x4 PUSH2 0x36B0 JUMP JUMPDEST PUSH2 0x13D0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x896 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH1 0xB SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0x3B6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x8B3 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x20 DUP1 DUP3 MSTORE PUSH32 0x737570706F72743D627261766F2671756F72756D3D666F722C6162737461696E SWAP1 DUP3 ADD MSTORE PUSH2 0x375 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x8F8 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH32 0xF2AAD550CF55F045CB27E9C559F9889FDFB6E6CDAA032301D6EA397784AE51D7 DUP2 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x92B JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x93A CALLDATASIZE PUSH1 0x4 PUSH2 0x3CE8 JUMP JUMPDEST PUSH2 0x1409 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x94A JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x959 CALLDATASIZE PUSH1 0x4 PUSH2 0x3D0B JUMP JUMPDEST PUSH2 0x141A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x969 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x978 CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH2 0x1439 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x988 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x3ED PUSH2 0x997 CALLDATASIZE PUSH1 0x4 PUSH2 0x3D35 JUMP JUMPDEST PUSH2 0x144A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x9A7 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x334 PUSH2 0x9B6 CALLDATASIZE PUSH1 0x4 PUSH2 0x33BC JUMP JUMPDEST PUSH2 0x148D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x9C6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH32 0x0 PUSH2 0x3B6 JUMP JUMPDEST PUSH0 PUSH2 0xA00 PUSH1 0xB SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP1 JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xE0 SHL SUB NOT DUP3 AND PUSH4 0x66DEFE77 PUSH1 0xE1 SHL EQ DUP1 PUSH2 0xA35 JUMPI POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xE0 SHL SUB NOT DUP3 AND PUSH4 0x32A2AD43 PUSH1 0xE1 SHL EQ JUMPDEST DUP1 PUSH2 0xA50 JUMPI POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xE0 SHL SUB NOT DUP3 AND PUSH4 0x2711897 PUSH1 0xE5 SHL EQ JUMPDEST DUP1 PUSH2 0xA6B JUMPI POP PUSH4 0x1FFC9A7 PUSH1 0xE0 SHL PUSH1 0x1 PUSH1 0x1 PUSH1 0xE0 SHL SUB NOT DUP4 AND EQ JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0xA79 PUSH2 0x152A JUMP JUMPDEST PUSH2 0xA82 DUP2 PUSH2 0x15A3 JUMP JUMPDEST POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD PUSH2 0xA94 SWAP1 PUSH2 0x3D8C JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xAC0 SWAP1 PUSH2 0x3D8C JUMP JUMPDEST DUP1 ISZERO PUSH2 0xB0B JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xAE2 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xB0B JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xAEE JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH0 ADDRESS PUSH2 0xB1F PUSH2 0x9ED JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0xB46 JUMPI PUSH1 0x40 MLOAD PUSH4 0x7485328F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP PUSH4 0xA85BD01 PUSH1 0xE1 SHL SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH2 0xB65 DUP7 DUP7 DUP7 DUP7 PUSH2 0x12B0 JUMP JUMPDEST SWAP1 POP PUSH2 0xB7A DUP2 PUSH2 0xB75 PUSH1 0x4 PUSH2 0x1638 JUMP JUMPDEST PUSH2 0x165A JUMP JUMPDEST POP PUSH0 PUSH2 0xB89 DUP3 DUP9 DUP9 DUP9 DUP9 PUSH2 0x1697 JUMP JUMPDEST SWAP1 POP PUSH6 0xFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0xC00 JUMPI PUSH0 DUP3 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x1 ADD DUP1 SLOAD PUSH6 0xFFFFFFFFFFFF NOT AND PUSH6 0xFFFFFFFFFFFF DUP6 AND SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP3 MLOAD DUP6 DUP2 MSTORE SWAP2 DUP3 ADD MSTORE PUSH32 0x9A2E42FD6722813D69113E7D0079D3D940171428DF7373DF9C7F7617CFDA2892 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH2 0xC19 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x48442523 PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH2 0xC31 DUP7 DUP7 DUP7 DUP7 PUSH2 0x12B0 JUMP JUMPDEST SWAP1 POP PUSH2 0xC51 DUP2 PUSH2 0xC41 PUSH1 0x5 PUSH2 0x1638 JUMP JUMPDEST PUSH2 0xC4B PUSH1 0x4 PUSH2 0x1638 JUMP JUMPDEST OR PUSH2 0x165A JUMP JUMPDEST POP PUSH0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0xFF PUSH1 0xF0 SHL NOT AND PUSH1 0x1 PUSH1 0xF0 SHL OR SWAP1 SSTORE ADDRESS PUSH2 0xC79 PUSH2 0x9ED JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0xD02 JUMPI PUSH0 JUMPDEST DUP7 MLOAD DUP2 LT ISZERO PUSH2 0xD00 JUMPI ADDRESS PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP8 DUP3 DUP2 MLOAD DUP2 LT PUSH2 0xCAE JUMPI PUSH2 0xCAE PUSH2 0x3DC4 JUMP JUMPDEST PUSH1 0x20 MUL PUSH1 0x20 ADD ADD MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SUB PUSH2 0xCF8 JUMPI PUSH2 0xCF8 DUP6 DUP3 DUP2 MLOAD DUP2 LT PUSH2 0xCD9 JUMPI PUSH2 0xCD9 PUSH2 0x3DC4 JUMP JUMPDEST PUSH1 0x20 MUL PUSH1 0x20 ADD ADD MLOAD DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 PUSH1 0x5 PUSH2 0x16A5 SWAP1 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0xC89 JUMP JUMPDEST POP JUMPDEST PUSH2 0xD0F DUP2 DUP8 DUP8 DUP8 DUP8 PUSH2 0x1706 JUMP JUMPDEST ADDRESS PUSH2 0xD18 PUSH2 0x9ED JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ ISZERO DUP1 ISZERO PUSH2 0xD44 JUMPI POP PUSH1 0x5 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x80 SHL SUB DUP1 DUP3 AND PUSH1 0x1 PUSH1 0x80 SHL SWAP1 SWAP3 DIV AND EQ ISZERO JUMPDEST ISZERO PUSH2 0xD4E JUMPI PUSH0 PUSH1 0x5 SSTORE JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 MSTORE PUSH32 0x712AE1383F79AC853F8D882153778E0260EF8F03B504E2866E0593E04D2B291F SWAP1 PUSH1 0x20 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 SHL SWAP1 DIV PUSH6 0xFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH0 PUSH2 0xA6B DUP3 PUSH2 0x171A JUMP JUMPDEST PUSH0 PUSH0 PUSH2 0xDC3 DUP7 DUP7 DUP7 DUP7 PUSH2 0x12B0 JUMP JUMPDEST SWAP1 POP CALLER PUSH2 0xDD0 DUP3 DUP3 PUSH2 0x1853 JUMP JUMPDEST PUSH2 0xE04 JUMPI PUSH1 0x40 MLOAD PUSH4 0x8FE5D8A9 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH1 0x24 DUP3 ADD MSTORE PUSH1 0x44 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0xE10 DUP8 DUP8 DUP8 DUP8 PUSH2 0x1898 JUMP JUMPDEST SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH32 0x0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH4 0x4BF5D7E9 PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL SWAP3 POP POP POP DUP1 ISZERO PUSH2 0xE9A JUMPI POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY PUSH1 0x1F RETURNDATASIZE SWAP1 DUP2 ADD PUSH1 0x1F NOT AND DUP3 ADD PUSH1 0x40 MSTORE PUSH2 0xE97 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x3DD8 JUMP JUMPDEST PUSH1 0x1 JUMPDEST PUSH2 0xED6 JUMPI POP PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x1D DUP2 MSTORE PUSH32 0x6D6F64653D626C6F636B6E756D6265722666726F6D3D64656661756C74000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 JUMP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 DUP2 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP3 ADD SLOAD PUSH1 0x2 SWAP1 SWAP3 ADD SLOAD SWAP1 SWAP2 SWAP1 JUMPDEST SWAP2 SWAP4 SWAP1 SWAP3 POP JUMP JUMPDEST PUSH0 DUP1 CALLER SWAP1 POP PUSH2 0xF1F DUP5 DUP3 DUP6 PUSH1 0x40 MLOAD DUP1 PUSH1 0x20 ADD PUSH1 0x40 MSTORE DUP1 PUSH0 DUP2 MSTORE POP PUSH2 0x18A5 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH0 PUSH2 0xF6D DUP9 DUP9 DUP9 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP DUP11 SWAP3 POP DUP10 SWAP2 POP PUSH2 0x18C6 SWAP1 POP JUMP JUMPDEST PUSH2 0xF95 JUMPI PUSH1 0x40 MLOAD PUSH4 0x94AB6C07 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0xDFB JUMP JUMPDEST PUSH2 0xFD8 DUP9 DUP8 DUP10 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP DUP11 SWAP3 POP PUSH2 0x1993 SWAP2 POP POP JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 DUP1 CALLER SWAP1 POP PUSH2 0xE10 DUP8 DUP3 DUP9 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP DUP11 SWAP3 POP PUSH2 0x1993 SWAP2 POP POP JUMP JUMPDEST PUSH0 PUSH2 0xA6B PUSH1 0xA DUP4 PUSH2 0x1A71 JUMP JUMPDEST PUSH2 0x1040 PUSH2 0x152A JUMP JUMPDEST PUSH2 0xA82 DUP2 PUSH2 0x1ABE JUMP JUMPDEST PUSH0 DUP1 CALLER SWAP1 POP PUSH2 0x108F DUP7 DUP3 DUP8 DUP8 DUP8 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP PUSH2 0x18A5 SWAP3 POP POP POP JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH0 CALLER PUSH2 0x10A5 DUP2 DUP5 PUSH2 0x1B24 JUMP JUMPDEST PUSH2 0x10CD JUMPI PUSH1 0x40 MLOAD PUSH4 0xD9B39557 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0xDFB JUMP JUMPDEST PUSH0 PUSH2 0x10D6 PUSH2 0x12C5 JUMP JUMPDEST SWAP1 POP DUP1 ISZERO PUSH2 0x1142 JUMPI PUSH0 PUSH2 0x1104 DUP4 PUSH1 0x1 PUSH2 0x10ED PUSH2 0x11E9 JUMP JUMPDEST PUSH2 0x10F7 SWAP2 SWAP1 PUSH2 0x3E60 JUMP JUMPDEST PUSH6 0xFFFFFFFFFFFF AND PUSH2 0x141A JUMP JUMPDEST SWAP1 POP DUP2 DUP2 LT ISZERO PUSH2 0x1140 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6121770B PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x44 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x64 ADD PUSH2 0xDFB JUMP JUMPDEST POP JUMPDEST PUSH2 0xE10 DUP8 DUP8 DUP8 DUP8 DUP7 PUSH2 0x1BA8 JUMP JUMPDEST PUSH0 PUSH1 0x60 DUP1 PUSH0 PUSH0 PUSH0 PUSH1 0x60 PUSH2 0x1160 PUSH2 0x1DCB JUMP JUMPDEST PUSH2 0x1168 PUSH2 0x1DF7 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 SWAP3 MSTORE PUSH1 0xF PUSH1 0xF8 SHL SWAP12 SWAP4 SWAP11 POP SWAP2 SWAP9 POP CHAINID SWAP8 POP ADDRESS SWAP7 POP SWAP5 POP SWAP3 POP SWAP1 POP JUMP JUMPDEST PUSH0 PUSH2 0x119E DUP6 DUP6 DUP6 DUP6 PUSH2 0x1E24 JUMP JUMPDEST PUSH2 0x11C6 JUMPI PUSH1 0x40 MLOAD PUSH4 0x94AB6C07 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0xDFB JUMP JUMPDEST PUSH2 0x11E0 DUP6 DUP5 DUP7 PUSH1 0x40 MLOAD DUP1 PUSH1 0x20 ADD PUSH1 0x40 MSTORE DUP1 PUSH0 DUP2 MSTORE POP PUSH2 0x18A5 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH32 0x0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH4 0x91DDADF4 PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL SWAP3 POP POP POP DUP1 ISZERO PUSH2 0x1264 JUMPI POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x1F RETURNDATASIZE SWAP1 DUP2 ADD PUSH1 0x1F NOT AND DUP3 ADD SWAP1 SWAP3 MSTORE PUSH2 0x1261 SWAP2 DUP2 ADD SWAP1 PUSH2 0x3E7E JUMP JUMPDEST PUSH1 0x1 JUMPDEST PUSH2 0xED6 JUMPI PUSH2 0xA00 PUSH2 0x1EAD JUMP JUMPDEST PUSH0 PUSH2 0x127C DUP5 DUP5 DUP5 PUSH2 0x1EB7 JUMP JUMPDEST SWAP1 POP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 PUSH2 0x1291 PUSH1 0xA PUSH2 0x1F4A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB AND SWAP1 POP SWAP1 JUMP JUMPDEST PUSH2 0x12A7 PUSH2 0x152A JUMP JUMPDEST PUSH2 0xA82 DUP2 PUSH2 0x1F8E JUMP JUMPDEST PUSH0 PUSH2 0x11E0 DUP6 DUP6 DUP6 DUP6 PUSH2 0x13D0 JUMP JUMPDEST PUSH0 PUSH1 0x1 PUSH2 0xA6B JUMP JUMPDEST PUSH0 PUSH2 0xA00 PUSH1 0x7 SLOAD SWAP1 JUMP JUMPDEST PUSH0 ADDRESS PUSH2 0x12D9 PUSH2 0x9ED JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x1300 JUMPI PUSH1 0x40 MLOAD PUSH4 0x7485328F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP PUSH4 0xBC197C81 PUSH1 0xE0 SHL SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD PUSH2 0x1346 SWAP1 PUSH1 0x1 PUSH1 0xD0 SHL DUP2 DIV PUSH4 0xFFFFFFFF AND SWAP1 PUSH1 0x1 PUSH1 0xA0 SHL SWAP1 DIV PUSH6 0xFFFFFFFFFFFF AND PUSH2 0x3E99 JUMP JUMPDEST PUSH6 0xFFFFFFFFFFFF AND SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x135C PUSH2 0x152A JUMP JUMPDEST PUSH0 PUSH0 DUP6 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP6 DUP6 DUP6 PUSH1 0x40 MLOAD PUSH2 0x1379 SWAP3 SWAP2 SWAP1 PUSH2 0x3EB7 JUMP JUMPDEST PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0x13B3 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x13B8 JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP2 POP SWAP2 POP PUSH2 0x13C7 DUP3 DUP3 PUSH2 0x1FF7 JUMP JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 DUP5 DUP5 DUP5 DUP5 PUSH1 0x40 MLOAD PUSH1 0x20 ADD PUSH2 0x13E8 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x3F59 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x1F NOT DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE DUP1 MLOAD PUSH1 0x20 SWAP1 SWAP2 ADD KECCAK256 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x1411 PUSH2 0x152A JUMP JUMPDEST PUSH2 0xA82 DUP2 PUSH2 0x2013 JUMP JUMPDEST PUSH0 PUSH2 0x127F DUP4 DUP4 PUSH2 0x1434 PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP2 ADD SWAP1 SWAP2 MSTORE PUSH0 DUP2 MSTORE SWAP1 JUMP JUMPDEST PUSH2 0x1EB7 JUMP JUMPDEST PUSH2 0x1441 PUSH2 0x152A JUMP JUMPDEST PUSH2 0xA82 DUP2 PUSH2 0x20AF JUMP JUMPDEST PUSH0 ADDRESS PUSH2 0x1454 PUSH2 0x9ED JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x147B JUMPI PUSH1 0x40 MLOAD PUSH4 0x7485328F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP PUSH4 0xF23A6E61 PUSH1 0xE0 SHL SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x2394E7A3 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH0 SWAP1 PUSH2 0xA6B SWAP1 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 AND SWAP1 PUSH4 0x8E539E8C SWAP1 PUSH1 0x24 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x14F6 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x151A SWAP2 SWAP1 PUSH2 0x3FA3 JUMP JUMPDEST PUSH2 0x1523 DUP5 PUSH2 0x102C JUMP JUMPDEST PUSH1 0x64 PUSH2 0x20F0 JUMP JUMPDEST CALLER PUSH2 0x1533 PUSH2 0x9ED JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x155C JUMPI PUSH1 0x40 MLOAD PUSH4 0x47096E47 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0xDFB JUMP JUMPDEST ADDRESS PUSH2 0x1565 PUSH2 0x9ED JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x15A1 JUMPI PUSH0 DUP1 CALLDATASIZE PUSH1 0x40 MLOAD PUSH2 0x1584 SWAP3 SWAP2 SWAP1 PUSH2 0x3EB7 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 SWAP1 POP JUMPDEST DUP1 PUSH2 0x159A PUSH1 0x5 PUSH2 0x21A0 JUMP JUMPDEST SUB PUSH2 0x158F JUMPI POP JUMPDEST JUMP JUMPDEST PUSH1 0x64 DUP1 DUP3 GT ISZERO PUSH2 0x15D0 JUMPI PUSH1 0x40 MLOAD PUSH4 0x243E5445 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x24 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x44 ADD PUSH2 0xDFB JUMP JUMPDEST PUSH0 PUSH2 0x15D9 PUSH2 0x1286 JUMP JUMPDEST SWAP1 POP PUSH2 0x15F8 PUSH2 0x15E6 PUSH2 0x11E9 JUMP JUMPDEST PUSH2 0x15EF DUP6 PUSH2 0x220D JUMP JUMPDEST PUSH1 0xA SWAP2 SWAP1 PUSH2 0x2244 JUMP JUMPDEST POP POP PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 ADD DUP6 SWAP1 MSTORE PUSH32 0x553476BF02EF2726E8CE5CED78D63E26E602E4A2257B1F559418E24B4633997 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 POP POP POP JUMP JUMPDEST PUSH0 DUP2 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x164B JUMPI PUSH2 0x164B PUSH2 0x3743 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xFF SWAP2 SWAP1 SWAP2 AND SHL SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH2 0x1665 DUP5 PUSH2 0xDAB JUMP JUMPDEST SWAP1 POP PUSH0 DUP4 PUSH2 0x1672 DUP4 PUSH2 0x1638 JUMP JUMPDEST AND SUB PUSH2 0x127F JUMPI DUP4 DUP2 DUP5 PUSH1 0x40 MLOAD PUSH4 0x31B75E4D PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xDFB SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x3FBA JUMP JUMPDEST PUSH0 PUSH2 0x108F DUP7 DUP7 DUP7 DUP7 DUP7 PUSH2 0x225E JUMP JUMPDEST DUP2 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x80 SHL SUB PUSH1 0x1 PUSH1 0x80 SHL DUP3 DIV DUP2 AND SWAP2 DUP2 AND PUSH1 0x1 DUP4 ADD SWAP1 SWAP2 AND SUB PUSH2 0x16D1 JUMPI PUSH2 0x16D1 PUSH1 0x41 PUSH2 0x23EF JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0x80 SHL SUB DUP1 DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x1 DUP1 DUP7 ADD PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 SWAP2 KECCAK256 SWAP4 SWAP1 SWAP4 SSTORE DUP4 SLOAD SWAP2 SWAP1 SWAP3 ADD DUP3 AND PUSH1 0x1 PUSH1 0x80 SHL MUL SWAP2 AND OR SWAP1 SSTORE JUMP JUMPDEST PUSH2 0x1713 DUP6 DUP6 DUP6 DUP6 DUP6 PUSH2 0x2400 JUMP JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH2 0x1725 DUP4 PUSH2 0x2490 JUMP JUMPDEST SWAP1 POP PUSH1 0x5 DUP2 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x173B JUMPI PUSH2 0x173B PUSH2 0x3743 JUMP JUMPDEST EQ PUSH2 0x1746 JUMPI SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH0 DUP4 DUP2 MSTORE PUSH1 0xC PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 SLOAD PUSH1 0xB SLOAD SWAP2 MLOAD PUSH4 0x2C258A9F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE SWAP1 SWAP2 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP1 PUSH4 0x584B153E SWAP1 PUSH1 0x24 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x179C JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x17C0 SWAP2 SWAP1 PUSH2 0x3FDC JUMP JUMPDEST ISZERO PUSH2 0x17CF JUMPI POP PUSH1 0x5 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0xB SLOAD PUSH1 0x40 MLOAD PUSH4 0x2AB0F529 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP1 PUSH4 0x2AB0F529 SWAP1 PUSH1 0x24 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x1816 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x183A SWAP2 SWAP1 PUSH2 0x3FDC JUMP JUMPDEST ISZERO PUSH2 0x1849 JUMPI POP PUSH1 0x7 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST POP PUSH1 0x2 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 DUP1 PUSH2 0x185E DUP5 PUSH2 0xDAB JUMP JUMPDEST PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x186F JUMPI PUSH2 0x186F PUSH2 0x3743 JUMP JUMPDEST EQ DUP1 ISZERO PUSH2 0x127F JUMPI POP POP PUSH0 SWAP2 DUP3 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 SWAP2 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP2 DUP3 AND SWAP2 AND EQ SWAP1 JUMP JUMPDEST PUSH0 PUSH2 0x11E0 DUP6 DUP6 DUP6 DUP6 PUSH2 0x25C1 JUMP JUMPDEST PUSH0 PUSH2 0x11E0 DUP6 DUP6 DUP6 DUP6 PUSH2 0x18C1 PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP2 ADD SWAP1 SWAP2 MSTORE PUSH0 DUP2 MSTORE SWAP1 JUMP JUMPDEST PUSH2 0x1993 JUMP JUMPDEST PUSH0 PUSH2 0xE10 DUP6 PUSH2 0x198D PUSH32 0x3E83946653575F9A39005E1545185629E92736B7528AB20CA3816F315424A811 DUP11 DUP11 DUP11 PUSH2 0x1918 DUP13 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP2 ADD SWAP1 SWAP2 SSTORE SWAP1 JUMP JUMPDEST DUP12 MLOAD PUSH1 0x20 DUP1 DUP15 ADD SWAP2 SWAP1 SWAP2 KECCAK256 DUP13 MLOAD DUP14 DUP4 ADD KECCAK256 PUSH1 0x40 MLOAD PUSH2 0x1972 SWAP9 SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 ADD SWAP7 DUP8 MSTORE PUSH1 0x20 DUP8 ADD SWAP6 SWAP1 SWAP6 MSTORE PUSH1 0xFF SWAP4 SWAP1 SWAP4 AND PUSH1 0x40 DUP7 ADD MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP2 SWAP1 SWAP2 AND PUSH1 0x60 DUP6 ADD MSTORE PUSH1 0x80 DUP5 ADD MSTORE PUSH1 0xA0 DUP4 ADD MSTORE PUSH1 0xC0 DUP3 ADD MSTORE PUSH1 0xE0 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 PUSH2 0x2658 JUMP JUMPDEST DUP5 PUSH2 0x2684 JUMP JUMPDEST PUSH0 PUSH2 0x19A2 DUP7 PUSH2 0xB75 PUSH1 0x1 PUSH2 0x1638 JUMP JUMPDEST POP PUSH0 PUSH2 0x19B7 DUP7 PUSH2 0x19B1 DUP10 PUSH2 0xD8B JUMP JUMPDEST DUP6 PUSH2 0x1EB7 JUMP JUMPDEST SWAP1 POP PUSH0 PUSH2 0x19C7 DUP9 DUP9 DUP9 DUP6 DUP9 PUSH2 0x26F4 JUMP JUMPDEST SWAP1 POP DUP4 MLOAD PUSH0 SUB PUSH2 0x1A1D JUMPI DUP7 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0xB8E138887D0AA13BAB447E82DE9D5C1777041ECD21CA36BA824FF1E6C07DDDA4 DUP10 DUP9 DUP5 DUP10 PUSH1 0x40 MLOAD PUSH2 0x1A10 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x3FFB JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 PUSH2 0xE10 JUMP JUMPDEST DUP7 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0xE2BABFBAC5889A709B63BB7F598B324E08BC5A4FB9EC647FB3CBC9EC07EB8712 DUP10 DUP9 DUP5 DUP10 DUP10 PUSH1 0x40 MLOAD PUSH2 0x1A5E SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x4022 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH2 0x1A7D DUP6 PUSH2 0x27F0 JUMP JUMPDEST SWAP3 POP SWAP3 POP POP DUP4 DUP3 PUSH6 0xFFFFFFFFFFFF AND GT ISZERO PUSH2 0x1AAA JUMPI PUSH2 0x1AA5 PUSH2 0x1A9E DUP6 PUSH2 0x2848 JUMP JUMPDEST DUP7 SWAP1 PUSH2 0x287A JUMP JUMPDEST PUSH2 0x1AAC JUMP JUMPDEST DUP1 JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB AND SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x8 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH6 0xFFFFFFFFFFFF SWAP3 DUP4 AND DUP2 MSTORE SWAP2 DUP4 AND PUSH1 0x20 DUP4 ADD MSTORE PUSH32 0xC565B045403DC03C2EEA82B81A0465EDAD9E2E7FC4D97E11421C209DA93D7A93 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH1 0x8 DUP1 SLOAD PUSH6 0xFFFFFFFFFFFF NOT AND PUSH6 0xFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST DUP1 MLOAD PUSH0 SWAP1 PUSH1 0x34 DUP2 LT ISZERO PUSH2 0x1B3B JUMPI PUSH1 0x1 SWAP2 POP POP PUSH2 0xA6B JUMP JUMPDEST PUSH1 0x13 NOT DUP2 DUP5 ADD ADD MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xB0 SHL SUB NOT DUP2 AND PUSH10 0x2370726F706F7365723D PUSH1 0xB0 SHL EQ PUSH2 0x1B6C JUMPI PUSH1 0x1 SWAP3 POP POP POP PUSH2 0xA6B JUMP JUMPDEST PUSH0 PUSH0 PUSH2 0x1B7C DUP7 PUSH1 0x2A DUP7 SUB DUP7 PUSH2 0x291C JUMP JUMPDEST SWAP2 POP SWAP2 POP DUP2 ISZERO DUP1 PUSH2 0xE10 JUMPI POP DUP7 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP2 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH2 0x1BBC DUP7 DUP7 DUP7 DUP7 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 PUSH2 0x12B0 JUMP JUMPDEST SWAP1 POP DUP5 MLOAD DUP7 MLOAD EQ ISZERO DUP1 PUSH2 0x1BD1 JUMPI POP DUP4 MLOAD DUP7 MLOAD EQ ISZERO JUMPDEST DUP1 PUSH2 0x1BDB JUMPI POP DUP6 MLOAD ISZERO JUMPDEST ISZERO PUSH2 0x1C10 JUMPI DUP6 MLOAD DUP5 MLOAD DUP7 MLOAD PUSH1 0x40 MLOAD PUSH4 0x447B05D PUSH1 0xE4 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD SWAP4 SWAP1 SWAP4 MSTORE PUSH1 0x24 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0xDFB JUMP JUMPDEST PUSH0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0x1 PUSH1 0xA0 SHL SWAP1 DIV PUSH6 0xFFFFFFFFFFFF AND ISZERO PUSH2 0x1C59 JUMPI DUP1 PUSH2 0x1C3C DUP3 PUSH2 0xDAB JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x31B75E4D PUSH1 0xE0 SHL DUP2 MSTORE PUSH2 0xDFB SWAP3 SWAP2 SWAP1 PUSH0 SWAP1 PUSH1 0x4 ADD PUSH2 0x3FBA JUMP JUMPDEST PUSH0 PUSH2 0x1C6B PUSH1 0x8 SLOAD PUSH6 0xFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH2 0x1C73 PUSH2 0x11E9 JUMP JUMPDEST PUSH6 0xFFFFFFFFFFFF AND PUSH2 0x1C85 SWAP2 SWAP1 PUSH2 0x405B JUMP JUMPDEST SWAP1 POP PUSH0 PUSH2 0x1C9F PUSH1 0x8 SLOAD PUSH4 0xFFFFFFFF PUSH1 0x1 PUSH1 0x30 SHL SWAP1 SWAP2 DIV AND SWAP1 JUMP JUMPDEST PUSH0 DUP5 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 AND OR DUP2 SSTORE SWAP1 SWAP2 POP PUSH2 0x1CD1 DUP4 PUSH2 0x2848 JUMP JUMPDEST DUP2 SLOAD PUSH6 0xFFFFFFFFFFFF SWAP2 SWAP1 SWAP2 AND PUSH1 0x1 PUSH1 0xA0 SHL MUL PUSH6 0xFFFFFFFFFFFF PUSH1 0xA0 SHL NOT SWAP1 SWAP2 AND OR DUP2 SSTORE PUSH2 0x1CFE DUP3 PUSH2 0x29C5 JUMP JUMPDEST DUP2 SLOAD PUSH4 0xFFFFFFFF SWAP2 SWAP1 SWAP2 AND PUSH1 0x1 PUSH1 0xD0 SHL MUL PUSH4 0xFFFFFFFF PUSH1 0xD0 SHL NOT SWAP1 SWAP2 AND OR DUP2 SSTORE DUP9 MLOAD PUSH32 0x7D84A6263AE0D98D3329BD7B46BB4E8D6F98CD35A7ADB45C274C8B7FD5EBD5E0 SWAP1 DUP6 SWAP1 DUP8 SWAP1 DUP13 SWAP1 DUP13 SWAP1 PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x1D61 JUMPI PUSH2 0x1D61 PUSH2 0x3427 JUMP JUMPDEST PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x1D94 JUMPI DUP2 PUSH1 0x20 ADD JUMPDEST PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 SWAP1 SUB SWAP1 DUP2 PUSH2 0x1D7F JUMPI SWAP1 POP JUMPDEST POP DUP13 DUP10 PUSH2 0x1DA1 DUP11 DUP3 PUSH2 0x405B JUMP JUMPDEST DUP15 PUSH1 0x40 MLOAD PUSH2 0x1DB7 SWAP10 SWAP9 SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x406E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 POP POP POP SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0xA00 PUSH32 0x0 PUSH0 PUSH2 0x29F5 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xA00 PUSH32 0x0 PUSH1 0x1 PUSH2 0x29F5 JUMP JUMPDEST PUSH0 PUSH2 0x11E0 DUP4 PUSH2 0x198D PUSH32 0xF2AAD550CF55F045CB27E9C559F9889FDFB6E6CDAA032301D6EA397784AE51D7 DUP9 DUP9 DUP9 PUSH2 0x1E76 DUP11 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP2 ADD SWAP1 SWAP2 SSTORE SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP2 ADD SWAP7 SWAP1 SWAP7 MSTORE DUP6 ADD SWAP4 SWAP1 SWAP4 MSTORE PUSH1 0xFF SWAP1 SWAP2 AND PUSH1 0x60 DUP5 ADD MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x80 DUP4 ADD MSTORE PUSH1 0xA0 DUP3 ADD MSTORE PUSH1 0xC0 ADD PUSH2 0x1972 JUMP JUMPDEST PUSH0 PUSH2 0xA00 NUMBER PUSH2 0x2848 JUMP JUMPDEST PUSH0 PUSH32 0x0 PUSH1 0x40 MLOAD PUSH4 0x748D635 PUSH1 0xE3 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE PUSH1 0x24 DUP3 ADD DUP7 SWAP1 MSTORE SWAP2 SWAP1 SWAP2 AND SWAP1 PUSH4 0x3A46B1A8 SWAP1 PUSH1 0x44 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x1F26 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x127C SWAP2 SWAP1 PUSH2 0x3FA3 JUMP JUMPDEST DUP1 SLOAD PUSH0 SWAP1 DUP1 ISZERO PUSH2 0x1F86 JUMPI PUSH2 0x1F70 DUP4 PUSH2 0x1F63 PUSH1 0x1 DUP5 PUSH2 0x4149 JUMP JUMPDEST PUSH0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SWAP1 JUMP JUMPDEST SLOAD PUSH1 0x1 PUSH1 0x30 SHL SWAP1 DIV PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB AND PUSH2 0x127F JUMP JUMPDEST PUSH0 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0xB SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP3 DUP4 AND DUP2 MSTORE SWAP2 DUP4 AND PUSH1 0x20 DUP4 ADD MSTORE PUSH32 0x8F74EA46EF7894F65EABFB5E6E695DE773A000B47C529AB559178069B226401 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH1 0xB DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x60 DUP3 PUSH2 0x200C JUMPI PUSH2 0x2007 DUP3 PUSH2 0x2A9E JUMP JUMPDEST PUSH2 0xA6B JUMP JUMPDEST POP DUP1 PUSH2 0xA6B JUMP JUMPDEST DUP1 PUSH4 0xFFFFFFFF AND PUSH0 SUB PUSH2 0x203B JUMPI PUSH1 0x40 MLOAD PUSH4 0xF1CFBF05 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0xDFB JUMP JUMPDEST PUSH1 0x8 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH4 0xFFFFFFFF PUSH1 0x1 PUSH1 0x30 SHL SWAP1 SWAP4 DIV DUP4 AND DUP2 MSTORE SWAP2 DUP4 AND PUSH1 0x20 DUP4 ADD MSTORE PUSH32 0x7E3F7F0708A84DE9203036ABAA450DCCC85AD5FF52F78C170F3EDB55CF5E8828 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH1 0x8 DUP1 SLOAD PUSH4 0xFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x1 PUSH1 0x30 SHL MUL PUSH10 0xFFFFFFFF000000000000 NOT SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x7 SLOAD PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP4 SWAP1 MSTORE PUSH32 0xCCB45DA8D5717E6C4544694297C4BA5CF151D455C9BB0ED4FC7A38411BC05461 SWAP2 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH1 0x7 SSTORE JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH2 0x20FD DUP7 DUP7 PUSH2 0x2AC6 JUMP JUMPDEST SWAP2 POP SWAP2 POP DUP2 PUSH0 SUB PUSH2 0x2121 JUMPI DUP4 DUP2 DUP2 PUSH2 0x2117 JUMPI PUSH2 0x2117 PUSH2 0x415C JUMP JUMPDEST DIV SWAP3 POP POP POP PUSH2 0x127F JUMP JUMPDEST DUP2 DUP5 GT PUSH2 0x2138 JUMPI PUSH2 0x2138 PUSH1 0x3 DUP6 ISZERO MUL PUSH1 0x11 XOR PUSH2 0x23EF JUMP JUMPDEST PUSH0 DUP5 DUP7 DUP9 MULMOD PUSH0 DUP7 DUP2 SUB DUP8 AND SWAP7 DUP8 SWAP1 DIV SWAP7 PUSH1 0x2 PUSH1 0x3 DUP10 MUL DUP2 XOR DUP1 DUP11 MUL DUP3 SUB MUL DUP1 DUP11 MUL DUP3 SUB MUL DUP1 DUP11 MUL DUP3 SUB MUL DUP1 DUP11 MUL DUP3 SUB MUL DUP1 DUP11 MUL DUP3 SUB MUL DUP1 DUP11 MUL SWAP1 SWAP2 SUB MUL SWAP2 DUP2 SWAP1 SUB DUP2 SWAP1 DIV PUSH1 0x1 ADD DUP6 DUP5 GT SWAP1 SWAP7 SUB SWAP6 SWAP1 SWAP6 MUL SWAP2 SWAP1 SWAP4 SUB SWAP4 SWAP1 SWAP4 DIV SWAP3 SWAP1 SWAP3 OR MUL SWAP2 POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP1 SLOAD PUSH0 SWAP1 PUSH1 0x1 PUSH1 0x1 PUSH1 0x80 SHL SUB DUP1 DUP3 AND SWAP2 PUSH1 0x1 PUSH1 0x80 SHL SWAP1 DIV AND DUP2 SUB PUSH2 0x21C8 JUMPI PUSH2 0x21C8 PUSH1 0x31 PUSH2 0x23EF JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0x80 SHL SUB DUP2 DUP2 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x1 DUP6 DUP2 ADD PUSH1 0x20 MSTORE PUSH1 0x40 DUP3 KECCAK256 DUP1 SLOAD SWAP3 SWAP1 SSTORE DUP6 SLOAD PUSH16 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND SWAP4 ADD SWAP1 SWAP2 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SWAP3 SSTORE POP SWAP1 JUMP JUMPDEST PUSH0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB DUP3 GT ISZERO PUSH2 0x2240 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6DFCC65 PUSH1 0xE4 SHL DUP2 MSTORE PUSH1 0xD0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x44 ADD PUSH2 0xDFB JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH0 DUP1 PUSH2 0x2251 DUP6 DUP6 DUP6 PUSH2 0x2AE2 JUMP JUMPDEST SWAP2 POP SWAP2 POP JUMPDEST SWAP4 POP SWAP4 SWAP2 POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH1 0xB PUSH0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH4 0xF27A0C92 PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x22B0 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x22D4 SWAP2 SWAP1 PUSH2 0x3FA3 JUMP JUMPDEST SWAP1 POP PUSH0 ADDRESS PUSH1 0x60 SHL PUSH12 0xFFFFFFFFFFFFFFFFFFFFFFFF NOT AND DUP5 XOR PUSH1 0xB SLOAD PUSH1 0x40 MLOAD PUSH4 0xB1C5F427 PUSH1 0xE0 SHL DUP2 MSTORE SWAP2 SWAP3 POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP1 PUSH4 0xB1C5F427 SWAP1 PUSH2 0x2325 SWAP1 DUP11 SWAP1 DUP11 SWAP1 DUP11 SWAP1 PUSH0 SWAP1 DUP9 SWAP1 PUSH1 0x4 ADD PUSH2 0x4170 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x2340 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x2364 SWAP2 SWAP1 PUSH2 0x3FA3 JUMP JUMPDEST PUSH0 DUP10 DUP2 MSTORE PUSH1 0xC PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP3 SWAP1 SWAP3 SSTORE PUSH1 0xB SLOAD SWAP2 MLOAD PUSH4 0x8F2A0BB PUSH1 0xE4 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP3 AND SWAP2 PUSH4 0x8F2A0BB0 SWAP2 PUSH2 0x23AE SWAP2 DUP12 SWAP2 DUP12 SWAP2 DUP12 SWAP2 SWAP1 DUP9 SWAP1 DUP11 SWAP1 PUSH1 0x4 ADD PUSH2 0x41BD JUMP JUMPDEST PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x23C5 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x23D7 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH2 0xFD8 DUP3 TIMESTAMP PUSH2 0x23EA SWAP2 SWAP1 PUSH2 0x405B JUMP JUMPDEST PUSH2 0x2848 JUMP JUMPDEST PUSH4 0x4E487B71 PUSH0 MSTORE DUP1 PUSH1 0x20 MSTORE PUSH1 0x24 PUSH1 0x1C REVERT JUMPDEST PUSH1 0xB SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH4 0xE38335E5 CALLVALUE DUP7 DUP7 DUP7 PUSH0 ADDRESS PUSH1 0x60 SHL PUSH12 0xFFFFFFFFFFFFFFFFFFFFFFFF NOT AND DUP9 XOR PUSH1 0x40 MLOAD DUP8 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x244B SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x4170 JUMP JUMPDEST PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x2462 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x2474 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP PUSH0 SWAP7 DUP8 MSTORE POP POP PUSH1 0xC PUSH1 0x20 MSTORE POP POP PUSH1 0x40 DUP4 KECCAK256 SWAP3 SWAP1 SWAP3 SSTORE POP POP JUMP JUMPDEST PUSH0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH1 0xFF PUSH1 0x1 PUSH1 0xF0 SHL DUP3 DIV DUP2 AND SWAP2 PUSH1 0x1 PUSH1 0xF8 SHL SWAP1 DIV AND DUP2 ISZERO PUSH2 0x24C4 JUMPI POP PUSH1 0x7 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP1 ISZERO PUSH2 0x24D5 JUMPI POP PUSH1 0x2 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH0 PUSH2 0x24DF DUP7 PUSH2 0xD8B JUMP JUMPDEST SWAP1 POP DUP1 PUSH0 SUB PUSH2 0x2504 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6AD06075 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP8 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0xDFB JUMP JUMPDEST PUSH0 PUSH2 0x250D PUSH2 0x11E9 JUMP JUMPDEST PUSH6 0xFFFFFFFFFFFF AND SWAP1 POP DUP1 DUP3 LT PUSH2 0x252A JUMPI POP PUSH0 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH2 0x2534 DUP9 PUSH2 0x1312 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 LT PUSH2 0x254B JUMPI POP PUSH1 0x1 SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0x2554 DUP9 PUSH2 0x2C32 JUMP JUMPDEST ISZERO DUP1 PUSH2 0x2573 JUMPI POP PUSH0 DUP9 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 SWAP1 SWAP2 ADD SLOAD GT ISZERO JUMPDEST ISZERO PUSH2 0x2586 JUMPI POP PUSH1 0x3 SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 DUP9 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x1 ADD SLOAD PUSH6 0xFFFFFFFFFFFF AND PUSH0 SUB PUSH2 0x25B3 JUMPI POP PUSH1 0x4 SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST POP PUSH1 0x5 SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH2 0x25CF DUP7 DUP7 DUP7 DUP7 PUSH2 0x2C68 JUMP JUMPDEST PUSH0 DUP2 DUP2 MSTORE PUSH1 0xC PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP2 POP DUP1 ISZERO PUSH2 0xC19 JUMPI PUSH1 0xB SLOAD PUSH1 0x40 MLOAD PUSH4 0xC4D252F5 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP1 PUSH4 0xC4D252F5 SWAP1 PUSH1 0x24 ADD PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x2629 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x263B JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP PUSH0 DUP4 DUP2 MSTORE PUSH1 0xC PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SSTORE POP POP SWAP1 POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH0 PUSH2 0xA6B PUSH2 0x2664 PUSH2 0x2D17 JUMP JUMPDEST DUP4 PUSH1 0x40 MLOAD PUSH2 0x1901 PUSH1 0xF0 SHL DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x22 DUP3 ADD MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH0 DUP4 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EXTCODESIZE PUSH0 SUB PUSH2 0x26E2 JUMPI PUSH0 PUSH0 PUSH2 0x26A2 DUP6 DUP6 PUSH2 0x2E40 JUMP JUMPDEST POP SWAP1 SWAP3 POP SWAP1 POP PUSH0 DUP2 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0x26BB JUMPI PUSH2 0x26BB PUSH2 0x3743 JUMP JUMPDEST EQ DUP1 ISZERO PUSH2 0x26D9 JUMPI POP DUP6 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP3 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ JUMPDEST SWAP3 POP POP POP PUSH2 0x127F JUMP JUMPDEST PUSH2 0x26ED DUP5 DUP5 DUP5 PUSH2 0x2E89 JUMP JUMPDEST SWAP1 POP PUSH2 0x127F JUMP JUMPDEST PUSH0 DUP6 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP9 AND DUP5 MSTORE PUSH1 0x3 DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x2746 JUMPI PUSH1 0x40 MLOAD PUSH4 0x71C6AF49 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0xDFB JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 DUP3 ADD PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x1 OR SWAP1 SSTORE PUSH1 0xFF DUP6 AND PUSH2 0x278F JUMPI DUP4 DUP2 PUSH0 ADD PUSH0 DUP3 DUP3 SLOAD PUSH2 0x2784 SWAP2 SWAP1 PUSH2 0x405B JUMP JUMPDEST SWAP1 SWAP2 SSTORE POP PUSH2 0x27E5 SWAP1 POP JUMP JUMPDEST PUSH0 NOT PUSH1 0xFF DUP7 AND ADD PUSH2 0x27AD JUMPI DUP4 DUP2 PUSH1 0x1 ADD PUSH0 DUP3 DUP3 SLOAD PUSH2 0x2784 SWAP2 SWAP1 PUSH2 0x405B JUMP JUMPDEST PUSH1 0x1 NOT PUSH1 0xFF DUP7 AND ADD PUSH2 0x27CC JUMPI DUP4 DUP2 PUSH1 0x2 ADD PUSH0 DUP3 DUP3 SLOAD PUSH2 0x2784 SWAP2 SWAP1 PUSH2 0x405B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x3599BE1 PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP SWAP2 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST DUP1 SLOAD PUSH0 SWAP1 DUP2 SWAP1 DUP2 SWAP1 DUP1 DUP3 SUB PUSH2 0x280E JUMPI PUSH0 PUSH0 PUSH0 SWAP4 POP SWAP4 POP SWAP4 POP POP PUSH2 0xEF9 JUMP JUMPDEST PUSH0 PUSH2 0x281E DUP7 PUSH2 0x1F63 PUSH1 0x1 DUP6 PUSH2 0x4149 JUMP JUMPDEST SLOAD PUSH1 0x1 SWAP6 POP PUSH6 0xFFFFFFFFFFFF DUP2 AND SWAP5 POP PUSH1 0x1 PUSH1 0x30 SHL SWAP1 DIV PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB AND SWAP3 POP PUSH2 0xEF9 SWAP2 POP POP JUMP JUMPDEST PUSH0 PUSH6 0xFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x2240 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6DFCC65 PUSH1 0xE4 SHL DUP2 MSTORE PUSH1 0x30 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x44 ADD PUSH2 0xDFB JUMP JUMPDEST DUP2 SLOAD PUSH0 SWAP1 DUP2 DUP2 PUSH1 0x5 DUP2 GT ISZERO PUSH2 0x28D6 JUMPI PUSH0 PUSH2 0x2893 DUP5 PUSH2 0x2F5F JUMP JUMPDEST PUSH2 0x289D SWAP1 DUP6 PUSH2 0x4149 JUMP JUMPDEST PUSH0 DUP9 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 SWAP1 SWAP2 POP DUP2 ADD SLOAD PUSH6 0xFFFFFFFFFFFF SWAP1 DUP2 AND SWAP1 DUP8 AND LT ISZERO PUSH2 0x28C6 JUMPI DUP1 SWAP2 POP PUSH2 0x28D4 JUMP JUMPDEST PUSH2 0x28D1 DUP2 PUSH1 0x1 PUSH2 0x405B JUMP JUMPDEST SWAP3 POP JUMPDEST POP JUMPDEST PUSH0 PUSH2 0x28E3 DUP8 DUP8 DUP6 DUP6 PUSH2 0x30B7 JUMP JUMPDEST SWAP1 POP DUP1 ISZERO PUSH2 0x2910 JUMPI PUSH2 0x28FA DUP8 PUSH2 0x1F63 PUSH1 0x1 DUP5 PUSH2 0x4149 JUMP JUMPDEST SLOAD PUSH1 0x1 PUSH1 0x30 SHL SWAP1 DIV PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB AND PUSH2 0xE10 JUMP JUMPDEST POP PUSH0 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 DUP5 MLOAD DUP4 GT DUP1 PUSH2 0x292C JUMPI POP DUP3 DUP5 GT JUMPDEST ISZERO PUSH2 0x293B JUMPI POP PUSH0 SWAP1 POP DUP1 PUSH2 0x2256 JUMP JUMPDEST PUSH0 PUSH2 0x2947 DUP6 PUSH1 0x1 PUSH2 0x405B JUMP JUMPDEST DUP5 GT DUP1 ISZERO PUSH2 0x296F JUMPI POP PUSH2 0x60F PUSH1 0xF3 SHL PUSH2 0x2963 DUP8 DUP8 ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xF0 SHL SUB NOT AND EQ JUMPDEST SWAP1 POP PUSH0 PUSH2 0x297F DUP3 ISZERO ISZERO PUSH1 0x2 PUSH2 0x4214 JUMP JUMPDEST PUSH2 0x298A SWAP1 PUSH1 0x28 PUSH2 0x405B JUMP JUMPDEST SWAP1 POP DUP1 PUSH2 0x2997 DUP8 DUP8 PUSH2 0x4149 JUMP JUMPDEST SUB PUSH2 0x29B8 JUMPI PUSH0 PUSH0 PUSH2 0x29A9 DUP10 DUP10 DUP10 PUSH2 0x3116 JUMP JUMPDEST SWAP1 SWAP7 POP SWAP5 POP PUSH2 0x2256 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 SWAP4 POP SWAP4 POP POP POP PUSH2 0x2256 JUMP JUMPDEST PUSH0 PUSH4 0xFFFFFFFF DUP3 GT ISZERO PUSH2 0x2240 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6DFCC65 PUSH1 0xE4 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x44 ADD PUSH2 0xDFB JUMP JUMPDEST PUSH1 0x60 PUSH1 0xFF DUP4 EQ PUSH2 0x2A0F JUMPI PUSH2 0x2A08 DUP4 PUSH2 0x31D7 JUMP JUMPDEST SWAP1 POP PUSH2 0xA6B JUMP JUMPDEST DUP2 DUP1 SLOAD PUSH2 0x2A1B SWAP1 PUSH2 0x3D8C JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x2A47 SWAP1 PUSH2 0x3D8C JUMP JUMPDEST DUP1 ISZERO PUSH2 0x2A92 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x2A69 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2A92 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2A75 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0xA6B JUMP JUMPDEST DUP1 MLOAD ISZERO PUSH2 0x2AAD JUMPI DUP1 MLOAD PUSH1 0x20 DUP3 ADD REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xD6BDA275 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 DUP1 PUSH0 NOT DUP4 DUP6 MULMOD SWAP4 SWAP1 SWAP3 MUL DUP1 DUP5 LT SWAP4 DUP2 SWAP1 SUB SWAP4 SWAP1 SWAP4 SUB SWAP4 SWAP2 POP POP JUMP JUMPDEST DUP3 SLOAD PUSH0 SWAP1 DUP2 SWAP1 DUP1 ISZERO PUSH2 0x2BD8 JUMPI PUSH0 PUSH2 0x2AFE DUP8 PUSH2 0x1F63 PUSH1 0x1 DUP6 PUSH2 0x4149 JUMP JUMPDEST DUP1 SLOAD SWAP1 SWAP2 POP PUSH6 0xFFFFFFFFFFFF DUP1 DUP3 AND SWAP2 PUSH1 0x1 PUSH1 0x30 SHL SWAP1 DIV PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB AND SWAP1 DUP9 AND DUP3 GT ISZERO PUSH2 0x2B41 JUMPI PUSH1 0x40 MLOAD PUSH4 0x2520601D PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP8 PUSH6 0xFFFFFFFFFFFF AND DUP3 PUSH6 0xFFFFFFFFFFFF AND SUB PUSH2 0x2B7A JUMPI DUP3 SLOAD PUSH6 0xFFFFFFFFFFFF AND PUSH1 0x1 PUSH1 0x30 SHL PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB DUP10 AND MUL OR DUP4 SSTORE PUSH2 0x2BCA JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH6 0xFFFFFFFFFFFF DUP1 DUP11 AND DUP3 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB DUP1 DUP11 AND PUSH1 0x20 DUP1 DUP6 ADD SWAP2 DUP3 MSTORE DUP14 SLOAD PUSH1 0x1 DUP2 ADD DUP16 SSTORE PUSH0 DUP16 DUP2 MSTORE SWAP2 SWAP1 SWAP2 KECCAK256 SWAP5 MLOAD SWAP2 MLOAD SWAP1 SWAP3 AND PUSH1 0x1 PUSH1 0x30 SHL MUL SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP2 ADD SSTORE JUMPDEST SWAP5 POP DUP6 SWAP4 POP PUSH2 0x2256 SWAP3 POP POP POP JUMP JUMPDEST POP POP PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH6 0xFFFFFFFFFFFF DUP1 DUP6 AND DUP3 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xD0 SHL SUB DUP1 DUP6 AND PUSH1 0x20 DUP1 DUP6 ADD SWAP2 DUP3 MSTORE DUP9 SLOAD PUSH1 0x1 DUP2 ADD DUP11 SSTORE PUSH0 DUP11 DUP2 MSTORE SWAP2 DUP3 KECCAK256 SWAP6 MLOAD SWAP3 MLOAD SWAP1 SWAP4 AND PUSH1 0x1 PUSH1 0x30 SHL MUL SWAP2 SWAP1 SWAP4 AND OR SWAP3 ADD SWAP2 SWAP1 SWAP2 SSTORE SWAP1 POP DUP2 PUSH2 0x2256 JUMP JUMPDEST PUSH0 DUP2 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x2 DUP2 ADD SLOAD PUSH1 0x1 DUP3 ADD SLOAD PUSH2 0x2C53 SWAP2 SWAP1 PUSH2 0x405B JUMP JUMPDEST PUSH2 0x2C5F PUSH2 0x9B6 DUP6 PUSH2 0xD8B JUMP JUMPDEST GT ISZERO SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH2 0x2C76 DUP7 DUP7 DUP7 DUP7 PUSH2 0x12B0 JUMP JUMPDEST SWAP1 POP PUSH2 0x2CC4 DUP2 PUSH2 0x2C86 PUSH1 0x7 PUSH2 0x1638 JUMP JUMPDEST PUSH2 0x2C90 PUSH1 0x6 PUSH2 0x1638 JUMP JUMPDEST PUSH2 0x2C9A PUSH1 0x2 PUSH2 0x1638 JUMP JUMPDEST PUSH1 0x1 PUSH2 0x2CA7 PUSH1 0x7 DUP3 PUSH2 0x422B JUMP JUMPDEST PUSH2 0x2CB2 SWAP1 PUSH1 0x2 PUSH2 0x431F JUMP JUMPDEST PUSH2 0x2CBC SWAP2 SWAP1 PUSH2 0x4149 JUMP JUMPDEST XOR XOR XOR PUSH2 0x165A JUMP JUMPDEST POP PUSH0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xF8 SHL SUB AND PUSH1 0x1 PUSH1 0xF8 SHL OR SWAP1 SSTORE MLOAD PUSH32 0x789CF55BE980739DAD1D0699B93B58E806B51C9D96619BFA8FE0A28ABAA7B30C SWAP1 PUSH2 0xD7A SWAP1 DUP4 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH0 ADDRESS PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 AND EQ DUP1 ISZERO PUSH2 0x2D6F JUMPI POP PUSH32 0x0 CHAINID EQ JUMPDEST ISZERO PUSH2 0x2D99 JUMPI POP PUSH32 0x0 SWAP1 JUMP JUMPDEST PUSH2 0xA00 PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x0 SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x0 PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH0 PUSH0 PUSH0 DUP4 MLOAD PUSH1 0x41 SUB PUSH2 0x2E77 JUMPI PUSH1 0x20 DUP5 ADD MLOAD PUSH1 0x40 DUP6 ADD MLOAD PUSH1 0x60 DUP7 ADD MLOAD PUSH0 BYTE PUSH2 0x2E69 DUP9 DUP3 DUP6 DUP6 PUSH2 0x3214 JUMP JUMPDEST SWAP6 POP SWAP6 POP SWAP6 POP POP POP POP PUSH2 0x2E82 JUMP JUMPDEST POP POP DUP2 MLOAD PUSH0 SWAP2 POP PUSH1 0x2 SWAP1 JUMPDEST SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH0 PUSH0 PUSH0 DUP6 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP6 DUP6 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x2EA9 SWAP3 SWAP2 SWAP1 PUSH2 0x432D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x1F NOT DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xE0 SHL SUB AND PUSH4 0xB135D3F PUSH1 0xE1 SHL OR SWAP1 MSTORE MLOAD PUSH2 0x2EDE SWAP2 SWAP1 PUSH2 0x4345 JUMP JUMPDEST PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 GAS STATICCALL SWAP2 POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0x2F16 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x2F1B JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP2 POP SWAP2 POP DUP2 DUP1 ISZERO PUSH2 0x2F2F JUMPI POP PUSH1 0x20 DUP2 MLOAD LT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x108F JUMPI POP DUP1 MLOAD PUSH4 0xB135D3F PUSH1 0xE1 SHL SWAP1 PUSH2 0x2F54 SWAP1 DUP4 ADD PUSH1 0x20 SWAP1 DUP2 ADD SWAP1 DUP5 ADD PUSH2 0x3FA3 JUMP JUMPDEST EQ SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x1 DUP3 GT PUSH2 0x2F6C JUMPI POP SWAP1 JUMP JUMPDEST DUP2 PUSH1 0x1 PUSH1 0x1 PUSH1 0x80 SHL DUP3 LT PUSH2 0x2F85 JUMPI PUSH1 0x80 SWAP2 SWAP1 SWAP2 SHR SWAP1 PUSH1 0x40 SHL JUMPDEST PUSH9 0x10000000000000000 DUP3 LT PUSH2 0x2FA0 JUMPI PUSH1 0x40 SWAP2 SWAP1 SWAP2 SHR SWAP1 PUSH1 0x20 SHL JUMPDEST PUSH5 0x100000000 DUP3 LT PUSH2 0x2FB7 JUMPI PUSH1 0x20 SWAP2 SWAP1 SWAP2 SHR SWAP1 PUSH1 0x10 SHL JUMPDEST PUSH3 0x10000 DUP3 LT PUSH2 0x2FCC JUMPI PUSH1 0x10 SWAP2 SWAP1 SWAP2 SHR SWAP1 PUSH1 0x8 SHL JUMPDEST PUSH2 0x100 DUP3 LT PUSH2 0x2FE0 JUMPI PUSH1 0x8 SWAP2 SWAP1 SWAP2 SHR SWAP1 PUSH1 0x4 SHL JUMPDEST PUSH1 0x10 DUP3 LT PUSH2 0x2FF3 JUMPI PUSH1 0x4 SWAP2 SWAP1 SWAP2 SHR SWAP1 PUSH1 0x2 SHL JUMPDEST PUSH1 0x4 DUP3 LT PUSH2 0x2FFF JUMPI PUSH1 0x1 SHL JUMPDEST PUSH1 0x3 MUL PUSH1 0x1 SWAP1 DUP2 SHR SWAP1 DUP2 DUP6 DUP2 PUSH2 0x3017 JUMPI PUSH2 0x3017 PUSH2 0x415C JUMP JUMPDEST DIV DUP3 ADD SWAP1 SHR SWAP1 POP PUSH1 0x1 DUP2 DUP6 DUP2 PUSH2 0x302F JUMPI PUSH2 0x302F PUSH2 0x415C JUMP JUMPDEST DIV DUP3 ADD SWAP1 SHR SWAP1 POP PUSH1 0x1 DUP2 DUP6 DUP2 PUSH2 0x3047 JUMPI PUSH2 0x3047 PUSH2 0x415C JUMP JUMPDEST DIV DUP3 ADD SWAP1 SHR SWAP1 POP PUSH1 0x1 DUP2 DUP6 DUP2 PUSH2 0x305F JUMPI PUSH2 0x305F PUSH2 0x415C JUMP JUMPDEST DIV DUP3 ADD SWAP1 SHR SWAP1 POP PUSH1 0x1 DUP2 DUP6 DUP2 PUSH2 0x3077 JUMPI PUSH2 0x3077 PUSH2 0x415C JUMP JUMPDEST DIV DUP3 ADD SWAP1 SHR SWAP1 POP PUSH1 0x1 DUP2 DUP6 DUP2 PUSH2 0x308F JUMPI PUSH2 0x308F PUSH2 0x415C JUMP JUMPDEST DIV DUP3 ADD SWAP1 SHR SWAP1 POP PUSH2 0x30AE DUP2 DUP6 DUP2 PUSH2 0x30A8 JUMPI PUSH2 0x30A8 PUSH2 0x415C JUMP JUMPDEST DIV DUP3 GT SWAP1 JUMP JUMPDEST SWAP1 SUB SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 JUMPDEST DUP2 DUP4 LT ISZERO PUSH2 0x310E JUMPI PUSH0 PUSH2 0x30CC DUP5 DUP5 PUSH2 0x32DC JUMP JUMPDEST PUSH0 DUP8 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH6 0xFFFFFFFFFFFF DUP7 AND SWAP1 DUP3 ADD SLOAD PUSH6 0xFFFFFFFFFFFF AND GT ISZERO PUSH2 0x30FA JUMPI DUP1 SWAP3 POP PUSH2 0x3108 JUMP JUMPDEST PUSH2 0x3105 DUP2 PUSH1 0x1 PUSH2 0x405B JUMP JUMPDEST SWAP4 POP JUMPDEST POP PUSH2 0x30B9 JUMP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 DUP1 DUP5 DUP2 PUSH2 0x3125 DUP7 PUSH1 0x1 PUSH2 0x405B JUMP JUMPDEST DUP6 GT DUP1 ISZERO PUSH2 0x314D JUMPI POP PUSH2 0x60F PUSH1 0xF3 SHL PUSH2 0x3141 DUP4 DUP9 ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xF0 SHL SUB NOT AND EQ JUMPDEST SWAP1 POP PUSH0 PUSH2 0x315D DUP3 ISZERO ISZERO PUSH1 0x2 PUSH2 0x4214 JUMP JUMPDEST SWAP1 POP PUSH0 DUP1 PUSH2 0x316B DUP4 DUP11 PUSH2 0x405B JUMP JUMPDEST SWAP1 POP JUMPDEST DUP8 DUP2 LT ISZERO PUSH2 0x31C6 JUMPI PUSH0 PUSH2 0x318C PUSH2 0x3187 DUP8 DUP5 ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH2 0x32F6 JUMP JUMPDEST SWAP1 POP PUSH1 0xF DUP2 PUSH1 0xFF AND GT ISZERO PUSH2 0x31AB JUMPI PUSH0 PUSH0 SWAP8 POP SWAP8 POP POP POP POP POP POP POP PUSH2 0x2256 JUMP JUMPDEST PUSH2 0x31B6 PUSH1 0x10 DUP5 PUSH2 0x4214 JUMP JUMPDEST PUSH1 0xFF SWAP1 SWAP2 AND ADD SWAP2 POP PUSH1 0x1 ADD PUSH2 0x316E JUMP JUMPDEST POP PUSH1 0x1 SWAP10 SWAP1 SWAP9 POP SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH0 PUSH2 0x31E3 DUP4 PUSH2 0x336E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 DUP4 ADD SWAP1 SWAP3 MSTORE SWAP2 SWAP3 POP PUSH0 SWAP2 SWAP1 PUSH1 0x20 DUP3 ADD DUP2 DUP1 CALLDATASIZE DUP4 CALLDATACOPY POP POP POP SWAP2 DUP3 MSTORE POP PUSH1 0x20 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH0 DUP1 DUP1 PUSH32 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 DUP5 GT ISZERO PUSH2 0x324D JUMPI POP PUSH0 SWAP2 POP PUSH1 0x3 SWAP1 POP DUP3 PUSH2 0x32D2 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP1 DUP5 MSTORE DUP11 SWAP1 MSTORE PUSH1 0xFF DUP10 AND SWAP3 DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP2 ADD DUP8 SWAP1 MSTORE PUSH1 0x80 DUP2 ADD DUP7 SWAP1 MSTORE PUSH1 0x1 SWAP1 PUSH1 0xA0 ADD PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x329E JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH1 0x1F NOT ADD MLOAD SWAP2 POP POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x32C9 JUMPI POP PUSH0 SWAP3 POP PUSH1 0x1 SWAP2 POP DUP3 SWAP1 POP PUSH2 0x32D2 JUMP JUMPDEST SWAP3 POP PUSH0 SWAP2 POP DUP2 SWAP1 POP JUMPDEST SWAP5 POP SWAP5 POP SWAP5 SWAP2 POP POP JUMP JUMPDEST PUSH0 PUSH2 0x32EA PUSH1 0x2 DUP5 DUP5 XOR PUSH2 0x435B JUMP JUMPDEST PUSH2 0x127F SWAP1 DUP5 DUP5 AND PUSH2 0x405B JUMP JUMPDEST PUSH0 PUSH1 0xF8 DUP3 SWAP1 SHR PUSH1 0x2F DUP2 GT DUP1 ISZERO PUSH2 0x330F JUMPI POP PUSH1 0x3A DUP2 PUSH1 0xFF AND LT JUMPDEST ISZERO PUSH2 0x331D JUMPI PUSH1 0x2F NOT ADD PUSH2 0xA6B JUMP JUMPDEST PUSH1 0x60 DUP2 PUSH1 0xFF AND GT DUP1 ISZERO PUSH2 0x3333 JUMPI POP PUSH1 0x67 DUP2 PUSH1 0xFF AND LT JUMPDEST ISZERO PUSH2 0x3341 JUMPI PUSH1 0x56 NOT ADD PUSH2 0xA6B JUMP JUMPDEST PUSH1 0x40 DUP2 PUSH1 0xFF AND GT DUP1 ISZERO PUSH2 0x3357 JUMPI POP PUSH1 0x47 DUP2 PUSH1 0xFF AND LT JUMPDEST ISZERO PUSH2 0x3365 JUMPI PUSH1 0x36 NOT ADD PUSH2 0xA6B JUMP JUMPDEST POP PUSH1 0xFF SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH0 PUSH1 0xFF DUP3 AND PUSH1 0x1F DUP2 GT ISZERO PUSH2 0xA6B JUMPI PUSH1 0x40 MLOAD PUSH4 0x2CD44AC3 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x33A5 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xE0 SHL SUB NOT DUP2 AND DUP2 EQ PUSH2 0x127F JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x33CC JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP CALLDATALOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 DUP2 MLOAD DUP1 DUP5 MSTORE DUP1 PUSH1 0x20 DUP5 ADD PUSH1 0x20 DUP7 ADD MCOPY PUSH0 PUSH1 0x20 DUP3 DUP7 ADD ADD MSTORE PUSH1 0x20 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP6 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 MSTORE PUSH0 PUSH2 0x127F PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x33D3 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0xA82 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x1F DUP3 ADD PUSH1 0x1F NOT AND DUP2 ADD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x3463 JUMPI PUSH2 0x3463 PUSH2 0x3427 JUMP JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP3 GT ISZERO PUSH2 0x3483 JUMPI PUSH2 0x3483 PUSH2 0x3427 JUMP JUMPDEST POP PUSH1 0x1F ADD PUSH1 0x1F NOT AND PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH0 PUSH2 0x34A3 PUSH2 0x349E DUP5 PUSH2 0x346B JUMP JUMPDEST PUSH2 0x343B JUMP JUMPDEST SWAP1 POP DUP3 DUP2 MSTORE DUP4 DUP4 DUP4 ADD GT ISZERO PUSH2 0x34B6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 DUP3 PUSH1 0x20 DUP4 ADD CALLDATACOPY PUSH0 PUSH1 0x20 DUP5 DUP4 ADD ADD MSTORE SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x34DB JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x127F DUP4 DUP4 CALLDATALOAD PUSH1 0x20 DUP6 ADD PUSH2 0x3491 JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x34FD JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH2 0x3508 DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP4 POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH2 0x3518 DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP3 POP PUSH1 0x40 DUP6 ADD CALLDATALOAD SWAP2 POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3539 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3545 DUP8 DUP3 DUP9 ADD PUSH2 0x34CC JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH0 PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP3 GT ISZERO PUSH2 0x3569 JUMPI PUSH2 0x3569 PUSH2 0x3427 JUMP JUMPDEST POP PUSH1 0x5 SHL PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x3582 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x3590 PUSH2 0x349E DUP3 PUSH2 0x3551 JUMP JUMPDEST DUP1 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP2 POP PUSH1 0x20 DUP4 PUSH1 0x5 SHL DUP7 ADD ADD SWAP3 POP DUP6 DUP4 GT ISZERO PUSH2 0x35B1 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x20 DUP6 ADD JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC19 JUMPI DUP1 CALLDATALOAD PUSH2 0x35C9 DUP2 PUSH2 0x3413 JUMP JUMPDEST DUP4 MSTORE PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 ADD PUSH2 0x35B6 JUMP JUMPDEST PUSH0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x35E6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x35F4 PUSH2 0x349E DUP3 PUSH2 0x3551 JUMP JUMPDEST DUP1 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP2 POP PUSH1 0x20 DUP4 PUSH1 0x5 SHL DUP7 ADD ADD SWAP3 POP DUP6 DUP4 GT ISZERO PUSH2 0x3615 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x20 DUP6 ADD JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC19 JUMPI DUP1 CALLDATALOAD DUP4 MSTORE PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 ADD PUSH2 0x361A JUMP JUMPDEST PUSH0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x3641 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x364F PUSH2 0x349E DUP3 PUSH2 0x3551 JUMP JUMPDEST DUP1 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP2 POP PUSH1 0x20 DUP4 PUSH1 0x5 SHL DUP7 ADD ADD SWAP3 POP DUP6 DUP4 GT ISZERO PUSH2 0x3670 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x20 DUP6 ADD JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC19 JUMPI DUP1 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3692 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x36A1 DUP9 PUSH1 0x20 DUP4 DUP11 ADD ADD PUSH2 0x34CC JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 ADD PUSH2 0x3675 JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x36C3 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x36D8 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x36E4 DUP8 DUP3 DUP9 ADD PUSH2 0x3573 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x36FF JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x370B DUP8 DUP3 DUP9 ADD PUSH2 0x35D7 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3726 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3732 DUP8 DUP3 DUP9 ADD PUSH2 0x3632 JUMP JUMPDEST SWAP5 SWAP8 SWAP4 SWAP7 POP SWAP4 SWAP5 PUSH1 0x60 ADD CALLDATALOAD SWAP4 POP POP POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x21 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x8 DUP2 LT PUSH2 0x3773 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x21 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST SWAP1 MSTORE JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0xA6B DUP3 DUP5 PUSH2 0x3757 JUMP JUMPDEST PUSH0 PUSH0 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x3796 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 CALLDATALOAD SWAP2 POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH2 0x37A8 DUP2 PUSH2 0x3413 JUMP JUMPDEST DUP1 SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST DUP1 CALLDATALOAD PUSH1 0xFF DUP2 AND DUP2 EQ PUSH2 0xED6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH0 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x37D4 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 CALLDATALOAD SWAP2 POP PUSH2 0x37E4 PUSH1 0x20 DUP5 ADD PUSH2 0x37B3 JUMP JUMPDEST SWAP1 POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH0 DUP4 PUSH1 0x1F DUP5 ADD SLT PUSH2 0x37FD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3813 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x20 DUP3 DUP6 ADD ADD GT ISZERO PUSH2 0x382A JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH0 PUSH0 PUSH0 PUSH1 0xC0 DUP9 DUP11 SUB SLT ISZERO PUSH2 0x3847 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP8 CALLDATALOAD SWAP7 POP PUSH2 0x3857 PUSH1 0x20 DUP10 ADD PUSH2 0x37B3 JUMP JUMPDEST SWAP6 POP PUSH1 0x40 DUP9 ADD CALLDATALOAD PUSH2 0x3867 DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP5 POP PUSH1 0x60 DUP9 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3881 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x388D DUP11 DUP3 DUP12 ADD PUSH2 0x37ED JUMP JUMPDEST SWAP1 SWAP6 POP SWAP4 POP POP PUSH1 0x80 DUP9 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x38AB JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x38B7 DUP11 DUP3 DUP12 ADD PUSH2 0x34CC JUMP JUMPDEST SWAP3 POP POP PUSH1 0xA0 DUP9 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x38D2 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x38DE DUP11 DUP3 DUP12 ADD PUSH2 0x34CC JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP9 SWAP2 SWAP5 SWAP8 POP SWAP3 SWAP6 POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH0 PUSH1 0x80 DUP7 DUP9 SUB SLT ISZERO PUSH2 0x3901 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP6 CALLDATALOAD SWAP5 POP PUSH2 0x3911 PUSH1 0x20 DUP8 ADD PUSH2 0x37B3 JUMP JUMPDEST SWAP4 POP PUSH1 0x40 DUP7 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x392B JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3937 DUP9 DUP3 DUP10 ADD PUSH2 0x37ED JUMP JUMPDEST SWAP1 SWAP5 POP SWAP3 POP POP PUSH1 0x60 DUP7 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3955 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3961 DUP9 DUP3 DUP10 ADD PUSH2 0x34CC JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 SWAP1 SWAP4 POP JUMP JUMPDEST PUSH6 0xFFFFFFFFFFFF DUP2 AND DUP2 EQ PUSH2 0xA82 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x3991 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x127F DUP2 PUSH2 0x396E JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH1 0x60 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x39AF JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP5 CALLDATALOAD SWAP4 POP PUSH2 0x39BF PUSH1 0x20 DUP7 ADD PUSH2 0x37B3 JUMP JUMPDEST SWAP3 POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x39D9 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x39E5 DUP8 DUP3 DUP9 ADD PUSH2 0x37ED JUMP JUMPDEST SWAP6 SWAP9 SWAP5 SWAP8 POP SWAP6 POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x3A04 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3A19 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3A25 DUP8 DUP3 DUP9 ADD PUSH2 0x3573 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3A40 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3A4C DUP8 DUP3 DUP9 ADD PUSH2 0x35D7 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3A67 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3A73 DUP8 DUP3 DUP9 ADD PUSH2 0x3632 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3A8E JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP6 ADD PUSH1 0x1F DUP2 ADD DUP8 SGT PUSH2 0x3A9E JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3545 DUP8 DUP3 CALLDATALOAD PUSH1 0x20 DUP5 ADD PUSH2 0x3491 JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x3ABD JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x127F DUP2 PUSH2 0x3413 JUMP JUMPDEST PUSH0 DUP2 MLOAD DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP4 ADD PUSH0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x3AF8 JUMPI DUP2 MLOAD DUP7 MSTORE PUSH1 0x20 SWAP6 DUP7 ADD SWAP6 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x3ADA JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0xFF PUSH1 0xF8 SHL DUP9 AND DUP2 MSTORE PUSH1 0xE0 PUSH1 0x20 DUP3 ADD MSTORE PUSH0 PUSH2 0x3B20 PUSH1 0xE0 DUP4 ADD DUP10 PUSH2 0x33D3 JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x3B32 DUP2 DUP10 PUSH2 0x33D3 JUMP JUMPDEST PUSH1 0x60 DUP5 ADD DUP9 SWAP1 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 AND PUSH1 0x80 DUP6 ADD MSTORE PUSH1 0xA0 DUP5 ADD DUP7 SWAP1 MSTORE DUP4 DUP2 SUB PUSH1 0xC0 DUP6 ADD MSTORE SWAP1 POP PUSH2 0x3B63 DUP2 DUP6 PUSH2 0x3AC8 JUMP JUMPDEST SWAP11 SWAP10 POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x3B84 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP5 CALLDATALOAD SWAP4 POP PUSH2 0x3B94 PUSH1 0x20 DUP7 ADD PUSH2 0x37B3 JUMP JUMPDEST SWAP3 POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH2 0x3BA4 DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP2 POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3539 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH0 PUSH0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x3BD0 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH2 0x3BDB DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP3 POP PUSH1 0x20 DUP5 ADD CALLDATALOAD SWAP2 POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3BFC JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3C08 DUP7 DUP3 DUP8 ADD PUSH2 0x34CC JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH0 PUSH1 0xA0 DUP7 DUP9 SUB SLT ISZERO PUSH2 0x3C26 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP6 CALLDATALOAD PUSH2 0x3C31 DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP5 POP PUSH1 0x20 DUP7 ADD CALLDATALOAD PUSH2 0x3C41 DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP4 POP PUSH1 0x40 DUP7 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3C5B JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3C67 DUP9 DUP3 DUP10 ADD PUSH2 0x35D7 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x60 DUP7 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3C82 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x3C8E DUP9 DUP3 DUP10 ADD PUSH2 0x35D7 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x80 DUP7 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3955 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH1 0x60 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x3CBC JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH2 0x3CC7 DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP4 POP PUSH1 0x20 DUP6 ADD CALLDATALOAD SWAP3 POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x39D9 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x3CF8 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH4 0xFFFFFFFF DUP2 AND DUP2 EQ PUSH2 0x127F JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH0 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x3D1C JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH2 0x3D27 DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP5 PUSH1 0x20 SWAP4 SWAP1 SWAP4 ADD CALLDATALOAD SWAP4 POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH0 PUSH1 0xA0 DUP7 DUP9 SUB SLT ISZERO PUSH2 0x3D49 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP6 CALLDATALOAD PUSH2 0x3D54 DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP5 POP PUSH1 0x20 DUP7 ADD CALLDATALOAD PUSH2 0x3D64 DUP2 PUSH2 0x3413 JUMP JUMPDEST SWAP4 POP PUSH1 0x40 DUP7 ADD CALLDATALOAD SWAP3 POP PUSH1 0x60 DUP7 ADD CALLDATALOAD SWAP2 POP PUSH1 0x80 DUP7 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3955 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x3DA0 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x3DBE JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x32 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x3DE8 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x3DFD JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 ADD PUSH1 0x1F DUP2 ADD DUP5 SGT PUSH2 0x3E0D JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 MLOAD PUSH2 0x3E1B PUSH2 0x349E DUP3 PUSH2 0x346B JUMP JUMPDEST DUP2 DUP2 MSTORE DUP6 PUSH1 0x20 DUP4 DUP6 ADD ADD GT ISZERO PUSH2 0x3E2F JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 PUSH1 0x20 DUP5 ADD PUSH1 0x20 DUP4 ADD MCOPY PUSH0 SWAP2 DUP2 ADD PUSH1 0x20 ADD SWAP2 SWAP1 SWAP2 MSTORE SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH6 0xFFFFFFFFFFFF DUP3 DUP2 AND DUP3 DUP3 AND SUB SWAP1 DUP2 GT ISZERO PUSH2 0xA6B JUMPI PUSH2 0xA6B PUSH2 0x3E4C JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x3E8E JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 MLOAD PUSH2 0x127F DUP2 PUSH2 0x396E JUMP JUMPDEST PUSH6 0xFFFFFFFFFFFF DUP2 DUP2 AND DUP4 DUP3 AND ADD SWAP1 DUP2 GT ISZERO PUSH2 0xA6B JUMPI PUSH2 0xA6B PUSH2 0x3E4C JUMP JUMPDEST DUP2 DUP4 DUP3 CALLDATACOPY PUSH0 SWAP2 ADD SWAP1 DUP2 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 DUP2 MLOAD DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP4 ADD PUSH0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x3AF8 JUMPI DUP2 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP7 MSTORE PUSH1 0x20 SWAP6 DUP7 ADD SWAP6 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x3ED8 JUMP JUMPDEST PUSH0 DUP3 DUP3 MLOAD DUP1 DUP6 MSTORE PUSH1 0x20 DUP6 ADD SWAP5 POP PUSH1 0x20 DUP2 PUSH1 0x5 SHL DUP4 ADD ADD PUSH1 0x20 DUP6 ADD PUSH0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x3F4D JUMPI PUSH1 0x1F NOT DUP6 DUP5 SUB ADD DUP9 MSTORE PUSH2 0x3F37 DUP4 DUP4 MLOAD PUSH2 0x33D3 JUMP JUMPDEST PUSH1 0x20 SWAP9 DUP10 ADD SWAP9 SWAP1 SWAP4 POP SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x3F1B JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x80 DUP2 MSTORE PUSH0 PUSH2 0x3F6B PUSH1 0x80 DUP4 ADD DUP8 PUSH2 0x3EC6 JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x20 DUP5 ADD MSTORE PUSH2 0x3F7D DUP2 DUP8 PUSH2 0x3AC8 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 SUB PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x3F91 DUP2 DUP7 PUSH2 0x3EFF JUMP JUMPDEST SWAP2 POP POP DUP3 PUSH1 0x60 DUP4 ADD MSTORE SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x3FB3 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP MLOAD SWAP2 SWAP1 POP JUMP JUMPDEST DUP4 DUP2 MSTORE PUSH1 0x60 DUP2 ADD PUSH2 0x3FCE PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x3757 JUMP JUMPDEST DUP3 PUSH1 0x40 DUP4 ADD MSTORE SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x3FEC JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 MLOAD DUP1 ISZERO ISZERO DUP2 EQ PUSH2 0x127F JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP5 DUP2 MSTORE PUSH1 0xFF DUP5 AND PUSH1 0x20 DUP3 ADD MSTORE DUP3 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x80 PUSH1 0x60 DUP3 ADD MSTORE PUSH0 PUSH2 0x108F PUSH1 0x80 DUP4 ADD DUP5 PUSH2 0x33D3 JUMP JUMPDEST DUP6 DUP2 MSTORE PUSH1 0xFF DUP6 AND PUSH1 0x20 DUP3 ADD MSTORE DUP4 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0xA0 PUSH1 0x60 DUP3 ADD MSTORE PUSH0 PUSH2 0x4049 PUSH1 0xA0 DUP4 ADD DUP6 PUSH2 0x33D3 JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x80 DUP5 ADD MSTORE PUSH2 0xFD8 DUP2 DUP6 PUSH2 0x33D3 JUMP JUMPDEST DUP1 DUP3 ADD DUP1 DUP3 GT ISZERO PUSH2 0xA6B JUMPI PUSH2 0xA6B PUSH2 0x3E4C JUMP JUMPDEST DUP10 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP10 AND PUSH1 0x20 DUP3 ADD MSTORE PUSH2 0x120 PUSH1 0x40 DUP3 ADD DUP2 SWAP1 MSTORE PUSH0 SWAP1 PUSH2 0x4098 SWAP1 DUP4 ADD DUP11 PUSH2 0x3EC6 JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x60 DUP5 ADD MSTORE PUSH2 0x40AA DUP2 DUP11 PUSH2 0x3AC8 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 SUB PUSH1 0x80 DUP5 ADD MSTORE DUP1 DUP9 MLOAD DUP1 DUP4 MSTORE PUSH1 0x20 DUP4 ADD SWAP2 POP PUSH1 0x20 DUP2 PUSH1 0x5 SHL DUP5 ADD ADD PUSH1 0x20 DUP12 ADD PUSH0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x4101 JUMPI PUSH1 0x1F NOT DUP7 DUP5 SUB ADD DUP6 MSTORE PUSH2 0x40EB DUP4 DUP4 MLOAD PUSH2 0x33D3 JUMP JUMPDEST PUSH1 0x20 SWAP6 DUP7 ADD SWAP6 SWAP1 SWAP4 POP SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x40CF JUMP JUMPDEST POP POP DUP6 DUP2 SUB PUSH1 0xA0 DUP8 ADD MSTORE PUSH2 0x4115 DUP2 DUP12 PUSH2 0x3EFF JUMP JUMPDEST SWAP4 POP POP POP POP DUP6 PUSH1 0xC0 DUP5 ADD MSTORE DUP5 PUSH1 0xE0 DUP5 ADD MSTORE DUP3 DUP2 SUB PUSH2 0x100 DUP5 ADD MSTORE PUSH2 0x4139 DUP2 DUP6 PUSH2 0x33D3 JUMP JUMPDEST SWAP13 SWAP12 POP POP POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP2 DUP2 SUB DUP2 DUP2 GT ISZERO PUSH2 0xA6B JUMPI PUSH2 0xA6B PUSH2 0x3E4C JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x12 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0xA0 DUP2 MSTORE PUSH0 PUSH2 0x4182 PUSH1 0xA0 DUP4 ADD DUP9 PUSH2 0x3EC6 JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x20 DUP5 ADD MSTORE PUSH2 0x4194 DUP2 DUP9 PUSH2 0x3AC8 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 SUB PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x41A8 DUP2 DUP8 PUSH2 0x3EFF JUMP JUMPDEST PUSH1 0x60 DUP5 ADD SWAP6 SWAP1 SWAP6 MSTORE POP POP PUSH1 0x80 ADD MSTORE SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0xC0 DUP2 MSTORE PUSH0 PUSH2 0x41CF PUSH1 0xC0 DUP4 ADD DUP10 PUSH2 0x3EC6 JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x20 DUP5 ADD MSTORE PUSH2 0x41E1 DUP2 DUP10 PUSH2 0x3AC8 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 SUB PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x41F5 DUP2 DUP9 PUSH2 0x3EFF JUMP JUMPDEST PUSH1 0x60 DUP5 ADD SWAP7 SWAP1 SWAP7 MSTORE POP POP PUSH1 0x80 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0xA0 SWAP1 SWAP2 ADD MSTORE SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP1 DUP3 MUL DUP2 ISZERO DUP3 DUP3 DIV DUP5 EQ OR PUSH2 0xA6B JUMPI PUSH2 0xA6B PUSH2 0x3E4C JUMP JUMPDEST PUSH1 0xFF DUP2 DUP2 AND DUP4 DUP3 AND ADD SWAP1 DUP2 GT ISZERO PUSH2 0xA6B JUMPI PUSH2 0xA6B PUSH2 0x3E4C JUMP JUMPDEST PUSH1 0x1 DUP2 JUMPDEST PUSH1 0x1 DUP5 GT ISZERO PUSH2 0x2256 JUMPI DUP1 DUP6 DIV DUP2 GT ISZERO PUSH2 0x4263 JUMPI PUSH2 0x4263 PUSH2 0x3E4C JUMP JUMPDEST PUSH1 0x1 DUP5 AND ISZERO PUSH2 0x4271 JUMPI SWAP1 DUP2 MUL SWAP1 JUMPDEST PUSH1 0x1 SWAP4 SWAP1 SWAP4 SHR SWAP3 DUP1 MUL PUSH2 0x4248 JUMP JUMPDEST PUSH0 DUP3 PUSH2 0x428D JUMPI POP PUSH1 0x1 PUSH2 0xA6B JUMP JUMPDEST DUP2 PUSH2 0x4299 JUMPI POP PUSH0 PUSH2 0xA6B JUMP JUMPDEST DUP2 PUSH1 0x1 DUP2 EQ PUSH2 0x42AF JUMPI PUSH1 0x2 DUP2 EQ PUSH2 0x42B9 JUMPI PUSH2 0x42D5 JUMP JUMPDEST PUSH1 0x1 SWAP2 POP POP PUSH2 0xA6B JUMP JUMPDEST PUSH1 0xFF DUP5 GT ISZERO PUSH2 0x42CA JUMPI PUSH2 0x42CA PUSH2 0x3E4C JUMP JUMPDEST POP POP PUSH1 0x1 DUP3 SHL PUSH2 0xA6B JUMP JUMPDEST POP PUSH1 0x20 DUP4 LT PUSH2 0x133 DUP4 LT AND PUSH1 0x4E DUP5 LT PUSH1 0xB DUP5 LT AND OR ISZERO PUSH2 0x42F8 JUMPI POP DUP2 DUP2 EXP PUSH2 0xA6B JUMP JUMPDEST PUSH2 0x4304 PUSH0 NOT DUP5 DUP5 PUSH2 0x4244 JUMP JUMPDEST DUP1 PUSH0 NOT DIV DUP3 GT ISZERO PUSH2 0x4317 JUMPI PUSH2 0x4317 PUSH2 0x3E4C JUMP JUMPDEST MUL SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 PUSH2 0x127F PUSH1 0xFF DUP5 AND DUP4 PUSH2 0x427F JUMP JUMPDEST DUP3 DUP2 MSTORE PUSH1 0x40 PUSH1 0x20 DUP3 ADD MSTORE PUSH0 PUSH2 0x127C PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0x33D3 JUMP JUMPDEST PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP6 ADD DUP5 MCOPY PUSH0 SWAP3 ADD SWAP2 DUP3 MSTORE POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 DUP3 PUSH2 0x4375 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x12 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP DIV SWAP1 JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 ADDRESS 0xC8 CREATE PUSH12 0xECF19A0A8D6AD0C9A6F53A89 0x2E PUSH2 0xE375 SDIV EQ 0x26 MUL SGT PUSH4 0xA7AD529D 0xD3 BLOCKHASH PUSH5 0x736F6C6343 STOP ADDMOD 0x1E STOP CALLER ",
"sourceMap": "947:2275:42:-:0;;;1096:272;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1351:9;1316:1;1272:6;1209:4;1227:5;1247:1;3566:88:2;;;;;;;;;;;;;-1:-1:-1;;;3566:88:2;;;3606:5;3613:9;:7;;;:9;;:::i;:::-;3501:45:31;:4;3532:13;3501:30;:45::i;:::-;3493:53;;3567:51;:7;3601:16;3567:33;:51::i;:::-;3556:62;;3642:22;;;;;;;;;;3628:36;;3691:25;;;;;;3674:42;;3744:13;3727:30;;3792:23;4326:11;;4339:14;;4304:80;;;2079:95;4304:80;;;3506:25:43;3547:18;;;3540:34;;;;3590:18;;;3583:34;4355:13:31;3633:18:43;;;3626:34;4378:4:31;3676:19:43;;;3669:61;4268:7:31;;3478:19:43;;4304:80:31;;;;;;;;;;;;4294:91;;;;;;4287:98;;4213:179;;3792:23;3767:48;;-1:-1:-1;;3847:4:31;3825:27;;3634:5:2::1;:13;3642:5:::0;3634;:13:::1;:::i;:::-;-1:-1:-1::0;1004:35:6;;-1:-1:-1;1020:18:6;1004:15;:35::i;:::-;1049:37;1066:19;1049:16;:37::i;:::-;1096:47;1118:24;1096:21;:47::i;:::-;-1:-1:-1;;;;;;;;612:40:8;;;1404:44:9;1427:20;1404:22;:44::i;:::-;-1:-1:-1;1891:32:7;1907:15;1891;:32::i;:::-;1833:97;1096:272:42;;947:2275;;4531:90:2;4604:10;;;;;;;;;;;;-1:-1:-1;;;4604:10:2;;;;;4531:90::o;2887:340:27:-;2983:11;3032:2;3016:5;3010:19;:24;3006:215;;;3057:20;3071:5;3057:13;:20::i;:::-;3050:27;;;;3006:215;3134:5;3108:46;3149:5;3134;3108:46;:::i;:::-;-1:-1:-1;1390:66:27;;-1:-1:-1;3006:215:27;2887:340;;;;:::o;2644:170:6:-;2739:12;;2724:44;;;2739:12;;;;3913:46:43;;3995:27;;;3990:2;3975:18;;3968:55;2724:44:6;;3886:18:43;2724:44:6;;;;;;;2778:12;:29;;-1:-1:-1;;2778:29:6;;;;;;;;;;;;2644:170::o;2934:274::-;3015:15;:20;;3034:1;3015:20;3011:88;;3058:30;;-1:-1:-1;;;3058:30:6;;3086:1;3058:30;;;4188:25:43;4161:18;;3058:30:6;;;;;;;;3011:88;3129:13;;3113:47;;;3129:13;;;;;;;4396:42:43;;4474:23;;;4469:2;4454:18;;4447:51;3113:47:6;;4369:18:43;3113:47:6;;;;;;;3170:13;:31;;;;;;;;-1:-1:-1;;;;3170:31:6;;;;;;;;;2934:274::o;3338:213::-;3452:18;;3431:62;;;4683:25:43;;;4739:2;4724:18;;4717:34;;;3431:62:6;;4656:18:43;3431:62:6;;;;;;;3503:18;:41;3338:213::o;3143:498:9:-;2146:3;3285:32;;;3281:132;;;3340:62;;-1:-1:-1;;;3340:62:9;;;;;4683:25:43;;;4724:18;;;4717:34;;;4656:18;;3340:62:9;4509:248:43;3281:132:9;3423:26;3452:17;:15;:17::i;:::-;3423:46;-1:-1:-1;3479:77:9;3508:7;:5;:7::i;:::-;3517:38;3536:18;3517;:38::i;:::-;3479:23;;:77;:28;:77::i;:::-;-1:-1:-1;;3572:62:9;;;4683:25:43;;;4739:2;4724:18;;4717:34;;;3572:62:9;;4656:18:43;3572:62:9;;;;;;;3220:421;;3143:498;:::o;6074:176:7:-;6177:9;;6154:56;;;-1:-1:-1;;;;;6177:9:7;;;4936:51:43;;5023:32;;;5018:2;5003:18;;4996:60;6154:56:7;;4909:18:43;6154:56:7;;;;;;;6220:9;:23;;-1:-1:-1;;;;;;6220:23:7;-1:-1:-1;;;;;6220:23:7;;;;;;;;;;6074:176::o;1708:286:27:-;1773:11;1796:17;1822:3;1796:30;;1854:2;1840:4;:11;:16;1836:72;;;1893:3;1879:18;;-1:-1:-1;;;1879:18:27;;;;;;;;:::i;1836:72::-;1974:11;;1957:13;1974:4;1957:13;:::i;:::-;1949:36;;1708:286;-1:-1:-1;;;1708:286:27:o;1552:121:9:-;1608:7;1634:32;:23;:30;:32::i;:::-;-1:-1:-1;;;;;1627:39:9;;;1552:121;:::o;1001:224:8:-;1056:6;1078:7;811:6;;;738:86;1078:7;-1:-1:-1;;;;;1078:13:8;;:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1078:15:8;;;;;;;;-1:-1:-1;;1078:15:8;;;;;;;;;;;;:::i;:::-;;;1074:145;;1190:18;:16;:18::i;:::-;1183:25;;1001:224;:::o;1074:145::-;1142:9;1001:224;-1:-1:-1;1001:224:8:o;4174:218:37:-;4231:7;-1:-1:-1;;;;;4254:25:37;;4250:105;;;4302:42;;-1:-1:-1;;;4302:42:37;;4333:3;4302:42;;;6263:36:43;6315:18;;;6308:34;;;6236:18;;4302:42:37;6081:267:43;4250:105:37;-1:-1:-1;4379:5:37;4174:218::o;8146:210:39:-;8258:16;;8311:38;8319:4;8338:3;8343:5;8311:7;:38::i;:::-;8304:45;;;;8146:210;;;;;;;:::o;10311:206::-;10406:24;;10373:7;;10447:8;;:63;;10462:41;10476:4;10495:7;10501:1;10495:3;:7;:::i;:::-;14401:28;14464:20;;;14529:4;14516:18;;;14512:28;;14291:265;10462:41;:48;;;;-1:-1:-1;;;;;10462:48:39;10447:63;;;10458:1;10447:63;10440:70;10311:206;-1:-1:-1;;;10311:206:39:o;931:109:41:-;977:6;1002:31;1020:12;1002:17;:31::i;11659:922:39:-;11840:11;;11780:16;;;;11866:7;;11862:713;;11889:26;11918:28;11932:4;11938:7;11944:1;11938:3;:7;:::i;11918:28::-;11977:9;;;;-1:-1:-1;11977:9:39;;;;;12020:11;;;-1:-1:-1;;;;;12020:11:39;;12105:13;;;;12101:89;;;12145:30;;-1:-1:-1;;;12145:30:39;;;;;;;;;;;12101:89;12264:3;12253:14;;:7;:14;;;12249:163;;12287:19;;;;;-1:-1:-1;;;;;12287:19:39;;;;;;12249:163;;;12355:41;;;;;;;;;;;;;;;-1:-1:-1;;;;;12355:41:39;;;;;;;;;;12345:52;;;;;;;-1:-1:-1;12345:52:39;;;;;;;;;;;;;;;;;;;;;;;;;12249:163;12433:9;-1:-1:-1;12444:5:39;;-1:-1:-1;12425:25:39;;-1:-1:-1;;;12425:25:39;11862:713;-1:-1:-1;;12491:41:39;;;;;;;;;;;;;;;-1:-1:-1;;;;;12491:41:39;;;;;;;;;;12481:52;;;;;;;-1:-1:-1;12481:52:39;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;12525:5:39;12547:17;;14296:213:37;14352:6;14382:16;14374:24;;14370:103;;;14421:41;;-1:-1:-1;;;14421:41:37;;14452:2;14421:41;;;6263:36:43;6315:18;;;6308:34;;;6236:18;;14421:41:37;6081:267:43;14:139;-1:-1:-1;;;;;97:31:43;;87:42;;77:70;;143:1;140;133:12;77:70;14:139;:::o;158:443::-;279:6;287;340:2;328:9;319:7;315:23;311:32;308:52;;;356:1;353;346:12;308:52;388:9;382:16;407:39;440:5;407:39;:::i;:::-;515:2;500:18;;494:25;465:5;;-1:-1:-1;528:41:43;494:25;528:41;:::i;:::-;588:7;578:17;;;158:443;;;;;:::o;606:127::-;667:10;662:3;658:20;655:1;648:31;698:4;695:1;688:15;722:4;719:1;712:15;738:380;817:1;813:12;;;;860;;;881:61;;935:4;927:6;923:17;913:27;;881:61;988:2;980:6;977:14;957:18;954:38;951:161;;1034:10;1029:3;1025:20;1022:1;1015:31;1069:4;1066:1;1059:15;1097:4;1094:1;1087:15;951:161;;738:380;;;:::o;1249:518::-;1351:2;1346:3;1343:11;1340:421;;;1387:5;1384:1;1377:16;1431:4;1428:1;1418:18;1501:2;1489:10;1485:19;1482:1;1478:27;1472:4;1468:38;1537:4;1525:10;1522:20;1519:47;;;-1:-1:-1;1560:4:43;1519:47;1615:2;1610:3;1606:12;1603:1;1599:20;1593:4;1589:31;1579:41;;1670:81;1688:2;1681:5;1678:13;1670:81;;;1747:1;1733:16;;1714:1;1703:13;1670:81;;;1674:3;;1340:421;1249:518;;;:::o;1943:1299::-;2063:10;;-1:-1:-1;;;;;2085:30:43;;2082:56;;;2118:18;;:::i;:::-;2147:97;2237:6;2197:38;2229:4;2223:11;2197:38;:::i;:::-;2191:4;2147:97;:::i;:::-;2293:4;2324:2;2313:14;;2341:1;2336:649;;;;3029:1;3046:6;3043:89;;;-1:-1:-1;3098:19:43;;;3092:26;3043:89;-1:-1:-1;;1900:1:43;1896:11;;;1892:24;1888:29;1878:40;1924:1;1920:11;;;1875:57;3145:81;;2306:930;;2336:649;1196:1;1189:14;;;1233:4;1220:18;;-1:-1:-1;;2372:20:43;;;2490:222;2504:7;2501:1;2498:14;2490:222;;;2586:19;;;2580:26;2565:42;;2693:4;2678:20;;;;2646:1;2634:14;;;;2520:12;2490:222;;;2494:3;2740:6;2731:7;2728:19;2725:201;;;2801:19;;;2795:26;-1:-1:-1;;2884:1:43;2880:14;;;2896:3;2876:24;2872:37;2868:42;2853:58;2838:74;;2725:201;-1:-1:-1;;;;2972:1:43;2956:14;;;2952:22;2939:36;;-1:-1:-1;1943:1299:43:o;5067:418::-;5216:2;5205:9;5198:21;5179:4;5248:6;5242:13;5291:6;5286:2;5275:9;5271:18;5264:34;5350:6;5345:2;5337:6;5333:15;5328:2;5317:9;5313:18;5307:50;5406:1;5401:2;5392:6;5381:9;5377:22;5373:31;5366:42;5476:2;5469;5465:7;5460:2;5452:6;5448:15;5444:29;5433:9;5429:45;5425:54;5417:62;;;5067:418;;;;:::o;5490:297::-;5608:12;;5655:4;5644:16;;;5638:23;;5608:12;5673:16;;5670:111;;;-1:-1:-1;;5747:4:43;5743:17;;;;5740:1;5736:25;5732:38;5721:50;;5490:297;-1:-1:-1;5490:297:43:o;5792:284::-;5861:6;5914:2;5902:9;5893:7;5889:23;5885:32;5882:52;;;5930:1;5927;5920:12;5882:52;5962:9;5956:16;6012:14;6005:5;6001:26;5994:5;5991:37;5981:65;;6042:1;6039;6032:12;6353:225;6420:9;;;6441:11;;;6438:134;;;6494:10;6489:3;6485:20;6482:1;6475:31;6529:4;6526:1;6519:15;6557:4;6554:1;6547:15;6583:266;947:2275:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {
"@BALLOT_TYPEHASH_431": {
"entryPoint": null,
"id": 431,
"parameterSlots": 0,
"returnSlots": 0
},
"@CLOCK_MODE_4578": {
"entryPoint": 3611,
"id": 4578,
"parameterSlots": 0,
"returnSlots": 1
},
"@COUNTING_MODE_3767": {
"entryPoint": null,
"id": 3767,
"parameterSlots": 0,
"returnSlots": 1
},
"@EXTENDED_BALLOT_TYPEHASH_436": {
"entryPoint": null,
"id": 436,
"parameterSlots": 0,
"returnSlots": 0
},
"@_520": {
"entryPoint": null,
"id": 520,
"parameterSlots": 0,
"returnSlots": 0
},
"@_EIP712Name_8096": {
"entryPoint": 7627,
"id": 8096,
"parameterSlots": 0,
"returnSlots": 1
},
"@_EIP712Version_8108": {
"entryPoint": 7671,
"id": 8108,
"parameterSlots": 0,
"returnSlots": 1
},
"@_buildDomainSeparator_8026": {
"entryPoint": null,
"id": 8026,
"parameterSlots": 0,
"returnSlots": 1
},
"@_cancel_14467": {
"entryPoint": 6296,
"id": 14467,
"parameterSlots": 4,
"returnSlots": 1
},
"@_cancel_1519": {
"entryPoint": 11368,
"id": 1519,
"parameterSlots": 4,
"returnSlots": 1
},
"@_cancel_4417": {
"entryPoint": 9665,
"id": 4417,
"parameterSlots": 4,
"returnSlots": 1
},
"@_castVote_1816": {
"entryPoint": 6309,
"id": 1816,
"parameterSlots": 4,
"returnSlots": 1
},
"@_castVote_1891": {
"entryPoint": 6547,
"id": 1891,
"parameterSlots": 5,
"returnSlots": 1
},
"@_checkGovernance_866": {
"entryPoint": 5418,
"id": 866,
"parameterSlots": 0,
"returnSlots": 0
},
"@_countVote_3960": {
"entryPoint": 9972,
"id": 3960,
"parameterSlots": 5,
"returnSlots": 1
},
"@_defaultParams_926": {
"entryPoint": null,
"id": 926,
"parameterSlots": 0,
"returnSlots": 1
},
"@_domainSeparatorV4_8005": {
"entryPoint": 11543,
"id": 8005,
"parameterSlots": 0,
"returnSlots": 1
},
"@_encodeStateBitmap_2053": {
"entryPoint": 5688,
"id": 2053,
"parameterSlots": 1,
"returnSlots": 1
},
"@_executeOperations_14439": {
"entryPoint": 5894,
"id": 14439,
"parameterSlots": 5,
"returnSlots": 0
},
"@_executeOperations_4364": {
"entryPoint": 9216,
"id": 4364,
"parameterSlots": 5,
"returnSlots": 0
},
"@_executor_14480": {
"entryPoint": 2541,
"id": 14480,
"parameterSlots": 0,
"returnSlots": 1
},
"@_executor_4430": {
"entryPoint": null,
"id": 4430,
"parameterSlots": 0,
"returnSlots": 1
},
"@_getVotes_4599": {
"entryPoint": 7863,
"id": 4599,
"parameterSlots": 3,
"returnSlots": 1
},
"@_hashTypedDataV4_8042": {
"entryPoint": 9816,
"id": 8042,
"parameterSlots": 1,
"returnSlots": 1
},
"@_insert_13002": {
"entryPoint": 10978,
"id": 13002,
"parameterSlots": 3,
"returnSlots": 2
},
"@_isValidDescriptionForProposer_2163": {
"entryPoint": 6948,
"id": 2163,
"parameterSlots": 2,
"returnSlots": 1
},
"@_msgData_5640": {
"entryPoint": null,
"id": 5640,
"parameterSlots": 0,
"returnSlots": 2
},
"@_msgSender_5631": {
"entryPoint": null,
"id": 5631,
"parameterSlots": 0,
"returnSlots": 1
},
"@_optimisticUpperLookupRecent_4791": {
"entryPoint": 6769,
"id": 4791,
"parameterSlots": 2,
"returnSlots": 1
},
"@_propose_1142": {
"entryPoint": 7080,
"id": 1142,
"parameterSlots": 5,
"returnSlots": 1
},
"@_queueOperations_14409": {
"entryPoint": 5783,
"id": 14409,
"parameterSlots": 5,
"returnSlots": 1
},
"@_queueOperations_4325": {
"entryPoint": 8798,
"id": 4325,
"parameterSlots": 5,
"returnSlots": 1
},
"@_quorumReached_3843": {
"entryPoint": 11314,
"id": 3843,
"parameterSlots": 1,
"returnSlots": 1
},
"@_revert_5387": {
"entryPoint": 10910,
"id": 5387,
"parameterSlots": 1,
"returnSlots": 0
},
"@_setProposalThreshold_4142": {
"entryPoint": 8367,
"id": 4142,
"parameterSlots": 1,
"returnSlots": 0
},
"@_setVotingDelay_4101": {
"entryPoint": 6846,
"id": 4101,
"parameterSlots": 1,
"returnSlots": 0
},
"@_setVotingPeriod_4126": {
"entryPoint": 8211,
"id": 4126,
"parameterSlots": 1,
"returnSlots": 0
},
"@_tallyUpdated_917": {
"entryPoint": null,
"id": 917,
"parameterSlots": 1,
"returnSlots": 0
},
"@_timelockSalt_4485": {
"entryPoint": null,
"id": 4485,
"parameterSlots": 1,
"returnSlots": 1
},
"@_tryParseChr_7355": {
"entryPoint": 13046,
"id": 7355,
"parameterSlots": 1,
"returnSlots": 1
},
"@_tryParseHexUintUncheckedBounds_7120": {
"entryPoint": 12566,
"id": 7120,
"parameterSlots": 3,
"returnSlots": 2
},
"@_unsafeAccess_13121": {
"entryPoint": null,
"id": 13121,
"parameterSlots": 2,
"returnSlots": 1
},
"@_unsafeReadBytesOffset_2232": {
"entryPoint": null,
"id": 2232,
"parameterSlots": 2,
"returnSlots": 1
},
"@_unsafeReadBytesOffset_7533": {
"entryPoint": null,
"id": 7533,
"parameterSlots": 2,
"returnSlots": 1
},
"@_updateQuorumNumerator_4758": {
"entryPoint": 5539,
"id": 4758,
"parameterSlots": 1,
"returnSlots": 0
},
"@_updateTimelock_4466": {
"entryPoint": 8078,
"id": 4466,
"parameterSlots": 1,
"returnSlots": 0
},
"@_upperBinaryLookup_13054": {
"entryPoint": 12471,
"id": 13054,
"parameterSlots": 4,
"returnSlots": 1
},
"@_useNonce_5713": {
"entryPoint": null,
"id": 5713,
"parameterSlots": 1,
"returnSlots": 1
},
"@_validateCancel_2188": {
"entryPoint": 6227,
"id": 2188,
"parameterSlots": 2,
"returnSlots": 1
},
"@_validateExtendedVoteSig_1792": {
"entryPoint": 6342,
"id": 1792,
"parameterSlots": 6,
"returnSlots": 1
},
"@_validateStateBitmap_2092": {
"entryPoint": 5722,
"id": 2092,
"parameterSlots": 2,
"returnSlots": 1
},
"@_validateVoteSig_1744": {
"entryPoint": 7716,
"id": 1744,
"parameterSlots": 4,
"returnSlots": 1
},
"@_voteSucceeded_3866": {
"entryPoint": null,
"id": 3866,
"parameterSlots": 1,
"returnSlots": 1
},
"@average_8885": {
"entryPoint": 13020,
"id": 8885,
"parameterSlots": 2,
"returnSlots": 1
},
"@blockNumber_14036": {
"entryPoint": 7853,
"id": 14036,
"parameterSlots": 0,
"returnSlots": 1
},
"@byteLength_5909": {
"entryPoint": 13166,
"id": 5909,
"parameterSlots": 1,
"returnSlots": 1
},
"@cancel_1459": {
"entryPoint": 3509,
"id": 1459,
"parameterSlots": 4,
"returnSlots": 1
},
"@castVoteBySig_1667": {
"entryPoint": 4497,
"id": 1667,
"parameterSlots": 4,
"returnSlots": 1
},
"@castVoteWithReasonAndParamsBySig_1709": {
"entryPoint": 3879,
"id": 1709,
"parameterSlots": 7,
"returnSlots": 1
},
"@castVoteWithReasonAndParams_1632": {
"entryPoint": 4068,
"id": 1632,
"parameterSlots": 5,
"returnSlots": 1
},
"@castVoteWithReason_1604": {
"entryPoint": 4169,
"id": 1604,
"parameterSlots": 4,
"returnSlots": 1
},
"@castVote_1579": {
"entryPoint": 3840,
"id": 1579,
"parameterSlots": 2,
"returnSlots": 1
},
"@clear_13964": {
"entryPoint": null,
"id": 13964,
"parameterSlots": 1,
"returnSlots": 0
},
"@clock_4554": {
"entryPoint": 4585,
"id": 4554,
"parameterSlots": 0,
"returnSlots": 1
},
"@eip712Domain_8084": {
"entryPoint": 4431,
"id": 8084,
"parameterSlots": 0,
"returnSlots": 7
},
"@empty_14000": {
"entryPoint": null,
"id": 14000,
"parameterSlots": 1,
"returnSlots": 1
},
"@execute_1354": {
"entryPoint": 3107,
"id": 1354,
"parameterSlots": 4,
"returnSlots": 1
},
"@getProposalId_636": {
"entryPoint": 4784,
"id": 636,
"parameterSlots": 4,
"returnSlots": 1
},
"@getVotesWithParams_1556": {
"entryPoint": 4720,
"id": 1556,
"parameterSlots": 3,
"returnSlots": 1
},
"@getVotes_1537": {
"entryPoint": 5146,
"id": 1537,
"parameterSlots": 2,
"returnSlots": 1
},
"@hasVoted_3786": {
"entryPoint": null,
"id": 3786,
"parameterSlots": 2,
"returnSlots": 1
},
"@hashProposal_611": {
"entryPoint": 5072,
"id": 611,
"parameterSlots": 4,
"returnSlots": 1
},
"@isValidERC1271SignatureNow_8309": {
"entryPoint": 11913,
"id": 8309,
"parameterSlots": 3,
"returnSlots": 1
},
"@isValidSignatureNow_8257": {
"entryPoint": 9860,
"id": 8257,
"parameterSlots": 3,
"returnSlots": 1
},
"@latestCheckpoint_12876": {
"entryPoint": 10224,
"id": 12876,
"parameterSlots": 1,
"returnSlots": 3
},
"@latest_12827": {
"entryPoint": 8010,
"id": 12827,
"parameterSlots": 1,
"returnSlots": 1
},
"@mul512_8575": {
"entryPoint": 10950,
"id": 8575,
"parameterSlots": 2,
"returnSlots": 2
},
"@mulDiv_9062": {
"entryPoint": 8432,
"id": 9062,
"parameterSlots": 3,
"returnSlots": 1
},
"@name_571": {
"entryPoint": 2693,
"id": 571,
"parameterSlots": 0,
"returnSlots": 1
},
"@nonces_5698": {
"entryPoint": null,
"id": 5698,
"parameterSlots": 1,
"returnSlots": 1
},
"@onERC1155BatchReceived_2033": {
"entryPoint": 4815,
"id": 2033,
"parameterSlots": 5,
"returnSlots": 1
},
"@onERC1155Received_1998": {
"entryPoint": 5194,
"id": 1998,
"parameterSlots": 5,
"returnSlots": 1
},
"@onERC721Received_1965": {
"entryPoint": 2837,
"id": 1965,
"parameterSlots": 4,
"returnSlots": 1
},
"@panic_5790": {
"entryPoint": 9199,
"id": 5790,
"parameterSlots": 1,
"returnSlots": 0
},
"@popFront_13850": {
"entryPoint": 8608,
"id": 13850,
"parameterSlots": 1,
"returnSlots": 1
},
"@proposalDeadline_787": {
"entryPoint": 4882,
"id": 787,
"parameterSlots": 1,
"returnSlots": 1
},
"@proposalEta_815": {
"entryPoint": null,
"id": 815,
"parameterSlots": 1,
"returnSlots": 1
},
"@proposalNeedsQueuing_14365": {
"entryPoint": 4797,
"id": 14365,
"parameterSlots": 1,
"returnSlots": 1
},
"@proposalNeedsQueuing_4260": {
"entryPoint": null,
"id": 4260,
"parameterSlots": 1,
"returnSlots": 1
},
"@proposalProposer_801": {
"entryPoint": null,
"id": 801,
"parameterSlots": 1,
"returnSlots": 1
},
"@proposalSnapshot_768": {
"entryPoint": 3467,
"id": 768,
"parameterSlots": 1,
"returnSlots": 1
},
"@proposalThreshold_14378": {
"entryPoint": 4805,
"id": 14378,
"parameterSlots": 0,
"returnSlots": 1
},
"@proposalThreshold_4046": {
"entryPoint": null,
"id": 4046,
"parameterSlots": 0,
"returnSlots": 1
},
"@proposalVotes_3814": {
"entryPoint": 3803,
"id": 3814,
"parameterSlots": 1,
"returnSlots": 3
},
"@propose_999": {
"entryPoint": 4249,
"id": 999,
"parameterSlots": 4,
"returnSlots": 1
},
"@pushBack_13707": {
"entryPoint": 5797,
"id": 13707,
"parameterSlots": 2,
"returnSlots": 0
},
"@push_12630": {
"entryPoint": 8772,
"id": 12630,
"parameterSlots": 3,
"returnSlots": 2
},
"@queue_1210": {
"entryPoint": 2903,
"id": 1210,
"parameterSlots": 4,
"returnSlots": 1
},
"@quorumDenominator_4678": {
"entryPoint": null,
"id": 4678,
"parameterSlots": 0,
"returnSlots": 1
},
"@quorumNumerator_4655": {
"entryPoint": 4742,
"id": 4655,
"parameterSlots": 0,
"returnSlots": 1
},
"@quorumNumerator_4669": {
"entryPoint": 4140,
"id": 4669,
"parameterSlots": 1,
"returnSlots": 1
},
"@quorum_4702": {
"entryPoint": 5261,
"id": 4702,
"parameterSlots": 1,
"returnSlots": 1
},
"@relay_1922": {
"entryPoint": 4948,
"id": 1922,
"parameterSlots": 4,
"returnSlots": 0
},
"@setProposalThreshold_4085": {
"entryPoint": 5177,
"id": 4085,
"parameterSlots": 1,
"returnSlots": 0
},
"@setVotingDelay_4059": {
"entryPoint": 4152,
"id": 4059,
"parameterSlots": 1,
"returnSlots": 0
},
"@setVotingPeriod_4072": {
"entryPoint": 5129,
"id": 4072,
"parameterSlots": 1,
"returnSlots": 0
},
"@sqrt_9700": {
"entryPoint": 12127,
"id": 9700,
"parameterSlots": 1,
"returnSlots": 1
},
"@state_14349": {
"entryPoint": 3499,
"id": 14349,
"parameterSlots": 1,
"returnSlots": 1
},
"@state_4236": {
"entryPoint": 5914,
"id": 4236,
"parameterSlots": 1,
"returnSlots": 1
},
"@state_745": {
"entryPoint": 9360,
"id": 745,
"parameterSlots": 1,
"returnSlots": 1
},
"@supportsInterface_562": {
"entryPoint": 2565,
"id": 562,
"parameterSlots": 1,
"returnSlots": 1
},
"@supportsInterface_8522": {
"entryPoint": null,
"id": 8522,
"parameterSlots": 1,
"returnSlots": 1
},
"@ternary_8824": {
"entryPoint": null,
"id": 8824,
"parameterSlots": 3,
"returnSlots": 1
},
"@timelock_4248": {
"entryPoint": null,
"id": 4248,
"parameterSlots": 0,
"returnSlots": 1
},
"@toStringWithFallback_5976": {
"entryPoint": 10741,
"id": 5976,
"parameterSlots": 2,
"returnSlots": 1
},
"@toString_5877": {
"entryPoint": 12759,
"id": 5877,
"parameterSlots": 1,
"returnSlots": 1
},
"@toTypedDataHash_8194": {
"entryPoint": null,
"id": 8194,
"parameterSlots": 2,
"returnSlots": 1
},
"@toUint208_10351": {
"entryPoint": 8717,
"id": 10351,
"parameterSlots": 1,
"returnSlots": 1
},
"@toUint32_10967": {
"entryPoint": 10693,
"id": 10967,
"parameterSlots": 1,
"returnSlots": 1
},
"@toUint48_10911": {
"entryPoint": 10312,
"id": 10911,
"parameterSlots": 1,
"returnSlots": 1
},
"@toUint_11920": {
"entryPoint": null,
"id": 11920,
"parameterSlots": 1,
"returnSlots": 1
},
"@token_4528": {
"entryPoint": null,
"id": 4528,
"parameterSlots": 0,
"returnSlots": 1
},
"@tryParseAddress_7295": {
"entryPoint": 10524,
"id": 7295,
"parameterSlots": 3,
"returnSlots": 2
},
"@tryRecover_7608": {
"entryPoint": 11840,
"id": 7608,
"parameterSlots": 2,
"returnSlots": 3
},
"@tryRecover_7796": {
"entryPoint": 12820,
"id": 7796,
"parameterSlots": 4,
"returnSlots": 3
},
"@updateQuorumNumerator_4715": {
"entryPoint": 2673,
"id": 4715,
"parameterSlots": 1,
"returnSlots": 0
},
"@updateTimelock_4444": {
"entryPoint": 4767,
"id": 4444,
"parameterSlots": 1,
"returnSlots": 0
},
"@upperLookupRecent_12797": {
"entryPoint": 10362,
"id": 12797,
"parameterSlots": 2,
"returnSlots": 1
},
"@verifyCallResult_5367": {
"entryPoint": 8183,
"id": 5367,
"parameterSlots": 2,
"returnSlots": 1
},
"@version_580": {
"entryPoint": null,
"id": 580,
"parameterSlots": 0,
"returnSlots": 1
},
"@votingDelay_4026": {
"entryPoint": null,
"id": 4026,
"parameterSlots": 0,
"returnSlots": 1
},
"@votingPeriod_4036": {
"entryPoint": null,
"id": 4036,
"parameterSlots": 0,
"returnSlots": 1
},
"abi_decode_array_address_dyn": {
"entryPoint": 13683,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_array_bytes_dyn": {
"entryPoint": 13874,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_array_uint256_dyn": {
"entryPoint": 13783,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_available_length_bytes": {
"entryPoint": 13457,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_decode_bytes": {
"entryPoint": 13516,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_string_calldata": {
"entryPoint": 14317,
"id": null,
"parameterSlots": 2,
"returnSlots": 2
},
"abi_decode_tuple_t_address": {
"entryPoint": 15021,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_addresst_addresst_array$_t_uint256_$dyn_memory_ptrt_array$_t_uint256_$dyn_memory_ptrt_bytes_memory_ptr": {
"entryPoint": 15378,
"id": null,
"parameterSlots": 2,
"returnSlots": 5
},
"abi_decode_tuple_t_addresst_addresst_uint256t_bytes_memory_ptr": {
"entryPoint": 13546,
"id": null,
"parameterSlots": 2,
"returnSlots": 4
},
"abi_decode_tuple_t_addresst_addresst_uint256t_uint256t_bytes_memory_ptr": {
"entryPoint": 15669,
"id": null,
"parameterSlots": 2,
"returnSlots": 5
},
"abi_decode_tuple_t_addresst_uint256": {
"entryPoint": 15627,
"id": null,
"parameterSlots": 2,
"returnSlots": 2
},
"abi_decode_tuple_t_addresst_uint256t_bytes_calldata_ptr": {
"entryPoint": 15529,
"id": null,
"parameterSlots": 2,
"returnSlots": 4
},
"abi_decode_tuple_t_addresst_uint256t_bytes_memory_ptr": {
"entryPoint": 15294,
"id": null,
"parameterSlots": 2,
"returnSlots": 3
},
"abi_decode_tuple_t_array$_t_address_$dyn_memory_ptrt_array$_t_uint256_$dyn_memory_ptrt_array$_t_bytes_memory_ptr_$dyn_memory_ptrt_bytes32": {
"entryPoint": 14000,
"id": null,
"parameterSlots": 2,
"returnSlots": 4
},
"abi_decode_tuple_t_array$_t_address_$dyn_memory_ptrt_array$_t_uint256_$dyn_memory_ptrt_array$_t_bytes_memory_ptr_$dyn_memory_ptrt_string_memory_ptr": {
"entryPoint": 14833,
"id": null,
"parameterSlots": 2,
"returnSlots": 4
},
"abi_decode_tuple_t_bool_fromMemory": {
"entryPoint": 16348,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_bytes32_fromMemory": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_bytes4": {
"entryPoint": 13205,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_contract$_TimelockController_$3728": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_string_memory_ptr_fromMemory": {
"entryPoint": 15832,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_uint256": {
"entryPoint": 13244,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_uint256_fromMemory": {
"entryPoint": 16291,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_uint256t_address": {
"entryPoint": 14213,
"id": null,
"parameterSlots": 2,
"returnSlots": 2
},
"abi_decode_tuple_t_uint256t_uint8": {
"entryPoint": 14275,
"id": null,
"parameterSlots": 2,
"returnSlots": 2
},
"abi_decode_tuple_t_uint256t_uint8t_addresst_bytes_memory_ptr": {
"entryPoint": 15217,
"id": null,
"parameterSlots": 2,
"returnSlots": 4
},
"abi_decode_tuple_t_uint256t_uint8t_addresst_string_calldata_ptrt_bytes_memory_ptrt_bytes_memory_ptr": {
"entryPoint": 14385,
"id": null,
"parameterSlots": 2,
"returnSlots": 7
},
"abi_decode_tuple_t_uint256t_uint8t_string_calldata_ptr": {
"entryPoint": 14748,
"id": null,
"parameterSlots": 2,
"returnSlots": 4
},
"abi_decode_tuple_t_uint256t_uint8t_string_calldata_ptrt_bytes_memory_ptr": {
"entryPoint": 14573,
"id": null,
"parameterSlots": 2,
"returnSlots": 5
},
"abi_decode_tuple_t_uint32": {
"entryPoint": 15592,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_uint48": {
"entryPoint": 14721,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_uint48_fromMemory": {
"entryPoint": 15998,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_uint8": {
"entryPoint": 14259,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_array_address_dyn": {
"entryPoint": 16070,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_array_bytes_dyn": {
"entryPoint": 16127,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_array_uint256_dyn": {
"entryPoint": 15048,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_enum_ProposalState": {
"entryPoint": 14167,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_string": {
"entryPoint": 13267,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_packed_t_bytes_calldata_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed": {
"entryPoint": 16055,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed": {
"entryPoint": 17221,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_address__to_t_address__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_address_t_uint256_t_uint256__to_t_address_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 4,
"returnSlots": 1
},
"abi_encode_tuple_t_array$_t_address_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_bytes_memory_ptr_$dyn_memory_ptr_t_bytes32__to_t_array$_t_address_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_bytes_memory_ptr_$dyn_memory_ptr_t_bytes32__fromStack_reversed": {
"entryPoint": 16217,
"id": null,
"parameterSlots": 5,
"returnSlots": 1
},
"abi_encode_tuple_t_array$_t_address_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_bytes_memory_ptr_$dyn_memory_ptr_t_rational_0_by_1_t_bytes32__to_t_array$_t_address_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_bytes_memory_ptr_$dyn_memory_ptr_t_bytes32_t_bytes32__fromStack_reversed": {
"entryPoint": 16752,
"id": null,
"parameterSlots": 6,
"returnSlots": 1
},
"abi_encode_tuple_t_array$_t_address_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_bytes_memory_ptr_$dyn_memory_ptr_t_rational_0_by_1_t_bytes32_t_uint256__to_t_array$_t_address_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_bytes_memory_ptr_$dyn_memory_ptr_t_bytes32_t_bytes32_t_uint256__fromStack_reversed": {
"entryPoint": 16829,
"id": null,
"parameterSlots": 7,
"returnSlots": 1
},
"abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__to_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed": {
"entryPoint": 15106,
"id": null,
"parameterSlots": 8,
"returnSlots": 1
},
"abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 6,
"returnSlots": 1
},
"abi_encode_tuple_t_bytes32_t_bytes_memory_ptr__to_t_bytes32_t_bytes_memory_ptr__fromStack_reversed": {
"entryPoint": 17197,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_bytes32_t_uint256_t_uint8_t_address_t_uint256__to_t_bytes32_t_uint256_t_uint8_t_address_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 6,
"returnSlots": 1
},
"abi_encode_tuple_t_bytes32_t_uint256_t_uint8_t_address_t_uint256_t_bytes32_t_bytes32__to_t_bytes32_t_uint256_t_uint8_t_address_t_uint256_t_bytes32_t_bytes32__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 8,
"returnSlots": 1
},
"abi_encode_tuple_t_bytes32_t_uint8_t_bytes32_t_bytes32__to_t_bytes32_t_uint8_t_bytes32_t_bytes32__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 5,
"returnSlots": 1
},
"abi_encode_tuple_t_bytes4__to_t_bytes4__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_contract$_IERC5805_$4929__to_t_address__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_enum$_ProposalState_$2253__to_t_uint8__fromStack_reversed": {
"entryPoint": 14199,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_rational_0_by_1__to_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_rational_208_by_1_t_uint256__to_t_uint8_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_rational_32_by_1_t_uint256__to_t_uint8_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_rational_48_by_1_t_uint256__to_t_uint8_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 13313,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_address__to_t_uint256_t_address__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_address_t_array$_t_address_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_string_memory_ptr_$dyn_memory_ptr_t_array$_t_bytes_memory_ptr_$dyn_memory_ptr_t_uint256_t_uint256_t_string_memory_ptr__to_t_uint256_t_address_t_array$_t_address_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_string_memory_ptr_$dyn_memory_ptr_t_array$_t_bytes_memory_ptr_$dyn_memory_ptr_t_uint256_t_uint256_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 16494,
"id": null,
"parameterSlots": 10,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_enum$_ProposalState_$2253_t_bytes32__to_t_uint256_t_uint8_t_bytes32__fromStack_reversed": {
"entryPoint": 16314,
"id": null,
"parameterSlots": 4,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_uint256__to_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_uint256_t_uint256__to_t_uint256_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 4,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_uint48__to_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_uint8_t_uint256_t_string_memory_ptr__to_t_uint256_t_uint8_t_uint256_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 16379,
"id": null,
"parameterSlots": 5,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_uint8_t_uint256_t_string_memory_ptr_t_bytes_memory_ptr__to_t_uint256_t_uint8_t_uint256_t_string_memory_ptr_t_bytes_memory_ptr__fromStack_reversed": {
"entryPoint": 16418,
"id": null,
"parameterSlots": 6,
"returnSlots": 1
},
"abi_encode_tuple_t_uint32_t_uint32__to_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_uint48__to_t_uint48__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_uint48_t_uint48__to_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": null,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"allocate_memory": {
"entryPoint": 13371,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"array_allocation_size_array_address_dyn": {
"entryPoint": 13649,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"array_allocation_size_bytes": {
"entryPoint": 13419,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"checked_add_t_uint256": {
"entryPoint": 16475,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_add_t_uint48": {
"entryPoint": 16025,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_add_t_uint8": {
"entryPoint": 16939,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_div_t_uint256": {
"entryPoint": 17243,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_exp_helper": {
"entryPoint": 16964,
"id": null,
"parameterSlots": 3,
"returnSlots": 2
},
"checked_exp_t_uint256_t_uint8": {
"entryPoint": 17183,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_exp_unsigned": {
"entryPoint": 17023,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_mul_t_uint256": {
"entryPoint": 16916,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_sub_t_uint256": {
"entryPoint": 16713,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_sub_t_uint48": {
"entryPoint": 15968,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"extract_byte_array_length": {
"entryPoint": 15756,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"panic_error_0x11": {
"entryPoint": 15948,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"panic_error_0x12": {
"entryPoint": 16732,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"panic_error_0x21": {
"entryPoint": 14147,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"panic_error_0x32": {
"entryPoint": 15812,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"panic_error_0x41": {
"entryPoint": 13351,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"validator_revert_address": {
"entryPoint": 13331,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_uint48": {
"entryPoint": 14702,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
}
},
"generatedSources": [
{
"ast": {
"nativeSrc": "0:38557:43",
"nodeType": "YulBlock",
"src": "0:38557:43",
"statements": [
{
"nativeSrc": "6:3:43",
"nodeType": "YulBlock",
"src": "6:3:43",
"statements": []
},
{
"body": {
"nativeSrc": "83:217:43",
"nodeType": "YulBlock",
"src": "83:217:43",
"statements": [
{
"body": {
"nativeSrc": "129:16:43",
"nodeType": "YulBlock",
"src": "129:16:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "138:1:43",
"nodeType": "YulLiteral",
"src": "138:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "141:1:43",
"nodeType": "YulLiteral",
"src": "141:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "131:6:43",
"nodeType": "YulIdentifier",
"src": "131:6:43"
},
"nativeSrc": "131:12:43",
"nodeType": "YulFunctionCall",
"src": "131:12:43"
},
"nativeSrc": "131:12:43",
"nodeType": "YulExpressionStatement",
"src": "131:12:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nativeSrc": "104:7:43",
"nodeType": "YulIdentifier",
"src": "104:7:43"
},
{
"name": "headStart",
"nativeSrc": "113:9:43",
"nodeType": "YulIdentifier",
"src": "113:9:43"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "100:3:43",
"nodeType": "YulIdentifier",
"src": "100:3:43"
},
"nativeSrc": "100:23:43",
"nodeType": "YulFunctionCall",
"src": "100:23:43"
},
{
"kind": "number",
"nativeSrc": "125:2:43",
"nodeType": "YulLiteral",
"src": "125:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nativeSrc": "96:3:43",
"nodeType": "YulIdentifier",
"src": "96:3:43"
},
"nativeSrc": "96:32:43",
"nodeType": "YulFunctionCall",
"src": "96:32:43"
},
"nativeSrc": "93:52:43",
"nodeType": "YulIf",
"src": "93:52:43"
},
{
"nativeSrc": "154:36:43",
"nodeType": "YulVariableDeclaration",
"src": "154:36:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "180:9:43",
"nodeType": "YulIdentifier",
"src": "180:9:43"
}
],
"functionName": {
"name": "calldataload",
"nativeSrc": "167:12:43",
"nodeType": "YulIdentifier",
"src": "167:12:43"
},
"nativeSrc": "167:23:43",
"nodeType": "YulFunctionCall",
"src": "167:23:43"
},
"variables": [
{
"name": "value",
"nativeSrc": "158:5:43",
"nodeType": "YulTypedName",
"src": "158:5:43",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "254:16:43",
"nodeType": "YulBlock",
"src": "254:16:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "263:1:43",
"nodeType": "YulLiteral",
"src": "263:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "266:1:43",
"nodeType": "YulLiteral",
"src": "266:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "256:6:43",
"nodeType": "YulIdentifier",
"src": "256:6:43"
},
"nativeSrc": "256:12:43",
"nodeType": "YulFunctionCall",
"src": "256:12:43"
},
"nativeSrc": "256:12:43",
"nodeType": "YulExpressionStatement",
"src": "256:12:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nativeSrc": "212:5:43",
"nodeType": "YulIdentifier",
"src": "212:5:43"
},
{
"arguments": [
{
"name": "value",
"nativeSrc": "223:5:43",
"nodeType": "YulIdentifier",
"src": "223:5:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "234:3:43",
"nodeType": "YulLiteral",
"src": "234:3:43",
"type": "",
"value": "224"
},
{
"kind": "number",
"nativeSrc": "239:10:43",
"nodeType": "YulLiteral",
"src": "239:10:43",
"type": "",
"value": "0xffffffff"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "230:3:43",
"nodeType": "YulIdentifier",
"src": "230:3:43"
},
"nativeSrc": "230:20:43",
"nodeType": "YulFunctionCall",
"src": "230:20:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "219:3:43",
"nodeType": "YulIdentifier",
"src": "219:3:43"
},
"nativeSrc": "219:32:43",
"nodeType": "YulFunctionCall",
"src": "219:32:43"
}
],
"functionName": {
"name": "eq",
"nativeSrc": "209:2:43",
"nodeType": "YulIdentifier",
"src": "209:2:43"
},
"nativeSrc": "209:43:43",
"nodeType": "YulFunctionCall",
"src": "209:43:43"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "202:6:43",
"nodeType": "YulIdentifier",
"src": "202:6:43"
},
"nativeSrc": "202:51:43",
"nodeType": "YulFunctionCall",
"src": "202:51:43"
},
"nativeSrc": "199:71:43",
"nodeType": "YulIf",
"src": "199:71:43"
},
{
"nativeSrc": "279:15:43",
"nodeType": "YulAssignment",
"src": "279:15:43",
"value": {
"name": "value",
"nativeSrc": "289:5:43",
"nodeType": "YulIdentifier",
"src": "289:5:43"
},
"variableNames": [
{
"name": "value0",
"nativeSrc": "279:6:43",
"nodeType": "YulIdentifier",
"src": "279:6:43"
}
]
}
]
},
"name": "abi_decode_tuple_t_bytes4",
"nativeSrc": "14:286:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "49:9:43",
"nodeType": "YulTypedName",
"src": "49:9:43",
"type": ""
},
{
"name": "dataEnd",
"nativeSrc": "60:7:43",
"nodeType": "YulTypedName",
"src": "60:7:43",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nativeSrc": "72:6:43",
"nodeType": "YulTypedName",
"src": "72:6:43",
"type": ""
}
],
"src": "14:286:43"
},
{
"body": {
"nativeSrc": "400:92:43",
"nodeType": "YulBlock",
"src": "400:92:43",
"statements": [
{
"nativeSrc": "410:26:43",
"nodeType": "YulAssignment",
"src": "410:26:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "422:9:43",
"nodeType": "YulIdentifier",
"src": "422:9:43"
},
{
"kind": "number",
"nativeSrc": "433:2:43",
"nodeType": "YulLiteral",
"src": "433:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "418:3:43",
"nodeType": "YulIdentifier",
"src": "418:3:43"
},
"nativeSrc": "418:18:43",
"nodeType": "YulFunctionCall",
"src": "418:18:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "410:4:43",
"nodeType": "YulIdentifier",
"src": "410:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "452:9:43",
"nodeType": "YulIdentifier",
"src": "452:9:43"
},
{
"arguments": [
{
"arguments": [
{
"name": "value0",
"nativeSrc": "477:6:43",
"nodeType": "YulIdentifier",
"src": "477:6:43"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "470:6:43",
"nodeType": "YulIdentifier",
"src": "470:6:43"
},
"nativeSrc": "470:14:43",
"nodeType": "YulFunctionCall",
"src": "470:14:43"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "463:6:43",
"nodeType": "YulIdentifier",
"src": "463:6:43"
},
"nativeSrc": "463:22:43",
"nodeType": "YulFunctionCall",
"src": "463:22:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "445:6:43",
"nodeType": "YulIdentifier",
"src": "445:6:43"
},
"nativeSrc": "445:41:43",
"nodeType": "YulFunctionCall",
"src": "445:41:43"
},
"nativeSrc": "445:41:43",
"nodeType": "YulExpressionStatement",
"src": "445:41:43"
}
]
},
"name": "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed",
"nativeSrc": "305:187:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "369:9:43",
"nodeType": "YulTypedName",
"src": "369:9:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "380:6:43",
"nodeType": "YulTypedName",
"src": "380:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "391:4:43",
"nodeType": "YulTypedName",
"src": "391:4:43",
"type": ""
}
],
"src": "305:187:43"
},
{
"body": {
"nativeSrc": "598:76:43",
"nodeType": "YulBlock",
"src": "598:76:43",
"statements": [
{
"nativeSrc": "608:26:43",
"nodeType": "YulAssignment",
"src": "608:26:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "620:9:43",
"nodeType": "YulIdentifier",
"src": "620:9:43"
},
{
"kind": "number",
"nativeSrc": "631:2:43",
"nodeType": "YulLiteral",
"src": "631:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "616:3:43",
"nodeType": "YulIdentifier",
"src": "616:3:43"
},
"nativeSrc": "616:18:43",
"nodeType": "YulFunctionCall",
"src": "616:18:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "608:4:43",
"nodeType": "YulIdentifier",
"src": "608:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "650:9:43",
"nodeType": "YulIdentifier",
"src": "650:9:43"
},
{
"name": "value0",
"nativeSrc": "661:6:43",
"nodeType": "YulIdentifier",
"src": "661:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "643:6:43",
"nodeType": "YulIdentifier",
"src": "643:6:43"
},
"nativeSrc": "643:25:43",
"nodeType": "YulFunctionCall",
"src": "643:25:43"
},
"nativeSrc": "643:25:43",
"nodeType": "YulExpressionStatement",
"src": "643:25:43"
}
]
},
"name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed",
"nativeSrc": "497:177:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "567:9:43",
"nodeType": "YulTypedName",
"src": "567:9:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "578:6:43",
"nodeType": "YulTypedName",
"src": "578:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "589:4:43",
"nodeType": "YulTypedName",
"src": "589:4:43",
"type": ""
}
],
"src": "497:177:43"
},
{
"body": {
"nativeSrc": "749:156:43",
"nodeType": "YulBlock",
"src": "749:156:43",
"statements": [
{
"body": {
"nativeSrc": "795:16:43",
"nodeType": "YulBlock",
"src": "795:16:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "804:1:43",
"nodeType": "YulLiteral",
"src": "804:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "807:1:43",
"nodeType": "YulLiteral",
"src": "807:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "797:6:43",
"nodeType": "YulIdentifier",
"src": "797:6:43"
},
"nativeSrc": "797:12:43",
"nodeType": "YulFunctionCall",
"src": "797:12:43"
},
"nativeSrc": "797:12:43",
"nodeType": "YulExpressionStatement",
"src": "797:12:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nativeSrc": "770:7:43",
"nodeType": "YulIdentifier",
"src": "770:7:43"
},
{
"name": "headStart",
"nativeSrc": "779:9:43",
"nodeType": "YulIdentifier",
"src": "779:9:43"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "766:3:43",
"nodeType": "YulIdentifier",
"src": "766:3:43"
},
"nativeSrc": "766:23:43",
"nodeType": "YulFunctionCall",
"src": "766:23:43"
},
{
"kind": "number",
"nativeSrc": "791:2:43",
"nodeType": "YulLiteral",
"src": "791:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nativeSrc": "762:3:43",
"nodeType": "YulIdentifier",
"src": "762:3:43"
},
"nativeSrc": "762:32:43",
"nodeType": "YulFunctionCall",
"src": "762:32:43"
},
"nativeSrc": "759:52:43",
"nodeType": "YulIf",
"src": "759:52:43"
},
{
"nativeSrc": "820:14:43",
"nodeType": "YulVariableDeclaration",
"src": "820:14:43",
"value": {
"kind": "number",
"nativeSrc": "833:1:43",
"nodeType": "YulLiteral",
"src": "833:1:43",
"type": "",
"value": "0"
},
"variables": [
{
"name": "value",
"nativeSrc": "824:5:43",
"nodeType": "YulTypedName",
"src": "824:5:43",
"type": ""
}
]
},
{
"nativeSrc": "843:32:43",
"nodeType": "YulAssignment",
"src": "843:32:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "865:9:43",
"nodeType": "YulIdentifier",
"src": "865:9:43"
}
],
"functionName": {
"name": "calldataload",
"nativeSrc": "852:12:43",
"nodeType": "YulIdentifier",
"src": "852:12:43"
},
"nativeSrc": "852:23:43",
"nodeType": "YulFunctionCall",
"src": "852:23:43"
},
"variableNames": [
{
"name": "value",
"nativeSrc": "843:5:43",
"nodeType": "YulIdentifier",
"src": "843:5:43"
}
]
},
{
"nativeSrc": "884:15:43",
"nodeType": "YulAssignment",
"src": "884:15:43",
"value": {
"name": "value",
"nativeSrc": "894:5:43",
"nodeType": "YulIdentifier",
"src": "894:5:43"
},
"variableNames": [
{
"name": "value0",
"nativeSrc": "884:6:43",
"nodeType": "YulIdentifier",
"src": "884:6:43"
}
]
}
]
},
"name": "abi_decode_tuple_t_uint256",
"nativeSrc": "679:226:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "715:9:43",
"nodeType": "YulTypedName",
"src": "715:9:43",
"type": ""
},
{
"name": "dataEnd",
"nativeSrc": "726:7:43",
"nodeType": "YulTypedName",
"src": "726:7:43",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nativeSrc": "738:6:43",
"nodeType": "YulTypedName",
"src": "738:6:43",
"type": ""
}
],
"src": "679:226:43"
},
{
"body": {
"nativeSrc": "960:239:43",
"nodeType": "YulBlock",
"src": "960:239:43",
"statements": [
{
"nativeSrc": "970:26:43",
"nodeType": "YulVariableDeclaration",
"src": "970:26:43",
"value": {
"arguments": [
{
"name": "value",
"nativeSrc": "990:5:43",
"nodeType": "YulIdentifier",
"src": "990:5:43"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "984:5:43",
"nodeType": "YulIdentifier",
"src": "984:5:43"
},
"nativeSrc": "984:12:43",
"nodeType": "YulFunctionCall",
"src": "984:12:43"
},
"variables": [
{
"name": "length",
"nativeSrc": "974:6:43",
"nodeType": "YulTypedName",
"src": "974:6:43",
"type": ""
}
]
},
{
"expression": {
"arguments": [
{
"name": "pos",
"nativeSrc": "1012:3:43",
"nodeType": "YulIdentifier",
"src": "1012:3:43"
},
{
"name": "length",
"nativeSrc": "1017:6:43",
"nodeType": "YulIdentifier",
"src": "1017:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1005:6:43",
"nodeType": "YulIdentifier",
"src": "1005:6:43"
},
"nativeSrc": "1005:19:43",
"nodeType": "YulFunctionCall",
"src": "1005:19:43"
},
"nativeSrc": "1005:19:43",
"nodeType": "YulExpressionStatement",
"src": "1005:19:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "pos",
"nativeSrc": "1043:3:43",
"nodeType": "YulIdentifier",
"src": "1043:3:43"
},
{
"kind": "number",
"nativeSrc": "1048:4:43",
"nodeType": "YulLiteral",
"src": "1048:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1039:3:43",
"nodeType": "YulIdentifier",
"src": "1039:3:43"
},
"nativeSrc": "1039:14:43",
"nodeType": "YulFunctionCall",
"src": "1039:14:43"
},
{
"arguments": [
{
"name": "value",
"nativeSrc": "1059:5:43",
"nodeType": "YulIdentifier",
"src": "1059:5:43"
},
{
"kind": "number",
"nativeSrc": "1066:4:43",
"nodeType": "YulLiteral",
"src": "1066:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1055:3:43",
"nodeType": "YulIdentifier",
"src": "1055:3:43"
},
"nativeSrc": "1055:16:43",
"nodeType": "YulFunctionCall",
"src": "1055:16:43"
},
{
"name": "length",
"nativeSrc": "1073:6:43",
"nodeType": "YulIdentifier",
"src": "1073:6:43"
}
],
"functionName": {
"name": "mcopy",
"nativeSrc": "1033:5:43",
"nodeType": "YulIdentifier",
"src": "1033:5:43"
},
"nativeSrc": "1033:47:43",
"nodeType": "YulFunctionCall",
"src": "1033:47:43"
},
"nativeSrc": "1033:47:43",
"nodeType": "YulExpressionStatement",
"src": "1033:47:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "pos",
"nativeSrc": "1104:3:43",
"nodeType": "YulIdentifier",
"src": "1104:3:43"
},
{
"name": "length",
"nativeSrc": "1109:6:43",
"nodeType": "YulIdentifier",
"src": "1109:6:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1100:3:43",
"nodeType": "YulIdentifier",
"src": "1100:3:43"
},
"nativeSrc": "1100:16:43",
"nodeType": "YulFunctionCall",
"src": "1100:16:43"
},
{
"kind": "number",
"nativeSrc": "1118:4:43",
"nodeType": "YulLiteral",
"src": "1118:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1096:3:43",
"nodeType": "YulIdentifier",
"src": "1096:3:43"
},
"nativeSrc": "1096:27:43",
"nodeType": "YulFunctionCall",
"src": "1096:27:43"
},
{
"kind": "number",
"nativeSrc": "1125:1:43",
"nodeType": "YulLiteral",
"src": "1125:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1089:6:43",
"nodeType": "YulIdentifier",
"src": "1089:6:43"
},
"nativeSrc": "1089:38:43",
"nodeType": "YulFunctionCall",
"src": "1089:38:43"
},
"nativeSrc": "1089:38:43",
"nodeType": "YulExpressionStatement",
"src": "1089:38:43"
},
{
"nativeSrc": "1136:57:43",
"nodeType": "YulAssignment",
"src": "1136:57:43",
"value": {
"arguments": [
{
"arguments": [
{
"name": "pos",
"nativeSrc": "1151:3:43",
"nodeType": "YulIdentifier",
"src": "1151:3:43"
},
{
"arguments": [
{
"arguments": [
{
"name": "length",
"nativeSrc": "1164:6:43",
"nodeType": "YulIdentifier",
"src": "1164:6:43"
},
{
"kind": "number",
"nativeSrc": "1172:2:43",
"nodeType": "YulLiteral",
"src": "1172:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1160:3:43",
"nodeType": "YulIdentifier",
"src": "1160:3:43"
},
"nativeSrc": "1160:15:43",
"nodeType": "YulFunctionCall",
"src": "1160:15:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "1181:2:43",
"nodeType": "YulLiteral",
"src": "1181:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "not",
"nativeSrc": "1177:3:43",
"nodeType": "YulIdentifier",
"src": "1177:3:43"
},
"nativeSrc": "1177:7:43",
"nodeType": "YulFunctionCall",
"src": "1177:7:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "1156:3:43",
"nodeType": "YulIdentifier",
"src": "1156:3:43"
},
"nativeSrc": "1156:29:43",
"nodeType": "YulFunctionCall",
"src": "1156:29:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1147:3:43",
"nodeType": "YulIdentifier",
"src": "1147:3:43"
},
"nativeSrc": "1147:39:43",
"nodeType": "YulFunctionCall",
"src": "1147:39:43"
},
{
"kind": "number",
"nativeSrc": "1188:4:43",
"nodeType": "YulLiteral",
"src": "1188:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1143:3:43",
"nodeType": "YulIdentifier",
"src": "1143:3:43"
},
"nativeSrc": "1143:50:43",
"nodeType": "YulFunctionCall",
"src": "1143:50:43"
},
"variableNames": [
{
"name": "end",
"nativeSrc": "1136:3:43",
"nodeType": "YulIdentifier",
"src": "1136:3:43"
}
]
}
]
},
"name": "abi_encode_string",
"nativeSrc": "910:289:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "937:5:43",
"nodeType": "YulTypedName",
"src": "937:5:43",
"type": ""
},
{
"name": "pos",
"nativeSrc": "944:3:43",
"nodeType": "YulTypedName",
"src": "944:3:43",
"type": ""
}
],
"returnVariables": [
{
"name": "end",
"nativeSrc": "952:3:43",
"nodeType": "YulTypedName",
"src": "952:3:43",
"type": ""
}
],
"src": "910:289:43"
},
{
"body": {
"nativeSrc": "1325:99:43",
"nodeType": "YulBlock",
"src": "1325:99:43",
"statements": [
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "1342:9:43",
"nodeType": "YulIdentifier",
"src": "1342:9:43"
},
{
"kind": "number",
"nativeSrc": "1353:2:43",
"nodeType": "YulLiteral",
"src": "1353:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1335:6:43",
"nodeType": "YulIdentifier",
"src": "1335:6:43"
},
"nativeSrc": "1335:21:43",
"nodeType": "YulFunctionCall",
"src": "1335:21:43"
},
"nativeSrc": "1335:21:43",
"nodeType": "YulExpressionStatement",
"src": "1335:21:43"
},
{
"nativeSrc": "1365:53:43",
"nodeType": "YulAssignment",
"src": "1365:53:43",
"value": {
"arguments": [
{
"name": "value0",
"nativeSrc": "1391:6:43",
"nodeType": "YulIdentifier",
"src": "1391:6:43"
},
{
"arguments": [
{
"name": "headStart",
"nativeSrc": "1403:9:43",
"nodeType": "YulIdentifier",
"src": "1403:9:43"
},
{
"kind": "number",
"nativeSrc": "1414:2:43",
"nodeType": "YulLiteral",
"src": "1414:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1399:3:43",
"nodeType": "YulIdentifier",
"src": "1399:3:43"
},
"nativeSrc": "1399:18:43",
"nodeType": "YulFunctionCall",
"src": "1399:18:43"
}
],
"functionName": {
"name": "abi_encode_string",
"nativeSrc": "1373:17:43",
"nodeType": "YulIdentifier",
"src": "1373:17:43"
},
"nativeSrc": "1373:45:43",
"nodeType": "YulFunctionCall",
"src": "1373:45:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "1365:4:43",
"nodeType": "YulIdentifier",
"src": "1365:4:43"
}
]
}
]
},
"name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed",
"nativeSrc": "1204:220:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "1294:9:43",
"nodeType": "YulTypedName",
"src": "1294:9:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "1305:6:43",
"nodeType": "YulTypedName",
"src": "1305:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "1316:4:43",
"nodeType": "YulTypedName",
"src": "1316:4:43",
"type": ""
}
],
"src": "1204:220:43"
},
{
"body": {
"nativeSrc": "1530:102:43",
"nodeType": "YulBlock",
"src": "1530:102:43",
"statements": [
{
"nativeSrc": "1540:26:43",
"nodeType": "YulAssignment",
"src": "1540:26:43",
"value": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "1552:9:43",
"nodeType": "YulIdentifier",
"src": "1552:9:43"
},
{
"kind": "number",
"nativeSrc": "1563:2:43",
"nodeType": "YulLiteral",
"src": "1563:2:43",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nativeSrc": "1548:3:43",
"nodeType": "YulIdentifier",
"src": "1548:3:43"
},
"nativeSrc": "1548:18:43",
"nodeType": "YulFunctionCall",
"src": "1548:18:43"
},
"variableNames": [
{
"name": "tail",
"nativeSrc": "1540:4:43",
"nodeType": "YulIdentifier",
"src": "1540:4:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "headStart",
"nativeSrc": "1582:9:43",
"nodeType": "YulIdentifier",
"src": "1582:9:43"
},
{
"arguments": [
{
"name": "value0",
"nativeSrc": "1597:6:43",
"nodeType": "YulIdentifier",
"src": "1597:6:43"
},
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "1613:3:43",
"nodeType": "YulLiteral",
"src": "1613:3:43",
"type": "",
"value": "160"
},
{
"kind": "number",
"nativeSrc": "1618:1:43",
"nodeType": "YulLiteral",
"src": "1618:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "1609:3:43",
"nodeType": "YulIdentifier",
"src": "1609:3:43"
},
"nativeSrc": "1609:11:43",
"nodeType": "YulFunctionCall",
"src": "1609:11:43"
},
{
"kind": "number",
"nativeSrc": "1622:1:43",
"nodeType": "YulLiteral",
"src": "1622:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "1605:3:43",
"nodeType": "YulIdentifier",
"src": "1605:3:43"
},
"nativeSrc": "1605:19:43",
"nodeType": "YulFunctionCall",
"src": "1605:19:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "1593:3:43",
"nodeType": "YulIdentifier",
"src": "1593:3:43"
},
"nativeSrc": "1593:32:43",
"nodeType": "YulFunctionCall",
"src": "1593:32:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1575:6:43",
"nodeType": "YulIdentifier",
"src": "1575:6:43"
},
"nativeSrc": "1575:51:43",
"nodeType": "YulFunctionCall",
"src": "1575:51:43"
},
"nativeSrc": "1575:51:43",
"nodeType": "YulExpressionStatement",
"src": "1575:51:43"
}
]
},
"name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed",
"nativeSrc": "1429:203:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nativeSrc": "1499:9:43",
"nodeType": "YulTypedName",
"src": "1499:9:43",
"type": ""
},
{
"name": "value0",
"nativeSrc": "1510:6:43",
"nodeType": "YulTypedName",
"src": "1510:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nativeSrc": "1521:4:43",
"nodeType": "YulTypedName",
"src": "1521:4:43",
"type": ""
}
],
"src": "1429:203:43"
},
{
"body": {
"nativeSrc": "1682:86:43",
"nodeType": "YulBlock",
"src": "1682:86:43",
"statements": [
{
"body": {
"nativeSrc": "1746:16:43",
"nodeType": "YulBlock",
"src": "1746:16:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1755:1:43",
"nodeType": "YulLiteral",
"src": "1755:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "1758:1:43",
"nodeType": "YulLiteral",
"src": "1758:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "1748:6:43",
"nodeType": "YulIdentifier",
"src": "1748:6:43"
},
"nativeSrc": "1748:12:43",
"nodeType": "YulFunctionCall",
"src": "1748:12:43"
},
"nativeSrc": "1748:12:43",
"nodeType": "YulExpressionStatement",
"src": "1748:12:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nativeSrc": "1705:5:43",
"nodeType": "YulIdentifier",
"src": "1705:5:43"
},
{
"arguments": [
{
"name": "value",
"nativeSrc": "1716:5:43",
"nodeType": "YulIdentifier",
"src": "1716:5:43"
},
{
"arguments": [
{
"arguments": [
{
"kind": "number",
"nativeSrc": "1731:3:43",
"nodeType": "YulLiteral",
"src": "1731:3:43",
"type": "",
"value": "160"
},
{
"kind": "number",
"nativeSrc": "1736:1:43",
"nodeType": "YulLiteral",
"src": "1736:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "1727:3:43",
"nodeType": "YulIdentifier",
"src": "1727:3:43"
},
"nativeSrc": "1727:11:43",
"nodeType": "YulFunctionCall",
"src": "1727:11:43"
},
{
"kind": "number",
"nativeSrc": "1740:1:43",
"nodeType": "YulLiteral",
"src": "1740:1:43",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "sub",
"nativeSrc": "1723:3:43",
"nodeType": "YulIdentifier",
"src": "1723:3:43"
},
"nativeSrc": "1723:19:43",
"nodeType": "YulFunctionCall",
"src": "1723:19:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "1712:3:43",
"nodeType": "YulIdentifier",
"src": "1712:3:43"
},
"nativeSrc": "1712:31:43",
"nodeType": "YulFunctionCall",
"src": "1712:31:43"
}
],
"functionName": {
"name": "eq",
"nativeSrc": "1702:2:43",
"nodeType": "YulIdentifier",
"src": "1702:2:43"
},
"nativeSrc": "1702:42:43",
"nodeType": "YulFunctionCall",
"src": "1702:42:43"
}
],
"functionName": {
"name": "iszero",
"nativeSrc": "1695:6:43",
"nodeType": "YulIdentifier",
"src": "1695:6:43"
},
"nativeSrc": "1695:50:43",
"nodeType": "YulFunctionCall",
"src": "1695:50:43"
},
"nativeSrc": "1692:70:43",
"nodeType": "YulIf",
"src": "1692:70:43"
}
]
},
"name": "validator_revert_address",
"nativeSrc": "1637:131:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nativeSrc": "1671:5:43",
"nodeType": "YulTypedName",
"src": "1671:5:43",
"type": ""
}
],
"src": "1637:131:43"
},
{
"body": {
"nativeSrc": "1805:95:43",
"nodeType": "YulBlock",
"src": "1805:95:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1822:1:43",
"nodeType": "YulLiteral",
"src": "1822:1:43",
"type": "",
"value": "0"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "1829:3:43",
"nodeType": "YulLiteral",
"src": "1829:3:43",
"type": "",
"value": "224"
},
{
"kind": "number",
"nativeSrc": "1834:10:43",
"nodeType": "YulLiteral",
"src": "1834:10:43",
"type": "",
"value": "0x4e487b71"
}
],
"functionName": {
"name": "shl",
"nativeSrc": "1825:3:43",
"nodeType": "YulIdentifier",
"src": "1825:3:43"
},
"nativeSrc": "1825:20:43",
"nodeType": "YulFunctionCall",
"src": "1825:20:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1815:6:43",
"nodeType": "YulIdentifier",
"src": "1815:6:43"
},
"nativeSrc": "1815:31:43",
"nodeType": "YulFunctionCall",
"src": "1815:31:43"
},
"nativeSrc": "1815:31:43",
"nodeType": "YulExpressionStatement",
"src": "1815:31:43"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1862:1:43",
"nodeType": "YulLiteral",
"src": "1862:1:43",
"type": "",
"value": "4"
},
{
"kind": "number",
"nativeSrc": "1865:4:43",
"nodeType": "YulLiteral",
"src": "1865:4:43",
"type": "",
"value": "0x41"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "1855:6:43",
"nodeType": "YulIdentifier",
"src": "1855:6:43"
},
"nativeSrc": "1855:15:43",
"nodeType": "YulFunctionCall",
"src": "1855:15:43"
},
"nativeSrc": "1855:15:43",
"nodeType": "YulExpressionStatement",
"src": "1855:15:43"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1886:1:43",
"nodeType": "YulLiteral",
"src": "1886:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "1889:4:43",
"nodeType": "YulLiteral",
"src": "1889:4:43",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "1879:6:43",
"nodeType": "YulIdentifier",
"src": "1879:6:43"
},
"nativeSrc": "1879:15:43",
"nodeType": "YulFunctionCall",
"src": "1879:15:43"
},
"nativeSrc": "1879:15:43",
"nodeType": "YulExpressionStatement",
"src": "1879:15:43"
}
]
},
"name": "panic_error_0x41",
"nativeSrc": "1773:127:43",
"nodeType": "YulFunctionDefinition",
"src": "1773:127:43"
},
{
"body": {
"nativeSrc": "1950:230:43",
"nodeType": "YulBlock",
"src": "1950:230:43",
"statements": [
{
"nativeSrc": "1960:19:43",
"nodeType": "YulAssignment",
"src": "1960:19:43",
"value": {
"arguments": [
{
"kind": "number",
"nativeSrc": "1976:2:43",
"nodeType": "YulLiteral",
"src": "1976:2:43",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "mload",
"nativeSrc": "1970:5:43",
"nodeType": "YulIdentifier",
"src": "1970:5:43"
},
"nativeSrc": "1970:9:43",
"nodeType": "YulFunctionCall",
"src": "1970:9:43"
},
"variableNames": [
{
"name": "memPtr",
"nativeSrc": "1960:6:43",
"nodeType": "YulIdentifier",
"src": "1960:6:43"
}
]
},
{
"nativeSrc": "1988:58:43",
"nodeType": "YulVariableDeclaration",
"src": "1988:58:43",
"value": {
"arguments": [
{
"name": "memPtr",
"nativeSrc": "2010:6:43",
"nodeType": "YulIdentifier",
"src": "2010:6:43"
},
{
"arguments": [
{
"arguments": [
{
"name": "size",
"nativeSrc": "2026:4:43",
"nodeType": "YulIdentifier",
"src": "2026:4:43"
},
{
"kind": "number",
"nativeSrc": "2032:2:43",
"nodeType": "YulLiteral",
"src": "2032:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2022:3:43",
"nodeType": "YulIdentifier",
"src": "2022:3:43"
},
"nativeSrc": "2022:13:43",
"nodeType": "YulFunctionCall",
"src": "2022:13:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "2041:2:43",
"nodeType": "YulLiteral",
"src": "2041:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "not",
"nativeSrc": "2037:3:43",
"nodeType": "YulIdentifier",
"src": "2037:3:43"
},
"nativeSrc": "2037:7:43",
"nodeType": "YulFunctionCall",
"src": "2037:7:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "2018:3:43",
"nodeType": "YulIdentifier",
"src": "2018:3:43"
},
"nativeSrc": "2018:27:43",
"nodeType": "YulFunctionCall",
"src": "2018:27:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2006:3:43",
"nodeType": "YulIdentifier",
"src": "2006:3:43"
},
"nativeSrc": "2006:40:43",
"nodeType": "YulFunctionCall",
"src": "2006:40:43"
},
"variables": [
{
"name": "newFreePtr",
"nativeSrc": "1992:10:43",
"nodeType": "YulTypedName",
"src": "1992:10:43",
"type": ""
}
]
},
{
"body": {
"nativeSrc": "2121:22:43",
"nodeType": "YulBlock",
"src": "2121:22:43",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x41",
"nativeSrc": "2123:16:43",
"nodeType": "YulIdentifier",
"src": "2123:16:43"
},
"nativeSrc": "2123:18:43",
"nodeType": "YulFunctionCall",
"src": "2123:18:43"
},
"nativeSrc": "2123:18:43",
"nodeType": "YulExpressionStatement",
"src": "2123:18:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "newFreePtr",
"nativeSrc": "2064:10:43",
"nodeType": "YulIdentifier",
"src": "2064:10:43"
},
{
"kind": "number",
"nativeSrc": "2076:18:43",
"nodeType": "YulLiteral",
"src": "2076:18:43",
"type": "",
"value": "0xffffffffffffffff"
}
],
"functionName": {
"name": "gt",
"nativeSrc": "2061:2:43",
"nodeType": "YulIdentifier",
"src": "2061:2:43"
},
"nativeSrc": "2061:34:43",
"nodeType": "YulFunctionCall",
"src": "2061:34:43"
},
{
"arguments": [
{
"name": "newFreePtr",
"nativeSrc": "2100:10:43",
"nodeType": "YulIdentifier",
"src": "2100:10:43"
},
{
"name": "memPtr",
"nativeSrc": "2112:6:43",
"nodeType": "YulIdentifier",
"src": "2112:6:43"
}
],
"functionName": {
"name": "lt",
"nativeSrc": "2097:2:43",
"nodeType": "YulIdentifier",
"src": "2097:2:43"
},
"nativeSrc": "2097:22:43",
"nodeType": "YulFunctionCall",
"src": "2097:22:43"
}
],
"functionName": {
"name": "or",
"nativeSrc": "2058:2:43",
"nodeType": "YulIdentifier",
"src": "2058:2:43"
},
"nativeSrc": "2058:62:43",
"nodeType": "YulFunctionCall",
"src": "2058:62:43"
},
"nativeSrc": "2055:88:43",
"nodeType": "YulIf",
"src": "2055:88:43"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "2159:2:43",
"nodeType": "YulLiteral",
"src": "2159:2:43",
"type": "",
"value": "64"
},
{
"name": "newFreePtr",
"nativeSrc": "2163:10:43",
"nodeType": "YulIdentifier",
"src": "2163:10:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "2152:6:43",
"nodeType": "YulIdentifier",
"src": "2152:6:43"
},
"nativeSrc": "2152:22:43",
"nodeType": "YulFunctionCall",
"src": "2152:22:43"
},
"nativeSrc": "2152:22:43",
"nodeType": "YulExpressionStatement",
"src": "2152:22:43"
}
]
},
"name": "allocate_memory",
"nativeSrc": "1905:275:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "size",
"nativeSrc": "1930:4:43",
"nodeType": "YulTypedName",
"src": "1930:4:43",
"type": ""
}
],
"returnVariables": [
{
"name": "memPtr",
"nativeSrc": "1939:6:43",
"nodeType": "YulTypedName",
"src": "1939:6:43",
"type": ""
}
],
"src": "1905:275:43"
},
{
"body": {
"nativeSrc": "2242:129:43",
"nodeType": "YulBlock",
"src": "2242:129:43",
"statements": [
{
"body": {
"nativeSrc": "2286:22:43",
"nodeType": "YulBlock",
"src": "2286:22:43",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x41",
"nativeSrc": "2288:16:43",
"nodeType": "YulIdentifier",
"src": "2288:16:43"
},
"nativeSrc": "2288:18:43",
"nodeType": "YulFunctionCall",
"src": "2288:18:43"
},
"nativeSrc": "2288:18:43",
"nodeType": "YulExpressionStatement",
"src": "2288:18:43"
}
]
},
"condition": {
"arguments": [
{
"name": "length",
"nativeSrc": "2258:6:43",
"nodeType": "YulIdentifier",
"src": "2258:6:43"
},
{
"kind": "number",
"nativeSrc": "2266:18:43",
"nodeType": "YulLiteral",
"src": "2266:18:43",
"type": "",
"value": "0xffffffffffffffff"
}
],
"functionName": {
"name": "gt",
"nativeSrc": "2255:2:43",
"nodeType": "YulIdentifier",
"src": "2255:2:43"
},
"nativeSrc": "2255:30:43",
"nodeType": "YulFunctionCall",
"src": "2255:30:43"
},
"nativeSrc": "2252:56:43",
"nodeType": "YulIf",
"src": "2252:56:43"
},
{
"nativeSrc": "2317:48:43",
"nodeType": "YulAssignment",
"src": "2317:48:43",
"value": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "length",
"nativeSrc": "2337:6:43",
"nodeType": "YulIdentifier",
"src": "2337:6:43"
},
{
"kind": "number",
"nativeSrc": "2345:2:43",
"nodeType": "YulLiteral",
"src": "2345:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2333:3:43",
"nodeType": "YulIdentifier",
"src": "2333:3:43"
},
"nativeSrc": "2333:15:43",
"nodeType": "YulFunctionCall",
"src": "2333:15:43"
},
{
"arguments": [
{
"kind": "number",
"nativeSrc": "2354:2:43",
"nodeType": "YulLiteral",
"src": "2354:2:43",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "not",
"nativeSrc": "2350:3:43",
"nodeType": "YulIdentifier",
"src": "2350:3:43"
},
"nativeSrc": "2350:7:43",
"nodeType": "YulFunctionCall",
"src": "2350:7:43"
}
],
"functionName": {
"name": "and",
"nativeSrc": "2329:3:43",
"nodeType": "YulIdentifier",
"src": "2329:3:43"
},
"nativeSrc": "2329:29:43",
"nodeType": "YulFunctionCall",
"src": "2329:29:43"
},
{
"kind": "number",
"nativeSrc": "2360:4:43",
"nodeType": "YulLiteral",
"src": "2360:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2325:3:43",
"nodeType": "YulIdentifier",
"src": "2325:3:43"
},
"nativeSrc": "2325:40:43",
"nodeType": "YulFunctionCall",
"src": "2325:40:43"
},
"variableNames": [
{
"name": "size",
"nativeSrc": "2317:4:43",
"nodeType": "YulIdentifier",
"src": "2317:4:43"
}
]
}
]
},
"name": "array_allocation_size_bytes",
"nativeSrc": "2185:186:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "length",
"nativeSrc": "2222:6:43",
"nodeType": "YulTypedName",
"src": "2222:6:43",
"type": ""
}
],
"returnVariables": [
{
"name": "size",
"nativeSrc": "2233:4:43",
"nodeType": "YulTypedName",
"src": "2233:4:43",
"type": ""
}
],
"src": "2185:186:43"
},
{
"body": {
"nativeSrc": "2450:262:43",
"nodeType": "YulBlock",
"src": "2450:262:43",
"statements": [
{
"nativeSrc": "2460:61:43",
"nodeType": "YulAssignment",
"src": "2460:61:43",
"value": {
"arguments": [
{
"arguments": [
{
"name": "length",
"nativeSrc": "2513:6:43",
"nodeType": "YulIdentifier",
"src": "2513:6:43"
}
],
"functionName": {
"name": "array_allocation_size_bytes",
"nativeSrc": "2485:27:43",
"nodeType": "YulIdentifier",
"src": "2485:27:43"
},
"nativeSrc": "2485:35:43",
"nodeType": "YulFunctionCall",
"src": "2485:35:43"
}
],
"functionName": {
"name": "allocate_memory",
"nativeSrc": "2469:15:43",
"nodeType": "YulIdentifier",
"src": "2469:15:43"
},
"nativeSrc": "2469:52:43",
"nodeType": "YulFunctionCall",
"src": "2469:52:43"
},
"variableNames": [
{
"name": "array",
"nativeSrc": "2460:5:43",
"nodeType": "YulIdentifier",
"src": "2460:5:43"
}
]
},
{
"expression": {
"arguments": [
{
"name": "array",
"nativeSrc": "2537:5:43",
"nodeType": "YulIdentifier",
"src": "2537:5:43"
},
{
"name": "length",
"nativeSrc": "2544:6:43",
"nodeType": "YulIdentifier",
"src": "2544:6:43"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "2530:6:43",
"nodeType": "YulIdentifier",
"src": "2530:6:43"
},
"nativeSrc": "2530:21:43",
"nodeType": "YulFunctionCall",
"src": "2530:21:43"
},
"nativeSrc": "2530:21:43",
"nodeType": "YulExpressionStatement",
"src": "2530:21:43"
},
{
"body": {
"nativeSrc": "2589:16:43",
"nodeType": "YulBlock",
"src": "2589:16:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "2598:1:43",
"nodeType": "YulLiteral",
"src": "2598:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "2601:1:43",
"nodeType": "YulLiteral",
"src": "2601:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "2591:6:43",
"nodeType": "YulIdentifier",
"src": "2591:6:43"
},
"nativeSrc": "2591:12:43",
"nodeType": "YulFunctionCall",
"src": "2591:12:43"
},
"nativeSrc": "2591:12:43",
"nodeType": "YulExpressionStatement",
"src": "2591:12:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "src",
"nativeSrc": "2570:3:43",
"nodeType": "YulIdentifier",
"src": "2570:3:43"
},
{
"name": "length",
"nativeSrc": "2575:6:43",
"nodeType": "YulIdentifier",
"src": "2575:6:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2566:3:43",
"nodeType": "YulIdentifier",
"src": "2566:3:43"
},
"nativeSrc": "2566:16:43",
"nodeType": "YulFunctionCall",
"src": "2566:16:43"
},
{
"name": "end",
"nativeSrc": "2584:3:43",
"nodeType": "YulIdentifier",
"src": "2584:3:43"
}
],
"functionName": {
"name": "gt",
"nativeSrc": "2563:2:43",
"nodeType": "YulIdentifier",
"src": "2563:2:43"
},
"nativeSrc": "2563:25:43",
"nodeType": "YulFunctionCall",
"src": "2563:25:43"
},
"nativeSrc": "2560:45:43",
"nodeType": "YulIf",
"src": "2560:45:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "array",
"nativeSrc": "2631:5:43",
"nodeType": "YulIdentifier",
"src": "2631:5:43"
},
{
"kind": "number",
"nativeSrc": "2638:4:43",
"nodeType": "YulLiteral",
"src": "2638:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2627:3:43",
"nodeType": "YulIdentifier",
"src": "2627:3:43"
},
"nativeSrc": "2627:16:43",
"nodeType": "YulFunctionCall",
"src": "2627:16:43"
},
{
"name": "src",
"nativeSrc": "2645:3:43",
"nodeType": "YulIdentifier",
"src": "2645:3:43"
},
{
"name": "length",
"nativeSrc": "2650:6:43",
"nodeType": "YulIdentifier",
"src": "2650:6:43"
}
],
"functionName": {
"name": "calldatacopy",
"nativeSrc": "2614:12:43",
"nodeType": "YulIdentifier",
"src": "2614:12:43"
},
"nativeSrc": "2614:43:43",
"nodeType": "YulFunctionCall",
"src": "2614:43:43"
},
"nativeSrc": "2614:43:43",
"nodeType": "YulExpressionStatement",
"src": "2614:43:43"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "array",
"nativeSrc": "2681:5:43",
"nodeType": "YulIdentifier",
"src": "2681:5:43"
},
{
"name": "length",
"nativeSrc": "2688:6:43",
"nodeType": "YulIdentifier",
"src": "2688:6:43"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2677:3:43",
"nodeType": "YulIdentifier",
"src": "2677:3:43"
},
"nativeSrc": "2677:18:43",
"nodeType": "YulFunctionCall",
"src": "2677:18:43"
},
{
"kind": "number",
"nativeSrc": "2697:4:43",
"nodeType": "YulLiteral",
"src": "2697:4:43",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2673:3:43",
"nodeType": "YulIdentifier",
"src": "2673:3:43"
},
"nativeSrc": "2673:29:43",
"nodeType": "YulFunctionCall",
"src": "2673:29:43"
},
{
"kind": "number",
"nativeSrc": "2704:1:43",
"nodeType": "YulLiteral",
"src": "2704:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "mstore",
"nativeSrc": "2666:6:43",
"nodeType": "YulIdentifier",
"src": "2666:6:43"
},
"nativeSrc": "2666:40:43",
"nodeType": "YulFunctionCall",
"src": "2666:40:43"
},
"nativeSrc": "2666:40:43",
"nodeType": "YulExpressionStatement",
"src": "2666:40:43"
}
]
},
"name": "abi_decode_available_length_bytes",
"nativeSrc": "2376:336:43",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "src",
"nativeSrc": "2419:3:43",
"nodeType": "YulTypedName",
"src": "2419:3:43",
"type": ""
},
{
"name": "length",
"nativeSrc": "2424:6:43",
"nodeType": "YulTypedName",
"src": "2424:6:43",
"type": ""
},
{
"name": "end",
"nativeSrc": "2432:3:43",
"nodeType": "YulTypedName",
"src": "2432:3:43",
"type": ""
}
],
"returnVariables": [
{
"name": "array",
"nativeSrc": "2440:5:43",
"nodeType": "YulTypedName",
"src": "2440:5:43",
"type": ""
}
],
"src": "2376:336:43"
},
{
"body": {
"nativeSrc": "2769:168:43",
"nodeType": "YulBlock",
"src": "2769:168:43",
"statements": [
{
"body": {
"nativeSrc": "2818:16:43",
"nodeType": "YulBlock",
"src": "2818:16:43",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nativeSrc": "2827:1:43",
"nodeType": "YulLiteral",
"src": "2827:1:43",
"type": "",
"value": "0"
},
{
"kind": "number",
"nativeSrc": "2830:1:43",
"nodeType": "YulLiteral",
"src": "2830:1:43",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nativeSrc": "2820:6:43",
"nodeType": "YulIdentifier",
"src": "2820:6:43"
},
"nativeSrc": "2820:12:43",
"nodeType": "YulFunctionCall",
"src": "2820:12:43"
},
"nativeSrc": "2820:12:43",
"nodeType": "YulExpressionStatement",
"src": "2820:12:43"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "offset",
"nativeSrc": "2797:6:43",
"nodeType": "YulIdentifier",
"src": "2797:6:43"
},
{
"kind": "number",
"nativeSrc": "2805:4:43",
"nodeType": "YulLiteral",
"src": "2805:4:43",
"type": "",
"value": "0x1f"
}
],
"functionName": {
"name": "add",
"nativeSrc": "2793:3:43",
"nodeType": "YulIdentifier",
"src": "2793:3:43"
},
"nativeSrc": "2793:17:43",
"nodeType": "YulFunctionCall",
"src": "2793:17:43"
},
{
"name": "end",
"nativeSrc": "2812:3:43",
"nodeType": "YulIdentifier",
"src": "2812:3:43"
}
],
"functionName": {
"name": "slt",
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment