Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
GaslessMechanic
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 1 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import "./MechanicMintManagerClientUpgradeable.sol";
import "../../erc721/interfaces/IEditionCollection.sol";
import "../../erc721/interfaces/IERC721GeneralSupplyMetadata.sol";
import "../../observability/IGengineObservability.sol";
import "./interfaces/IManifold1155Burn.sol";
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
/**
* @notice Gasless mechanic
* @author highlight.xyz
*/
contract GaslessMechanic is MechanicMintManagerClientUpgradeable, UUPSUpgradeable {
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableSet for EnumerableSet.Bytes32Set;
/**
* @notice Throw when an action is unauthorized
*/
error Unauthorized();
/**
* @notice Throw when signer of signature is invalid
*/
error InvalidSigner();
/**
* @notice Throw when it is invalid to mint on a vector
*/
error InvalidMint();
/**
* @notice Throw when it is invalid to mint a number of tokens
*/
error InvalidMintAmount();
/**
* @notice Throw when it is invalid to sponsor
*/
error InvalidSponsor();
/**
* @notice Throw when a vector is already created with a mechanic vector ID
*/
error VectorAlreadyCreated();
/**
* @notice Throw when the vector update is invalid
*/
error InvalidUpdate();
/**
* @notice Throw when code gets into impossible state
*/
error ImpossibleState();
/**
* @notice Throw when an internal transfer of ether fails
*/
error EtherSendFailed();
/**
* @notice Throw when a claim is invalid
*/
error InvalidClaim();
/**
* @notice Throw when the sponsor amount is invalid
*/
error InvalidSponsorAmount();
/**
* @notice Errors to throw when adding / removing bids from user bid ids
*/
error BidAlreadyAdded();
error BidAlreadyReclaimed();
/**
* @notice Throw when currency isn't supported
*/
error CurrencyNotSupported();
/**
* @notice Throw when signature is invalid
*/
error InvalidSignature();
/**
* @notice Gasless vector
*/
struct Vector {
uint64 maxClaimablePerUser;
uint64 maxClaimableViaVector;
uint64 numMinted;
uint64 numSponsored;
}
/**
* @notice Config used to control updating of fields in Vector
*/
struct VectorUpdateConfig {
bool updateMaxUserClaimableViaVector;
bool updateMaxTotalClaimableViaVector;
}
/**
* @notice Sponsor structure
* @param mechanicVectorId Mechanic vector ID
* @param pricePerToken Price per token
* @param mintFeePerToken Mint fee per token
* @param gasPerToken Gas to deliver token
* @param currency Currency
* @param vectorPaymentRecipient Vector payment recipient
* @param claimExpiryTimestamp Claim expiry timestamp
*/
struct GaslessSponsorConfig {
bytes32 mechanicVectorId;
uint256 pricePerToken;
uint256 mintFeePerToken;
uint256 gasPerToken;
address currency;
address vectorPaymentRecipient;
uint48 claimExpiryTimestamp;
uint48 chainId;
}
/**
* @notice Constants that help with EIP-712, signature based minting
*/
bytes32 private constant _DOMAIN_TYPEHASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)");
/* solhint-disable max-line-length */
bytes32 private constant _GASLESS_SPONSOR_CONFIG_TYPESHASH =
keccak256(
"GaslessSponsorConfig(bytes32 mechanicVectorId,uint256 pricePerToken,uint256 mintFeePerToken,uint256 gasPerToken,address currency,address vectorPaymentRecipient,uint48 claimExpiryTimestamp,uint48 chainId)"
);
/* solhint-enable max-line-length */
/**
* @notice Stores gasless vector, indexed by global mechanic vector id
*/
mapping(bytes32 => Vector) private vector;
/**
* @notice Stores user claims per vector
*/
mapping(bytes32 => mapping(address => uint64)) private _numUserClaimed;
/**
* @notice Emitted when a mint vector is created
*/
event GaslessVectorCreated(bytes32 indexed mechanicVectorId);
/**
* @notice Emitted when a mint vector is updated
*/
event GaslessVectorUpdated(bytes32 indexed mechanicVectorId);
/**
* @notice Emitted when mints are sponsored
*/
event GaslessSponsor(
bytes32 indexed mechanicVectorId,
address indexed sponsor,
uint64 numSponsored,
uint256 pricePerToken,
uint256 mintFeePerToken,
uint256 gasPerToken,
address currency,
address paymentRecipient
);
/**
* @notice Emitted when sponsored mints are redeemed
*/
event SponsoredMint(
bytes32 indexed mechanicVectorId,
address indexed mintRecipient,
uint64 indexed initialSponsorId,
address feeCollector,
address currency,
uint256 fee,
uint32 numMinted
);
/**
* @notice Initialize mechanic contract
* @param _mintManager Mint manager address
* @param platform Platform owning the contract
*/
function initialize(address _mintManager, address platform) external initializer {
__MechanicMintManagerClientUpgradeable_initialize(_mintManager, platform);
}
/**
* @notice Create a gasless mechanic vector
* @param mechanicVectorId Global mechanic vector ID
* @param vectorData Vector data, to be deserialized into gasless vector data
*/
function createVector(bytes32 mechanicVectorId, bytes memory vectorData) external onlyMintManager {
(uint64 maxClaimablePerUser, uint64 maxClaimableViaVector) = abi.decode(vectorData, (uint64, uint64));
Vector memory _vector = Vector(maxClaimablePerUser, maxClaimableViaVector, 0, 0);
vector[mechanicVectorId] = _vector;
emit GaslessVectorCreated(mechanicVectorId);
}
/* solhint-disable code-complexity */
/**
* @notice Update a seed based vector
* @param mechanicVectorId Global mechanic vector ID
* @param newVector New vector fields
* @param updateConfig Config denoting what fields on vector to update
*/
function updateVector(
bytes32 mechanicVectorId,
Vector calldata newVector,
VectorUpdateConfig calldata updateConfig
) external {
MechanicVectorMetadata memory metadata = _getMechanicVectorMetadata(mechanicVectorId);
if (
OwnableUpgradeable(metadata.contractAddress).owner() != msg.sender && metadata.contractAddress != msg.sender
) {
_revert(Unauthorized.selector);
}
// rather than updating entire vector, update per-field
if (updateConfig.updateMaxUserClaimableViaVector) {
vector[mechanicVectorId].maxClaimablePerUser = newVector.maxClaimablePerUser;
}
if (updateConfig.updateMaxTotalClaimableViaVector) {
vector[mechanicVectorId].maxClaimableViaVector = newVector.maxClaimableViaVector;
}
emit GaslessVectorUpdated(mechanicVectorId);
}
/**
* @notice Sponsor mints
*/
function sponsorMints(
GaslessSponsorConfig calldata sponsorConfig,
bytes calldata signature,
uint64 numToSponsor
) external payable {
_validateSponsorConfig(sponsorConfig, signature);
if (numToSponsor == 0) {
_revert(InvalidSponsor.selector);
}
Vector memory _vector = vector[sponsorConfig.mechanicVectorId];
uint64 newNumSponsored = _vector.numSponsored + numToSponsor;
if (newNumSponsored > _vector.maxClaimableViaVector && _vector.maxClaimableViaVector != 0) {
_revert(InvalidSponsor.selector);
}
vector[sponsorConfig.mechanicVectorId].numSponsored = newNumSponsored;
if (sponsorConfig.currency != address(0)) {
_revert(InvalidSponsor.selector);
}
// validate ether amount, send mint fee to HL, send price to paymentRecipient
uint256 amountToRecipient = sponsorConfig.pricePerToken * numToSponsor;
uint256 amountToPlatform = sponsorConfig.mintFeePerToken * numToSponsor;
if (amountToRecipient == 0) {
amountToRecipient = amountToPlatform / 2;
amountToPlatform = amountToPlatform - amountToRecipient;
}
if (amountToRecipient + amountToPlatform + (sponsorConfig.gasPerToken * numToSponsor) > msg.value) {
_revert(InvalidSponsorAmount.selector);
}
if (amountToRecipient > 0) {
_sendEther(amountToRecipient, payable(sponsorConfig.vectorPaymentRecipient));
}
if (amountToPlatform > 0) {
_sendEther(amountToPlatform, payable(owner()));
}
emit GaslessSponsor(
sponsorConfig.mechanicVectorId,
msg.sender,
numToSponsor,
sponsorConfig.pricePerToken,
sponsorConfig.mintFeePerToken,
sponsorConfig.gasPerToken,
sponsorConfig.currency,
sponsorConfig.vectorPaymentRecipient
);
}
/**
* @notice See {IMechanic-processNumMint}
*/
function processNumMint(
bytes32 mechanicVectorId,
address recipient,
uint32 numToMint,
address minter,
MechanicVectorMetadata calldata mechanicVectorMetadata,
bytes calldata data
) external payable onlyMintManager {
_processMint(mechanicVectorId, minter, recipient, numToMint, data);
}
/**
* @notice See {IMechanic-processChooseMint}
*/
function processChooseMint(
bytes32 mechanicVectorId,
address recipient,
uint256[] calldata tokenIds,
address minter,
MechanicVectorMetadata calldata mechanicVectorMetadata,
bytes calldata data
) external payable onlyMintManager {
_processMint(mechanicVectorId, minter, recipient, uint32(tokenIds.length), data);
}
/* solhint-disable no-empty-blocks */
receive() external payable {}
fallback() external payable {}
/**
* @notice State readers
*/
function getRawVector(bytes32 mechanicVectorId) external view returns (Vector memory _vector) {
_vector = vector[mechanicVectorId];
}
function getVectorState(
bytes32 mechanicVectorId
) external view returns (Vector memory _vector, uint256 collectionSupply, uint256 collectionSize) {
_vector = vector[mechanicVectorId];
(collectionSupply, collectionSize) = _collectionSupplyAndSize(mechanicVectorId);
}
function getUserClaimed(bytes32 mechanicVectorId, address user) external view returns (uint64) {
return _numUserClaimed[mechanicVectorId][user];
}
/* solhint-disable no-empty-blocks */
/**
* @notice Limit upgrades of contract to SeedBasedMintMechanic owner
* @param // New implementation address
*/
function _authorizeUpgrade(address) internal override onlyOwner {}
/**
* @notice Process sequential mint logic
* @param mechanicVectorId Mechanic vector ID
* @param minter Minter
* @param recipient Mint recipient
* @param numToMint Number of tokens to mint
* @param data Mechanic mint data (signature)
*/
function _processMint(
bytes32 mechanicVectorId,
address minter,
address recipient,
uint32 numToMint,
bytes calldata data
) private {
(uint256 fee, address feeCollector) = abi.decode(data, (uint256, address));
Vector memory _vector = vector[mechanicVectorId];
uint64 newNumMinted = _vector.numMinted + numToMint;
if (newNumMinted > _vector.numSponsored) {
_revert(InvalidMintAmount.selector);
}
vector[mechanicVectorId].numMinted = newNumMinted;
uint64 newNumUserClaimed = _numUserClaimed[mechanicVectorId][recipient] + numToMint;
if (newNumUserClaimed > _vector.maxClaimablePerUser && _vector.maxClaimablePerUser != 0) {
_revert(InvalidMintAmount.selector);
}
_numUserClaimed[mechanicVectorId][recipient] = newNumUserClaimed;
_sendEther(fee, payable(feeCollector));
emit SponsoredMint(
mechanicVectorId,
recipient,
_vector.numMinted + 1,
feeCollector,
address(0),
fee,
numToMint
);
}
/**
* @notice Send ether to a recipient
*/
function _sendEther(uint256 amount, address payable recipient) private {
(bool sent, ) = recipient.call{ value: amount }("");
if (!sent) {
_revert(EtherSendFailed.selector);
}
}
/**
* @notice Validate sponsor event signature
* @param sponsorConfig GaslessSponsorConfig
* @param signature Sponsor config signature
*/
function _validateSponsorConfig(GaslessSponsorConfig memory sponsorConfig, bytes calldata signature) private {
bytes32 claimId = keccak256(
abi.encode(
_GASLESS_SPONSOR_CONFIG_TYPESHASH,
sponsorConfig.mechanicVectorId,
sponsorConfig.pricePerToken,
sponsorConfig.mintFeePerToken,
sponsorConfig.gasPerToken,
sponsorConfig.currency,
sponsorConfig.vectorPaymentRecipient,
sponsorConfig.claimExpiryTimestamp,
sponsorConfig.chainId
)
);
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", _getDomainSeperator(), claimId));
address signer = ECDSA.recover(digest, signature);
if (
signer == address(0) ||
!_isPlatformExecutor(signer) ||
uint48(block.timestamp) > sponsorConfig.claimExpiryTimestamp
) {
_revert(InvalidSignature.selector);
}
if (block.chainid != sponsorConfig.chainId) {
_revert(InvalidClaim.selector);
}
}
/**
* @notice Returns a collection's current supply
* @param mechanicVectorId Mechanic vector ID
*/
function _collectionSupplyAndSize(bytes32 mechanicVectorId) private view returns (uint256 supply, uint256 size) {
MechanicVectorMetadata memory metadata = _getMechanicVectorMetadata(mechanicVectorId);
if (metadata.contractAddress == address(0)) {
revert("Vector doesn't exist");
}
if (metadata.isEditionBased) {
IEditionCollection.EditionDetails memory edition = IEditionCollection(metadata.contractAddress)
.getEditionDetails(metadata.editionId);
supply = edition.supply;
size = edition.size;
} else {
// supply holds a tighter constraint (no burns), some old contracts don't have it
try IERC721GeneralSupplyMetadata(metadata.contractAddress).supply() returns (uint256 _supply) {
supply = _supply;
} catch {
supply = IERC721GeneralSupplyMetadata(metadata.contractAddress).totalSupply();
}
size = IERC721GeneralSupplyMetadata(metadata.contractAddress).limitSupply();
}
}
/**
* @notice Return EIP712 domain seperator
*/
function _getDomainSeperator() private view returns (bytes32) {
return
keccak256(
abi.encode(
_DOMAIN_TYPEHASH,
keccak256("GaslessMechanic"),
keccak256("1"),
block.chainid,
address(this),
0x954386A2b103A8AD2B933E44Ea148036f73DC4B906c0fea200392fd413d44da0 // gasless mechanic salt
)
);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. 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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822Proxiable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
*
* _Available since v4.8.3._
*/
interface IERC1967 {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
import "../beacon/IBeacon.sol";
import "../../interfaces/IERC1967.sol";
import "../../interfaces/draft-IERC1822.sol";
import "../../utils/Address.sol";
import "../../utils/StorageSlot.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*
* _Available since v4.1._
*/
abstract contract ERC1967Upgrade is IERC1967 {
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Perform implementation upgrade
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Perform implementation upgrade with additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
_upgradeTo(newImplementation);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(newImplementation, data);
}
}
/**
* @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
// Upgrades from old implementations will perform a rollback test. This test requires the new
// implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
// this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
} catch {
revert("ERC1967Upgrade: new implementation is not UUPS");
}
_upgradeToAndCall(newImplementation, data, forceCall);
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
*/
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Returns the current beacon.
*/
function _getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
Address.isContract(IBeacon(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
}
/**
* @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
* not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.0;
import "../../interfaces/draft-IERC1822.sol";
import "../ERC1967/ERC1967Upgrade.sol";
/**
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
*
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*
* _Available since v4.1._
*/
abstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
address private immutable __self = address(this);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
/**
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
* callable on the implementing contract but not through proxies.
*/
modifier notDelegated() {
require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
_;
}
/**
* @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
*/
function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
return _IMPLEMENTATION_SLOT;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeTo(address newImplementation) public virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded in `data`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data, true);
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeTo} and {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal override onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, "\x19\x01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
data := keccak256(ptr, 0x42)
}
}
/**
* @dev Returns an Ethereum Signed Data with intended validator, created from a
* `validator` and `data` according to the version 0 of EIP-191.
*
* See {recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x00", validator, data));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// 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 prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return 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 {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
* _Available since v4.9 for `string`, `bytes`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 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) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
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) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
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) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(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) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
/**
* @notice Interfaces with the details of editions on collections
* @author highlight.xyz
*/
interface IEditionCollection {
/**
* @notice Edition details
* @param name Edition name
* @param size Edition size
* @param supply Total number of tokens minted on edition
* @param initialTokenId Token id of first token minted in edition
*/
struct EditionDetails {
string name;
uint256 size;
uint256 supply;
uint256 initialTokenId;
}
/**
* @notice Get the edition a token belongs to
* @param tokenId The token id of the token
*/
function getEditionId(uint256 tokenId) external view returns (uint256);
/**
* @notice Get an edition's details
* @param editionId Edition id
*/
function getEditionDetails(uint256 editionId) external view returns (EditionDetails memory);
/**
* @notice Get the details and uris of a number of editions
* @param editionIds List of editions to get info for
*/
function getEditionsDetailsAndUri(
uint256[] calldata editionIds
) external view returns (EditionDetails[] memory, string[] memory uris);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
/**
* @notice Get a Series based collection's supply metadata
* @author highlight.xyz
*/
interface IERC721GeneralSupplyMetadata {
/**
* @notice Get a series based collection's supply, burned tokens notwithstanding
*/
function supply() external view returns (uint256);
/**
* @notice Get a series based collection's total supply
*/
function totalSupply() external view returns (uint256);
/**
* @notice Get a series based collection's supply cap
*/
function limitSupply() external view returns (uint256);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
/**
* @notice Interface to burn tokens on a Manifold 1155 Creator contract
*/
interface IManifold1155Burn {
function burn(address account, uint256[] memory tokenIds, uint256[] memory amounts) external;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import "./IMechanicData.sol";
/**
* @notice Interface that mint mechanics are forced to adhere to,
* provided they support both collector's choice and sequential minting
*/
interface IMechanic is IMechanicData {
/**
* @notice Create a mechanic vector on the mechanic
* @param mechanicVectorId Global mechanic vector ID
* @param vectorData Mechanic vector data
*/
function createVector(bytes32 mechanicVectorId, bytes calldata vectorData) external;
/**
* @notice Process a sequential mint
* @param mechanicVectorId Global ID identifying mint vector, using this mechanic
* @param recipient Mint recipient
* @param numToMint Number of tokens to mint
* @param minter Account that called mint on the MintManager
* @param mechanicVectorMetadata Mechanic vector metadata
* @param data Custom data that can be deserialized and processed according to implementation
*/
function processNumMint(
bytes32 mechanicVectorId,
address recipient,
uint32 numToMint,
address minter,
MechanicVectorMetadata calldata mechanicVectorMetadata,
bytes calldata data
) external payable;
/**
* @notice Process a collector's choice mint
* @param mechanicVectorId Global ID identifying mint vector, using this mechanic
* @param recipient Mint recipient
* @param tokenIds IDs of tokens to mint
* @param minter Account that called mint on the MintManager
* @param mechanicVectorMetadata Mechanic vector metadata
* @param data Custom data that can be deserialized and processed according to implementation
*/
function processChooseMint(
bytes32 mechanicVectorId,
address recipient,
uint256[] calldata tokenIds,
address minter,
MechanicVectorMetadata calldata mechanicVectorMetadata,
bytes calldata data
) external payable;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
/**
* @notice Defines a mechanic's metadata on the MintManager
*/
interface IMechanicData {
/**
* @notice A mechanic's metadata
* @param contractAddress Collection contract address
* @param editionId Edition ID if the collection is edition based
* @param mechanic Address of mint mechanic contract
* @param isEditionBased True if collection is edition based
* @param isChoose True if collection uses a collector's choice mint paradigm
* @param paused True if mechanic vector is paused
*/
struct MechanicVectorMetadata {
address contractAddress;
uint96 editionId;
address mechanic;
bool isEditionBased;
bool isChoose;
bool paused;
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import "./IMechanicData.sol";
interface IMechanicMintManagerView is IMechanicData {
/**
* @notice Get a mechanic vector's metadata
* @param mechanicVectorId Global mechanic vector ID
*/
function mechanicVectorMetadata(bytes32 mechanicVectorId) external view returns (MechanicVectorMetadata memory);
/**
* @notice Returns whether an address is a valid platform executor
* @param _executor Address to be checked
*/
function isPlatformExecutor(address _executor) external view returns (bool);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./interfaces/IMechanic.sol";
import "./interfaces/IMechanicMintManagerView.sol";
/**
* @notice MintManager client, to be used by mechanic contracts
* @author highlight.xyz
*/
abstract contract MechanicMintManagerClientUpgradeable is OwnableUpgradeable, IMechanic {
/**
* @notice Throw when caller is not MintManager
*/
error NotMintManager();
/**
* @notice Throw when input mint manager is invalid
*/
error InvalidMintManager();
/**
* @notice Mint manager
*/
address public mintManager;
/**
* @notice Enforce caller to be mint manager
*/
modifier onlyMintManager() {
if (msg.sender != mintManager) {
_revert(NotMintManager.selector);
}
_;
}
/**
* @notice Update the mint manager
* @param _mintManager New mint manager
*/
function updateMintManager(address _mintManager) external onlyOwner {
if (_mintManager == address(0)) {
_revert(InvalidMintManager.selector);
}
mintManager = _mintManager;
}
/**
* @notice Initialize mechanic mint manager client
* @param _mintManager Mint manager address
* @param platform Platform owning the contract
*/
function __MechanicMintManagerClientUpgradeable_initialize(
address _mintManager,
address platform
) internal onlyInitializing {
__Ownable_init();
mintManager = _mintManager;
_transferOwnership(platform);
}
/**
* @notice Get a mechanic mint vector's metadata
* @param mechanicVectorId Mechanic vector ID
*/
function _getMechanicVectorMetadata(
bytes32 mechanicVectorId
) internal view returns (MechanicVectorMetadata memory) {
return IMechanicMintManagerView(mintManager).mechanicVectorMetadata(mechanicVectorId);
}
function _isPlatformExecutor(address _executor) internal view returns (bool) {
return IMechanicMintManagerView(mintManager).isPlatformExecutor(_executor);
}
/**
* @dev For more efficient reverts.
*/
function _revert(bytes4 errorSelector) internal pure {
assembly {
mstore(0x00, errorSelector)
revert(0x00, 0x04)
}
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
/**
* @title IGengineObservability
* @author highlight.xyz
* @notice Interface to interact with the Highlight Gengine observability singleton
* @dev Singleton to coalesce select Highlight Gengine protocol events
*/
interface IGengineObservability {
/**
* @notice Emitted when contract metadata is set
* @param contractAddress Initial contract that emitted event
* @param name New name
* @param symbol New symbol
* @param contractURI New contract uri
*/
event ContractMetadataSet(address indexed contractAddress, string name, string symbol, string contractURI);
/**
* @notice Emitted when limit supply is set
* @param contractAddress Initial contract that emitted event
* @param newLimitSupply Limit supply to set
*/
event LimitSupplySet(address indexed contractAddress, uint256 indexed newLimitSupply);
/**
* @notice Emits when a series collection has its base uri set
* @param contractAddress Contract with updated base uri
* @param newBaseUri New base uri
*/
event BaseUriSet(address indexed contractAddress, string newBaseUri);
/**************************
Deployment events
**************************/
/**
* @notice Emitted when Generative Series contract is deployed
* @param deployer Contract deployer
* @param contractAddress Address of contract that was deployed
*/
event GenerativeSeriesDeployed(address indexed deployer, address indexed contractAddress);
/**
* @notice Emitted when Series contract is deployed
* @param deployer Contract deployer
* @param contractAddress Address of contract that was deployed
*/
event SeriesDeployed(address indexed deployer, address indexed contractAddress);
/**************************
ERC721 events
**************************/
/**
* @notice Emitted on a mint where a number of tokens are minted
* @param contractAddress Address of contract being minted on
* @param numMinted Number of tokens minted
*/
event TokenMint(address indexed contractAddress, address indexed to, uint256 indexed numMinted);
/**
* @notice Emitted whenever the metadata for the token is updated
* @param contractAddress NFT contract token resides on
* @param tokenId Token being updated
*/
event TokenUpdated(address indexed contractAddress, uint256 indexed tokenId);
/**
* @notice Emitted when `tokenId` token is transferred from `from` to `to` on contractAddress
* @param contractAddress NFT contract token resides on
* @param from Token sender
* @param to Token receiver
* @param tokenId Token being sent
*/
event Transfer(address indexed contractAddress, address indexed from, address to, uint256 indexed tokenId);
/**
* @notice Emitted for the seed based data on mint
* @param sender contract emitting the event
* @param contractAddress NFT contract token resides on
* @param data custom mint data
*/
event CustomMintData(address indexed sender, address indexed contractAddress, bytes data);
/**
* @notice Emitted to regenerate the generative art for a token
* @param sender contract emitting the event
* @param collection NFT contract token resides on
* @param tokenId Token ID
*/
event HighlightRegenerate(address indexed sender, address indexed collection, uint256 indexed tokenId);
/**
* @notice Emit ContractMetadataSet
*/
function emitContractMetadataSet(
string calldata name,
string calldata symbol,
string calldata contractURI
) external;
/**
* @notice Emit LimitSupplySet
*/
function emitLimitSupplySet(uint256 newLimitSupply) external;
/**
* @notice Emit BaseUriSet
*/
function emitBaseUriSet(string calldata newBaseUri) external;
/**
* @notice Emit GenerativeSeriesDeployed
*/
function emitGenerativeSeriesDeployed(address contractAddress) external;
/**
* @notice Emit SeriesDeployed
*/
function emitSeriesDeployed(address contractAddress) external;
/**
* @notice Emit Token Mint
*/
function emitTokenMint(address to, uint256 numMinted) external;
/**
* @notice Emit Token Updated
*/
function emitTokenUpdated(address contractAddress, uint256 tokenId) external;
/**
* @notice Emit Transfer
*/
function emitTransfer(address from, address to, uint256 tokenId) external;
/**
* @notice Emit Custom Mint Data
*/
function emitCustomMintData(address contractAddress, bytes calldata data) external;
/**
* @notice Emit HighlightRegenerate
*/
function emitHighlightRegenerate(address collection, uint256 tokenId) external;
}{
"metadata": {
"bytecodeHash": "none"
},
"optimizer": {
"enabled": true,
"runs": 1
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"BidAlreadyAdded","type":"error"},{"inputs":[],"name":"BidAlreadyReclaimed","type":"error"},{"inputs":[],"name":"CurrencyNotSupported","type":"error"},{"inputs":[],"name":"EtherSendFailed","type":"error"},{"inputs":[],"name":"ImpossibleState","type":"error"},{"inputs":[],"name":"InvalidClaim","type":"error"},{"inputs":[],"name":"InvalidMint","type":"error"},{"inputs":[],"name":"InvalidMintAmount","type":"error"},{"inputs":[],"name":"InvalidMintManager","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidSponsor","type":"error"},{"inputs":[],"name":"InvalidSponsorAmount","type":"error"},{"inputs":[],"name":"InvalidUpdate","type":"error"},{"inputs":[],"name":"NotMintManager","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"VectorAlreadyCreated","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":false,"internalType":"uint64","name":"numSponsored","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintFeePerToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasPerToken","type":"uint256"},{"indexed":false,"internalType":"address","name":"currency","type":"address"},{"indexed":false,"internalType":"address","name":"paymentRecipient","type":"address"}],"name":"GaslessSponsor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"}],"name":"GaslessVectorCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"}],"name":"GaslessVectorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":true,"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"mintRecipient","type":"address"},{"indexed":true,"internalType":"uint64","name":"initialSponsorId","type":"uint64"},{"indexed":false,"internalType":"address","name":"feeCollector","type":"address"},{"indexed":false,"internalType":"address","name":"currency","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"numMinted","type":"uint32"}],"name":"SponsoredMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"},{"internalType":"bytes","name":"vectorData","type":"bytes"}],"name":"createVector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"}],"name":"getRawVector","outputs":[{"components":[{"internalType":"uint64","name":"maxClaimablePerUser","type":"uint64"},{"internalType":"uint64","name":"maxClaimableViaVector","type":"uint64"},{"internalType":"uint64","name":"numMinted","type":"uint64"},{"internalType":"uint64","name":"numSponsored","type":"uint64"}],"internalType":"struct GaslessMechanic.Vector","name":"_vector","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserClaimed","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"}],"name":"getVectorState","outputs":[{"components":[{"internalType":"uint64","name":"maxClaimablePerUser","type":"uint64"},{"internalType":"uint64","name":"maxClaimableViaVector","type":"uint64"},{"internalType":"uint64","name":"numMinted","type":"uint64"},{"internalType":"uint64","name":"numSponsored","type":"uint64"}],"internalType":"struct GaslessMechanic.Vector","name":"_vector","type":"tuple"},{"internalType":"uint256","name":"collectionSupply","type":"uint256"},{"internalType":"uint256","name":"collectionSize","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_mintManager","type":"address"},{"internalType":"address","name":"platform","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"address","name":"minter","type":"address"},{"components":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint96","name":"editionId","type":"uint96"},{"internalType":"address","name":"mechanic","type":"address"},{"internalType":"bool","name":"isEditionBased","type":"bool"},{"internalType":"bool","name":"isChoose","type":"bool"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct IMechanicData.MechanicVectorMetadata","name":"mechanicVectorMetadata","type":"tuple"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"processChooseMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint32","name":"numToMint","type":"uint32"},{"internalType":"address","name":"minter","type":"address"},{"components":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint96","name":"editionId","type":"uint96"},{"internalType":"address","name":"mechanic","type":"address"},{"internalType":"bool","name":"isEditionBased","type":"bool"},{"internalType":"bool","name":"isChoose","type":"bool"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct IMechanicData.MechanicVectorMetadata","name":"mechanicVectorMetadata","type":"tuple"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"processNumMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"uint256","name":"mintFeePerToken","type":"uint256"},{"internalType":"uint256","name":"gasPerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"address","name":"vectorPaymentRecipient","type":"address"},{"internalType":"uint48","name":"claimExpiryTimestamp","type":"uint48"},{"internalType":"uint48","name":"chainId","type":"uint48"}],"internalType":"struct GaslessMechanic.GaslessSponsorConfig","name":"sponsorConfig","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint64","name":"numToSponsor","type":"uint64"}],"name":"sponsorMints","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_mintManager","type":"address"}],"name":"updateMintManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"mechanicVectorId","type":"bytes32"},{"components":[{"internalType":"uint64","name":"maxClaimablePerUser","type":"uint64"},{"internalType":"uint64","name":"maxClaimableViaVector","type":"uint64"},{"internalType":"uint64","name":"numMinted","type":"uint64"},{"internalType":"uint64","name":"numSponsored","type":"uint64"}],"internalType":"struct GaslessMechanic.Vector","name":"newVector","type":"tuple"},{"components":[{"internalType":"bool","name":"updateMaxUserClaimableViaVector","type":"bool"},{"internalType":"bool","name":"updateMaxTotalClaimableViaVector","type":"bool"}],"internalType":"struct GaslessMechanic.VectorUpdateConfig","name":"updateConfig","type":"tuple"}],"name":"updateVector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60a06040523060805234801561001457600080fd5b5060805161292061004c600039600081816104df01528181610528015281816106cd0152818161070d015261078901526129206000f3fe6080604052600436106100cf5760003560e01c80630ae94103146100d857806313b5d9e61461010e5780631a8d37921461013d5780633659cfe61461015d578063485cc9551461017d5780634f1ef2861461019d57806352d1902d146101b0578063715018a6146101d35780637e4edf70146101e85780638383a2e514610215578063865b9b6e146102355780638da5cb5b1461026d5780639cc163e514610282578063c4804ce214610295578063cdacf467146102a8578063ceab8e19146102bb578063f2fde38b146102db57005b366100d657005b005b3480156100e457600080fd5b506100f86100f3366004611e5a565b6102fb565b6040516101059190611ea6565b60405180910390f35b34801561011a57600080fd5b5061012e610129366004611e5a565b61035e565b60405161010593929190611eb4565b34801561014957600080fd5b506100d6610158366004611fbe565b6103d4565b34801561016957600080fd5b506100d6610178366004612029565b6104d4565b34801561018957600080fd5b506100d6610198366004612046565b6105a6565b6100d66101ab36600461207f565b6106c2565b3480156101bc57600080fd5b506101c561077c565b604051908152602001610105565b3480156101df57600080fd5b506100d661082a565b3480156101f457600080fd5b50606554610208906001600160a01b031681565b60405161010591906120b8565b34801561022157600080fd5b506100d66102303660046120cc565b61083e565b34801561024157600080fd5b5061025561025036600461211e565b6109ca565b6040516001600160401b039091168152602001610105565b34801561027957600080fd5b506102086109fd565b6100d661029036600461219c565b610a0c565b6100d66102a336600461223d565b610a45565b6100d66102b6366004612330565b610a7f565b3480156102c757600080fd5b506100d66102d6366004612029565b610d42565b3480156102e757600080fd5b506100d66102f6366004612029565b610d8a565b610303611e33565b50600090815260666020908152604091829020825160808101845290546001600160401b038082168352600160401b8204811693830193909352600160801b8104831693820193909352600160c01b90920416606082015290565b610366611e33565b506000818152606660209081526040808320815160808101835290546001600160401b038082168352600160401b8204811694830194909452600160801b8104841692820192909252600160c01b909104909116606082015290806103ca84610e00565b9395909450915050565b6065546001600160a01b031633146103f6576103f6639a04794d60e01b61103f565b6000808280602001905181019061040d91906123a0565b604080516080810182526001600160401b03808516825280841660208084019182526000848601818152606086018281528d83526066909352868220865181549551925194518716600160c01b026001600160c01b03958816600160801b02959095166001600160801b03938816600160401b026001600160801b031990971691909716179490941716939093171790559151939550919350909186917ff847cddefa1c1a4603e71ac33532e01fb1bfeb644c8423edd9752fa863df908291a25050505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156105265760405162461bcd60e51b815260040161051d906123cf565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610558611049565b6001600160a01b03161461057e5760405162461bcd60e51b815260040161051d90612409565b61058781611065565b604080516000808252602082019092526105a39183919061106d565b50565b600054610100900460ff16158080156105c65750600054600160ff909116105b806105e757506105d5306111d8565b1580156105e7575060005460ff166001145b61064a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161051d565b6000805460ff19166001179055801561066d576000805461ff0019166101001790555b61067783836111e7565b80156106bd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561070b5760405162461bcd60e51b815260040161051d906123cf565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661073d611049565b6001600160a01b0316146107635760405162461bcd60e51b815260040161051d90612409565b61076c82611065565b6107788282600161106d565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108175760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b606482015260840161051d565b506000805160206128cd83398151915290565b61083261123a565b61083c6000611299565b565b6000610849846112eb565b9050336001600160a01b031681600001516001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610897573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bb9190612443565b6001600160a01b0316141580156108dc575080516001600160a01b03163314155b156108f0576108f06282b42960e81b61103f565b6108fd602083018361246e565b1561093c5761090f602084018461248b565b600085815260666020526040902080546001600160401b0319166001600160401b03929092169190911790555b61094c604083016020840161246e565b1561099957610961604084016020850161248b565b600085815260666020526040902080546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790555b60405184907f9ac460ae6003af642d4a5a332d0d32dcfc751b66db4d37f94bdfe169ec9a89bc90600090a250505050565b60008281526067602090815260408083206001600160a01b03851684529091529020546001600160401b03165b92915050565b6033546001600160a01b031690565b6065546001600160a01b03163314610a2e57610a2e639a04794d60e01b61103f565b610a3c878588888686611385565b50505050505050565b6065546001600160a01b03163314610a6757610a67639a04794d60e01b61103f565b610a75888589888686611385565b5050505050505050565b610a98610a91368690038601866124be565b84846115a9565b6001600160401b038116610ab657610ab6632f212e0d60e11b61103f565b83356000908152606660209081526040808320815160808101835290546001600160401b038082168352600160401b8204811694830194909452600160801b8104841692820192909252600160c01b90910490911660608201819052909190610b20908490612581565b905081602001516001600160401b0316816001600160401b0316118015610b53575060208201516001600160401b031615155b15610b6857610b68632f212e0d60e11b61103f565b8535600090815260666020526040812080546001600160c01b0316600160c01b6001600160401b03851602179055610ba660a0880160808901612029565b6001600160a01b031614610bc457610bc4632f212e0d60e11b61103f565b6000610bdd6001600160401b03851660208901356125ac565b90506000610bf86001600160401b03861660408a01356125ac565b905081610c1957610c0a6002826125cb565b9150610c1682826125ed565b90505b34610c316001600160401b03871660608b01356125ac565b610c3b8385612604565b610c459190612604565b1115610c5b57610c5b63b84961ed60e01b61103f565b8115610c7a57610c7a82610c7560c08b0160a08c01612029565b61183b565b8015610c8c57610c8c81610c756109fd565b336001600160a01b031688600001357fb2cd958e770678e410da874d10303731cbc687b88dcd9a4e6365a46a69dcec8d878b602001358c604001358d606001358e6080016020810190610cdf9190612029565b8f60a0016020810190610cf29190612029565b604080516001600160401b03909716875260208701959095529385019290925260608401526001600160a01b0390811660808401521660a082015260c00160405180910390a35050505050505050565b610d4a61123a565b6001600160a01b038116610d6857610d6863040b3bcf60e31b61103f565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b610d9261123a565b6001600160a01b038116610df75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161051d565b6105a381611299565b6000806000610e0e846112eb565b80519091506001600160a01b0316610e5f5760405162461bcd60e51b8152602060048201526014602482015273159958dd1bdc88191bd95cdb89dd08195e1a5cdd60621b604482015260640161051d565b806060015115610efe578051602082015160405163ddf990f960e01b81526001600160601b0390911660048201526000916001600160a01b03169063ddf990f990602401600060405180830381865afa158015610ec0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ee89190810190612648565b9050806040015193508060200151925050611039565b80600001516001600160a01b031663047fc9aa6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610f5c575060408051601f3d908101601f19168201909252610f599181019061270b565b60015b610fcd5780600001516001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc6919061270b565b9250610fd0565b92505b80600001516001600160a01b0316632ddcb21f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611012573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611036919061270b565b91505b50915091565b8060005260046000fd5b6000805160206128cd833981519152546001600160a01b031690565b6105a361123a565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156110a0576106bd836118a6565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156110fa575060408051601f3d908101601f191682019092526110f79181019061270b565b60015b61115d5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161051d565b6000805160206128cd83398151915281146111cc5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161051d565b506106bd838383611940565b6001600160a01b03163b151590565b600054610100900460ff1661120e5760405162461bcd60e51b815260040161051d90612724565b61121661196b565b606580546001600160a01b0319166001600160a01b03841617905561077881611299565b336112436109fd565b6001600160a01b03161461083c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051d565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040805160c081018252600080825260208201819052818301819052606082018190526080820181905260a0820152606554915162820a0360e31b81526004810184905290916001600160a01b03169063041050189060240160c060405180830381865afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f7919061277a565b6000806113948385018561211e565b60008a8152606660209081526040808320815160808101835290546001600160401b038082168352600160401b8204811694830194909452600160801b81048416928201839052600160c01b9004909216606083015293955091935090916114039063ffffffff891690612581565b905081606001516001600160401b0316816001600160401b031611156114335761143363199f5a0360e31b61103f565b60008a815260666020908152604080832080546001600160401b03808716600160801b02600160801b600160c01b031990921691909117909155606783528184206001600160a01b038d1685529092528220546114989163ffffffff8b169116612581565b905082600001516001600160401b0316816001600160401b03161180156114c8575082516001600160401b031615155b156114dd576114dd63199f5a0360e31b61103f565b60008b81526067602090815260408083206001600160a01b038d168452909152902080546001600160401b0319166001600160401b038316179055611522858561183b565b6040830151611532906001612581565b604080516001600160a01b0387811682526000602083015291810188905263ffffffff8b1660608201526001600160401b039290921691908b16908d907f049db32fba2a1a1e27b64c6c4e413452663a197c14e67bd3168b0ba21fa3c30d9060800160405180910390a45050505050505050505050565b60007fd4cd86574bcac27e78578396249c462b885315e7c05472e3750e399678b08e17846000015185602001518660400151876060015188608001518960a001518a60c001518b60e0015160405160200161165d9998979695949392919098895260208901979097526040880195909552606087019390935260808601919091526001600160a01b0390811660a08601521660c084015265ffffffffffff90811660e0840152166101008201526101200190565b6040516020818303038152906040528051906020012090506000611745604080517fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac5647260208201527f47263be69a82ba8bdcefb67b35791543e0b4a536196541b2d28eae0b6fd6afb3918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a08201527f954386a2b103a8ad2b933e44ea148036f73dc4b906c0fea200392fd413d44da060c082015260009060e00160405160208183030381529060405280519060200120905090565b60405161190160f01b602082015260228101919091526042810183905260620160405160208183030381529060405280519060200120905060006117bf8286868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061199a92505050565b90506001600160a01b03811615806117dd57506117db816119be565b155b806117fb57508560c0015165ffffffffffff164265ffffffffffff16115b1561181057611810638baa579f60e01b61103f565b8560e0015165ffffffffffff16461461183357611833633b4f091f60e21b61103f565b505050505050565b6000816001600160a01b03168360405160006040518083038185875af1925050503d8060008114611888576040519150601f19603f3d011682016040523d82523d6000602084013e61188d565b606091505b50509050806106bd576106bd637cd69c3960e11b61103f565b6118af816111d8565b6119115760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161051d565b6000805160206128cd83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61194983611a30565b6000825111806119565750805b156106bd576119658383611a70565b50505050565b600054610100900460ff166119925760405162461bcd60e51b815260040161051d90612724565b61083c611a9c565b60008060006119a98585611acc565b915091506119b681611b12565b509392505050565b60655460405163717b358f60e11b81526000916001600160a01b03169063e2f66b1e906119ef9085906004016120b8565b602060405180830381865afa158015611a0c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f7919061282a565b611a39816118a6565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060611a9583836040518060600160405280602781526020016128ed60279139611c5b565b9392505050565b600054610100900460ff16611ac35760405162461bcd60e51b815260040161051d90612724565b61083c33611299565b600080825160411415611b035760208301516040840151606085015160001a611af787828585611cd3565b94509450505050611b0b565b506000905060025b9250929050565b6000816004811115611b2657611b26612847565b1415611b2f5750565b6001816004811115611b4357611b43612847565b1415611b8c5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b604482015260640161051d565b6002816004811115611ba057611ba0612847565b1415611bee5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161051d565b6003816004811115611c0257611c02612847565b14156105a35760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161051d565b6060600080856001600160a01b031685604051611c78919061285d565b600060405180830381855af49150503d8060008114611cb3576040519150601f19603f3d011682016040523d82523d6000602084013e611cb8565b606091505b5091509150611cc986838387611d8d565b9695505050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115611d005750600090506003611d84565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611d54573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611d7d57600060019250925050611d84565b9150600090505b94509492505050565b60608315611df7578251611df057611da4856111d8565b611df05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161051d565b5081611e01565b611e018383611e09565b949350505050565b815115611e195781518083602001fd5b8060405162461bcd60e51b815260040161051d9190612879565b60408051608081018252600080825260208201819052918101829052606081019190915290565b600060208284031215611e6c57600080fd5b5035919050565b80516001600160401b03908116835260208083015182169084015260408281015182169084015260609182015116910152565b608081016109f78284611e73565b60c08101611ec28286611e73565b608082019390935260a00152919050565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b0381118282101715611f0b57611f0b611ed3565b60405290565b604051601f8201601f191681016001600160401b0381118282101715611f3957611f39611ed3565b604052919050565b60006001600160401b03821115611f5a57611f5a611ed3565b50601f01601f191660200190565b600082601f830112611f7957600080fd5b8135611f8c611f8782611f41565b611f11565b818152846020838601011115611fa157600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215611fd157600080fd5b8235915060208301356001600160401b03811115611fee57600080fd5b611ffa85828601611f68565b9150509250929050565b6001600160a01b03811681146105a357600080fd5b803561202481612004565b919050565b60006020828403121561203b57600080fd5b8135611a9581612004565b6000806040838503121561205957600080fd5b823561206481612004565b9150602083013561207481612004565b809150509250929050565b6000806040838503121561209257600080fd5b823561209d81612004565b915060208301356001600160401b03811115611fee57600080fd5b6001600160a01b0391909116815260200190565b600080600083850360e08112156120e257600080fd5b843593506080601f19820112156120f857600080fd5b6020850192506040609f198201121561211057600080fd5b5060a0840190509250925092565b6000806040838503121561213157600080fd5b82359150602083013561207481612004565b600060c0828403121561215557600080fd5b50919050565b60008083601f84011261216d57600080fd5b5081356001600160401b0381111561218457600080fd5b602083019150836020828501011115611b0b57600080fd5b6000806000806000806000610160888a0312156121b857600080fd5b8735965060208801356121ca81612004565b9550604088013563ffffffff811681146121e357600080fd5b945060608801356121f381612004565b93506122028960808a01612143565b92506101408801356001600160401b0381111561221e57600080fd5b61222a8a828b0161215b565b989b979a50959850939692959293505050565b600080600080600080600080610160898b03121561225a57600080fd5b88359750602089013561226c81612004565b965060408901356001600160401b038082111561228857600080fd5b818b0191508b601f83011261229c57600080fd5b8135818111156122ab57600080fd5b8c60208260051b85010111156122c057600080fd5b60208301985096506122d460608c01612019565b95506122e38c60808d01612143565b94506101408b01359150808211156122fa57600080fd5b506123078b828c0161215b565b999c989b5096995094979396929594505050565b6001600160401b03811681146105a357600080fd5b60008060008084860361014081121561234857600080fd5b6101008082121561235857600080fd5b86955085013590506001600160401b0381111561237457600080fd5b6123808782880161215b565b9094509250506101208501356123958161231b565b939692955090935050565b600080604083850312156123b357600080fd5b82516123be8161231b565b60208401519092506120748161231b565b6020808252602c908201526000805160206128ad83398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201526000805160206128ad83398151915260408201526b6163746976652070726f787960a01b606082015260800190565b60006020828403121561245557600080fd5b8151611a9581612004565b80151581146105a357600080fd5b60006020828403121561248057600080fd5b8135611a9581612460565b60006020828403121561249d57600080fd5b8135611a958161231b565b803565ffffffffffff8116811461202457600080fd5b60006101008083850312156124d257600080fd5b604051908101906001600160401b03821181831017156124f4576124f4611ed3565b81604052833581526020840135602082015260408401356040820152606084013560608201526080840135915061252a82612004565b81608082015261253c60a08501612019565b60a082015261254d60c085016124a8565b60c082015261255e60e085016124a8565b60e0820152949350505050565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b038281168482168083038211156125a3576125a361256b565b01949350505050565b60008160001904831182151516156125c6576125c661256b565b500290565b6000826125e857634e487b7160e01b600052601260045260246000fd5b500490565b6000828210156125ff576125ff61256b565b500390565b600082198211156126175761261761256b565b500190565b60005b8381101561263757818101518382015260200161261f565b838111156119655750506000910152565b6000602080838503121561265b57600080fd5b82516001600160401b038082111561267257600080fd5b908401906080828703121561268657600080fd5b61268e611ee9565b82518281111561269d57600080fd5b83019150601f820187136126b057600080fd5b81516126be611f8782611f41565b81815288868386010111156126d257600080fd5b6126e18287830188870161261c565b82525082840151938101939093525060408082015190830152606090810151908201529392505050565b60006020828403121561271d57600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b805161202481612460565b600060c0828403121561278c57600080fd5b60405160c081016001600160401b03811182821017156127ae576127ae611ed3565b60405282516127bc81612004565b815260208301516001600160601b03811681146127d857600080fd5b602082015260408301516127eb81612004565b60408201526127fc6060840161276f565b606082015261280d6080840161276f565b608082015261281e60a0840161276f565b60a08201529392505050565b60006020828403121561283c57600080fd5b8151611a9581612460565b634e487b7160e01b600052602160045260246000fd5b6000825161286f81846020870161261c565b9190910192915050565b602081526000825180602084015261289881604085016020870161261c565b601f01601f1916919091016040019291505056fe46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c634300080a000a
Deployed Bytecode
0x6080604052600436106100cf5760003560e01c80630ae94103146100d857806313b5d9e61461010e5780631a8d37921461013d5780633659cfe61461015d578063485cc9551461017d5780634f1ef2861461019d57806352d1902d146101b0578063715018a6146101d35780637e4edf70146101e85780638383a2e514610215578063865b9b6e146102355780638da5cb5b1461026d5780639cc163e514610282578063c4804ce214610295578063cdacf467146102a8578063ceab8e19146102bb578063f2fde38b146102db57005b366100d657005b005b3480156100e457600080fd5b506100f86100f3366004611e5a565b6102fb565b6040516101059190611ea6565b60405180910390f35b34801561011a57600080fd5b5061012e610129366004611e5a565b61035e565b60405161010593929190611eb4565b34801561014957600080fd5b506100d6610158366004611fbe565b6103d4565b34801561016957600080fd5b506100d6610178366004612029565b6104d4565b34801561018957600080fd5b506100d6610198366004612046565b6105a6565b6100d66101ab36600461207f565b6106c2565b3480156101bc57600080fd5b506101c561077c565b604051908152602001610105565b3480156101df57600080fd5b506100d661082a565b3480156101f457600080fd5b50606554610208906001600160a01b031681565b60405161010591906120b8565b34801561022157600080fd5b506100d66102303660046120cc565b61083e565b34801561024157600080fd5b5061025561025036600461211e565b6109ca565b6040516001600160401b039091168152602001610105565b34801561027957600080fd5b506102086109fd565b6100d661029036600461219c565b610a0c565b6100d66102a336600461223d565b610a45565b6100d66102b6366004612330565b610a7f565b3480156102c757600080fd5b506100d66102d6366004612029565b610d42565b3480156102e757600080fd5b506100d66102f6366004612029565b610d8a565b610303611e33565b50600090815260666020908152604091829020825160808101845290546001600160401b038082168352600160401b8204811693830193909352600160801b8104831693820193909352600160c01b90920416606082015290565b610366611e33565b506000818152606660209081526040808320815160808101835290546001600160401b038082168352600160401b8204811694830194909452600160801b8104841692820192909252600160c01b909104909116606082015290806103ca84610e00565b9395909450915050565b6065546001600160a01b031633146103f6576103f6639a04794d60e01b61103f565b6000808280602001905181019061040d91906123a0565b604080516080810182526001600160401b03808516825280841660208084019182526000848601818152606086018281528d83526066909352868220865181549551925194518716600160c01b026001600160c01b03958816600160801b02959095166001600160801b03938816600160401b026001600160801b031990971691909716179490941716939093171790559151939550919350909186917ff847cddefa1c1a4603e71ac33532e01fb1bfeb644c8423edd9752fa863df908291a25050505050565b306001600160a01b037f000000000000000000000000a749779d450c266b1bbe776426555da578ebb5f91614156105265760405162461bcd60e51b815260040161051d906123cf565b60405180910390fd5b7f000000000000000000000000a749779d450c266b1bbe776426555da578ebb5f96001600160a01b0316610558611049565b6001600160a01b03161461057e5760405162461bcd60e51b815260040161051d90612409565b61058781611065565b604080516000808252602082019092526105a39183919061106d565b50565b600054610100900460ff16158080156105c65750600054600160ff909116105b806105e757506105d5306111d8565b1580156105e7575060005460ff166001145b61064a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161051d565b6000805460ff19166001179055801561066d576000805461ff0019166101001790555b61067783836111e7565b80156106bd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b306001600160a01b037f000000000000000000000000a749779d450c266b1bbe776426555da578ebb5f916141561070b5760405162461bcd60e51b815260040161051d906123cf565b7f000000000000000000000000a749779d450c266b1bbe776426555da578ebb5f96001600160a01b031661073d611049565b6001600160a01b0316146107635760405162461bcd60e51b815260040161051d90612409565b61076c82611065565b6107788282600161106d565b5050565b6000306001600160a01b037f000000000000000000000000a749779d450c266b1bbe776426555da578ebb5f916146108175760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b606482015260840161051d565b506000805160206128cd83398151915290565b61083261123a565b61083c6000611299565b565b6000610849846112eb565b9050336001600160a01b031681600001516001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610897573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bb9190612443565b6001600160a01b0316141580156108dc575080516001600160a01b03163314155b156108f0576108f06282b42960e81b61103f565b6108fd602083018361246e565b1561093c5761090f602084018461248b565b600085815260666020526040902080546001600160401b0319166001600160401b03929092169190911790555b61094c604083016020840161246e565b1561099957610961604084016020850161248b565b600085815260666020526040902080546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790555b60405184907f9ac460ae6003af642d4a5a332d0d32dcfc751b66db4d37f94bdfe169ec9a89bc90600090a250505050565b60008281526067602090815260408083206001600160a01b03851684529091529020546001600160401b03165b92915050565b6033546001600160a01b031690565b6065546001600160a01b03163314610a2e57610a2e639a04794d60e01b61103f565b610a3c878588888686611385565b50505050505050565b6065546001600160a01b03163314610a6757610a67639a04794d60e01b61103f565b610a75888589888686611385565b5050505050505050565b610a98610a91368690038601866124be565b84846115a9565b6001600160401b038116610ab657610ab6632f212e0d60e11b61103f565b83356000908152606660209081526040808320815160808101835290546001600160401b038082168352600160401b8204811694830194909452600160801b8104841692820192909252600160c01b90910490911660608201819052909190610b20908490612581565b905081602001516001600160401b0316816001600160401b0316118015610b53575060208201516001600160401b031615155b15610b6857610b68632f212e0d60e11b61103f565b8535600090815260666020526040812080546001600160c01b0316600160c01b6001600160401b03851602179055610ba660a0880160808901612029565b6001600160a01b031614610bc457610bc4632f212e0d60e11b61103f565b6000610bdd6001600160401b03851660208901356125ac565b90506000610bf86001600160401b03861660408a01356125ac565b905081610c1957610c0a6002826125cb565b9150610c1682826125ed565b90505b34610c316001600160401b03871660608b01356125ac565b610c3b8385612604565b610c459190612604565b1115610c5b57610c5b63b84961ed60e01b61103f565b8115610c7a57610c7a82610c7560c08b0160a08c01612029565b61183b565b8015610c8c57610c8c81610c756109fd565b336001600160a01b031688600001357fb2cd958e770678e410da874d10303731cbc687b88dcd9a4e6365a46a69dcec8d878b602001358c604001358d606001358e6080016020810190610cdf9190612029565b8f60a0016020810190610cf29190612029565b604080516001600160401b03909716875260208701959095529385019290925260608401526001600160a01b0390811660808401521660a082015260c00160405180910390a35050505050505050565b610d4a61123a565b6001600160a01b038116610d6857610d6863040b3bcf60e31b61103f565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b610d9261123a565b6001600160a01b038116610df75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161051d565b6105a381611299565b6000806000610e0e846112eb565b80519091506001600160a01b0316610e5f5760405162461bcd60e51b8152602060048201526014602482015273159958dd1bdc88191bd95cdb89dd08195e1a5cdd60621b604482015260640161051d565b806060015115610efe578051602082015160405163ddf990f960e01b81526001600160601b0390911660048201526000916001600160a01b03169063ddf990f990602401600060405180830381865afa158015610ec0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ee89190810190612648565b9050806040015193508060200151925050611039565b80600001516001600160a01b031663047fc9aa6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610f5c575060408051601f3d908101601f19168201909252610f599181019061270b565b60015b610fcd5780600001516001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc6919061270b565b9250610fd0565b92505b80600001516001600160a01b0316632ddcb21f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611012573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611036919061270b565b91505b50915091565b8060005260046000fd5b6000805160206128cd833981519152546001600160a01b031690565b6105a361123a565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156110a0576106bd836118a6565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156110fa575060408051601f3d908101601f191682019092526110f79181019061270b565b60015b61115d5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161051d565b6000805160206128cd83398151915281146111cc5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161051d565b506106bd838383611940565b6001600160a01b03163b151590565b600054610100900460ff1661120e5760405162461bcd60e51b815260040161051d90612724565b61121661196b565b606580546001600160a01b0319166001600160a01b03841617905561077881611299565b336112436109fd565b6001600160a01b03161461083c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161051d565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040805160c081018252600080825260208201819052818301819052606082018190526080820181905260a0820152606554915162820a0360e31b81526004810184905290916001600160a01b03169063041050189060240160c060405180830381865afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f7919061277a565b6000806113948385018561211e565b60008a8152606660209081526040808320815160808101835290546001600160401b038082168352600160401b8204811694830194909452600160801b81048416928201839052600160c01b9004909216606083015293955091935090916114039063ffffffff891690612581565b905081606001516001600160401b0316816001600160401b031611156114335761143363199f5a0360e31b61103f565b60008a815260666020908152604080832080546001600160401b03808716600160801b02600160801b600160c01b031990921691909117909155606783528184206001600160a01b038d1685529092528220546114989163ffffffff8b169116612581565b905082600001516001600160401b0316816001600160401b03161180156114c8575082516001600160401b031615155b156114dd576114dd63199f5a0360e31b61103f565b60008b81526067602090815260408083206001600160a01b038d168452909152902080546001600160401b0319166001600160401b038316179055611522858561183b565b6040830151611532906001612581565b604080516001600160a01b0387811682526000602083015291810188905263ffffffff8b1660608201526001600160401b039290921691908b16908d907f049db32fba2a1a1e27b64c6c4e413452663a197c14e67bd3168b0ba21fa3c30d9060800160405180910390a45050505050505050505050565b60007fd4cd86574bcac27e78578396249c462b885315e7c05472e3750e399678b08e17846000015185602001518660400151876060015188608001518960a001518a60c001518b60e0015160405160200161165d9998979695949392919098895260208901979097526040880195909552606087019390935260808601919091526001600160a01b0390811660a08601521660c084015265ffffffffffff90811660e0840152166101008201526101200190565b6040516020818303038152906040528051906020012090506000611745604080517fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac5647260208201527f47263be69a82ba8bdcefb67b35791543e0b4a536196541b2d28eae0b6fd6afb3918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a08201527f954386a2b103a8ad2b933e44ea148036f73dc4b906c0fea200392fd413d44da060c082015260009060e00160405160208183030381529060405280519060200120905090565b60405161190160f01b602082015260228101919091526042810183905260620160405160208183030381529060405280519060200120905060006117bf8286868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061199a92505050565b90506001600160a01b03811615806117dd57506117db816119be565b155b806117fb57508560c0015165ffffffffffff164265ffffffffffff16115b1561181057611810638baa579f60e01b61103f565b8560e0015165ffffffffffff16461461183357611833633b4f091f60e21b61103f565b505050505050565b6000816001600160a01b03168360405160006040518083038185875af1925050503d8060008114611888576040519150601f19603f3d011682016040523d82523d6000602084013e61188d565b606091505b50509050806106bd576106bd637cd69c3960e11b61103f565b6118af816111d8565b6119115760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161051d565b6000805160206128cd83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61194983611a30565b6000825111806119565750805b156106bd576119658383611a70565b50505050565b600054610100900460ff166119925760405162461bcd60e51b815260040161051d90612724565b61083c611a9c565b60008060006119a98585611acc565b915091506119b681611b12565b509392505050565b60655460405163717b358f60e11b81526000916001600160a01b03169063e2f66b1e906119ef9085906004016120b8565b602060405180830381865afa158015611a0c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f7919061282a565b611a39816118a6565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060611a9583836040518060600160405280602781526020016128ed60279139611c5b565b9392505050565b600054610100900460ff16611ac35760405162461bcd60e51b815260040161051d90612724565b61083c33611299565b600080825160411415611b035760208301516040840151606085015160001a611af787828585611cd3565b94509450505050611b0b565b506000905060025b9250929050565b6000816004811115611b2657611b26612847565b1415611b2f5750565b6001816004811115611b4357611b43612847565b1415611b8c5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b604482015260640161051d565b6002816004811115611ba057611ba0612847565b1415611bee5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161051d565b6003816004811115611c0257611c02612847565b14156105a35760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161051d565b6060600080856001600160a01b031685604051611c78919061285d565b600060405180830381855af49150503d8060008114611cb3576040519150601f19603f3d011682016040523d82523d6000602084013e611cb8565b606091505b5091509150611cc986838387611d8d565b9695505050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115611d005750600090506003611d84565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611d54573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611d7d57600060019250925050611d84565b9150600090505b94509492505050565b60608315611df7578251611df057611da4856111d8565b611df05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161051d565b5081611e01565b611e018383611e09565b949350505050565b815115611e195781518083602001fd5b8060405162461bcd60e51b815260040161051d9190612879565b60408051608081018252600080825260208201819052918101829052606081019190915290565b600060208284031215611e6c57600080fd5b5035919050565b80516001600160401b03908116835260208083015182169084015260408281015182169084015260609182015116910152565b608081016109f78284611e73565b60c08101611ec28286611e73565b608082019390935260a00152919050565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b0381118282101715611f0b57611f0b611ed3565b60405290565b604051601f8201601f191681016001600160401b0381118282101715611f3957611f39611ed3565b604052919050565b60006001600160401b03821115611f5a57611f5a611ed3565b50601f01601f191660200190565b600082601f830112611f7957600080fd5b8135611f8c611f8782611f41565b611f11565b818152846020838601011115611fa157600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215611fd157600080fd5b8235915060208301356001600160401b03811115611fee57600080fd5b611ffa85828601611f68565b9150509250929050565b6001600160a01b03811681146105a357600080fd5b803561202481612004565b919050565b60006020828403121561203b57600080fd5b8135611a9581612004565b6000806040838503121561205957600080fd5b823561206481612004565b9150602083013561207481612004565b809150509250929050565b6000806040838503121561209257600080fd5b823561209d81612004565b915060208301356001600160401b03811115611fee57600080fd5b6001600160a01b0391909116815260200190565b600080600083850360e08112156120e257600080fd5b843593506080601f19820112156120f857600080fd5b6020850192506040609f198201121561211057600080fd5b5060a0840190509250925092565b6000806040838503121561213157600080fd5b82359150602083013561207481612004565b600060c0828403121561215557600080fd5b50919050565b60008083601f84011261216d57600080fd5b5081356001600160401b0381111561218457600080fd5b602083019150836020828501011115611b0b57600080fd5b6000806000806000806000610160888a0312156121b857600080fd5b8735965060208801356121ca81612004565b9550604088013563ffffffff811681146121e357600080fd5b945060608801356121f381612004565b93506122028960808a01612143565b92506101408801356001600160401b0381111561221e57600080fd5b61222a8a828b0161215b565b989b979a50959850939692959293505050565b600080600080600080600080610160898b03121561225a57600080fd5b88359750602089013561226c81612004565b965060408901356001600160401b038082111561228857600080fd5b818b0191508b601f83011261229c57600080fd5b8135818111156122ab57600080fd5b8c60208260051b85010111156122c057600080fd5b60208301985096506122d460608c01612019565b95506122e38c60808d01612143565b94506101408b01359150808211156122fa57600080fd5b506123078b828c0161215b565b999c989b5096995094979396929594505050565b6001600160401b03811681146105a357600080fd5b60008060008084860361014081121561234857600080fd5b6101008082121561235857600080fd5b86955085013590506001600160401b0381111561237457600080fd5b6123808782880161215b565b9094509250506101208501356123958161231b565b939692955090935050565b600080604083850312156123b357600080fd5b82516123be8161231b565b60208401519092506120748161231b565b6020808252602c908201526000805160206128ad83398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201526000805160206128ad83398151915260408201526b6163746976652070726f787960a01b606082015260800190565b60006020828403121561245557600080fd5b8151611a9581612004565b80151581146105a357600080fd5b60006020828403121561248057600080fd5b8135611a9581612460565b60006020828403121561249d57600080fd5b8135611a958161231b565b803565ffffffffffff8116811461202457600080fd5b60006101008083850312156124d257600080fd5b604051908101906001600160401b03821181831017156124f4576124f4611ed3565b81604052833581526020840135602082015260408401356040820152606084013560608201526080840135915061252a82612004565b81608082015261253c60a08501612019565b60a082015261254d60c085016124a8565b60c082015261255e60e085016124a8565b60e0820152949350505050565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b038281168482168083038211156125a3576125a361256b565b01949350505050565b60008160001904831182151516156125c6576125c661256b565b500290565b6000826125e857634e487b7160e01b600052601260045260246000fd5b500490565b6000828210156125ff576125ff61256b565b500390565b600082198211156126175761261761256b565b500190565b60005b8381101561263757818101518382015260200161261f565b838111156119655750506000910152565b6000602080838503121561265b57600080fd5b82516001600160401b038082111561267257600080fd5b908401906080828703121561268657600080fd5b61268e611ee9565b82518281111561269d57600080fd5b83019150601f820187136126b057600080fd5b81516126be611f8782611f41565b81815288868386010111156126d257600080fd5b6126e18287830188870161261c565b82525082840151938101939093525060408082015190830152606090810151908201529392505050565b60006020828403121561271d57600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b805161202481612460565b600060c0828403121561278c57600080fd5b60405160c081016001600160401b03811182821017156127ae576127ae611ed3565b60405282516127bc81612004565b815260208301516001600160601b03811681146127d857600080fd5b602082015260408301516127eb81612004565b60408201526127fc6060840161276f565b606082015261280d6080840161276f565b608082015261281e60a0840161276f565b60a08201529392505050565b60006020828403121561283c57600080fd5b8151611a9581612460565b634e487b7160e01b600052602160045260246000fd5b6000825161286f81846020870161261c565b9190910192915050565b602081526000825180602084015261289881604085016020870161261c565b601f01601f1916919091016040019291505056fe46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c634300080a000a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.