Source Code
Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 21 from a total of 21 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw Payment... | 45836016 | 143 days ago | IN | 0 S | 0.00262818 | ||||
| Mint | 42996037 | 165 days ago | IN | 0 S | 0.01482321 | ||||
| Mint | 42866919 | 166 days ago | IN | 0 S | 0.01383551 | ||||
| Mint | 42846046 | 166 days ago | IN | 0 S | 0.01383551 | ||||
| Mint | 42623992 | 167 days ago | IN | 0 S | 0.01410212 | ||||
| Mint | 42567596 | 168 days ago | IN | 0 S | 0.0148259 | ||||
| Mint | 42392519 | 169 days ago | IN | 0 S | 0.01297451 | ||||
| Mint | 42160652 | 171 days ago | IN | 0 S | 0.0148259 | ||||
| Mint | 41791906 | 174 days ago | IN | 0 S | 0.01195387 | ||||
| Mint | 41791715 | 174 days ago | IN | 0 S | 0.01195387 | ||||
| Mint | 41790226 | 174 days ago | IN | 0 S | 0.01195387 | ||||
| Mint | 41789820 | 174 days ago | IN | 0 S | 0.01298366 | ||||
| Mint | 41638450 | 175 days ago | IN | 0 S | 0.01280887 | ||||
| Mint | 41532710 | 176 days ago | IN | 0 S | 0.01366387 | ||||
| Create Batch | 40767973 | 181 days ago | IN | 0 S | 0.01413177 | ||||
| Create Batch | 40767817 | 181 days ago | IN | 0 S | 0.01413177 | ||||
| Mint | 40767478 | 181 days ago | IN | 0 S | 0.02874942 | ||||
| Mint | 40766967 | 181 days ago | IN | 0 S | 0.0030039 | ||||
| Mint | 40766261 | 181 days ago | IN | 0 S | 0.00186357 | ||||
| Mint | 40766051 | 181 days ago | IN | 0 S | 0.00941218 | ||||
| Create Batch | 40765479 | 181 days ago | IN | 0 S | 0.01420883 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
FroqFurniture
Compiler Version
v0.8.30+commit.73712a01
Contract Source Code (Solidity)
/**
*Submitted for verification at SonicScan.org on 2025-07-29
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.16 >=0.6.2 >=0.8.4 ^0.8.13 ^0.8.20;
// lib/openzeppelin-contracts/contracts/utils/Comparators.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Comparators.sol)
/**
* @dev Provides a set of functions to compare values.
*
* _Available since v5.1._
*/
library Comparators {
function lt(uint256 a, uint256 b) internal pure returns (bool) {
return a < b;
}
function gt(uint256 a, uint256 b) internal pure returns (bool) {
return a > b;
}
}
// lib/openzeppelin-contracts/contracts/utils/Context.sol
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
/**
* @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;
}
}
// lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
/**
* @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);
}
// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
/**
* @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);
}
// lib/openzeppelin-contracts/contracts/utils/Panic.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)
/**
* @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)
}
}
}
// lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}
// lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
/**
* @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))
}
}
}
// lib/openzeppelin-contracts/contracts/utils/SlotDerivation.sol
// OpenZeppelin Contracts (last updated v5.3.0) (utils/SlotDerivation.sol)
// This file was procedurally generated from scripts/generate/templates/SlotDerivation.js.
/**
* @dev Library for computing storage (and transient storage) locations from namespaces and deriving slots
* corresponding to standard patterns. The derivation method for array and mapping matches the storage layout used by
* the solidity language / compiler.
*
* See https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays[Solidity docs for mappings and dynamic arrays.].
*
* Example usage:
* ```solidity
* contract Example {
* // Add the library methods
* using StorageSlot for bytes32;
* using SlotDerivation for bytes32;
*
* // Declare a namespace
* string private constant _NAMESPACE = "<namespace>"; // eg. OpenZeppelin.Slot
*
* function setValueInNamespace(uint256 key, address newValue) internal {
* _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value = newValue;
* }
*
* function getValueInNamespace(uint256 key) internal view returns (address) {
* return _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value;
* }
* }
* ```
*
* TIP: Consider using this library along with {StorageSlot}.
*
* NOTE: This library provides a way to manipulate storage locations in a non-standard way. Tooling for checking
* upgrade safety will ignore the slots accessed through this library.
*
* _Available since v5.1._
*/
library SlotDerivation {
/**
* @dev Derive an ERC-7201 slot from a string (namespace).
*/
function erc7201Slot(string memory namespace) internal pure returns (bytes32 slot) {
assembly ("memory-safe") {
mstore(0x00, sub(keccak256(add(namespace, 0x20), mload(namespace)), 1))
slot := and(keccak256(0x00, 0x20), not(0xff))
}
}
/**
* @dev Add an offset to a slot to get the n-th element of a structure or an array.
*/
function offset(bytes32 slot, uint256 pos) internal pure returns (bytes32 result) {
unchecked {
return bytes32(uint256(slot) + pos);
}
}
/**
* @dev Derive the location of the first element in an array from the slot where the length is stored.
*/
function deriveArray(bytes32 slot) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, slot)
result := keccak256(0x00, 0x20)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, address key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, and(key, shr(96, not(0))))
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bool key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, iszero(iszero(key)))
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bytes32 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, uint256 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, int256 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, string memory key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
let length := mload(key)
let begin := add(key, 0x20)
let end := add(begin, length)
let cache := mload(end)
mstore(end, slot)
result := keccak256(begin, add(length, 0x20))
mstore(end, cache)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bytes memory key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
let length := mload(key)
let begin := add(key, 0x20)
let end := add(begin, length)
let cache := mload(end)
mstore(end, slot)
result := keccak256(begin, add(length, 0x20))
mstore(end, cache)
}
}
}
// lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
/**
* @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
}
}
}
// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC6093.sol)
/**
* @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);
}
// lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.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;
}
}
// lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/IERC1155.sol)
/**
* @dev Required interface of an ERC-1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[ERC].
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the value of tokens of token type `id` owned by `account`.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the zero address.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155Received} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155BatchReceived} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
}
// lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/IERC1155Receiver.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);
}
// lib/openzeppelin-contracts/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.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);
}
}
}
// lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol)
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[ERC].
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
// lib/openzeppelin-contracts/contracts/utils/math/Math.sol
// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.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;
}
}
// lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Utils.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/utils/ERC1155Utils.sol)
/**
* @dev Library that provide common ERC-1155 utility functions.
*
* See https://eips.ethereum.org/EIPS/eip-1155[ERC-1155].
*
* _Available since v5.1._
*/
library ERC1155Utils {
/**
* @dev Performs an acceptance check for the provided `operator` by calling {IERC1155Receiver-onERC1155Received}
* on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`).
*
* The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA).
* Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept
* the transfer.
*/
function checkOnERC1155Received(
address operator,
address from,
address to,
uint256 id,
uint256 value,
bytes memory data
) internal {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
// Tokens rejected
revert IERC1155Errors.ERC1155InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
// non-IERC1155Receiver implementer
revert IERC1155Errors.ERC1155InvalidReceiver(to);
} else {
assembly ("memory-safe") {
revert(add(reason, 0x20), mload(reason))
}
}
}
}
}
/**
* @dev Performs a batch acceptance check for the provided `operator` by calling {IERC1155Receiver-onERC1155BatchReceived}
* on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`).
*
* The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA).
* Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept
* the transfer.
*/
function checkOnERC1155BatchReceived(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
// Tokens rejected
revert IERC1155Errors.ERC1155InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
// non-IERC1155Receiver implementer
revert IERC1155Errors.ERC1155InvalidReceiver(to);
} else {
assembly ("memory-safe") {
revert(add(reason, 0x20), mload(reason))
}
}
}
}
}
}
// lib/openzeppelin-contracts/contracts/utils/Strings.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Strings.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))
}
}
}
// lib/openzeppelin-contracts/contracts/utils/Arrays.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Arrays.sol)
// This file was procedurally generated from scripts/generate/templates/Arrays.js.
/**
* @dev Collection of functions related to array types.
*/
library Arrays {
using SlotDerivation for bytes32;
using StorageSlot for bytes32;
/**
* @dev Sort an array of uint256 (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
uint256[] memory array,
function(uint256, uint256) pure returns (bool) comp
) internal pure returns (uint256[] memory) {
_quickSort(_begin(array), _end(array), comp);
return array;
}
/**
* @dev Variant of {sort} that sorts an array of uint256 in increasing order.
*/
function sort(uint256[] memory array) internal pure returns (uint256[] memory) {
sort(array, Comparators.lt);
return array;
}
/**
* @dev Sort an array of address (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
address[] memory array,
function(address, address) pure returns (bool) comp
) internal pure returns (address[] memory) {
sort(_castToUint256Array(array), _castToUint256Comp(comp));
return array;
}
/**
* @dev Variant of {sort} that sorts an array of address in increasing order.
*/
function sort(address[] memory array) internal pure returns (address[] memory) {
sort(_castToUint256Array(array), Comparators.lt);
return array;
}
/**
* @dev Sort an array of bytes32 (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
bytes32[] memory array,
function(bytes32, bytes32) pure returns (bool) comp
) internal pure returns (bytes32[] memory) {
sort(_castToUint256Array(array), _castToUint256Comp(comp));
return array;
}
/**
* @dev Variant of {sort} that sorts an array of bytes32 in increasing order.
*/
function sort(bytes32[] memory array) internal pure returns (bytes32[] memory) {
sort(_castToUint256Array(array), Comparators.lt);
return array;
}
/**
* @dev Performs a quick sort of a segment of memory. The segment sorted starts at `begin` (inclusive), and stops
* at end (exclusive). Sorting follows the `comp` comparator.
*
* Invariant: `begin <= end`. This is the case when initially called by {sort} and is preserved in subcalls.
*
* IMPORTANT: Memory locations between `begin` and `end` are not validated/zeroed. This function should
* be used only if the limits are within a memory array.
*/
function _quickSort(uint256 begin, uint256 end, function(uint256, uint256) pure returns (bool) comp) private pure {
unchecked {
if (end - begin < 0x40) return;
// Use first element as pivot
uint256 pivot = _mload(begin);
// Position where the pivot should be at the end of the loop
uint256 pos = begin;
for (uint256 it = begin + 0x20; it < end; it += 0x20) {
if (comp(_mload(it), pivot)) {
// If the value stored at the iterator's position comes before the pivot, we increment the
// position of the pivot and move the value there.
pos += 0x20;
_swap(pos, it);
}
}
_swap(begin, pos); // Swap pivot into place
_quickSort(begin, pos, comp); // Sort the left side of the pivot
_quickSort(pos + 0x20, end, comp); // Sort the right side of the pivot
}
}
/**
* @dev Pointer to the memory location of the first element of `array`.
*/
function _begin(uint256[] memory array) private pure returns (uint256 ptr) {
assembly ("memory-safe") {
ptr := add(array, 0x20)
}
}
/**
* @dev Pointer to the memory location of the first memory word (32bytes) after `array`. This is the memory word
* that comes just after the last element of the array.
*/
function _end(uint256[] memory array) private pure returns (uint256 ptr) {
unchecked {
return _begin(array) + array.length * 0x20;
}
}
/**
* @dev Load memory word (as a uint256) at location `ptr`.
*/
function _mload(uint256 ptr) private pure returns (uint256 value) {
assembly {
value := mload(ptr)
}
}
/**
* @dev Swaps the elements memory location `ptr1` and `ptr2`.
*/
function _swap(uint256 ptr1, uint256 ptr2) private pure {
assembly {
let value1 := mload(ptr1)
let value2 := mload(ptr2)
mstore(ptr1, value2)
mstore(ptr2, value1)
}
}
/// @dev Helper: low level cast address memory array to uint256 memory array
function _castToUint256Array(address[] memory input) private pure returns (uint256[] memory output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast bytes32 memory array to uint256 memory array
function _castToUint256Array(bytes32[] memory input) private pure returns (uint256[] memory output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast address comp function to uint256 comp function
function _castToUint256Comp(
function(address, address) pure returns (bool) input
) private pure returns (function(uint256, uint256) pure returns (bool) output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast bytes32 comp function to uint256 comp function
function _castToUint256Comp(
function(bytes32, bytes32) pure returns (bool) input
) private pure returns (function(uint256, uint256) pure returns (bool) output) {
assembly {
output := input
}
}
/**
* @dev Searches a sorted `array` and returns the first index that contains
* a value greater or equal to `element`. If no such index exists (i.e. all
* values in the array are strictly less than `element`), the array length is
* returned. Time complexity O(log n).
*
* NOTE: The `array` is expected to be sorted in ascending order, and to
* contain no repeated elements.
*
* IMPORTANT: Deprecated. This implementation behaves as {lowerBound} but lacks
* support for repeated elements in the array. The {lowerBound} function should
* be used instead.
*/
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
low = mid + 1;
}
}
// At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
if (low > 0 && unsafeAccess(array, low - 1).value == element) {
return low - 1;
} else {
return low;
}
}
/**
* @dev Searches an `array` sorted in ascending order and returns the first
* index that contains a value greater or equal than `element`. If no such index
* exists (i.e. all values in the array are strictly less than `element`), the array
* length is returned. Time complexity O(log n).
*
* See C++'s https://en.cppreference.com/w/cpp/algorithm/lower_bound[lower_bound].
*/
function lowerBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value < element) {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
} else {
high = mid;
}
}
return low;
}
/**
* @dev Searches an `array` sorted in ascending order and returns the first
* index that contains a value strictly greater than `element`. If no such index
* exists (i.e. all values in the array are strictly less than `element`), the array
* length is returned. Time complexity O(log n).
*
* See C++'s https://en.cppreference.com/w/cpp/algorithm/upper_bound[upper_bound].
*/
function upperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
}
}
return low;
}
/**
* @dev Same as {lowerBound}, but with an array in memory.
*/
function lowerBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeMemoryAccess(array, mid) < element) {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
} else {
high = mid;
}
}
return low;
}
/**
* @dev Same as {upperBound}, but with an array in memory.
*/
function upperBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeMemoryAccess(array, mid) > element) {
high = mid;
} else {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
}
}
return low;
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getAddressSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getBytes32Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getUint256Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes[] storage arr, uint256 pos) internal pure returns (StorageSlot.BytesSlot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getBytesSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(string[] storage arr, uint256 pos) internal pure returns (StorageSlot.StringSlot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getStringSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(bytes32[] memory arr, uint256 pos) internal pure returns (bytes32 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(bytes[] memory arr, uint256 pos) internal pure returns (bytes memory res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(string[] memory arr, uint256 pos) internal pure returns (string memory res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(address[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(bytes32[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(uint256[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(bytes[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(string[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
}
// lib/openzeppelin-contracts/contracts/token/ERC1155/ERC1155.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/ERC1155.sol)
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*/
abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors {
using Arrays for uint256[];
using Arrays for address[];
mapping(uint256 id => mapping(address account => uint256)) private _balances;
mapping(address account => mapping(address operator => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the ERC].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256 /* id */) public view virtual returns (string memory) {
return _uri;
}
/// @inheritdoc IERC1155
function balanceOf(address account, uint256 id) public view virtual returns (uint256) {
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] memory accounts,
uint256[] memory ids
) public view virtual returns (uint256[] memory) {
if (accounts.length != ids.length) {
revert ERC1155InvalidArrayLength(ids.length, accounts.length);
}
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i));
}
return batchBalances;
}
/// @inheritdoc IERC1155
function setApprovalForAll(address operator, bool approved) public virtual {
_setApprovalForAll(_msgSender(), operator, approved);
}
/// @inheritdoc IERC1155
function isApprovedForAll(address account, address operator) public view virtual returns (bool) {
return _operatorApprovals[account][operator];
}
/// @inheritdoc IERC1155
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual {
address sender = _msgSender();
if (from != sender && !isApprovedForAll(from, sender)) {
revert ERC1155MissingApprovalForAll(sender, from);
}
_safeTransferFrom(from, to, id, value, data);
}
/// @inheritdoc IERC1155
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) public virtual {
address sender = _msgSender();
if (from != sender && !isApprovedForAll(from, sender)) {
revert ERC1155MissingApprovalForAll(sender, from);
}
_safeBatchTransferFrom(from, to, ids, values, data);
}
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from`
* (or `to`) is the zero address.
*
* Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received}
* or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value.
* - `ids` and `values` must have the same length.
*
* NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead.
*/
function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual {
if (ids.length != values.length) {
revert ERC1155InvalidArrayLength(ids.length, values.length);
}
address operator = _msgSender();
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids.unsafeMemoryAccess(i);
uint256 value = values.unsafeMemoryAccess(i);
if (from != address(0)) {
uint256 fromBalance = _balances[id][from];
if (fromBalance < value) {
revert ERC1155InsufficientBalance(from, fromBalance, value, id);
}
unchecked {
// Overflow not possible: value <= fromBalance
_balances[id][from] = fromBalance - value;
}
}
if (to != address(0)) {
_balances[id][to] += value;
}
}
if (ids.length == 1) {
uint256 id = ids.unsafeMemoryAccess(0);
uint256 value = values.unsafeMemoryAccess(0);
emit TransferSingle(operator, from, to, id, value);
} else {
emit TransferBatch(operator, from, to, ids, values);
}
}
/**
* @dev Version of {_update} that performs the token acceptance check by calling
* {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it
* contains code (eg. is a smart contract at the moment of execution).
*
* IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any
* update to the contract state after this function would break the check-effect-interaction pattern. Consider
* overriding {_update} instead.
*/
function _updateWithAcceptanceCheck(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal virtual {
_update(from, to, ids, values);
if (to != address(0)) {
address operator = _msgSender();
if (ids.length == 1) {
uint256 id = ids.unsafeMemoryAccess(0);
uint256 value = values.unsafeMemoryAccess(0);
ERC1155Utils.checkOnERC1155Received(operator, from, to, id, value, data);
} else {
ERC1155Utils.checkOnERC1155BatchReceived(operator, from, to, ids, values, data);
}
}
}
/**
* @dev Transfers a `value` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(from, to, ids, values, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
* - `ids` and `values` must have the same length.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
_updateWithAcceptanceCheck(from, to, ids, values, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the ERC].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the values in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(address(0), to, ids, values, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
_updateWithAcceptanceCheck(address(0), to, ids, values, data);
}
/**
* @dev Destroys a `value` amount of tokens of type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `value` amount of tokens of type `id`.
*/
function _burn(address from, uint256 id, uint256 value) internal {
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(from, address(0), ids, values, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `value` amount of tokens of type `id`.
* - `ids` and `values` must have the same length.
*/
function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal {
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
_updateWithAcceptanceCheck(from, address(0), ids, values, "");
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the zero address.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
if (operator == address(0)) {
revert ERC1155InvalidOperator(address(0));
}
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Creates an array in memory with only one value for each of the elements provided.
*/
function _asSingletonArrays(
uint256 element1,
uint256 element2
) private pure returns (uint256[] memory array1, uint256[] memory array2) {
assembly ("memory-safe") {
// Load the free memory pointer
array1 := mload(0x40)
// Set array length to 1
mstore(array1, 1)
// Store the single element at the next word after the length (where content starts)
mstore(add(array1, 0x20), element1)
// Repeat for next array locating it right after the first array
array2 := add(array1, 0x40)
mstore(array2, 1)
mstore(add(array2, 0x20), element2)
// Update the free memory pointer by pointing after the second array
mstore(0x40, add(array2, 0x40))
}
}
}
// src/FroqFurniture.sol
contract FroqFurniture is ERC1155, Ownable, ReentrancyGuard {
using Strings for uint256;
uint256 private _currentTokenId;
uint256 private _currentBatchId;
mapping(uint256 => string) private _tokenURIs;
mapping(uint256 => uint256) private _batchSizes;
mapping(uint256 => uint256) private _batchStartTokenId;
uint256 public MAX_MINTABLE_SIZE = 100;
IERC20 public paymentToken;
enum BatchStatus { Open, Closed }
struct BatchInfo {
uint256 maxSupply;
uint256 mintedCount;
uint256 startTokenId;
string uri;
BatchStatus status;
uint256 createdAt;
uint256 pricePerToken;
}
mapping(uint256 => BatchInfo) private _batches;
mapping(uint256 => uint256) private _tokenToBatch;
mapping(address => uint256) private _totalNFTBalance;
event BatchCreated(uint256 indexed batchId, uint256 indexed startTokenId, uint256 maxSupply, string uri, uint256 pricePerToken);
event TokenMinted(uint256 indexed batchId, uint256 indexed tokenId, address indexed minter);
event BatchClosed(uint256 indexed batchId, uint256 totalMinted);
event BatchURIUpdated(uint256 indexed batchId, string oldURI, string newURI, uint256 tokensUpdated);
event BatchPriceUpdated(uint256 indexed batchId, uint256 oldPrice, uint256 newPrice);
event PaymentTokenUpdated(address oldToken, address newToken);
event MaxMintableSizeUpdated(uint256 oldSize, uint256 newSize);
constructor(address _paymentToken) ERC1155("") Ownable(msg.sender) {
_currentTokenId = 1;
_currentBatchId = 1;
paymentToken = IERC20(_paymentToken);
}
function createBatch(uint256 maxSupply, string memory _uri, uint256 pricePerToken) external onlyOwner returns (uint256 batchId) {
require(maxSupply > 0, "Max supply must be greater than 0");
require(bytes(_uri).length > 0, "URI cannot be empty");
require(pricePerToken > 0, "Price per token must be greater than 0");
batchId = _currentBatchId;
uint256 startTokenId = _currentTokenId;
_batches[batchId] = BatchInfo({
maxSupply: maxSupply,
mintedCount: 0,
startTokenId: startTokenId,
uri: _uri,
status: BatchStatus.Open,
createdAt: block.timestamp,
pricePerToken: pricePerToken
});
_batchStartTokenId[batchId] = startTokenId;
_currentTokenId += maxSupply;
_currentBatchId++;
emit BatchCreated(batchId, startTokenId, maxSupply, _uri, pricePerToken); // TODO uhm does tokenId logic make sense?
}
function mint(uint256 batchId, uint256 amount) external nonReentrant {
require(batchId > 0 && batchId < _currentBatchId, "Invalid batch ID");
require(amount > 0, "Amount must be greater than 0");
require(amount <= MAX_MINTABLE_SIZE, "Amount exceeds maximum mintable size");
BatchInfo storage batch = _batches[batchId];
require(batch.status == BatchStatus.Open, "Batch is not open for minting");
require(batch.mintedCount + amount <= batch.maxSupply, "Amount exceeds available supply");
uint256 totalCost = amount * batch.pricePerToken;
require(paymentToken.transferFrom(msg.sender, address(this), totalCost), "Payment failed");
uint256 mintStart = batch.startTokenId + batch.mintedCount;
uint256[] memory ids = new uint256[](amount);
uint256[] memory amounts = new uint256[](amount);
for (uint256 i = 0; i < amount; i++) {
uint256 tokenId = mintStart + i;
ids[i] = tokenId;
amounts[i] = 1;
_tokenURIs[tokenId] = batch.uri;
_batchSizes[tokenId] = batch.maxSupply;
_tokenToBatch[tokenId] = batchId;
emit TokenMinted(batchId, tokenId, msg.sender);
}
_mintBatch(msg.sender, ids, amounts, "");
_totalNFTBalance[msg.sender] += amount;
batch.mintedCount += amount;
if (batch.mintedCount == batch.maxSupply) {
batch.status = BatchStatus.Closed;
emit BatchClosed(batchId, batch.mintedCount);
}
}
function closeBatch(uint256 batchId) external onlyOwner {
require(batchId > 0 && batchId < _currentBatchId, "Invalid batch ID");
BatchInfo storage batch = _batches[batchId];
require(batch.status == BatchStatus.Open, "Batch is not open");
batch.status = BatchStatus.Closed;
emit BatchClosed(batchId, batch.mintedCount);
}
function updateBatchURI(uint256 batchId, string memory newURI) external onlyOwner {
require(bytes(newURI).length > 0, "URI cannot be empty");
require(batchId > 0 && batchId < _currentBatchId, "Query for nonexistent batch");
BatchInfo storage batch = _batches[batchId];
string memory oldURI = batch.uri;
batch.uri = newURI;
uint256 tokensUpdated = 0;
uint256 endTokenId = batch.startTokenId + batch.mintedCount;
for (uint256 tokenId = batch.startTokenId; tokenId < endTokenId; tokenId++) {
_tokenURIs[tokenId] = newURI;
tokensUpdated++;
}
emit BatchURIUpdated(batchId, oldURI, newURI, tokensUpdated);
}
function setBatchPrice(uint256 batchId, uint256 newPrice) external onlyOwner {
require(batchId > 0 && batchId < _currentBatchId, "Invalid batch ID");
require(newPrice > 0, "Price must be greater than 0");
BatchInfo storage batch = _batches[batchId];
require(batch.status == BatchStatus.Open, "Batch is not open");
uint256 oldPrice = batch.pricePerToken;
batch.pricePerToken = newPrice;
emit BatchPriceUpdated(batchId, oldPrice, newPrice);
}
function setMaxMintableSize(uint256 _newSize) external onlyOwner {
require(_newSize > 0, "Max mintable size must be greater than 0");
uint256 oldSize = MAX_MINTABLE_SIZE;
MAX_MINTABLE_SIZE = _newSize;
emit MaxMintableSizeUpdated(oldSize, _newSize);
}
function setPaymentToken(address _newPaymentToken) external onlyOwner {
require(_newPaymentToken != address(0), "Invalid payment token address");
address oldToken = address(paymentToken);
paymentToken = IERC20(_newPaymentToken);
emit PaymentTokenUpdated(oldToken, _newPaymentToken);
}
function withdrawPayments() external onlyOwner {
uint256 balance = paymentToken.balanceOf(address(this));
require(balance > 0, "No payments to withdraw");
require(paymentToken.transfer(owner(), balance), "Withdrawal failed");
}
function uri(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "URI query for nonexistent token");
return _tokenURIs[tokenId];
}
function getBatchSize(uint256 tokenId) external view returns (uint256) {
require(_exists(tokenId), "Query for nonexistent token");
return _batchSizes[tokenId];
}
function totalSupply() external view returns (uint256) {
return _currentTokenId - 1;
}
function totalBatches() external view returns (uint256) {
return _currentBatchId - 1;
}
function getBatchStartTokenId(uint256 batchId) external view returns (uint256) {
require(batchId > 0 && batchId < _currentBatchId, "Query for nonexistent batch");
return _batchStartTokenId[batchId];
}
function getBatchEndTokenId(uint256 batchId) external view returns (uint256) {
require(batchId > 0 && batchId < _currentBatchId, "Query for nonexistent batch");
uint256 startTokenId = _batchStartTokenId[batchId];
uint256 batchSize = _batchSizes[startTokenId];
return startTokenId + batchSize - 1;
}
function getBatchTokenIds(uint256 batchId) external view returns (uint256[] memory) {
require(batchId > 0 && batchId < _currentBatchId, "Query for nonexistent batch");
uint256 startTokenId = _batchStartTokenId[batchId];
uint256 batchSize = _batchSizes[startTokenId];
uint256[] memory tokenIds = new uint256[](batchSize);
for (uint256 i = 0; i < batchSize; i++) {
tokenIds[i] = startTokenId + i;
}
return tokenIds;
}
function getBatchInfo(uint256 batchId) external view returns (BatchInfo memory) {
require(batchId > 0 && batchId < _currentBatchId, "Query for nonexistent batch");
return _batches[batchId];
}
function getBatchStatus(uint256 batchId) external view returns (BatchStatus) {
require(batchId > 0 && batchId < _currentBatchId, "Query for nonexistent batch");
return _batches[batchId].status;
}
function getBatchProgress(uint256 batchId) external view returns (uint256 minted, uint256 total) {
require(batchId > 0 && batchId < _currentBatchId, "Query for nonexistent batch");
BatchInfo storage batch = _batches[batchId];
return (batch.mintedCount, batch.maxSupply);
}
function getTokenBatch(uint256 tokenId) external view returns (uint256) {
require(_exists(tokenId), "Query for nonexistent token");
return _tokenToBatch[tokenId];
}
function getTotalNFTBalance(address account) external view returns (uint256) {
return _totalNFTBalance[account];
}
function getBatchPrice(uint256 batchId) external view returns (uint256) {
require(batchId > 0 && batchId < _currentBatchId, "Query for nonexistent batch");
return _batches[batchId].pricePerToken;
}
function getBatchAvailableSupply(uint256 batchId) external view returns (uint256) {
require(batchId > 0 && batchId < _currentBatchId, "Query for nonexistent batch");
BatchInfo storage batch = _batches[batchId];
return batch.maxSupply - batch.mintedCount;
}
function isBatchOpen(uint256 batchId) external view returns (bool) {
require(batchId > 0 && batchId < _currentBatchId, "Query for nonexistent batch");
return _batches[batchId].status == BatchStatus.Open;
}
function getOpenBatches() external view returns (uint256[] memory) {
uint256 batchCount = _currentBatchId - 1;
uint256 openCount = 0;
for (uint256 i = 1; i <= batchCount; i++) {
if (_batches[i].status == BatchStatus.Open) {
openCount++;
}
}
uint256[] memory openBatches = new uint256[](openCount);
uint256 index = 0;
for (uint256 i = 1; i <= batchCount; i++) {
if (_batches[i].status == BatchStatus.Open) {
openBatches[index] = i;
index++;
}
}
return openBatches;
}
function getBatchTotals() external view returns (uint256[] memory batchIds, uint256[] memory totals) {
uint256 batchCount = _currentBatchId - 1;
batchIds = new uint256[](batchCount);
totals = new uint256[](batchCount);
for (uint256 i = 1; i <= batchCount; i++) {
batchIds[i - 1] = i;
totals[i - 1] = _batches[i].mintedCount;
}
return (batchIds, totals);
}
function getBalancePerBatch(address account) external view returns (uint256[] memory batchIds, uint256[] memory balances) {
uint256 batchCount = _currentBatchId - 1;
batchIds = new uint256[](batchCount);
balances = new uint256[](batchCount);
for (uint256 i = 1; i <= batchCount; i++) {
batchIds[i - 1] = i;
uint256 balance = 0;
BatchInfo storage batch = _batches[i];
uint256 endTokenId = batch.startTokenId + batch.mintedCount;
for (uint256 tokenId = batch.startTokenId; tokenId < endTokenId; tokenId++) {
balance += balanceOf(account, tokenId);
}
balances[i - 1] = balance;
}
return (batchIds, balances);
}
function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId > 0 && tokenId < _currentTokenId;
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_paymentToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC1155InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC1155InvalidApprover","type":"error"},{"inputs":[{"internalType":"uint256","name":"idsLength","type":"uint256"},{"internalType":"uint256","name":"valuesLength","type":"uint256"}],"name":"ERC1155InvalidArrayLength","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC1155InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC1155InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC1155InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC1155MissingApprovalForAll","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"batchId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalMinted","type":"uint256"}],"name":"BatchClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"batchId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"startTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxSupply","type":"uint256"},{"indexed":false,"internalType":"string","name":"uri","type":"string"},{"indexed":false,"internalType":"uint256","name":"pricePerToken","type":"uint256"}],"name":"BatchCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"batchId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"BatchPriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"batchId","type":"uint256"},{"indexed":false,"internalType":"string","name":"oldURI","type":"string"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"},{"indexed":false,"internalType":"uint256","name":"tokensUpdated","type":"uint256"}],"name":"BatchURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldSize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newSize","type":"uint256"}],"name":"MaxMintableSizeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldToken","type":"address"},{"indexed":false,"internalType":"address","name":"newToken","type":"address"}],"name":"PaymentTokenUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"batchId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"minter","type":"address"}],"name":"TokenMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[],"name":"MAX_MINTABLE_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"closeBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"string","name":"_uri","type":"string"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"}],"name":"createBatch","outputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getBalancePerBatch","outputs":[{"internalType":"uint256[]","name":"batchIds","type":"uint256[]"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"getBatchAvailableSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"getBatchEndTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"getBatchInfo","outputs":[{"components":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"mintedCount","type":"uint256"},{"internalType":"uint256","name":"startTokenId","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"enum FroqFurniture.BatchStatus","name":"status","type":"uint8"},{"internalType":"uint256","name":"createdAt","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"}],"internalType":"struct FroqFurniture.BatchInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"getBatchPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"getBatchProgress","outputs":[{"internalType":"uint256","name":"minted","type":"uint256"},{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getBatchSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"getBatchStartTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"getBatchStatus","outputs":[{"internalType":"enum FroqFurniture.BatchStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"getBatchTokenIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBatchTotals","outputs":[{"internalType":"uint256[]","name":"batchIds","type":"uint256[]"},{"internalType":"uint256[]","name":"totals","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOpenBatches","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenBatch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getTotalNFTBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"isBatchOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"},{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"setBatchPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newSize","type":"uint256"}],"name":"setMaxMintableSize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newPaymentToken","type":"address"}],"name":"setPaymentToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBatches","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"},{"internalType":"string","name":"newURI","type":"string"}],"name":"updateBatchURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawPayments","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040526064600a55348015610014575f5ffd5b506040516133e93803806133e983398101604081905261003391610119565b60408051602081019091525f8152339061004c816100b8565b506001600160a01b03811661007a57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b610083816100c8565b50600160048190556005819055600655600b80546001600160a01b0319166001600160a01b0392909216919091179055610298565b60026100c482826101de565b5050565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b5f60208284031215610129575f5ffd5b81516001600160a01b038116811461013f575f5ffd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c9082168061016e57607f821691505b60208210810361018c57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156101d957805f5260205f20601f840160051c810160208510156101b75750805b601f840160051c820191505b818110156101d6575f81556001016101c3565b50505b505050565b81516001600160401b038111156101f7576101f7610146565b61020b81610205845461015a565b84610192565b6020601f82116001811461023d575f83156102265750848201515b5f19600385901b1c1916600184901b1784556101d6565b5f84815260208120601f198516915b8281101561026c578785015182556020948501946001909201910161024c565b508482101561028957868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b613144806102a55f395ff3fe608060405234801561000f575f5ffd5b5060043610610228575f3560e01c8063715018a61161012a578063c3322985116100b4578063e985e9c511610079578063e985e9c5146104fa578063f242432a1461050d578063f2fde38b14610520578063f33c7bcc14610533578063fe31ed2814610546575f5ffd5b8063c3322985146104a5578063c94bf54d146104b8578063d2c411d3146104cb578063dff352c0146104de578063e7094a81146104e7575f5ffd5b8063a22cb465116100fa578063a22cb4651461041c578063a3bef9b21461042f578063b82bf13614610457578063b93afa121461047f578063b955e9b914610492575f5ffd5b8063715018a6146103e8578063844f2e07146103f05780638da5cb5b146103f8578063929a29c014610409575f5ffd5b80632d1bbc8e116101b65780634e1273f41161017b5780634e1273f4146103925780636103d70b146103b257806364f47a37146103ba57806369ff6abb146103cd5780636a326ab1146103d5575f5ffd5b80632d1bbc8e1461030b5780632eb2c2d61461032b5780633013ce291461033e578063419109781461036957806342d12e031461037c575f5ffd5b806318160ddd116101fc57806318160ddd146102a85780631a0058f5146102b05780631b2ef1ca146102d057806329e3dd7d146102e55780632bd92dd3146102f8575f5ffd5b8062fdd58e1461022c57806301ffc9a7146102525780630e25ca1e146102755780630e89341c14610288575b5f5ffd5b61023f61023a3660046126d2565b610559565b6040519081526020015b60405180910390f35b61026561026036600461270f565b610580565b6040519015158152602001610249565b61023f61028336600461272a565b6105cf565b61029b61029636600461272a565b61063c565b604051610249919061276f565b61023f61072e565b6102c36102be36600461272a565b610743565b60405161024991906127b5565b6102e36102de366004612822565b61088d565b005b61023f6102f336600461272a565b610d34565b61023f61030636600461272a565b610d86565b61031e61031936600461272a565b610dc8565b6040516102499190612842565b6102e3610339366004612991565b610e0d565b600b54610351906001600160a01b031681565b6040516001600160a01b039091168152602001610249565b61023f61037736600461272a565b610e74565b610384610edc565b604051610249929190612a77565b6103a56103a0366004612aa4565b611002565b6040516102499190612b65565b6102e36110cc565b6103846103c8366004612b77565b611263565b61023f6113ce565b6102e36103e3366004612b77565b6113de565b6102e361149e565b6103a56114b1565b6003546001600160a01b0316610351565b61023f61041736600461272a565b6115dd565b6102e361042a366004612b9d565b61161c565b61044261043d36600461272a565b611627565b60408051928352602083019190915201610249565b61023f610465366004612b77565b6001600160a01b03165f908152600e602052604090205490565b6102e361048d366004612822565b61166f565b61023f6104a036600461272a565b6117a5565b6102656104b336600461272a565b61180d565b6103a56104c636600461272a565b611866565b6102e36104d936600461272a565b611938565b61023f600a5481565b6102e36104f536600461272a565b611a22565b610265610508366004612bd2565b611ac8565b6102e361051b366004612c03565b611af5565b6102e361052e366004612b77565b611b54565b61023f610541366004612c56565b611b8e565b6102e3610554366004612ca2565b611dc5565b5f818152602081815260408083206001600160a01b03861684529091529020545b92915050565b5f6001600160e01b03198216636cdb3d1360e11b14806105b057506001600160e01b031982166303a24d0760e21b145b8061057a57506301ffc9a760e01b6001600160e01b031983161461057a565b5f6105d982611f89565b61062a5760405162461bcd60e51b815260206004820152601b60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e000000000060448201526064015b60405180910390fd5b505f908152600d602052604090205490565b606061064782611f89565b6106935760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e006044820152606401610621565b5f82815260076020526040902080546106ab90612cdb565b80601f01602080910402602001604051908101604052809291908181526020018280546106d790612cdb565b80156107225780601f106106f957610100808354040283529160200191610722565b820191905f5260205f20905b81548152906001019060200180831161070557829003601f168201915b50505050509050919050565b5f600160055461073e9190612d27565b905090565b61074b61266f565b5f8211801561075b575060065482105b6107775760405162461bcd60e51b815260040161062190612d3a565b600c5f8381526020019081526020015f206040518060e00160405290815f820154815260200160018201548152602001600282015481526020016003820180546107c090612cdb565b80601f01602080910402602001604051908101604052809291908181526020018280546107ec90612cdb565b80156108375780601f1061080e57610100808354040283529160200191610837565b820191905f5260205f20905b81548152906001019060200180831161081a57829003601f168201915b5050509183525050600482015460209091019060ff16600181111561085e5761085e612781565b600181111561086f5761086f612781565b81526005820154602082015260069091015460409091015292915050565b610895611f9c565b5f821180156108a5575060065482105b6108c15760405162461bcd60e51b815260040161062190612d71565b5f81116109105760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610621565b600a5481111561096e5760405162461bcd60e51b8152602060048201526024808201527f416d6f756e742065786365656473206d6178696d756d206d696e7461626c652060448201526373697a6560e01b6064820152608401610621565b5f828152600c6020526040812090600482015460ff16600181111561099557610995612781565b146109e25760405162461bcd60e51b815260206004820152601d60248201527f4261746368206973206e6f74206f70656e20666f72206d696e74696e670000006044820152606401610621565b805460018201546109f4908490612d9b565b1115610a425760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206578636565647320617661696c61626c6520737570706c79006044820152606401610621565b5f816006015483610a539190612dae565b600b546040516323b872dd60e01b8152336004820152306024820152604481018390529192506001600160a01b0316906323b872dd906064016020604051808303815f875af1158015610aa8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610acc9190612dc5565b610b095760405162461bcd60e51b815260206004820152600e60248201526d14185e5b595b9d0819985a5b195960921b6044820152606401610621565b5f82600101548360020154610b1e9190612d9b565b90505f846001600160401b03811115610b3957610b39612850565b604051908082528060200260200182016040528015610b62578160200160208202803683370190505b5090505f856001600160401b03811115610b7e57610b7e612850565b604051908082528060200260200182016040528015610ba7578160200160208202803683370190505b5090505f5b86811015610c72575f610bbf8286612d9b565b905080848381518110610bd457610bd4612de0565b6020026020010181815250506001838381518110610bf457610bf4612de0565b6020908102919091018101919091525f828152600790915260409020610c1d6003890182612e3d565b5086545f82815260086020908152604080832093909355600d90528181208b90559051339183918c917ff371d67483809edbc84279729528d26a3e37ce67f1e3a911778dbf88ff927ca291a450600101610bac565b50610c8d33838360405180602001604052805f815250611fc6565b335f908152600e602052604081208054889290610cab908490612d9b565b9250508190555085856001015f828254610cc59190612d9b565b90915550508454600186015403610d215760048501805460ff1916600190811790915585015460405190815287907fed76190d94e2079764a112387a25d1b74945a43c0b92ce5f4f65b391b66390fe9060200160405180910390a25b5050505050610d306001600455565b5050565b5f5f82118015610d45575060065482105b610d615760405162461bcd60e51b815260040161062190612d3a565b5f828152600c6020526040902060018101548154610d7f9190612d27565b9392505050565b5f5f82118015610d97575060065482105b610db35760405162461bcd60e51b815260040161062190612d3a565b505f908152600c602052604090206006015490565b5f5f82118015610dd9575060065482105b610df55760405162461bcd60e51b815260040161062190612d3a565b505f908152600c602052604090206004015460ff1690565b336001600160a01b0386168114801590610e2e5750610e2c8682611ac8565b155b15610e5f5760405163711bec9160e11b81526001600160a01b03808316600483015287166024820152604401610621565b610e6c8686868686612002565b505050505050565b5f5f82118015610e85575060065482105b610ea15760405162461bcd60e51b815260040161062190612d3a565b5f828152600960209081526040808320548084526008909252909120546001610eca8284612d9b565b610ed49190612d27565b949350505050565b6060805f6001600654610eef9190612d27565b9050806001600160401b03811115610f0957610f09612850565b604051908082528060200260200182016040528015610f32578160200160208202803683370190505b509250806001600160401b03811115610f4d57610f4d612850565b604051908082528060200260200182016040528015610f76578160200160208202803683370190505b50915060015b818111610ffc578084610f90600183612d27565b81518110610fa057610fa0612de0565b602002602001018181525050600c5f8281526020019081526020015f206001015483600183610fcf9190612d27565b81518110610fdf57610fdf612de0565b602090810291909101015280610ff481612f14565b915050610f7c565b50509091565b606081518351146110335781518351604051635b05999160e01b815260048101929092526024820152604401610621565b5f83516001600160401b0381111561104d5761104d612850565b604051908082528060200260200182016040528015611076578160200160208202803683370190505b5090505f5b84518110156110c45760208082028601015161109f90602080840287010151610559565b8282815181106110b1576110b1612de0565b602090810291909101015260010161107b565b509392505050565b6110d4612067565b600b546040516370a0823160e01b81523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa15801561111a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061113e9190612f2c565b90505f811161118f5760405162461bcd60e51b815260206004820152601760248201527f4e6f207061796d656e747320746f2077697468647261770000000000000000006044820152606401610621565b600b546001600160a01b031663a9059cbb6111b26003546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303815f875af11580156111fc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112209190612dc5565b6112605760405162461bcd60e51b815260206004820152601160248201527015da5d1a191c985dd85b0819985a5b1959607a1b6044820152606401610621565b50565b6060805f60016006546112769190612d27565b9050806001600160401b0381111561129057611290612850565b6040519080825280602002602001820160405280156112b9578160200160208202803683370190505b509250806001600160401b038111156112d4576112d4612850565b6040519080825280602002602001820160405280156112fd578160200160208202803683370190505b50915060015b8181116113c7578084611317600183612d27565b8151811061132757611327612de0565b6020908102919091018101919091525f828152600c9091526040812060018101546002820154839161135891612d9b565b60028301549091505b81811015611387576113738982610559565b61137d9085612d9b565b9350600101611361565b508286611395600187612d27565b815181106113a5576113a5612de0565b60200260200101818152505050505080806113bf90612f14565b915050611303565b5050915091565b5f600160065461073e9190612d27565b6113e6612067565b6001600160a01b03811661143c5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207061796d656e7420746f6b656e20616464726573730000006044820152606401610621565b600b80546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f5efdfedf5aef119c431263f0656093045dffdf44b3d8f1b0f158dc295c3a0f8e91015b60405180910390a15050565b6114a6612067565b6114af5f612094565b565b60605f60016006546114c39190612d27565b90505f60015b82811161151a575f818152600c602052604081206004015460ff1660018111156114f5576114f5612781565b03611508578161150481612f14565b9250505b8061151281612f14565b9150506114c9565b505f816001600160401b0381111561153457611534612850565b60405190808252806020026020018201604052801561155d578160200160208202803683370190505b5090505f60015b8481116115d3575f818152600c602052604081206004015460ff16600181111561159057611590612781565b036115c157808383815181106115a8576115a8612de0565b6020908102919091010152816115bd81612f14565b9250505b806115cb81612f14565b915050611564565b5090949350505050565b5f5f821180156115ee575060065482105b61160a5760405162461bcd60e51b815260040161062190612d3a565b505f9081526009602052604090205490565b610d303383836120e5565b5f5f5f83118015611639575060065483105b6116555760405162461bcd60e51b815260040161062190612d3a565b50505f908152600c60205260409020600181015490549091565b611677612067565b5f82118015611687575060065482105b6116a35760405162461bcd60e51b815260040161062190612d71565b5f81116116f25760405162461bcd60e51b815260206004820152601c60248201527f5072696365206d7573742062652067726561746572207468616e2030000000006044820152606401610621565b5f828152600c6020526040812090600482015460ff16600181111561171957611719612781565b1461175a5760405162461bcd60e51b81526020600482015260116024820152702130ba31b41034b9903737ba1037b832b760791b6044820152606401610621565b60068101805490839055604080518281526020810185905285917fae5e9ff0c68b91963dfa1a9a6106102352cf6980220d5656755ec28f987bba4b910160405180910390a250505050565b5f6117af82611f89565b6117fb5760405162461bcd60e51b815260206004820152601b60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e00000000006044820152606401610621565b505f9081526008602052604090205490565b5f5f8211801561181e575060065482105b61183a5760405162461bcd60e51b815260040161062190612d3a565b5f828152600c602052604081206004015460ff16600181111561185f5761185f612781565b1492915050565b60605f82118015611878575060065482105b6118945760405162461bcd60e51b815260040161062190612d3a565b5f8281526009602090815260408083205480845260089092528220549091816001600160401b038111156118ca576118ca612850565b6040519080825280602002602001820160405280156118f3578160200160208202803683370190505b5090505f5b8281101561192f5761190a8185612d9b565b82828151811061191c5761191c612de0565b60209081029190910101526001016118f8565b50949350505050565b611940612067565b5f81118015611950575060065481105b61196c5760405162461bcd60e51b815260040161062190612d71565b5f818152600c6020526040812090600482015460ff16600181111561199357611993612781565b146119d45760405162461bcd60e51b81526020600482015260116024820152702130ba31b41034b9903737ba1037b832b760791b6044820152606401610621565b60048101805460ff1916600190811790915581015460405190815282907fed76190d94e2079764a112387a25d1b74945a43c0b92ce5f4f65b391b66390fe9060200160405180910390a25050565b611a2a612067565b5f8111611a8a5760405162461bcd60e51b815260206004820152602860248201527f4d6178206d696e7461626c652073697a65206d75737420626520677265617465604482015267072207468616e20360c41b6064820152608401610621565b600a80549082905560408051828152602081018490527ffdb31efaa40f0ff2e74bd2541da7a711e2697265923a01622e6f39775daeee749101611492565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205460ff1690565b336001600160a01b0386168114801590611b165750611b148682611ac8565b155b15611b475760405163711bec9160e11b81526001600160a01b03808316600483015287166024820152604401610621565b610e6c8686868686612179565b611b5c612067565b6001600160a01b038116611b8557604051631e4fbdf760e01b81525f6004820152602401610621565b61126081612094565b5f611b97612067565b5f8411611bf05760405162461bcd60e51b815260206004820152602160248201527f4d617820737570706c79206d7573742062652067726561746572207468616e206044820152600360fc1b6064820152608401610621565b5f835111611c365760405162461bcd60e51b81526020600482015260136024820152725552492063616e6e6f7420626520656d70747960681b6044820152606401610621565b5f8211611c945760405162461bcd60e51b815260206004820152602660248201527f50726963652070657220746f6b656e206d75737420626520677265617465722060448201526507468616e20360d41b6064820152608401610621565b506006546005546040805160e0810182528681525f6020808301828152838501868152606085018a8152608086018590524260a087015260c086018a9052888552600c9093529490922083518155915160018301559251600282015591519091906003820190611d049082612f43565b50608082015160048201805460ff191660018381811115611d2757611d27612781565b021790555060a082015160058083019190915560c0909201516006909101555f838152600960205260408120839055815487929190611d67908490612d9b565b909155505060068054905f611d7b83612f14565b919050555080827f8cfee0bc5b9375f5f9282721ae570276a6a80491cbeb4297f98f36bfdcad5631878787604051611db593929190612ff5565b60405180910390a3509392505050565b611dcd612067565b5f815111611e135760405162461bcd60e51b81526020600482015260136024820152725552492063616e6e6f7420626520656d70747960681b6044820152606401610621565b5f82118015611e23575060065482105b611e3f5760405162461bcd60e51b815260040161062190612d3a565b5f828152600c60205260408120600381018054919291611e5e90612cdb565b80601f0160208091040260200160405190810160405280929190818152602001828054611e8a90612cdb565b8015611ed55780601f10611eac57610100808354040283529160200191611ed5565b820191905f5260205f20905b815481529060010190602001808311611eb857829003601f168201915b5050505050905082826003019081611eed9190612f43565b50600182015460028301545f918291611f069190612d9b565b60028501549091505b81811015611f44575f818152600760205260409020611f2e8782612f43565b5082611f3981612f14565b935050600101611f0f565b50857f6f36843c8e1b559eda0e48dddb3b6df1219674e5c8b968b33fd0136e5ebfa1a2848785604051611f799392919061301d565b60405180910390a2505050505050565b5f5f8211801561057a5750506005541190565b600260045403611fbf57604051633ee5aeb560e01b815260040160405180910390fd5b6002600455565b6001600160a01b038416611fef57604051632bfa23e760e11b81525f6004820152602401610621565b611ffc5f85858585612205565b50505050565b6001600160a01b03841661202b57604051632bfa23e760e11b81525f6004820152602401610621565b6001600160a01b03851661205357604051626a0d4560e21b81525f6004820152602401610621565b6120608585858585612205565b5050505050565b6003546001600160a01b031633146114af5760405163118cdaa760e01b8152336004820152602401610621565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b03821661210d5760405162ced3e160e81b81525f6004820152602401610621565b6001600160a01b038381165f81815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166121a257604051632bfa23e760e11b81525f6004820152602401610621565b6001600160a01b0385166121ca57604051626a0d4560e21b81525f6004820152602401610621565b604080516001808252602082018690528183019081526060820185905260808201909252906121fc8787848487612205565b50505050505050565b61221185858585612258565b6001600160a01b03841615612060578251339060010361224a5760208481015190840151612243838989858589612467565b5050610e6c565b610e6c818787878787612588565b80518251146122875781518151604051635b05999160e01b815260048101929092526024820152604401610621565b335f5b8351811015612389576020818102858101820151908501909101516001600160a01b0388161561233b575f828152602081815260408083206001600160a01b038c16845290915290205481811015612315576040516303dee4c560e01b81526001600160a01b038a166004820152602481018290526044810183905260648101849052608401610621565b5f838152602081815260408083206001600160a01b038d16845290915290209082900390555b6001600160a01b0387161561237f575f828152602081815260408083206001600160a01b038b16845290915281208054839290612379908490612d9b565b90915550505b505060010161228a565b5082516001036124095760208301515f906020840151909150856001600160a01b0316876001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6285856040516123fa929190918252602082015260400190565b60405180910390a45050612060565b836001600160a01b0316856001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612458929190612a77565b60405180910390a45050505050565b6001600160a01b0384163b15610e6c5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906124ab9089908990889088908890600401613052565b6020604051808303815f875af19250505080156124e5575060408051601f3d908101601f191682019092526124e291810190613096565b60015b61254c573d808015612512576040519150601f19603f3d011682016040523d82523d5f602084013e612517565b606091505b5080515f0361254457604051632bfa23e760e11b81526001600160a01b0386166004820152602401610621565b805160208201fd5b6001600160e01b0319811663f23a6e6160e01b146121fc57604051632bfa23e760e11b81526001600160a01b0386166004820152602401610621565b6001600160a01b0384163b15610e6c5760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906125cc90899089908890889088906004016130b1565b6020604051808303815f875af1925050508015612606575060408051601f3d908101601f1916820190925261260391810190613096565b60015b612633573d808015612512576040519150601f19603f3d011682016040523d82523d5f602084013e612517565b6001600160e01b0319811663bc197c8160e01b146121fc57604051632bfa23e760e11b81526001600160a01b0386166004820152602401610621565b6040518060e001604052805f81526020015f81526020015f8152602001606081526020015f60018111156126a5576126a5612781565b81526020015f81526020015f81525090565b80356001600160a01b03811681146126cd575f5ffd5b919050565b5f5f604083850312156126e3575f5ffd5b6126ec836126b7565b946020939093013593505050565b6001600160e01b031981168114611260575f5ffd5b5f6020828403121561271f575f5ffd5b8135610d7f816126fa565b5f6020828403121561273a575f5ffd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610d7f6020830184612741565b634e487b7160e01b5f52602160045260245ffd5b600281106127b157634e487b7160e01b5f52602160045260245ffd5b9052565b602081528151602082015260208201516040820152604082015160608201525f606083015160e060808401526127ef610100840182612741565b9050608084015161280360a0850182612795565b5060a084015160c084015260c084015160e08401528091505092915050565b5f5f60408385031215612833575f5ffd5b50508035926020909101359150565b6020810161057a8284612795565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561288c5761288c612850565b604052919050565b5f6001600160401b038211156128ac576128ac612850565b5060051b60200190565b5f82601f8301126128c5575f5ffd5b81356128d86128d382612894565b612864565b8082825260208201915060208360051b8601019250858311156128f9575f5ffd5b602085015b838110156129165780358352602092830192016128fe565b5095945050505050565b5f82601f83011261292f575f5ffd5b8135602083015f5f6001600160401b0384111561294e5761294e612850565b50601f8301601f191660200161296381612864565b915050828152858383011115612977575f5ffd5b828260208301375f92810160200192909252509392505050565b5f5f5f5f5f60a086880312156129a5575f5ffd5b6129ae866126b7565b94506129bc602087016126b7565b935060408601356001600160401b038111156129d6575f5ffd5b6129e2888289016128b6565b93505060608601356001600160401b038111156129fd575f5ffd5b612a09888289016128b6565b92505060808601356001600160401b03811115612a24575f5ffd5b612a3088828901612920565b9150509295509295909350565b5f8151808452602084019350602083015f5b82811015612a6d578151865260209586019590910190600101612a4f565b5093949350505050565b604081525f612a896040830185612a3d565b8281036020840152612a9b8185612a3d565b95945050505050565b5f5f60408385031215612ab5575f5ffd5b82356001600160401b03811115612aca575f5ffd5b8301601f81018513612ada575f5ffd5b8035612ae86128d382612894565b8082825260208201915060208360051b850101925087831115612b09575f5ffd5b6020840193505b82841015612b3257612b21846126b7565b825260209384019390910190612b10565b945050505060208301356001600160401b03811115612b4f575f5ffd5b612b5b858286016128b6565b9150509250929050565b602081525f610d7f6020830184612a3d565b5f60208284031215612b87575f5ffd5b610d7f826126b7565b8015158114611260575f5ffd5b5f5f60408385031215612bae575f5ffd5b612bb7836126b7565b91506020830135612bc781612b90565b809150509250929050565b5f5f60408385031215612be3575f5ffd5b612bec836126b7565b9150612bfa602084016126b7565b90509250929050565b5f5f5f5f5f60a08688031215612c17575f5ffd5b612c20866126b7565b9450612c2e602087016126b7565b9350604086013592506060860135915060808601356001600160401b03811115612a24575f5ffd5b5f5f5f60608486031215612c68575f5ffd5b8335925060208401356001600160401b03811115612c84575f5ffd5b612c9086828701612920565b93969395505050506040919091013590565b5f5f60408385031215612cb3575f5ffd5b8235915060208301356001600160401b03811115612ccf575f5ffd5b612b5b85828601612920565b600181811c90821680612cef57607f821691505b602082108103612d0d57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561057a5761057a612d13565b6020808252601b908201527f517565727920666f72206e6f6e6578697374656e742062617463680000000000604082015260600190565b60208082526010908201526f125b9d985b1a590818985d18da08125160821b604082015260600190565b8082018082111561057a5761057a612d13565b808202811582820484141761057a5761057a612d13565b5f60208284031215612dd5575f5ffd5b8151610d7f81612b90565b634e487b7160e01b5f52603260045260245ffd5b601f821115612e3857805f5260205f20601f840160051c81016020851015612e195750805b601f840160051c820191505b81811015612060575f8155600101612e25565b505050565b818103612e48575050565b612e528254612cdb565b6001600160401b03811115612e6957612e69612850565b612e7d81612e778454612cdb565b84612df4565b5f601f821160018114612eb1575f8315612e975750848201545b600184901b5f19600386901b1c198216175b855550612060565b5f8581526020808220868352908220601f198616925b83811015612ee75782860154825560019586019590910190602001612ec7565b5085831015612f0457818501545f19600388901b60f8161c191681555b5050505050600190811b01905550565b5f60018201612f2557612f25612d13565b5060010190565b5f60208284031215612f3c575f5ffd5b5051919050565b81516001600160401b03811115612f5c57612f5c612850565b612f6a81612e778454612cdb565b6020601f821160018114612f9a575f8315612e97575081850151600184901b5f19600386901b1c19821617612ea9565b5f84815260208120601f198516915b82811015612fc95787850151825560209485019460019092019101612fa9565b5084821015612fe657868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b838152606060208201525f61300d6060830185612741565b9050826040830152949350505050565b606081525f61302f6060830186612741565b82810360208401526130418186612741565b915050826040830152949350505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190525f9061308b90830184612741565b979650505050505050565b5f602082840312156130a6575f5ffd5b8151610d7f816126fa565b6001600160a01b0386811682528516602082015260a0604082018190525f906130dc90830186612a3d565b82810360608401526130ee8186612a3d565b905082810360808401526131028185612741565b9897505050505050505056fea2646970667358221220873fca9eca08a4884283d9718b88460a38d721989c8202a0c88629fa0c19ce3664736f6c634300081e0033000000000000000000000000131f5ae1cbfefe8efbdf93da23fa4d39f14a817c
Deployed Bytecode
0x608060405234801561000f575f5ffd5b5060043610610228575f3560e01c8063715018a61161012a578063c3322985116100b4578063e985e9c511610079578063e985e9c5146104fa578063f242432a1461050d578063f2fde38b14610520578063f33c7bcc14610533578063fe31ed2814610546575f5ffd5b8063c3322985146104a5578063c94bf54d146104b8578063d2c411d3146104cb578063dff352c0146104de578063e7094a81146104e7575f5ffd5b8063a22cb465116100fa578063a22cb4651461041c578063a3bef9b21461042f578063b82bf13614610457578063b93afa121461047f578063b955e9b914610492575f5ffd5b8063715018a6146103e8578063844f2e07146103f05780638da5cb5b146103f8578063929a29c014610409575f5ffd5b80632d1bbc8e116101b65780634e1273f41161017b5780634e1273f4146103925780636103d70b146103b257806364f47a37146103ba57806369ff6abb146103cd5780636a326ab1146103d5575f5ffd5b80632d1bbc8e1461030b5780632eb2c2d61461032b5780633013ce291461033e578063419109781461036957806342d12e031461037c575f5ffd5b806318160ddd116101fc57806318160ddd146102a85780631a0058f5146102b05780631b2ef1ca146102d057806329e3dd7d146102e55780632bd92dd3146102f8575f5ffd5b8062fdd58e1461022c57806301ffc9a7146102525780630e25ca1e146102755780630e89341c14610288575b5f5ffd5b61023f61023a3660046126d2565b610559565b6040519081526020015b60405180910390f35b61026561026036600461270f565b610580565b6040519015158152602001610249565b61023f61028336600461272a565b6105cf565b61029b61029636600461272a565b61063c565b604051610249919061276f565b61023f61072e565b6102c36102be36600461272a565b610743565b60405161024991906127b5565b6102e36102de366004612822565b61088d565b005b61023f6102f336600461272a565b610d34565b61023f61030636600461272a565b610d86565b61031e61031936600461272a565b610dc8565b6040516102499190612842565b6102e3610339366004612991565b610e0d565b600b54610351906001600160a01b031681565b6040516001600160a01b039091168152602001610249565b61023f61037736600461272a565b610e74565b610384610edc565b604051610249929190612a77565b6103a56103a0366004612aa4565b611002565b6040516102499190612b65565b6102e36110cc565b6103846103c8366004612b77565b611263565b61023f6113ce565b6102e36103e3366004612b77565b6113de565b6102e361149e565b6103a56114b1565b6003546001600160a01b0316610351565b61023f61041736600461272a565b6115dd565b6102e361042a366004612b9d565b61161c565b61044261043d36600461272a565b611627565b60408051928352602083019190915201610249565b61023f610465366004612b77565b6001600160a01b03165f908152600e602052604090205490565b6102e361048d366004612822565b61166f565b61023f6104a036600461272a565b6117a5565b6102656104b336600461272a565b61180d565b6103a56104c636600461272a565b611866565b6102e36104d936600461272a565b611938565b61023f600a5481565b6102e36104f536600461272a565b611a22565b610265610508366004612bd2565b611ac8565b6102e361051b366004612c03565b611af5565b6102e361052e366004612b77565b611b54565b61023f610541366004612c56565b611b8e565b6102e3610554366004612ca2565b611dc5565b5f818152602081815260408083206001600160a01b03861684529091529020545b92915050565b5f6001600160e01b03198216636cdb3d1360e11b14806105b057506001600160e01b031982166303a24d0760e21b145b8061057a57506301ffc9a760e01b6001600160e01b031983161461057a565b5f6105d982611f89565b61062a5760405162461bcd60e51b815260206004820152601b60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e000000000060448201526064015b60405180910390fd5b505f908152600d602052604090205490565b606061064782611f89565b6106935760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e006044820152606401610621565b5f82815260076020526040902080546106ab90612cdb565b80601f01602080910402602001604051908101604052809291908181526020018280546106d790612cdb565b80156107225780601f106106f957610100808354040283529160200191610722565b820191905f5260205f20905b81548152906001019060200180831161070557829003601f168201915b50505050509050919050565b5f600160055461073e9190612d27565b905090565b61074b61266f565b5f8211801561075b575060065482105b6107775760405162461bcd60e51b815260040161062190612d3a565b600c5f8381526020019081526020015f206040518060e00160405290815f820154815260200160018201548152602001600282015481526020016003820180546107c090612cdb565b80601f01602080910402602001604051908101604052809291908181526020018280546107ec90612cdb565b80156108375780601f1061080e57610100808354040283529160200191610837565b820191905f5260205f20905b81548152906001019060200180831161081a57829003601f168201915b5050509183525050600482015460209091019060ff16600181111561085e5761085e612781565b600181111561086f5761086f612781565b81526005820154602082015260069091015460409091015292915050565b610895611f9c565b5f821180156108a5575060065482105b6108c15760405162461bcd60e51b815260040161062190612d71565b5f81116109105760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610621565b600a5481111561096e5760405162461bcd60e51b8152602060048201526024808201527f416d6f756e742065786365656473206d6178696d756d206d696e7461626c652060448201526373697a6560e01b6064820152608401610621565b5f828152600c6020526040812090600482015460ff16600181111561099557610995612781565b146109e25760405162461bcd60e51b815260206004820152601d60248201527f4261746368206973206e6f74206f70656e20666f72206d696e74696e670000006044820152606401610621565b805460018201546109f4908490612d9b565b1115610a425760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206578636565647320617661696c61626c6520737570706c79006044820152606401610621565b5f816006015483610a539190612dae565b600b546040516323b872dd60e01b8152336004820152306024820152604481018390529192506001600160a01b0316906323b872dd906064016020604051808303815f875af1158015610aa8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610acc9190612dc5565b610b095760405162461bcd60e51b815260206004820152600e60248201526d14185e5b595b9d0819985a5b195960921b6044820152606401610621565b5f82600101548360020154610b1e9190612d9b565b90505f846001600160401b03811115610b3957610b39612850565b604051908082528060200260200182016040528015610b62578160200160208202803683370190505b5090505f856001600160401b03811115610b7e57610b7e612850565b604051908082528060200260200182016040528015610ba7578160200160208202803683370190505b5090505f5b86811015610c72575f610bbf8286612d9b565b905080848381518110610bd457610bd4612de0565b6020026020010181815250506001838381518110610bf457610bf4612de0565b6020908102919091018101919091525f828152600790915260409020610c1d6003890182612e3d565b5086545f82815260086020908152604080832093909355600d90528181208b90559051339183918c917ff371d67483809edbc84279729528d26a3e37ce67f1e3a911778dbf88ff927ca291a450600101610bac565b50610c8d33838360405180602001604052805f815250611fc6565b335f908152600e602052604081208054889290610cab908490612d9b565b9250508190555085856001015f828254610cc59190612d9b565b90915550508454600186015403610d215760048501805460ff1916600190811790915585015460405190815287907fed76190d94e2079764a112387a25d1b74945a43c0b92ce5f4f65b391b66390fe9060200160405180910390a25b5050505050610d306001600455565b5050565b5f5f82118015610d45575060065482105b610d615760405162461bcd60e51b815260040161062190612d3a565b5f828152600c6020526040902060018101548154610d7f9190612d27565b9392505050565b5f5f82118015610d97575060065482105b610db35760405162461bcd60e51b815260040161062190612d3a565b505f908152600c602052604090206006015490565b5f5f82118015610dd9575060065482105b610df55760405162461bcd60e51b815260040161062190612d3a565b505f908152600c602052604090206004015460ff1690565b336001600160a01b0386168114801590610e2e5750610e2c8682611ac8565b155b15610e5f5760405163711bec9160e11b81526001600160a01b03808316600483015287166024820152604401610621565b610e6c8686868686612002565b505050505050565b5f5f82118015610e85575060065482105b610ea15760405162461bcd60e51b815260040161062190612d3a565b5f828152600960209081526040808320548084526008909252909120546001610eca8284612d9b565b610ed49190612d27565b949350505050565b6060805f6001600654610eef9190612d27565b9050806001600160401b03811115610f0957610f09612850565b604051908082528060200260200182016040528015610f32578160200160208202803683370190505b509250806001600160401b03811115610f4d57610f4d612850565b604051908082528060200260200182016040528015610f76578160200160208202803683370190505b50915060015b818111610ffc578084610f90600183612d27565b81518110610fa057610fa0612de0565b602002602001018181525050600c5f8281526020019081526020015f206001015483600183610fcf9190612d27565b81518110610fdf57610fdf612de0565b602090810291909101015280610ff481612f14565b915050610f7c565b50509091565b606081518351146110335781518351604051635b05999160e01b815260048101929092526024820152604401610621565b5f83516001600160401b0381111561104d5761104d612850565b604051908082528060200260200182016040528015611076578160200160208202803683370190505b5090505f5b84518110156110c45760208082028601015161109f90602080840287010151610559565b8282815181106110b1576110b1612de0565b602090810291909101015260010161107b565b509392505050565b6110d4612067565b600b546040516370a0823160e01b81523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa15801561111a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061113e9190612f2c565b90505f811161118f5760405162461bcd60e51b815260206004820152601760248201527f4e6f207061796d656e747320746f2077697468647261770000000000000000006044820152606401610621565b600b546001600160a01b031663a9059cbb6111b26003546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303815f875af11580156111fc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112209190612dc5565b6112605760405162461bcd60e51b815260206004820152601160248201527015da5d1a191c985dd85b0819985a5b1959607a1b6044820152606401610621565b50565b6060805f60016006546112769190612d27565b9050806001600160401b0381111561129057611290612850565b6040519080825280602002602001820160405280156112b9578160200160208202803683370190505b509250806001600160401b038111156112d4576112d4612850565b6040519080825280602002602001820160405280156112fd578160200160208202803683370190505b50915060015b8181116113c7578084611317600183612d27565b8151811061132757611327612de0565b6020908102919091018101919091525f828152600c9091526040812060018101546002820154839161135891612d9b565b60028301549091505b81811015611387576113738982610559565b61137d9085612d9b565b9350600101611361565b508286611395600187612d27565b815181106113a5576113a5612de0565b60200260200101818152505050505080806113bf90612f14565b915050611303565b5050915091565b5f600160065461073e9190612d27565b6113e6612067565b6001600160a01b03811661143c5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207061796d656e7420746f6b656e20616464726573730000006044820152606401610621565b600b80546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f5efdfedf5aef119c431263f0656093045dffdf44b3d8f1b0f158dc295c3a0f8e91015b60405180910390a15050565b6114a6612067565b6114af5f612094565b565b60605f60016006546114c39190612d27565b90505f60015b82811161151a575f818152600c602052604081206004015460ff1660018111156114f5576114f5612781565b03611508578161150481612f14565b9250505b8061151281612f14565b9150506114c9565b505f816001600160401b0381111561153457611534612850565b60405190808252806020026020018201604052801561155d578160200160208202803683370190505b5090505f60015b8481116115d3575f818152600c602052604081206004015460ff16600181111561159057611590612781565b036115c157808383815181106115a8576115a8612de0565b6020908102919091010152816115bd81612f14565b9250505b806115cb81612f14565b915050611564565b5090949350505050565b5f5f821180156115ee575060065482105b61160a5760405162461bcd60e51b815260040161062190612d3a565b505f9081526009602052604090205490565b610d303383836120e5565b5f5f5f83118015611639575060065483105b6116555760405162461bcd60e51b815260040161062190612d3a565b50505f908152600c60205260409020600181015490549091565b611677612067565b5f82118015611687575060065482105b6116a35760405162461bcd60e51b815260040161062190612d71565b5f81116116f25760405162461bcd60e51b815260206004820152601c60248201527f5072696365206d7573742062652067726561746572207468616e2030000000006044820152606401610621565b5f828152600c6020526040812090600482015460ff16600181111561171957611719612781565b1461175a5760405162461bcd60e51b81526020600482015260116024820152702130ba31b41034b9903737ba1037b832b760791b6044820152606401610621565b60068101805490839055604080518281526020810185905285917fae5e9ff0c68b91963dfa1a9a6106102352cf6980220d5656755ec28f987bba4b910160405180910390a250505050565b5f6117af82611f89565b6117fb5760405162461bcd60e51b815260206004820152601b60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e00000000006044820152606401610621565b505f9081526008602052604090205490565b5f5f8211801561181e575060065482105b61183a5760405162461bcd60e51b815260040161062190612d3a565b5f828152600c602052604081206004015460ff16600181111561185f5761185f612781565b1492915050565b60605f82118015611878575060065482105b6118945760405162461bcd60e51b815260040161062190612d3a565b5f8281526009602090815260408083205480845260089092528220549091816001600160401b038111156118ca576118ca612850565b6040519080825280602002602001820160405280156118f3578160200160208202803683370190505b5090505f5b8281101561192f5761190a8185612d9b565b82828151811061191c5761191c612de0565b60209081029190910101526001016118f8565b50949350505050565b611940612067565b5f81118015611950575060065481105b61196c5760405162461bcd60e51b815260040161062190612d71565b5f818152600c6020526040812090600482015460ff16600181111561199357611993612781565b146119d45760405162461bcd60e51b81526020600482015260116024820152702130ba31b41034b9903737ba1037b832b760791b6044820152606401610621565b60048101805460ff1916600190811790915581015460405190815282907fed76190d94e2079764a112387a25d1b74945a43c0b92ce5f4f65b391b66390fe9060200160405180910390a25050565b611a2a612067565b5f8111611a8a5760405162461bcd60e51b815260206004820152602860248201527f4d6178206d696e7461626c652073697a65206d75737420626520677265617465604482015267072207468616e20360c41b6064820152608401610621565b600a80549082905560408051828152602081018490527ffdb31efaa40f0ff2e74bd2541da7a711e2697265923a01622e6f39775daeee749101611492565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205460ff1690565b336001600160a01b0386168114801590611b165750611b148682611ac8565b155b15611b475760405163711bec9160e11b81526001600160a01b03808316600483015287166024820152604401610621565b610e6c8686868686612179565b611b5c612067565b6001600160a01b038116611b8557604051631e4fbdf760e01b81525f6004820152602401610621565b61126081612094565b5f611b97612067565b5f8411611bf05760405162461bcd60e51b815260206004820152602160248201527f4d617820737570706c79206d7573742062652067726561746572207468616e206044820152600360fc1b6064820152608401610621565b5f835111611c365760405162461bcd60e51b81526020600482015260136024820152725552492063616e6e6f7420626520656d70747960681b6044820152606401610621565b5f8211611c945760405162461bcd60e51b815260206004820152602660248201527f50726963652070657220746f6b656e206d75737420626520677265617465722060448201526507468616e20360d41b6064820152608401610621565b506006546005546040805160e0810182528681525f6020808301828152838501868152606085018a8152608086018590524260a087015260c086018a9052888552600c9093529490922083518155915160018301559251600282015591519091906003820190611d049082612f43565b50608082015160048201805460ff191660018381811115611d2757611d27612781565b021790555060a082015160058083019190915560c0909201516006909101555f838152600960205260408120839055815487929190611d67908490612d9b565b909155505060068054905f611d7b83612f14565b919050555080827f8cfee0bc5b9375f5f9282721ae570276a6a80491cbeb4297f98f36bfdcad5631878787604051611db593929190612ff5565b60405180910390a3509392505050565b611dcd612067565b5f815111611e135760405162461bcd60e51b81526020600482015260136024820152725552492063616e6e6f7420626520656d70747960681b6044820152606401610621565b5f82118015611e23575060065482105b611e3f5760405162461bcd60e51b815260040161062190612d3a565b5f828152600c60205260408120600381018054919291611e5e90612cdb565b80601f0160208091040260200160405190810160405280929190818152602001828054611e8a90612cdb565b8015611ed55780601f10611eac57610100808354040283529160200191611ed5565b820191905f5260205f20905b815481529060010190602001808311611eb857829003601f168201915b5050505050905082826003019081611eed9190612f43565b50600182015460028301545f918291611f069190612d9b565b60028501549091505b81811015611f44575f818152600760205260409020611f2e8782612f43565b5082611f3981612f14565b935050600101611f0f565b50857f6f36843c8e1b559eda0e48dddb3b6df1219674e5c8b968b33fd0136e5ebfa1a2848785604051611f799392919061301d565b60405180910390a2505050505050565b5f5f8211801561057a5750506005541190565b600260045403611fbf57604051633ee5aeb560e01b815260040160405180910390fd5b6002600455565b6001600160a01b038416611fef57604051632bfa23e760e11b81525f6004820152602401610621565b611ffc5f85858585612205565b50505050565b6001600160a01b03841661202b57604051632bfa23e760e11b81525f6004820152602401610621565b6001600160a01b03851661205357604051626a0d4560e21b81525f6004820152602401610621565b6120608585858585612205565b5050505050565b6003546001600160a01b031633146114af5760405163118cdaa760e01b8152336004820152602401610621565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b03821661210d5760405162ced3e160e81b81525f6004820152602401610621565b6001600160a01b038381165f81815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166121a257604051632bfa23e760e11b81525f6004820152602401610621565b6001600160a01b0385166121ca57604051626a0d4560e21b81525f6004820152602401610621565b604080516001808252602082018690528183019081526060820185905260808201909252906121fc8787848487612205565b50505050505050565b61221185858585612258565b6001600160a01b03841615612060578251339060010361224a5760208481015190840151612243838989858589612467565b5050610e6c565b610e6c818787878787612588565b80518251146122875781518151604051635b05999160e01b815260048101929092526024820152604401610621565b335f5b8351811015612389576020818102858101820151908501909101516001600160a01b0388161561233b575f828152602081815260408083206001600160a01b038c16845290915290205481811015612315576040516303dee4c560e01b81526001600160a01b038a166004820152602481018290526044810183905260648101849052608401610621565b5f838152602081815260408083206001600160a01b038d16845290915290209082900390555b6001600160a01b0387161561237f575f828152602081815260408083206001600160a01b038b16845290915281208054839290612379908490612d9b565b90915550505b505060010161228a565b5082516001036124095760208301515f906020840151909150856001600160a01b0316876001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6285856040516123fa929190918252602082015260400190565b60405180910390a45050612060565b836001600160a01b0316856001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612458929190612a77565b60405180910390a45050505050565b6001600160a01b0384163b15610e6c5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906124ab9089908990889088908890600401613052565b6020604051808303815f875af19250505080156124e5575060408051601f3d908101601f191682019092526124e291810190613096565b60015b61254c573d808015612512576040519150601f19603f3d011682016040523d82523d5f602084013e612517565b606091505b5080515f0361254457604051632bfa23e760e11b81526001600160a01b0386166004820152602401610621565b805160208201fd5b6001600160e01b0319811663f23a6e6160e01b146121fc57604051632bfa23e760e11b81526001600160a01b0386166004820152602401610621565b6001600160a01b0384163b15610e6c5760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906125cc90899089908890889088906004016130b1565b6020604051808303815f875af1925050508015612606575060408051601f3d908101601f1916820190925261260391810190613096565b60015b612633573d808015612512576040519150601f19603f3d011682016040523d82523d5f602084013e612517565b6001600160e01b0319811663bc197c8160e01b146121fc57604051632bfa23e760e11b81526001600160a01b0386166004820152602401610621565b6040518060e001604052805f81526020015f81526020015f8152602001606081526020015f60018111156126a5576126a5612781565b81526020015f81526020015f81525090565b80356001600160a01b03811681146126cd575f5ffd5b919050565b5f5f604083850312156126e3575f5ffd5b6126ec836126b7565b946020939093013593505050565b6001600160e01b031981168114611260575f5ffd5b5f6020828403121561271f575f5ffd5b8135610d7f816126fa565b5f6020828403121561273a575f5ffd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610d7f6020830184612741565b634e487b7160e01b5f52602160045260245ffd5b600281106127b157634e487b7160e01b5f52602160045260245ffd5b9052565b602081528151602082015260208201516040820152604082015160608201525f606083015160e060808401526127ef610100840182612741565b9050608084015161280360a0850182612795565b5060a084015160c084015260c084015160e08401528091505092915050565b5f5f60408385031215612833575f5ffd5b50508035926020909101359150565b6020810161057a8284612795565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561288c5761288c612850565b604052919050565b5f6001600160401b038211156128ac576128ac612850565b5060051b60200190565b5f82601f8301126128c5575f5ffd5b81356128d86128d382612894565b612864565b8082825260208201915060208360051b8601019250858311156128f9575f5ffd5b602085015b838110156129165780358352602092830192016128fe565b5095945050505050565b5f82601f83011261292f575f5ffd5b8135602083015f5f6001600160401b0384111561294e5761294e612850565b50601f8301601f191660200161296381612864565b915050828152858383011115612977575f5ffd5b828260208301375f92810160200192909252509392505050565b5f5f5f5f5f60a086880312156129a5575f5ffd5b6129ae866126b7565b94506129bc602087016126b7565b935060408601356001600160401b038111156129d6575f5ffd5b6129e2888289016128b6565b93505060608601356001600160401b038111156129fd575f5ffd5b612a09888289016128b6565b92505060808601356001600160401b03811115612a24575f5ffd5b612a3088828901612920565b9150509295509295909350565b5f8151808452602084019350602083015f5b82811015612a6d578151865260209586019590910190600101612a4f565b5093949350505050565b604081525f612a896040830185612a3d565b8281036020840152612a9b8185612a3d565b95945050505050565b5f5f60408385031215612ab5575f5ffd5b82356001600160401b03811115612aca575f5ffd5b8301601f81018513612ada575f5ffd5b8035612ae86128d382612894565b8082825260208201915060208360051b850101925087831115612b09575f5ffd5b6020840193505b82841015612b3257612b21846126b7565b825260209384019390910190612b10565b945050505060208301356001600160401b03811115612b4f575f5ffd5b612b5b858286016128b6565b9150509250929050565b602081525f610d7f6020830184612a3d565b5f60208284031215612b87575f5ffd5b610d7f826126b7565b8015158114611260575f5ffd5b5f5f60408385031215612bae575f5ffd5b612bb7836126b7565b91506020830135612bc781612b90565b809150509250929050565b5f5f60408385031215612be3575f5ffd5b612bec836126b7565b9150612bfa602084016126b7565b90509250929050565b5f5f5f5f5f60a08688031215612c17575f5ffd5b612c20866126b7565b9450612c2e602087016126b7565b9350604086013592506060860135915060808601356001600160401b03811115612a24575f5ffd5b5f5f5f60608486031215612c68575f5ffd5b8335925060208401356001600160401b03811115612c84575f5ffd5b612c9086828701612920565b93969395505050506040919091013590565b5f5f60408385031215612cb3575f5ffd5b8235915060208301356001600160401b03811115612ccf575f5ffd5b612b5b85828601612920565b600181811c90821680612cef57607f821691505b602082108103612d0d57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561057a5761057a612d13565b6020808252601b908201527f517565727920666f72206e6f6e6578697374656e742062617463680000000000604082015260600190565b60208082526010908201526f125b9d985b1a590818985d18da08125160821b604082015260600190565b8082018082111561057a5761057a612d13565b808202811582820484141761057a5761057a612d13565b5f60208284031215612dd5575f5ffd5b8151610d7f81612b90565b634e487b7160e01b5f52603260045260245ffd5b601f821115612e3857805f5260205f20601f840160051c81016020851015612e195750805b601f840160051c820191505b81811015612060575f8155600101612e25565b505050565b818103612e48575050565b612e528254612cdb565b6001600160401b03811115612e6957612e69612850565b612e7d81612e778454612cdb565b84612df4565b5f601f821160018114612eb1575f8315612e975750848201545b600184901b5f19600386901b1c198216175b855550612060565b5f8581526020808220868352908220601f198616925b83811015612ee75782860154825560019586019590910190602001612ec7565b5085831015612f0457818501545f19600388901b60f8161c191681555b5050505050600190811b01905550565b5f60018201612f2557612f25612d13565b5060010190565b5f60208284031215612f3c575f5ffd5b5051919050565b81516001600160401b03811115612f5c57612f5c612850565b612f6a81612e778454612cdb565b6020601f821160018114612f9a575f8315612e97575081850151600184901b5f19600386901b1c19821617612ea9565b5f84815260208120601f198516915b82811015612fc95787850151825560209485019460019092019101612fa9565b5084821015612fe657868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b838152606060208201525f61300d6060830185612741565b9050826040830152949350505050565b606081525f61302f6060830186612741565b82810360208401526130418186612741565b915050826040830152949350505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190525f9061308b90830184612741565b979650505050505050565b5f602082840312156130a6575f5ffd5b8151610d7f816126fa565b6001600160a01b0386811682528516602082015260a0604082018190525f906130dc90830186612a3d565b82810360608401526130ee8186612a3d565b905082810360808401526131028185612741565b9897505050505050505056fea2646970667358221220873fca9eca08a4884283d9718b88460a38d721989c8202a0c88629fa0c19ce3664736f6c634300081e0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000131f5ae1cbfefe8efbdf93da23fa4d39f14a817c
-----Decoded View---------------
Arg [0] : _paymentToken (address): 0x131F5AE1CBfEFe8EFbDf93dA23fa4d39F14a817c
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000131f5ae1cbfefe8efbdf93da23fa4d39f14a817c
Deployed Bytecode Sourcemap
169885:12737:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;157372:134;;;;;;:::i;:::-;;:::i;:::-;;;643:25:1;;;631:2;616:18;157372:134:0;;;;;;;;156508:310;;;;;;:::i;:::-;;:::i;:::-;;;1230:14:1;;1223:22;1205:41;;1193:2;1178:18;156508:310:0;1065:187:1;179381::0;;;;;;:::i;:::-;;:::i;176905:191::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;177296:100::-;;;:::i;178609:214::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;172642:1644::-;;;;;;:::i;:::-;;:::i;:::-;;179944:288;;;;;;:::i;:::-;;:::i;179716:220::-;;;;;;:::i;:::-;;:::i;178835:218::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;159053:441::-;;;;;;:::i;:::-;;:::i;170286:26::-;;;;;-1:-1:-1;;;;;170286:26:0;;;;;;-1:-1:-1;;;;;6856:32:1;;;6838:51;;6826:2;6811:18;170286:26:0;6678:217:1;177744:339:0;;;;;;:::i;:::-;;:::i;181178:460::-;;;:::i;:::-;;;;;;;;:::i;157672:567::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;176638:259::-;;;:::i;181646:836::-;;;;;;:::i;:::-;;:::i;177404:101::-;;;:::i;176305:325::-;;;;;;:::i;:::-;;:::i;74115:103::-;;;:::i;180476:694::-;;;:::i;73440:87::-;73513:6;;-1:-1:-1;;;;;73513:6:0;73440:87;;177513:223;;;;;;:::i;:::-;;:::i;158277:146::-;;;;;;:::i;:::-;;:::i;179065:304::-;;;;;;:::i;:::-;;:::i;:::-;;;;10228:25:1;;;10284:2;10269:18;;10262:34;;;;10201:18;179065:304:0;10054:248:1;179580:128:0;;;;;;:::i;:::-;-1:-1:-1;;;;;179675:25:0;179648:7;179675:25;;;:16;:25;;;;;;;179580:128;175470:528;;;;;;:::i;:::-;;:::i;177104:184::-;;;;;;:::i;:::-;;:::i;180240:228::-;;;;;;:::i;:::-;;:::i;178091:506::-;;;;;;:::i;:::-;;:::i;174298:380::-;;;;;;:::i;:::-;;:::i;170235:38::-;;;;;;176006:291;;;;;;:::i;:::-;;:::i;158461:159::-;;;;;;:::i;:::-;;:::i;158658:357::-;;;;;;:::i;:::-;;:::i;74373:220::-;;;;;;:::i;:::-;;:::i;171604:1026::-;;;;;;:::i;:::-;;:::i;174690:772::-;;;;;;:::i;:::-;;:::i;157372:134::-;157449:7;157476:13;;;;;;;;;;;-1:-1:-1;;;;;157476:22:0;;;;;;;;;;157372:134;;;;;:::o;156508:310::-;156610:4;-1:-1:-1;;;;;;156647:41:0;;-1:-1:-1;;;156647:41:0;;:110;;-1:-1:-1;;;;;;;156705:52:0;;-1:-1:-1;;;156705:52:0;156647:110;:163;;;-1:-1:-1;;;;;;;;;;64311:40:0;;;156774:36;64211:148;179381:187;179444:7;179472:16;179480:7;179472;:16::i;:::-;179464:56;;;;-1:-1:-1;;;179464:56:0;;12483:2:1;179464:56:0;;;12465:21:1;12522:2;12502:18;;;12495:30;12561:29;12541:18;;;12534:57;12608:18;;179464:56:0;;;;;;;;;-1:-1:-1;179538:22:0;;;;:13;:22;;;;;;;179381:187::o;176905:191::-;176965:13;176999:16;177007:7;176999;:16::i;:::-;176991:60;;;;-1:-1:-1;;;176991:60:0;;12839:2:1;176991:60:0;;;12821:21:1;12878:2;12858:18;;;12851:30;12917:33;12897:18;;;12890:61;12968:18;;176991:60:0;12637:355:1;176991:60:0;177069:19;;;;:10;:19;;;;;177062:26;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;176905:191;;;:::o;177296:100::-;177342:7;177387:1;177369:15;;:19;;;;:::i;:::-;177362:26;;177296:100;:::o;178609:214::-;178671:16;;:::i;:::-;178718:1;178708:7;:11;:40;;;;;178733:15;;178723:7;:25;178708:40;178700:80;;;;-1:-1:-1;;;178700:80:0;;;;;;;:::i;:::-;178798:8;:17;178807:7;178798:17;;;;;;;;;;;178791:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;178791:24:0;;;-1:-1:-1;;178791:24:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;178609:214;-1:-1:-1;;178609:214:0:o;172642:1644::-;9928:21;:19;:21::i;:::-;172740:1:::1;172730:7;:11;:40;;;;;172755:15;;172745:7;:25;172730:40;172722:69;;;;-1:-1:-1::0;;;172722:69:0::1;;;;;;;:::i;:::-;172819:1;172810:6;:10;172802:52;;;::::0;-1:-1:-1;;;172802:52:0;;14550:2:1;172802:52:0::1;::::0;::::1;14532:21:1::0;14589:2;14569:18;;;14562:30;14628:31;14608:18;;;14601:59;14677:18;;172802:52:0::1;14348:353:1::0;172802:52:0::1;172883:17;;172873:6;:27;;172865:76;;;::::0;-1:-1:-1;;;172865:76:0;;14908:2:1;172865:76:0::1;::::0;::::1;14890:21:1::0;14947:2;14927:18;;;14920:30;14986:34;14966:18;;;14959:62;-1:-1:-1;;;15037:18:1;;;15030:34;15081:19;;172865:76:0::1;14706:400:1::0;172865:76:0::1;172962:23;172988:17:::0;;;:8:::1;:17;::::0;;;;;173024:12:::1;::::0;::::1;::::0;::::1;;::::0;:32;::::1;;;;;;:::i;:::-;;173016:74;;;::::0;-1:-1:-1;;;173016:74:0;;15313:2:1;173016:74:0::1;::::0;::::1;15295:21:1::0;15352:2;15332:18;;;15325:30;15391:31;15371:18;;;15364:59;15440:18;;173016:74:0::1;15111:353:1::0;173016:74:0::1;173139:15:::0;;173109:17:::1;::::0;::::1;::::0;:26:::1;::::0;173129:6;;173109:26:::1;:::i;:::-;:45;;173101:89;;;::::0;-1:-1:-1;;;173101:89:0;;15801:2:1;173101:89:0::1;::::0;::::1;15783:21:1::0;15840:2;15820:18;;;15813:30;15879:33;15859:18;;;15852:61;15930:18;;173101:89:0::1;15599:355:1::0;173101:89:0::1;173211:17;173240:5;:19;;;173231:6;:28;;;;:::i;:::-;173278:12;::::0;:63:::1;::::0;-1:-1:-1;;;173278:63:0;;173304:10:::1;173278:63;::::0;::::1;16334:51:1::0;173324:4:0::1;16401:18:1::0;;;16394:60;16470:18;;;16463:34;;;173211:48:0;;-1:-1:-1;;;;;;173278:12:0::1;::::0;:25:::1;::::0;16307:18:1;;173278:63:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;173270:90;;;::::0;-1:-1:-1;;;173270:90:0;;16960:2:1;173270:90:0::1;::::0;::::1;16942:21:1::0;16999:2;16979:18;;;16972:30;-1:-1:-1;;;17018:18:1;;;17011:44;17072:18;;173270:90:0::1;16758:338:1::0;173270:90:0::1;173381:17;173422:5;:17;;;173401:5;:18;;;:38;;;;:::i;:::-;173381:58;;173450:20;173487:6;-1:-1:-1::0;;;;;173473:21:0::1;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;-1:-1:-1;173473:21:0::1;;173450:44;;173505:24;173546:6;-1:-1:-1::0;;;;;173532:21:0::1;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;-1:-1:-1;173532:21:0::1;-1:-1:-1::0;173505:48:0;-1:-1:-1;173579:9:0::1;173574:376;173598:6;173594:1;:10;173574:376;;;173626:15;173644:13;173656:1:::0;173644:9;:13:::1;:::i;:::-;173626:31;;173681:7;173672:3;173676:1;173672:6;;;;;;;;:::i;:::-;;;;;;:16;;;::::0;::::1;173716:1;173703:7;173711:1;173703:10;;;;;;;;:::i;:::-;;::::0;;::::1;::::0;;;;;;:14;;;;173732:19:::1;::::0;;;:10:::1;:19:::0;;;;;;:31:::1;173754:9;::::0;::::1;173732:19:::0;:31:::1;:::i;:::-;-1:-1:-1::0;173801:15:0;;::::1;173778:20:::0;;;:11:::1;:20;::::0;;;;;;;:38;;;;173831:13:::1;:22:::0;;;;;:32;;;173897:41;;173927:10:::1;::::0;173790:7;;173856;;173897:41:::1;::::0;::::1;-1:-1:-1::0;173606:3:0::1;;173574:376;;;;173970:40;173981:10;173993:3;173998:7;173970:40;;;;;;;;;;;::::0;:10:::1;:40::i;:::-;174038:10;174021:28;::::0;;;:16:::1;:28;::::0;;;;:38;;174053:6;;174021:28;:38:::1;::::0;174053:6;;174021:38:::1;:::i;:::-;;;;;;;;174091:6;174070:5;:17;;;:27;;;;;;;:::i;:::-;::::0;;;-1:-1:-1;;174143:15:0;;174122:17:::1;::::0;::::1;::::0;:36;174118:161:::1;;174175:12;::::0;::::1;:33:::0;;-1:-1:-1;;174175:33:0::1;174190:18;174175:33:::0;;::::1;::::0;;;174249:17;::::1;::::0;174228:39:::1;::::0;643:25:1;;;174240:7:0;;174228:39:::1;::::0;631:2:1;616:18;174228:39:0::1;;;;;;;174118:161;172711:1575;;;;;9972:20:::0;9263:1;10514:7;:21;10331:212;9972:20;172642:1644;;:::o;179944:288::-;180017:7;180055:1;180045:7;:11;:40;;;;;180070:15;;180060:7;:25;180045:40;180037:80;;;;-1:-1:-1;;;180037:80:0;;;;;;;:::i;:::-;180128:23;180154:17;;;:8;:17;;;;;180207;;;;180189:15;;:35;;180207:17;180189:35;:::i;:::-;180182:42;179944:288;-1:-1:-1;;;179944:288:0:o;179716:220::-;179779:7;179817:1;179807:7;:11;:40;;;;;179832:15;;179822:7;:25;179807:40;179799:80;;;;-1:-1:-1;;;179799:80:0;;;;;;;:::i;:::-;-1:-1:-1;179897:17:0;;;;:8;:17;;;;;:31;;;;179716:220::o;178835:218::-;178899:11;178941:1;178931:7;:11;:40;;;;;178956:15;;178946:7;:25;178931:40;178923:80;;;;-1:-1:-1;;;178923:80:0;;;;;;;:::i;:::-;-1:-1:-1;179021:17:0;;;;:8;:17;;;;;:24;;;;;;178835:218::o;159053:441::-;1314:10;-1:-1:-1;;;;;159298:14:0;;;;;;;:49;;;159317:30;159334:4;159340:6;159317:16;:30::i;:::-;159316:31;159298:49;159294:131;;;159371:42;;-1:-1:-1;;;159371:42:0;;-1:-1:-1;;;;;19647:32:1;;;159371:42:0;;;19629:51:1;19716:32;;19696:18;;;19689:60;19602:18;;159371:42:0;19455:300:1;159294:131:0;159435:51;159458:4;159464:2;159468:3;159473:6;159481:4;159435:22;:51::i;:::-;159243:251;159053:441;;;;;:::o;177744:339::-;177812:7;177850:1;177840:7;:11;:40;;;;;177865:15;;177855:7;:25;177840:40;177832:80;;;;-1:-1:-1;;;177832:80:0;;;;;;;:::i;:::-;177923:20;177946:27;;;:18;:27;;;;;;;;;178004:25;;;:11;:25;;;;;;;178074:1;178047:24;178004:25;177946:27;178047:24;:::i;:::-;:28;;;;:::i;:::-;178040:35;177744:339;-1:-1:-1;;;;177744:339:0:o;181178:460::-;181227:25;181254:23;181290:18;181329:1;181311:15;;:19;;;;:::i;:::-;181290:40;;181366:10;-1:-1:-1;;;;;181352:25:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;181352:25:0;;181341:36;;181411:10;-1:-1:-1;;;;;181397:25:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;181397:25:0;-1:-1:-1;181388:34:0;-1:-1:-1;181460:1:0;181443:142;181468:10;181463:1;:15;181443:142;;181518:1;181500:8;181509:5;181513:1;181518;181509:5;:::i;:::-;181500:15;;;;;;;;:::i;:::-;;;;;;:19;;;;;181550:8;:11;181559:1;181550:11;;;;;;;;;;;:23;;;181534:6;181545:1;181541;:5;;;;:::i;:::-;181534:13;;;;;;;;:::i;:::-;;;;;;;;;;:39;181480:3;;;;:::i;:::-;;;;181443:142;;;;181605:25;181178:460;;:::o;157672:567::-;157799:16;157851:3;:10;157832:8;:15;:29;157828:123;;157911:10;;157923:15;;157885:54;;-1:-1:-1;;;157885:54:0;;;;;10228:25:1;;;;10269:18;;;10262:34;10201:18;;157885:54:0;10054:248:1;157828:123:0;157963:30;158010:8;:15;-1:-1:-1;;;;;157996:30:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;157996:30:0;-1:-1:-1;157963:63:0;-1:-1:-1;158044:9:0;158039:160;158063:8;:15;158059:1;:19;158039:160;;;151779:4;151770:14;;;151750:35;;;151744:42;158119:68;;151779:4;151770:14;;;151750:35;;;151744:42;157372:134;:::i;158119:68::-;158100:13;158114:1;158100:16;;;;;;;;:::i;:::-;;;;;;;;;;:87;158080:3;;158039:160;;;-1:-1:-1;158218:13:0;157672:567;-1:-1:-1;;;157672:567:0:o;176638:259::-;73326:13;:11;:13::i;:::-;176714:12:::1;::::0;:37:::1;::::0;-1:-1:-1;;;176714:37:0;;176745:4:::1;176714:37;::::0;::::1;6838:51:1::0;176696:15:0::1;::::0;-1:-1:-1;;;;;176714:12:0::1;::::0;:22:::1;::::0;6811:18:1;;176714:37:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;176696:55;;176780:1;176770:7;:11;176762:47;;;::::0;-1:-1:-1;;;176762:47:0;;20291:2:1;176762:47:0::1;::::0;::::1;20273:21:1::0;20330:2;20310:18;;;20303:30;20369:25;20349:18;;;20342:53;20412:18;;176762:47:0::1;20089:347:1::0;176762:47:0::1;176828:12;::::0;-1:-1:-1;;;;;176828:12:0::1;:21;176850:7;73513:6:::0;;-1:-1:-1;;;;;73513:6:0;;73440:87;176850:7:::1;176828:39;::::0;-1:-1:-1;;;;;;176828:39:0::1;::::0;;;;;;-1:-1:-1;;;;;20633:32:1;;;176828:39:0::1;::::0;::::1;20615:51:1::0;20682:18;;;20675:34;;;20588:18;;176828:39:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;176820:69;;;::::0;-1:-1:-1;;;176820:69:0;;20922:2:1;176820:69:0::1;::::0;::::1;20904:21:1::0;20961:2;20941:18;;;20934:30;-1:-1:-1;;;20980:18:1;;;20973:47;21037:18;;176820:69:0::1;20720:341:1::0;176820:69:0::1;176685:212;176638:259::o:0;181646:836::-;181714:25;181741;181779:18;181818:1;181800:15;;:19;;;;:::i;:::-;181779:40;;181855:10;-1:-1:-1;;;;;181841:25:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;181841:25:0;;181830:36;;181902:10;-1:-1:-1;;;;;181888:25:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;181888:25:0;-1:-1:-1;181877:36:0;-1:-1:-1;181951:1:0;181934:493;181959:10;181954:1;:15;181934:493;;182009:1;181991:8;182000:5;182004:1;182009;182000:5;:::i;:::-;181991:15;;;;;;;;:::i;:::-;;;;;;;;;;;:19;;;;182025:15;182099:11;;;:8;:11;;;;;;182167:17;;;;182146:18;;;;182025:15;;182146:38;;;:::i;:::-;182236:18;;;;182125:59;;-1:-1:-1;182213:149:0;182266:10;182256:7;:20;182213:149;;;182319:27;182329:7;182338;182319:9;:27::i;:::-;182308:38;;;;:::i;:::-;;-1:-1:-1;182278:9:0;;182213:149;;;-1:-1:-1;182408:7:0;182390:8;182399:5;182403:1;182399;:5;:::i;:::-;182390:15;;;;;;;;:::i;:::-;;;;;;:25;;;;;181976:451;;;181971:3;;;;;:::i;:::-;;;;181934:493;;;;182447:27;181646:836;;;:::o;177404:101::-;177451:7;177496:1;177478:15;;:19;;;;:::i;176305:325::-;73326:13;:11;:13::i;:::-;-1:-1:-1;;;;;176394:30:0;::::1;176386:72;;;::::0;-1:-1:-1;;;176386:72:0;;21268:2:1;176386:72:0::1;::::0;::::1;21250:21:1::0;21307:2;21287:18;;;21280:30;21346:31;21326:18;;;21319:59;21395:18;;176386:72:0::1;21066:353:1::0;176386:72:0::1;176496:12;::::0;;-1:-1:-1;;;;;176520:39:0;;::::1;-1:-1:-1::0;;;;;;176520:39:0;::::1;::::0;::::1;::::0;;;176575:47:::1;::::0;;176496:12;;;::::1;19629:51:1::0;;;19711:2;19696:18;;19689:60;;;;176575:47:0::1;::::0;19602:18:1;176575:47:0::1;;;;;;;;176375:255;176305:325:::0;:::o;74115:103::-;73326:13;:11;:13::i;:::-;74180:30:::1;74207:1;74180:18;:30::i;:::-;74115:103::o:0;180476:694::-;180525:16;180554:18;180593:1;180575:15;;:19;;;;:::i;:::-;180554:40;-1:-1:-1;180605:17:0;180664:1;180647:158;180672:10;180667:1;:15;180647:158;;180730:16;180708:11;;;:8;:11;;;;;:18;;;;;;:38;;;;;;;:::i;:::-;;180704:90;;180767:11;;;;:::i;:::-;;;;180704:90;180684:3;;;;:::i;:::-;;;;180647:158;;;;180825:28;180870:9;-1:-1:-1;;;;;180856:24:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;180856:24:0;-1:-1:-1;180825:55:0;-1:-1:-1;180891:13:0;180946:1;180929:195;180954:10;180949:1;:15;180929:195;;181012:16;180990:11;;;:8;:11;;;;;:18;;;;;;:38;;;;;;;:::i;:::-;;180986:127;;181070:1;181049:11;181061:5;181049:18;;;;;;;;:::i;:::-;;;;;;;;;;:22;181090:7;;;;:::i;:::-;;;;180986:127;180966:3;;;;:::i;:::-;;;;180929:195;;;-1:-1:-1;181151:11:0;;180476:694;-1:-1:-1;;;;180476:694:0:o;177513:223::-;177583:7;177621:1;177611:7;:11;:40;;;;;177636:15;;177626:7;:25;177611:40;177603:80;;;;-1:-1:-1;;;177603:80:0;;;;;;;:::i;:::-;-1:-1:-1;177701:27:0;;;;:18;:27;;;;;;;177513:223::o;158277:146::-;158363:52;1314:10;158396:8;158406;158363:18;:52::i;179065:304::-;179131:14;179147:13;179191:1;179181:7;:11;:40;;;;;179206:15;;179196:7;:25;179181:40;179173:80;;;;-1:-1:-1;;;179173:80:0;;;;;;;:::i;:::-;-1:-1:-1;;179264:23:0;179290:17;;;:8;:17;;;;;179326;;;;179345:15;;179326:17;;179065:304::o;175470:528::-;73326:13;:11;:13::i;:::-;175576:1:::1;175566:7;:11;:40;;;;;175591:15;;175581:7;:25;175566:40;175558:69;;;;-1:-1:-1::0;;;175558:69:0::1;;;;;;;:::i;:::-;175657:1;175646:8;:12;175638:53;;;::::0;-1:-1:-1;;;175638:53:0;;21626:2:1;175638:53:0::1;::::0;::::1;21608:21:1::0;21665:2;21645:18;;;21638:30;21704;21684:18;;;21677:58;21752:18;;175638:53:0::1;21424:352:1::0;175638:53:0::1;175712:23;175738:17:::0;;;:8:::1;:17;::::0;;;;;175774:12:::1;::::0;::::1;::::0;::::1;;::::0;:32;::::1;;;;;;:::i;:::-;;175766:62;;;::::0;-1:-1:-1;;;175766:62:0;;21983:2:1;175766:62:0::1;::::0;::::1;21965:21:1::0;22022:2;22002:18;;;21995:30;-1:-1:-1;;;22041:18:1;;;22034:47;22098:18;;175766:62:0::1;21781:341:1::0;175766:62:0::1;175868:19;::::0;::::1;::::0;;175898:30;;;;175944:46:::1;::::0;;10228:25:1;;;10284:2;10269:18;;10262:34;;;175962:7:0;;175944:46:::1;::::0;10201:18:1;175944:46:0::1;;;;;;;175547:451;;175470:528:::0;;:::o;177104:184::-;177166:7;177194:16;177202:7;177194;:16::i;:::-;177186:56;;;;-1:-1:-1;;;177186:56:0;;12483:2:1;177186:56:0;;;12465:21:1;12522:2;12502:18;;;12495:30;12561:29;12541:18;;;12534:57;12608:18;;177186:56:0;12281:351:1;177186:56:0;-1:-1:-1;177260:20:0;;;;:11;:20;;;;;;;177104:184::o;180240:228::-;180301:4;180336:1;180326:7;:11;:40;;;;;180351:15;;180341:7;:25;180326:40;180318:80;;;;-1:-1:-1;;;180318:80:0;;;;;;;:::i;:::-;180444:16;180416:17;;;:8;:17;;;;;:24;;;;;;:44;;;;;;;:::i;:::-;;;180240:228;-1:-1:-1;;180240:228:0:o;178091:506::-;178157:16;178204:1;178194:7;:11;:40;;;;;178219:15;;178209:7;:25;178194:40;178186:80;;;;-1:-1:-1;;;178186:80:0;;;;;;;:::i;:::-;178277:20;178300:27;;;:18;:27;;;;;;;;;178358:25;;;:11;:25;;;;;;178300:27;;178358:25;-1:-1:-1;;;;;178432:24:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;178432:24:0;-1:-1:-1;178404:52:0;-1:-1:-1;178472:9:0;178467:97;178491:9;178487:1;:13;178467:97;;;178536:16;178551:1;178536:12;:16;:::i;:::-;178522:8;178531:1;178522:11;;;;;;;;:::i;:::-;;;;;;;;;;:30;178502:3;;178467:97;;;-1:-1:-1;178581:8:0;178091:506;-1:-1:-1;;;;178091:506:0:o;174298:380::-;73326:13;:11;:13::i;:::-;174383:1:::1;174373:7;:11;:40;;;;;174398:15;;174388:7;:25;174373:40;174365:69;;;;-1:-1:-1::0;;;174365:69:0::1;;;;;;;:::i;:::-;174445:23;174471:17:::0;;;:8:::1;:17;::::0;;;;;174507:12:::1;::::0;::::1;::::0;::::1;;::::0;:32;::::1;;;;;;:::i;:::-;;174499:62;;;::::0;-1:-1:-1;;;174499:62:0;;21983:2:1;174499:62:0::1;::::0;::::1;21965:21:1::0;22022:2;22002:18;;;21995:30;-1:-1:-1;;;22041:18:1;;;22034:47;22098:18;;174499:62:0::1;21781:341:1::0;174499:62:0::1;174582:12;::::0;::::1;:33:::0;;-1:-1:-1;;174582:33:0::1;174597:18;174582:33:::0;;::::1;::::0;;;174652:17;::::1;::::0;174631:39:::1;::::0;643:25:1;;;174643:7:0;;174631:39:::1;::::0;631:2:1;616:18;174631:39:0::1;;;;;;;174354:324;174298:380:::0;:::o;176006:291::-;73326:13;:11;:13::i;:::-;176101:1:::1;176090:8;:12;176082:65;;;::::0;-1:-1:-1;;;176082:65:0;;22329:2:1;176082:65:0::1;::::0;::::1;22311:21:1::0;22368:2;22348:18;;;22341:30;22407:34;22387:18;;;22380:62;-1:-1:-1;;;22458:18:1;;;22451:38;22506:19;;176082:65:0::1;22127:404:1::0;176082:65:0::1;176176:17;::::0;;176204:28;;;;176248:41:::1;::::0;;10228:25:1;;;10284:2;10269:18;;10262:34;;;176248:41:0::1;::::0;10201:18:1;176248:41:0::1;10054:248:1::0;158461:159:0;-1:-1:-1;;;;;158575:27:0;;;158551:4;158575:27;;;:18;:27;;;;;;;;:37;;;;;;;;;;;;;;;158461:159::o;158658:357::-;1314:10;-1:-1:-1;;;;;158826:14:0;;;;;;;:49;;;158845:30;158862:4;158868:6;158845:16;:30::i;:::-;158844:31;158826:49;158822:131;;;158899:42;;-1:-1:-1;;;158899:42:0;;-1:-1:-1;;;;;19647:32:1;;;158899:42:0;;;19629:51:1;19716:32;;19696:18;;;19689:60;19602:18;;158899:42:0;19455:300:1;158822:131:0;158963:44;158981:4;158987:2;158991;158995:5;159002:4;158963:17;:44::i;74373:220::-;73326:13;:11;:13::i;:::-;-1:-1:-1;;;;;74458:22:0;::::1;74454:93;;74504:31;::::0;-1:-1:-1;;;74504:31:0;;74532:1:::1;74504:31;::::0;::::1;6838:51:1::0;6811:18;;74504:31:0::1;6678:217:1::0;74454:93:0::1;74557:28;74576:8;74557:18;:28::i;171604:1026::-:0;171715:15;73326:13;:11;:13::i;:::-;171763:1:::1;171751:9;:13;171743:59;;;::::0;-1:-1:-1;;;171743:59:0;;22738:2:1;171743:59:0::1;::::0;::::1;22720:21:1::0;22777:2;22757:18;;;22750:30;22816:34;22796:18;;;22789:62;-1:-1:-1;;;22867:18:1;;;22860:31;22908:19;;171743:59:0::1;22536:397:1::0;171743:59:0::1;171842:1;171827:4;171821:18;:22;171813:54;;;::::0;-1:-1:-1;;;171813:54:0;;23140:2:1;171813:54:0::1;::::0;::::1;23122:21:1::0;23179:2;23159:18;;;23152:30;-1:-1:-1;;;23198:18:1;;;23191:49;23257:18;;171813:54:0::1;22938:343:1::0;171813:54:0::1;171902:1;171886:13;:17;171878:68;;;::::0;-1:-1:-1;;;171878:68:0;;23488:2:1;171878:68:0::1;::::0;::::1;23470:21:1::0;23527:2;23507:18;;;23500:30;23566:34;23546:18;;;23539:62;-1:-1:-1;;;23617:18:1;;;23610:36;23663:19;;171878:68:0::1;23286:402:1::0;171878:68:0::1;-1:-1:-1::0;171977:15:0::1;::::0;172026::::1;::::0;172082:274:::1;::::0;;::::1;::::0;::::1;::::0;;;;;-1:-1:-1;172082:274:0::1;::::0;;::::1;::::0;;;;;;;;;;;;;;;;;;;;;172286:15:::1;172082:274:::0;;;;;;;;;;172062:17;;;:8:::1;:17:::0;;;;;;;:294;;;;;;::::1;::::0;::::1;::::0;;;::::1;::::0;::::1;::::0;;;172082:274;;172062:17;:294:::1;::::0;::::1;::::0;::::1;::::0;;::::1;:::i;:::-;-1:-1:-1::0;172062:294:0::1;::::0;::::1;::::0;::::1;::::0;::::1;::::0;;-1:-1:-1;;172062:294:0::1;::::0;;;;::::1;;;;;;:::i;:::-;;;::::0;;-1:-1:-1;172062:294:0::1;::::0;::::1;::::0;::::1;::::0;;::::1;::::0;;;;::::1;::::0;;::::1;::::0;::::1;::::0;;::::1;::::0;-1:-1:-1;172377:27:0;;;:18:::1;:27;::::0;;;;:42;;;172430:28;;172449:9;;172062:294;-1:-1:-1;172430:28:0::1;::::0;172449:9;;172430:28:::1;:::i;:::-;::::0;;;-1:-1:-1;;172469:15:0::1;:17:::0;;;:15:::1;:17;::::0;::::1;:::i;:::-;;;;;;172534:12;172525:7;172512:67;172548:9;172559:4;172565:13;172512:67;;;;;;;;:::i;:::-;;;;;;;;171732:898;171604:1026:::0;;;;;:::o;174690:772::-;73326:13;:11;:13::i;:::-;174814:1:::1;174797:6;174791:20;:24;174783:56;;;::::0;-1:-1:-1;;;174783:56:0;;23140:2:1;174783:56:0::1;::::0;::::1;23122:21:1::0;23179:2;23159:18;;;23152:30;-1:-1:-1;;;23198:18:1;;;23191:49;23257:18;;174783:56:0::1;22938:343:1::0;174783:56:0::1;174868:1;174858:7;:11;:40;;;;;174883:15;;174873:7;:25;174858:40;174850:80;;;;-1:-1:-1::0;;;174850:80:0::1;;;;;;;:::i;:::-;174951:23;174977:17:::0;;;:8:::1;:17;::::0;;;;175038:9:::1;::::0;::::1;175015:32:::0;;174977:17;;174951:23;175015:32:::1;::::0;::::1;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;175070:6;175058:5;:9;;:18;;;;;;:::i;:::-;-1:-1:-1::0;175175:17:0::1;::::0;::::1;::::0;175154:18:::1;::::0;::::1;::::0;175097:21:::1;::::0;;;175154:38:::1;::::0;175175:17;175154:38:::1;:::i;:::-;175236:18;::::0;::::1;::::0;175133:59;;-1:-1:-1;175213:161:0::1;175266:10;175256:7;:20;175213:161;;;175304:19;::::0;;;:10:::1;:19;::::0;;;;:28:::1;175326:6:::0;175304:19;:28:::1;:::i;:::-;-1:-1:-1::0;175347:15:0;::::1;::::0;::::1;:::i;:::-;::::0;-1:-1:-1;;175278:9:0::1;;175213:161;;;;175415:7;175399:55;175424:6;175432;175440:13;175399:55;;;;;;;;:::i;:::-;;;;;;;;174772:690;;;;174690:772:::0;;:::o;182490:129::-;182547:4;182581:1;182571:7;:11;:40;;;;-1:-1:-1;;182596:15:0;;-1:-1:-1;182586:25:0;182490:129::o;10008:315::-;9306:1;10137:7;;:18;10133:88;;10179:30;;-1:-1:-1;;;10179:30:0;;;;;;;;;;;10133:88;9306:1;10298:7;:17;10008:315::o;166769:287::-;-1:-1:-1;;;;;166891:16:0;;166887:90;;166931:34;;-1:-1:-1;;;166931:34:0;;166962:1;166931:34;;;6838:51:1;6811:18;;166931:34:0;6678:217:1;166887:90:0;166987:61;167022:1;167026:2;167030:3;167035:6;167043:4;166987:26;:61::i;:::-;166769:287;;;;:::o;164191:459::-;-1:-1:-1;;;;;164391:16:0;;164387:90;;164431:34;;-1:-1:-1;;;164431:34:0;;164462:1;164431:34;;;6838:51:1;6811:18;;164431:34:0;6678:217:1;164387:90:0;-1:-1:-1;;;;;164491:18:0;;164487:90;;164533:32;;-1:-1:-1;;;164533:32:0;;164562:1;164533:32;;;6838:51:1;6811:18;;164533:32:0;6678:217:1;164487:90:0;164587:55;164614:4;164620:2;164624:3;164629:6;164637:4;164587:26;:55::i;:::-;164191:459;;;;;:::o;73605:166::-;73513:6;;-1:-1:-1;;;;;73513:6:0;1314:10;73665:23;73661:103;;73712:40;;-1:-1:-1;;;73712:40:0;;1314:10;73712:40;;;6838:51:1;6811:18;;73712:40:0;6678:217:1;74753:191:0;74846:6;;;-1:-1:-1;;;;;74863:17:0;;;-1:-1:-1;;;;;;74863:17:0;;;;;;;74896:40;;74846:6;;;74863:17;74846:6;;74896:40;;74827:16;;74896:40;74816:128;74753:191;:::o;168566:321::-;-1:-1:-1;;;;;168674:22:0;;168670:96;;168720:34;;-1:-1:-1;;;168720:34:0;;168751:1;168720:34;;;6838:51:1;6811:18;;168720:34:0;6678:217:1;168670:96:0;-1:-1:-1;;;;;168776:25:0;;;;;;;:18;:25;;;;;;;;:35;;;;;;;;;;;;;:46;;-1:-1:-1;;168776:46:0;;;;;;;;;;168838:41;;1205::1;;;168838::0;;1178:18:1;168838:41:0;;;;;;;168566:321;;;:::o;163305:472::-;-1:-1:-1;;;;;163428:16:0;;163424:90;;163468:34;;-1:-1:-1;;;163468:34:0;;163499:1;163468:34;;;6838:51:1;6811:18;;163468:34:0;6678:217:1;163424:90:0;-1:-1:-1;;;;;163528:18:0;;163524:90;;163570:32;;-1:-1:-1;;;163570:32:0;;163599:1;163570:32;;;6838:51:1;6811:18;;163570:32:0;6678:217:1;163524:90:0;169281:4;169275:11;;169353:1;169338:17;;;169486:4;169474:17;;169467:35;;;169606:17;;;169637;;;169119:23;169675:17;;169668:35;;;169814:17;;;169801:31;;;169275:11;163714:55;163741:4;163747:2;169275:11;169606:17;163764:4;163714:26;:55::i;:::-;163413:364;;163305:472;;;;;:::o;162116:718::-;162324:30;162332:4;162338:2;162342:3;162347:6;162324:7;:30::i;:::-;-1:-1:-1;;;;;162369:16:0;;;162365:462;;162452:10;;1314;;162466:1;162452:15;162448:368;;151779:4;151750:35;;;151744:42;151750:35;;;151744:42;162608:72;162644:8;162654:4;162660:2;151744:42;;162675:4;162608:35;:72::i;:::-;162469:227;;162448:368;;;162721:79;162762:8;162772:4;162778:2;162782:3;162787:6;162795:4;162721:40;:79::i;160211:1315::-;160347:6;:13;160333:3;:10;:27;160329:119;;160410:10;;160422:13;;160384:52;;-1:-1:-1;;;160384:52:0;;;;;10228:25:1;;;;10269:18;;;10262:34;10201:18;;160384:52:0;10054:248:1;160329:119:0;1314:10;160460:16;160504:709;160528:3;:10;160524:1;:14;160504:709;;;151779:4;151770:14;;;151750:35;;;;;151744:42;151750:35;;;;;;151744:42;-1:-1:-1;;;;;160678:18:0;;;160674:429;;160717:19;160739:13;;;;;;;;;;;-1:-1:-1;;;;;160739:19:0;;;;;;;;;;160781;;;160777:131;;;160832:56;;-1:-1:-1;;;160832:56:0;;-1:-1:-1;;;;;26072:32:1;;160832:56:0;;;26054:51:1;26121:18;;;26114:34;;;26164:18;;;26157:34;;;26207:18;;;26200:34;;;26026:19;;160832:56:0;25823:417:1;160777:131:0;161027:9;:13;;;;;;;;;;;-1:-1:-1;;;;;161027:19:0;;;;;;;;;161049;;;;161027:41;;160674:429;-1:-1:-1;;;;;161123:16:0;;;161119:83;;161160:9;:13;;;;;;;;;;;-1:-1:-1;;;;;161160:17:0;;;;;;;;;:26;;161181:5;;161160:9;:26;;161181:5;;161160:26;:::i;:::-;;;;-1:-1:-1;;161119:83:0;-1:-1:-1;;160540:3:0;;160504:709;;;;161229:3;:10;161243:1;161229:15;161225:294;;151779:4;151750:35;;151744:42;161261:10;;151779:4;151750:35;;151744:42;161261:38;;-1:-1:-1;161409:2:0;-1:-1:-1;;;;;161378:45:0;161403:4;-1:-1:-1;;;;;161378:45:0;161393:8;-1:-1:-1;;;;;161378:45:0;;161413:2;161417:5;161378:45;;;;;;10228:25:1;;;10284:2;10269:18;;10262:34;10216:2;10201:18;;10054:248;161378:45:0;;;;;;;;161246:189;;161225:294;;;161491:2;-1:-1:-1;;;;;161461:46:0;161485:4;-1:-1:-1;;;;;161461:46:0;161475:8;-1:-1:-1;;;;;161461:46:0;;161495:3;161500:6;161461:46;;;;;;;:::i;:::-;;;;;;;;160318:1208;160211:1315;;;;:::o;112016:986::-;-1:-1:-1;;;;;112223:14:0;;;:18;112219:776;;112262:71;;-1:-1:-1;;;112262:71:0;;-1:-1:-1;;;;;112262:38:0;;;;;:71;;112301:8;;112311:4;;112317:2;;112321:5;;112328:4;;112262:71;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;-1:-1:-1;112262:71:0;;;;;;;;-1:-1:-1;;112262:71:0;;;;;;;;;;;;:::i;:::-;;;112258:726;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;112638:6;:13;112655:1;112638:18;112634:335;;112745:41;;-1:-1:-1;;;112745:41:0;;-1:-1:-1;;;;;6856:32:1;;112745:41:0;;;6838:51:1;6811:18;;112745:41:0;6678:217:1;112634:335:0;112919:6;112913:13;112906:4;112898:6;112894:17;112887:40;112258:726;-1:-1:-1;;;;;;112383:55:0;;-1:-1:-1;;;112383:55:0;112379:192;;112510:41;;-1:-1:-1;;;112510:41:0;;-1:-1:-1;;;;;6856:32:1;;112510:41:0;;;6838:51:1;6811:18;;112510:41:0;6678:217:1;113568:1055:0;-1:-1:-1;;;;;113800:14:0;;;:18;113796:820;;113839:78;;-1:-1:-1;;;113839:78:0;;-1:-1:-1;;;;;113839:43:0;;;;;:78;;113883:8;;113893:4;;113899:3;;113904:6;;113912:4;;113839:78;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;-1:-1:-1;113839:78:0;;;;;;;;-1:-1:-1;;113839:78:0;;;;;;;;;;;;:::i;:::-;;;113835:770;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;113999:60:0;;-1:-1:-1;;;113999:60:0;113995:197;;114131:41;;-1:-1:-1;;;114131:41:0;;-1:-1:-1;;;;;6856:32:1;;114131:41:0;;;6838:51:1;6811:18;;114131:41:0;6678:217:1;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;:::o;14:173:1:-;82:20;;-1:-1:-1;;;;;131:31:1;;121:42;;111:70;;177:1;174;167:12;111:70;14:173;;;:::o;192:300::-;260:6;268;321:2;309:9;300:7;296:23;292:32;289:52;;;337:1;334;327:12;289:52;360:29;379:9;360:29;:::i;:::-;350:39;458:2;443:18;;;;430:32;;-1:-1:-1;;;192:300:1:o;679:131::-;-1:-1:-1;;;;;;753:32:1;;743:43;;733:71;;800:1;797;790:12;815:245;873:6;926:2;914:9;905:7;901:23;897:32;894:52;;;942:1;939;932:12;894:52;981:9;968:23;1000:30;1024:5;1000:30;:::i;1257:226::-;1316:6;1369:2;1357:9;1348:7;1344:23;1340:32;1337:52;;;1385:1;1382;1375:12;1337:52;-1:-1:-1;1430:23:1;;1257:226;-1:-1:-1;1257:226:1:o;1488:289::-;1530:3;1568:5;1562:12;1595:6;1590:3;1583:19;1651:6;1644:4;1637:5;1633:16;1626:4;1621:3;1617:14;1611:47;1703:1;1696:4;1687:6;1682:3;1678:16;1674:27;1667:38;1766:4;1759:2;1755:7;1750:2;1742:6;1738:15;1734:29;1729:3;1725:39;1721:50;1714:57;;;1488:289;;;;:::o;1782:220::-;1931:2;1920:9;1913:21;1894:4;1951:45;1992:2;1981:9;1977:18;1969:6;1951:45;:::i;2007:127::-;2068:10;2063:3;2059:20;2056:1;2049:31;2099:4;2096:1;2089:15;2123:4;2120:1;2113:15;2139:239;2222:1;2215:5;2212:12;2202:143;;2267:10;2262:3;2258:20;2255:1;2248:31;2302:4;2299:1;2292:15;2330:4;2327:1;2320:15;2202:143;2354:18;;2139:239::o;2383:801::-;2566:2;2555:9;2548:21;2611:6;2605:13;2600:2;2589:9;2585:18;2578:41;2673:2;2665:6;2661:15;2655:22;2650:2;2639:9;2635:18;2628:50;2732:2;2724:6;2720:15;2714:22;2709:2;2698:9;2694:18;2687:50;2529:4;2784:2;2776:6;2772:15;2766:22;2825:4;2819:3;2808:9;2804:19;2797:33;2853:52;2900:3;2889:9;2885:19;2871:12;2853:52;:::i;:::-;2839:66;;2954:3;2946:6;2942:16;2936:23;2968:64;3027:3;3016:9;3012:19;2996:14;2968:64;:::i;:::-;;3087:3;3079:6;3075:16;3069:23;3063:3;3052:9;3048:19;3041:52;3149:3;3141:6;3137:16;3131:23;3124:4;3113:9;3109:20;3102:53;3172:6;3164:14;;;2383:801;;;;:::o;3189:346::-;3257:6;3265;3318:2;3306:9;3297:7;3293:23;3289:32;3286:52;;;3334:1;3331;3324:12;3286:52;-1:-1:-1;;3379:23:1;;;3499:2;3484:18;;;3471:32;;-1:-1:-1;3189:346:1:o;3540:212::-;3688:2;3673:18;;3700:46;3677:9;3728:6;3700:46;:::i;3757:127::-;3818:10;3813:3;3809:20;3806:1;3799:31;3849:4;3846:1;3839:15;3873:4;3870:1;3863:15;3889:275;3960:2;3954:9;4025:2;4006:13;;-1:-1:-1;;4002:27:1;3990:40;;-1:-1:-1;;;;;4045:34:1;;4081:22;;;4042:62;4039:88;;;4107:18;;:::i;:::-;4143:2;4136:22;3889:275;;-1:-1:-1;3889:275:1:o;4169:183::-;4229:4;-1:-1:-1;;;;;4254:6:1;4251:30;4248:56;;;4284:18;;:::i;:::-;-1:-1:-1;4329:1:1;4325:14;4341:4;4321:25;;4169:183::o;4357:723::-;4411:5;4464:3;4457:4;4449:6;4445:17;4441:27;4431:55;;4482:1;4479;4472:12;4431:55;4522:6;4509:20;4549:64;4565:47;4605:6;4565:47;:::i;:::-;4549:64;:::i;:::-;4637:3;4661:6;4656:3;4649:19;4693:4;4688:3;4684:14;4677:21;;4754:4;4744:6;4741:1;4737:14;4729:6;4725:27;4721:38;4707:52;;4782:3;4774:6;4771:15;4768:35;;;4799:1;4796;4789:12;4768:35;4835:4;4827:6;4823:17;4849:200;4865:6;4860:3;4857:15;4849:200;;;4957:17;;4987:18;;5034:4;5025:14;;;;4882;4849:200;;;-1:-1:-1;5067:7:1;4357:723;-1:-1:-1;;;;;4357:723:1:o;5085:629::-;5127:5;5180:3;5173:4;5165:6;5161:17;5157:27;5147:55;;5198:1;5195;5188:12;5147:55;5238:6;5225:20;5277:4;5269:6;5265:17;5306:1;5328;-1:-1:-1;;;;;5344:6:1;5341:30;5338:56;;;5374:18;;:::i;:::-;-1:-1:-1;5440:2:1;5419:15;;-1:-1:-1;;5415:29:1;5446:4;5411:40;5471:21;5411:40;5471:21;:::i;:::-;5460:32;;;5517:6;5508:7;5501:23;5557:3;5548:6;5543:3;5539:16;5536:25;5533:45;;;5574:1;5571;5564:12;5533:45;5625:6;5620:3;5613:4;5604:7;5600:18;5587:45;5681:1;5652:20;;;5674:4;5648:31;5641:42;;;;-1:-1:-1;5656:7:1;5085:629;-1:-1:-1;;;5085:629:1:o;5719:954::-;5873:6;5881;5889;5897;5905;5958:3;5946:9;5937:7;5933:23;5929:33;5926:53;;;5975:1;5972;5965:12;5926:53;5998:29;6017:9;5998:29;:::i;:::-;5988:39;;6046:38;6080:2;6069:9;6065:18;6046:38;:::i;:::-;6036:48;;6135:2;6124:9;6120:18;6107:32;-1:-1:-1;;;;;6154:6:1;6151:30;6148:50;;;6194:1;6191;6184:12;6148:50;6217:61;6270:7;6261:6;6250:9;6246:22;6217:61;:::i;:::-;6207:71;;;6331:2;6320:9;6316:18;6303:32;-1:-1:-1;;;;;6350:8:1;6347:32;6344:52;;;6392:1;6389;6382:12;6344:52;6415:63;6470:7;6459:8;6448:9;6444:24;6415:63;:::i;:::-;6405:73;;;6531:3;6520:9;6516:19;6503:33;-1:-1:-1;;;;;6551:8:1;6548:32;6545:52;;;6593:1;6590;6583:12;6545:52;6616:51;6659:7;6648:8;6637:9;6633:24;6616:51;:::i;:::-;6606:61;;;5719:954;;;;;;;;:::o;6900:420::-;6953:3;6991:5;6985:12;7018:6;7013:3;7006:19;7050:4;7045:3;7041:14;7034:21;;7089:4;7082:5;7078:16;7112:1;7122:173;7136:6;7133:1;7130:13;7122:173;;;7197:13;;7185:26;;7240:4;7231:14;;;;7268:17;;;;7158:1;7151:9;7122:173;;;-1:-1:-1;7311:3:1;;6900:420;-1:-1:-1;;;;6900:420:1:o;7325:465::-;7582:2;7571:9;7564:21;7545:4;7608:56;7660:2;7649:9;7645:18;7637:6;7608:56;:::i;:::-;7712:9;7704:6;7700:22;7695:2;7684:9;7680:18;7673:50;7740:44;7777:6;7769;7740:44;:::i;:::-;7732:52;7325:465;-1:-1:-1;;;;;7325:465:1:o;7795:1146::-;7913:6;7921;7974:2;7962:9;7953:7;7949:23;7945:32;7942:52;;;7990:1;7987;7980:12;7942:52;8030:9;8017:23;-1:-1:-1;;;;;8055:6:1;8052:30;8049:50;;;8095:1;8092;8085:12;8049:50;8118:22;;8171:4;8163:13;;8159:27;-1:-1:-1;8149:55:1;;8200:1;8197;8190:12;8149:55;8240:2;8227:16;8263:64;8279:47;8319:6;8279:47;:::i;8263:64::-;8349:3;8373:6;8368:3;8361:19;8405:4;8400:3;8396:14;8389:21;;8462:4;8452:6;8449:1;8445:14;8441:2;8437:23;8433:34;8419:48;;8490:7;8482:6;8479:19;8476:39;;;8511:1;8508;8501:12;8476:39;8543:4;8539:2;8535:13;8524:24;;8557:152;8573:6;8568:3;8565:15;8557:152;;;8641:23;8660:3;8641:23;:::i;:::-;8629:36;;8694:4;8590:14;;;;8685;;;;8557:152;;;8728:5;-1:-1:-1;;;;8786:4:1;8771:20;;8758:34;-1:-1:-1;;;;;8804:32:1;;8801:52;;;8849:1;8846;8839:12;8801:52;8872:63;8927:7;8916:8;8905:9;8901:24;8872:63;:::i;:::-;8862:73;;;7795:1146;;;;;:::o;8946:261::-;9125:2;9114:9;9107:21;9088:4;9145:56;9197:2;9186:9;9182:18;9174:6;9145:56;:::i;9212:186::-;9271:6;9324:2;9312:9;9303:7;9299:23;9295:32;9292:52;;;9340:1;9337;9330:12;9292:52;9363:29;9382:9;9363:29;:::i;9611:118::-;9697:5;9690:13;9683:21;9676:5;9673:32;9663:60;;9719:1;9716;9709:12;9734:315;9799:6;9807;9860:2;9848:9;9839:7;9835:23;9831:32;9828:52;;;9876:1;9873;9866:12;9828:52;9899:29;9918:9;9899:29;:::i;:::-;9889:39;;9978:2;9967:9;9963:18;9950:32;9991:28;10013:5;9991:28;:::i;:::-;10038:5;10028:15;;;9734:315;;;;;:::o;10307:260::-;10375:6;10383;10436:2;10424:9;10415:7;10411:23;10407:32;10404:52;;;10452:1;10449;10442:12;10404:52;10475:29;10494:9;10475:29;:::i;:::-;10465:39;;10523:38;10557:2;10546:9;10542:18;10523:38;:::i;:::-;10513:48;;10307:260;;;;;:::o;10572:704::-;10676:6;10684;10692;10700;10708;10761:3;10749:9;10740:7;10736:23;10732:33;10729:53;;;10778:1;10775;10768:12;10729:53;10801:29;10820:9;10801:29;:::i;:::-;10791:39;;10849:38;10883:2;10872:9;10868:18;10849:38;:::i;:::-;10839:48;-1:-1:-1;10956:2:1;10941:18;;10928:32;;-1:-1:-1;11057:2:1;11042:18;;11029:32;;-1:-1:-1;11138:3:1;11123:19;;11110:33;-1:-1:-1;;;;;11155:30:1;;11152:50;;;11198:1;11195;11188:12;11281:555;11368:6;11376;11384;11437:2;11425:9;11416:7;11412:23;11408:32;11405:52;;;11453:1;11450;11443:12;11405:52;11498:23;;;-1:-1:-1;11596:2:1;11581:18;;11568:32;-1:-1:-1;;;;;11612:30:1;;11609:50;;;11655:1;11652;11645:12;11609:50;11678:49;11719:7;11710:6;11699:9;11695:22;11678:49;:::i;:::-;11281:555;;11668:59;;-1:-1:-1;;;;11800:2:1;11785:18;;;;11772:32;;11281:555::o;11841:435::-;11919:6;11927;11980:2;11968:9;11959:7;11955:23;11951:32;11948:52;;;11996:1;11993;11986:12;11948:52;12041:23;;;-1:-1:-1;12139:2:1;12124:18;;12111:32;-1:-1:-1;;;;;12155:30:1;;12152:50;;;12198:1;12195;12188:12;12152:50;12221:49;12262:7;12253:6;12242:9;12238:22;12221:49;:::i;12997:380::-;13076:1;13072:12;;;;13119;;;13140:61;;13194:4;13186:6;13182:17;13172:27;;13140:61;13247:2;13239:6;13236:14;13216:18;13213:38;13210:161;;13293:10;13288:3;13284:20;13281:1;13274:31;13328:4;13325:1;13318:15;13356:4;13353:1;13346:15;13210:161;;12997:380;;;:::o;13382:127::-;13443:10;13438:3;13434:20;13431:1;13424:31;13474:4;13471:1;13464:15;13498:4;13495:1;13488:15;13514:128;13581:9;;;13602:11;;;13599:37;;;13616:18;;:::i;13647:351::-;13849:2;13831:21;;;13888:2;13868:18;;;13861:30;13927:29;13922:2;13907:18;;13900:57;13989:2;13974:18;;13647:351::o;14003:340::-;14205:2;14187:21;;;14244:2;14224:18;;;14217:30;-1:-1:-1;;;14278:2:1;14263:18;;14256:46;14334:2;14319:18;;14003:340::o;15469:125::-;15534:9;;;15555:10;;;15552:36;;;15568:18;;:::i;15959:168::-;16032:9;;;16063;;16080:15;;;16074:22;;16060:37;16050:71;;16101:18;;:::i;16508:245::-;16575:6;16628:2;16616:9;16607:7;16603:23;16599:32;16596:52;;;16644:1;16641;16634:12;16596:52;16676:9;16670:16;16695:28;16717:5;16695:28;:::i;17101:127::-;17162:10;17157:3;17153:20;17150:1;17143:31;17193:4;17190:1;17183:15;17217:4;17214:1;17207:15;17359:518;17461:2;17456:3;17453:11;17450:421;;;17497:5;17494:1;17487:16;17541:4;17538:1;17528:18;17611:2;17599:10;17595:19;17592:1;17588:27;17582:4;17578:38;17647:4;17635:10;17632:20;17629:47;;;-1:-1:-1;17670:4:1;17629:47;17725:2;17720:3;17716:12;17713:1;17709:20;17703:4;17699:31;17689:41;;17780:81;17798:2;17791:5;17788:13;17780:81;;;17857:1;17843:16;;17824:1;17813:13;17780:81;;17450:421;17359:518;;;:::o;18053:1397::-;18172:3;18166:4;18163:13;18160:26;;18179:5;;18053:1397::o;18160:26::-;18209:37;18241:3;18235:10;18209:37;:::i;:::-;-1:-1:-1;;;;;18261:6:1;18258:30;18255:56;;;18291:18;;:::i;:::-;18320:97;18410:6;18370:38;18402:4;18396:11;18370:38;:::i;:::-;18364:4;18320:97;:::i;:::-;18443:1;18471:2;18463:6;18460:14;18488:1;18483:710;;;;19237:1;19254:6;19251:89;;;-1:-1:-1;19306:19:1;;;19300:26;19251:89;18034:1;18030:11;;;-1:-1:-1;;18010:1:1;18006:11;;;18002:24;17998:29;17988:40;;17985:57;19366:67;19360:4;19353:81;;18453:991;;18483:710;17306:1;17299:14;;;17343:4;17330:18;;;17299:14;;;17330:18;;;-1:-1:-1;;18519:20:1;;;18697:221;18711:7;18708:1;18705:14;18697:221;;;18793:21;;;18787:28;18772:44;;18855:1;18887:17;;;;18843:14;;;;18734:4;18727:12;18697:221;;;18701:3;18946:6;18937:7;18934:19;18931:203;;;19007:21;;;19001:28;-1:-1:-1;;19092:1:1;19088:14;;;19104:3;19084:24;19080:37;19076:42;19061:58;19046:74;;18931:203;-1:-1:-1;;;;;19180:1:1;19164:14;;;19160:22;19147:36;;-1:-1:-1;18053:1397:1:o;19760:135::-;19799:3;19820:17;;;19817:43;;19840:18;;:::i;:::-;-1:-1:-1;19887:1:1;19876:13;;19760:135::o;19900:184::-;19970:6;20023:2;20011:9;20002:7;19998:23;19994:32;19991:52;;;20039:1;20036;20029:12;19991:52;-1:-1:-1;20062:16:1;;19900:184;-1:-1:-1;19900:184:1:o;23693:1299::-;23819:3;23813:10;-1:-1:-1;;;;;23838:6:1;23835:30;23832:56;;;23868:18;;:::i;:::-;23897:97;23987:6;23947:38;23979:4;23973:11;23947:38;:::i;23897:97::-;24043:4;24074:2;24063:14;;24091:1;24086:649;;;;24779:1;24796:6;24793:89;;;-1:-1:-1;24848:19:1;;;24842:26;18034:1;18030:11;;;-1:-1:-1;;18010:1:1;18006:11;;;18002:24;17998:29;17988:40;;17985:57;24908:67;17882:166;24086:649;17306:1;17299:14;;;17343:4;17330:18;;-1:-1:-1;;24122:20:1;;;24240:222;24254:7;24251:1;24248:14;24240:222;;;24336:19;;;24330:26;24315:42;;24443:4;24428:20;;;;24396:1;24384:14;;;;24270:12;24240:222;;;24244:3;24490:6;24481:7;24478:19;24475:201;;;24551:19;;;24545:26;-1:-1:-1;;24634:1:1;24630:14;;;24646:3;24626:24;24622:37;24618:42;24603:58;24588:74;;24475:201;-1:-1:-1;;;;24722:1:1;24706:14;;;24702:22;24689:36;;-1:-1:-1;23693:1299:1:o;24997:362::-;25202:6;25191:9;25184:25;25245:2;25240;25229:9;25225:18;25218:30;25165:4;25265:45;25306:2;25295:9;25291:18;25283:6;25265:45;:::i;:::-;25257:53;;25346:6;25341:2;25330:9;25326:18;25319:34;24997:362;;;;;;:::o;25364:454::-;25589:2;25578:9;25571:21;25552:4;25615:45;25656:2;25645:9;25641:18;25633:6;25615:45;:::i;:::-;25708:9;25700:6;25696:22;25691:2;25680:9;25676:18;25669:50;25736:33;25762:6;25754;25736:33;:::i;:::-;25728:41;;;25805:6;25800:2;25789:9;25785:18;25778:34;25364:454;;;;;;:::o;26245:557::-;-1:-1:-1;;;;;26504:32:1;;;26486:51;;26573:32;;26568:2;26553:18;;26546:60;26637:2;26622:18;;26615:34;;;26680:2;26665:18;;26658:34;;;26524:3;26723;26708:19;;26701:32;;;-1:-1:-1;;26750:46:1;;26776:19;;26768:6;26750:46;:::i;:::-;26742:54;26245:557;-1:-1:-1;;;;;;;26245:557:1:o;26807:249::-;26876:6;26929:2;26917:9;26908:7;26904:23;26900:32;26897:52;;;26945:1;26942;26935:12;26897:52;26977:9;26971:16;26996:30;27020:5;26996:30;:::i;27061:823::-;-1:-1:-1;;;;;27420:32:1;;;27402:51;;27489:32;;27484:2;27469:18;;27462:60;27440:3;27553:2;27538:18;;27531:31;;;-1:-1:-1;;27585:57:1;;27622:19;;27614:6;27585:57;:::i;:::-;27690:9;27682:6;27678:22;27673:2;27662:9;27658:18;27651:50;27724:44;27761:6;27753;27724:44;:::i;:::-;27710:58;;27817:9;27809:6;27805:22;27799:3;27788:9;27784:19;27777:51;27845:33;27871:6;27863;27845:33;:::i;:::-;27837:41;27061:823;-1:-1:-1;;;;;;;;27061:823:1:o
Swarm Source
ipfs://873fca9eca08a4884283d9718b88460a38d721989c8202a0c88629fa0c19ce36
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.