More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 84 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Sweep | 19819656 | 115 days ago | IN | 0 ETH | 0.00026051 | ||||
Sweep | 19819631 | 115 days ago | IN | 0 ETH | 0.0002696 | ||||
Mint | 19804875 | 117 days ago | IN | 0 ETH | 0.00075627 | ||||
Mint | 19802152 | 117 days ago | IN | 0.00756551 ETH | 0.00065344 | ||||
Mint | 19799415 | 117 days ago | IN | 0 ETH | 0.00051912 | ||||
Mint | 19799359 | 117 days ago | IN | 0.00756551 ETH | 0.00049878 | ||||
Mint | 19768853 | 122 days ago | IN | 0 ETH | 0.00194101 | ||||
Mint | 19768846 | 122 days ago | IN | 0.00756551 ETH | 0.00216755 | ||||
Mint | 19764772 | 122 days ago | IN | 0.00756551 ETH | 0.00067071 | ||||
Mint | 19764675 | 122 days ago | IN | 0 ETH | 0.00073388 | ||||
Mint | 19764672 | 122 days ago | IN | 0.00756551 ETH | 0.00067549 | ||||
Mint | 19756885 | 123 days ago | IN | 0 ETH | 0.00058004 | ||||
Mint | 19756224 | 124 days ago | IN | 0 ETH | 0.00068817 | ||||
Mint | 19756093 | 124 days ago | IN | 0.00756551 ETH | 0.00089872 | ||||
Mint | 19729237 | 127 days ago | IN | 0 ETH | 0.00086125 | ||||
Mint | 19725816 | 128 days ago | IN | 0.00756551 ETH | 0.00323343 | ||||
Mint | 19714284 | 129 days ago | IN | 0.00756551 ETH | 0.00062058 | ||||
Mint | 19714231 | 129 days ago | IN | 0 ETH | 0.00088278 | ||||
Mint | 19714172 | 129 days ago | IN | 0 ETH | 0.00092442 | ||||
Mint | 19714142 | 129 days ago | IN | 0 ETH | 0.00084946 | ||||
Mint | 19714139 | 129 days ago | IN | 0 ETH | 0.00088928 | ||||
Mint | 19714135 | 129 days ago | IN | 0.00756551 ETH | 0.00086037 | ||||
Mint | 19714116 | 129 days ago | IN | 0.00756551 ETH | 0.00098958 | ||||
Mint | 19714112 | 129 days ago | IN | 0.00756551 ETH | 0.00103123 | ||||
Mint | 19714060 | 129 days ago | IN | 0 ETH | 0.00074317 |
Loading...
Loading
Contract Name:
StoreFront721
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.11; import "../openzeppelin/access/Ownable.sol"; import "../openzeppelin/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../openzeppelin/utils/SafeERC20.sol"; import "../erc721psi/IERC721PsiKO.sol"; /* It saves bytecode to revert on custom errors instead of using require statements. We are just declaring these errors for reverting with upon various conditions later in this contract. */ error CannotEndSaleBeforeItStarts(); error CannotBuyZeroItems(); error CannotBuyBeforeSaleStarts(); error CannotBuyFromEndedSale(); error CannotExceedPerTransactionCap(); error CannotExceedPerCallerCap(); error CannotExceedTotalCap(); error CannotUnderpayForMint(); error RefundTransferFailed(); error SweepingTransferFailed(); /** @title A storefront contract built on top of DropShop721 and DropPresaleShop721 accepts IERC721PsiKO display items (for sale) @author timeout */ contract StoreFront721 is Ownable, ReentrancyGuard { using SafeERC20 for IERC20; event Received(address, uint); receive () external payable { emit Received(msg.sender, msg.value); } /** This struct is used to define information regarding a particular item that the user may choose to place for sale @param startTime The time when the public sale begins. @param endTime The time when the public sale ends. @param totalCap The maximum number of items from the `collection` that may be sold. @param callerCap The maximum number of items that a single address may purchase. @param transactionCap The maximum number of items that may be purchased in a single transaction. @param price The price at which to sell the item. @param paymentDestination The destination of claimed payments. @param token The address of the token with which purchases will be If this is the zero address, then this whitelist will conduct purchases using ETH. */ struct Display { address paymentDestination; address token; uint256 startTime; uint256 endTime; uint256 totalCap; uint256 callerCap; uint256 transactionCap; uint256 price; } /// A mapping to look up information for each specific display. mapping ( bytes32 => Display ) public displays; // A double mapping to track the number of items purchases by each caller. mapping ( address => mapping(address => uint256) ) public purchaseCounts; // The total number of items sold on each display mapping ( address => uint256) public sold; /** @dev Adds new display in the storefront to be sold If multiple displays exists for the same collection, the underlying assumptiong is that they all should have the same total capacity. @param _cfg A parameter containing store front/display information, passed here as a struct to avoid a stack-to-deep error. */ function setDisplay( address _collection, Display calldata _cfg ) external onlyOwner { // Perform basic input validation. if (_cfg.endTime < _cfg.startTime) { revert CannotEndSaleBeforeItStarts(); } bytes32 hashedKey = keccak256(abi.encodePacked(_collection,_cfg.token)); displays[hashedKey] = Display({ startTime: _cfg.startTime, endTime: _cfg.endTime, totalCap: _cfg.totalCap, callerCap: _cfg.callerCap, transactionCap: _cfg.transactionCap, price: _cfg.price, paymentDestination: _cfg.paymentDestination, token: _cfg.token }); } /** Allow a caller to purchase an item. @param _amount The amount of items that the caller would like to purchase. */ function mint( address _collection, address _token, uint256 _amount ) public virtual payable nonReentrant { // Reject purchases for no items. if (_amount < 1) { revert CannotBuyZeroItems(); } bytes32 hashedKey = keccak256(abi.encodePacked(_collection,_token)); /// Reject purchases that happen before the start of the sale. if (block.timestamp < displays[hashedKey].startTime) { revert CannotBuyBeforeSaleStarts(); } /// Reject purchases that happen after the end of the sale. if (block.timestamp > displays[hashedKey].endTime) { revert CannotBuyFromEndedSale(); } // Reject purchases that exceed the per-transaction cap. if (_amount > displays[hashedKey].transactionCap) { revert CannotExceedPerTransactionCap(); } // Reject purchases that exceed the per-caller cap. if (purchaseCounts[_collection][_msgSender()] + _amount > displays[hashedKey].callerCap) { revert CannotExceedPerCallerCap(); } // Reject purchases that exceed the total sale cap. if (sold[_collection] + _amount > displays[hashedKey].totalCap) { revert CannotExceedTotalCap(); } address token = displays[hashedKey].token; uint256 totalCharge = displays[hashedKey].price * _amount; // The zero address indicates that the purchase assets is Ether. if (token == address(0)) { // Reject the purchase if the caller is underpaying. if (msg.value < totalCharge) { revert CannotUnderpayForMint(); } // Refund the caller's excess payment if they overpaid. if (msg.value > totalCharge) { uint256 excess = msg.value - totalCharge; (bool returned, ) = payable(_msgSender()).call{ value: excess }(""); if (!returned) { revert RefundTransferFailed(); } } } else { // Otherwise, the caller is making their purchase with an ERC-20 token. IERC20(token).safeTransferFrom( _msgSender(), address(this), totalCharge ); } // Update the count of items sold. sold[_collection] += _amount; // Update the caller's purchase count. purchaseCounts[_collection][_msgSender()] += _amount; // Mint the items. IERC721PsiKO(_collection).mint_Qgo(_msgSender(), _amount); } /** Allow any caller to send this contract's balance of Ether to the payment destination. */ function claim(address _collection) external nonReentrant { bytes32 hashedKey = keccak256(abi.encodePacked(_collection, address(0))); (bool success, ) = payable(displays[hashedKey].paymentDestination).call{ value: address(this).balance }(""); if (!success) { revert SweepingTransferFailed(); } } /** Allow the owner to sweep either Ether or a particular ERC-20 token from the contract and send it to another address. This allows the owner of the shop to withdraw their funds after the sale is completed. @param _token The token to sweep the balance from; if a zero address is sent then the contract's balance of Ether will be swept. @param _amount The amount of token to sweep. @param _destination The address to send the swept tokens to. */ function sweep( address _token, address _destination, uint256 _amount ) external onlyOwner nonReentrant { // A zero address means we should attempt to sweep Ether. if (_token == address(0)) { (bool success, ) = payable(_destination).call{ value: _amount }(""); if (!success) { revert SweepingTransferFailed(); } // Otherwise, we should try to sweep an ERC-20 token. } else { IERC20(_token).safeTransfer(_destination, _amount); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Context.sol"; /* It saves bytecode to revert on custom errors instead of using require statements. We are just declaring these errors for reverting with upon various conditions later in this contract. */ error CallerNotOwner(); error OwnerZeroAddress(); /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert CallerNotOwner(); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnerZeroAddress(); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /* It saves bytecode to revert on custom errors instead of using require statements. We are just declaring these errors for reverting with upon various conditions later in this contract. */ error ReentrantCall(); /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _notEntered will be true if(_status == _ENTERED) { revert ReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` 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 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../extensions/draft-ERC20Permit.sol"; import "./Address.sol"; /* It saves bytecode to revert on custom errors instead of using require statements. We are just declaring these errors for reverting with upon various conditions later in this contract. */ error DecreasedAllowanceBelowZero(); error PermitDidNotSucceed(); error ERC20DidNotSucceed(); /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); if (oldAllowance < value) { revert DecreasedAllowanceBelowZero(); } uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); if (nonceAfter != nonceBefore + 1) { revert PermitDidNotSucceed(); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional if (!abi.decode(returndata, (bool))) { revert ERC20DidNotSucceed(); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** @title IERC721PsiKO: An ERC721 compliant implementation of ERC721PsiKO @author timeout */ interface IERC721PsiKO{ /** @dev Return the total number of this token that have ever been minted. @return The total supply of minted tokens. */ function totalSupply () external view returns (uint256); /** @dev Return whether or not the transfer of a particular token ID `_id` is locked. @param _id The ID of the token to check the lock status of. @return Whether or not the particular token ID `_id` has transfers locked. */ function transferLocks ( uint256 _id ) external returns (bool); /** @dev Provided with an address parameter, this function returns the number of all tokens in this collection that are owned by the specified address. @param _owner The address of the account for which we are checking balances */ function balanceOf ( address _owner ) external returns (uint256); /** @dev Return the address that holds a particular token ID. @param _id The token ID to check for the holding address of. @return The address that holds the token with ID of `_id`. */ function ownerOf ( uint256 _id ) external returns (address); /** @dev This function performs an unsafe transfer of token ID `_id` from address `_from` to address `_to`. The transfer is considered unsafe because it does not validate that the receiver can actually take proper receipt of an ERC-721 token. @param _from The address to transfer the token from. @param _to The address to transfer the token to. @param _id The ID of the token being transferred. */ function transferFrom ( address _from, address _to, uint256 _id ) external; /** @dev This function allows permissioned minters of this contract to mint one or more tokens dictated by the `_amount` parameter. Any minted tokens are sent to the `_recipient` address. @param _recipient The recipient of the tokens being minted. @param _amount The amount of tokens to mint. */ function mint_Qgo ( address _recipient, uint256 _amount ) external; /** @dev Allow the caller, either the owner of a token or an approved manager, to burn a specific token ID. In order for the token to be eligible for burning, transfer of the token must not be locked. @param _id The token ID to burn. */ function burn ( uint256 _id ) external; /** @dev This function allows an administrative caller to lock the transfer of particular token IDs. This is designed for a non-escrow staking contract that comes later to lock a user's NFT while still letting them keep it in their wallet. @param _id The ID of the token to lock. @param _locked The status of the lock; true to lock, false to unlock. */ function lockTransfer ( uint256 _id, bool _locked ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol"; import "../ERC20.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; /* It saves bytecode to revert on custom errors instead of using require statements. We are just declaring these errors for reverting with upon various conditions later in this contract. */ error ExpiredDeadline(); error InvalidSignature(); /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { if (block.timestamp > deadline) { revert ExpiredDeadline(); } bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); if (signer != owner) { revert InvalidSignature(); } _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /* It saves bytecode to revert on custom errors instead of using require statements. We are just declaring these errors for reverting with upon various conditions later in this contract. */ error InsufficientBalance(); error RecipientMayHaveReverted(); error CallToNonContract(); /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/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.5.11/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 InsufficientBalance(); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert RecipientMayHaveReverted(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { if (address(this).balance < value) { revert InsufficientBalance(); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (!isContract(target)) { revert CallToNonContract(); } } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/utils/Context.sol"; /* It saves bytecode to revert on custom errors instead of using require statements. We are just declaring these errors for reverting with upon various conditions later in this contract. */ error DecreaseAllowanceBelowZero(); error TransferToFromZeroAddress(); error TransferExceedsBalance(); error MintToZero(); error BurnToZero(); error BurnExceedsBalance(); error ApproveToFromZeroAddress(); error InsufficientAllowance(); /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); if (currentAllowance<subtractedValue) { revert DecreaseAllowanceBelowZero(); } unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { if (from == address(0) || to == address(0)) { revert TransferToFromZeroAddress();} _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; if (fromBalance < amount) { revert TransferExceedsBalance();} unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { if (account == address(0)) { revert MintToZero(); } _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { if (account == address(0)) { revert BurnToZero(); } _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; if (accountBalance < amount) { revert BurnExceedsBalance(); } unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { if (owner == address(0) || spender == address(0)) { revert ApproveToFromZeroAddress(); } _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < amount) { revert InsufficientAllowance(); } unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"CallToNonContract","type":"error"},{"inputs":[],"name":"CallerNotOwner","type":"error"},{"inputs":[],"name":"CannotBuyBeforeSaleStarts","type":"error"},{"inputs":[],"name":"CannotBuyFromEndedSale","type":"error"},{"inputs":[],"name":"CannotBuyZeroItems","type":"error"},{"inputs":[],"name":"CannotEndSaleBeforeItStarts","type":"error"},{"inputs":[],"name":"CannotExceedPerCallerCap","type":"error"},{"inputs":[],"name":"CannotExceedPerTransactionCap","type":"error"},{"inputs":[],"name":"CannotExceedTotalCap","type":"error"},{"inputs":[],"name":"CannotUnderpayForMint","type":"error"},{"inputs":[],"name":"ERC20DidNotSucceed","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"OwnerZeroAddress","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RefundTransferFailed","type":"error"},{"inputs":[],"name":"SweepingTransferFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"Received","type":"event"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"displays","outputs":[{"internalType":"address","name":"paymentDestination","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"totalCap","type":"uint256"},{"internalType":"uint256","name":"callerCap","type":"uint256"},{"internalType":"uint256","name":"transactionCap","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"purchaseCounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"components":[{"internalType":"address","name":"paymentDestination","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"totalCap","type":"uint256"},{"internalType":"uint256","name":"callerCap","type":"uint256"},{"internalType":"uint256","name":"transactionCap","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct StoreFront721.Display","name":"_cfg","type":"tuple"}],"name":"setDisplay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"sold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_destination","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a33610023565b60018055610073565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610eee806100826000396000f3fe6080604052600436106100955760003560e01c80638da5cb5b116100595780638da5cb5b1461022e578063b69dc15d14610256578063c6c3bbe614610283578063f2fde38b14610296578063ff6cbb72146102b657600080fd5b806319687147146100d95780631e83409a146101245780633f62c00e1461014657806362c06767146101f9578063715018a61461021957600080fd5b366100d457604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910160405180910390a1005b600080fd5b3480156100e557600080fd5b506101116100f4366004610ca5565b600360209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b34801561013057600080fd5b5061014461013f366004610cd8565b6102d6565b005b34801561015257600080fd5b506101b3610161366004610cfa565b6002602081905260009182526040909120805460018201549282015460038301546004840154600585015460068601546007909601546001600160a01b03958616979095169593949293919290919088565b604080516001600160a01b03998a168152989097166020890152958701949094526060860192909252608085015260a084015260c083015260e08201526101000161011b565b34801561020557600080fd5b50610144610214366004610d13565b610399565b34801561022557600080fd5b50610144610453565b34801561023a57600080fd5b506000546040516001600160a01b03909116815260200161011b565b34801561026257600080fd5b50610111610271366004610cd8565b60046020526000908152604090205481565b610144610291366004610d13565b610467565b3480156102a257600080fd5b506101446102b1366004610cd8565b6107e6565b3480156102c257600080fd5b506101446102d1366004610d4f565b61081e565b6102de61098a565b60008160006040516020016102f4929190610d90565b60408051808303601f1901815282825280516020918201206000818152600290925291812054919350916001600160a01b039091169047908381818185875af1925050503d8060008114610364576040519150601f19603f3d011682016040523d82523d6000602084013e610369565b606091505b505090508061038b57604051639081276360e01b815260040160405180910390fd5b505061039660018055565b50565b6103a16109b5565b6103a961098a565b6001600160a01b038316610431576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610404576040519150601f19603f3d011682016040523d82523d6000602084013e610409565b606091505b505090508061042b57604051639081276360e01b815260040160405180910390fd5b50610445565b6104456001600160a01b03841683836109e0565b61044e60018055565b505050565b61045b6109b5565b6104656000610a43565b565b61046f61098a565b600181101561049157604051632e2e531360e11b815260040160405180910390fd5b600083836040516020016104a6929190610d90565b60405160208183030381529060405280519060200120905060026000828152602001908152602001600020600201544210156104f557604051637852656d60e01b815260040160405180910390fd5b600081815260026020526040902060030154421115610527576040516382272bc160e01b815260040160405180910390fd5b6000818152600260205260409020600601548211156105595760405163eeb0781760e01b815260040160405180910390fd5b6000818152600260209081526040808320600501546001600160a01b03881684526003835281842033855290925290912054610596908490610dcd565b11156105b5576040516374441b5960e11b815260040160405180910390fd5b60008181526002602090815260408083206004908101546001600160a01b03891685529252909120546105e9908490610dcd565b111561060857604051636f9f46c960e11b815260040160405180910390fd5b600081815260026020526040812060018101546007909101546001600160a01b039091169190610639908590610de5565b90506001600160a01b0382166106f2578034101561066a57604051636123fa2560e11b815260040160405180910390fd5b803411156106ed57600061067e8234610e04565b604051909150600090339083908381818185875af1925050503d80600081146106c3576040519150601f19603f3d011682016040523d82523d6000602084013e6106c8565b606091505b50509050806106ea5760405163cbe4e8c360e01b815260040160405180910390fd5b50505b610707565b6107076001600160a01b038316333084610a93565b6001600160a01b0386166000908152600460205260408120805486929061072f908490610dcd565b90915550506001600160a01b038616600090815260036020908152604080832033845290915281208054869290610767908490610dcd565b90915550506001600160a01b038616611784336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101879052604401600060405180830381600087803b1580156107c257600080fd5b505af11580156107d6573d6000803e3d6000fd5b5050505050505061044e60018055565b6107ee6109b5565b6001600160a01b03811661081557604051630962257960e11b815260040160405180910390fd5b61039681610a43565b6108266109b5565b80604001358160600135101561084f5760405163174562e960e21b815260040160405180910390fd5b6000826108626040840160208501610cd8565b604051602001610873929190610d90565b60408051601f198184030181528282528051602091820120610100840190925290925081906108a490850185610cd8565b6001600160a01b031681526020018360200160208101906108c59190610cd8565b6001600160a01b039081168252604080860135602080850191909152606080880135838601526080808901358287015260a0808a01358288015260c0808b01358289015260e09a8b0135978101979097526000988952600280855298859020885181549088166001600160a01b0319918216178255948901516001820180549190981695169490941790955592860151968201969096559484015160038601558301516004850155820151600584015581015160068301559091015160079091015550565b600260015414156109ae576040516306fda65d60e31b815260040160405180910390fd5b6002600155565b6000546001600160a01b0316331461046557604051632e6c18c960e11b815260040160405180910390fd5b6040516001600160a01b03831660248201526044810182905261044e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ad1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052610acb9085906323b872dd60e01b90608401610a0c565b50505050565b6000610b26826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610b619092919063ffffffff16565b80519091501561044e5780806020019051810190610b449190610e1b565b61044e576040516332654d8560e11b815260040160405180910390fd5b6060610b708484600085610b78565b949350505050565b606082471015610b9b57604051631e9acf1760e31b815260040160405180910390fd5b600080866001600160a01b03168587604051610bb79190610e69565b60006040518083038185875af1925050503d8060008114610bf4576040519150601f19603f3d011682016040523d82523d6000602084013e610bf9565b606091505b5091509150610c0a87838387610c15565b979650505050505050565b60608315610c51578251610c4a576001600160a01b0385163b610c4a5760405162ba183960e81b815260040160405180910390fd5b5081610b70565b610b708383815115610c665781518083602001fd5b8060405162461bcd60e51b8152600401610c809190610e85565b60405180910390fd5b80356001600160a01b0381168114610ca057600080fd5b919050565b60008060408385031215610cb857600080fd5b610cc183610c89565b9150610ccf60208401610c89565b90509250929050565b600060208284031215610cea57600080fd5b610cf382610c89565b9392505050565b600060208284031215610d0c57600080fd5b5035919050565b600080600060608486031215610d2857600080fd5b610d3184610c89565b9250610d3f60208501610c89565b9150604084013590509250925092565b600080828403610120811215610d6457600080fd5b610d6d84610c89565b9250610100601f1982011215610d8257600080fd5b506020830190509250929050565b6bffffffffffffffffffffffff19606093841b811682529190921b16601482015260280190565b634e487b7160e01b600052601160045260246000fd5b60008219821115610de057610de0610db7565b500190565b6000816000190483118215151615610dff57610dff610db7565b500290565b600082821015610e1657610e16610db7565b500390565b600060208284031215610e2d57600080fd5b81518015158114610cf357600080fd5b60005b83811015610e58578181015183820152602001610e40565b83811115610acb5750506000910152565b60008251610e7b818460208701610e3d565b9190910192915050565b6020815260008251806020840152610ea4816040850160208701610e3d565b601f01601f1916919091016040019291505056fea26469706673582212209b59f31088d5fb6edc82a7ff2080c8b8e25ef8a2773bb65c8aecb4e438b899c664736f6c634300080b0033
Deployed Bytecode
0x6080604052600436106100955760003560e01c80638da5cb5b116100595780638da5cb5b1461022e578063b69dc15d14610256578063c6c3bbe614610283578063f2fde38b14610296578063ff6cbb72146102b657600080fd5b806319687147146100d95780631e83409a146101245780633f62c00e1461014657806362c06767146101f9578063715018a61461021957600080fd5b366100d457604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910160405180910390a1005b600080fd5b3480156100e557600080fd5b506101116100f4366004610ca5565b600360209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b34801561013057600080fd5b5061014461013f366004610cd8565b6102d6565b005b34801561015257600080fd5b506101b3610161366004610cfa565b6002602081905260009182526040909120805460018201549282015460038301546004840154600585015460068601546007909601546001600160a01b03958616979095169593949293919290919088565b604080516001600160a01b03998a168152989097166020890152958701949094526060860192909252608085015260a084015260c083015260e08201526101000161011b565b34801561020557600080fd5b50610144610214366004610d13565b610399565b34801561022557600080fd5b50610144610453565b34801561023a57600080fd5b506000546040516001600160a01b03909116815260200161011b565b34801561026257600080fd5b50610111610271366004610cd8565b60046020526000908152604090205481565b610144610291366004610d13565b610467565b3480156102a257600080fd5b506101446102b1366004610cd8565b6107e6565b3480156102c257600080fd5b506101446102d1366004610d4f565b61081e565b6102de61098a565b60008160006040516020016102f4929190610d90565b60408051808303601f1901815282825280516020918201206000818152600290925291812054919350916001600160a01b039091169047908381818185875af1925050503d8060008114610364576040519150601f19603f3d011682016040523d82523d6000602084013e610369565b606091505b505090508061038b57604051639081276360e01b815260040160405180910390fd5b505061039660018055565b50565b6103a16109b5565b6103a961098a565b6001600160a01b038316610431576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610404576040519150601f19603f3d011682016040523d82523d6000602084013e610409565b606091505b505090508061042b57604051639081276360e01b815260040160405180910390fd5b50610445565b6104456001600160a01b03841683836109e0565b61044e60018055565b505050565b61045b6109b5565b6104656000610a43565b565b61046f61098a565b600181101561049157604051632e2e531360e11b815260040160405180910390fd5b600083836040516020016104a6929190610d90565b60405160208183030381529060405280519060200120905060026000828152602001908152602001600020600201544210156104f557604051637852656d60e01b815260040160405180910390fd5b600081815260026020526040902060030154421115610527576040516382272bc160e01b815260040160405180910390fd5b6000818152600260205260409020600601548211156105595760405163eeb0781760e01b815260040160405180910390fd5b6000818152600260209081526040808320600501546001600160a01b03881684526003835281842033855290925290912054610596908490610dcd565b11156105b5576040516374441b5960e11b815260040160405180910390fd5b60008181526002602090815260408083206004908101546001600160a01b03891685529252909120546105e9908490610dcd565b111561060857604051636f9f46c960e11b815260040160405180910390fd5b600081815260026020526040812060018101546007909101546001600160a01b039091169190610639908590610de5565b90506001600160a01b0382166106f2578034101561066a57604051636123fa2560e11b815260040160405180910390fd5b803411156106ed57600061067e8234610e04565b604051909150600090339083908381818185875af1925050503d80600081146106c3576040519150601f19603f3d011682016040523d82523d6000602084013e6106c8565b606091505b50509050806106ea5760405163cbe4e8c360e01b815260040160405180910390fd5b50505b610707565b6107076001600160a01b038316333084610a93565b6001600160a01b0386166000908152600460205260408120805486929061072f908490610dcd565b90915550506001600160a01b038616600090815260036020908152604080832033845290915281208054869290610767908490610dcd565b90915550506001600160a01b038616611784336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101879052604401600060405180830381600087803b1580156107c257600080fd5b505af11580156107d6573d6000803e3d6000fd5b5050505050505061044e60018055565b6107ee6109b5565b6001600160a01b03811661081557604051630962257960e11b815260040160405180910390fd5b61039681610a43565b6108266109b5565b80604001358160600135101561084f5760405163174562e960e21b815260040160405180910390fd5b6000826108626040840160208501610cd8565b604051602001610873929190610d90565b60408051601f198184030181528282528051602091820120610100840190925290925081906108a490850185610cd8565b6001600160a01b031681526020018360200160208101906108c59190610cd8565b6001600160a01b039081168252604080860135602080850191909152606080880135838601526080808901358287015260a0808a01358288015260c0808b01358289015260e09a8b0135978101979097526000988952600280855298859020885181549088166001600160a01b0319918216178255948901516001820180549190981695169490941790955592860151968201969096559484015160038601558301516004850155820151600584015581015160068301559091015160079091015550565b600260015414156109ae576040516306fda65d60e31b815260040160405180910390fd5b6002600155565b6000546001600160a01b0316331461046557604051632e6c18c960e11b815260040160405180910390fd5b6040516001600160a01b03831660248201526044810182905261044e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ad1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052610acb9085906323b872dd60e01b90608401610a0c565b50505050565b6000610b26826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610b619092919063ffffffff16565b80519091501561044e5780806020019051810190610b449190610e1b565b61044e576040516332654d8560e11b815260040160405180910390fd5b6060610b708484600085610b78565b949350505050565b606082471015610b9b57604051631e9acf1760e31b815260040160405180910390fd5b600080866001600160a01b03168587604051610bb79190610e69565b60006040518083038185875af1925050503d8060008114610bf4576040519150601f19603f3d011682016040523d82523d6000602084013e610bf9565b606091505b5091509150610c0a87838387610c15565b979650505050505050565b60608315610c51578251610c4a576001600160a01b0385163b610c4a5760405162ba183960e81b815260040160405180910390fd5b5081610b70565b610b708383815115610c665781518083602001fd5b8060405162461bcd60e51b8152600401610c809190610e85565b60405180910390fd5b80356001600160a01b0381168114610ca057600080fd5b919050565b60008060408385031215610cb857600080fd5b610cc183610c89565b9150610ccf60208401610c89565b90509250929050565b600060208284031215610cea57600080fd5b610cf382610c89565b9392505050565b600060208284031215610d0c57600080fd5b5035919050565b600080600060608486031215610d2857600080fd5b610d3184610c89565b9250610d3f60208501610c89565b9150604084013590509250925092565b600080828403610120811215610d6457600080fd5b610d6d84610c89565b9250610100601f1982011215610d8257600080fd5b506020830190509250929050565b6bffffffffffffffffffffffff19606093841b811682529190921b16601482015260280190565b634e487b7160e01b600052601160045260246000fd5b60008219821115610de057610de0610db7565b500190565b6000816000190483118215151615610dff57610dff610db7565b500290565b600082821015610e1657610e16610db7565b500390565b600060208284031215610e2d57600080fd5b81518015158114610cf357600080fd5b60005b83811015610e58578181015183820152602001610e40565b83811115610acb5750506000910152565b60008251610e7b818460208701610e3d565b9190910192915050565b6020815260008251806020840152610ea4816040850160208701610e3d565b601f01601f1916919091016040019291505056fea26469706673582212209b59f31088d5fb6edc82a7ff2080c8b8e25ef8a2773bb65c8aecb4e438b899c664736f6c634300080b0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $2,508.25 | 0.00431693 | $10.83 |
Loading...
Loading
[ Download: CSV Export ]
[ 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.