@artblocks/contracts 1.3.2 → 1.4.0
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/README.md +11 -10
- package/artifacts/contracts/AdminACLV0RoyaltyRegistry.sol/AdminACLV0RoyaltyRegistry.json +193 -0
- package/artifacts/contracts/AdminACLV0RoyaltyRegistry.sol/IRoyaltyRegistry.json +35 -0
- package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
- package/artifacts/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2.sol/BytecodeStorageReaderContractV2.json +2 -2
- package/artifacts/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2_Web3Call.sol/BytecodeStorageReaderContractV2_Web3Call.json +2 -2
- package/artifacts/contracts/BytecodeStorageV2Writer.sol/BytecodeStorageV2Writer.json +2 -2
- package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +210 -2
- package/artifacts/contracts/GenArt721CoreV3_Curated.sol/GenArt721CoreV3_Curated.json +235 -20
- package/artifacts/contracts/GenArt721CoreV3_Curated_Flex.sol/GenArt721CoreV3_Curated_Flex.json +3197 -0
- package/artifacts/contracts/GenArt721CoreV3_Explorations_Flex.sol/GenArt721CoreV3_Explorations_Flex.json +3192 -0
- package/artifacts/contracts/OwnedCreate2FactoryV0.sol/OwnedCreate2FactoryV0.json +2 -2
- package/artifacts/contracts/archive/GenArt721CoreV3.sol/GenArt721CoreV3.json +27 -2
- package/artifacts/contracts/archive/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +27 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol/MinterDAExpV2.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol/MinterDAExpV3.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV4.sol/MinterDAExpV4.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol/MinterDAExpSettlementV0.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV1.sol/MinterDAExpSettlementV1.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV2.sol/MinterDALinV2.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV3.sol/MinterDALinV3.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV4.sol/MinterDALinV4.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV1.sol/MinterHolderV1.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV3.sol/MinterHolderV3.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV4.sol/MinterHolderV4.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV1.sol/MinterMerkleV1.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV2.sol/MinterMerkleV2.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol/MinterMerkleV3.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol/MinterMerkleV4.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV5.sol/MinterMerkleV5.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterPolyptych/MinterPolyptychV0.sol/IGenArt721CoreContractV3WithRandomizer.json +25 -0
- package/artifacts/contracts/archive/minter-suite/Minters/MinterPolyptych/MinterPolyptychV0.sol/MinterPolyptychV0.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSEA/MinterSEAV0.sol/MinterSEAV0.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol/MinterSetPriceV2.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol/MinterSetPriceV3.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV4.sol/MinterSetPriceV4.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol/MinterSetPriceERC20V2.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol/MinterSetPriceERC20V3.json +2 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V4.sol/MinterSetPriceERC20V4.json +2 -2
- package/artifacts/contracts/engine/V3/EngineFactoryV0.sol/EngineFactoryV0.json +28 -2
- package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +239 -20
- package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +267 -48
- package/artifacts/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol/GenArt721CoreV3_Engine_Flex_PROOF.json +27 -2
- package/artifacts/contracts/engine/V3/forks/PROHIBITION/AdminACLV0_PROHIBITION.sol/AdminACLV0_PROHIBITION.json +2 -2
- package/artifacts/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol/GenArt721CoreV3_Engine_Flex_PROHIBITION.json +27 -2
- package/artifacts/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.json +25 -0
- package/artifacts/contracts/engine/V3/transfer-hooks/AbstractTransferHook.sol/AbstractTransferHook.json +79 -0
- package/artifacts/contracts/engine/V3/transfer-hooks/OwnerHistoryTransferHook.sol/OwnerHistoryTransferHook.json +315 -0
- package/artifacts/contracts/generator/GenArt721GeneratorV0.sol/GenArt721GeneratorV0.json +2 -2
- package/artifacts/contracts/interfaces/v0.8.x/IClaimMinter.sol/IClaimMinter.json +189 -0
- package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +149 -0
- package/artifacts/contracts/interfaces/v0.8.x/IEngineFactoryV0.sol/IEngineFactoryV0.json +26 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3.sol/IGenArt721CoreContractV3.json +25 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol/IGenArt721CoreContractV3_Base.json +25 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol/IGenArt721CoreContractV3_Engine.json +123 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol/IGenArt721CoreContractV3_Engine_Flex.json +123 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.sol/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.json +25 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_PreV3p2.sol/IGenArt721CoreContractV3_Engine_PreV3p2.json +25 -0
- package/artifacts/contracts/interfaces/v0.8.x/IOwnerHistoryTransferHook.sol/IOwnerHistoryTransferHook.json +299 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISRHooks.sol/ISRHooks.json +432 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISeaDropShimForContract.sol/ISeaDropShimForContract.json +0 -13
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterTieredAllowV0.sol/ISharedMinterTieredAllowV0.json +94 -0
- package/artifacts/contracts/interfaces/v0.8.x/ITransferHook.sol/ITransferHook.json +63 -0
- package/artifacts/contracts/libs/v0.8.x/AuthLib.sol/AuthLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV2.sol/BytecodeStorageReader.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV2.sol/BytecodeStorageWriter.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol/DependencyRegistryStorageLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/ENSLib.sol/ENSLib.json +10 -0
- package/artifacts/contracts/libs/v0.8.x/ENSLib.sol/IUniversalResolver.json +45 -0
- package/artifacts/contracts/libs/v0.8.x/EnumerableSetUint16.sol/EnumerableSetUint16.json +10 -0
- package/artifacts/contracts/libs/v0.8.x/FeistelWalkLib.sol/FeistelWalkLib.json +10 -0
- package/artifacts/contracts/libs/v0.8.x/ImmutableUint16Array.sol/ImmutableUint16Array.json +10 -0
- package/artifacts/contracts/libs/v0.8.x/V3EngineLib.sol/V3EngineLib.json +163 -0
- package/artifacts/contracts/libs/v0.8.x/V3FlexLib.sol/V3FlexLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/V3TransferHookLib.sol/V3TransferHookLib.json +79 -0
- package/artifacts/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol/MaxInvocationsLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/OnChainAllowlistLib.sol/OnChainAllowlistLib.json +10 -0
- package/artifacts/contracts/libs/v0.8.x/minter-libs/PolyptychLib.sol/PolyptychLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/RAMLib.sol/RAMLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/SEALib.sol/SEALib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/SettlementExpLib.sol/SettlementExpLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol/SplitFundsLib.json +2 -2
- package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV1.sol/MinterFilterV1.json +2 -2
- package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV2.sol/MinterFilterV2.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpHolderV5.sol/MinterDAExpHolderV5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV3.sol/MinterDAExpSettlementV3.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpV5.sol/MinterDAExpV5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterDALinHolderV5.sol/MinterDALinHolderV5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterDALinV5.sol/MinterDALinV5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterMinPriceMerkleV0.sol/MinterMinPriceMerkleV0.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterMinPriceV0.sol/MinterMinPriceV0.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterRAMV0.sol/MinterRAMV0.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterSEAV1.sol/MinterSEAV1.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V5.sol/MinterSetPriceERC20V5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceHolderV5.sol/MinterSetPriceHolderV5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceMerkleV5.sol/MinterSetPriceMerkleV5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceOnChainAllowV0.sol/MinterSetPriceOnChainAllowV0.json +522 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychERC20V5.sol/MinterSetPricePolyptychERC20V5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol/MinterSetPricePolyptychV5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceTieredAllowV1.sol/MinterSetPriceTieredAllowV1.json +715 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV5.sol/MinterSetPriceV5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterSlidingScaleV0.sol/MinterSlidingScaleV0.json +431 -0
- package/artifacts/contracts/minter-suite/Minters/one-off/ClaimMinter.sol/ClaimMinter.json +502 -0
- package/artifacts/contracts/minter-suite/Minters/one-off/MinterSetPriceTieredOnChainAllowV0.sol/MinterSetPriceTieredOnChainAllowV0.json +673 -0
- package/artifacts/contracts/minter-suite/Minters/one-off/MinterSetPriceV5_SingleCore.sol/MinterSetPriceV5_SingleCore.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/one-off/SeaDropXArtBlocksShim.sol/SeaDropXArtBlocksShim.json +6 -19
- package/artifacts/contracts/mock/BytecodeV2TextCR_DMock.sol/BytecodeV2TextCR_DMock.json +2 -2
- package/artifacts/contracts/mock/DummySharedMinter.sol/DummySharedMinter.json +2 -2
- package/artifacts/contracts/mock/ENSLibMock.sol/ENSLibMock.json +30 -0
- package/artifacts/contracts/mock/EnumerableSetUint16Mock.sol/EnumerableSetUint16Mock.json +146 -0
- package/artifacts/contracts/mock/FeistelWalkLibMock.sol/FeistelWalkLibMock.json +142 -0
- package/artifacts/contracts/mock/ForceSendMock.sol/ForceSendMock.json +2 -2
- package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +2 -2
- package/artifacts/contracts/mock/ImmutableUint16ArrayMock.sol/ImmutableUint16ArrayMock.json +89 -0
- package/artifacts/contracts/mock/MockAdminACLV0_PROHIBITION.sol/MockAdminACLV0Events_PROHIBITION.json +2 -2
- package/artifacts/contracts/mock/MockGenArt721V3Core.sol/MockGenArt721V3Core.json +490 -0
- package/artifacts/contracts/mock/MockPMP.sol/MockPMP.json +523 -0
- package/artifacts/contracts/mock/MockTransferHook.sol/MockTransferHook.json +453 -0
- package/artifacts/contracts/mock/MockTransferHookTestHelpers.sol/MockBatchTransferrer.json +39 -0
- package/artifacts/contracts/mock/MockTransferHookTestHelpers.sol/MockForwardingERC721Receiver.json +71 -0
- package/artifacts/contracts/mock/MockTransferHookTestHelpers.sol/MockSpoofingCore.json +94 -0
- package/artifacts/contracts/mock/RandomizerV2_NoAssignMock.sol/RandomizerV2_NoAssignMock.json +2 -2
- package/artifacts/contracts/mock/ReentrancyBatchMockShared.sol/IBatchMinter.json +64 -0
- package/artifacts/contracts/mock/ReentrancyBatchMockShared.sol/ReentrancyBatchMockShared.json +113 -0
- package/artifacts/contracts/mock/RelayExecutorTestHelper.sol/MockTarget.json +74 -0
- package/artifacts/contracts/mock/RelayExecutorTestHelper.sol/RelayExecutorPartialRevertsTestHelper.json +138 -0
- package/artifacts/contracts/mock/RelayExecutorTestHelper.sol/RelayExecutorTestHelper.json +119 -0
- package/artifacts/contracts/randomizer/deprecated/PolyptychRandomizerV0.sol/BasicPolyptychRandomizerV0.json +2 -2
- package/artifacts/contracts/randomizer/deprecated/RandomizerV2.sol/BasicRandomizerV2.json +2 -2
- package/artifacts/contracts/randomizer/shared/SharedRandomizerV0.sol/SharedRandomizerV0.json +2 -2
- package/artifacts/contracts/relay/RelayExecutor.sol/RelayExecutor.json +101 -0
- package/artifacts/contracts/relay/RelayExecutorPartialReverts.sol/RelayExecutorPartialReverts.json +120 -0
- package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverrideSplits.sol/GenArt721RoyaltyOverrideSplits.json +263 -0
- package/artifacts/contracts/utils/MintMulticallUtil.sol/IMinterSetPriceV5.json +40 -0
- package/artifacts/contracts/utils/MintMulticallUtil.sol/MintMulticallUtil.json +163 -0
- package/artifacts/contracts/web3call/PMPV0.sol/PMPV0.json +2 -2
- package/artifacts/contracts/web3call/PMPV1.sol/PMPV1.json +648 -0
- package/artifacts/contracts/web3call/augment-hooks/InjectBaseGasFee.sol/InjectBaseGasFee.json +2 -2
- package/artifacts/contracts/web3call/augment-hooks/InjectBlockHeight.sol/InjectBlockHeight.json +83 -0
- package/artifacts/contracts/web3call/augment-hooks/InjectBlockHeightAndArtistProjectOverrides.sol/InjectBlockHeightAndArtistProjectOverrides.json +226 -0
- package/artifacts/contracts/web3call/augment-hooks/InjectBlockHeightAndNumOwnedProjectTokens.sol/InjectBlockHeightAndNumOwnedProjectTokens.json +182 -0
- package/artifacts/contracts/web3call/augment-hooks/InjectBlockHeightProjectInvocationsAndArtistProjectOverrides.sol/InjectBlockHeightProjectInvocationsAndArtistProjectOverrides.json +226 -0
- package/artifacts/contracts/web3call/augment-hooks/InjectBlockTimestamp.sol/InjectBlockTimestamp.json +83 -0
- package/artifacts/contracts/web3call/augment-hooks/InjectBytesPerToken.sol/InjectBytesPerToken.json +358 -0
- package/artifacts/contracts/web3call/augment-hooks/InjectChromieSquiggleFloorPrice.sol/InjectChromieSquiggleFloorPrice.json +2 -2
- package/artifacts/contracts/web3call/augment-hooks/InjectIsNounsDaoMember.sol/InjectIsNounsDaoMember.json +2 -2
- package/artifacts/contracts/web3call/augment-hooks/InjectIsProjectFullyMinted.sol/InjectIsProjectFullyMinted.json +2 -2
- package/artifacts/contracts/web3call/augment-hooks/InjectPolyptychTokenHash.sol/InjectPolyptychTokenHash.json +2 -2
- package/artifacts/contracts/web3call/augment-hooks/InjectTokenHashSeed.sol/InjectTokenHashSeed.json +2 -2
- package/artifacts/contracts/web3call/augment-hooks/InjectTokenOwner.sol/InjectTokenOwner.json +2 -2
- package/artifacts/contracts/web3call/augment-hooks/InjectTokenOwnerEthBalance.sol/InjectTokenOwnerEthBalance.json +2 -2
- package/artifacts/contracts/web3call/augment-hooks/InjectUSDCTotalSupply.sol/InjectUSDCTotalSupply.json +2 -2
- package/artifacts/contracts/web3call/augment-hooks/SRHooks.sol/SRHooks.json +899 -0
- package/artifacts/contracts/web3call/combined-hooks/LiftHooks.sol/IGenArt721V0_Minimal.json +30 -0
- package/artifacts/contracts/web3call/combined-hooks/LiftHooks.sol/IRelic.json +35 -0
- package/artifacts/contracts/web3call/combined-hooks/LiftHooks.sol/LiftHooks.json +256 -0
- package/artifacts/contracts/web3call/configure-hooks/{abstractPMPConfigureHook.sol → AbstractPMPConfigureHook.sol}/AbstractPMPConfigureHook.json +1 -1
- package/artifacts/contracts/web3call/configure-hooks/PMPConfigureLockHook.sol/PMPConfigureLockHook.json +195 -0
- package/contracts/AdminACLV0RoyaltyRegistry.sol +142 -0
- package/contracts/DependencyRegistryV0.sol +143 -13
- package/contracts/GenArt721CoreV3_Curated.sol +1 -1
- package/contracts/GenArt721CoreV3_Curated_Flex.sol +173 -0
- package/contracts/GenArt721CoreV3_Explorations_Flex.sol +159 -0
- package/contracts/engine/V3/EngineFactoryV0.sol +20 -1
- package/contracts/engine/V3/GenArt721CoreV3_Engine.sol +286 -299
- package/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol +292 -301
- package/contracts/engine/V3/transfer-hooks/AbstractTransferHook.sol +101 -0
- package/contracts/engine/V3/transfer-hooks/OwnerHistoryTransferHook.sol +291 -0
- package/contracts/generator/GenArt721GeneratorV0.sol +145 -47
- package/contracts/helpers/ERC1967ProxyImport.sol +5 -0
- package/contracts/interfaces/v0.8.x/IArtblocksRoyaltyOverride.sol +1 -1
- package/contracts/interfaces/v0.8.x/IClaimMinter.sol +70 -0
- package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +95 -0
- package/contracts/interfaces/v0.8.x/IEngineFactoryV0.sol +15 -0
- package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol +21 -2
- package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol +72 -0
- package/contracts/interfaces/v0.8.x/IOwnerHistoryTransferHook.sol +119 -0
- package/contracts/interfaces/v0.8.x/ISRHooks.sol +229 -0
- package/contracts/interfaces/v0.8.x/ISeaDropShimForContract.sol +0 -6
- package/contracts/interfaces/v0.8.x/ISharedMinterTieredAllowV0.sol +69 -0
- package/contracts/interfaces/v0.8.x/ITransferHook.sol +48 -0
- package/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol +12 -0
- package/contracts/libs/v0.8.x/ENSLib.sol +85 -0
- package/contracts/libs/v0.8.x/EnumerableSetUint16.sol +429 -0
- package/contracts/libs/v0.8.x/FeistelWalkLib.sol +221 -0
- package/contracts/libs/v0.8.x/ImmutableUint16Array.sol +201 -0
- package/contracts/libs/v0.8.x/V3EngineLib.sol +490 -0
- package/contracts/libs/v0.8.x/V3TransferHookLib.sol +251 -0
- package/contracts/libs/v0.8.x/minter-libs/OnChainAllowlistLib.sol +165 -0
- package/contracts/minter-suite/Minters/MinterSetPriceOnChainAllowV0.sol +632 -0
- package/contracts/minter-suite/Minters/MinterSetPriceTieredAllowV1.sol +871 -0
- package/contracts/minter-suite/Minters/MinterSlidingScaleV0.sol +493 -0
- package/contracts/minter-suite/Minters/one-off/ClaimMinter.sol +595 -0
- package/contracts/minter-suite/Minters/one-off/MinterSetPriceTieredOnChainAllowV0.sol +894 -0
- package/contracts/minter-suite/Minters/one-off/SeaDropXArtBlocksShim.sol +59 -41
- package/contracts/mock/ENSLibMock.sol +25 -0
- package/contracts/mock/EnumerableSetUint16Mock.sol +88 -0
- package/contracts/mock/FeistelWalkLibMock.sol +81 -0
- package/contracts/mock/ImmutableUint16ArrayMock.sol +62 -0
- package/contracts/mock/MockGenArt721V3Core.sol +416 -0
- package/contracts/mock/MockPMP.sol +287 -0
- package/contracts/mock/MockTransferHook.sol +160 -0
- package/contracts/mock/MockTransferHookTestHelpers.sol +96 -0
- package/contracts/mock/ReentrancyBatchMockShared.sol +53 -0
- package/contracts/mock/RelayExecutorTestHelper.sol +44 -0
- package/contracts/relay/RelayExecutor.sol +61 -0
- package/contracts/relay/RelayExecutorPartialReverts.sol +79 -0
- package/contracts/royalty-registry/GenArt721RoyaltyOverrideSplits.sol +130 -0
- package/contracts/utils/MintMulticallUtil.sol +103 -0
- package/contracts/web3call/PMPV1.sol +1204 -0
- package/contracts/web3call/augment-hooks/AbstractPMPAugmentHook.sol +1 -1
- package/contracts/web3call/augment-hooks/InjectBaseGasFee.sol +1 -1
- package/contracts/web3call/augment-hooks/InjectBlockHeight.sol +57 -0
- package/contracts/web3call/augment-hooks/InjectBlockHeightAndArtistProjectOverrides.sol +310 -0
- package/contracts/web3call/augment-hooks/InjectBlockHeightAndNumOwnedProjectTokens.sol +141 -0
- package/contracts/web3call/augment-hooks/InjectBlockHeightProjectInvocationsAndArtistProjectOverrides.sol +326 -0
- package/contracts/web3call/augment-hooks/InjectBlockTimestamp.sol +57 -0
- package/contracts/web3call/augment-hooks/InjectBytesPerToken.sol +279 -0
- package/contracts/web3call/augment-hooks/InjectIsProjectFullyMinted.sol +1 -1
- package/contracts/web3call/augment-hooks/InjectTokenHashSeed.sol +1 -1
- package/contracts/web3call/augment-hooks/InjectTokenOwner.sol +1 -1
- package/contracts/web3call/augment-hooks/InjectTokenOwnerEthBalance.sol +1 -1
- package/contracts/web3call/augment-hooks/SRHooks.sol +1722 -0
- package/contracts/web3call/combined-hooks/LiftHooks.sol +304 -0
- package/contracts/web3call/configure-hooks/{abstractPMPConfigureHook.sol → AbstractPMPConfigureHook.sol} +1 -1
- package/contracts/web3call/configure-hooks/PMPConfigureLockHook.sol +107 -0
- package/package.json +39 -24
|
@@ -10,10 +10,4 @@ interface ISeaDropShimForContract {
|
|
|
10
10
|
* @param nftContract The address of the NFT contract that this shim contract is compatible with
|
|
11
11
|
*/
|
|
12
12
|
event SeaDropShimForContract(address nftContract);
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @dev Emit event when the local max supply is updated
|
|
16
|
-
* @param newLocalMaxSupply The new local max supply
|
|
17
|
-
*/
|
|
18
|
-
event LocalMaxSupplyUpdated(uint256 newLocalMaxSupply);
|
|
19
13
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
// Created By: Art Blocks Inc.
|
|
3
|
+
|
|
4
|
+
pragma solidity ^0.8.0;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @title This interface adds support for tiered allowlist pricing.
|
|
8
|
+
* @notice Intended for shared minters that expose both a public price and a
|
|
9
|
+
* privileged allowlist price, and that can resolve the effective price for a
|
|
10
|
+
* given wallet.
|
|
11
|
+
* @author Art Blocks Inc.
|
|
12
|
+
*/
|
|
13
|
+
interface ISharedMinterTieredAllowV0 {
|
|
14
|
+
/**
|
|
15
|
+
* @notice Gets if price is configured, allowlist price of minting a token
|
|
16
|
+
* on project `projectId`, and currency symbol and address to be used as
|
|
17
|
+
* payment.
|
|
18
|
+
* @param projectId Project ID to get allowlist price information for
|
|
19
|
+
* @param coreContract Contract address of the core contract
|
|
20
|
+
* @return isConfigured true only if prices have been configured on this
|
|
21
|
+
* minter
|
|
22
|
+
* @return tokenPriceInWei current allowlist price of token on this minter
|
|
23
|
+
* @return currencySymbol currency symbol for purchases of project on this
|
|
24
|
+
* minter
|
|
25
|
+
* @return currencyAddress currency address for purchases of project on
|
|
26
|
+
* this minter
|
|
27
|
+
*/
|
|
28
|
+
function getAllowlistPriceInfo(
|
|
29
|
+
uint256 projectId,
|
|
30
|
+
address coreContract
|
|
31
|
+
)
|
|
32
|
+
external
|
|
33
|
+
view
|
|
34
|
+
returns (
|
|
35
|
+
bool isConfigured,
|
|
36
|
+
uint256 tokenPriceInWei,
|
|
37
|
+
string memory currencySymbol,
|
|
38
|
+
address currencyAddress
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @notice Returns the effective price for a given wallet address on
|
|
43
|
+
* project `projectId`. If the wallet is allowlisted, returns the
|
|
44
|
+
* allowlist price; otherwise returns the public price.
|
|
45
|
+
* @param projectId Project ID to get price information for
|
|
46
|
+
* @param coreContract Contract address of the core contract
|
|
47
|
+
* @param wallet Address to check the effective price for
|
|
48
|
+
* @return isConfigured true only if prices have been configured for the
|
|
49
|
+
* project
|
|
50
|
+
* @return tokenPriceInWei effective price per token for the given wallet
|
|
51
|
+
* @return currencySymbol currency symbol for purchases of project on this
|
|
52
|
+
* minter
|
|
53
|
+
* @return currencyAddress currency address for purchases of project on
|
|
54
|
+
* this minter
|
|
55
|
+
*/
|
|
56
|
+
function getPriceInfoForAddress(
|
|
57
|
+
uint256 projectId,
|
|
58
|
+
address coreContract,
|
|
59
|
+
address wallet
|
|
60
|
+
)
|
|
61
|
+
external
|
|
62
|
+
view
|
|
63
|
+
returns (
|
|
64
|
+
bool isConfigured,
|
|
65
|
+
uint256 tokenPriceInWei,
|
|
66
|
+
string memory currencySymbol,
|
|
67
|
+
address currencyAddress
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
// Created By: Art Blocks Inc.
|
|
3
|
+
|
|
4
|
+
pragma solidity ^0.8.0;
|
|
5
|
+
|
|
6
|
+
import {IERC165} from "@openzeppelin-5.0/contracts/interfaces/IERC165.sol";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @title Transfer hook interface for Art Blocks V3 Engine cores.
|
|
10
|
+
* @author Art Blocks Inc.
|
|
11
|
+
* @notice Invoked by a core after a token's ownership has been updated (mint
|
|
12
|
+
* or transfer). A reverting hook aborts the entire mint or transfer.
|
|
13
|
+
* Implementations MUST authenticate `msg.sender` as the expected core; the
|
|
14
|
+
* core passes `coreContract` for convenience when one hook serves many cores.
|
|
15
|
+
* Inheriting `AbstractTransferHook` is the recommended way to satisfy both
|
|
16
|
+
* that requirement and the ERC-165 requirement below.
|
|
17
|
+
* @dev A core will not accept a hook unless it ERC-165-advertises this
|
|
18
|
+
* interface. The ERC-165 interface ID is `0x6344b0e2`, which is
|
|
19
|
+
* `type(ITransferHook).interfaceId` — the selector of `onTokenTransfer`
|
|
20
|
+
* alone. Solidity excludes inherited interface functions (here, `IERC165`)
|
|
21
|
+
* from that XOR, so implementers hardcoding the value must use `0x6344b0e2`
|
|
22
|
+
* and not XOR in `IERC165`'s `0x01ffc9a7`.
|
|
23
|
+
*/
|
|
24
|
+
interface ITransferHook is IERC165 {
|
|
25
|
+
/**
|
|
26
|
+
* @notice Execution logic to be executed after a token's ownership updates.
|
|
27
|
+
* @dev Called after the ERC-721 ownership write. On mint, called after the
|
|
28
|
+
* token hash seed is assigned. Reverting aborts the mint or transfer.
|
|
29
|
+
* @dev The calling core blocks reentrant mints and transfers for the
|
|
30
|
+
* duration of this call, on every project of that core. Implementations
|
|
31
|
+
* must not attempt to mint or transfer on the calling core.
|
|
32
|
+
* @param coreContract The core contract that performed the ownership update.
|
|
33
|
+
* Also equal to `msg.sender` when called by a conforming core.
|
|
34
|
+
* @param tokenId The token whose ownership changed.
|
|
35
|
+
* @param from Previous owner. `address(0)` on mint.
|
|
36
|
+
* @param to New owner. `address(0)` on burn (cores do not currently burn).
|
|
37
|
+
* @param operator For transfers, the ERC-721 operator (`_msgSender()`).
|
|
38
|
+
* For mint, the `_by` address passed to `mint_Ecf` (the initiating user,
|
|
39
|
+
* not the minter contract).
|
|
40
|
+
*/
|
|
41
|
+
function onTokenTransfer(
|
|
42
|
+
address coreContract,
|
|
43
|
+
uint256 tokenId,
|
|
44
|
+
address from,
|
|
45
|
+
address to,
|
|
46
|
+
address operator
|
|
47
|
+
) external;
|
|
48
|
+
}
|
|
@@ -4,6 +4,7 @@ pragma solidity ^0.8.19;
|
|
|
4
4
|
import "../../interfaces/v0.8.x/IAdminACLV0.sol";
|
|
5
5
|
import "../../interfaces/v0.8.x/ICoreRegistryV1.sol";
|
|
6
6
|
import "../../interfaces/v0.8.x/IUniversalBytecodeStorageReader.sol";
|
|
7
|
+
import {IDependencyRegistryV0} from "../../interfaces/v0.8.x/IDependencyRegistryV0.sol";
|
|
7
8
|
import "@openzeppelin-4.7/contracts/utils/structs/EnumerableSet.sol";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -51,6 +52,17 @@ library DependencyRegistryStorageLib {
|
|
|
51
52
|
uint24 additionalRepositoryCount;
|
|
52
53
|
// count of scripts that make up the dependency, if the dependency is available on-chain
|
|
53
54
|
uint24 scriptCount;
|
|
55
|
+
// @dev fields below are appended for the generator's rendering directives, and are
|
|
56
|
+
// safe to append because Dependency is only ever used as a mapping value.
|
|
57
|
+
// canvas tag requirement for the dependency
|
|
58
|
+
IDependencyRegistryV0.CanvasTagType canvasTagType;
|
|
59
|
+
// how a project's script must be injected into generated HTML
|
|
60
|
+
IDependencyRegistryV0.ProjectScriptTagType projectScriptTagType;
|
|
61
|
+
// whether the dependency's own script is an ES module, and therefore must be exposed to
|
|
62
|
+
// project scripts via an import map rather than loaded with a plain `<script src>` tag
|
|
63
|
+
bool loadAsModule;
|
|
64
|
+
// `type` attribute used when projectScriptTagType is SpecialType; empty otherwise
|
|
65
|
+
string projectScriptSpecialType;
|
|
54
66
|
}
|
|
55
67
|
|
|
56
68
|
/**
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
// Created By: Art Blocks Inc.
|
|
3
|
+
|
|
4
|
+
pragma solidity ^0.8.0;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @title IUniversalResolver
|
|
8
|
+
* @notice Minimal ENS Universal Resolver interface for reverse resolution
|
|
9
|
+
* @dev See https://docs.ens.domains/resolvers/universal#reverse-resolution
|
|
10
|
+
*/
|
|
11
|
+
interface IUniversalResolver {
|
|
12
|
+
function reverse(
|
|
13
|
+
bytes calldata lookupAddress,
|
|
14
|
+
uint256 coinType
|
|
15
|
+
)
|
|
16
|
+
external
|
|
17
|
+
view
|
|
18
|
+
returns (
|
|
19
|
+
string memory primary,
|
|
20
|
+
address resolver,
|
|
21
|
+
address reverseResolver
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @title ENS Library
|
|
27
|
+
* @notice This library provides helper functions for ENS name resolution
|
|
28
|
+
* using the ENS Universal Resolver following ENS best practices.
|
|
29
|
+
* @author Art Blocks Inc.
|
|
30
|
+
* @dev This library uses the Universal Resolver's reverse() function which
|
|
31
|
+
* performs both reverse lookup AND forward verification in a single call.
|
|
32
|
+
* For an address to have a valid ENS name returned by this library, the owner
|
|
33
|
+
* must set up a reverse record (reverse lookup) by calling setName() on the
|
|
34
|
+
* reverse registrar. This is OPTIONAL and must be done by the address owner
|
|
35
|
+
* on-chain. If not set, the library returns an empty string.
|
|
36
|
+
*
|
|
37
|
+
* References:
|
|
38
|
+
* - Universal Resolver: https://docs.ens.domains/resolvers/universal
|
|
39
|
+
* - Reverse Resolution: https://docs.ens.domains/resolvers/universal#reverse-resolution
|
|
40
|
+
*/
|
|
41
|
+
library ENSLib {
|
|
42
|
+
/// @notice ENS Universal Resolver deployment address (same on mainnet and testnets)
|
|
43
|
+
/// @dev This is a proxy contract owned by ENS DAO
|
|
44
|
+
/// See: https://docs.ens.domains/resolvers/universal
|
|
45
|
+
address internal constant UNIVERSAL_RESOLVER_ADDRESS =
|
|
46
|
+
0xeEeEEEeE14D718C2B47D9923Deab1335E144EeEe;
|
|
47
|
+
|
|
48
|
+
/// @notice Coin type for Ethereum (used in reverse resolution)
|
|
49
|
+
/// @dev See ENSIP-9 for multichain address resolution
|
|
50
|
+
uint256 internal constant COIN_TYPE_ETH = 60;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @notice Resolves an ENS name for a given address using the Universal Resolver.
|
|
54
|
+
* @dev Uses the ENS Universal Resolver's reverse() function which internally:
|
|
55
|
+
* 1. Performs reverse lookup to get the name claimed by the address
|
|
56
|
+
* 2. Verifies forward resolution to ensure the name actually resolves back to the address
|
|
57
|
+
*
|
|
58
|
+
* This provides protection against spoofing in a single call.
|
|
59
|
+
*
|
|
60
|
+
* NOTE: For an address to have a valid ENS name returned by this function, the owner must:
|
|
61
|
+
* - Set up a reverse record (reverse lookup) by calling setName() on the reverse registrar
|
|
62
|
+
* - This is OPTIONAL and must be done by the address owner on-chain
|
|
63
|
+
* - If not set, this function returns an empty string
|
|
64
|
+
*
|
|
65
|
+
* @param ownerAddress The address to resolve the ENS name for.
|
|
66
|
+
* @return ensName The ENS name for the address, or empty string if not found/invalid.
|
|
67
|
+
*/
|
|
68
|
+
function getEnsName(
|
|
69
|
+
address ownerAddress
|
|
70
|
+
) internal view returns (string memory) {
|
|
71
|
+
// Call the Universal Resolver's reverse function
|
|
72
|
+
// The reverse function internally performs both reverse lookup and forward verification
|
|
73
|
+
try
|
|
74
|
+
IUniversalResolver(UNIVERSAL_RESOLVER_ADDRESS).reverse(
|
|
75
|
+
abi.encodePacked(ownerAddress),
|
|
76
|
+
COIN_TYPE_ETH
|
|
77
|
+
)
|
|
78
|
+
returns (string memory primary, address, address) {
|
|
79
|
+
return primary;
|
|
80
|
+
} catch {
|
|
81
|
+
// If any error occurs (no reverse record, forward mismatch, etc.), return empty string
|
|
82
|
+
return "";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
// Created By: Art Blocks Inc.
|
|
3
|
+
|
|
4
|
+
pragma solidity ^0.8.0;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @title EnumerableSetUint16
|
|
8
|
+
* @author Art Blocks Inc.
|
|
9
|
+
* @notice Gas-optimized enumerable set library for uint16 values with assembly optimizations.
|
|
10
|
+
* @dev This library efficiently packs uint16 values into shared uint256 storage slots,
|
|
11
|
+
* storing up to 16 uint16 values per slot. This significantly reduces gas costs compared
|
|
12
|
+
* to OpenZeppelin's EnumerableSet.UintSet which stores each value in its own slot.
|
|
13
|
+
*
|
|
14
|
+
* The library maintains:
|
|
15
|
+
* - A packed array where each uint256 slot contains up to 16 uint16 values (stored as value+1)
|
|
16
|
+
* - An index mapping for O(1) lookups (maps value -> packed position)
|
|
17
|
+
*
|
|
18
|
+
* Values are stored as (value + 1) to distinguish empty slots (0) from actual values.
|
|
19
|
+
* This means the maximum storable value is 65534 (not 65535).
|
|
20
|
+
*
|
|
21
|
+
* Count is derived on-demand by examining the last slot to find the highest populated position.
|
|
22
|
+
* This eliminates an SSTORE operation on every add/remove, significantly reducing gas costs.
|
|
23
|
+
*
|
|
24
|
+
* Assembly is used extensively for:
|
|
25
|
+
* - Efficient bit manipulation operations
|
|
26
|
+
* - Optimized storage access patterns
|
|
27
|
+
* - Reduced memory operations
|
|
28
|
+
* - Binary search for finding highest offset
|
|
29
|
+
*
|
|
30
|
+
* Interface is compatible with OpenZeppelin's EnumerableSet.UintSet, but specifically
|
|
31
|
+
* for uint16 values.
|
|
32
|
+
*/
|
|
33
|
+
library EnumerableSetUint16 {
|
|
34
|
+
/**
|
|
35
|
+
* @dev Structure to hold the set data.
|
|
36
|
+
*
|
|
37
|
+
* Storage layout:
|
|
38
|
+
* - _values: Array of uint256 where each element packs 16 uint16 values (stored as value+1)
|
|
39
|
+
* - _indexesPacked: Packed mapping where each uint256 contains 16 positions (16 bits each)
|
|
40
|
+
*
|
|
41
|
+
* Position encoding: 16 bits per position = (slotIndex << 4) | offsetInSlot + 1
|
|
42
|
+
* - Bits 0-11: slotIndex (supports up to 4096 slots = 65,536 values)
|
|
43
|
+
* - Bits 12-15: offsetInSlot (0-15)
|
|
44
|
+
* - +1 makes it 1-indexed so 0 means "not present"
|
|
45
|
+
*
|
|
46
|
+
* Packing in _indexesPacked:
|
|
47
|
+
* - Key: value >> 4 (bucket index - groups of 16 values)
|
|
48
|
+
* - Value: uint256 containing 16 packed 16-bit positions
|
|
49
|
+
* - Position in bucket: value & 0xF (determines which 16-bit segment)
|
|
50
|
+
*/
|
|
51
|
+
struct Uint16Set {
|
|
52
|
+
// Array of packed uint256 slots, each containing up to 16 uint16 values (as value+1)
|
|
53
|
+
uint256[] _values;
|
|
54
|
+
// Packed mapping: each uint256 holds 16 positions (16 bits each) for 16 consecutive values
|
|
55
|
+
// Bucket (value>>4) maps to uint256 with 16 positions at (value&0xF)*16 bits
|
|
56
|
+
mapping(uint16 => uint256) _indexesPacked;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @dev Add a value to a set. O(1).
|
|
61
|
+
* Returns true if the value was added to the set, that is if it was not
|
|
62
|
+
* already present.
|
|
63
|
+
* @param value The uint16 value to add. Must be < 65535 (max uint16 - 1).
|
|
64
|
+
*/
|
|
65
|
+
function add(Uint16Set storage set, uint16 value) internal returns (bool) {
|
|
66
|
+
require(
|
|
67
|
+
value < type(uint16).max,
|
|
68
|
+
"EnumerableSetUint16: value too large"
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
if (contains(set, value)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
uint256 count = length(set);
|
|
76
|
+
uint256 slotIndex;
|
|
77
|
+
uint256 offsetInSlot;
|
|
78
|
+
|
|
79
|
+
assembly {
|
|
80
|
+
// slotIndex = count >> 4 (count / 16)
|
|
81
|
+
slotIndex := shr(4, count)
|
|
82
|
+
// offsetInSlot = count & 0xF (count % 16)
|
|
83
|
+
offsetInSlot := and(count, 0xF)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Ensure the slot exists
|
|
87
|
+
if (slotIndex >= set._values.length) {
|
|
88
|
+
set._values.push(0);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Pack the value+1 into the slot using assembly
|
|
92
|
+
assembly {
|
|
93
|
+
// Calculate storage slot for _values[slotIndex]
|
|
94
|
+
mstore(0x00, set.slot)
|
|
95
|
+
let valuesSlot := keccak256(0x00, 0x20)
|
|
96
|
+
let targetSlot := add(valuesSlot, slotIndex)
|
|
97
|
+
|
|
98
|
+
// Load current slot value
|
|
99
|
+
let slot := sload(targetSlot)
|
|
100
|
+
|
|
101
|
+
// Calculate shift amount: offsetInSlot * 16
|
|
102
|
+
let shiftAmount := shl(4, offsetInSlot)
|
|
103
|
+
|
|
104
|
+
// Create mask: 0xFFFF << shiftAmount
|
|
105
|
+
let mask := shl(shiftAmount, 0xFFFF)
|
|
106
|
+
|
|
107
|
+
// Clear the target position and insert value+1
|
|
108
|
+
// slot = (slot & ~mask) | ((value + 1) << shiftAmount)
|
|
109
|
+
slot := or(and(slot, not(mask)), shl(shiftAmount, add(value, 1)))
|
|
110
|
+
|
|
111
|
+
// Store back
|
|
112
|
+
sstore(targetSlot, slot)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Store the position (1-indexed) in packed format
|
|
116
|
+
// Position encodes: ((slotIndex << 4) | offsetInSlot) + 1
|
|
117
|
+
uint256 position;
|
|
118
|
+
assembly {
|
|
119
|
+
position := add(or(shl(4, slotIndex), offsetInSlot), 1)
|
|
120
|
+
}
|
|
121
|
+
_setPackedIndex(set._indexesPacked, value, position);
|
|
122
|
+
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @dev Removes a value from a set. O(1).
|
|
128
|
+
* Returns true if the value was removed from the set, that is if it was
|
|
129
|
+
* present.
|
|
130
|
+
*/
|
|
131
|
+
function remove(
|
|
132
|
+
Uint16Set storage set,
|
|
133
|
+
uint16 value
|
|
134
|
+
) internal returns (bool) {
|
|
135
|
+
uint256 valueIndex = _getPackedIndex(set._indexesPacked, value);
|
|
136
|
+
|
|
137
|
+
if (valueIndex == 0) {
|
|
138
|
+
return false; // Value not in set
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
uint256 lastIndex = length(set) - 1;
|
|
142
|
+
uint256 valuePosition = valueIndex - 1;
|
|
143
|
+
|
|
144
|
+
// Calculate last slot position (used in both branches)
|
|
145
|
+
uint256 lastSlotIndex;
|
|
146
|
+
uint256 lastOffsetInSlot;
|
|
147
|
+
assembly {
|
|
148
|
+
lastSlotIndex := shr(4, lastIndex)
|
|
149
|
+
lastOffsetInSlot := and(lastIndex, 0xF)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (lastIndex != valuePosition) {
|
|
153
|
+
uint256 lastValuePlusOne;
|
|
154
|
+
|
|
155
|
+
assembly {
|
|
156
|
+
// Load last value
|
|
157
|
+
mstore(0x00, set.slot)
|
|
158
|
+
let valuesSlot := keccak256(0x00, 0x20)
|
|
159
|
+
let lastSlot := sload(add(valuesSlot, lastSlotIndex))
|
|
160
|
+
|
|
161
|
+
// Extract last value: (lastSlot >> (lastOffsetInSlot * 16)) & 0xFFFF
|
|
162
|
+
lastValuePlusOne := and(
|
|
163
|
+
shr(shl(4, lastOffsetInSlot), lastSlot),
|
|
164
|
+
0xFFFF
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Move last value to the removed value's position
|
|
169
|
+
uint256 valueSlotIndex;
|
|
170
|
+
uint256 valueOffsetInSlot;
|
|
171
|
+
|
|
172
|
+
assembly {
|
|
173
|
+
valueSlotIndex := shr(4, valuePosition)
|
|
174
|
+
valueOffsetInSlot := and(valuePosition, 0xF)
|
|
175
|
+
|
|
176
|
+
// Calculate storage slot
|
|
177
|
+
mstore(0x00, set.slot)
|
|
178
|
+
let valuesSlot := keccak256(0x00, 0x20)
|
|
179
|
+
let targetSlot := add(valuesSlot, valueSlotIndex)
|
|
180
|
+
|
|
181
|
+
// Load current slot
|
|
182
|
+
let slot := sload(targetSlot)
|
|
183
|
+
|
|
184
|
+
// Calculate shift and mask
|
|
185
|
+
let shiftAmount := shl(4, valueOffsetInSlot)
|
|
186
|
+
let mask := shl(shiftAmount, 0xFFFF)
|
|
187
|
+
|
|
188
|
+
// Update slot: (slot & ~mask) | (lastValuePlusOne << shiftAmount)
|
|
189
|
+
slot := or(
|
|
190
|
+
and(slot, not(mask)),
|
|
191
|
+
shl(shiftAmount, lastValuePlusOne)
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
// Store back
|
|
195
|
+
sstore(targetSlot, slot)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Update the moved value's index
|
|
199
|
+
_setPackedIndex(
|
|
200
|
+
set._indexesPacked,
|
|
201
|
+
uint16(lastValuePlusOne - 1),
|
|
202
|
+
valueIndex
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Clear the last position
|
|
207
|
+
bool shouldPop;
|
|
208
|
+
|
|
209
|
+
assembly {
|
|
210
|
+
// Calculate storage slot
|
|
211
|
+
mstore(0x00, set.slot)
|
|
212
|
+
let valuesSlot := keccak256(0x00, 0x20)
|
|
213
|
+
let targetSlot := add(valuesSlot, lastSlotIndex)
|
|
214
|
+
|
|
215
|
+
// Load current slot
|
|
216
|
+
let slot := sload(targetSlot)
|
|
217
|
+
|
|
218
|
+
// Clear the position: slot & ~(0xFFFF << (lastOffsetInSlot * 16))
|
|
219
|
+
let shiftAmount := shl(4, lastOffsetInSlot)
|
|
220
|
+
let mask := shl(shiftAmount, 0xFFFF)
|
|
221
|
+
slot := and(slot, not(mask))
|
|
222
|
+
|
|
223
|
+
// Store back
|
|
224
|
+
sstore(targetSlot, slot)
|
|
225
|
+
|
|
226
|
+
// Check if we should pop: slot is zero
|
|
227
|
+
shouldPop := iszero(slot)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Pop the array if the last slot is now empty
|
|
231
|
+
if (shouldPop && lastSlotIndex == set._values.length - 1) {
|
|
232
|
+
set._values.pop();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Delete the removed value's packed index
|
|
236
|
+
_setPackedIndex(set._indexesPacked, value, 0);
|
|
237
|
+
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @dev Returns true if the value is in the set. O(1).
|
|
243
|
+
*/
|
|
244
|
+
function contains(
|
|
245
|
+
Uint16Set storage set,
|
|
246
|
+
uint16 value
|
|
247
|
+
) internal view returns (bool) {
|
|
248
|
+
return _getPackedIndex(set._indexesPacked, value) != 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @dev Returns the number of values in the set. O(1) amortized.
|
|
253
|
+
* Uses binary search to find the highest populated position in the last slot.
|
|
254
|
+
*/
|
|
255
|
+
function length(
|
|
256
|
+
Uint16Set storage set
|
|
257
|
+
) internal view returns (uint256 result) {
|
|
258
|
+
uint256 valuesLength = set._values.length;
|
|
259
|
+
|
|
260
|
+
if (valuesLength == 0) {
|
|
261
|
+
return 0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
uint256 lastSlot = set._values[valuesLength - 1];
|
|
265
|
+
|
|
266
|
+
// Use binary search to find highest non-zero 16-bit segment
|
|
267
|
+
uint256 highestOffset;
|
|
268
|
+
assembly {
|
|
269
|
+
let slot := lastSlot
|
|
270
|
+
highestOffset := 0
|
|
271
|
+
|
|
272
|
+
// Binary search for highest non-zero segment
|
|
273
|
+
// Check upper half (bits 128-255)
|
|
274
|
+
let upper := shr(128, slot)
|
|
275
|
+
if gt(upper, 0) {
|
|
276
|
+
highestOffset := 8
|
|
277
|
+
slot := upper
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Check upper 4 positions of current 8-position range
|
|
281
|
+
upper := shr(64, slot)
|
|
282
|
+
if gt(upper, 0) {
|
|
283
|
+
highestOffset := add(highestOffset, 4)
|
|
284
|
+
slot := upper
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Check upper 2 positions of current 4-position range
|
|
288
|
+
upper := shr(32, slot)
|
|
289
|
+
if gt(upper, 0) {
|
|
290
|
+
highestOffset := add(highestOffset, 2)
|
|
291
|
+
slot := upper
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Check upper 1 position of current 2-position range
|
|
295
|
+
upper := shr(16, slot)
|
|
296
|
+
if gt(upper, 0) {
|
|
297
|
+
highestOffset := add(highestOffset, 1)
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Calculate total length: ((valuesLength - 1) * 16) + highestOffset + 1
|
|
302
|
+
return ((valuesLength - 1) << 4) + highestOffset + 1;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* @dev Returns the value stored at position `index` in the set. O(1).
|
|
307
|
+
*
|
|
308
|
+
* Note that there are no guarantees on the ordering of values inside the
|
|
309
|
+
* array, and it may change when more values are added or removed.
|
|
310
|
+
*
|
|
311
|
+
* Requirements:
|
|
312
|
+
* - `index` must be strictly less than {length}.
|
|
313
|
+
*/
|
|
314
|
+
function at(
|
|
315
|
+
Uint16Set storage set,
|
|
316
|
+
uint256 index
|
|
317
|
+
) internal view returns (uint16) {
|
|
318
|
+
require(
|
|
319
|
+
index < length(set),
|
|
320
|
+
"EnumerableSetUint16: index out of bounds"
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
uint256 result;
|
|
324
|
+
assembly {
|
|
325
|
+
// slotIndex = index >> 4
|
|
326
|
+
let slotIndex := shr(4, index)
|
|
327
|
+
// offsetInSlot = index & 0xF
|
|
328
|
+
let offsetInSlot := and(index, 0xF)
|
|
329
|
+
|
|
330
|
+
// Load slot value
|
|
331
|
+
mstore(0x00, set.slot)
|
|
332
|
+
let valuesSlot := keccak256(0x00, 0x20)
|
|
333
|
+
let slot := sload(add(valuesSlot, slotIndex))
|
|
334
|
+
|
|
335
|
+
// Extract value: (slot >> (offsetInSlot * 16)) & 0xFFFF - 1
|
|
336
|
+
result := sub(and(shr(shl(4, offsetInSlot), slot), 0xFFFF), 1)
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return uint16(result);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @dev Returns an array containing all values in the set. O(N).
|
|
344
|
+
*
|
|
345
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive.
|
|
346
|
+
* This is designed to mostly be used by view accessors that are queried without any gas fees.
|
|
347
|
+
* Developers should keep in mind that this function has an unbounded cost, and using it as part
|
|
348
|
+
* of a state-changing function may render the function uncallable if the set grows to a point
|
|
349
|
+
* where copying to memory consumes too much gas to fit in a block.
|
|
350
|
+
*/
|
|
351
|
+
function values(
|
|
352
|
+
Uint16Set storage set
|
|
353
|
+
) internal view returns (uint256[] memory) {
|
|
354
|
+
uint256 count = length(set);
|
|
355
|
+
uint256[] memory result = new uint256[](count);
|
|
356
|
+
|
|
357
|
+
for (uint256 i = 0; i < count; i++) {
|
|
358
|
+
result[i] = at(set, i);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return result;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* @dev Internal helper to get a packed index for a value.
|
|
366
|
+
* @param packed The packed index mapping.
|
|
367
|
+
* @param value The uint16 value to look up.
|
|
368
|
+
* @return position The position (1-indexed, 0 means not present).
|
|
369
|
+
*/
|
|
370
|
+
function _getPackedIndex(
|
|
371
|
+
mapping(uint16 => uint256) storage packed,
|
|
372
|
+
uint16 value
|
|
373
|
+
) private view returns (uint256 position) {
|
|
374
|
+
assembly {
|
|
375
|
+
// bucketIndex = value >> 4
|
|
376
|
+
let bucketIndex := shr(4, value)
|
|
377
|
+
// posInBucket = value & 0xF
|
|
378
|
+
let posInBucket := and(value, 0xF)
|
|
379
|
+
|
|
380
|
+
// Calculate storage slot for packed[bucketIndex]
|
|
381
|
+
mstore(0x00, bucketIndex)
|
|
382
|
+
mstore(0x20, packed.slot)
|
|
383
|
+
let bucketSlot := keccak256(0x00, 0x40)
|
|
384
|
+
|
|
385
|
+
// Load bucket
|
|
386
|
+
let bucket := sload(bucketSlot)
|
|
387
|
+
|
|
388
|
+
// Extract position: (bucket >> (posInBucket * 16)) & 0xFFFF
|
|
389
|
+
position := and(shr(shl(4, posInBucket), bucket), 0xFFFF)
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* @dev Internal helper to set a packed index for a value.
|
|
395
|
+
* @param packed The packed index mapping.
|
|
396
|
+
* @param value The uint16 value to set.
|
|
397
|
+
* @param position The position to store (1-indexed, 0 means remove).
|
|
398
|
+
*/
|
|
399
|
+
function _setPackedIndex(
|
|
400
|
+
mapping(uint16 => uint256) storage packed,
|
|
401
|
+
uint16 value,
|
|
402
|
+
uint256 position
|
|
403
|
+
) private {
|
|
404
|
+
assembly {
|
|
405
|
+
// bucketIndex = value >> 4
|
|
406
|
+
let bucketIndex := shr(4, value)
|
|
407
|
+
// posInBucket = value & 0xF
|
|
408
|
+
let posInBucket := and(value, 0xF)
|
|
409
|
+
|
|
410
|
+
// Calculate storage slot for packed[bucketIndex]
|
|
411
|
+
mstore(0x00, bucketIndex)
|
|
412
|
+
mstore(0x20, packed.slot)
|
|
413
|
+
let bucketSlot := keccak256(0x00, 0x40)
|
|
414
|
+
|
|
415
|
+
// Load current bucket
|
|
416
|
+
let bucket := sload(bucketSlot)
|
|
417
|
+
|
|
418
|
+
// Calculate shift and mask
|
|
419
|
+
let shiftAmount := shl(4, posInBucket)
|
|
420
|
+
let mask := shl(shiftAmount, 0xFFFF)
|
|
421
|
+
|
|
422
|
+
// Update bucket: (bucket & ~mask) | (position << shiftAmount)
|
|
423
|
+
bucket := or(and(bucket, not(mask)), shl(shiftAmount, position))
|
|
424
|
+
|
|
425
|
+
// Store back
|
|
426
|
+
sstore(bucketSlot, bucket)
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|