@rarible/external-contracts 3.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +201 -0
- package/README.md +144 -0
- package/contracts/base/ERC1155Base.sol +282 -0
- package/contracts/base/ERC1155DelayedReveal.sol +117 -0
- package/contracts/base/ERC1155Drop.sol +368 -0
- package/contracts/base/ERC1155LazyMint.sol +286 -0
- package/contracts/base/ERC1155SignatureMint.sol +132 -0
- package/contracts/base/ERC20Base.sol +111 -0
- package/contracts/base/ERC20Drop.sol +157 -0
- package/contracts/base/ERC20DropVote.sol +135 -0
- package/contracts/base/ERC20SignatureMint.sol +100 -0
- package/contracts/base/ERC20SignatureMintVote.sol +107 -0
- package/contracts/base/ERC20Vote.sol +111 -0
- package/contracts/base/ERC721Base.sol +210 -0
- package/contracts/base/ERC721DelayedReveal.sol +118 -0
- package/contracts/base/ERC721Drop.sol +312 -0
- package/contracts/base/ERC721LazyMint.sol +219 -0
- package/contracts/base/ERC721Multiwrap.sol +262 -0
- package/contracts/base/ERC721SignatureMint.sol +120 -0
- package/contracts/base/Staking1155Base.sol +189 -0
- package/contracts/base/Staking20Base.sol +179 -0
- package/contracts/base/Staking721Base.sol +186 -0
- package/contracts/eip/ERC1155.sol +294 -0
- package/contracts/eip/ERC1271.sol +18 -0
- package/contracts/eip/ERC165.sol +29 -0
- package/contracts/eip/ERC721A.sol +580 -0
- package/contracts/eip/ERC721AUpgradeable.sol +625 -0
- package/contracts/eip/ERC721AVirtualApprove.sol +582 -0
- package/contracts/eip/ERC721AVirtualApproveUpgradeable.sol +598 -0
- package/contracts/eip/interface/IERC1155.sol +132 -0
- package/contracts/eip/interface/IERC1155Enumerable.sol +11 -0
- package/contracts/eip/interface/IERC1155Metadata.sol +15 -0
- package/contracts/eip/interface/IERC1155Receiver.sol +58 -0
- package/contracts/eip/interface/IERC1155Supply.sol +11 -0
- package/contracts/eip/interface/IERC165.sol +25 -0
- package/contracts/eip/interface/IERC20.sol +24 -0
- package/contracts/eip/interface/IERC20Metadata.sol +14 -0
- package/contracts/eip/interface/IERC20Permit.sol +60 -0
- package/contracts/eip/interface/IERC2981.sol +23 -0
- package/contracts/eip/interface/IERC4906.sol +17 -0
- package/contracts/eip/interface/IERC721.sol +128 -0
- package/contracts/eip/interface/IERC721A.sol +109 -0
- package/contracts/eip/interface/IERC721Enumerable.sol +24 -0
- package/contracts/eip/interface/IERC721Metadata.sol +20 -0
- package/contracts/eip/interface/IERC721Receiver.sol +27 -0
- package/contracts/eip/interface/IERC721Supply.sol +13 -0
- package/contracts/eip/queryable/ERC721AQueryable.sol +168 -0
- package/contracts/eip/queryable/ERC721AQueryableUpgradeable.sol +193 -0
- package/contracts/eip/queryable/ERC721AStorage.sol +57 -0
- package/contracts/eip/queryable/ERC721AUpgradeable.sol +1075 -0
- package/contracts/eip/queryable/ERC721A__Initializable.sol +75 -0
- package/contracts/eip/queryable/ERC721A__InitializableStorage.sol +29 -0
- package/contracts/eip/queryable/IERC721AQueryable.sol +69 -0
- package/contracts/eip/queryable/IERC721AQueryableUpgradeable.sol +69 -0
- package/contracts/eip/queryable/IERC721AUpgradeable.sol +269 -0
- package/contracts/extension/AppURI.sol +37 -0
- package/contracts/extension/BatchMintMetadata.sol +143 -0
- package/contracts/extension/BurnToClaim.sol +60 -0
- package/contracts/extension/ContractMetadata.sol +48 -0
- package/contracts/extension/DelayedReveal.sol +111 -0
- package/contracts/extension/Drop.sol +284 -0
- package/contracts/extension/Drop1155.sol +300 -0
- package/contracts/extension/DropSinglePhase.sol +237 -0
- package/contracts/extension/DropSinglePhase1155.sol +215 -0
- package/contracts/extension/Initializable.sol +136 -0
- package/contracts/extension/LazyMint.sol +56 -0
- package/contracts/extension/LazyMintWithTier.sol +112 -0
- package/contracts/extension/Multicall.sol +40 -0
- package/contracts/extension/NFTMetadata.sol +58 -0
- package/contracts/extension/OperatorFilterToggle.sol +22 -0
- package/contracts/extension/OperatorFilterer.sol +73 -0
- package/contracts/extension/OperatorFiltererUpgradeable.sol +69 -0
- package/contracts/extension/Ownable.sol +58 -0
- package/contracts/extension/Permissions.sol +159 -0
- package/contracts/extension/PermissionsEnumerable.sol +111 -0
- package/contracts/extension/PlatformFee.sol +117 -0
- package/contracts/extension/PrimarySale.sol +57 -0
- package/contracts/extension/Proxy.sol +84 -0
- package/contracts/extension/ProxyForUpgradeable.sol +32 -0
- package/contracts/extension/Royalty.sol +134 -0
- package/contracts/extension/SeaportEIP1271.sol +88 -0
- package/contracts/extension/SeaportOrderParser.sol +550 -0
- package/contracts/extension/SharedMetadata.sol +63 -0
- package/contracts/extension/SignatureAction.sol +67 -0
- package/contracts/extension/SignatureActionUpgradeable.sol +71 -0
- package/contracts/extension/SignatureMintERC1155.sol +78 -0
- package/contracts/extension/SignatureMintERC1155Upgradeable.sol +84 -0
- package/contracts/extension/SignatureMintERC20.sol +70 -0
- package/contracts/extension/SignatureMintERC20Upgradeable.sol +77 -0
- package/contracts/extension/SignatureMintERC721.sol +96 -0
- package/contracts/extension/SignatureMintERC721Upgradeable.sol +102 -0
- package/contracts/extension/SoulboundERC721A.sol +51 -0
- package/contracts/extension/Staking1155.sol +516 -0
- package/contracts/extension/Staking1155Upgradeable.sol +516 -0
- package/contracts/extension/Staking20.sol +376 -0
- package/contracts/extension/Staking20Upgradeable.sol +383 -0
- package/contracts/extension/Staking721.sol +362 -0
- package/contracts/extension/Staking721Upgradeable.sol +364 -0
- package/contracts/extension/TokenBundle.sol +130 -0
- package/contracts/extension/TokenStore.sol +97 -0
- package/contracts/extension/Upgradeable.sol +95 -0
- package/contracts/extension/interface/IAccountPermissions.sol +114 -0
- package/contracts/extension/interface/IAppURI.sol +24 -0
- package/contracts/extension/interface/IBurnToClaim.sol +43 -0
- package/contracts/extension/interface/IBurnableERC1155.sol +16 -0
- package/contracts/extension/interface/IBurnableERC20.sol +26 -0
- package/contracts/extension/interface/IBurnableERC721.sol +15 -0
- package/contracts/extension/interface/IClaimCondition.sol +48 -0
- package/contracts/extension/interface/IClaimConditionMultiPhase.sol +39 -0
- package/contracts/extension/interface/IClaimConditionsSinglePhase.sol +31 -0
- package/contracts/extension/interface/IClaimableERC1155.sol +39 -0
- package/contracts/extension/interface/IClaimableERC721.sol +37 -0
- package/contracts/extension/interface/IContractFactory.sol +20 -0
- package/contracts/extension/interface/IContractMetadata.sol +25 -0
- package/contracts/extension/interface/IDelayedReveal.sol +33 -0
- package/contracts/extension/interface/IDelayedRevealDeprecated.sol +38 -0
- package/contracts/extension/interface/IDrop.sol +72 -0
- package/contracts/extension/interface/IDrop1155.sol +75 -0
- package/contracts/extension/interface/IDropSinglePhase.sol +70 -0
- package/contracts/extension/interface/IDropSinglePhase1155.sol +74 -0
- package/contracts/extension/interface/IERC2771Context.sol +6 -0
- package/contracts/extension/interface/ILazyMint.sol +33 -0
- package/contracts/extension/interface/ILazyMintWithTier.sol +43 -0
- package/contracts/extension/interface/IMintableERC1155.sol +24 -0
- package/contracts/extension/interface/IMintableERC20.sol +20 -0
- package/contracts/extension/interface/IMintableERC721.sol +19 -0
- package/contracts/extension/interface/IMulticall.sol +16 -0
- package/contracts/extension/interface/INFTMetadata.sol +17 -0
- package/contracts/extension/interface/IOperatorFilterRegistry.sol +54 -0
- package/contracts/extension/interface/IOperatorFilterToggle.sol +12 -0
- package/contracts/extension/interface/IOwnable.sol +21 -0
- package/contracts/extension/interface/IPermissions.sol +88 -0
- package/contracts/extension/interface/IPermissionsEnumerable.sol +31 -0
- package/contracts/extension/interface/IPlatformFee.sol +33 -0
- package/contracts/extension/interface/IPrimarySale.sol +21 -0
- package/contracts/extension/interface/IRoyalty.sol +39 -0
- package/contracts/extension/interface/IRoyaltyEngineV1.sol +42 -0
- package/contracts/extension/interface/IRoyaltyPayments.sol +37 -0
- package/contracts/extension/interface/IRulesEngine.sol +58 -0
- package/contracts/extension/interface/ISharedMetadata.sol +30 -0
- package/contracts/extension/interface/ISharedMetadataBatch.sol +57 -0
- package/contracts/extension/interface/ISignatureAction.sol +44 -0
- package/contracts/extension/interface/ISignatureMintERC1155.sol +77 -0
- package/contracts/extension/interface/ISignatureMintERC20.sol +64 -0
- package/contracts/extension/interface/ISignatureMintERC721.sol +75 -0
- package/contracts/extension/interface/IStaking1155.sol +110 -0
- package/contracts/extension/interface/IStaking20.sol +97 -0
- package/contracts/extension/interface/IStaking721.sol +83 -0
- package/contracts/extension/interface/ITokenBundle.sol +52 -0
- package/contracts/extension/interface/plugin/IContext.sol +10 -0
- package/contracts/extension/interface/plugin/IPluginMap.sol +31 -0
- package/contracts/extension/interface/plugin/IRouter.sol +30 -0
- package/contracts/extension/plugin/ContractMetadataLogic.sol +52 -0
- package/contracts/extension/plugin/ContractMetadataStorage.sol +25 -0
- package/contracts/extension/plugin/ERC2771ContextConsumer.sol +34 -0
- package/contracts/extension/plugin/ERC2771ContextLogic.sol +43 -0
- package/contracts/extension/plugin/ERC2771ContextStorage.sol +22 -0
- package/contracts/extension/plugin/ERC2771ContextUpgradeableLogic.sol +47 -0
- package/contracts/extension/plugin/ERC2771ContextUpgradeableStorage.sol +20 -0
- package/contracts/extension/plugin/PermissionsEnumerableLogic.sol +101 -0
- package/contracts/extension/plugin/PermissionsEnumerableStorage.sol +41 -0
- package/contracts/extension/plugin/PermissionsLogic.sol +182 -0
- package/contracts/extension/plugin/PermissionsStorage.sol +28 -0
- package/contracts/extension/plugin/PlatformFeeLogic.sol +56 -0
- package/contracts/extension/plugin/PlatformFeeStorage.sol +28 -0
- package/contracts/extension/plugin/PluginMap.sol +81 -0
- package/contracts/extension/plugin/ReentrancyGuardLogic.sol +69 -0
- package/contracts/extension/plugin/ReentrancyGuardStorage.sol +22 -0
- package/contracts/extension/plugin/Router.sol +270 -0
- package/contracts/extension/plugin/RouterImmutable.sol +26 -0
- package/contracts/extension/plugin/RoyaltyPayments.sol +121 -0
- package/contracts/extension/upgradeable/AccountPermissions.sol +253 -0
- package/contracts/extension/upgradeable/BatchMintMetadata.sol +144 -0
- package/contracts/extension/upgradeable/BurnToClaim.sol +83 -0
- package/contracts/extension/upgradeable/ContractMetadata.sol +73 -0
- package/contracts/extension/upgradeable/DelayedReveal.sol +126 -0
- package/contracts/extension/upgradeable/Drop.sol +278 -0
- package/contracts/extension/upgradeable/ERC2771Context.sol +64 -0
- package/contracts/extension/upgradeable/ERC2771ContextConsumer.sol +32 -0
- package/contracts/extension/upgradeable/ERC2771ContextUpgradeable.sol +72 -0
- package/contracts/extension/upgradeable/Initializable.sol +110 -0
- package/contracts/extension/upgradeable/LazyMint.sol +77 -0
- package/contracts/extension/upgradeable/OperatorFilterToggle.sol +47 -0
- package/contracts/extension/upgradeable/OperatorFiltererUpgradeable.sol +58 -0
- package/contracts/extension/upgradeable/Ownable.sol +75 -0
- package/contracts/extension/upgradeable/Permissions.sol +197 -0
- package/contracts/extension/upgradeable/PermissionsEnumerable.sol +134 -0
- package/contracts/extension/upgradeable/PlatformFee.sol +131 -0
- package/contracts/extension/upgradeable/PrimarySale.sol +69 -0
- package/contracts/extension/upgradeable/ReentrancyGuard.sol +53 -0
- package/contracts/extension/upgradeable/Royalty.sol +144 -0
- package/contracts/extension/upgradeable/RoyaltyPayments.sol +121 -0
- package/contracts/extension/upgradeable/RulesEngine.sol +163 -0
- package/contracts/extension/upgradeable/SharedMetadataBatch.sol +98 -0
- package/contracts/extension/upgradeable/impl/ContractMetadataImpl.sol +34 -0
- package/contracts/extension/upgradeable/impl/MetaTx.sol +8 -0
- package/contracts/extension/upgradeable/impl/PermissionsEnumerableImpl.sol +28 -0
- package/contracts/extension/upgradeable/impl/PlatformFeeImpl.sol +34 -0
- package/contracts/extension/upgradeable/init/ContractMetadataInit.sol +17 -0
- package/contracts/extension/upgradeable/init/ERC2771ContextInit.sol +19 -0
- package/contracts/extension/upgradeable/init/ERC721AInit.sol +23 -0
- package/contracts/extension/upgradeable/init/ERC721AQueryableInit.sol +21 -0
- package/contracts/extension/upgradeable/init/OwnableInit.sol +18 -0
- package/contracts/extension/upgradeable/init/PermissionsEnumerableInit.sol +23 -0
- package/contracts/extension/upgradeable/init/PermissionsInit.sol +27 -0
- package/contracts/extension/upgradeable/init/PlatformFeeInit.sol +25 -0
- package/contracts/extension/upgradeable/init/PrimarySaleInit.sol +19 -0
- package/contracts/extension/upgradeable/init/ReentrancyGuardInit.sol +18 -0
- package/contracts/extension/upgradeable/init/RoyaltyInit.sol +22 -0
- package/contracts/external-deps/chainlink/LinkTokenInterface.sol +28 -0
- package/contracts/external-deps/chainlink/VRFV2WrapperConsumerBase.sol +83 -0
- package/contracts/external-deps/chainlink/VRFV2WrapperInterface.sol +35 -0
- package/contracts/external-deps/openzeppelin/ERC1155PresetUpgradeable.sol +160 -0
- package/contracts/external-deps/openzeppelin/cryptography/EIP712ChainlessDomain.sol +100 -0
- package/contracts/external-deps/openzeppelin/finance/PaymentSplitterUpgradeable.sol +231 -0
- package/contracts/external-deps/openzeppelin/governance/utils/IVotes.sol +54 -0
- package/contracts/external-deps/openzeppelin/metatx/ERC2771Context.sol +44 -0
- package/contracts/external-deps/openzeppelin/metatx/ERC2771ContextUpgradeable.sol +50 -0
- package/contracts/external-deps/openzeppelin/metatx/MinimalForwarderEOAOnly.sol +67 -0
- package/contracts/external-deps/openzeppelin/proxy/Clones.sol +88 -0
- package/contracts/external-deps/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol +32 -0
- package/contracts/external-deps/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol +173 -0
- package/contracts/external-deps/openzeppelin/proxy/IERC1822Proxiable.sol +20 -0
- package/contracts/external-deps/openzeppelin/proxy/Proxy.sol +86 -0
- package/contracts/external-deps/openzeppelin/proxy/beacon/IBeacon.sol +16 -0
- package/contracts/external-deps/openzeppelin/proxy/utils/Initializable.sol +138 -0
- package/contracts/external-deps/openzeppelin/security/ReentrancyGuard.sol +32 -0
- package/contracts/external-deps/openzeppelin/security/ReentrancyGuardUpgradeable.sol +44 -0
- package/contracts/external-deps/openzeppelin/token/ERC1155/IERC1155Receiver.sol +58 -0
- package/contracts/external-deps/openzeppelin/token/ERC1155/utils/ERC1155Holder.sol +36 -0
- package/contracts/external-deps/openzeppelin/token/ERC1155/utils/ERC1155Receiver.sol +19 -0
- package/contracts/external-deps/openzeppelin/token/ERC20/ERC20.sol +359 -0
- package/contracts/external-deps/openzeppelin/token/ERC20/extensions/ERC20Permit.sol +117 -0
- package/contracts/external-deps/openzeppelin/token/ERC20/extensions/ERC20Votes.sol +246 -0
- package/contracts/external-deps/openzeppelin/token/ERC20/utils/SafeERC20.sol +78 -0
- package/contracts/external-deps/openzeppelin/token/ERC721/IERC721Receiver.sol +27 -0
- package/contracts/external-deps/openzeppelin/token/ERC721/utils/ERC721Holder.sol +23 -0
- package/contracts/external-deps/openzeppelin/utils/Base64.sol +92 -0
- package/contracts/external-deps/openzeppelin/utils/Context.sol +24 -0
- package/contracts/external-deps/openzeppelin/utils/Counters.sol +43 -0
- package/contracts/external-deps/openzeppelin/utils/Create2.sol +58 -0
- package/contracts/external-deps/openzeppelin/utils/ERC1155/ERC1155Holder.sol +36 -0
- package/contracts/external-deps/openzeppelin/utils/ERC1155/ERC1155Receiver.sol +19 -0
- package/contracts/external-deps/openzeppelin/utils/ERC721/ERC721Holder.sol +23 -0
- package/contracts/external-deps/openzeppelin/utils/EnumerableSet.sol +367 -0
- package/contracts/external-deps/openzeppelin/utils/cryptography/ECDSA.sol +217 -0
- package/contracts/external-deps/openzeppelin/utils/cryptography/EIP712.sol +104 -0
- package/contracts/external-deps/openzeppelin/utils/math/Math.sol +43 -0
- package/contracts/external-deps/openzeppelin/utils/math/SafeCast.sol +241 -0
- package/contracts/external-deps/openzeppelin/utils/math/SafeMath.sol +215 -0
- package/contracts/external-deps/openzeppelin/utils/structs/EnumerableSet.sol +367 -0
- package/contracts/infra/ContractPublisher.sol +268 -0
- package/contracts/infra/TWFactory.sol +140 -0
- package/contracts/infra/TWFee.sol +162 -0
- package/contracts/infra/TWMinimalFactory.sol +47 -0
- package/contracts/infra/TWMultichainRegistry.sol +116 -0
- package/contracts/infra/TWProxy.sol +42 -0
- package/contracts/infra/TWRegistry.sol +70 -0
- package/contracts/infra/TWStatelessFactory.sol +47 -0
- package/contracts/infra/forwarder/Forwarder.sol +76 -0
- package/contracts/infra/forwarder/ForwarderChainlessDomain.sol +90 -0
- package/contracts/infra/forwarder/ForwarderConsumer.sol +25 -0
- package/contracts/infra/forwarder/ForwarderEOAOnly.sol +23 -0
- package/contracts/infra/interface/IContractDeployer.sol +54 -0
- package/contracts/infra/interface/IContractPublisher.sol +128 -0
- package/contracts/infra/interface/ITWFee.sol +6 -0
- package/contracts/infra/interface/ITWMultichainRegistry.sol +28 -0
- package/contracts/infra/interface/ITWRegistry.sol +24 -0
- package/contracts/infra/interface/IThirdwebContract.sol +19 -0
- package/contracts/infra/interface/IWETH.sol +10 -0
- package/contracts/infra/registry/entrypoint/TWMultichainRegistryRouter.sol +61 -0
- package/contracts/infra/registry/registry-extension/TWMultichainRegistryLogic.sol +120 -0
- package/contracts/infra/registry/registry-extension/TWMultichainRegistryStorage.sol +30 -0
- package/contracts/legacy-contracts/extension/BatchMintMetadata_V1.sol +89 -0
- package/contracts/legacy-contracts/extension/DropSinglePhase1155_V1.sol +268 -0
- package/contracts/legacy-contracts/extension/DropSinglePhase_V1.sol +252 -0
- package/contracts/legacy-contracts/extension/LazyMintWithTier_V1.sol +112 -0
- package/contracts/legacy-contracts/extension/LazyMint_V1.sol +52 -0
- package/contracts/legacy-contracts/extension/PlatformFee_V1.sol +69 -0
- package/contracts/legacy-contracts/extension/PrimarySale_V1.sol +53 -0
- package/contracts/legacy-contracts/extension/interface/IClaimCondition_V1.sol +54 -0
- package/contracts/legacy-contracts/extension/interface/IDropSinglePhase1155_V1.sol +58 -0
- package/contracts/legacy-contracts/extension/interface/IDropSinglePhase_V1.sol +54 -0
- package/contracts/legacy-contracts/extension/interface/IPlatformFee_V1.sol +21 -0
- package/contracts/legacy-contracts/extension/interface/IPrimarySale_V1.sol +21 -0
- package/contracts/legacy-contracts/interface/ISignatureMintERC721_V1.sol +18 -0
- package/contracts/legacy-contracts/interface/drop/IDropClaimCondition_V2.sol +82 -0
- package/contracts/legacy-contracts/interface/drop/IDropERC1155_V2.sol +96 -0
- package/contracts/legacy-contracts/interface/drop/IDropERC20_V2.sol +73 -0
- package/contracts/legacy-contracts/interface/drop/IDropERC721_V3.sol +98 -0
- package/contracts/legacy-contracts/pre-builts/DropERC1155_V2.sol +731 -0
- package/contracts/legacy-contracts/pre-builts/DropERC20_V2.sol +521 -0
- package/contracts/legacy-contracts/pre-builts/DropERC721_V3.sol +745 -0
- package/contracts/legacy-contracts/pre-builts/SignatureDrop_V4.sol +360 -0
- package/contracts/legacy-contracts/smart-wallet/interface/IAccountPermissions_V1.sol +115 -0
- package/contracts/lib/Address.sol +244 -0
- package/contracts/lib/BitMaps.sol +52 -0
- package/contracts/lib/BytesLib.sol +18 -0
- package/contracts/lib/CurrencyTransferLib.sol +96 -0
- package/contracts/lib/FeeType.sol +10 -0
- package/contracts/lib/MerkleProof.sol +40 -0
- package/contracts/lib/NFTMetadataRenderer.sol +91 -0
- package/contracts/lib/StorageSlot.sol +54 -0
- package/contracts/lib/StringSet.sol +107 -0
- package/contracts/lib/Strings.sol +195 -0
- package/contracts/prebuilts/account/dynamic/DynamicAccount.sol +48 -0
- package/contracts/prebuilts/account/dynamic/DynamicAccountFactory.sol +61 -0
- package/contracts/prebuilts/account/interfaces/IAccount.sol +39 -0
- package/contracts/prebuilts/account/interfaces/IAccountCore.sol +11 -0
- package/contracts/prebuilts/account/interfaces/IAccountExecute.sol +17 -0
- package/contracts/prebuilts/account/interfaces/IAccountFactory.sol +16 -0
- package/contracts/prebuilts/account/interfaces/IAccountFactoryCore.sol +40 -0
- package/contracts/prebuilts/account/interfaces/IAggregator.sol +41 -0
- package/contracts/prebuilts/account/interfaces/IEntryPoint.sol +204 -0
- package/contracts/prebuilts/account/interfaces/INonceManager.sol +25 -0
- package/contracts/prebuilts/account/interfaces/IOracle.sol +10 -0
- package/contracts/prebuilts/account/interfaces/IPaymaster.sol +63 -0
- package/contracts/prebuilts/account/interfaces/IStakeManager.sol +94 -0
- package/contracts/prebuilts/account/interfaces/PackedUserOperation.sol +28 -0
- package/contracts/prebuilts/account/managed/ManagedAccount.sol +33 -0
- package/contracts/prebuilts/account/managed/ManagedAccountFactory.sol +68 -0
- package/contracts/prebuilts/account/non-upgradeable/Account.sol +169 -0
- package/contracts/prebuilts/account/non-upgradeable/AccountFactory.sol +54 -0
- package/contracts/prebuilts/account/token-bound-account/TokenBoundAccount.sol +252 -0
- package/contracts/prebuilts/account/token-bound-account/erc6551-utils/ERC6551AccountLib.sol +44 -0
- package/contracts/prebuilts/account/token-bound-account/erc6551-utils/ERC6551BytecodeLib.sol +20 -0
- package/contracts/prebuilts/account/token-bound-account/erc6551-utils/IERC6551Account.sol +51 -0
- package/contracts/prebuilts/account/token-paymaster/BasePaymaster.sol +151 -0
- package/contracts/prebuilts/account/token-paymaster/TokenPaymaster.sol +212 -0
- package/contracts/prebuilts/account/utils/AccountCore.sol +245 -0
- package/contracts/prebuilts/account/utils/AccountCoreStorage.sol +21 -0
- package/contracts/prebuilts/account/utils/AccountExtension.sol +172 -0
- package/contracts/prebuilts/account/utils/AccountSeaportBulkSigSupport.sol +40 -0
- package/contracts/prebuilts/account/utils/BaseAccount.sol +106 -0
- package/contracts/prebuilts/account/utils/BaseAccountFactory.sol +168 -0
- package/contracts/prebuilts/account/utils/EntryPoint.sol +725 -0
- package/contracts/prebuilts/account/utils/Exec.sol +56 -0
- package/contracts/prebuilts/account/utils/Helpers.sol +88 -0
- package/contracts/prebuilts/account/utils/NonceManager.sol +39 -0
- package/contracts/prebuilts/account/utils/OracleHelper.sol +154 -0
- package/contracts/prebuilts/account/utils/SenderCreator.sol +28 -0
- package/contracts/prebuilts/account/utils/StakeManager.sol +126 -0
- package/contracts/prebuilts/account/utils/TokenCallbackHandler.sol +55 -0
- package/contracts/prebuilts/account/utils/UniswapHelper.sol +119 -0
- package/contracts/prebuilts/account/utils/UserOperationLib.sol +127 -0
- package/contracts/prebuilts/airdrop/Airdrop.sol +616 -0
- package/contracts/prebuilts/drop/DropERC1155.sol +388 -0
- package/contracts/prebuilts/drop/DropERC20.sol +262 -0
- package/contracts/prebuilts/drop/DropERC721.sol +397 -0
- package/contracts/prebuilts/evolving-nfts/EvolvingNFT.sol +101 -0
- package/contracts/prebuilts/evolving-nfts/EvolvingNFTLogic.sol +251 -0
- package/contracts/prebuilts/evolving-nfts/extension/RulesEngineExtension.sol +26 -0
- package/contracts/prebuilts/interface/ILoyaltyCard.sol +27 -0
- package/contracts/prebuilts/interface/ILoyaltyPoints.sol +24 -0
- package/contracts/prebuilts/interface/IMultiwrap.sol +49 -0
- package/contracts/prebuilts/interface/IPack.sol +69 -0
- package/contracts/prebuilts/interface/IPackVRFDirect.sol +85 -0
- package/contracts/prebuilts/interface/airdrop/IAirdropERC1155.sol +45 -0
- package/contracts/prebuilts/interface/airdrop/IAirdropERC1155Claimable.sol +40 -0
- package/contracts/prebuilts/interface/airdrop/IAirdropERC20.sol +46 -0
- package/contracts/prebuilts/interface/airdrop/IAirdropERC20Claimable.sol +33 -0
- package/contracts/prebuilts/interface/airdrop/IAirdropERC721.sol +42 -0
- package/contracts/prebuilts/interface/airdrop/IAirdropERC721Claimable.sol +33 -0
- package/contracts/prebuilts/interface/drop/IDropClaimCondition.sol +82 -0
- package/contracts/prebuilts/interface/drop/IDropERC1155.sol +92 -0
- package/contracts/prebuilts/interface/drop/IDropERC20.sol +68 -0
- package/contracts/prebuilts/interface/drop/IDropERC721.sol +94 -0
- package/contracts/prebuilts/interface/marketplace/IMarketplace.sol +329 -0
- package/contracts/prebuilts/interface/staking/IEditionStake.sol +45 -0
- package/contracts/prebuilts/interface/staking/INFTStake.sol +45 -0
- package/contracts/prebuilts/interface/staking/ITokenStake.sol +46 -0
- package/contracts/prebuilts/interface/token/ITokenERC1155.sol +84 -0
- package/contracts/prebuilts/interface/token/ITokenERC20.sol +68 -0
- package/contracts/prebuilts/interface/token/ITokenERC721.sol +77 -0
- package/contracts/prebuilts/loyalty/LoyaltyCard.sol +339 -0
- package/contracts/prebuilts/marketplace/IMarketplace.sol +512 -0
- package/contracts/prebuilts/marketplace/direct-listings/DirectListingsLogic.sol +579 -0
- package/contracts/prebuilts/marketplace/direct-listings/DirectListingsStorage.sol +30 -0
- package/contracts/prebuilts/marketplace/english-auctions/EnglishAuctionsLogic.sol +546 -0
- package/contracts/prebuilts/marketplace/english-auctions/EnglishAuctionsStorage.sol +30 -0
- package/contracts/prebuilts/marketplace/entrypoint/MarketplaceV3.sol +184 -0
- package/contracts/prebuilts/marketplace/offers/OffersLogic.sol +358 -0
- package/contracts/prebuilts/marketplace/offers/OffersStorage.sol +28 -0
- package/contracts/prebuilts/marketplace-legacy/Marketplace.sol +907 -0
- package/contracts/prebuilts/multiwrap/Multiwrap.sol +264 -0
- package/contracts/prebuilts/open-edition/OpenEditionERC721.sol +268 -0
- package/contracts/prebuilts/open-edition/OpenEditionERC721FlatFee.sol +298 -0
- package/contracts/prebuilts/pack/Pack.sol +463 -0
- package/contracts/prebuilts/pack/PackVRFDirect.sol +516 -0
- package/contracts/prebuilts/signature-drop/SignatureDrop.sol +371 -0
- package/contracts/prebuilts/split/Split.sol +182 -0
- package/contracts/prebuilts/staking/EditionStake.sol +211 -0
- package/contracts/prebuilts/staking/NFTStake.sol +201 -0
- package/contracts/prebuilts/staking/TokenStake.sol +197 -0
- package/contracts/prebuilts/tiered-drop/TieredDrop.sol +607 -0
- package/contracts/prebuilts/token/TokenERC1155.sol +576 -0
- package/contracts/prebuilts/token/TokenERC20.sol +312 -0
- package/contracts/prebuilts/token/TokenERC721.sol +469 -0
- package/contracts/prebuilts/unaudited/airdrop/AirdropERC1155.sol +154 -0
- package/contracts/prebuilts/unaudited/airdrop/AirdropERC1155Claimable.sol +199 -0
- package/contracts/prebuilts/unaudited/airdrop/AirdropERC20.sol +194 -0
- package/contracts/prebuilts/unaudited/airdrop/AirdropERC20Claimable.sol +180 -0
- package/contracts/prebuilts/unaudited/airdrop/AirdropERC721.sol +143 -0
- package/contracts/prebuilts/unaudited/airdrop/AirdropERC721Claimable.sol +197 -0
- package/contracts/prebuilts/unaudited/burn-to-claim-drop/BurnToClaimDropERC721.sol +137 -0
- package/contracts/prebuilts/unaudited/burn-to-claim-drop/extension/BurnToClaimDrop721Logic.sol +362 -0
- package/contracts/prebuilts/unaudited/burn-to-claim-drop/extension/BurnToClaimDrop721Storage.sol +21 -0
- package/contracts/prebuilts/unaudited/contract-builder/CoreRouter.sol +60 -0
- package/contracts/prebuilts/unaudited/contract-builder/extension/PermissionOverride.sol +52 -0
- package/contracts/prebuilts/unaudited/loyalty/LoyaltyPoints.sol +249 -0
- package/contracts/prebuilts/vote/VoteERC20.sol +167 -0
- package/js/DropERC1155.d.ts +1198 -0
- package/js/DropERC1155.js +2 -0
- package/js/DropERC1155.js.map +1 -0
- package/js/DropERC721.d.ts +1247 -0
- package/js/DropERC721.js +2 -0
- package/js/DropERC721.js.map +1 -0
- package/js/OpenEditionERC721FlatFee.d.ts +1207 -0
- package/js/OpenEditionERC721FlatFee.js +2 -0
- package/js/OpenEditionERC721FlatFee.js.map +1 -0
- package/js/common.d.ts +22 -0
- package/js/common.js +2 -0
- package/js/common.js.map +1 -0
- package/js/factories/DropERC1155__factory.d.ts +1751 -0
- package/js/factories/DropERC1155__factory.js +2279 -0
- package/js/factories/DropERC1155__factory.js.map +1 -0
- package/js/factories/DropERC721__factory.d.ts +1826 -0
- package/js/factories/DropERC721__factory.js +2380 -0
- package/js/factories/DropERC721__factory.js.map +1 -0
- package/js/factories/OpenEditionERC721FlatFee__factory.d.ts +1707 -0
- package/js/factories/OpenEditionERC721FlatFee__factory.js +2219 -0
- package/js/factories/OpenEditionERC721FlatFee__factory.js.map +1 -0
- package/js/factories/index.d.ts +1 -0
- package/js/factories/index.js +5 -0
- package/js/factories/index.js.map +1 -0
- package/js/index.d.ts +3 -0
- package/js/index.js +3 -0
- package/js/index.js.map +1 -0
- package/package.json +74 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2021 Non-Fungible Labs, Inc
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<br />
|
|
3
|
+
<a href="https://thirdweb.com"><img src="https://github.com/thirdweb-dev/typescript-sdk/blob/main/logo.svg?raw=true" width="200" alt=""/></a>
|
|
4
|
+
<br />
|
|
5
|
+
</p>
|
|
6
|
+
<h1 align="center">thirdweb Contracts forked by Rarible</h1>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@thirdweb-dev/contracts"><img src="https://img.shields.io/npm/v/@thirdweb-dev/contracts?color=red&logo=npm" alt="npm version"/></a>
|
|
9
|
+
<a href="https://github.com/thirdweb-dev/contracts/actions"><img alt="Build Status" src="https://github.com/thirdweb-dev/contracts/actions/workflows/tests.yml/badge.svg"/></a>
|
|
10
|
+
<a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a>
|
|
11
|
+
|
|
12
|
+
</p>
|
|
13
|
+
<p align="center"><strong>Collection of smart contracts deployable via the thirdweb SDK, dashboard and CLI forked by Rarible</strong></p>
|
|
14
|
+
<br />
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
# Forge projects
|
|
20
|
+
forge install https://github.com/thirdweb-dev/contracts
|
|
21
|
+
|
|
22
|
+
# Hardhat / npm based projects
|
|
23
|
+
npm i @thirdweb-dev/contracts
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
contracts
|
|
28
|
+
|
|
|
29
|
+
|-- extension: "extensions that can be inherited by NON-upgradeable contracts"
|
|
30
|
+
| |-- interface: "interfaces of all extension contracts"
|
|
31
|
+
| |-- upgradeable: "extensions that can be inherited by upgradeable contracts"
|
|
32
|
+
| |-- [$prebuilt-category]: "legacy extensions written specifically for a prebuilt contract"
|
|
33
|
+
|
|
|
34
|
+
|-- base: "NON-upgradeable base contracts to build on top of"
|
|
35
|
+
| |-- interface: "interfaces for all base contracts"
|
|
36
|
+
| |-- upgradeable: "upgradeable base contracts to build on top of"
|
|
37
|
+
|
|
|
38
|
+
|-- prebuilt: "audited, ready-to-deploy thirdweb smart contracts"
|
|
39
|
+
| |-- interface: "interfaces for all prebuilt contracts"
|
|
40
|
+
| |--[$prebuilt-category]: "feature-based group of prebuilt contracts"
|
|
41
|
+
| |-- unaudited: "yet-to-audit thirdweb smart contracts"
|
|
42
|
+
| |-- [$prebuilt-category]: "feature-based group of prebuilt contracts"
|
|
43
|
+
|
|
|
44
|
+
|-- infra: "onchain infrastructure contracts"
|
|
45
|
+
| |-- interface: "interfaces for all infrastructure contracts"
|
|
46
|
+
|
|
|
47
|
+
|-- eip: "implementations of relevant EIP standards"
|
|
48
|
+
| |-- interface "all interfaces of relevant EIP standards"
|
|
49
|
+
|
|
|
50
|
+
|-- lib: "Solidity libraries"
|
|
51
|
+
|
|
|
52
|
+
|-- external-deps: "modified / copied over external dependencies"
|
|
53
|
+
| |-- openzeppelin: "modified / copied over openzeppelin dependencies"
|
|
54
|
+
| |-- chainlink: "modified / copied over chainlink dependencies"
|
|
55
|
+
|
|
|
56
|
+
|-- legacy-contracts: "maintained legacy thirdweb contracts"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Running Tests
|
|
60
|
+
|
|
61
|
+
1. `yarn`: install contracts dependencies
|
|
62
|
+
2. `forge install`: install tests dependencies
|
|
63
|
+
3. `forge test`: run the tests
|
|
64
|
+
|
|
65
|
+
This repository is a [forge](https://github.com/foundry-rs/foundry/tree/master/forge) project.
|
|
66
|
+
|
|
67
|
+
First install the relevant dependencies of the project:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
yarn
|
|
71
|
+
|
|
72
|
+
forge install
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
To compile contracts, run:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
forge build
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
To run tests:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
forge test
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Pre-built Contracts
|
|
88
|
+
|
|
89
|
+
Pre-built contracts are written by the thirdweb team, and cover the most common use cases for smart contracts.
|
|
90
|
+
|
|
91
|
+
- [DropERC20](https://thirdweb.com/deployer.thirdweb.eth/DropERC20)
|
|
92
|
+
- [DropERC721](https://thirdweb.com/deployer.thirdweb.eth/DropERC721)
|
|
93
|
+
- [DropERC1155](https://thirdweb.com/deployer.thirdweb.eth/DropERC1155)
|
|
94
|
+
- [SignatureDrop](https://thirdweb.com/deployer.thirdweb.eth/SignatureDrop)
|
|
95
|
+
- [Marketplace](https://thirdweb.com/deployer.thirdweb.eth/Marketplace)
|
|
96
|
+
- [Multiwrap](https://thirdweb.com/deployer.thirdweb.eth/Multiwrap)
|
|
97
|
+
- [TokenERC20](https://thirdweb.com/deployer.thirdweb.eth/TokenERC20)
|
|
98
|
+
- [TokenERC721](https://thirdweb.com/deployer.thirdweb.eth/TokenERC721)
|
|
99
|
+
- [TokenERC1155](https://thirdweb.com/deployer.thirdweb.eth/TokenERC1155)
|
|
100
|
+
- [VoteERC20](https://thirdweb.com/deployer.thirdweb.eth/VoteERC20)
|
|
101
|
+
- [Split](https://thirdweb.com/deployer.thirdweb.eth/Split)
|
|
102
|
+
|
|
103
|
+
[Learn more about pre-built contracts](https://portal.thirdweb.com/pre-built-contracts)
|
|
104
|
+
|
|
105
|
+
## Extensions
|
|
106
|
+
|
|
107
|
+
Extensions are building blocks that help enrich smart contracts with features.
|
|
108
|
+
|
|
109
|
+
Some blocks come packaged together as Base Contracts, which come with a full set of features out of the box that you can modify and extend. These contracts are available at `contracts/base/`.
|
|
110
|
+
|
|
111
|
+
Other (smaller) blocks are Features, which provide a way for you to pick and choose which individual pieces you want to put into your contract; with full customization of how those features work. These are available at `contracts/extension/`.
|
|
112
|
+
|
|
113
|
+
[Learn more about extensions](https://portal.thirdweb.com/extensions)
|
|
114
|
+
|
|
115
|
+
## Contract Audits
|
|
116
|
+
|
|
117
|
+
- [Audit 1](audit-reports/audit-1.pdf)
|
|
118
|
+
- [Audit 2](audit-reports/audit-2.pdf)
|
|
119
|
+
- [Audit 3](audit-reports/audit-3.pdf)
|
|
120
|
+
- [Audit 4](audit-reports/audit-4.pdf)
|
|
121
|
+
- [Audit 5](audit-reports/audit-5.pdf)
|
|
122
|
+
- [Audit 6](audit-reports/audit-6.pdf)
|
|
123
|
+
- [Audit 7](audit-reports/audit-7.pdf)
|
|
124
|
+
- [Audit 8](audit-reports/audit-8.pdf)
|
|
125
|
+
- [Audit 9](audit-reports/audit-9.pdf)
|
|
126
|
+
- [Audit 10](audit-reports/audit-10.pdf)
|
|
127
|
+
- [Audit 11](audit-reports/audit-11.pdf)
|
|
128
|
+
- [Audit 12](audit-reports/audit-12.pdf)
|
|
129
|
+
|
|
130
|
+
## Bug reports
|
|
131
|
+
|
|
132
|
+
Found a security issue with our smart contracts? Send bug reports to security@thirdweb.com and we'll continue communicating with you from there. We're actively developing a bug bounty program; bug report payouts happen on a case by case basis, for now.
|
|
133
|
+
|
|
134
|
+
## Feedback
|
|
135
|
+
|
|
136
|
+
If you have any feedback, please reach out to us at support@thirdweb.com.
|
|
137
|
+
|
|
138
|
+
## Authors
|
|
139
|
+
|
|
140
|
+
- [thirdweb](https://thirdweb.com)
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt)
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
/// @author thirdweb
|
|
5
|
+
|
|
6
|
+
import { ERC1155 } from "../eip/ERC1155.sol";
|
|
7
|
+
|
|
8
|
+
import "../extension/ContractMetadata.sol";
|
|
9
|
+
import "../extension/Multicall.sol";
|
|
10
|
+
import "../extension/Ownable.sol";
|
|
11
|
+
import "../extension/Royalty.sol";
|
|
12
|
+
import "../extension/BatchMintMetadata.sol";
|
|
13
|
+
|
|
14
|
+
import "../lib/Strings.sol";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The `ERC1155Base` smart contract implements the ERC1155 NFT standard.
|
|
18
|
+
* It includes the following additions to standard ERC1155 logic:
|
|
19
|
+
*
|
|
20
|
+
* - Ability to mint NFTs via the provided `mintTo` and `batchMintTo` functions.
|
|
21
|
+
*
|
|
22
|
+
* - Contract metadata for royalty support on platforms such as OpenSea that use
|
|
23
|
+
* off-chain information to distribute roaylties.
|
|
24
|
+
*
|
|
25
|
+
* - Ownership of the contract, with the ability to restrict certain functions to
|
|
26
|
+
* only be called by the contract's owner.
|
|
27
|
+
*
|
|
28
|
+
* - Multicall capability to perform multiple actions atomically
|
|
29
|
+
*
|
|
30
|
+
* - EIP 2981 compliance for royalty support on NFT marketplaces.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
contract ERC1155Base is ERC1155, ContractMetadata, Ownable, Royalty, Multicall, BatchMintMetadata {
|
|
34
|
+
using Strings for uint256;
|
|
35
|
+
|
|
36
|
+
/*//////////////////////////////////////////////////////////////
|
|
37
|
+
State variables
|
|
38
|
+
//////////////////////////////////////////////////////////////*/
|
|
39
|
+
|
|
40
|
+
/// @dev The tokenId of the next NFT to mint.
|
|
41
|
+
uint256 internal nextTokenIdToMint_;
|
|
42
|
+
|
|
43
|
+
/*//////////////////////////////////////////////////////////////
|
|
44
|
+
Mappings
|
|
45
|
+
//////////////////////////////////////////////////////////////*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @notice Returns the total supply of NFTs of a given tokenId
|
|
49
|
+
* @dev Mapping from tokenId => total circulating supply of NFTs of that tokenId.
|
|
50
|
+
*/
|
|
51
|
+
mapping(uint256 => uint256) public totalSupply;
|
|
52
|
+
|
|
53
|
+
/*//////////////////////////////////////////////////////////////
|
|
54
|
+
Constructor
|
|
55
|
+
//////////////////////////////////////////////////////////////*/
|
|
56
|
+
|
|
57
|
+
constructor(
|
|
58
|
+
address _defaultAdmin,
|
|
59
|
+
string memory _name,
|
|
60
|
+
string memory _symbol,
|
|
61
|
+
address _royaltyRecipient,
|
|
62
|
+
uint128 _royaltyBps
|
|
63
|
+
) ERC1155(_name, _symbol) {
|
|
64
|
+
_setupOwner(_defaultAdmin);
|
|
65
|
+
_setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*//////////////////////////////////////////////////////////////
|
|
69
|
+
Overriden metadata logic
|
|
70
|
+
//////////////////////////////////////////////////////////////*/
|
|
71
|
+
|
|
72
|
+
/// @notice Returns the metadata URI for the given tokenId.
|
|
73
|
+
/// @param _tokenId The tokenId of the token for which a URI should be returned.
|
|
74
|
+
/// @return The metadata URI for the given tokenId.
|
|
75
|
+
function uri(uint256 _tokenId) public view virtual override returns (string memory) {
|
|
76
|
+
string memory uriForToken = _uri[_tokenId];
|
|
77
|
+
if (bytes(uriForToken).length > 0) {
|
|
78
|
+
return uriForToken;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
string memory batchUri = _getBaseURI(_tokenId);
|
|
82
|
+
return string(abi.encodePacked(batchUri, _tokenId.toString()));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/*//////////////////////////////////////////////////////////////
|
|
86
|
+
Mint / burn logic
|
|
87
|
+
//////////////////////////////////////////////////////////////*/
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @notice Lets an authorized address mint NFTs to a recipient.
|
|
91
|
+
* @dev - The logic in the `_canMint` function determines whether the caller is authorized to mint NFTs.
|
|
92
|
+
* - If `_tokenId == type(uint256).max` a new NFT at tokenId `nextTokenIdToMint` is minted. If the given
|
|
93
|
+
* `tokenId < nextTokenIdToMint`, then additional supply of an existing NFT is being minted.
|
|
94
|
+
*
|
|
95
|
+
* @param _to The recipient of the NFTs to mint.
|
|
96
|
+
* @param _tokenId The tokenId of the NFT to mint.
|
|
97
|
+
* @param _tokenURI The full metadata URI for the NFTs minted (if a new NFT is being minted).
|
|
98
|
+
* @param _amount The amount of the same NFT to mint.
|
|
99
|
+
*/
|
|
100
|
+
function mintTo(address _to, uint256 _tokenId, string memory _tokenURI, uint256 _amount) public virtual {
|
|
101
|
+
require(_canMint(), "Not authorized to mint.");
|
|
102
|
+
|
|
103
|
+
uint256 tokenIdToMint;
|
|
104
|
+
uint256 nextIdToMint = nextTokenIdToMint();
|
|
105
|
+
|
|
106
|
+
if (_tokenId == type(uint256).max) {
|
|
107
|
+
tokenIdToMint = nextIdToMint;
|
|
108
|
+
nextTokenIdToMint_ += 1;
|
|
109
|
+
_setTokenURI(nextIdToMint, _tokenURI);
|
|
110
|
+
} else {
|
|
111
|
+
require(_tokenId < nextIdToMint, "invalid id");
|
|
112
|
+
tokenIdToMint = _tokenId;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
_mint(_to, tokenIdToMint, _amount, "");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @notice Lets an authorized address mint multiple NEW NFTs at once to a recipient.
|
|
120
|
+
* @dev The logic in the `_canMint` function determines whether the caller is authorized to mint NFTs.
|
|
121
|
+
* If `_tokenIds[i] == type(uint256).max` a new NFT at tokenId `nextTokenIdToMint` is minted. If the given
|
|
122
|
+
* `tokenIds[i] < nextTokenIdToMint`, then additional supply of an existing NFT is minted.
|
|
123
|
+
* The metadata for each new NFT is stored at `baseURI/{tokenID of NFT}`
|
|
124
|
+
*
|
|
125
|
+
* @param _to The recipient of the NFT to mint.
|
|
126
|
+
* @param _tokenIds The tokenIds of the NFTs to mint.
|
|
127
|
+
* @param _amounts The amounts of each NFT to mint.
|
|
128
|
+
* @param _baseURI The baseURI for the `n` number of NFTs minted. The metadata for each NFT is `baseURI/tokenId`
|
|
129
|
+
*/
|
|
130
|
+
function batchMintTo(
|
|
131
|
+
address _to,
|
|
132
|
+
uint256[] memory _tokenIds,
|
|
133
|
+
uint256[] memory _amounts,
|
|
134
|
+
string memory _baseURI
|
|
135
|
+
) public virtual {
|
|
136
|
+
require(_canMint(), "Not authorized to mint.");
|
|
137
|
+
require(_amounts.length > 0, "Minting zero tokens.");
|
|
138
|
+
require(_tokenIds.length == _amounts.length, "Length mismatch.");
|
|
139
|
+
|
|
140
|
+
uint256 nextIdToMint = nextTokenIdToMint();
|
|
141
|
+
uint256 startNextIdToMint = nextIdToMint;
|
|
142
|
+
|
|
143
|
+
uint256 numOfNewNFTs;
|
|
144
|
+
|
|
145
|
+
for (uint256 i = 0; i < _tokenIds.length; i += 1) {
|
|
146
|
+
if (_tokenIds[i] == type(uint256).max) {
|
|
147
|
+
_tokenIds[i] = nextIdToMint;
|
|
148
|
+
|
|
149
|
+
nextIdToMint += 1;
|
|
150
|
+
numOfNewNFTs += 1;
|
|
151
|
+
} else {
|
|
152
|
+
require(_tokenIds[i] < nextIdToMint, "invalid id");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (numOfNewNFTs > 0) {
|
|
157
|
+
_batchMintMetadata(startNextIdToMint, numOfNewNFTs, _baseURI);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
nextTokenIdToMint_ = nextIdToMint;
|
|
161
|
+
_mintBatch(_to, _tokenIds, _amounts, "");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @notice Lets an owner or approved operator burn NFTs of the given tokenId.
|
|
166
|
+
*
|
|
167
|
+
* @param _owner The owner of the NFT to burn.
|
|
168
|
+
* @param _tokenId The tokenId of the NFT to burn.
|
|
169
|
+
* @param _amount The amount of the NFT to burn.
|
|
170
|
+
*/
|
|
171
|
+
function burn(address _owner, uint256 _tokenId, uint256 _amount) external virtual {
|
|
172
|
+
address caller = msg.sender;
|
|
173
|
+
|
|
174
|
+
require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");
|
|
175
|
+
require(balanceOf[_owner][_tokenId] >= _amount, "Not enough tokens owned");
|
|
176
|
+
|
|
177
|
+
_burn(_owner, _tokenId, _amount);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @notice Lets an owner or approved operator burn NFTs of the given tokenIds.
|
|
182
|
+
*
|
|
183
|
+
* @param _owner The owner of the NFTs to burn.
|
|
184
|
+
* @param _tokenIds The tokenIds of the NFTs to burn.
|
|
185
|
+
* @param _amounts The amounts of the NFTs to burn.
|
|
186
|
+
*/
|
|
187
|
+
function burnBatch(address _owner, uint256[] memory _tokenIds, uint256[] memory _amounts) external virtual {
|
|
188
|
+
address caller = msg.sender;
|
|
189
|
+
|
|
190
|
+
require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");
|
|
191
|
+
require(_tokenIds.length == _amounts.length, "Length mismatch");
|
|
192
|
+
|
|
193
|
+
for (uint256 i = 0; i < _tokenIds.length; i += 1) {
|
|
194
|
+
require(balanceOf[_owner][_tokenIds[i]] >= _amounts[i], "Not enough tokens owned");
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
_burnBatch(_owner, _tokenIds, _amounts);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/*//////////////////////////////////////////////////////////////
|
|
201
|
+
ERC165 Logic
|
|
202
|
+
//////////////////////////////////////////////////////////////*/
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @dev See ERC165: https://eips.ethereum.org/EIPS/eip-165
|
|
206
|
+
* @inheritdoc IERC165
|
|
207
|
+
*/
|
|
208
|
+
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) {
|
|
209
|
+
return
|
|
210
|
+
interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
|
|
211
|
+
interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155
|
|
212
|
+
interfaceId == 0x0e89341c || // ERC165 Interface ID for ERC1155MetadataURI
|
|
213
|
+
interfaceId == type(IERC2981).interfaceId; // ERC165 ID for ERC2981
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/*//////////////////////////////////////////////////////////////
|
|
217
|
+
View functions
|
|
218
|
+
//////////////////////////////////////////////////////////////*/
|
|
219
|
+
|
|
220
|
+
/// @notice The tokenId assigned to the next new NFT to be minted.
|
|
221
|
+
function nextTokenIdToMint() public view virtual returns (uint256) {
|
|
222
|
+
return nextTokenIdToMint_;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/*//////////////////////////////////////////////////////////////
|
|
226
|
+
Internal (overrideable) functions
|
|
227
|
+
//////////////////////////////////////////////////////////////*/
|
|
228
|
+
|
|
229
|
+
/// @dev Returns whether contract metadata can be set in the given execution context.
|
|
230
|
+
/// @return Whether contract metadata can be set in the given execution context.
|
|
231
|
+
function _canSetContractURI() internal view virtual override returns (bool) {
|
|
232
|
+
return msg.sender == owner();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/// @dev Returns whether a token can be minted in the given execution context.
|
|
236
|
+
/// @return Whether a token can be minted in the given execution context.
|
|
237
|
+
function _canMint() internal view virtual returns (bool) {
|
|
238
|
+
return msg.sender == owner();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/// @dev Returns whether owner can be set in the given execution context.
|
|
242
|
+
/// @return Whether owner can be set in the given execution context.
|
|
243
|
+
function _canSetOwner() internal view virtual override returns (bool) {
|
|
244
|
+
return msg.sender == owner();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/// @dev Returns whether royalty info can be set in the given execution context.
|
|
248
|
+
/// @return Whether royalty info can be set in the given execution context.
|
|
249
|
+
function _canSetRoyaltyInfo() internal view virtual override returns (bool) {
|
|
250
|
+
return msg.sender == owner();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/// @dev Runs before every token transfer / mint / burn.
|
|
254
|
+
/// @param operator The address of the caller.
|
|
255
|
+
/// @param from The address of the sender.
|
|
256
|
+
/// @param to The address of the recipient.
|
|
257
|
+
/// @param ids The tokenIds of the tokens being transferred.
|
|
258
|
+
/// @param amounts The amounts of the tokens being transferred.
|
|
259
|
+
/// @param data Additional data with no specified format.
|
|
260
|
+
function _beforeTokenTransfer(
|
|
261
|
+
address operator,
|
|
262
|
+
address from,
|
|
263
|
+
address to,
|
|
264
|
+
uint256[] memory ids,
|
|
265
|
+
uint256[] memory amounts,
|
|
266
|
+
bytes memory data
|
|
267
|
+
) internal virtual override {
|
|
268
|
+
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
|
|
269
|
+
|
|
270
|
+
if (from == address(0)) {
|
|
271
|
+
for (uint256 i = 0; i < ids.length; ++i) {
|
|
272
|
+
totalSupply[ids[i]] += amounts[i];
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (to == address(0)) {
|
|
277
|
+
for (uint256 i = 0; i < ids.length; ++i) {
|
|
278
|
+
totalSupply[ids[i]] -= amounts[i];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|