Contract Overview
Balance:
0 MATIC
MATIC Value:
$0.00
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x2774161b5ff8c4f4459f08120a9f63f5452962da7953ff46f924075baab2440d | 0x61014060 | 42336816 | 151 days 3 hrs ago | 0x132c50a3d9439a21cc8bfadeeac06045db3a29a7 | IN | Create: AbstractERC721Limited | 0 MATIC | 0.472021408766 |
[ Download CSV Export ]
Contract Name:
AbstractERC721Limited
Compiler Version
v0.8.16+commit.07a7930e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract 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 { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC1271 standard signature validation method for * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. * * _Available since v4.1._ */ interface IERC1271 { /** * @dev Should return whether the signature provided is valid for the provided data * @param hash Hash of the data to be signed * @param signature Signature byte array associated with _data */ function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// 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/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _safeTransfer(from, to, tokenId, data); } /** * @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. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) 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. * - `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 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * 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 caller. * * 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 v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @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 v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [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 { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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.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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.3) (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) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (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 (last updated v4.7.1) (utils/cryptography/SignatureChecker.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; import "../Address.sol"; import "../../interfaces/IERC1271.sol"; /** * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like * Argent and Gnosis Safe. * * _Available since v4.1._ */ library SignatureChecker { /** * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`. * * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus * change through time. It could return true at block N and false at block N+1 (or the opposite). */ function isValidSignatureNow( address signer, bytes32 hash, bytes memory signature ) internal view returns (bool) { (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature); if (error == ECDSA.RecoverError.NoError && recovered == signer) { return true; } (bool success, bytes memory result) = signer.staticcall( abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature) ); return (success && result.length == 32 && abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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 pragma solidity ^0.8; import { IERC165 } from '@openzeppelin/contracts/utils/introspection/IERC165.sol'; import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { IERC721 } from '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import { IERC1155 } from '@openzeppelin/contracts/token/ERC1155/IERC1155.sol'; struct AbstractTokenMessage { uint256 chainId; // the chain where the token(s) can be reified address implementation; // the contract by which the token(s) can be reified address owner; // the address that owns the token(s) uint256 nonce; // counter to allow otherwise duplicate messages bytes meta; // application-specific information defining the token(s) bytes proof; // application-specific information authorizing the creation of the token(s) } enum AbstractTokenMessageStatus { invalid, // the token message is rejected by the contract valid, // the token message is valid and has not already been used used // the token message has already been used to reify or dereify tokens } interface IAbstractToken { event Reify(AbstractTokenMessage message); event Dereify(AbstractTokenMessage message); // transforms token(s) from message to contract function reify(AbstractTokenMessage calldata message) external; // transforms token(s) from contract to message function dereify(AbstractTokenMessage calldata message) external; // check abstract token message status: an abstract token message can only be reified if valid and not already reified function status(AbstractTokenMessage calldata message) external view returns (AbstractTokenMessageStatus status); } // example abstract token interfaces interface IAbstractERC20 is IAbstractToken, IERC20, IERC165 { // reify the message and then transfer tokens function transfer( address to, uint256 amount, AbstractTokenMessage calldata message ) external returns (bool); // reify the message and then transferFrom tokens function transferFrom( address from, address to, uint256 amount, AbstractTokenMessage calldata message ) external returns (bool); // quantity of tokens in the message function amount(AbstractTokenMessage calldata message) external view returns (uint256); } interface IAbstractERC721 is IAbstractToken, IERC721 { function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata _data, AbstractTokenMessage calldata message ) external; function transferFrom( address from, address to, uint256 tokenId, AbstractTokenMessage calldata message ) external; // id of token in message function id(AbstractTokenMessage calldata message) external view returns (uint256); // reference to further information on the tokens function uri(AbstractTokenMessage calldata message) external view returns (string memory); } interface IAbstractERC1155 is IAbstractToken, IERC1155 { function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data, AbstractTokenMessage calldata message ) external; function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data, AbstractTokenMessage[] calldata messages ) external; // id of token in message function id(AbstractTokenMessage calldata message) external view returns (uint256); // quantity of tokens in the message function amount(AbstractTokenMessage calldata message) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity =0.8.16; import { IERC165 } from '@openzeppelin/contracts/utils/introspection/IERC165.sol'; import { ERC721 } from '@openzeppelin/contracts/token/ERC721/ERC721.sol'; import { IERC721 } from '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import { IAbstractToken, IAbstractERC721, AbstractTokenMessage } from '../interfaces/IAbstractToken.sol'; import { AbstractToken } from './AbstractToken.sol'; contract AbstractERC721 is IERC165, AbstractToken, IAbstractERC721, ERC721 { constructor( string memory _name, string memory _symbol, address _signer ) ERC721(_name, _symbol) AbstractToken(_signer) {} function _validMeta(bytes calldata metadata) internal pure override returns (bool) { /** ERC721 metadata - id: uint256 - amount: not applicable - uri?: string */ return metadata.length >= 32; } function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return type (IERC165).interfaceId == interfaceId || type (IERC721).interfaceId == interfaceId || type(IAbstractERC721).interfaceId == interfaceId || type(IAbstractToken).interfaceId == interfaceId; } function id(AbstractTokenMessage calldata message) public pure returns (uint256) { require(_validMeta(message.meta), 'invalid metadata'); // metadata for ERC721 tokens includes the id and uri return uint256(bytes32(message.meta[0:32])); } function uri(AbstractTokenMessage calldata message) public pure returns (string calldata) { require(_validMeta(message.meta), 'invalid metadata'); return string(message.meta[32:]); } // transforms token from message to contract function _reify(AbstractTokenMessage calldata message) internal override(AbstractToken) virtual { // no permission checking! Callers must validate the message! _mint(message.owner, id(message)); } // transforms token from contract to message function _dereify(AbstractTokenMessage calldata message) internal override(AbstractToken) { // no permission checking! Callers must validate the message! _burn(id(message)); } function safeTransferFrom( address _from, address _to, uint256 _id, bytes calldata _data, AbstractTokenMessage calldata message ) external { reify(message); safeTransferFrom(_from, _to, _id, _data); } function transferFrom( address _from, address _to, uint256 _id, AbstractTokenMessage calldata message ) external { reify(message); transferFrom(_from, _to, _id); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.16; import { IAbstractToken, AbstractTokenMessage } from '../interfaces/IAbstractToken.sol'; import { AbstractToken } from './AbstractToken.sol'; import { AbstractERC721 } from './AbstractERC721.sol'; contract AbstractERC721Limited is AbstractERC721 { uint256 public count; uint256 public max; constructor( string memory _name, string memory _symbol, address _signer, uint256 _max ) AbstractERC721(_name, _symbol, _signer) { max = _max; } function _reify(AbstractTokenMessage calldata message) override internal { // checks require(count < max, 'max supply reached'); // effects count += 1; // interactions super.reify(message); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.16; import "@openzeppelin/contracts/access/Ownable.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol"; import {IAbstractToken, IAbstractERC20, AbstractTokenMessage, AbstractTokenMessageStatus} from "../interfaces/IAbstractToken.sol"; import {GenericEIP712} from "./GenericEIP712.sol"; abstract contract AbstractToken is IAbstractToken, Ownable, GenericEIP712 { event SetSigner(address signer); mapping(bytes32 => bool) used; address private signer; // The type of content signed in the EIP-712 signature bytes32 internal constant TYPE_HASH = keccak256("AbstractTokenMessage(uint256 chainId,address implementation,address owner,uint256 nonce,bytes meta)"); modifier validMessage(AbstractTokenMessage calldata message) { AbstractTokenMessageStatus s = status(message); require(s != AbstractTokenMessageStatus.used, "message used"); require(s != AbstractTokenMessageStatus.invalid, "message invalid"); _; } constructor(address _signer) GenericEIP712('AbstractToken', '1') { _setSigner(_signer); } // the actual mechanics of reifying the token depend on the type of token function _reify(AbstractTokenMessage calldata message) internal virtual; // transforms token(s) from message to contract function reify(AbstractTokenMessage calldata message) public validMessage(message) { // checks require(message.chainId == block.chainid, "for other chain"); require(message.implementation == address(this), "for other contract"); // effects bytes32 id = messageId(message); used[id] = true; // interactions // the actual mechanics of creating the token depends on implementation _reify(message); emit Reify(message); } // the actual mechanics of dereifying the token depend on the type of token function _dereify(AbstractTokenMessage calldata message) internal virtual; // transforms token(s) from contract to message function dereify(AbstractTokenMessage calldata message) public validMessage(message) { // checks require(message.chainId != block.chainid || message.implementation != address(this), "same contract"); // effects bytes32 id = messageId(message); used[id] = true; // interactions _dereify(message); emit Dereify(message); } // check metadata - depends on implementation function _validMeta(bytes calldata metadata) virtual internal view returns (bool); // check abstract token message validity: an abstract token message can only be reified if valid function status(AbstractTokenMessage calldata message) public view returns (AbstractTokenMessageStatus) { bytes32 id = messageId(message); // this message was once valid but now it is reified if (used[id]) return AbstractTokenMessageStatus.used; // the metadata is not valid if (!_validMeta(message.meta)) return AbstractTokenMessageStatus.invalid; // message must include a valid proof (EIP-712 signature) // // note that the message chainId and implementation may be different than this contract's! (It could be intended for another chain but still valid for dereification) bytes32 digest = _hashTypedDataV4(id, message.chainId, message.implementation); if(!SignatureChecker.isValidSignatureNow(signer, digest, message.proof)) return AbstractTokenMessageStatus.invalid; // all checks pass: the message is valid return AbstractTokenMessageStatus.valid; } function messageId(AbstractTokenMessage calldata message) public view returns (bytes32) { // Note that the message ID is also the EIP-712 hash of the message struct - the fields must match the contents of TYPE_HASH return keccak256( abi.encode( TYPE_HASH, message.chainId, message.implementation, message.owner, message.nonce, keccak256(message.meta) ) ); } function _setSigner (address _signer) internal { signer = _signer; emit SetSigner(signer); } // admin functions function setSigner(address _signer) external onlyOwner { _setSigner(_signer); } function getSigner () external view returns (address) { return signer; } function _equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b)); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.16; import { ECDSA } from '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; // based on open zeppelin implementation - allows verifying signatures intended for other chains abstract contract GenericEIP712 { 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; 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, block.chainid, address(this) ); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } function _domainSeparatorV4(uint256 chainId, address implementation) internal view returns (bytes32) { // return the cached domain separator for the original chain if (implementation == _CACHED_THIS && chainId == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { // build a domain separator for another chain return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION, chainId, implementation); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash, uint256 chainId, address implementation ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, chainId, implementation)); } function _hashTypedDataV4(bytes32 structHash, uint256 chainId, address implementation) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(chainId, implementation), structHash); } }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_signer","type":"address"},{"internalType":"uint256","name":"_max","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"meta","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"}],"indexed":false,"internalType":"struct AbstractTokenMessage","name":"message","type":"tuple"}],"name":"Dereify","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"meta","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"}],"indexed":false,"internalType":"struct AbstractTokenMessage","name":"message","type":"tuple"}],"name":"Reify","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"signer","type":"address"}],"name":"SetSigner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"meta","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct AbstractTokenMessage","name":"message","type":"tuple"}],"name":"dereify","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"meta","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct AbstractTokenMessage","name":"message","type":"tuple"}],"name":"id","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"max","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"meta","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct AbstractTokenMessage","name":"message","type":"tuple"}],"name":"messageId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"meta","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct AbstractTokenMessage","name":"message","type":"tuple"}],"name":"reify","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"},{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"meta","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct AbstractTokenMessage","name":"message","type":"tuple"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"meta","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct AbstractTokenMessage","name":"message","type":"tuple"}],"name":"status","outputs":[{"internalType":"enum AbstractTokenMessageStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"meta","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct AbstractTokenMessage","name":"message","type":"tuple"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"meta","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct AbstractTokenMessage","name":"message","type":"tuple"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]
Contract Creation Code
6101406040523480156200001257600080fd5b50604051620028ca380380620028ca8339810160408190526200003591620002d0565b8383838282826040518060400160405280600d81526020016c20b139ba3930b1ba2a37b5b2b760991b815250604051806040016040528060018152602001603160f81b815250620000956200008f6200016360201b60201c565b62000167565b815160209283012081519183019190912060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818801819052818301969096526060810194909452608080850193909352308483018190528151808603909301835260c094850190915281519190950120905291909152610120526200012f81620001b7565b5060036200013e8382620003f2565b5060046200014d8282620003f2565b505050600a9390935550620004be945050505050565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fbb10aee7ef5a307b8097c6a7f2892b909ff1736fd24a6a5260640c185f7153b69060200160405180910390a150565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023357600080fd5b81516001600160401b03808211156200025057620002506200020b565b604051601f8301601f19908116603f011681019082821181831017156200027b576200027b6200020b565b816040528381526020925086838588010111156200029857600080fd5b600091505b83821015620002bc57858201830151818301840152908201906200029d565b600093810190920192909252949350505050565b60008060008060808587031215620002e757600080fd5b84516001600160401b0380821115620002ff57600080fd5b6200030d8883890162000221565b955060208701519150808211156200032457600080fd5b50620003338782880162000221565b604087015190945090506001600160a01b03811681146200035357600080fd5b6060959095015193969295505050565b600181811c908216806200037857607f821691505b6020821081036200039957634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003ed57600081815260208120601f850160051c81016020861015620003c85750805b601f850160051c820191505b81811015620003e957828155600101620003d4565b5050505b505050565b81516001600160401b038111156200040e576200040e6200020b565b62000426816200041f845462000363565b846200039f565b602080601f8311600181146200045e5760008415620004455750858301515b600019600386901b1c1916600185901b178555620003e9565b600085815260208120601f198616915b828110156200048f578886015182559484019460019091019084016200046e565b5085821015620004ae5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161010051610120516123bc6200050e6000396000611843015260006118920152600061186d015260006117b2015260006117ee0152600061181801526123bc6000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c806370a08231116100f9578063a22cb46511610097578063c7fc596a11610071578063c7fc596a146103bd578063c87b56dd146103d0578063e985e9c5146103e3578063f2fde38b146103f657600080fd5b8063a22cb46514610384578063a73bfbe414610397578063b88d4fde146103aa57600080fd5b80638b8f37a8116100d35780638b8f37a81461032a5780638da5cb5b1461034b57806395d89b411461035c5780639787e1cf1461036457600080fd5b806370a08231146102fe578063715018a6146103115780637ac3c02f1461031957600080fd5b806323b872dd1161016657806361f27e5f1161014057806361f27e5f146102bc5780636352211e146102cf5780636ac5db19146102e25780636c19e783146102eb57600080fd5b806323b872dd146102835780633c3316231461029657806342842e0e146102a957600080fd5b806306fdde03116101a257806306fdde031461021d578063081812fc14610232578063095ea7b31461025d5780630e6577e91461027057600080fd5b806301ffc9a7146101c957806304fe745e146101f157806306661abd14610206575b600080fd5b6101dc6101d7366004611b35565b610409565b60405190151581526020015b60405180910390f35b6102046101ff366004611b86565b610476565b005b61020f60095481565b6040519081526020016101e8565b6102256104c9565b6040516101e89190611c97565b610245610240366004611caa565b61055b565b6040516001600160a01b0390911681526020016101e8565b61020461026b366004611cc3565b610582565b61020461027e366004611ced565b61069c565b610204610291366004611d22565b610820565b6102046102a4366004611d5e565b610851565b6102046102b7366004611d22565b61086b565b6102046102ca366004611ced565b610886565b6102456102dd366004611caa565b610a36565b61020f600a5481565b6102046102f9366004611dc6565b610a96565b61020f61030c366004611dc6565b610aaa565b610204610b30565b6002546001600160a01b0316610245565b61033d610338366004611ced565b610b44565b6040516101e8929190611e0a565b6000546001600160a01b0316610245565b610225610bc3565b610377610372366004611ced565b610bd2565b6040516101e89190611e34565b610204610392366004611e5c565b610cae565b61020f6103a5366004611ced565b610cbd565b6102046103b8366004611eae565b610d7e565b61020f6103cb366004611ced565b610db0565b6102256103de366004611caa565b610e26565b6101dc6103f1366004611f8a565b610e9a565b610204610404366004611dc6565b610ec8565b60006301ffc9a760e01b6001600160e01b03198316148061043a57506380ac58cd60e01b6001600160e01b03198316145b8061045557506374be0cbf60e01b6001600160e01b03198316145b80610470575063f810e87960e01b6001600160e01b03198316145b92915050565b61047f81610886565b6104c186868686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610d7e92505050565b505050505050565b6060600380546104d890611fbd565b80601f016020809104026020016040519081016040528092919081815260200182805461050490611fbd565b80156105515780601f1061052657610100808354040283529160200191610551565b820191906000526020600020905b81548152906001019060200180831161053457829003601f168201915b5050505050905090565b600061056682610f3e565b506000908152600760205260409020546001600160a01b031690565b600061058d82610a36565b9050806001600160a01b0316836001600160a01b0316036105ff5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061061b575061061b8133610e9a565b61068d5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016105f6565b6106978383610f9d565b505050565b8060006106a882610bd2565b905060028160028111156106be576106be611e1e565b036106fa5760405162461bcd60e51b815260206004820152600c60248201526b1b595cdcd859d9481d5cd95960a21b60448201526064016105f6565b600081600281111561070e5761070e611e1e565b0361074d5760405162461bcd60e51b815260206004820152600f60248201526e1b595cdcd859d9481a5b9d985b1a59608a1b60448201526064016105f6565b8235461415806107755750306107696040850160208601611dc6565b6001600160a01b031614155b6107b15760405162461bcd60e51b815260206004820152600d60248201526c1cd85b594818dbdb9d1c9858dd609a1b60448201526064016105f6565b60006107bc84610cbd565b6000818152600160208190526040909120805460ff1916909117905590506107e38461100b565b7f84f1a7778bf3428465050ad88c7c47e9dc1c54ac950919d1e66ee23f87859c4c846040516108129190612037565b60405180910390a150505050565b61082a338261101c565b6108465760405162461bcd60e51b81526004016105f6906120d1565b61069783838361107b565b61085a81610886565b610865848484610820565b50505050565b61069783838360405180602001604052806000815250610d7e565b80600061089282610bd2565b905060028160028111156108a8576108a8611e1e565b036108e45760405162461bcd60e51b815260206004820152600c60248201526b1b595cdcd859d9481d5cd95960a21b60448201526064016105f6565b60008160028111156108f8576108f8611e1e565b036109375760405162461bcd60e51b815260206004820152600f60248201526e1b595cdcd859d9481a5b9d985b1a59608a1b60448201526064016105f6565b823546146109795760405162461bcd60e51b815260206004820152600f60248201526e3337b91037ba3432b91031b430b4b760891b60448201526064016105f6565b3061098a6040850160208601611dc6565b6001600160a01b0316146109d55760405162461bcd60e51b8152602060048201526012602482015271199bdc881bdd1a195c8818dbdb9d1c9858dd60721b60448201526064016105f6565b60006109e084610cbd565b6000818152600160208190526040909120805460ff191690911790559050610a0784611217565b7fc3126dc123edaee63ef2c7a9bd90dc5df6480aa64220fd88d3cf402395003511846040516108129190612037565b6000818152600560205260408120546001600160a01b0316806104705760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016105f6565b610a9e611281565b610aa7816112db565b50565b60006001600160a01b038216610b145760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016105f6565b506001600160a01b031660009081526006602052604090205490565b610b38611281565b610b42600061132f565b565b366000610b60610b57608085018561211f565b60201115919050565b610b9f5760405162461bcd60e51b815260206004820152601060248201526f696e76616c6964206d6574616461746160801b60448201526064016105f6565b610bac608084018461211f565b610bba916020908290612166565b91509150915091565b6060600480546104d890611fbd565b600080610bde83610cbd565b60008181526001602052604090205490915060ff1615610c015750600292915050565b610c11610b57608085018561211f565b610c1e5750600092915050565b6000610c3b828535610c366040880160208901611dc6565b61137f565b600254909150610c96906001600160a01b031682610c5c60a088018861211f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506113cf92505050565b610ca4575060009392505050565b5060019392505050565b610cb9338383611511565b5050565b60007f6260efc2366089225b5b33136d6b9ff38e537eb6848db9023467be41bf9eea008235610cf26040850160208601611dc6565b610d026060860160408701611dc6565b6060860135610d14608088018861211f565b604051610d22929190612190565b6040805191829003822060208301979097528101949094526001600160a01b0392831660608501529116608083015260a082015260c081019190915260e001604051602081830303815290604052805190602001209050919050565b610d88338361101c565b610da45760405162461bcd60e51b81526004016105f6906120d1565b610865848484846115df565b6000610dc2610b57608084018461211f565b610e015760405162461bcd60e51b815260206004820152601060248201526f696e76616c6964206d6574616461746160801b60448201526064016105f6565b610e0e608083018361211f565b610e1d91602091600091612166565b610470916121a0565b6060610e3182610f3e565b6000610e4860408051602081019091526000815290565b90506000815111610e685760405180602001604052806000815250610e93565b80610e7284611612565b604051602001610e839291906121be565b6040516020818303038152906040525b9392505050565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b610ed0611281565b6001600160a01b038116610f355760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f6565b610aa78161132f565b6000818152600560205260409020546001600160a01b0316610aa75760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016105f6565b600081815260076020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610fd282610a36565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b610aa761101782610db0565b611713565b60008061102883610a36565b9050806001600160a01b0316846001600160a01b0316148061104f575061104f8185610e9a565b806110735750836001600160a01b03166110688461055b565b6001600160a01b0316145b949350505050565b826001600160a01b031661108e82610a36565b6001600160a01b0316146110f25760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016105f6565b6001600160a01b0382166111545760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016105f6565b61115f600082610f9d565b6001600160a01b0383166000908152600660205260408120805460019290611188908490612203565b90915550506001600160a01b03821660009081526006602052604081208054600192906111b6908490612216565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a546009541061125f5760405162461bcd60e51b81526020600482015260126024820152711b585e081cdd5c1c1b1e481c995858da195960721b60448201526064016105f6565b6001600960008282546112729190612216565b90915550610aa7905081610886565b6000546001600160a01b03163314610b425760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105f6565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fbb10aee7ef5a307b8097c6a7f2892b909ff1736fd24a6a5260640c185f7153b69060200160405180910390a150565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061107361138e84846117ae565b8560405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006113de85856118ec565b909250905060008160048111156113f7576113f7611e1e565b1480156114155750856001600160a01b0316826001600160a01b0316145b1561142557600192505050610e93565b600080876001600160a01b0316631626ba7e60e01b888860405160240161144d929190612229565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161148b9190612242565b600060405180830381855afa9150503d80600081146114c6576040519150601f19603f3d011682016040523d82523d6000602084013e6114cb565b606091505b50915091508180156114de575080516020145b801561150557508051630b135d3f60e11b90611503908301602090810190840161225e565b145b98975050505050505050565b816001600160a01b0316836001600160a01b0316036115725760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016105f6565b6001600160a01b03838116600081815260086020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6115ea84848461107b565b6115f684848484611931565b6108655760405162461bcd60e51b81526004016105f690612277565b6060816000036116395750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611663578061164d816122c9565b915061165c9050600a836122f8565b915061163d565b60008167ffffffffffffffff81111561167e5761167e611e98565b6040519080825280601f01601f1916602001820160405280156116a8576020820181803683370190505b5090505b8415611073576116bd600183612203565b91506116ca600a8661230c565b6116d5906030612216565b60f81b8183815181106116ea576116ea612320565b60200101906001600160f81b031916908160001a90535061170c600a866122f8565b94506116ac565b600061171e82610a36565b905061172b600083610f9d565b6001600160a01b0381166000908152600660205260408120805460019290611754908490612203565b909155505060008281526005602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614801561181057507f000000000000000000000000000000000000000000000000000000000000000083145b1561183c57507f0000000000000000000000000000000000000000000000000000000000000000610470565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f00000000000000000000000000000000000000000000000000000000000000006060830152608082018590526001600160a01b03841660a0808401919091528351808403909101815260c09092019092528051910120610470565b60008082516041036119225760208301516040840151606085015160001a61191687828585611a32565b9450945050505061192a565b506000905060025b9250929050565b60006001600160a01b0384163b15611a2757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611975903390899088908890600401612336565b6020604051808303816000875af19250505080156119b0575060408051601f3d908101601f191682019092526119ad91810190612369565b60015b611a0d573d8080156119de576040519150601f19603f3d011682016040523d82523d6000602084013e6119e3565b606091505b508051600003611a055760405162461bcd60e51b81526004016105f690612277565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611073565b506001949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611a695750600090506003611b16565b8460ff16601b14158015611a8157508460ff16601c14155b15611a925750600090506004611b16565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611ae6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611b0f57600060019250925050611b16565b9150600090505b94509492505050565b6001600160e01b031981168114610aa757600080fd5b600060208284031215611b4757600080fd5b8135610e9381611b1f565b80356001600160a01b0381168114611b6957600080fd5b919050565b600060c08284031215611b8057600080fd5b50919050565b60008060008060008060a08789031215611b9f57600080fd5b611ba887611b52565b9550611bb660208801611b52565b945060408701359350606087013567ffffffffffffffff80821115611bda57600080fd5b818901915089601f830112611bee57600080fd5b813581811115611bfd57600080fd5b8a6020828501011115611c0f57600080fd5b602083019550809450506080890135915080821115611c2d57600080fd5b50611c3a89828a01611b6e565b9150509295509295509295565b60005b83811015611c62578181015183820152602001611c4a565b50506000910152565b60008151808452611c83816020860160208601611c47565b601f01601f19169290920160200192915050565b602081526000610e936020830184611c6b565b600060208284031215611cbc57600080fd5b5035919050565b60008060408385031215611cd657600080fd5b611cdf83611b52565b946020939093013593505050565b600060208284031215611cff57600080fd5b813567ffffffffffffffff811115611d1657600080fd5b61107384828501611b6e565b600080600060608486031215611d3757600080fd5b611d4084611b52565b9250611d4e60208501611b52565b9150604084013590509250925092565b60008060008060808587031215611d7457600080fd5b611d7d85611b52565b9350611d8b60208601611b52565b925060408501359150606085013567ffffffffffffffff811115611dae57600080fd5b611dba87828801611b6e565b91505092959194509250565b600060208284031215611dd857600080fd5b610e9382611b52565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000611073602083018486611de1565b634e487b7160e01b600052602160045260246000fd5b6020810160038310611e5657634e487b7160e01b600052602160045260246000fd5b91905290565b60008060408385031215611e6f57600080fd5b611e7883611b52565b915060208301358015158114611e8d57600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611ec457600080fd5b611ecd85611b52565b9350611edb60208601611b52565b925060408501359150606085013567ffffffffffffffff80821115611eff57600080fd5b818701915087601f830112611f1357600080fd5b813581811115611f2557611f25611e98565b604051601f8201601f19908116603f01168101908382118183101715611f4d57611f4d611e98565b816040528281528a6020848701011115611f6657600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215611f9d57600080fd5b611fa683611b52565b9150611fb460208401611b52565b90509250929050565b600181811c90821680611fd157607f821691505b602082108103611b8057634e487b7160e01b600052602260045260246000fd5b6000808335601e1984360301811261200857600080fd5b830160208101925035905067ffffffffffffffff81111561202857600080fd5b80360382131561192a57600080fd5b6020815281356020820152600061205060208401611b52565b60018060a01b0380821660408501528061206c60408701611b52565b16606085015250506060830135608083015261208b6080840184611ff1565b60c060a08501526120a060e085018284611de1565b9150506120b060a0850185611ff1565b848303601f190160c08601526120c7838284611de1565b9695505050505050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6000808335601e1984360301811261213657600080fd5b83018035915067ffffffffffffffff82111561215157600080fd5b60200191503681900382131561192a57600080fd5b6000808585111561217657600080fd5b8386111561218357600080fd5b5050820193919092039150565b8183823760009101908152919050565b8035602083101561047057600019602084900360031b1b1692915050565b600083516121d0818460208801611c47565b8351908301906121e4818360208801611c47565b01949350505050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610470576104706121ed565b80820180821115610470576104706121ed565b8281526040602082015260006110736040830184611c6b565b60008251612254818460208701611c47565b9190910192915050565b60006020828403121561227057600080fd5b5051919050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000600182016122db576122db6121ed565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082612307576123076122e2565b500490565b60008261231b5761231b6122e2565b500690565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906120c790830184611c6b565b60006020828403121561237b57600080fd5b8151610e9381611b1f56fea2646970667358221220d0e3616222399fa5a3f73fa5152ac76ab47ac510145f7e673f5cacfceb4a697064736f6c63430008100033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000fb0a178e9ad20bc82598ac3b02116deb300eed5800000000000000000000000000000000000000000000000000000000000027100000000000000000000000000000000000000000000000000000000000000007536f6674696573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007534f465449455300000000000000000000000000000000000000000000000000
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000fb0a178e9ad20bc82598ac3b02116deb300eed5800000000000000000000000000000000000000000000000000000000000027100000000000000000000000000000000000000000000000000000000000000007536f6674696573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007534f465449455300000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): Softies
Arg [1] : _symbol (string): SOFTIES
Arg [2] : _signer (address): 0xfb0a178e9ad20bc82598ac3b02116deb300eed58
Arg [3] : _max (uint256): 10000
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 000000000000000000000000fb0a178e9ad20bc82598ac3b02116deb300eed58
Arg [3] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [5] : 536f667469657300000000000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [7] : 534f465449455300000000000000000000000000000000000000000000000000
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.