Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x61012060 | 18998182 | 322 days ago | IN | 0 ETH | 0.04050614 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
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:
FloorPeriphery
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import { UUPSUpgradeable } from "@openzeppelin-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import { IUniversalRouter } from "@uniswap/universal-router/contracts/interfaces/IUniversalRouter.sol"; import { IPermit2 } from "@permit2/src/interfaces/IPermit2.sol"; import { IAllowanceTransfer } from "@permit2/src/interfaces/IAllowanceTransfer.sol"; import { ISignatureTransfer } from "@permit2/src/interfaces/ISignatureTransfer.sol"; import { IFlooring } from "./interface/IFlooring.sol"; import { OwnedUpgradeable } from "./library/OwnedUpgradeable.sol"; import { CurrencyTransfer } from "./library/CurrencyTransfer.sol"; import { ERC721Transfer } from "./library/ERC721Transfer.sol"; import { TicketRecord, SafeBoxKey, SafeBox } from "./logic/Structs.sol"; import "./logic/SafeBox.sol"; import "./Errors.sol"; import "./Constants.sol"; import { FloorGetter } from "./FloorGetter.sol"; import "./interface/IWETH9.sol"; import "./Multicall.sol"; contract FloorPeriphery is OwnedUpgradeable, UUPSUpgradeable, IERC721Receiver { error WrongEthSender(); error InsufficientWETH9(); error InvalidParameter(); error InvalidClaimFee(); error InvalidPermitOwner(); IUniversalRouter public immutable UNIVERSAL_ROUTER; IPermit2 public immutable PERMIT2; address public immutable floor; address public immutable floorGetter; struct FloorFragment { address collectionId; address collectionContract; uint256[] tokenIds; } struct FloorClaim { address collectionId; uint256[] tokenIds; uint256 maxClaimFee; uint256 claimCnt; } struct UniversalRouterExecute { bytes commands; bytes[] inputs; uint256 deadline; } enum TransferWay { /// Permitted before, Transfer via Permit2 PermittedTransfer, /// Permit allowance and Transfer via Permit2 AllowanceTransfer, /// Transfer with signature via Permit2 SignatureTransfer, /// Native ETH, No more actions to transfer NativeTransfer } /// Signature Transfer via Permit2, permit owner is `msg.sender` struct SignPermitTransfer { ISignatureTransfer.PermitTransferFrom permit; ISignatureTransfer.SignatureTransferDetails transferDetails; bytes signature; } /// Permit and transfer `token` from `msg.sender` to `to` /// permit owner is `msg.sender` struct AllowancePermitTransfer { IAllowanceTransfer.PermitSingle permit; bytes signature; address to; uint160 amount; address token; } /// permit owner is `msg.sender` struct SignPermitBatchTransfer { ISignatureTransfer.PermitBatchTransferFrom permit; ISignatureTransfer.SignatureTransferDetails[] transferDetails; bytes signature; } /// permit owner is `msg.sender` struct AllowancePermitBatchTransfer { IAllowanceTransfer.PermitBatch permit; bytes signature; IAllowanceTransfer.AllowanceTransferDetails[] transferDetails; } constructor( address _floor, address _floorGetter, address _universalRouter, address permit2 ) payable { floor = _floor; floorGetter = _floorGetter; UNIVERSAL_ROUTER = IUniversalRouter(_universalRouter); PERMIT2 = IPermit2(permit2); } // required by the OZ UUPS module function _authorizeUpgrade(address) internal override onlyOwner {} function initialize() public initializer { __Owned_init(); __UUPSUpgradeable_init(); } function fragmentAndSell( FloorFragment memory fragmentParam, UniversalRouterExecute calldata swapParam, TransferWay transferWay, bytes calldata transferParam ) external payable { _fragment(fragmentParam); /// transfer selling tokens to UNIVERSAL_ROUTER _executeTransfer(transferWay, transferParam); /// swap UNIVERSAL_ROUTER.execute( swapParam.commands, swapParam.inputs, swapParam.deadline ); } function fragmentAndSell( FloorFragment[] memory fragmentParams, UniversalRouterExecute calldata swapParam, TransferWay transferWay, bytes calldata transferParam ) external payable { uint256 batchLen = fragmentParams.length; for (uint256 i; i < batchLen; ) { _fragment(fragmentParams[i]); unchecked { ++i; } } /// transfer selling tokens to UNIVERSAL_ROUTER _executeBatchTransfer(transferWay, transferParam); /// swap UNIVERSAL_ROUTER.execute( swapParam.commands, swapParam.inputs, swapParam.deadline ); } function _fragment(FloorFragment memory param) private { ( address collectionId, address collectionContract, uint256[] memory tokenIds ) = (param.collectionId, param.collectionContract, param.tokenIds); /// approve all nfts for Floor approveAllERC721(collectionContract, floor); /// transfer tokens into this ERC721Transfer.safeBatchTransferFrom( collectionContract, msg.sender, address(this), tokenIds ); /// fragment IFlooring(floor).fragmentNFTs(collectionId, tokenIds, msg.sender); } function buyAndClaimExpired( FloorClaim memory claimParams, UniversalRouterExecute calldata swapParam, TransferWay transferWay, bytes calldata transferParam ) external payable { IFlooring(floor).tidyExpiredNFTs( claimParams.collectionId, claimParams.tokenIds ); buyAndClaimVault(claimParams, swapParam, transferWay, transferParam); } function buyAndClaimExpired( FloorClaim[] memory claimParams, UniversalRouterExecute calldata swapParam, TransferWay transferWay, bytes calldata transferParam ) external payable { uint256 batchLen = claimParams.length; for (uint256 i; i < batchLen; ) { IFlooring(floor).tidyExpiredNFTs( claimParams[i].collectionId, claimParams[i].tokenIds ); unchecked { ++i; } } buyAndClaimVault(claimParams, swapParam, transferWay, transferParam); } function buyAndClaimVault( FloorClaim memory claimParams, UniversalRouterExecute calldata swapParam, TransferWay transferWay, bytes calldata transferParam ) public payable { _executeTransfer(transferWay, transferParam); _executeSwap(transferWay, swapParam); _claim(claimParams); } function buyAndClaimVault( FloorClaim[] memory claimParams, UniversalRouterExecute calldata swapParam, TransferWay transferWay, bytes calldata transferParam ) public payable { _executeBatchTransfer(transferWay, transferParam); _executeSwap(transferWay, swapParam); uint256 batchLen = claimParams.length; for (uint256 i; i < batchLen; ) { _claim(claimParams[i]); unchecked { ++i; } } } function _claim(FloorClaim memory param) private { (address collectionId, uint256 claimCnt, uint256 maxClaimFee) = ( param.collectionId, param.claimCnt, param.maxClaimFee ); address fragmentToken = FloorGetter(floorGetter).fragmentTokenOf( collectionId ); if (maxClaimFee > 0) { approveAllERC20(fragmentToken, floor, maxClaimFee); IFlooring(floor).addTokens( address(this), fragmentToken, maxClaimFee ); } uint256 claimCost = IFlooring(floor).claimRandomNFT( collectionId, claimCnt, maxClaimFee, msg.sender ); /// no extra fee or fee matching if (maxClaimFee > 0 && maxClaimFee != claimCost) revert InvalidClaimFee(); } function _executeSwap( TransferWay way, UniversalRouterExecute calldata swapParam ) private { if (way == TransferWay.NativeTransfer && address(this).balance > 0) { /// buy with eth UNIVERSAL_ROUTER.execute{ value: address(this).balance }( swapParam.commands, swapParam.inputs, swapParam.deadline ); } else { UNIVERSAL_ROUTER.execute( swapParam.commands, swapParam.inputs, swapParam.deadline ); } } function _executeTransfer( TransferWay way, bytes calldata transferParam ) private { if (way == TransferWay.NativeTransfer) return; if (way == TransferWay.PermittedTransfer) { (address to, uint160 amount, address token) = abi.decode( transferParam, (address, uint160, address) ); PERMIT2.transferFrom(msg.sender, to, amount, token); } else if (way == TransferWay.AllowanceTransfer) { AllowancePermitTransfer memory param = abi.decode( transferParam, (AllowancePermitTransfer) ); PERMIT2.permit(msg.sender, param.permit, param.signature); PERMIT2.transferFrom( msg.sender, param.to, param.amount, param.token ); } else if (way == TransferWay.SignatureTransfer) { SignPermitTransfer memory param = abi.decode( transferParam, (SignPermitTransfer) ); /// transfer selling tokens to UNIVERSAL_ROUTER PERMIT2.permitTransferFrom( param.permit, param.transferDetails, msg.sender, param.signature ); } else { revert InvalidParameter(); } } function _executeBatchTransfer( TransferWay way, bytes calldata transferParam ) private { if (way == TransferWay.NativeTransfer) return; if (way == TransferWay.PermittedTransfer) { IAllowanceTransfer.AllowanceTransferDetails[] memory param = abi .decode( transferParam, (IAllowanceTransfer.AllowanceTransferDetails[]) ); for (uint256 i; i < param.length; ++i) { if (param[i].from != msg.sender) revert InvalidPermitOwner(); } PERMIT2.transferFrom(param); } else if (way == TransferWay.AllowanceTransfer) { AllowancePermitBatchTransfer memory param = abi.decode( transferParam, (AllowancePermitBatchTransfer) ); PERMIT2.permit(msg.sender, param.permit, param.signature); for (uint256 i; i < param.transferDetails.length; ++i) { if (param.transferDetails[i].from != msg.sender) revert InvalidPermitOwner(); } PERMIT2.transferFrom(param.transferDetails); } else if (way == TransferWay.SignatureTransfer) { SignPermitBatchTransfer memory param = abi.decode( transferParam, (SignPermitBatchTransfer) ); /// transfer selling tokens to UNIVERSAL_ROUTER PERMIT2.permitTransferFrom( param.permit, param.transferDetails, msg.sender, param.signature ); } else { revert InvalidParameter(); } } function approveAllERC20( address token, address spender, uint256 desireAmount ) private { if (desireAmount == 0) { return; } uint256 allowance = IERC20(token).allowance(address(this), spender); if (allowance < desireAmount) { IERC20(token).approve(spender, type(uint256).max); } } function approveAllERC721(address collection, address spender) private { bool approved = IERC721(collection).isApprovedForAll( address(this), spender ); if (!approved) { IERC721(collection).setApprovalForAll(spender, true); } } function onERC721Received( address, /*operator*/ address, /*from*/ uint256, /*tokenId*/ bytes calldata /*data*/ ) external pure override returns (bytes4) { return this.onERC721Received.selector; } receive() external payable { if (msg.sender != address(UNIVERSAL_ROUTER)) revert WrongEthSender(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @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 Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._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 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._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() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @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 { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "./Initializable.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. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @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() { _checkProxy(); _; } /** * @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() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @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 notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @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); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC1967-compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @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 v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @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. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "../beacon/IBeacon.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @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); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @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 { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ 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 { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-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 the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore 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 { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or * {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the address zero. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.20; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be * reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set 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(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ 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 pragma solidity ^0.8.0; import {IEIP712} from "./IEIP712.sol"; /// @title AllowanceTransfer /// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts /// @dev Requires user's token approval on the Permit2 contract interface IAllowanceTransfer is IEIP712 { /// @notice Thrown when an allowance on a token has expired. /// @param deadline The timestamp at which the allowed amount is no longer valid error AllowanceExpired(uint256 deadline); /// @notice Thrown when an allowance on a token has been depleted. /// @param amount The maximum amount allowed error InsufficientAllowance(uint256 amount); /// @notice Thrown when too many nonces are invalidated. error ExcessiveInvalidation(); /// @notice Emits an event when the owner successfully invalidates an ordered nonce. event NonceInvalidation( address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce ); /// @notice Emits an event when the owner successfully sets permissions on a token for the spender. event Approval( address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration ); /// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender. event Permit( address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration, uint48 nonce ); /// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function. event Lockdown(address indexed owner, address token, address spender); /// @notice The permit data for a token struct PermitDetails { // ERC20 token address address token; // the maximum amount allowed to spend uint160 amount; // timestamp at which a spender's token allowances become invalid uint48 expiration; // an incrementing value indexed per owner,token,and spender for each signature uint48 nonce; } /// @notice The permit message signed for a single token allowance struct PermitSingle { // the permit data for a single token alownce PermitDetails details; // address permissioned on the allowed tokens address spender; // deadline on the permit signature uint256 sigDeadline; } /// @notice The permit message signed for multiple token allowances struct PermitBatch { // the permit data for multiple token allowances PermitDetails[] details; // address permissioned on the allowed tokens address spender; // deadline on the permit signature uint256 sigDeadline; } /// @notice The saved permissions /// @dev This info is saved per owner, per token, per spender and all signed over in the permit message /// @dev Setting amount to type(uint160).max sets an unlimited approval struct PackedAllowance { // amount allowed uint160 amount; // permission expiry uint48 expiration; // an incrementing value indexed per owner,token,and spender for each signature uint48 nonce; } /// @notice A token spender pair. struct TokenSpenderPair { // the token the spender is approved address token; // the spender address address spender; } /// @notice Details for a token transfer. struct AllowanceTransferDetails { // the owner of the token address from; // the recipient of the token address to; // the amount of the token uint160 amount; // the token to be transferred address token; } /// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval. /// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress] /// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals. function allowance(address user, address token, address spender) external view returns (uint160 amount, uint48 expiration, uint48 nonce); /// @notice Approves the spender to use up to amount of the specified token up until the expiration /// @param token The token to approve /// @param spender The spender address to approve /// @param amount The approved amount of the token /// @param expiration The timestamp at which the approval is no longer valid /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve /// @dev Setting amount to type(uint160).max sets an unlimited approval function approve(address token, address spender, uint160 amount, uint48 expiration) external; /// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce /// @param owner The owner of the tokens being approved /// @param permitSingle Data signed over by the owner specifying the terms of approval /// @param signature The owner's signature over the permit data function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external; /// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce /// @param owner The owner of the tokens being approved /// @param permitBatch Data signed over by the owner specifying the terms of approval /// @param signature The owner's signature over the permit data function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external; /// @notice Transfer approved tokens from one address to another /// @param from The address to transfer from /// @param to The address of the recipient /// @param amount The amount of the token to transfer /// @param token The token address to transfer /// @dev Requires the from address to have approved at least the desired amount /// of tokens to msg.sender. function transferFrom(address from, address to, uint160 amount, address token) external; /// @notice Transfer approved tokens in a batch /// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers /// @dev Requires the from addresses to have approved at least the desired amount /// of tokens to msg.sender. function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external; /// @notice Enables performing a "lockdown" of the sender's Permit2 identity /// by batch revoking approvals /// @param approvals Array of approvals to revoke. function lockdown(TokenSpenderPair[] calldata approvals) external; /// @notice Invalidate nonces for a given (token, spender) pair /// @param token The token to invalidate nonces for /// @param spender The spender to invalidate nonces for /// @param newNonce The new nonce to set. Invalidates all nonces less than it. /// @dev Can't invalidate more than 2**16 nonces per transaction. function invalidateNonces(address token, address spender, uint48 newNonce) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IEIP712 { function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {ISignatureTransfer} from "./ISignatureTransfer.sol"; import {IAllowanceTransfer} from "./IAllowanceTransfer.sol"; /// @notice Permit2 handles signature-based transfers in SignatureTransfer and allowance-based transfers in AllowanceTransfer. /// @dev Users must approve Permit2 before calling any of the transfer functions. interface IPermit2 is ISignatureTransfer, IAllowanceTransfer { // IPermit2 unifies the two interfaces so users have maximal flexibility with their approval. }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IEIP712} from "./IEIP712.sol"; /// @title SignatureTransfer /// @notice Handles ERC20 token transfers through signature based actions /// @dev Requires user's token approval on the Permit2 contract interface ISignatureTransfer is IEIP712 { /// @notice Thrown when the requested amount for a transfer is larger than the permissioned amount /// @param maxAmount The maximum amount a spender can request to transfer error InvalidAmount(uint256 maxAmount); /// @notice Thrown when the number of tokens permissioned to a spender does not match the number of tokens being transferred /// @dev If the spender does not need to transfer the number of tokens permitted, the spender can request amount 0 to be transferred error LengthMismatch(); /// @notice Emits an event when the owner successfully invalidates an unordered nonce. event UnorderedNonceInvalidation(address indexed owner, uint256 word, uint256 mask); /// @notice The token and amount details for a transfer signed in the permit transfer signature struct TokenPermissions { // ERC20 token address address token; // the maximum amount that can be spent uint256 amount; } /// @notice The signed permit message for a single token transfer struct PermitTransferFrom { TokenPermissions permitted; // a unique value for every token owner's signature to prevent signature replays uint256 nonce; // deadline on the permit signature uint256 deadline; } /// @notice Specifies the recipient address and amount for batched transfers. /// @dev Recipients and amounts correspond to the index of the signed token permissions array. /// @dev Reverts if the requested amount is greater than the permitted signed amount. struct SignatureTransferDetails { // recipient address address to; // spender requested amount uint256 requestedAmount; } /// @notice Used to reconstruct the signed permit message for multiple token transfers /// @dev Do not need to pass in spender address as it is required that it is msg.sender /// @dev Note that a user still signs over a spender address struct PermitBatchTransferFrom { // the tokens and corresponding amounts permitted for a transfer TokenPermissions[] permitted; // a unique value for every token owner's signature to prevent signature replays uint256 nonce; // deadline on the permit signature uint256 deadline; } /// @notice A map from token owner address and a caller specified word index to a bitmap. Used to set bits in the bitmap to prevent against signature replay protection /// @dev Uses unordered nonces so that permit messages do not need to be spent in a certain order /// @dev The mapping is indexed first by the token owner, then by an index specified in the nonce /// @dev It returns a uint256 bitmap /// @dev The index, or wordPosition is capped at type(uint248).max function nonceBitmap(address, uint256) external view returns (uint256); /// @notice Transfers a token using a signed permit message /// @dev Reverts if the requested amount is greater than the permitted signed amount /// @param permit The permit data signed over by the owner /// @param owner The owner of the tokens to transfer /// @param transferDetails The spender's requested transfer details for the permitted token /// @param signature The signature to verify function permitTransferFrom( PermitTransferFrom memory permit, SignatureTransferDetails calldata transferDetails, address owner, bytes calldata signature ) external; /// @notice Transfers a token using a signed permit message /// @notice Includes extra data provided by the caller to verify signature over /// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition /// @dev Reverts if the requested amount is greater than the permitted signed amount /// @param permit The permit data signed over by the owner /// @param owner The owner of the tokens to transfer /// @param transferDetails The spender's requested transfer details for the permitted token /// @param witness Extra data to include when checking the user signature /// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash /// @param signature The signature to verify function permitWitnessTransferFrom( PermitTransferFrom memory permit, SignatureTransferDetails calldata transferDetails, address owner, bytes32 witness, string calldata witnessTypeString, bytes calldata signature ) external; /// @notice Transfers multiple tokens using a signed permit message /// @param permit The permit data signed over by the owner /// @param owner The owner of the tokens to transfer /// @param transferDetails Specifies the recipient and requested amount for the token transfer /// @param signature The signature to verify function permitTransferFrom( PermitBatchTransferFrom memory permit, SignatureTransferDetails[] calldata transferDetails, address owner, bytes calldata signature ) external; /// @notice Transfers multiple tokens using a signed permit message /// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition /// @notice Includes extra data provided by the caller to verify signature over /// @param permit The permit data signed over by the owner /// @param owner The owner of the tokens to transfer /// @param transferDetails Specifies the recipient and requested amount for the token transfer /// @param witness Extra data to include when checking the user signature /// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash /// @param signature The signature to verify function permitWitnessTransferFrom( PermitBatchTransferFrom memory permit, SignatureTransferDetails[] calldata transferDetails, address owner, bytes32 witness, string calldata witnessTypeString, bytes calldata signature ) external; /// @notice Invalidates the bits specified in mask for the bitmap at the word position /// @dev The wordPos is maxed at type(uint248).max /// @param wordPos A number to index the nonceBitmap at /// @param mask A bitmap masked against msg.sender's current bitmap at the word position function invalidateUnorderedNonces(uint256 wordPos, uint256 mask) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.15; import {ERC20} from 'solmate/src/tokens/ERC20.sol'; /// @title LooksRare Rewards Collector /// @notice Implements a permissionless call to fetch LooksRare rewards earned by Universal Router users /// and transfers them to an external rewards distributor contract interface IRewardsCollector { /// @notice Fetches users' LooksRare rewards and sends them to the distributor contract /// @param looksRareClaim The data required by LooksRare to claim reward tokens function collectRewards(bytes calldata looksRareClaim) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; import {IERC721Receiver} from '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import {IERC1155Receiver} from '@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol'; import {IRewardsCollector} from './IRewardsCollector.sol'; interface IUniversalRouter is IRewardsCollector, IERC721Receiver, IERC1155Receiver { /// @notice Thrown when a required command has failed error ExecutionFailed(uint256 commandIndex, bytes message); /// @notice Thrown when attempting to send ETH directly to the contract error ETHNotAccepted(); /// @notice Thrown when executing commands with an expired deadline error TransactionDeadlinePassed(); /// @notice Thrown when attempting to execute commands and an incorrect number of inputs are provided error LengthMismatch(); /// @notice Executes encoded commands along with provided inputs. Reverts if deadline has expired. /// @param commands A set of concatenated commands, each 1 byte in length /// @param inputs An array of byte strings containing abi encoded inputs for each command /// @param deadline The deadline by which the transaction must be executed function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; library Constants { /// @notice Flooring protocol /// @dev floor token amount of 1 NFT (with 18 decimals) uint256 public constant FLOOR_TOKEN_AMOUNT = 1_000_000 ether; /// @dev The minimum vip level required to use `proxy collection` uint8 public constant PROXY_COLLECTION_VIP_THRESHOLD = 3; /// @notice Rolling Bucket Constant Conf uint256 public constant BUCKET_SPAN_1 = 259199 seconds; // BUCKET_SPAN minus 1, used for rounding up uint256 public constant BUCKET_SPAN = 3 days; uint256 public constant MAX_LOCKING_BUCKET = 240; uint256 public constant MAX_LOCKING_PERIOD = 720 days; // MAX LOCKING BUCKET * BUCKET_SPAN /// @notice Auction Config uint256 public constant FREE_AUCTION_PERIOD = 24 hours; uint256 public constant AUCTION_INITIAL_PERIODS = 24 hours; uint256 public constant AUCTION_COMPLETE_GRACE_PERIODS = 2 days; /// @dev admin fee charged per NFT when someone starts aution on expired safebox uint256 public constant AUCTION_ON_EXPIRED_SAFEBOX_COST = 0; /// @dev admin fee charged per NFT when owner starts aution on himself safebox uint256 public constant AUCTION_COST = 100 ether; /// @notice Raffle Config uint256 public constant RAFFLE_COST = 500 ether; uint256 public constant RAFFLE_COMPLETE_GRACE_PERIODS = 2 days; /// @notice Private offer Config uint256 public constant PRIVATE_OFFER_DURATION = 24 hours; uint256 public constant PRIVATE_OFFER_COMPLETE_GRACE_DURATION = 2 days; uint256 public constant PRIVATE_OFFER_COST = 0; uint256 public constant ADD_FREE_NFT_REWARD = 0; /// @notice Lock/Unlock config uint256 public constant USER_SAFEBOX_QUOTA_REFRESH_DURATION = 1 days; uint256 public constant USER_REDEMPTION_WAIVER_REFRESH_DURATION = 1 days; /// @notice The max percentage of the collection that one user can lock uint256 public constant USER_COLLECTION_LOCKED_BOUND_PCT = 50; /// @notice The max locking ratio of the collection that the NFTs in the vault can be redeemed uint256 public constant VAULT_REDEMPTION_MAX_LOKING_RATIO = 80; uint256 public constant VAULT_QUOTA_RESET_PERIOD = 5 days; /// @notice Activities Fee Rate /// @notice Fee rate used to distribute funds that collected from Auctions on expired safeboxes. /// these auction would be settled using credit token uint256 public constant FREE_AUCTION_FEE_RATE_BIPS = 2000; // 20% uint256 public constant VIP_LEVEL_COUNT = 8; struct AuctionBidOption { uint256 extendDurationSecs; uint256 minimumRaisePct; uint256 vipLevel; } function getVipLockingBuckets( uint256 vipLevel ) internal pure returns (uint256 buckets) { require(vipLevel < VIP_LEVEL_COUNT); assembly { switch vipLevel case 1 { buckets := 1 } case 2 { buckets := 5 } case 3 { buckets := 20 } case 4 { buckets := 60 } case 5 { buckets := 120 } case 6 { buckets := 180 } case 7 { buckets := MAX_LOCKING_BUCKET } } } function getVipLevel(uint256 totalCredit) internal pure returns (uint8) { if (totalCredit < 30_000 ether) { return 0; } else if (totalCredit < 100_000 ether) { return 1; } else if (totalCredit < 300_000 ether) { return 2; } else if (totalCredit < 1_000_000 ether) { return 3; } else if (totalCredit < 3_000_000 ether) { return 4; } else if (totalCredit < 10_000_000 ether) { return 5; } else if (totalCredit < 30_000_000 ether) { return 6; } else { return 7; } } function getVipBalanceRequirements( uint256 vipLevel ) internal pure returns (uint256 required) { require(vipLevel < VIP_LEVEL_COUNT); assembly { switch vipLevel case 1 { required := 30000 } case 2 { required := 100000 } case 3 { required := 300000 } case 4 { required := 1000000 } case 5 { required := 3000000 } case 6 { required := 10000000 } case 7 { required := 30000000 } } /// credit token should be scaled with 18 decimals(1 ether == 10**18) unchecked { return required * 1 ether; } } function getBidOption( uint256 idx ) internal pure returns (AuctionBidOption memory) { require(idx < 4); AuctionBidOption[4] memory bidOptions = [ AuctionBidOption({ extendDurationSecs: 5 minutes, minimumRaisePct: 1, vipLevel: 0 }), AuctionBidOption({ extendDurationSecs: 8 hours, minimumRaisePct: 10, vipLevel: 3 }), AuctionBidOption({ extendDurationSecs: 16 hours, minimumRaisePct: 20, vipLevel: 5 }), AuctionBidOption({ extendDurationSecs: 24 hours, minimumRaisePct: 40, vipLevel: 7 }) ]; return bidOptions[idx]; } function raffleDurations( uint256 idx ) internal pure returns (uint256 vipLevel, uint256 duration) { require(idx < 6); vipLevel = idx; assembly { switch idx case 1 { duration := 1 } case 2 { duration := 2 } case 3 { duration := 3 } case 4 { duration := 5 } case 5 { duration := 7 } } unchecked { duration *= 1 days; } } /// return locking ratio restrictions /// indicates that the vipLevel can utility infinite lock NFTs at corresponding ratio function getLockingRatioForInfinite( uint8 vipLevel ) internal pure returns (uint256 ratio) { assembly { switch vipLevel case 1 { ratio := 0 } case 2 { ratio := 0 } case 3 { ratio := 20 } case 4 { ratio := 30 } case 5 { ratio := 40 } case 6 { ratio := 50 } case 7 { ratio := 80 } } } /// return locking ratio restrictions /// indicates that the vipLevel can utility safebox to lock NFTs at corresponding ratio function getLockingRatioForSafebox( uint8 vipLevel ) internal pure returns (uint256 ratio) { assembly { switch vipLevel case 1 { ratio := 10 } case 2 { ratio := 20 } case 3 { ratio := 30 } case 4 { ratio := 40 } case 5 { ratio := 50 } case 6 { ratio := 60 } case 7 { ratio := 70 } } } function getRequiredStakingWithSelfRatio( uint256 requiredStaking, uint256 selfRatio ) internal pure returns (uint256) { if (selfRatio < 10) { return requiredStaking; } return ((selfRatio + 1) * requiredStaking) / 10; } function getVipRequiredStakingWithDiscount( uint256 requiredStaking, uint8 vipLevel ) internal pure returns (uint256) { if (vipLevel < 3) { return requiredStaking; } unchecked { /// the higher vip level, more discount for staking /// discount range: 5% - 25% return (requiredStaking * (100 - (vipLevel - 2) * 5)) / 100; } } function getRequiredStakingForLockRatio( uint256 locked, uint256 totalManaged ) internal pure returns (uint256) { if (totalManaged <= 0) { return 1200 ether; } unchecked { uint256 lockingRatioPct = (locked * 100) / totalManaged; if (lockingRatioPct <= 40) { return 1200 ether; } else if (lockingRatioPct < 60) { return 1320 ether + ((lockingRatioPct - 40) >> 1) * 120 ether; } else if (lockingRatioPct < 70) { return 2640 ether + ((lockingRatioPct - 60) >> 1) * 240 ether; } else if (lockingRatioPct < 80) { return 4080 ether + ((lockingRatioPct - 70) >> 1) * 480 ether; } else if (lockingRatioPct < 90) { return 6960 ether + ((lockingRatioPct - 80) >> 1) * 960 ether; } else if (lockingRatioPct < 100) { /// 108000 * 2^x return (108000 ether << ((lockingRatioPct - 90) >> 1)) / 5; } else { return 345600 ether; } } } function getVaultAuctionDurationAtLR( uint256 lockingRatio ) internal pure returns (uint256) { if (lockingRatio < 80) return 1 hours; else if (lockingRatio < 85) return 3 hours; else if (lockingRatio < 90) return 6 hours; else if (lockingRatio < 95) return 12 hours; else return 24 hours; } function getSafeboxPeriodQuota( uint8 vipLevel ) internal pure returns (uint16 quota) { assembly { switch vipLevel case 0 { quota := 0 } case 1 { quota := 1 } case 2 { quota := 2 } case 3 { quota := 4 } case 4 { quota := 8 } case 5 { quota := 16 } case 6 { quota := 32 } case 7 { quota := 64 } } } function getSafeboxUserQuota( uint8 vipLevel ) internal pure returns (uint16 quota) { assembly { switch vipLevel case 0 { quota := 0 } case 1 { quota := 4 } case 2 { quota := 8 } case 3 { quota := 16 } case 4 { quota := 32 } case 5 { quota := 64 } case 6 { quota := 128 } case 7 { quota := 256 } } } function getVaultContQuotaAtLR( uint256 lockingRatio ) internal pure returns (uint32 contQuota) { if (lockingRatio <= 70) { return 1; } else if (lockingRatio <= 80) { return 2; } else if (lockingRatio <= 90) { return 4; } else { return 8; } } /// two options to redeem from vault /// pay fee with fragment token or consume quota function getVaultQuotaFeeAtLR( uint256 lockingRatio ) internal pure returns (uint32) { if (lockingRatio <= 50) { return 1; } else { return uint32(2 ** ((lockingRatio - 51) / 10 + 1)); } } function getVaultRedemptionFee( uint256 lockingRatio, uint16 baseRate ) internal pure returns (uint256) { if (lockingRatio <= 50) { return (FLOOR_TOKEN_AMOUNT * baseRate) / 10000; } else { uint256 rate = ((lockingRatio - 51) / 10 + 2) * baseRate; return (FLOOR_TOKEN_AMOUNT * rate) / 10000; } } /// @return protocol fee after discount function getListingProtocolFeeWithDiscount( uint256 protocolFee, uint8 vipLevel ) internal pure returns (uint256) { if (vipLevel < 3) { return protocolFee; } unchecked { /// the higher vip level, more discount for protocol fee /// discount range: 5% - 25% return (protocolFee * (100 - (vipLevel - 2) * 5)) / 100; } } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; library Errors { /// @notice Safe Box error error SafeBoxHasExpire(); error SafeBoxNotExist(); error SafeBoxHasNotExpire(); error SafeBoxAlreadyExist(); error NoMatchingSafeBoxKey(); error SafeBoxKeyAlreadyExist(); /// @notice Auction error error AuctionHasNotCompleted(); error AuctionHasExpire(); error AuctionBidIsNotHighEnough(); error AuctionBidTokenMismatch(); error AuctionSelfBid(); error AuctionInvalidBidAmount(); error AuctionNotExist(); error SafeBoxAuctionWindowHasPassed(); /// @notice Activity common error error NftHasActiveActivities(); error ActivityHasNotCompleted(); error ActivityHasExpired(); error ActivityNotExist(); /// @notice User account error error InsufficientCredit(); error InsufficientBalanceForVipLevel(); error NoPrivilege(); /// @notice Parameter error error InvalidParam(); error NftCollectionNotSupported(); error NftCollectionAlreadySupported(); error ClaimableNftInsufficient(); error TokenNotSupported(); error PeriodQuotaExhausted(); error UserQuotaExhausted(); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import "./interface/IFlooring.sol"; import "./Constants.sol"; import { TicketRecord, SafeBoxKey, SafeBox, FeeConfig, RoyaltyFeeRate, SafeboxFeeRate, VaultFeeRate, Fees, AuctionType } from "./logic/Structs.sol"; import { Multicall } from "./Multicall.sol"; contract FloorGetter is Multicall { IFlooring public immutable _flooring; uint256 private constant COLLECTION_STATES_SLOT = 101; uint256 private constant USER_ACCOUNTS_SLOT = 102; uint256 private constant SUPPORTED_TOKENS_SLOT = 103; uint256 private constant COLLECTION_PROXY_SLOT = 104; uint256 private constant COLLECTION_FEES_SLOT = 105; uint256 private constant MASK_32 = (1 << 32) - 1; uint256 private constant MASK_48 = (1 << 48) - 1; uint256 private constant MASK_64 = (1 << 64) - 1; uint256 private constant MASK_96 = (1 << 96) - 1; uint256 private constant MASK_128 = (1 << 128) - 1; uint256 private constant MASK_160 = (1 << 160) - 1; constructor(address flooring) { _flooring = IFlooring(flooring); } function supportedToken(address token) public view returns (bool) { uint256 val = uint256( _flooring.extsload( keccak256(abi.encode(token, SUPPORTED_TOKENS_SLOT)) ) ); return val != 0; } function collectionProxy(address proxy) public view returns (address) { address underlying = address( uint160( uint256( _flooring.extsload( keccak256(abi.encode(proxy, COLLECTION_PROXY_SLOT)) ) ) ) ); return underlying; } function collectionFee( address collection, address token ) public view returns (FeeConfig memory fee) { bytes memory values = _flooring.extsload( keccak256( abi.encode( token, keccak256(abi.encode(collection, COLLECTION_FEES_SLOT)) ) ), 3 ); uint256 slot1; uint256 slot2; uint256 slot3; assembly { slot1 := mload(add(values, 0x20)) slot2 := mload(add(values, 0x40)) slot3 := mload(add(values, 0x60)) } fee = FeeConfig({ royalty: RoyaltyFeeRate({ receipt: address(uint160(slot1 & MASK_160)), marketlist: uint16((slot1 >> 160) & 0xFFFF), vault: uint16((slot1 >> 176) & 0xFFFF), raffle: uint16((slot1 >> 192) & 0xFFFF) }), safeboxFee: SafeboxFeeRate({ receipt: address(uint160(slot2 & MASK_160)), auctionOwned: uint16((slot2 >> 160) & 0xFFFF), auctionExpired: uint16((slot2 >> 176) & 0xFFFF), raffle: uint16((slot2 >> 192) & 0xFFFF), marketlist: uint16((slot2 >> 208) & 0xFFFF) }), vaultFee: VaultFeeRate({ receipt: address(uint160(slot3 & MASK_160)), vaultAuction: uint16((slot3 >> 160) & 0xFFFFF), redemptionBase: uint16((slot3 >> 176) & 0xFFFFF) }) }); } function fragmentTokenOf( address collection ) public view returns (address token) { bytes32 val = _flooring.extsload( keccak256(abi.encode(collection, COLLECTION_STATES_SLOT)) ); assembly { token := val } } struct CollectionInfo { address fragmentToken; uint256 freeNftLength; uint64 lastUpdatedBucket; uint64 nextKeyId; uint64 activeSafeBoxCnt; uint64 infiniteCnt; uint64 nextActivityId; uint32 lastVaultAuctionPeriodTs; address _contractAddr; } function collectionInfo( address collection ) public view returns (CollectionInfo memory info) { bytes memory val = _flooring.extsload( keccak256(abi.encode(collection, COLLECTION_STATES_SLOT)), 9 ); assembly { mstore(info, mload(add(val, 0x20))) mstore(add(info, 0x20), mload(add(val, mul(3, 0x20)))) let cntVal := mload(add(val, mul(8, 0x20))) mstore(add(info, 0x40), and(cntVal, MASK_64)) mstore(add(info, 0x60), and(shr(64, cntVal), MASK_64)) mstore(add(info, 0x80), and(shr(128, cntVal), MASK_64)) mstore(add(info, 0xA0), and(shr(192, cntVal), MASK_64)) cntVal := mload(add(val, mul(9, 0x20))) mstore(add(info, 0xC0), and(cntVal, MASK_64)) mstore(add(info, 0xE0), and(shr(64, cntVal), MASK_32)) mstore(add(info, 0x100), and(shr(96, cntVal), MASK_160)) } } function getFreeNftIds( address collection, uint256 startIdx, uint256 size ) public view returns (uint256[] memory nftIds) { bytes32 collectionSlot = keccak256( abi.encode(collection, COLLECTION_STATES_SLOT) ); bytes32 nftIdsSlot = bytes32(uint256(collectionSlot) + 2); uint256 freeNftLength = uint256(_flooring.extsload(nftIdsSlot)); if (startIdx >= freeNftLength || size == 0) { return nftIds; } uint256 maxLen = freeNftLength - startIdx; if (size < maxLen) { maxLen = size; } bytes memory arrVal = _flooring.extsload( bytes32(uint256(keccak256(abi.encode(nftIdsSlot))) + startIdx), maxLen ); nftIds = new uint256[](maxLen); assembly { for { let i := 0x20 let end := mul(add(1, maxLen), 0x20) } lt(i, end) { i := add(i, 0x20) } { mstore(add(nftIds, i), mload(add(arrVal, i))) } } } function getSafeBox( address collection, uint256 nftId ) public view returns (SafeBox memory safeBox) { bytes32 collectionSlot = keccak256( abi.encode(underlyingCollection(collection), COLLECTION_STATES_SLOT) ); bytes32 safeBoxMapSlot = bytes32(uint256(collectionSlot) + 3); uint256 val = uint256( _flooring.extsload(keccak256(abi.encode(nftId, safeBoxMapSlot))) ); safeBox.keyId = uint64(val & MASK_64); safeBox.expiryTs = uint32(val >> 64); safeBox.owner = address(uint160(val >> 96)); } function getAuction( address collection, uint256 nftId ) public view returns ( uint96 endTime, address bidToken, uint128 minimumBid, uint128 lastBidAmount, address lastBidder, address triggerAddress, uint64 activityId, AuctionType typ, Fees memory fees ) { bytes32 collectionSlot = keccak256( abi.encode(underlyingCollection(collection), COLLECTION_STATES_SLOT) ); bytes32 auctionMapSlot = bytes32(uint256(collectionSlot) + 4); bytes memory val = _flooring.extsload( keccak256(abi.encode(nftId, auctionMapSlot)), 6 ); uint256 royaltyRate; uint256 protocolRate; assembly { let slotVal := mload(add(val, 0x20)) endTime := and(slotVal, MASK_96) bidToken := shr(96, slotVal) slotVal := mload(add(val, 0x40)) minimumBid := and(slotVal, MASK_96) triggerAddress := shr(96, slotVal) slotVal := mload(add(val, 0x60)) lastBidAmount := and(slotVal, MASK_96) lastBidder := shr(96, slotVal) slotVal := mload(add(val, 0x80)) activityId := and(shr(8, slotVal), MASK_64) typ := and(shr(104, slotVal), 0xFF) royaltyRate := mload(add(val, 0xA0)) protocolRate := mload(add(val, 0xC0)) } fees = parseFees(royaltyRate, protocolRate); } function getRaffle( address collection, uint256 nftId ) public view returns ( uint48 endTime, uint48 maxTickets, address token, uint96 ticketPrice, uint96 collectedFund, uint64 activityId, address owner, uint48 ticketSold, bool isSettling, uint256 ticketsArrLen, Fees memory fees ) { bytes32 raffleMapSlot = bytes32( uint256( keccak256( abi.encode( underlyingCollection(collection), COLLECTION_STATES_SLOT ) ) ) + 5 ); bytes memory val = _flooring.extsload( keccak256(abi.encode(nftId, raffleMapSlot)), 6 ); uint256 royaltyRate; uint256 protocolRate; assembly { let slotVal := mload(add(val, 0x20)) endTime := and(slotVal, MASK_48) maxTickets := and(shr(48, slotVal), MASK_48) token := and(shr(96, slotVal), MASK_160) slotVal := mload(add(val, 0x40)) owner := and(slotVal, MASK_160) ticketPrice := and(shr(160, slotVal), MASK_96) slotVal := mload(add(val, 0x60)) activityId := and(slotVal, MASK_64) collectedFund := and(shr(64, slotVal), MASK_96) ticketSold := and(shr(160, slotVal), MASK_48) isSettling := and(shr(208, slotVal), 0xFF) ticketsArrLen := mload(add(val, 0x80)) royaltyRate := mload(add(val, 0xA0)) protocolRate := mload(add(val, 0xC0)) } fees = parseFees(royaltyRate, protocolRate); } function getRaffleTicketRecords( address collection, uint256 nftId, uint256 startIdx, uint256 size ) public view returns (TicketRecord[] memory tickets) { bytes32 collectionSlot = keccak256( abi.encode(underlyingCollection(collection), COLLECTION_STATES_SLOT) ); bytes32 raffleMapSlot = bytes32(uint256(collectionSlot) + 5); bytes32 ticketRecordsSlot = bytes32( uint256(keccak256(abi.encode(nftId, raffleMapSlot))) + 3 ); uint256 totalRecordsLen = uint256( _flooring.extsload(ticketRecordsSlot) ); if (startIdx >= totalRecordsLen || size == 0) { return tickets; } uint256 maxLen = totalRecordsLen - startIdx; if (size < maxLen) { maxLen = size; } bytes memory arrVal = _flooring.extsload( bytes32( uint256(keccak256(abi.encode(ticketRecordsSlot))) + startIdx ), maxLen ); tickets = new TicketRecord[](maxLen); for (uint256 i; i < maxLen; ++i) { uint256 element; assembly { element := mload(add(arrVal, mul(add(i, 1), 0x20))) } tickets[i].buyer = address(uint160(element & MASK_160)); tickets[i].startIdx = uint48((element >> 160) & MASK_48); tickets[i].endIdx = uint48((element >> 208) & MASK_48); } } function getPrivateOffer( address collection, uint256 nftId ) public view returns ( uint96 endTime, address token, uint96 price, address owner, address buyer, uint64 activityId, Fees memory fees ) { bytes32 collectionSlot = keccak256( abi.encode(underlyingCollection(collection), COLLECTION_STATES_SLOT) ); bytes32 offerMapSlot = bytes32(uint256(collectionSlot) + 6); bytes memory val = _flooring.extsload( keccak256(abi.encode(nftId, offerMapSlot)), 5 ); uint256 royaltyRate; uint256 protocolRate; assembly { let slotVal := mload(add(val, 0x20)) endTime := and(slotVal, MASK_96) token := and(shr(96, slotVal), MASK_160) slotVal := mload(add(val, 0x40)) price := and(slotVal, MASK_96) owner := and(shr(96, slotVal), MASK_160) slotVal := mload(add(val, 0x60)) buyer := and(slotVal, MASK_160) activityId := and(shr(160, slotVal), MASK_64) royaltyRate := mload(add(val, 0x80)) protocolRate := mload(add(val, 0xA0)) } fees = parseFees(royaltyRate, protocolRate); } function tokenBalance( address user, address token ) public view returns (uint256) { bytes32 userSlot = keccak256(abi.encode(user, USER_ACCOUNTS_SLOT)); bytes32 tokenMapSlot = bytes32(uint256(userSlot) + 4); bytes32 balance = _flooring.extsload( keccak256(abi.encode(token, tokenMapSlot)) ); return uint256(balance); } function userAccount( address user ) public view returns ( uint256 minMaintCredit, address firstCollection, uint8 minMaintVipLevel, uint256[] memory vipKeyCnts, uint256 lockedCredit, uint32 lastQuotaPeriodTs, uint16 safeboxQuotaUsed ) { bytes32 userSlot = keccak256(abi.encode(user, USER_ACCOUNTS_SLOT)); bytes memory val = _flooring.extsload(userSlot, 6); uint256 vipInfo; assembly { let slotVal := mload(add(val, 0x20)) minMaintCredit := and(slotVal, MASK_96) firstCollection := and(shr(96, slotVal), MASK_160) vipInfo := mload(add(val, 0x40)) lockedCredit := mload(add(val, 0x60)) slotVal := mload(add(val, 0xC0)) lastQuotaPeriodTs := and(slotVal, MASK_32) safeboxQuotaUsed := and(shr(32, slotVal), 0xFFFF) } vipKeyCnts = new uint256[](Constants.VIP_LEVEL_COUNT); minMaintVipLevel = uint8((vipInfo >> 240) & 0xFF); for (uint256 i; i < Constants.VIP_LEVEL_COUNT; ++i) { vipKeyCnts[i] = (vipInfo >> (i * 24)) & 0xFFFFFF; } } function userCollection( address user, address collection, uint256 nftId ) public view returns ( uint256 totalLockingCredit, address next, uint32 keyCnt, uint32 vaultContQuota, uint32 lastVaultActiveTs, SafeBoxKey memory key ) { bytes32 userSlot = keccak256(abi.encode(user, USER_ACCOUNTS_SLOT)); bytes32 collectionSlot = keccak256( abi.encode( underlyingCollection(collection), bytes32(uint256(userSlot) + 3) ) ); bytes32 collectionKeysSlot = keccak256( abi.encode(nftId, collectionSlot) ); bytes memory vals = _flooring.extsload( bytes32(uint256(collectionSlot) + 1), 2 ); assembly { let slotVal := mload(add(vals, 0x20)) totalLockingCredit := and(slotVal, MASK_96) next := and(shr(96, slotVal), MASK_160) slotVal := mload(add(vals, 0x40)) keyCnt := and(slotVal, MASK_32) vaultContQuota := and(shr(32, slotVal), MASK_32) lastVaultActiveTs := and(shr(64, slotVal), MASK_32) } { uint256 val = uint256(_flooring.extsload(collectionKeysSlot)); key.lockingCredit = uint96(val & MASK_96); key.keyId = uint64((val >> 96) & MASK_64); key.vipLevel = uint8((val >> 160) & 0xFF); } } function underlyingCollection( address collection ) private view returns (address) { address underlying = collectionProxy(collection); if (underlying == address(0)) { return collection; } return underlying; } function parseFees( uint256 royalty, uint256 protocol ) private pure returns (Fees memory fees) { fees.royalty.receipt = address(uint160(royalty & MASK_160)); fees.royalty.rateBips = uint16(royalty >> 160); fees.protocol.receipt = address(uint160(protocol & MASK_160)); fees.protocol.rateBips = uint16(protocol >> 160); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "./IMulticall.sol"; interface IFlooring is IERC721Receiver, IMulticall { /// Admin Operations struct NewCollectionParam { /// @notice The Collection Id in the Floor Protocol /// It is maybe different from the collection contract address address collectionId; /// @notice The Contract Address of the collection address contractAddr; /// @notice The fragment token of the collection address fragmentToken; } /// @notice Add new collection for Flooring Protocol function supportNewCollection( NewCollectionParam calldata param ) external payable; /// @notice Add new token which will be used as settlement token in Flooring Protocol /// @param addOrRemove `true` means add token, `false` means remove token function supportNewToken( address _tokenAddress, bool addOrRemove ) external payable; /// @notice set proxy collection config /// Note. the `tokenId`s of the proxy collection and underlying collection must be correspond one by one /// eg. Paraspace Derivative Token BAYC(nBAYC) -> BAYC function setCollectionProxy( address proxyCollection, address underlyingCollection ) external payable; /// @notice withdraw platform fee accumulated. /// Note. withdraw from `address(this)`'s account. function withdrawPlatformFee( address token, uint256 amount ) external payable; /// @notice Deposit and lock credit token on behalf of receiver /// user can not withdraw these tokens until `unlockCredit` is called. function addAndLockCredit( address receiver, uint256 amount ) external payable; /// @notice Unlock user credit token to allow withdraw /// used to release investors' funds as time goes /// Note. locked credit can be used to operate safeboxes(lock/unlock...) function unlockCredit(address receiver, uint256 amount) external payable; /// User Operations /// @notice User deposits token to the Floor Contract /// @param onBehalfOf deposit token into `onBehalfOf`'s account.(note. the tokens of msg.sender will be transfered) function addTokens( address onBehalfOf, address token, uint256 amount ) external payable; /// @notice User removes token from Floor Contract /// @param receiver who will receive the funds.(note. the token of msg.sender will be transfered) function removeTokens( address token, uint256 amount, address receiver ) external; /// @notice Lock specified `nftIds` into Flooring Safeboxes /// and receive corresponding Fragment Tokens of the `collection` /// @param expiryTs when the safeboxes expired, `0` means infinite lock without expiry /// @param vipLevel vip tier required in this lock operation /// @param maxCredit maximum credit can be locked in this operation, /// if real cost exceeds this limit, the tx will fail /// @param onBehalfOf who will receive the safebox and fragment tokens. /// (note. the NFTs of the msg.sender will be transfered) function lockNFTs( address collectionId, uint256[] memory nftIds, uint256 expiryTs, uint256 vipLevel, uint256 maxCredit, address onBehalfOf ) external returns (uint256); /// @notice Extend the exist safeboxes with longer lock duration with more credit token staked /// @param expiryTs new expiry timestamp, should bigger than previous expiry function extendKeys( address collectionId, uint256[] memory nftIds, uint256 expiryTs, uint256 vipLevel, uint256 maxCredit ) external returns (uint256); /// @notice Unlock specified `nftIds` which had been locked previously /// sender's wallet should have enough Fragment Tokens of the `collection` /// which will be burned to redeem the NFTs /// @param expiryTs the latest nft's expiry, we need this to clear locking records /// if the value smaller than the latest nft's expiry, the tx will fail /// if part of `nftIds` were locked infinitely, just skip these expiry /// @param receiver who will receive the NFTs. /// note. - The safeboxes of the msg.sender will be removed. /// - The Fragment Tokens of the msg.sender will be burned. function unlockNFTs( address collectionId, uint256 expiryTs, uint256[] memory nftIds, address receiver ) external; /// @notice Fragment specified `nftIds` into Floor Vault and receive Fragment Tokens without any locking /// after fragmented, any one has enough Fragment Tokens can redeem there `nftIds` /// @param onBehalfOf who will receive the fragment tokens and the vault contribution quota. /// (note. the NFTs of the msg.sender will be transfered) /// if onBehalfOf == address(this), /// it means msg.sender intends to swap the same quantity of NFTs from the vault as the `nftIds` function fragmentNFTs( address collectionId, uint256[] memory nftIds, address onBehalfOf ) external; /// @notice Kick expired safeboxes to the vault function tidyExpiredNFTs( address collectionId, uint256[] memory nftIds ) external; /// @notice Randomly claim `claimCnt` NFTs from Floor Vault /// sender's wallet should have enough Fragment Tokens of the `collection` /// which will be burned to redeem the NFTs /// @param maxCredit maximum credit can be costed in this operation, /// if real cost exceeds this limit, the tx will fail /// @param receiver who will receive the NFTs. /// note. - the msg.sender will pay the redemption cost. /// - The Fragment Tokens of the msg.sender will be burned. function claimRandomNFT( address collectionId, uint256 claimCnt, uint256 maxCredit, address receiver ) external returns (uint256); /// @notice Start auctions on specified `nftIds` with an initial bid price(`bidAmount`) /// This kind of auctions will be settled with Floor Credit Token /// @param bidAmount initial bid price function initAuctionOnExpiredSafeBoxes( address collectionId, uint256[] memory nftIds, address bidToken, uint256 bidAmount ) external; /// @notice Start auctions on specified `nftIds` index in the vault with an initial bid price(`bidAmount`) /// This kind of auctions will be settled with Fragment Token of the collection /// @param bidAmount initial bid price function initAuctionOnVault( address collectionId, uint256[] memory vaultIdx, address bidToken, uint96 bidAmount ) external; /// @notice Owner starts auctions on his locked Safeboxes /// @param maxExpiry the latest nft's expiry, we need this to clear locking records /// @param token which token should be used to settle auctions(bid, settle) /// @param minimumBid minimum bid price when someone place a bid on the auction function ownerInitAuctions( address collectionId, uint256[] memory nftIds, uint256 maxExpiry, address token, uint256 minimumBid ) external; /// @notice Place a bid on specified `nftId`'s action /// @param bidAmount bid price /// @param bidOptionIdx which option used to extend auction expiry and bid price function placeBidOnAuction( address collectionId, uint256 nftId, uint256 bidAmount, uint256 bidOptionIdx ) external payable; /// @notice Settle auctions of `nftIds` function settleAuctions( address collectionId, uint256[] memory nftIds ) external; struct RaffleInitParam { address collectionId; uint256[] nftIds; /// @notice which token used to buy and settle raffle address ticketToken; /// @notice price per ticket uint96 ticketPrice; /// @notice max tickets amount can be sold uint32 maxTickets; /// @notice durationIdx used to get how long does raffles last uint256 duration; /// @notice the largest epxiry of nfts, we need this to clear locking records uint256 maxExpiry; } /// @notice Owner start raffles on locked `nftIds` function ownerInitRaffles(RaffleInitParam memory param) external; /// @notice Buy `nftId`'s raffle tickets /// @param ticketCnt how many tickets should be bought in this operation function buyRaffleTickets( address collectionId, uint256 nftId, uint256 ticketCnt ) external payable; /// @notice Settle raffles of `nftIds` function settleRaffles( address collectionId, uint256[] memory nftIds ) external; struct PrivateOfferInitParam { address collectionId; uint256[] nftIds; /// @notice the largest epxiry of nfts, we need this to clear locking records uint256 maxExpiry; /// @notice who will receive the otc offers address receiver; /// @notice which token used to settle offers address token; /// @notice price of the offers uint96 price; } /// @notice Owner start private offers(otc) on locked `nftIds` function ownerInitPrivateOffers( PrivateOfferInitParam memory param ) external; enum OfferOpType { Cancel, Decline, ChangePrice } struct ChangeOfferPriceData { uint96[] priceList; } /// @notice Owner or Receiver cancel the private offers of `nftIds` function modifyOffers( address collectionId, uint256[] memory nftIds, OfferOpType opTy, bytes calldata data ) external; /// @notice Receiver accept the private offers of `nftIds` function buyerAcceptPrivateOffers( address collectionId, uint256[] memory nftIds, uint256 maxSafeboxExpiry ) external payable; /// @notice Clear expired or mismatching safeboxes of `nftIds` in user account /// @param onBehalfOf whose account will be recalculated /// @return credit amount has been released function removeExpiredKeyAndRestoreCredit( address collectionId, uint256[] memory nftIds, address onBehalfOf, bool verifyLocking ) external returns (uint256); /// @notice Update user's staking credit status by iterating all active collections in user account /// @param onBehalfOf whose account will be recalculated /// @return availableCredit how many credit available to use after this opeartion function recalculateAvailableCredit( address onBehalfOf ) external returns (uint256 availableCredit); /// Util operations /// @notice Called by external contracts to access granular pool state /// @param slot Key of slot to sload /// @return value The value of the slot as bytes32 function extsload(bytes32 slot) external view returns (bytes32 value); /// @notice Called by external contracts to access granular pool state /// @param slot Key of slot to start sloading from /// @param nSlots Number of slots to load into return value /// @return value The value of the sload-ed slots concatenated as dynamic bytes function extsload( bytes32 slot, uint256 nSlots ) external view returns (bytes memory value); function creditToken() external view returns (address); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; interface IFragmentToken { error CallerIsNotTrustedContract(); function mint(address account, uint256 amount) external; function burn(address account, uint256 amount) external; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; /// @title Multicall interface /// @notice Enables calling multiple methods in a single call to the contract interface IMulticall { /** * @dev A call to an address target failed. The target may have reverted. */ error FailedMulticall(); /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed /// @param data The encoded function data for each of the calls to make to this contract /// @return results The results from each of the calls passed in via data function multicall( bytes[] calldata data ) external returns (bytes[] memory results); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// @title Interface for WETH9 interface IWETH9 is IERC20 { /// @notice Deposit ether to get wrapped ether function deposit() external payable; /// @notice Withdraw wrapped ether to get ether function withdraw(uint256) external; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; library CurrencyTransfer { /// @notice Thrown when an ERC20 transfer fails error ERC20TransferFailed(); /// @notice Thrown when an NATIVE transfer fails error NativeTransferFailed(); address public constant NATIVE = address(0); function safeTransfer(address token, address to, uint256 amount) internal { // ref // https://docs.soliditylang.org/en/latest/internals/layout_in_memory.html // implementation from // https://github.com/transmissions11/solmate/blob/v7/src/utils/SafeTransferLib.sol // https://github.com/Uniswap/v4-core/blob/main/contracts/types/Currency.sol bool success; if (token == NATIVE) { assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } if (!success) revert NativeTransferFailed(); } else { /// @solidity memory-safe-assembly assembly { // We'll write our calldata to this slot below, but restore it later. let memPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore( 0, 0xa9059cbb00000000000000000000000000000000000000000000000000000000 ) mstore(4, to) // Append the "to" argument. mstore(36, amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or( and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize()) ), // We use 68 because that's the total length of our calldata (4 + 32 * 2) // Counterintuitively, this call() must be positioned after the or() in the // surrounding and() because and() evaluates its arguments from right to left. call(gas(), token, 0, 0, 68, 0, 32) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, memPointer) // Restore the memPointer. } if (!success) revert ERC20TransferFailed(); } } function safeTransferFrom( address token, address from, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let memPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore( 0, 0x23b872dd00000000000000000000000000000000000000000000000000000000 ) mstore(4, from) // Append and mask the "from" argument. mstore(36, to) // Append and mask the "to" argument. // Append the "amount" argument. Masking not required as it's a full 32 byte type. mstore(68, amount) success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or( and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize()) ), // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, 0, 100, 0, 32) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, memPointer) // Restore the memPointer. } if (!success) revert ERC20TransferFailed(); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; library ERC721Transfer { /// @notice Thrown when an ERC721 transfer fails error ERC721TransferFailed(); function safeTransferFrom( address collection, address from, address to, uint256 tokenId ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let memPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore( 0, 0x42842e0e00000000000000000000000000000000000000000000000000000000 ) mstore(4, from) // Append and mask the "from" argument. mstore(36, to) // Append and mask the "to" argument. // Append the "tokenId" argument. Masking not required as it's a full 32 byte type. mstore(68, tokenId) success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or( and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize()) ), // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), collection, 0, 0, 100, 0, 32) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, memPointer) // Restore the memPointer. } if (!success) revert ERC721TransferFailed(); } function safeBatchTransferFrom( address collection, address from, address to, uint256[] memory tokenIds ) internal { unchecked { uint256 len = tokenIds.length; for (uint256 i; i < len; ++i) { safeTransferFrom(collection, from, to, tokenIds[i]); } } } function safeBatchTransferFromCalldata( address collection, address from, address to, uint256[] calldata tokenIds ) internal { unchecked { uint256 len = tokenIds.length; for (uint256 i; i < len; ++i) { safeTransferFrom(collection, from, to, tokenIds[i]); } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @notice Simple single owner authorization mixin. /// @author modified from Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/auth/Owned.sol) abstract contract OwnedUpgradeable { error Unauthorized(); event OwnerUpdated(address indexed user, address indexed newOwner); address public owner; modifier onlyOwner() virtual { checkOwner(); _; } function checkOwner() internal view { if (msg.sender != owner) revert Unauthorized(); } function __Owned_init() internal { owner = msg.sender; } function setOwner(address newOwner) public virtual onlyOwner { owner = newOwner; emit OwnerUpdated(msg.sender, newOwner); } uint256[49] private __gap; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import { SafeBox, SafeBoxKey } from "./Structs.sol"; library SafeBoxLib { uint64 public constant SAFEBOX_KEY_NOTATION = type(uint64).max; function isInfiniteSafeBox( SafeBox storage safeBox ) internal view returns (bool) { return safeBox.expiryTs == 0; } function isSafeBoxExpired( SafeBox storage safeBox ) internal view returns (bool) { return safeBox.expiryTs != 0 && safeBox.expiryTs < block.timestamp; } function _isSafeBoxExpired( SafeBox memory safeBox ) internal view returns (bool) { return safeBox.expiryTs != 0 && safeBox.expiryTs < block.timestamp; } function isKeyMatchingSafeBox( SafeBox storage safeBox, SafeBoxKey storage safeBoxKey ) internal view returns (bool) { return safeBox.keyId == safeBoxKey.keyId; } function _isKeyMatchingSafeBox( SafeBox memory safeBox, SafeBoxKey memory safeBoxKey ) internal pure returns (bool) { return safeBox.keyId == safeBoxKey.keyId; } function encodeSafeBoxKey( SafeBoxKey memory key ) internal pure returns (uint256) { uint256 val = key.lockingCredit; val |= (uint256(key.keyId) << 96); val |= (uint256(key.vipLevel) << 160); return val; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import "../interface/IFragmentToken.sol"; struct SafeBox { /// Either matching a key OR Constants.SAFEBOX_KEY_NOTATION meaning temporarily /// held by a bidder in auction. uint64 keyId; /// The timestamp that the safe box expires. uint32 expiryTs; /// The owner of the safebox. It maybe outdated due to expiry address owner; } struct PrivateOffer { /// private offer end time uint96 endTime; /// which token used to accpet the offer address token; /// price of the offer uint96 price; address owner; /// who should receive the offer address buyer; uint64 activityId; Fees fees; } enum AuctionType { Owned, Expired, Vault } struct AuctionInfo { /// The end time for the auction. uint96 endTime; /// Bid token address. address bidTokenAddress; /// Minimum Bid. uint96 minimumBid; /// The person who trigger the auction at the beginning. address triggerAddress; uint96 lastBidAmount; address lastBidder; /// [Deprecated] Whether the auction is triggered by the NFT owner itself? /// Note. Don't remove it directly as we need keep mainnet contract layout bool isSelfTriggered; uint64 activityId; /// [Deprecated] fee config /// Note. Don't remove it directly as we need keep mainnet contract layout uint32 oldFeeRateBips; AuctionType typ; Fees fees; } struct TicketRecord { /// who buy the tickets address buyer; /// Start index of tickets /// [startIdx, endIdx) uint48 startIdx; /// End index of tickets uint48 endIdx; } struct RaffleInfo { /// raffle end time uint48 endTime; /// max tickets amount the raffle can sell uint48 maxTickets; /// which token used to buy the raffle tickets address token; /// owner of raffle address owner; /// price per ticket uint96 ticketPrice; uint64 activityId; /// total funds collected by selling tickets uint96 collectedFund; /// total sold tickets amount uint48 ticketSold; /// whether the raffle is being settling bool isSettling; /// tickets sold records TicketRecord[] tickets; Fees fees; } struct CollectionState { /// The address of the Floor Token cooresponding to the NFTs. IFragmentToken floorToken; /// Records the active safe box in each time bucket. mapping(uint256 => uint256) countingBuckets; /// Stores all of the NFTs that has been fragmented but *without* locked up limit. uint256[] freeTokenIds; /// Huge map for all the `SafeBox`es in one collection. mapping(uint256 => SafeBox) safeBoxes; /// Stores all the ongoing auctions: nftId => `AuctionInfo`. mapping(uint256 => AuctionInfo) activeAuctions; /// Stores all the ongoing raffles: nftId => `RaffleInfo`. mapping(uint256 => RaffleInfo) activeRaffles; /// Stores all the ongoing private offers: nftId => `PrivateOffer`. mapping(uint256 => PrivateOffer) activePrivateOffers; /// The last bucket time the `countingBuckets` is updated. uint64 lastUpdatedBucket; /// Next Key Id. This should start from 1, we treat key id `SafeboxLib.SAFEBOX_KEY_NOTATION` as temporarily /// being used for activities(auction/raffle). uint64 nextKeyId; /// Active Safe Box Count. uint64 activeSafeBoxCnt; /// The number of infinite lock count. uint64 infiniteCnt; /// Next Activity Id. This should start from 1 uint64 nextActivityId; uint32 lastVaultAuctionPeriodTs; /// The contract address of the collection, used to transfer /// it could be different from the collection id address _contractAddr; } struct UserFloorAccount { /// @notice it should be maximum of the `totalLockingCredit` across all collections uint96 minMaintCredit; /// @notice used to iterate collection accounts /// packed with `minMaintCredit` to reduce storage slot access address firstCollection; /// @notice user vip level related info /// 0 - 239 bits: store SafeBoxKey Count per vip level, per level using 24 bits /// 240 - 247 bits: store minMaintVipLevel /// 248 - 255 bits: remaining uint256 vipInfo; /// @notice Locked Credit amount which cannot be withdrawn and will be released as time goes. uint256 lockedCredit; mapping(address => CollectionAccount) accounts; mapping(address => uint256) tokenAmounts; /// Each account has safebox quota to use per period uint32 lastQuotaPeriodTs; uint16 safeboxQuotaUsed; /// [Deprecated] Each account has vault redemption waiver per period uint32 lastWaiverPeriodTs; uint96 creditWaiverUsed; } struct SafeBoxKey { /// locked credit amount of this safebox uint96 lockingCredit; /// corresponding key id of the safebox uint64 keyId; /// which vip level the safebox locked uint8 vipLevel; } struct CollectionAccount { mapping(uint256 => SafeBoxKey) keys; /// total locking credit of all `keys` in this collection uint96 totalLockingCredit; /// track next collection as linked list address next; /// tracking total locked of the collection uint32 keyCnt; /// Depositing to vault gets quota, redepmtion consumes quota uint32 vaultContQuota; /// Used to track and clear vault contribution quota when the quota is inactive for a certain duration uint32 lastVaultActiveTs; } struct Fees { FeeRate royalty; FeeRate protocol; } struct FeeConfig { RoyaltyFeeRate royalty; SafeboxFeeRate safeboxFee; VaultFeeRate vaultFee; } struct RoyaltyFeeRate { address receipt; uint16 marketlist; uint16 vault; uint16 raffle; } struct VaultFeeRate { address receipt; uint16 vaultAuction; uint16 redemptionBase; } struct SafeboxFeeRate { address receipt; uint16 auctionOwned; uint16 auctionExpired; uint16 raffle; uint16 marketlist; } struct FeeRate { address receipt; uint16 rateBips; } /// Internal Structure struct LockParam { address proxyCollectionId; address collectionId; uint256[] nftIds; uint256 expiryTs; uint8 vipLevel; uint256 maxCreditCost; address creditToken; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import "./interface/IMulticall.sol"; /// @title Multicall /// @notice Enables calling multiple methods in a single call to the contract abstract contract Multicall is IMulticall { /// @inheritdoc IMulticall function multicall( bytes[] calldata data ) external virtual override returns (bytes[] memory) { bytes[] memory results = new bytes[](data.length); for (uint256 i; i < data.length; ) { /// @custom:oz-upgrades-unsafe-allow-reachable delegatecall (bool success, bytes memory result) = address(this).delegatecall( data[i] ); if (success) { results[i] = result; } else { // Next 4 lines from // https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/ // blob/master/contracts/utils/AddressUpgradeable.sol#L229 if (result.length > 0) { assembly { let returndata_size := mload(result) revert(add(32, result), returndata_size) } } else { revert FailedMulticall(); } } unchecked { ++i; } } return results; } }
{ "metadata": { "bytecodeHash": "none", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 800 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_floor","type":"address"},{"internalType":"address","name":"_floorGetter","type":"address"},{"internalType":"address","name":"_universalRouter","type":"address"},{"internalType":"address","name":"permit2","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"ERC721TransferFailed","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InsufficientWETH9","type":"error"},{"inputs":[],"name":"InvalidClaimFee","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidParameter","type":"error"},{"inputs":[],"name":"InvalidPermitOwner","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"WrongEthSender","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"PERMIT2","outputs":[{"internalType":"contract IPermit2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNIVERSAL_ROUTER","outputs":[{"internalType":"contract IUniversalRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"collectionId","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"maxClaimFee","type":"uint256"},{"internalType":"uint256","name":"claimCnt","type":"uint256"}],"internalType":"struct FloorPeriphery.FloorClaim[]","name":"claimParams","type":"tuple[]"},{"components":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct FloorPeriphery.UniversalRouterExecute","name":"swapParam","type":"tuple"},{"internalType":"enum FloorPeriphery.TransferWay","name":"transferWay","type":"uint8"},{"internalType":"bytes","name":"transferParam","type":"bytes"}],"name":"buyAndClaimExpired","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"collectionId","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"maxClaimFee","type":"uint256"},{"internalType":"uint256","name":"claimCnt","type":"uint256"}],"internalType":"struct FloorPeriphery.FloorClaim","name":"claimParams","type":"tuple"},{"components":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct FloorPeriphery.UniversalRouterExecute","name":"swapParam","type":"tuple"},{"internalType":"enum FloorPeriphery.TransferWay","name":"transferWay","type":"uint8"},{"internalType":"bytes","name":"transferParam","type":"bytes"}],"name":"buyAndClaimExpired","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"collectionId","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"maxClaimFee","type":"uint256"},{"internalType":"uint256","name":"claimCnt","type":"uint256"}],"internalType":"struct FloorPeriphery.FloorClaim[]","name":"claimParams","type":"tuple[]"},{"components":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct FloorPeriphery.UniversalRouterExecute","name":"swapParam","type":"tuple"},{"internalType":"enum FloorPeriphery.TransferWay","name":"transferWay","type":"uint8"},{"internalType":"bytes","name":"transferParam","type":"bytes"}],"name":"buyAndClaimVault","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"collectionId","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"maxClaimFee","type":"uint256"},{"internalType":"uint256","name":"claimCnt","type":"uint256"}],"internalType":"struct FloorPeriphery.FloorClaim","name":"claimParams","type":"tuple"},{"components":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct FloorPeriphery.UniversalRouterExecute","name":"swapParam","type":"tuple"},{"internalType":"enum FloorPeriphery.TransferWay","name":"transferWay","type":"uint8"},{"internalType":"bytes","name":"transferParam","type":"bytes"}],"name":"buyAndClaimVault","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"floor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"floorGetter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"collectionId","type":"address"},{"internalType":"address","name":"collectionContract","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"internalType":"struct FloorPeriphery.FloorFragment[]","name":"fragmentParams","type":"tuple[]"},{"components":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct FloorPeriphery.UniversalRouterExecute","name":"swapParam","type":"tuple"},{"internalType":"enum FloorPeriphery.TransferWay","name":"transferWay","type":"uint8"},{"internalType":"bytes","name":"transferParam","type":"bytes"}],"name":"fragmentAndSell","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"collectionId","type":"address"},{"internalType":"address","name":"collectionContract","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"internalType":"struct FloorPeriphery.FloorFragment","name":"fragmentParam","type":"tuple"},{"components":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct FloorPeriphery.UniversalRouterExecute","name":"swapParam","type":"tuple"},{"internalType":"enum FloorPeriphery.TransferWay","name":"transferWay","type":"uint8"},{"internalType":"bytes","name":"transferParam","type":"bytes"}],"name":"fragmentAndSell","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"setOwner","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
61012060408190523060805262002dfa388190039081908339810160408190526200002a916200006a565b6001600160a01b0393841660e05291831661010052821660a0521660c052620000c4565b80516001600160a01b038116811462000065575f80fd5b919050565b5f805f80608085870312156200007e575f80fd5b62000089856200004e565b935062000099602086016200004e565b9250620000a9604086016200004e565b9150620000b9606086016200004e565b905092959194509250565b60805160a05160c05160e05161010051612c57620001a35f395f81816103890152610e1001525f8181610229015281816107fb015281816108ec01528181610e8901528181610eda01528181610f670152818161103f015261108501525f81816102bc01528181610a1f01528181610ace01528181610bbe01528181610c1c01528181611140015281816111ca0152818161126f01526112c901525f818161011c015281816103cf015281816104f00152818161061601528181610cc40152610d5901525f818161132f0152818161135801526114c50152612c575ff3fe60806040526004361061010c575f3560e01c80635b8d8b33116100a1578063ab6a73eb11610071578063e89a7aed11610057578063e89a7aed14610378578063e8ad7f68146103ab578063e8dd7fc3146103be575f80fd5b8063ab6a73eb14610310578063ad3cb1cc14610323575f80fd5b80635b8d8b33146102985780636afdd850146102ab5780638129fc1c146102de5780638da5cb5b146102f2575f80fd5b80632c5fcdc5116100dc5780632c5fcdc51461020557806340695363146102185780634f1ef2861461026357806352d1902d14610276575f80fd5b806311bfa5901461015f57806313af403514610172578063150b7a02146101915780632582de55146101f2575f80fd5b3661015b57336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101595760405162ffa65f60e11b815260040160405180910390fd5b005b5f80fd5b61015961016d366004611bd2565b6103f1565b34801561017d575f80fd5b5061015961018c366004611cd8565b610445565b34801561019c575f80fd5b506101bc6101ab366004611cf3565b630a85bd0160e11b95945050505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020015b60405180910390f35b610159610200366004611dbb565b6104a4565b610159610213366004611e5e565b610586565b348015610223575f80fd5b5061024b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101e9565b610159610271366004611f16565b6105ab565b348015610281575f80fd5b5061028a6105ca565b6040519081526020016101e9565b6101596102a6366004611f63565b6105f8565b3480156102b6575f80fd5b5061024b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102e9575f80fd5b506101596106ab565b3480156102fd575f80fd5b505f5461024b906001600160a01b031681565b61015961031e366004611bd2565b6107ed565b34801561032e575f80fd5b5061036b6040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516101e99190611fe7565b348015610383575f80fd5b5061024b7f000000000000000000000000000000000000000000000000000000000000000081565b6101596103b9366004611e5e565b6108ce565b3480156103c9575f80fd5b5061024b7f000000000000000000000000000000000000000000000000000000000000000081565b6103fc838383610959565b6104068385610c95565b84515f5b8181101561043c5761043487828151811061042757610427611ff9565b6020026020010151610de3565b60010161040a565b50505050505050565b61044d611002565b5f805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b84515f5b818110156104da576104d28782815181106104c5576104c5611ff9565b602002602001015161102d565b6001016104a8565b506104e6848484610959565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016633593564c61051f878061200d565b61052c60208a018a612050565b8a604001356040518663ffffffff1660e01b81526004016105519594939291906120be565b5f604051808303815f87803b158015610568575f80fd5b505af115801561057a573d5f803e3d5ffd5b50505050505050505050565b6105918383836110be565b61059b8385610c95565b6105a485610de3565b5050505050565b6105b3611324565b6105bc826113db565b6105c682826113e6565b5050565b5f6105d36114ba565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b6106018561102d565b61060c8383836110be565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016633593564c610645868061200d565b6106526020890189612050565b89604001356040518663ffffffff1660e01b81526004016106779594939291906120be565b5f604051808303815f87803b15801561068e575f80fd5b505af11580156106a0573d5f803e3d5ffd5b505050505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff165f811580156106f55750825b90505f8267ffffffffffffffff1660011480156107115750303b155b90508115801561071f575080155b1561073d5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561077157845468ff00000000000000001916680100000000000000001785555b6107945f805473ffffffffffffffffffffffffffffffffffffffff191633179055565b61079c611503565b83156105a457845468ff000000000000000019168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050565b84515f5b818110156108b8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166364d5d9fa88838151811061083a5761083a611ff9565b60200260200101515f015189848151811061085757610857611ff9565b6020026020010151602001516040518363ffffffff1660e01b81526004016108809291906121ad565b5f604051808303815f87803b158015610897575f80fd5b505af11580156108a9573d5f803e3d5ffd5b505050508060010190506107f1565b506108c686868686866103f1565b505050505050565b8451602086015160405163326aecfd60e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016926364d5d9fa9261091f926004016121ad565b5f604051808303815f87803b158015610936575f80fd5b505af1158015610948573d5f803e3d5ffd5b505050506105a48585858585610586565b600383600381111561096d5761096d6121d6565b0361097757505050565b5f83600381111561098a5761098a6121d6565b03610a87575f61099c8284018461229d565b90505f5b8151811015610a0757336001600160a01b03168282815181106109c5576109c5611ff9565b60200260200101515f01516001600160a01b0316146109f7576040516334513eed60e21b815260040160405180910390fd5b610a00816122cf565b90506109a0565b50604051630d58b1db60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630d58b1db90610a549084906004016122f3565b5f604051808303815f87803b158015610a6b575f80fd5b505af1158015610a7d573d5f803e3d5ffd5b5050505050505050565b6001836003811115610a9b57610a9b6121d6565b03610bf2575f610aad828401846123dd565b80516020820151604051632a2d80d160e01b81529293506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692632a2d80d192610b0392339260040161252d565b5f604051808303815f87803b158015610b1a575f80fd5b505af1158015610b2c573d5f803e3d5ffd5b505050505f5b816040015151811015610ba157336001600160a01b031682604001518281518110610b5f57610b5f611ff9565b60200260200101515f01516001600160a01b031614610b91576040516334513eed60e21b815260040160405180910390fd5b610b9a816122cf565b9050610b32565b506040808201519051630d58b1db60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691630d58b1db91610a5491906004016122f3565b6002836003811115610c0657610c066121d6565b03610c77575f610c18828401846126cc565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663edd9444b825f015183602001513385604001516040518563ffffffff1660e01b8152600401610a549493929190612807565b604051630309cb8760e51b815260040160405180910390fd5b505050565b6003826003811115610ca957610ca96121d6565b148015610cb557505f47115b15610d4f576001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016633593564c47610cf4848061200d565b610d016020870187612050565b87604001356040518763ffffffff1660e01b8152600401610d269594939291906120be565b5f604051808303818588803b158015610d3d575f80fd5b505af115801561043c573d5f803e3d5ffd5b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016633593564c610d88838061200d565b610d956020860186612050565b86604001356040518663ffffffff1660e01b8152600401610dba9594939291906120be565b5f604051808303815f87803b158015610dd1575f80fd5b505af11580156108c6573d5f803e3d5ffd5b8051606082015160408084015190516316063a8760e21b81526001600160a01b0380851660048301525f917f000000000000000000000000000000000000000000000000000000000000000090911690635818ea1c90602401602060405180830381865afa158015610e57573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e7b91906128c6565b90508115610f3257610eae817f00000000000000000000000000000000000000000000000000000000000000008461150b565b6040516346d5785160e11b81523060048201526001600160a01b038281166024830152604482018490527f00000000000000000000000000000000000000000000000000000000000000001690638daaf0a2906064015f604051808303815f87803b158015610f1b575f80fd5b505af1158015610f2d573d5f803e3d5ffd5b505050505b60405163fdbed69960e01b81526001600160a01b03858116600483015260248201859052604482018490523360648301525f917f00000000000000000000000000000000000000000000000000000000000000009091169063fdbed699906084016020604051808303815f875af1158015610faf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fd391906128e1565b90505f83118015610fe45750808314155b156108c65760405163af2eb37360e01b815260040160405180910390fd5b5f546001600160a01b0316331461102b576040516282b42960e81b815260040160405180910390fd5b565b805160208201516040830151611063827f0000000000000000000000000000000000000000000000000000000000000000611608565b61106f823330846116c7565b60405162e592a960e61b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633964aa4090610a54908690859033906004016128f8565b60038360038111156110d2576110d26121d6565b036110dc57505050565b5f8360038111156110ef576110ef6121d6565b03611183575f80806111038486018661292d565b604051631b63c28b60e11b81523360048201526001600160a01b0384811660248301528381166044830152828116606483015293965091945092507f0000000000000000000000000000000000000000000000000000000000000000909116906336c78516906084015f604051808303815f87803b158015610568575f80fd5b6001836003811115611197576111976121d6565b0361129f575f6111a982840184612975565b805160208201516040516302b67b5760e41b81529293506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692632b67b570926111ff923392600401612a5e565b5f604051808303815f87803b158015611216575f80fd5b505af1158015611228573d5f803e3d5ffd5b505050604080830151606084015160808501519251631b63c28b60e11b81523360048201526001600160a01b039283166024820152908216604482015291811660648301527f00000000000000000000000000000000000000000000000000000000000000001691506336c7851690608401610a54565b60028360038111156112b3576112b36121d6565b03610c77575f6112c582840184612aeb565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166330f28b7a825f015183602001513385604001516040518563ffffffff1660e01b8152600401610a549493929190612b99565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806113bd57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166113b17f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614155b1561102b5760405163703e46dd60e11b815260040160405180910390fd5b6113e3611002565b50565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611440575060408051601f3d908101601f1916820190925261143d918101906128e1565b60015b61146d57604051634c9c8ce360e01b81526001600160a01b03831660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146114b057604051632a87526960e21b815260048101829052602401611464565b610c908383611700565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461102b5760405163703e46dd60e11b815260040160405180910390fd5b61102b611755565b805f0361151757505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301525f919085169063dd62ed3e90604401602060405180830381865afa158015611564573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061158891906128e1565b9050818110156116025760405163095ea7b360e01b81526001600160a01b0384811660048301525f19602483015285169063095ea7b3906044016020604051808303815f875af11580156115de573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105a49190612c10565b50505050565b60405163e985e9c560e01b81523060048201526001600160a01b0382811660248301525f919084169063e985e9c590604401602060405180830381865afa158015611655573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116799190612c10565b905080610c905760405163a22cb46560e01b81526001600160a01b0383811660048301526001602483015284169063a22cb465906044015f604051808303815f87803b158015610d3d575f80fd5b80515f5b818110156108c6576116f88686868685815181106116eb576116eb611ff9565b60200260200101516117a3565b6001016116cb565b611709826117fe565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a280511561174d57610c908282611881565b6105c66118f3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff1661102b57604051631afcd79f60e31b815260040160405180910390fd5b5f604051632142170760e11b5f5284600452836024528260445260205f60645f808a5af13d15601f3d1160015f511416171691505f6060528060405250806105a457604051636ff8a60f60e11b815260040160405180910390fd5b806001600160a01b03163b5f0361183357604051634c9c8ce360e01b81526001600160a01b0382166004820152602401611464565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60605f80846001600160a01b03168460405161189d9190612c2f565b5f60405180830381855af49150503d805f81146118d5576040519150601f19603f3d011682016040523d82523d5f602084013e6118da565b606091505b50915091506118ea858383611912565b95945050505050565b341561102b5760405163b398979f60e01b815260040160405180910390fd5b6060826119275761192282611971565b61196a565b815115801561193e57506001600160a01b0384163b155b1561196757604051639996b31560e01b81526001600160a01b0385166004820152602401611464565b50805b9392505050565b8051156119815780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b634e487b7160e01b5f52604160045260245ffd5b6040516080810167ffffffffffffffff811182821017156119d1576119d161199a565b60405290565b6040516060810167ffffffffffffffff811182821017156119d1576119d161199a565b60405160a0810167ffffffffffffffff811182821017156119d1576119d161199a565b604051601f8201601f1916810167ffffffffffffffff81118282101715611a4657611a4661199a565b604052919050565b5f67ffffffffffffffff821115611a6757611a6761199a565b5060051b60200190565b6001600160a01b03811681146113e3575f80fd5b8035611a9081611a71565b919050565b5f82601f830112611aa4575f80fd5b81356020611ab9611ab483611a4e565b611a1d565b82815260059290921b84018101918181019086841115611ad7575f80fd5b8286015b84811015611af25780358352918301918301611adb565b509695505050505050565b5f60808284031215611b0d575f80fd5b611b156119ae565b90508135611b2281611a71565b8152602082013567ffffffffffffffff811115611b3d575f80fd5b611b4984828501611a95565b602083015250604082013560408201526060820135606082015292915050565b5f60608284031215611b79575f80fd5b50919050565b803560048110611a90575f80fd5b5f8083601f840112611b9d575f80fd5b50813567ffffffffffffffff811115611bb4575f80fd5b602083019150836020828501011115611bcb575f80fd5b9250929050565b5f805f805f60808688031215611be6575f80fd5b853567ffffffffffffffff80821115611bfd575f80fd5b818801915088601f830112611c10575f80fd5b81356020611c20611ab483611a4e565b82815260059290921b8401810191818101908c841115611c3e575f80fd5b8286015b84811015611c7557803586811115611c59575f8081fd5b611c678f86838b0101611afd565b845250918301918301611c42565b5099505089013592505080821115611c8b575f80fd5b611c9789838a01611b69565b9550611ca560408901611b7f565b94506060880135915080821115611cba575f80fd5b50611cc788828901611b8d565b969995985093965092949392505050565b5f60208284031215611ce8575f80fd5b813561196a81611a71565b5f805f805f60808688031215611d07575f80fd5b8535611d1281611a71565b94506020860135611d2281611a71565b935060408601359250606086013567ffffffffffffffff811115611d44575f80fd5b611cc788828901611b8d565b5f60608284031215611d60575f80fd5b611d686119d7565b90508135611d7581611a71565b81526020820135611d8581611a71565b6020820152604082013567ffffffffffffffff811115611da3575f80fd5b611daf84828501611a95565b60408301525092915050565b5f805f805f60808688031215611dcf575f80fd5b853567ffffffffffffffff80821115611de6575f80fd5b818801915088601f830112611df9575f80fd5b81356020611e09611ab483611a4e565b82815260059290921b8401810191818101908c841115611e27575f80fd5b8286015b84811015611c7557803586811115611e42575f8081fd5b611e508f86838b0101611d50565b845250918301918301611e2b565b5f805f805f60808688031215611e72575f80fd5b853567ffffffffffffffff80821115611e89575f80fd5b611e9589838a01611afd565b96506020880135915080821115611c8b575f80fd5b5f82601f830112611eb9575f80fd5b813567ffffffffffffffff811115611ed357611ed361199a565b611ee6601f8201601f1916602001611a1d565b818152846020838601011115611efa575f80fd5b816020850160208301375f918101602001919091529392505050565b5f8060408385031215611f27575f80fd5b8235611f3281611a71565b9150602083013567ffffffffffffffff811115611f4d575f80fd5b611f5985828601611eaa565b9150509250929050565b5f805f805f60808688031215611f77575f80fd5b853567ffffffffffffffff80821115611f8e575f80fd5b611e9589838a01611d50565b5f5b83811015611fb4578181015183820152602001611f9c565b50505f910152565b5f8151808452611fd3816020860160208601611f9a565b601f01601f19169290920160200192915050565b602081525f61196a6020830184611fbc565b634e487b7160e01b5f52603260045260245ffd5b5f808335601e19843603018112612022575f80fd5b83018035915067ffffffffffffffff82111561203c575f80fd5b602001915036819003821315611bcb575f80fd5b5f808335601e19843603018112612065575f80fd5b83018035915067ffffffffffffffff82111561207f575f80fd5b6020019150600581901b3603821315611bcb575f80fd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b606081525f6120d1606083018789612096565b602083820381850152818683528183019050818760051b840101885f5b8981101561215b57858303601f190184528135368c9003601e19018112612113575f80fd5b8b01858101903567ffffffffffffffff81111561212e575f80fd5b80360382131561213c575f80fd5b612147858284612096565b9587019594505050908401906001016120ee565b5050809450505050508260408301529695505050505050565b5f8151808452602080850194508084015f5b838110156121a257815187529582019590820190600101612186565b509495945050505050565b6001600160a01b0383168152604060208201525f6121ce6040830184612174565b949350505050565b634e487b7160e01b5f52602160045260245ffd5b5f82601f8301126121f9575f80fd5b81356020612209611ab483611a4e565b82815260079290921b84018101918181019086841115612227575f80fd5b8286015b84811015611af25760808189031215612243575f8081fd5b61224b6119ae565b813561225681611a71565b81528185013561226581611a71565b8186015260408281013561227881611a71565b9082015260608281013561228b81611a71565b9082015283529183019160800161222b565b5f602082840312156122ad575f80fd5b813567ffffffffffffffff8111156122c3575f80fd5b6121ce848285016121ea565b5f600182016122ec57634e487b7160e01b5f52601160045260245ffd5b5060010190565b602080825282518282018190525f919060409081850190868401855b8281101561235957815180516001600160a01b039081168652878201518116888701528682015181168787015260609182015116908501526080909301929085019060010161230f565b5091979650505050505050565b803565ffffffffffff81168114611a90575f80fd5b5f6080828403121561238b575f80fd5b6123936119ae565b905081356123a081611a71565b815260208201356123b081611a71565b60208201526123c160408301612366565b60408201526123d260608301612366565b606082015292915050565b5f60208083850312156123ee575f80fd5b823567ffffffffffffffff80821115612405575f80fd5b9084019060608287031215612418575f80fd5b6124206119d7565b82358281111561242e575f80fd5b83016060818903121561243f575f80fd5b6124476119d7565b813584811115612455575f80fd5b8201601f81018a13612465575f80fd5b8035612473611ab482611a4e565b81815260079190911b8201880190888101908c831115612491575f80fd5b928901925b828410156124ba576124a88d8561237b565b82528982019150608084019350612496565b8452506124cb915050828701611a85565b8682015260408201356040820152808352505083830135828111156124ee575f80fd5b6124fa88828601611eaa565b85830152506040830135935081841115612512575f80fd5b61251e878585016121ea565b60408201529695505050505050565b5f6001600160a01b038086168352602060608185015260c08401865160608087015281815180845260e08801915084830193505f92505b808310156125c9576125b38285516001600160a01b0380825116835280602083015116602084015250604081015165ffffffffffff808216604085015280606084015116606085015250505050565b6080820191508484019350600183019250612564565b5084848a0151166080880152604089015160a088015286810360408801526125f18189611fbc565b9a9950505050505050505050565b5f6040828403121561260f575f80fd5b6040516040810181811067ffffffffffffffff821117156126325761263261199a565b604052905080823561264381611a71565b8152602092830135920191909152919050565b5f612663611ab484611a4e565b8381529050602080820190600685901b840186811115612681575f80fd5b845b818110156126a35761269588826125ff565b845292820192604001612683565b505050509392505050565b5f82601f8301126126bd575f80fd5b61196a83833560208501612656565b5f60208083850312156126dd575f80fd5b823567ffffffffffffffff808211156126f4575f80fd5b9084019060608287031215612707575f80fd5b61270f6119d7565b82358281111561271d575f80fd5b83016060818903121561272e575f80fd5b6127366119d7565b813584811115612744575f80fd5b8201601f81018a13612754575f80fd5b6127628a8235898401612656565b8252508582013586820152604082013560408201528083525050838301358281111561278c575f80fd5b612798888286016126ae565b858301525060408301359350818411156127b0575f80fd5b61251e87858501611eaa565b5f8151808452602080850194508084015f5b838110156121a2576127f487835180516001600160a01b03168252602090810151910152565b60409690960195908201906001016127ce565b608081525f60e08201865160606080850152818151808452610100860191506020935083830192505f5b8181101561286a5761285783855180516001600160a01b03168252602090810151910152565b9284019260409290920191600101612831565b50508289015160a0860152604089015160c08601528481038386015261289081896127bc565b925050506128a960408401866001600160a01b03169052565b82810360608401526128bb8185611fbc565b979650505050505050565b5f602082840312156128d6575f80fd5b815161196a81611a71565b5f602082840312156128f1575f80fd5b5051919050565b5f6001600160a01b0380861683526060602084015261291a6060840186612174565b9150808416604084015250949350505050565b5f805f6060848603121561293f575f80fd5b833561294a81611a71565b9250602084013561295a81611a71565b9150604084013561296a81611a71565b809150509250925092565b5f60208284031215612985575f80fd5b813567ffffffffffffffff8082111561299c575f80fd5b908301908185036101408112156129b1575f80fd5b6129b96119fa565b60c08212156129c6575f80fd5b6129ce6119d7565b91506129da878561237b565b825260808401356129ea81611a71565b602083015260a0840135604083015290815260c08301359082821115612a0e575f80fd5b612a1a87838601611eaa565b6020820152612a2b60e08501611a85565b6040820152612a3d6101008501611a85565b6060820152612a4f6101208501611a85565b60808201529695505050505050565b5f6101006001600160a01b038087168452612ab96020850187516001600160a01b0380825116835280602083015116602084015250604081015165ffffffffffff808216604085015280606084015116606085015250505050565b60208601511660a0840152604085015160c084015260e08301819052612ae181840185611fbc565b9695505050505050565b5f60208284031215612afb575f80fd5b813567ffffffffffffffff80821115612b12575f80fd5b9083019081850360e0811215612b26575f80fd5b612b2e6119d7565b6080821215612b3b575f80fd5b612b436119d7565b9150612b4f87856125ff565b82526040840135602083015260608401356040830152818152612b7587608086016125ff565b602082015260c0840135915082821115612b8d575f80fd5b61251e87838601611eaa565b5f610100612bbb83885180516001600160a01b03168252602090810151910152565b6020870151604084015260408701516060840152612bef608084018780516001600160a01b03168252602090810151910152565b6001600160a01b03851660c08401528060e08401526128bb81840185611fbc565b5f60208284031215612c20575f80fd5b8151801515811461196a575f80fd5b5f8251612c40818460208701611f9a565b919091019291505056fea164736f6c6343000814000a0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da2000000000000000000000000785cf9e71381bd780e227b4fa89f5490148a76b00000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3
Deployed Bytecode
0x60806040526004361061010c575f3560e01c80635b8d8b33116100a1578063ab6a73eb11610071578063e89a7aed11610057578063e89a7aed14610378578063e8ad7f68146103ab578063e8dd7fc3146103be575f80fd5b8063ab6a73eb14610310578063ad3cb1cc14610323575f80fd5b80635b8d8b33146102985780636afdd850146102ab5780638129fc1c146102de5780638da5cb5b146102f2575f80fd5b80632c5fcdc5116100dc5780632c5fcdc51461020557806340695363146102185780634f1ef2861461026357806352d1902d14610276575f80fd5b806311bfa5901461015f57806313af403514610172578063150b7a02146101915780632582de55146101f2575f80fd5b3661015b57336001600160a01b037f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad16146101595760405162ffa65f60e11b815260040160405180910390fd5b005b5f80fd5b61015961016d366004611bd2565b6103f1565b34801561017d575f80fd5b5061015961018c366004611cd8565b610445565b34801561019c575f80fd5b506101bc6101ab366004611cf3565b630a85bd0160e11b95945050505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020015b60405180910390f35b610159610200366004611dbb565b6104a4565b610159610213366004611e5e565b610586565b348015610223575f80fd5b5061024b7f0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da281565b6040516001600160a01b0390911681526020016101e9565b610159610271366004611f16565b6105ab565b348015610281575f80fd5b5061028a6105ca565b6040519081526020016101e9565b6101596102a6366004611f63565b6105f8565b3480156102b6575f80fd5b5061024b7f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba381565b3480156102e9575f80fd5b506101596106ab565b3480156102fd575f80fd5b505f5461024b906001600160a01b031681565b61015961031e366004611bd2565b6107ed565b34801561032e575f80fd5b5061036b6040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516101e99190611fe7565b348015610383575f80fd5b5061024b7f000000000000000000000000785cf9e71381bd780e227b4fa89f5490148a76b081565b6101596103b9366004611e5e565b6108ce565b3480156103c9575f80fd5b5061024b7f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad81565b6103fc838383610959565b6104068385610c95565b84515f5b8181101561043c5761043487828151811061042757610427611ff9565b6020026020010151610de3565b60010161040a565b50505050505050565b61044d611002565b5f805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b84515f5b818110156104da576104d28782815181106104c5576104c5611ff9565b602002602001015161102d565b6001016104a8565b506104e6848484610959565b6001600160a01b037f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad16633593564c61051f878061200d565b61052c60208a018a612050565b8a604001356040518663ffffffff1660e01b81526004016105519594939291906120be565b5f604051808303815f87803b158015610568575f80fd5b505af115801561057a573d5f803e3d5ffd5b50505050505050505050565b6105918383836110be565b61059b8385610c95565b6105a485610de3565b5050505050565b6105b3611324565b6105bc826113db565b6105c682826113e6565b5050565b5f6105d36114ba565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b6106018561102d565b61060c8383836110be565b6001600160a01b037f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad16633593564c610645868061200d565b6106526020890189612050565b89604001356040518663ffffffff1660e01b81526004016106779594939291906120be565b5f604051808303815f87803b15801561068e575f80fd5b505af11580156106a0573d5f803e3d5ffd5b505050505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff165f811580156106f55750825b90505f8267ffffffffffffffff1660011480156107115750303b155b90508115801561071f575080155b1561073d5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561077157845468ff00000000000000001916680100000000000000001785555b6107945f805473ffffffffffffffffffffffffffffffffffffffff191633179055565b61079c611503565b83156105a457845468ff000000000000000019168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050565b84515f5b818110156108b8577f0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da26001600160a01b03166364d5d9fa88838151811061083a5761083a611ff9565b60200260200101515f015189848151811061085757610857611ff9565b6020026020010151602001516040518363ffffffff1660e01b81526004016108809291906121ad565b5f604051808303815f87803b158015610897575f80fd5b505af11580156108a9573d5f803e3d5ffd5b505050508060010190506107f1565b506108c686868686866103f1565b505050505050565b8451602086015160405163326aecfd60e11b81526001600160a01b037f0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da216926364d5d9fa9261091f926004016121ad565b5f604051808303815f87803b158015610936575f80fd5b505af1158015610948573d5f803e3d5ffd5b505050506105a48585858585610586565b600383600381111561096d5761096d6121d6565b0361097757505050565b5f83600381111561098a5761098a6121d6565b03610a87575f61099c8284018461229d565b90505f5b8151811015610a0757336001600160a01b03168282815181106109c5576109c5611ff9565b60200260200101515f01516001600160a01b0316146109f7576040516334513eed60e21b815260040160405180910390fd5b610a00816122cf565b90506109a0565b50604051630d58b1db60e01b81526001600160a01b037f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba31690630d58b1db90610a549084906004016122f3565b5f604051808303815f87803b158015610a6b575f80fd5b505af1158015610a7d573d5f803e3d5ffd5b5050505050505050565b6001836003811115610a9b57610a9b6121d6565b03610bf2575f610aad828401846123dd565b80516020820151604051632a2d80d160e01b81529293506001600160a01b037f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba31692632a2d80d192610b0392339260040161252d565b5f604051808303815f87803b158015610b1a575f80fd5b505af1158015610b2c573d5f803e3d5ffd5b505050505f5b816040015151811015610ba157336001600160a01b031682604001518281518110610b5f57610b5f611ff9565b60200260200101515f01516001600160a01b031614610b91576040516334513eed60e21b815260040160405180910390fd5b610b9a816122cf565b9050610b32565b506040808201519051630d58b1db60e01b81526001600160a01b037f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba31691630d58b1db91610a5491906004016122f3565b6002836003811115610c0657610c066121d6565b03610c77575f610c18828401846126cc565b90507f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba36001600160a01b031663edd9444b825f015183602001513385604001516040518563ffffffff1660e01b8152600401610a549493929190612807565b604051630309cb8760e51b815260040160405180910390fd5b505050565b6003826003811115610ca957610ca96121d6565b148015610cb557505f47115b15610d4f576001600160a01b037f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad16633593564c47610cf4848061200d565b610d016020870187612050565b87604001356040518763ffffffff1660e01b8152600401610d269594939291906120be565b5f604051808303818588803b158015610d3d575f80fd5b505af115801561043c573d5f803e3d5ffd5b6001600160a01b037f0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad16633593564c610d88838061200d565b610d956020860186612050565b86604001356040518663ffffffff1660e01b8152600401610dba9594939291906120be565b5f604051808303815f87803b158015610dd1575f80fd5b505af11580156108c6573d5f803e3d5ffd5b8051606082015160408084015190516316063a8760e21b81526001600160a01b0380851660048301525f917f000000000000000000000000785cf9e71381bd780e227b4fa89f5490148a76b090911690635818ea1c90602401602060405180830381865afa158015610e57573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e7b91906128c6565b90508115610f3257610eae817f0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da28461150b565b6040516346d5785160e11b81523060048201526001600160a01b038281166024830152604482018490527f0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da21690638daaf0a2906064015f604051808303815f87803b158015610f1b575f80fd5b505af1158015610f2d573d5f803e3d5ffd5b505050505b60405163fdbed69960e01b81526001600160a01b03858116600483015260248201859052604482018490523360648301525f917f0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da29091169063fdbed699906084016020604051808303815f875af1158015610faf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fd391906128e1565b90505f83118015610fe45750808314155b156108c65760405163af2eb37360e01b815260040160405180910390fd5b5f546001600160a01b0316331461102b576040516282b42960e81b815260040160405180910390fd5b565b805160208201516040830151611063827f0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da2611608565b61106f823330846116c7565b60405162e592a960e61b81526001600160a01b037f0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da21690633964aa4090610a54908690859033906004016128f8565b60038360038111156110d2576110d26121d6565b036110dc57505050565b5f8360038111156110ef576110ef6121d6565b03611183575f80806111038486018661292d565b604051631b63c28b60e11b81523360048201526001600160a01b0384811660248301528381166044830152828116606483015293965091945092507f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3909116906336c78516906084015f604051808303815f87803b158015610568575f80fd5b6001836003811115611197576111976121d6565b0361129f575f6111a982840184612975565b805160208201516040516302b67b5760e41b81529293506001600160a01b037f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba31692632b67b570926111ff923392600401612a5e565b5f604051808303815f87803b158015611216575f80fd5b505af1158015611228573d5f803e3d5ffd5b505050604080830151606084015160808501519251631b63c28b60e11b81523360048201526001600160a01b039283166024820152908216604482015291811660648301527f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba31691506336c7851690608401610a54565b60028360038111156112b3576112b36121d6565b03610c77575f6112c582840184612aeb565b90507f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba36001600160a01b03166330f28b7a825f015183602001513385604001516040518563ffffffff1660e01b8152600401610a549493929190612b99565b306001600160a01b037f00000000000000000000000091d975c33ad78727eae2b348b545127e0459c6211614806113bd57507f00000000000000000000000091d975c33ad78727eae2b348b545127e0459c6216001600160a01b03166113b17f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614155b1561102b5760405163703e46dd60e11b815260040160405180910390fd5b6113e3611002565b50565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611440575060408051601f3d908101601f1916820190925261143d918101906128e1565b60015b61146d57604051634c9c8ce360e01b81526001600160a01b03831660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146114b057604051632a87526960e21b815260048101829052602401611464565b610c908383611700565b306001600160a01b037f00000000000000000000000091d975c33ad78727eae2b348b545127e0459c621161461102b5760405163703e46dd60e11b815260040160405180910390fd5b61102b611755565b805f0361151757505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301525f919085169063dd62ed3e90604401602060405180830381865afa158015611564573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061158891906128e1565b9050818110156116025760405163095ea7b360e01b81526001600160a01b0384811660048301525f19602483015285169063095ea7b3906044016020604051808303815f875af11580156115de573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105a49190612c10565b50505050565b60405163e985e9c560e01b81523060048201526001600160a01b0382811660248301525f919084169063e985e9c590604401602060405180830381865afa158015611655573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116799190612c10565b905080610c905760405163a22cb46560e01b81526001600160a01b0383811660048301526001602483015284169063a22cb465906044015f604051808303815f87803b158015610d3d575f80fd5b80515f5b818110156108c6576116f88686868685815181106116eb576116eb611ff9565b60200260200101516117a3565b6001016116cb565b611709826117fe565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a280511561174d57610c908282611881565b6105c66118f3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff1661102b57604051631afcd79f60e31b815260040160405180910390fd5b5f604051632142170760e11b5f5284600452836024528260445260205f60645f808a5af13d15601f3d1160015f511416171691505f6060528060405250806105a457604051636ff8a60f60e11b815260040160405180910390fd5b806001600160a01b03163b5f0361183357604051634c9c8ce360e01b81526001600160a01b0382166004820152602401611464565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60605f80846001600160a01b03168460405161189d9190612c2f565b5f60405180830381855af49150503d805f81146118d5576040519150601f19603f3d011682016040523d82523d5f602084013e6118da565b606091505b50915091506118ea858383611912565b95945050505050565b341561102b5760405163b398979f60e01b815260040160405180910390fd5b6060826119275761192282611971565b61196a565b815115801561193e57506001600160a01b0384163b155b1561196757604051639996b31560e01b81526001600160a01b0385166004820152602401611464565b50805b9392505050565b8051156119815780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b634e487b7160e01b5f52604160045260245ffd5b6040516080810167ffffffffffffffff811182821017156119d1576119d161199a565b60405290565b6040516060810167ffffffffffffffff811182821017156119d1576119d161199a565b60405160a0810167ffffffffffffffff811182821017156119d1576119d161199a565b604051601f8201601f1916810167ffffffffffffffff81118282101715611a4657611a4661199a565b604052919050565b5f67ffffffffffffffff821115611a6757611a6761199a565b5060051b60200190565b6001600160a01b03811681146113e3575f80fd5b8035611a9081611a71565b919050565b5f82601f830112611aa4575f80fd5b81356020611ab9611ab483611a4e565b611a1d565b82815260059290921b84018101918181019086841115611ad7575f80fd5b8286015b84811015611af25780358352918301918301611adb565b509695505050505050565b5f60808284031215611b0d575f80fd5b611b156119ae565b90508135611b2281611a71565b8152602082013567ffffffffffffffff811115611b3d575f80fd5b611b4984828501611a95565b602083015250604082013560408201526060820135606082015292915050565b5f60608284031215611b79575f80fd5b50919050565b803560048110611a90575f80fd5b5f8083601f840112611b9d575f80fd5b50813567ffffffffffffffff811115611bb4575f80fd5b602083019150836020828501011115611bcb575f80fd5b9250929050565b5f805f805f60808688031215611be6575f80fd5b853567ffffffffffffffff80821115611bfd575f80fd5b818801915088601f830112611c10575f80fd5b81356020611c20611ab483611a4e565b82815260059290921b8401810191818101908c841115611c3e575f80fd5b8286015b84811015611c7557803586811115611c59575f8081fd5b611c678f86838b0101611afd565b845250918301918301611c42565b5099505089013592505080821115611c8b575f80fd5b611c9789838a01611b69565b9550611ca560408901611b7f565b94506060880135915080821115611cba575f80fd5b50611cc788828901611b8d565b969995985093965092949392505050565b5f60208284031215611ce8575f80fd5b813561196a81611a71565b5f805f805f60808688031215611d07575f80fd5b8535611d1281611a71565b94506020860135611d2281611a71565b935060408601359250606086013567ffffffffffffffff811115611d44575f80fd5b611cc788828901611b8d565b5f60608284031215611d60575f80fd5b611d686119d7565b90508135611d7581611a71565b81526020820135611d8581611a71565b6020820152604082013567ffffffffffffffff811115611da3575f80fd5b611daf84828501611a95565b60408301525092915050565b5f805f805f60808688031215611dcf575f80fd5b853567ffffffffffffffff80821115611de6575f80fd5b818801915088601f830112611df9575f80fd5b81356020611e09611ab483611a4e565b82815260059290921b8401810191818101908c841115611e27575f80fd5b8286015b84811015611c7557803586811115611e42575f8081fd5b611e508f86838b0101611d50565b845250918301918301611e2b565b5f805f805f60808688031215611e72575f80fd5b853567ffffffffffffffff80821115611e89575f80fd5b611e9589838a01611afd565b96506020880135915080821115611c8b575f80fd5b5f82601f830112611eb9575f80fd5b813567ffffffffffffffff811115611ed357611ed361199a565b611ee6601f8201601f1916602001611a1d565b818152846020838601011115611efa575f80fd5b816020850160208301375f918101602001919091529392505050565b5f8060408385031215611f27575f80fd5b8235611f3281611a71565b9150602083013567ffffffffffffffff811115611f4d575f80fd5b611f5985828601611eaa565b9150509250929050565b5f805f805f60808688031215611f77575f80fd5b853567ffffffffffffffff80821115611f8e575f80fd5b611e9589838a01611d50565b5f5b83811015611fb4578181015183820152602001611f9c565b50505f910152565b5f8151808452611fd3816020860160208601611f9a565b601f01601f19169290920160200192915050565b602081525f61196a6020830184611fbc565b634e487b7160e01b5f52603260045260245ffd5b5f808335601e19843603018112612022575f80fd5b83018035915067ffffffffffffffff82111561203c575f80fd5b602001915036819003821315611bcb575f80fd5b5f808335601e19843603018112612065575f80fd5b83018035915067ffffffffffffffff82111561207f575f80fd5b6020019150600581901b3603821315611bcb575f80fd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b606081525f6120d1606083018789612096565b602083820381850152818683528183019050818760051b840101885f5b8981101561215b57858303601f190184528135368c9003601e19018112612113575f80fd5b8b01858101903567ffffffffffffffff81111561212e575f80fd5b80360382131561213c575f80fd5b612147858284612096565b9587019594505050908401906001016120ee565b5050809450505050508260408301529695505050505050565b5f8151808452602080850194508084015f5b838110156121a257815187529582019590820190600101612186565b509495945050505050565b6001600160a01b0383168152604060208201525f6121ce6040830184612174565b949350505050565b634e487b7160e01b5f52602160045260245ffd5b5f82601f8301126121f9575f80fd5b81356020612209611ab483611a4e565b82815260079290921b84018101918181019086841115612227575f80fd5b8286015b84811015611af25760808189031215612243575f8081fd5b61224b6119ae565b813561225681611a71565b81528185013561226581611a71565b8186015260408281013561227881611a71565b9082015260608281013561228b81611a71565b9082015283529183019160800161222b565b5f602082840312156122ad575f80fd5b813567ffffffffffffffff8111156122c3575f80fd5b6121ce848285016121ea565b5f600182016122ec57634e487b7160e01b5f52601160045260245ffd5b5060010190565b602080825282518282018190525f919060409081850190868401855b8281101561235957815180516001600160a01b039081168652878201518116888701528682015181168787015260609182015116908501526080909301929085019060010161230f565b5091979650505050505050565b803565ffffffffffff81168114611a90575f80fd5b5f6080828403121561238b575f80fd5b6123936119ae565b905081356123a081611a71565b815260208201356123b081611a71565b60208201526123c160408301612366565b60408201526123d260608301612366565b606082015292915050565b5f60208083850312156123ee575f80fd5b823567ffffffffffffffff80821115612405575f80fd5b9084019060608287031215612418575f80fd5b6124206119d7565b82358281111561242e575f80fd5b83016060818903121561243f575f80fd5b6124476119d7565b813584811115612455575f80fd5b8201601f81018a13612465575f80fd5b8035612473611ab482611a4e565b81815260079190911b8201880190888101908c831115612491575f80fd5b928901925b828410156124ba576124a88d8561237b565b82528982019150608084019350612496565b8452506124cb915050828701611a85565b8682015260408201356040820152808352505083830135828111156124ee575f80fd5b6124fa88828601611eaa565b85830152506040830135935081841115612512575f80fd5b61251e878585016121ea565b60408201529695505050505050565b5f6001600160a01b038086168352602060608185015260c08401865160608087015281815180845260e08801915084830193505f92505b808310156125c9576125b38285516001600160a01b0380825116835280602083015116602084015250604081015165ffffffffffff808216604085015280606084015116606085015250505050565b6080820191508484019350600183019250612564565b5084848a0151166080880152604089015160a088015286810360408801526125f18189611fbc565b9a9950505050505050505050565b5f6040828403121561260f575f80fd5b6040516040810181811067ffffffffffffffff821117156126325761263261199a565b604052905080823561264381611a71565b8152602092830135920191909152919050565b5f612663611ab484611a4e565b8381529050602080820190600685901b840186811115612681575f80fd5b845b818110156126a35761269588826125ff565b845292820192604001612683565b505050509392505050565b5f82601f8301126126bd575f80fd5b61196a83833560208501612656565b5f60208083850312156126dd575f80fd5b823567ffffffffffffffff808211156126f4575f80fd5b9084019060608287031215612707575f80fd5b61270f6119d7565b82358281111561271d575f80fd5b83016060818903121561272e575f80fd5b6127366119d7565b813584811115612744575f80fd5b8201601f81018a13612754575f80fd5b6127628a8235898401612656565b8252508582013586820152604082013560408201528083525050838301358281111561278c575f80fd5b612798888286016126ae565b858301525060408301359350818411156127b0575f80fd5b61251e87858501611eaa565b5f8151808452602080850194508084015f5b838110156121a2576127f487835180516001600160a01b03168252602090810151910152565b60409690960195908201906001016127ce565b608081525f60e08201865160606080850152818151808452610100860191506020935083830192505f5b8181101561286a5761285783855180516001600160a01b03168252602090810151910152565b9284019260409290920191600101612831565b50508289015160a0860152604089015160c08601528481038386015261289081896127bc565b925050506128a960408401866001600160a01b03169052565b82810360608401526128bb8185611fbc565b979650505050505050565b5f602082840312156128d6575f80fd5b815161196a81611a71565b5f602082840312156128f1575f80fd5b5051919050565b5f6001600160a01b0380861683526060602084015261291a6060840186612174565b9150808416604084015250949350505050565b5f805f6060848603121561293f575f80fd5b833561294a81611a71565b9250602084013561295a81611a71565b9150604084013561296a81611a71565b809150509250925092565b5f60208284031215612985575f80fd5b813567ffffffffffffffff8082111561299c575f80fd5b908301908185036101408112156129b1575f80fd5b6129b96119fa565b60c08212156129c6575f80fd5b6129ce6119d7565b91506129da878561237b565b825260808401356129ea81611a71565b602083015260a0840135604083015290815260c08301359082821115612a0e575f80fd5b612a1a87838601611eaa565b6020820152612a2b60e08501611a85565b6040820152612a3d6101008501611a85565b6060820152612a4f6101208501611a85565b60808201529695505050505050565b5f6101006001600160a01b038087168452612ab96020850187516001600160a01b0380825116835280602083015116602084015250604081015165ffffffffffff808216604085015280606084015116606085015250505050565b60208601511660a0840152604085015160c084015260e08301819052612ae181840185611fbc565b9695505050505050565b5f60208284031215612afb575f80fd5b813567ffffffffffffffff80821115612b12575f80fd5b9083019081850360e0811215612b26575f80fd5b612b2e6119d7565b6080821215612b3b575f80fd5b612b436119d7565b9150612b4f87856125ff565b82526040840135602083015260608401356040830152818152612b7587608086016125ff565b602082015260c0840135915082821115612b8d575f80fd5b61251e87838601611eaa565b5f610100612bbb83885180516001600160a01b03168252602090810151910152565b6020870151604084015260408701516060840152612bef608084018780516001600160a01b03168252602090810151910152565b6001600160a01b03851660c08401528060e08401526128bb81840185611fbc565b5f60208284031215612c20575f80fd5b8151801515811461196a575f80fd5b5f8251612c40818460208701611f9a565b919091019291505056fea164736f6c6343000814000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da2000000000000000000000000785cf9e71381bd780e227b4fa89f5490148a76b00000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3
-----Decoded View---------------
Arg [0] : _floor (address): 0x3eb879cc9a0Ef4C6f1d870A40ae187768c278Da2
Arg [1] : _floorGetter (address): 0x785cF9E71381bd780E227B4fa89F5490148a76B0
Arg [2] : _universalRouter (address): 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD
Arg [3] : permit2 (address): 0x000000000022D473030F116dDEE9F6B43aC78BA3
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000003eb879cc9a0ef4c6f1d870a40ae187768c278da2
Arg [1] : 000000000000000000000000785cf9e71381bd780e227b4fa89f5490148a76b0
Arg [2] : 0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad
Arg [3] : 000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.