diff --git a/contracts/Multiwrap.sol b/contracts/Multiwrap.sol index 9e8680516..b6fdafeaa 100644 --- a/contracts/Multiwrap.sol +++ b/contracts/Multiwrap.sol @@ -22,6 +22,7 @@ import "./openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol"; // Helpers import "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol"; import "./lib/CurrencyTransferLib.sol"; import "./lib/MultiTokenTransferLib.sol"; @@ -354,7 +355,7 @@ contract Multiwrap is public view virtual - override(AccessControlEnumerableUpgradeable, ERC1155Upgradeable, IERC165Upgradeable, ERC1155ReceiverUpgradeable) + override(AccessControlEnumerableUpgradeable, ERC1155Upgradeable, ERC1155ReceiverUpgradeable) returns (bool) { return diff --git a/contracts/Pack.sol b/contracts/Pack.sol index 62b77e82f..2c98be7e6 100644 --- a/contracts/Pack.sol +++ b/contracts/Pack.sol @@ -4,8 +4,8 @@ pragma solidity ^0.8.11; // Base import "./openzeppelin-presets/ERC1155PresetUpgradeable.sol"; import "./interfaces/IThirdwebContract.sol"; -import "./interfaces/IThirdwebOwnable.sol"; -import "./interfaces/IThirdwebRoyalty.sol"; +import "./feature/interface/IThirdwebOwnable.sol"; +import "./feature/interface/IThirdwebRoyalty.sol"; // Randomness import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; @@ -20,6 +20,7 @@ import "./lib/FeeType.sol"; // Helper interfaces import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol"; // Thirdweb top-level import "./interfaces/ITWFee.sol"; @@ -527,12 +528,7 @@ contract Pack is **/ /// @dev See EIP 165 - function supportsInterface(bytes4 interfaceId) - public - view - override(ERC1155PresetUpgradeable, IERC165Upgradeable) - returns (bool) - { + function supportsInterface(bytes4 interfaceId) public view override(ERC1155PresetUpgradeable) returns (bool) { return super.supportsInterface(interfaceId) || type(IERC2981Upgradeable).interfaceId == interfaceId; } diff --git a/contracts/drop/DropERC1155.sol b/contracts/drop/DropERC1155.sol index 07c9ac2ed..a0345717c 100644 --- a/contracts/drop/DropERC1155.sol +++ b/contracts/drop/DropERC1155.sol @@ -17,10 +17,13 @@ import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable. // ========== Internal imports ========== import "../interfaces/IThirdwebContract.sol"; -import "../interfaces/IThirdwebPlatformFee.sol"; -import "../interfaces/IThirdwebPrimarySale.sol"; -import "../interfaces/IThirdwebRoyalty.sol"; -import "../interfaces/IThirdwebOwnable.sol"; + +// ========== Features ========== + +import "../feature/interface/IThirdwebPlatformFee.sol"; +import "../feature/interface/IThirdwebPrimarySale.sol"; +import "../feature/interface/IThirdwebRoyalty.sol"; +import "../feature/interface/IThirdwebOwnable.sol"; import { IDropERC1155 } from "../interfaces/drop/IDropERC1155.sol"; import { ITWFee } from "../interfaces/ITWFee.sol"; diff --git a/contracts/drop/DropERC20.sol b/contracts/drop/DropERC20.sol index 315614bc2..2f2b1cf96 100644 --- a/contracts/drop/DropERC20.sol +++ b/contracts/drop/DropERC20.sol @@ -16,8 +16,11 @@ import "@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol"; // ========== Internal imports ========== import "../interfaces/IThirdwebContract.sol"; -import "../interfaces/IThirdwebPlatformFee.sol"; -import "../interfaces/IThirdwebPrimarySale.sol"; + +// ========== Features ========== + +import "../feature/interface/IThirdwebPlatformFee.sol"; +import "../feature/interface/IThirdwebPrimarySale.sol"; import { IDropERC20 } from "../interfaces/drop/IDropERC20.sol"; import { ITWFee } from "../interfaces/ITWFee.sol"; diff --git a/contracts/drop/DropERC721.sol b/contracts/drop/DropERC721.sol index aeb0fd194..501dde0b3 100644 --- a/contracts/drop/DropERC721.sol +++ b/contracts/drop/DropERC721.sol @@ -17,12 +17,14 @@ import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import { IDropERC721 } from "../interfaces/drop/IDropERC721.sol"; import { ITWFee } from "../interfaces/ITWFee.sol"; - import "../interfaces/IThirdwebContract.sol"; -import "../interfaces/IThirdwebPlatformFee.sol"; -import "../interfaces/IThirdwebPrimarySale.sol"; -import "../interfaces/IThirdwebRoyalty.sol"; -import "../interfaces/IThirdwebOwnable.sol"; + +// ========== Features ========== + +import "../feature/interface/IThirdwebPlatformFee.sol"; +import "../feature/interface/IThirdwebPrimarySale.sol"; +import "../feature/interface/IThirdwebRoyalty.sol"; +import "../feature/interface/IThirdwebOwnable.sol"; import "../openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol"; diff --git a/contracts/SignatureDrop.sol b/contracts/drop/SignatureDrop.sol similarity index 96% rename from contracts/SignatureDrop.sol rename to contracts/drop/SignatureDrop.sol index ab4f6ed26..1ea9497f4 100644 --- a/contracts/SignatureDrop.sol +++ b/contracts/drop/SignatureDrop.sol @@ -11,23 +11,25 @@ import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; // ========== Internal imports ========== -import "./interfaces/ITWFee.sol"; +import "../interfaces/ITWFee.sol"; +import "../interfaces/IThirdwebContract.sol"; +import "../interfaces/drop/IDropClaimCondition.sol"; -import "./interfaces/IThirdwebContract.sol"; -import "./interfaces/IThirdwebPlatformFee.sol"; -import "./interfaces/IThirdwebPrimarySale.sol"; -import "./interfaces/IThirdwebRoyalty.sol"; -import "./interfaces/IThirdwebOwnable.sol"; +// ========== Features ========== -import "./interfaces/drop/IDropClaimCondition.sol"; -import "./drop/DelayedReveal.sol"; -import "./drop/LazyMint.sol"; -import "./token/SignatureMintUpgradeable.sol"; +import "../feature/interface/IThirdwebPlatformFee.sol"; +import "../feature/interface/IThirdwebPrimarySale.sol"; +import "../feature/interface/IThirdwebRoyalty.sol"; +import "../feature/interface/IThirdwebOwnable.sol"; +import "../feature/DelayedReveal.sol"; +import "../feature/LazyMint.sol"; +import "../feature/SignatureMintUpgradeable.sol"; -import "./openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol"; +import "../openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol"; +import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol"; -import "./lib/CurrencyTransferLib.sol"; -import "./lib/FeeType.sol"; +import "../lib/CurrencyTransferLib.sol"; +import "../lib/FeeType.sol"; contract SignatureDrop is Initializable, @@ -206,7 +208,7 @@ contract SignatureDrop is public view virtual - override(ERC721EnumerableUpgradeable, AccessControlEnumerableUpgradeable, IERC165Upgradeable) + override(ERC721EnumerableUpgradeable, AccessControlEnumerableUpgradeable) returns (bool) { return super.supportsInterface(interfaceId) || type(IERC2981Upgradeable).interfaceId == interfaceId; diff --git a/contracts/eip/ERC1155.sol b/contracts/eip/ERC1155.sol new file mode 100644 index 000000000..0d80f1707 --- /dev/null +++ b/contracts/eip/ERC1155.sol @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.0; + +/** + @title ERC-1155 Multi Token Standard + @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md + Note: The ERC-165 identifier for this interface is 0xd9b67a26. + */ +interface ERC1155 { + /** + @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). + The `_operator` argument MUST be msg.sender. + The `_from` argument MUST be the address of the holder whose balance is decreased. + The `_to` argument MUST be the address of the recipient whose balance is increased. + The `_id` argument MUST be the token type being transferred. + The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by. + When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). + When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address). + */ + event TransferSingle( + address indexed _operator, + address indexed _from, + address indexed _to, + uint256 _id, + uint256 _value + ); + + /** + @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). + The `_operator` argument MUST be msg.sender. + The `_from` argument MUST be the address of the holder whose balance is decreased. + The `_to` argument MUST be the address of the recipient whose balance is increased. + The `_ids` argument MUST be the list of tokens being transferred. + The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by. + When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). + When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address). + */ + event TransferBatch( + address indexed _operator, + address indexed _from, + address indexed _to, + uint256[] _ids, + uint256[] _values + ); + + /** + @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled). + */ + event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); + + /** + @dev MUST emit when the URI is updated for a token ID. + URIs are defined in RFC 3986. + The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema". + */ + event URI(string _value, uint256 indexed _id); + + /** + @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call). + @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard). + MUST revert if `_to` is the zero address. + MUST revert if balance of holder for token `_id` is lower than the `_value` sent. + MUST revert on any other error. + MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard). + After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard). + @param _from Source address + @param _to Target address + @param _id ID of the token type + @param _value Transfer amount + @param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to` + */ + function safeTransferFrom( + address _from, + address _to, + uint256 _id, + uint256 _value, + bytes calldata _data + ) external; + + /** + @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call). + @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard). + MUST revert if `_to` is the zero address. + MUST revert if length of `_ids` is not the same as length of `_values`. + MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient. + MUST revert on any other error. + MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard). + Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc). + After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard). + @param _from Source address + @param _to Target address + @param _ids IDs of each token type (order and length must match _values array) + @param _values Transfer amounts per token type (order and length must match _ids array) + @param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to` + */ + function safeBatchTransferFrom( + address _from, + address _to, + uint256[] calldata _ids, + uint256[] calldata _values, + bytes calldata _data + ) external; + + /** + @notice Get the balance of an account's Tokens. + @param _owner The address of the token holder + @param _id ID of the Token + @return The _owner's balance of the Token type requested + */ + function balanceOf(address _owner, uint256 _id) external view returns (uint256); + + /** + @notice Get the balance of multiple account/token pairs + @param _owners The addresses of the token holders + @param _ids ID of the Tokens + @return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair) + */ + function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) + external + view + returns (uint256[] memory); + + /** + @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens. + @dev MUST emit the ApprovalForAll event on success. + @param _operator Address to add to the set of authorized operators + @param _approved True if the operator is approved, false to revoke approval + */ + function setApprovalForAll(address _operator, bool _approved) external; + + /** + @notice Queries the approval status of an operator for a given owner. + @param _owner The owner of the Tokens + @param _operator Address of authorized operator + @return True if the operator is approved, false if not + */ + function isApprovedForAll(address _owner, address _operator) external view returns (bool); +} diff --git a/contracts/eip/ERC1155Enumerable.sol b/contracts/eip/ERC1155Enumerable.sol new file mode 100644 index 000000000..8ae819422 --- /dev/null +++ b/contracts/eip/ERC1155Enumerable.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.0; + +/// @title ERC1155Enumarable Non-Fungible Token Standard, optional enumeration extension +/// @dev See https://eips.ethereum.org/EIPS/eip-1155 +interface ERC1155Enumerable { + /// @notice Count NFTs tracked by this contract + /// @return A count of valid NFTs tracked by this contract, where each one of + /// them has an assigned and queryable owner not equal to the zero address + function totalSupply(uint256 id) external view returns (uint256); + + /// @notice Returns the next token ID available for minting + /// @return The token identifier for the `_index`th NFT, + /// (sort order not specified) + function nextTokenIdToMint() external view returns (uint256); +} diff --git a/contracts/eip/ERC1155Metadata.sol b/contracts/eip/ERC1155Metadata.sol new file mode 100644 index 000000000..c0fc731de --- /dev/null +++ b/contracts/eip/ERC1155Metadata.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.0; + +/** + Note: The ERC-165 identifier for this interface is 0x0e89341c. +*/ +interface ERC1155Metadata { + /** + @notice A distinct Uniform Resource Identifier (URI) for a given token. + @dev URIs are defined in RFC 3986. + The URI may point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema". + @return URI string + */ + function uri(uint256 _id) external view returns (string memory); +} diff --git a/contracts/eip/ERC20.sol b/contracts/eip/ERC20.sol new file mode 100644 index 000000000..1969d7eda --- /dev/null +++ b/contracts/eip/ERC20.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.0; + +/** + * @title ERC20 interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +interface ERC20 { + function totalSupply() external view returns (uint256); + + function balanceOf(address who) external view returns (uint256); + + function allowance(address owner, address spender) external view returns (uint256); + + function transfer(address to, uint256 value) external returns (bool); + + function approve(address spender, uint256 value) external returns (bool); + + function transferFrom( + address from, + address to, + uint256 value + ) external returns (bool); + + event Transfer(address indexed from, address indexed to, uint256 value); + + event Approval(address indexed owner, address indexed spender, uint256 value); +} diff --git a/contracts/eip/ERC20Metadata.sol b/contracts/eip/ERC20Metadata.sol new file mode 100644 index 000000000..c2ed055ca --- /dev/null +++ b/contracts/eip/ERC20Metadata.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.0; + +/** + * @title ERC20Metadata interface + * @dev see https://github.com/ethereum/EIPs/issues/20 + */ +interface ERC20Metadata { + function name() external view returns (string memory); + + function symbol() external view returns (string memory); + + function decimals() external view returns (uint8); +} diff --git a/contracts/eip/ERC721.sol b/contracts/eip/ERC721.sol index d1b8516a1..29ad3f645 100644 --- a/contracts/eip/ERC721.sol +++ b/contracts/eip/ERC721.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; /// @title ERC-721 Non-Fungible Token Standard /// @dev See https://eips.ethereum.org/EIPS/eip-721 diff --git a/contracts/eip/ERC721Enumerable.sol b/contracts/eip/ERC721Enumerable.sol index 0d625bdcf..1750a9bb3 100644 --- a/contracts/eip/ERC721Enumerable.sol +++ b/contracts/eip/ERC721Enumerable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; /// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension /// @dev See https://eips.ethereum.org/EIPS/eip-721 diff --git a/contracts/eip/ERC721Metadata.sol b/contracts/eip/ERC721Metadata.sol index 79cd43329..908316f18 100644 --- a/contracts/eip/ERC721Metadata.sol +++ b/contracts/eip/ERC721Metadata.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; /// @title ERC-721 Non-Fungible Token Standard, optional metadata extension /// @dev See https://eips.ethereum.org/EIPS/eip-721 diff --git a/contracts/drop/DelayedReveal.sol b/contracts/feature/DelayedReveal.sol similarity index 96% rename from contracts/drop/DelayedReveal.sol rename to contracts/feature/DelayedReveal.sol index 5ccc80c29..41ecf821e 100644 --- a/contracts/drop/DelayedReveal.sol +++ b/contracts/feature/DelayedReveal.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; -import "../interfaces/drop/IDelayedReveal.sol"; +import "./interface/IDelayedReveal.sol"; abstract contract DelayedReveal is IDelayedReveal { /// @dev Mapping from id of a batch of tokens => to encrypted base URI for the respective batch of tokens. diff --git a/contracts/drop/LazyMint.sol b/contracts/feature/LazyMint.sol similarity index 97% rename from contracts/drop/LazyMint.sol rename to contracts/feature/LazyMint.sol index 0dff2856c..81fde817e 100644 --- a/contracts/drop/LazyMint.sol +++ b/contracts/feature/LazyMint.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; -import "../interfaces/drop/ILazyMint.sol"; +import "./interface/ILazyMint.sol"; abstract contract LazyMint is ILazyMint { /// @dev Largest tokenId of each batch of tokens with the same baseURI. diff --git a/contracts/token/SignatureMint.sol b/contracts/feature/SignatureMint.sol similarity index 97% rename from contracts/token/SignatureMint.sol rename to contracts/feature/SignatureMint.sol index d4bf9c4f4..8e1e0e2b2 100644 --- a/contracts/token/SignatureMint.sol +++ b/contracts/feature/SignatureMint.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; -import "../interfaces/token/ISignatureMint.sol"; +import "./interface/ISignatureMint.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; diff --git a/contracts/token/SignatureMintUpgradeable.sol b/contracts/feature/SignatureMintUpgradeable.sol similarity index 97% rename from contracts/token/SignatureMintUpgradeable.sol rename to contracts/feature/SignatureMintUpgradeable.sol index 11106c375..fda4dee93 100644 --- a/contracts/token/SignatureMintUpgradeable.sol +++ b/contracts/feature/SignatureMintUpgradeable.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; -import "../interfaces/token/ISignatureMint.sol"; +import "./interface/ISignatureMint.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; diff --git a/contracts/interfaces/token/IBurnableERC1155.sol b/contracts/feature/interface/IBurnableERC1155.sol similarity index 100% rename from contracts/interfaces/token/IBurnableERC1155.sol rename to contracts/feature/interface/IBurnableERC1155.sol diff --git a/contracts/interfaces/token/IBurnableERC20.sol b/contracts/feature/interface/IBurnableERC20.sol similarity index 100% rename from contracts/interfaces/token/IBurnableERC20.sol rename to contracts/feature/interface/IBurnableERC20.sol diff --git a/contracts/interfaces/token/IBurnableERC721.sol b/contracts/feature/interface/IBurnableERC721.sol similarity index 100% rename from contracts/interfaces/token/IBurnableERC721.sol rename to contracts/feature/interface/IBurnableERC721.sol diff --git a/contracts/interfaces/drop/IDelayedReveal.sol b/contracts/feature/interface/IDelayedReveal.sol similarity index 92% rename from contracts/interfaces/drop/IDelayedReveal.sol rename to contracts/feature/interface/IDelayedReveal.sol index 409a069fb..51d96ff7f 100644 --- a/contracts/interfaces/drop/IDelayedReveal.sol +++ b/contracts/feature/interface/IDelayedReveal.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; interface IDelayedReveal { function reveal(uint256 identifier, bytes calldata key) external returns (string memory revealedURI); diff --git a/contracts/interfaces/drop/ILazyMint.sol b/contracts/feature/interface/ILazyMint.sol similarity index 88% rename from contracts/interfaces/drop/ILazyMint.sol rename to contracts/feature/interface/ILazyMint.sol index bcf1510f6..e775cee38 100644 --- a/contracts/interfaces/drop/ILazyMint.sol +++ b/contracts/feature/interface/ILazyMint.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; interface ILazyMint { function lazyMint( diff --git a/contracts/interfaces/token/IMintableERC1155.sol b/contracts/feature/interface/IMintableERC1155.sol similarity index 100% rename from contracts/interfaces/token/IMintableERC1155.sol rename to contracts/feature/interface/IMintableERC1155.sol diff --git a/contracts/interfaces/token/IMintableERC20.sol b/contracts/feature/interface/IMintableERC20.sol similarity index 100% rename from contracts/interfaces/token/IMintableERC20.sol rename to contracts/feature/interface/IMintableERC20.sol diff --git a/contracts/interfaces/token/IMintableERC721.sol b/contracts/feature/interface/IMintableERC721.sol similarity index 100% rename from contracts/interfaces/token/IMintableERC721.sol rename to contracts/feature/interface/IMintableERC721.sol diff --git a/contracts/interfaces/token/ISignatureMint.sol b/contracts/feature/interface/ISignatureMint.sol similarity index 92% rename from contracts/interfaces/token/ISignatureMint.sol rename to contracts/feature/interface/ISignatureMint.sol index a82a0edee..9eda91c26 100644 --- a/contracts/interfaces/token/ISignatureMint.sol +++ b/contracts/feature/interface/ISignatureMint.sol @@ -1,13 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; -import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol"; -import "../IThirdwebContract.sol"; -import "../IThirdwebPlatformFee.sol"; -import "../IThirdwebPrimarySale.sol"; -import "../IThirdwebRoyalty.sol"; -import "../IThirdwebOwnable.sol"; - /** * The 'signature minting' mechanism used in thirdweb Token smart contracts is a way for a contract admin to authorize an external party's * request to mint tokens on the admin's contract. diff --git a/contracts/interfaces/IThirdwebOwnable.sol b/contracts/feature/interface/IThirdwebOwnable.sol similarity index 94% rename from contracts/interfaces/IThirdwebOwnable.sol rename to contracts/feature/interface/IThirdwebOwnable.sol index e06401bbd..20e847aec 100644 --- a/contracts/interfaces/IThirdwebOwnable.sol +++ b/contracts/feature/interface/IThirdwebOwnable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; interface IThirdwebOwnable { /// @dev Returns the owner of the contract. diff --git a/contracts/interfaces/IThirdwebPlatformFee.sol b/contracts/feature/interface/IThirdwebPlatformFee.sol similarity index 95% rename from contracts/interfaces/IThirdwebPlatformFee.sol rename to contracts/feature/interface/IThirdwebPlatformFee.sol index 437406129..1b1be27cb 100644 --- a/contracts/interfaces/IThirdwebPlatformFee.sol +++ b/contracts/feature/interface/IThirdwebPlatformFee.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; interface IThirdwebPlatformFee { /// @dev Returns the platform fee bps and recipient. diff --git a/contracts/interfaces/IThirdwebPrimarySale.sol b/contracts/feature/interface/IThirdwebPrimarySale.sol similarity index 95% rename from contracts/interfaces/IThirdwebPrimarySale.sol rename to contracts/feature/interface/IThirdwebPrimarySale.sol index 8e14148e7..1ccd585d2 100644 --- a/contracts/interfaces/IThirdwebPrimarySale.sol +++ b/contracts/feature/interface/IThirdwebPrimarySale.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; interface IThirdwebPrimarySale { /// @dev The adress that receives all primary sales value. diff --git a/contracts/interfaces/IThirdwebRoyalty.sol b/contracts/feature/interface/IThirdwebRoyalty.sol similarity index 71% rename from contracts/interfaces/IThirdwebRoyalty.sol rename to contracts/feature/interface/IThirdwebRoyalty.sol index 70de127ce..1c0a611c4 100644 --- a/contracts/interfaces/IThirdwebRoyalty.sol +++ b/contracts/feature/interface/IThirdwebRoyalty.sol @@ -1,9 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; -import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol"; - -interface IThirdwebRoyalty is IERC2981Upgradeable { +interface IThirdwebRoyalty { struct RoyaltyInfo { address recipient; uint256 bps; @@ -25,6 +23,15 @@ interface IThirdwebRoyalty is IERC2981Upgradeable { /// @dev Returns the royalty recipient for a particular token Id. function getRoyaltyInfoForToken(uint256 tokenId) external view returns (address, uint16); + /** + * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of + * exchange. The royalty amount is denominated and should be payed in that same unit of exchange. + */ + function royaltyInfo(uint256 tokenId, uint256 salePrice) + external + view + returns (address receiver, uint256 royaltyAmount); + /// @dev Emitted when royalty info is updated. event DefaultRoyalty(address newRoyaltyRecipient, uint256 newRoyaltyBps); diff --git a/contracts/interfaces/IMultiwrap.sol b/contracts/interfaces/IMultiwrap.sol index b7db26f3d..2c0988575 100644 --- a/contracts/interfaces/IMultiwrap.sol +++ b/contracts/interfaces/IMultiwrap.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.11; import "./IThirdwebContract.sol"; -import "./IThirdwebRoyalty.sol"; -import "./IThirdwebOwnable.sol"; +import "../feature/interface/IThirdwebRoyalty.sol"; +import "../feature/interface/IThirdwebOwnable.sol"; import "../lib/MultiTokenTransferLib.sol"; interface IMultiwrap is IThirdwebContract, IThirdwebOwnable, IThirdwebRoyalty { diff --git a/contracts/interfaces/IPack.sol b/contracts/interfaces/IPack.sol index 2cad69d40..f36e81d76 100644 --- a/contracts/interfaces/IPack.sol +++ b/contracts/interfaces/IPack.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.11; import "./IThirdwebContract.sol"; -import "./IThirdwebOwnable.sol"; -import "./IThirdwebRoyalty.sol"; +import "../feature/interface/IThirdwebOwnable.sol"; +import "../feature/interface/IThirdwebRoyalty.sol"; interface IPack is IThirdwebContract, IThirdwebOwnable, IThirdwebRoyalty { /** diff --git a/contracts/interfaces/drop/IDropClaimCondition.sol b/contracts/interfaces/drop/IDropClaimCondition.sol index 55777dfc7..fe9409747 100644 --- a/contracts/interfaces/drop/IDropClaimCondition.sol +++ b/contracts/interfaces/drop/IDropClaimCondition.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.11; +pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/utils/structs/BitMapsUpgradeable.sol"; diff --git a/contracts/interfaces/marketplace/IMarketplace.sol b/contracts/interfaces/marketplace/IMarketplace.sol index fee6feca2..e863d76c4 100644 --- a/contracts/interfaces/marketplace/IMarketplace.sol +++ b/contracts/interfaces/marketplace/IMarketplace.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.11; import "../IThirdwebContract.sol"; -import "../IThirdwebPlatformFee.sol"; +import "../../feature/interface/IThirdwebPlatformFee.sol"; interface IMarketplace is IThirdwebContract, IThirdwebPlatformFee { /// @notice Type of the tokens that can be listed for sale. diff --git a/contracts/interfaces/token/ITokenERC1155.sol b/contracts/interfaces/token/ITokenERC1155.sol deleted file mode 100644 index 57e95a5b2..000000000 --- a/contracts/interfaces/token/ITokenERC1155.sol +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol"; -import "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol"; - -/** - * `SignatureMint1155` is an ERC 1155 contract. It lets anyone mint NFTs by producing a mint request - * and a signature (produced by an account with MINTER_ROLE, signing the mint request). - */ -interface ITokenERC1155 is IERC1155Upgradeable, IERC1155MetadataURIUpgradeable { - /// @dev The total circulating supply of tokens of ID `tokenId` - function totalSupply(uint256 id) external view returns (uint256 supply); -} diff --git a/contracts/interfaces/token/ITokenERC20.sol b/contracts/interfaces/token/ITokenERC20.sol deleted file mode 100644 index 09b9028c0..000000000 --- a/contracts/interfaces/token/ITokenERC20.sol +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; -import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; - -interface ITokenERC20 is IERC20MetadataUpgradeable {} diff --git a/contracts/token/TokenERC1155.sol b/contracts/token/TokenERC1155.sol index 457f55aa3..cd8491f1f 100644 --- a/contracts/token/TokenERC1155.sol +++ b/contracts/token/TokenERC1155.sol @@ -2,16 +2,15 @@ pragma solidity ^0.8.11; // Interface -import "../interfaces/token/ITokenERC1155.sol"; -import "../interfaces/token/IMintableERC1155.sol"; -import "../interfaces/token/IBurnableERC1155.sol"; -import "./SignatureMintUpgradeable.sol"; +import "../feature/interface/IMintableERC1155.sol"; +import "../feature/interface/IBurnableERC1155.sol"; +import "../feature/SignatureMintUpgradeable.sol"; import "../interfaces/IThirdwebContract.sol"; -import "../interfaces/IThirdwebPlatformFee.sol"; -import "../interfaces/IThirdwebPrimarySale.sol"; -import "../interfaces/IThirdwebRoyalty.sol"; -import "../interfaces/IThirdwebOwnable.sol"; +import "../feature/interface/IThirdwebPlatformFee.sol"; +import "../feature/interface/IThirdwebPrimarySale.sol"; +import "../feature/interface/IThirdwebRoyalty.sol"; +import "../feature/interface/IThirdwebOwnable.sol"; // Token import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; @@ -45,7 +44,6 @@ contract TokenERC1155 is MulticallUpgradeable, AccessControlEnumerableUpgradeable, ERC1155Upgradeable, - ITokenERC1155, IMintableERC1155, IBurnableERC1155, SignatureMintUpgradeable @@ -168,12 +166,7 @@ contract TokenERC1155 is } /// @dev Returns the URI for a tokenId - function uri(uint256 _tokenId) - public - view - override(ERC1155Upgradeable, IERC1155MetadataURIUpgradeable) - returns (string memory) - { + function uri(uint256 _tokenId) public view override(ERC1155Upgradeable) returns (string memory) { return _tokenURI[_tokenId]; } @@ -450,7 +443,7 @@ contract TokenERC1155 is public view virtual - override(AccessControlEnumerableUpgradeable, ERC1155Upgradeable, IERC165Upgradeable) + override(AccessControlEnumerableUpgradeable, ERC1155Upgradeable) returns (bool) { return diff --git a/contracts/token/TokenERC20.sol b/contracts/token/TokenERC20.sol index 4667dfdca..160b58ba1 100644 --- a/contracts/token/TokenERC20.sol +++ b/contracts/token/TokenERC20.sol @@ -2,14 +2,13 @@ pragma solidity ^0.8.11; //Interface -import "../interfaces/token/ITokenERC20.sol"; -import "../interfaces/token/IBurnableERC20.sol"; -import "../interfaces/token/IMintableERC20.sol"; -import "./SignatureMintUpgradeable.sol"; +import "../feature/interface/IBurnableERC20.sol"; +import "../feature/interface/IMintableERC20.sol"; +import "../feature/SignatureMintUpgradeable.sol"; import "../interfaces/IThirdwebContract.sol"; -import "../interfaces/IThirdwebPlatformFee.sol"; -import "../interfaces/IThirdwebPrimarySale.sol"; +import "../feature/interface/IThirdwebPlatformFee.sol"; +import "../feature/interface/IThirdwebPrimarySale.sol"; // Token import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; @@ -45,7 +44,6 @@ contract TokenERC20 is MulticallUpgradeable, ERC20PausableUpgradeable, ERC20VotesUpgradeable, - ITokenERC20, IMintableERC20, IBurnableERC20, SignatureMintUpgradeable diff --git a/contracts/token/TokenERC721.sol b/contracts/token/TokenERC721.sol index 1c063ee41..51764a00e 100644 --- a/contracts/token/TokenERC721.sol +++ b/contracts/token/TokenERC721.sol @@ -2,15 +2,15 @@ pragma solidity ^0.8.11; // Interface -import "../interfaces/token/IMintableERC721.sol"; -import "../interfaces/token/IBurnableERC721.sol"; -import "./SignatureMintUpgradeable.sol"; +import "../feature/interface/IMintableERC721.sol"; +import "../feature/interface/IBurnableERC721.sol"; +import "../feature/SignatureMintUpgradeable.sol"; import "../interfaces/IThirdwebContract.sol"; -import "../interfaces/IThirdwebPlatformFee.sol"; -import "../interfaces/IThirdwebPrimarySale.sol"; -import "../interfaces/IThirdwebRoyalty.sol"; -import "../interfaces/IThirdwebOwnable.sol"; +import "../feature/interface/IThirdwebPlatformFee.sol"; +import "../feature/interface/IThirdwebPrimarySale.sol"; +import "../feature/interface/IThirdwebRoyalty.sol"; +import "../feature/interface/IThirdwebOwnable.sol"; // Token import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; @@ -371,7 +371,7 @@ contract TokenERC721 is public view virtual - override(AccessControlEnumerableUpgradeable, ERC721EnumerableUpgradeable, IERC165Upgradeable) + override(AccessControlEnumerableUpgradeable, ERC721EnumerableUpgradeable) returns (bool) { return super.supportsInterface(interfaceId) || interfaceId == type(IERC2981Upgradeable).interfaceId; diff --git a/docs/ERC1155.md b/docs/ERC1155.md new file mode 100644 index 000000000..f01d1abc0 --- /dev/null +++ b/docs/ERC1155.md @@ -0,0 +1,219 @@ +# ERC1155 + + + +> ERC-1155 Multi Token Standard + + + +*See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md Note: The ERC-165 identifier for this interface is 0xd9b67a26.* + +## Methods + +### balanceOf + +```solidity +function balanceOf(address _owner, uint256 _id) external view returns (uint256) +``` + +Get the balance of an account's Tokens. + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _owner | address | The address of the token holder +| _id | uint256 | ID of the Token + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | uint256 | The _owner's balance of the Token type requested + +### balanceOfBatch + +```solidity +function balanceOfBatch(address[] _owners, uint256[] _ids) external view returns (uint256[]) +``` + +Get the balance of multiple account/token pairs + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _owners | address[] | The addresses of the token holders +| _ids | uint256[] | ID of the Tokens + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | uint256[] | The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair) + +### isApprovedForAll + +```solidity +function isApprovedForAll(address _owner, address _operator) external view returns (bool) +``` + +Queries the approval status of an operator for a given owner. + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _owner | address | The owner of the Tokens +| _operator | address | Address of authorized operator + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | bool | True if the operator is approved, false if not + +### safeBatchTransferFrom + +```solidity +function safeBatchTransferFrom(address _from, address _to, uint256[] _ids, uint256[] _values, bytes _data) external nonpayable +``` + +Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call). + +*Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard). MUST revert if `_to` is the zero address. MUST revert if length of `_ids` is not the same as length of `_values`. MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient. MUST revert on any other error. MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard). Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc). After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).* + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _from | address | Source address +| _to | address | Target address +| _ids | uint256[] | IDs of each token type (order and length must match _values array) +| _values | uint256[] | Transfer amounts per token type (order and length must match _ids array) +| _data | bytes | Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to` + +### safeTransferFrom + +```solidity +function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes _data) external nonpayable +``` + +Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call). + +*Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard). MUST revert if `_to` is the zero address. MUST revert if balance of holder for token `_id` is lower than the `_value` sent. MUST revert on any other error. MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard). After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).* + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _from | address | Source address +| _to | address | Target address +| _id | uint256 | ID of the token type +| _value | uint256 | Transfer amount +| _data | bytes | Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to` + +### setApprovalForAll + +```solidity +function setApprovalForAll(address _operator, bool _approved) external nonpayable +``` + +Enable or disable approval for a third party ("operator") to manage all of the caller's tokens. + +*MUST emit the ApprovalForAll event on success.* + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _operator | address | Address to add to the set of authorized operators +| _approved | bool | True if the operator is approved, false to revoke approval + + + +## Events + +### ApprovalForAll + +```solidity +event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved) +``` + + + +*MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled).* + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _owner `indexed` | address | undefined | +| _operator `indexed` | address | undefined | +| _approved | bool | undefined | + +### TransferBatch + +```solidity +event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values) +``` + + + +*Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). The `_operator` argument MUST be msg.sender. The `_from` argument MUST be the address of the holder whose balance is decreased. The `_to` argument MUST be the address of the recipient whose balance is increased. The `_ids` argument MUST be the list of tokens being transferred. The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by. When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).* + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _operator `indexed` | address | undefined | +| _from `indexed` | address | undefined | +| _to `indexed` | address | undefined | +| _ids | uint256[] | undefined | +| _values | uint256[] | undefined | + +### TransferSingle + +```solidity +event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value) +``` + + + +*Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). The `_operator` argument MUST be msg.sender. The `_from` argument MUST be the address of the holder whose balance is decreased. The `_to` argument MUST be the address of the recipient whose balance is increased. The `_id` argument MUST be the token type being transferred. The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by. When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).* + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _operator `indexed` | address | undefined | +| _from `indexed` | address | undefined | +| _to `indexed` | address | undefined | +| _id | uint256 | undefined | +| _value | uint256 | undefined | + +### URI + +```solidity +event URI(string _value, uint256 indexed _id) +``` + + + +*MUST emit when the URI is updated for a token ID. URIs are defined in RFC 3986. The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".* + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _value | string | undefined | +| _id `indexed` | uint256 | undefined | + + + diff --git a/docs/ERC1155Enumerable.md b/docs/ERC1155Enumerable.md new file mode 100644 index 000000000..0ad9e81c9 --- /dev/null +++ b/docs/ERC1155Enumerable.md @@ -0,0 +1,54 @@ +# ERC1155Enumerable + + + +> ERC1155Enumarable Non-Fungible Token Standard, optional enumeration extension + + + +*See https://eips.ethereum.org/EIPS/eip-1155* + +## Methods + +### nextTokenIdToMint + +```solidity +function nextTokenIdToMint() external view returns (uint256) +``` + +Returns the next token ID available for minting + + + + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | uint256 | The token identifier for the `_index`th NFT, (sort order not specified) + +### totalSupply + +```solidity +function totalSupply(uint256 id) external view returns (uint256) +``` + +Count NFTs tracked by this contract + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| id | uint256 | undefined + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | uint256 | A count of valid NFTs tracked by this contract, where each one of them has an assigned and queryable owner not equal to the zero address + + + + diff --git a/docs/ERC1155Metadata.md b/docs/ERC1155Metadata.md new file mode 100644 index 000000000..fd25bad71 --- /dev/null +++ b/docs/ERC1155Metadata.md @@ -0,0 +1,37 @@ +# ERC1155Metadata + + + + + +Note: The ERC-165 identifier for this interface is 0x0e89341c. + + + +## Methods + +### uri + +```solidity +function uri(uint256 _id) external view returns (string) +``` + +A distinct Uniform Resource Identifier (URI) for a given token. + +*URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".* + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _id | uint256 | undefined + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | string | URI string + + + + diff --git a/docs/ERC20.md b/docs/ERC20.md new file mode 100644 index 000000000..55587c48c --- /dev/null +++ b/docs/ERC20.md @@ -0,0 +1,186 @@ +# ERC20 + + + +> ERC20 interface + + + +*see https://github.com/ethereum/EIPs/issues/20* + +## Methods + +### allowance + +```solidity +function allowance(address owner, address spender) external view returns (uint256) +``` + + + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| owner | address | undefined +| spender | address | undefined + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | uint256 | undefined + +### approve + +```solidity +function approve(address spender, uint256 value) external nonpayable returns (bool) +``` + + + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| spender | address | undefined +| value | uint256 | undefined + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | bool | undefined + +### balanceOf + +```solidity +function balanceOf(address who) external view returns (uint256) +``` + + + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| who | address | undefined + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | uint256 | undefined + +### totalSupply + +```solidity +function totalSupply() external view returns (uint256) +``` + + + + + + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | uint256 | undefined + +### transfer + +```solidity +function transfer(address to, uint256 value) external nonpayable returns (bool) +``` + + + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| to | address | undefined +| value | uint256 | undefined + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | bool | undefined + +### transferFrom + +```solidity +function transferFrom(address from, address to, uint256 value) external nonpayable returns (bool) +``` + + + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| from | address | undefined +| to | address | undefined +| value | uint256 | undefined + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | bool | undefined + + + +## Events + +### Approval + +```solidity +event Approval(address indexed owner, address indexed spender, uint256 value) +``` + + + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| owner `indexed` | address | undefined | +| spender `indexed` | address | undefined | +| value | uint256 | undefined | + +### Transfer + +```solidity +event Transfer(address indexed from, address indexed to, uint256 value) +``` + + + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| from `indexed` | address | undefined | +| to `indexed` | address | undefined | +| value | uint256 | undefined | + + + diff --git a/docs/ERC20Metadata.md b/docs/ERC20Metadata.md new file mode 100644 index 000000000..4bf91cd20 --- /dev/null +++ b/docs/ERC20Metadata.md @@ -0,0 +1,66 @@ +# ERC20Metadata + + + +> ERC20Metadata interface + + + +*see https://github.com/ethereum/EIPs/issues/20* + +## Methods + +### decimals + +```solidity +function decimals() external view returns (uint8) +``` + + + + + + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | uint8 | undefined + +### name + +```solidity +function name() external view returns (string) +``` + + + + + + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | string | undefined + +### symbol + +```solidity +function symbol() external view returns (string) +``` + + + + + + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | string | undefined + + + + diff --git a/docs/IMultiwrap.md b/docs/IMultiwrap.md index d02f9e41a..6be406904 100644 --- a/docs/IMultiwrap.md +++ b/docs/IMultiwrap.md @@ -210,28 +210,6 @@ function setRoyaltyInfoForToken(uint256 tokenId, address recipient, uint256 bps) | recipient | address | undefined | bps | uint256 | undefined -### supportsInterface - -```solidity -function supportsInterface(bytes4 interfaceId) external view returns (bool) -``` - - - -*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.* - -#### Parameters - -| Name | Type | Description | -|---|---|---| -| interfaceId | bytes4 | undefined - -#### Returns - -| Name | Type | Description | -|---|---|---| -| _0 | bool | undefined - ### unwrap ```solidity diff --git a/docs/IPack.md b/docs/IPack.md index 80a223699..4bbe435e3 100644 --- a/docs/IPack.md +++ b/docs/IPack.md @@ -246,28 +246,6 @@ function setRoyaltyInfoForToken(uint256 tokenId, address recipient, uint256 bps) | recipient | address | undefined | bps | uint256 | undefined -### supportsInterface - -```solidity -function supportsInterface(bytes4 interfaceId) external view returns (bool) -``` - - - -*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.* - -#### Parameters - -| Name | Type | Description | -|---|---|---| -| interfaceId | bytes4 | undefined - -#### Returns - -| Name | Type | Description | -|---|---|---| -| _0 | bool | undefined - ## Events diff --git a/docs/IThirdwebRoyalty.md b/docs/IThirdwebRoyalty.md index ef1017db2..9063a98cb 100644 --- a/docs/IThirdwebRoyalty.md +++ b/docs/IThirdwebRoyalty.md @@ -110,28 +110,6 @@ function setRoyaltyInfoForToken(uint256 tokenId, address recipient, uint256 bps) | recipient | address | undefined | bps | uint256 | undefined -### supportsInterface - -```solidity -function supportsInterface(bytes4 interfaceId) external view returns (bool) -``` - - - -*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.* - -#### Parameters - -| Name | Type | Description | -|---|---|---| -| interfaceId | bytes4 | undefined - -#### Returns - -| Name | Type | Description | -|---|---|---| -| _0 | bool | undefined - ## Events