@artblocks/contracts 1.1.0 → 1.2.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 +75 -7
- package/artifacts/contracts/AdminACLV0.sol/AdminACLV0.json +2 -2
- package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
- package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +273 -155
- package/artifacts/contracts/archive/GenArt721CoreV3.sol/GenArt721CoreV3.json +2047 -0
- package/artifacts/contracts/archive/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +2021 -0
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterBase_v0_1_1.sol/MinterBase.json +1 -1
- 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/{minter-suite/Minters → archive/minter-suite/Minters/MinterDAExp}/MinterDAExpV4.sol/MinterDAExpV4.json +3 -3
- 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/{minter-suite/Minters → archive/minter-suite/Minters/MinterDAExpSettlement}/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +3 -3
- 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/{minter-suite/Minters → archive/minter-suite/Minters/MinterDALin}/MinterDALinV4.sol/MinterDALinV4.json +3 -3
- 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/{minter-suite/Minters → archive/minter-suite/Minters/MinterHolder}/MinterHolderV4.sol/MinterHolderV4.json +3 -3
- 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/{minter-suite/Minters → archive/minter-suite/Minters/MinterMerkle}/MinterMerkleV5.sol/MinterMerkleV5.json +3 -3
- package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterPolyptych}/MinterPolyptychV0.sol/IGenArt721CoreContractV3WithRandomizer.json +31 -63
- package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterPolyptych}/MinterPolyptychV0.sol/MinterPolyptychV0.json +3 -3
- package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterSEA}/MinterSEAV0.sol/MinterSEAV0.json +3 -3
- 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/{minter-suite/Minters → archive/minter-suite/Minters/MinterSetPrice}/MinterSetPriceV4.sol/MinterSetPriceV4.json +3 -3
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V0.sol/MinterSetPriceERC20V0.json +65 -2
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V1.sol/MinterSetPriceERC20V1.json +65 -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 +807 -0
- package/artifacts/contracts/engine/V2/GenArt721MinterBurner_PBAB.sol/GenArt721MinterBurner_PBAB.json +65 -2
- package/artifacts/contracts/engine/V2/GenArt721Minter_PBAB.sol/GenArt721Minter_PBAB.json +65 -2
- package/artifacts/contracts/engine/V3/EngineFactoryV0.sol/EngineFactoryV0.json +606 -0
- package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +567 -206
- package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +787 -224
- package/artifacts/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol/GenArt721CoreV3_Engine_Flex_PROOF.json +38 -8
- 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 +38 -8
- package/artifacts/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.json +36 -68
- package/artifacts/contracts/interfaces/v0.8.x/IAdminACLV0_Extended.sol/IAdminACLV0_Extended.json +140 -0
- package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReaderV2.sol/IBytecodeStorageReaderV2.json +130 -0
- package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +58 -45
- package/artifacts/contracts/interfaces/v0.8.x/IEngineFactoryV0.sol/IEngineFactoryV0.json +283 -0
- package/artifacts/contracts/interfaces/v0.8.x/IFilteredMinterDAExpSettlementV0.sol/IFilteredMinterDAExpSettlementV0.json +12 -12
- package/artifacts/contracts/interfaces/v0.8.x/IFilteredMinterDAExpSettlementV1.sol/IFilteredMinterDAExpSettlementV1.json +12 -12
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3.sol/IGenArt721CoreContractV3.json +30 -62
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol/IGenArt721CoreContractV3_Base.json +30 -62
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol/IGenArt721CoreContractV3_Engine.json +170 -104
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol/IGenArt721CoreContractV3_Engine_Flex.json +170 -104
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.sol/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.json +1028 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_PreV3p2.sol/IGenArt721CoreContractV3_Engine_PreV3p2.json +741 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_ProjectFinance.sol/IGenArt721CoreContractV3_ProjectFinance.json +87 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721Minter_PBAB.sol/IGenArt721Minter_PBAB.json +279 -0
- package/artifacts/contracts/interfaces/v0.8.x/IPseudorandomAtomic.sol/IPseudorandomAtomic.json +1 -1
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAExpSettlementV0.sol/ISharedMinterDAExpSettlementV0.json +18 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterRAMV0.sol/ISharedMinterRAMV0.json +62 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterRequired.sol/ISharedMinterRequired.json +37 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterSEAV0.sol/ISharedMinterSEAV0.json +1 -1
- package/artifacts/contracts/interfaces/v0.8.x/ISplitAtomicFactoryV0.sol/ISplitAtomicFactoryV0.json +170 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISplitAtomicV0.sol/ISplitAtomicV0.json +126 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISplitProviderV0.sol/ISplitProviderV0.json +98 -0
- package/artifacts/contracts/interfaces/v0.8.x/integration-refs/splits-0x-v2/ISplitFactoryV2.sol/ISplitFactoryV2.json +123 -0
- package/artifacts/contracts/libs/integration-refs/delegation-registry/DelegationRegistry.sol/DelegationRegistry.json +2 -2
- package/artifacts/contracts/libs/integration-refs/gnosis-safe/GnosisSafeMock.sol/GnosisSafeMock.json +2 -2
- package/artifacts/contracts/libs/integration-refs/gnosis-safe/GnosisSafeProxyFactoryMock.sol/GnosisSafeProxyFactoryMock.json +2 -2
- package/artifacts/contracts/libs/integration-refs/gnosis-safe/MultiSendMock.sol/MultiSendMock.json +2 -2
- package/artifacts/contracts/libs/integration-refs/weth9/weth9.sol/WETH9_.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/ABHelpers.sol/ABHelpers.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/AuthLib.sol/AuthLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/BitMap.sol/BitMaps256.json +10 -0
- package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV0.sol/BytecodeStorage.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV1.sol/BytecodeStorageReader.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV1.sol/BytecodeStorageWriter.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV2.sol/BytecodeStorageReader.json +214 -0
- package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV2.sol/BytecodeStorageWriter.json +10 -0
- package/artifacts/contracts/libs/v0.8.x/Bytes32Strings.sol/Bytes32Strings.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol/DependencyRegistryStorageLib.json +10 -0
- package/artifacts/contracts/libs/v0.8.x/ERC721_PackedHashSeed.sol/ERC721_PackedHashSeed.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/ERC721_PackedHashSeedV1.sol/ERC721_PackedHashSeedV1.json +444 -0
- package/artifacts/contracts/libs/v0.8.x/PackedBools.sol/PackedBools.json +10 -0
- package/artifacts/contracts/libs/v0.8.x/SSTORE2.sol/SSTORE2.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/V3FlexLib.sol/V3FlexLib.json +208 -0
- package/artifacts/contracts/libs/v0.8.x/minter-libs/DAExpLib.sol/DAExpLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/DALib.sol/DALib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/DALinLib.sol/DALinLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/GenericMinterEventsLib.sol/GenericMinterEventsLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol/MaxInvocationsLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/MerkleLib.sol/MerkleLib.json +2 -2
- 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 +398 -0
- package/artifacts/contracts/libs/v0.8.x/minter-libs/SEALib.sol/SEALib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/SetPriceLib.sol/SetPriceLib.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/libs/v0.8.x/minter-libs/TokenHolderLib.sol/TokenHolderLib.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/MinterRAMV0.sol/MinterRAMV0.json +1374 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSEAV1.sol/MinterSEAV1.json +7 -7
- 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/MinterSetPricePolyptychERC20V5.sol/MinterSetPricePolyptychERC20V5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol/MinterSetPricePolyptychV5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV5.sol/MinterSetPriceV5.json +2 -2
- package/artifacts/contracts/minter-suite/Minters/one-off/MinterSetPriceV5_SingleCore.sol/MinterSetPriceV5_SingleCore.json +417 -0
- package/artifacts/contracts/mock/BytecodeV2LibCallsMock.sol/BytecodeV2LibCallsMock.json +154 -0
- package/artifacts/contracts/mock/BytecodeV2TextCR_DMock.sol/BytecodeV2TextCR_DMock.json +428 -0
- package/artifacts/contracts/mock/DummySharedMinter.sol/DummySharedMinter.json +2 -2
- package/artifacts/contracts/mock/ERC20Mock.sol/ERC20Mock.json +2 -2
- package/artifacts/contracts/mock/ForceSendMock.sol/ForceSendMock.json +24 -0
- package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +2 -2
- package/artifacts/contracts/mock/Mock0xSplitsV2PullFactory.sol/Mock0xSplitsV2PullFactory.json +149 -0
- package/artifacts/contracts/mock/Mock0xSplitsV2Splitter.sol/Mock0xSplitsV2Splitter.json +99 -0
- package/artifacts/contracts/mock/MockAdminACLV0.sol/MockAdminACLV0Events.json +20 -2
- package/artifacts/contracts/mock/MockAdminACLV0_PROHIBITION.sol/MockAdminACLV0Events_PROHIBITION.json +20 -2
- package/artifacts/contracts/mock/RandomizerV2_NoAssignMock.sol/RandomizerV2_NoAssignMock.json +2 -2
- package/artifacts/contracts/mock/ReentrancyGenArt721MinterMock.sol/ReentrancyGenArt721MinterMock.json +100 -0
- package/artifacts/contracts/mock/ReentrancyHolderMock.sol/ReentrancyHolderMock.json +2 -2
- package/artifacts/contracts/mock/ReentrancyHolderMockShared.sol/ReentrancyHolderMockShared.json +2 -2
- package/artifacts/contracts/mock/ReentrancyMerkleMock.sol/ReentrancyMerkleMock.json +2 -2
- package/artifacts/contracts/mock/ReentrancyMerkleMockShared.sol/ReentrancyMerkleMockShared.json +2 -2
- package/artifacts/contracts/mock/ReentrancyMock.sol/ReentrancyMock.json +2 -2
- package/artifacts/contracts/mock/ReentrancyMockShared.sol/ReentrancyMockShared.json +2 -2
- package/artifacts/contracts/mock/ReentrancySEAMock.sol/ReentrancySEAAutoBidderMock.json +2 -2
- package/artifacts/contracts/mock/ReentrancySEAMockShared.sol/ReentrancySEAAutoBidderMockShared.json +2 -2
- package/artifacts/contracts/mock/ReentrancySplitterMocks.sol/ReentrancySplitterDrainETHMock.json +54 -0
- package/artifacts/contracts/mock/ReentrancySplitterMocks.sol/ReentrancySplitterSendETHMock.json +54 -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/primitive/PseudorandomAtomicBasic.sol/PseudorandomAtomic.json +2 -2
- package/artifacts/contracts/randomizer/shared/SharedRandomizerV0.sol/SharedRandomizerV0.json +2 -2
- package/artifacts/contracts/split/SplitAtomicFactoryV0.sol/SplitAtomicFactoryV0.json +203 -0
- package/artifacts/contracts/split/SplitAtomicV0.sol/SplitAtomicV0.json +168 -0
- package/artifacts/contracts/split/split-provider/SplitProviderV0.sol/SplitProviderV0.json +141 -0
- package/contracts/AdminACLV0.sol +6 -2
- package/contracts/AdminACLV1.sol +2 -2
- package/contracts/DependencyRegistryV0.sol +687 -408
- package/contracts/{GenArt721CoreV3.sol → archive/GenArt721CoreV3.sol} +56 -20
- package/contracts/{explorations → archive}/GenArt721CoreV3_Explorations.sol +49 -13
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterBase_v0_1_1.sol +4 -4
- package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterDAExp}/MinterDAExpV4.sol +4 -4
- package/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol +4 -4
- package/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV1.sol +5 -5
- package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterDAExpSettlement}/MinterDAExpSettlementV2.sol +8 -8
- package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterDALin}/MinterDALinV4.sol +4 -4
- package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterHolder}/MinterHolderV4.sol +5 -5
- package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterMerkle}/MinterMerkleV5.sol +5 -5
- package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterPolyptych}/MinterPolyptychV0.sol +7 -7
- package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterSEA}/MinterSEAV0.sol +13 -13
- package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterSetPrice}/MinterSetPriceV4.sol +4 -4
- package/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V0.sol +82 -10
- package/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V1.sol +82 -10
- package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterSetPriceERC20}/MinterSetPriceERC20V4.sol +88 -21
- package/contracts/engine/V2/GenArt721MinterBurner_PBAB.sol +81 -22
- package/contracts/engine/V2/GenArt721Minter_PBAB.sol +80 -22
- package/contracts/engine/V3/EngineFactoryV0.sol +419 -0
- package/contracts/engine/V3/GenArt721CoreV3_Engine.sol +894 -488
- package/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol +1054 -650
- package/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol +3 -3
- package/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol +1 -1
- package/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol +2 -2
- package/contracts/interfaces/v0.8.x/IAdminACLV0_Extended.sol +20 -0
- package/contracts/interfaces/v0.8.x/IBytecodeStorageReaderV2.sol +23 -0
- package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +47 -45
- package/contracts/interfaces/v0.8.x/IEngineFactoryV0.sol +124 -0
- package/contracts/interfaces/v0.8.x/IFilteredMinterDAExpSettlementV0.sol +1 -3
- package/contracts/interfaces/v0.8.x/IFilteredMinterDAExpSettlementV1.sol +1 -3
- package/contracts/interfaces/v0.8.x/IFilteredMinterDAExpV1.sol +1 -3
- package/contracts/interfaces/v0.8.x/IFilteredMinterDALinV1.sol +1 -3
- package/contracts/interfaces/v0.8.x/IFilteredMinterHolderV2.sol +1 -3
- package/contracts/interfaces/v0.8.x/IFilteredMinterMerkleV2.sol +1 -3
- package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol +115 -11
- package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol +84 -8
- package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol +26 -8
- package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.sol +141 -0
- package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_PreV3p2.sol +78 -0
- package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_ProjectFinance.sol +47 -0
- package/contracts/interfaces/v0.8.x/IGenArt721Minter_PBAB.sol +91 -0
- package/contracts/interfaces/v0.8.x/IPseudorandomAtomic.sol +1 -3
- package/contracts/interfaces/v0.8.x/ISharedMinterDAExpSettlementV0.sol +19 -0
- package/contracts/interfaces/v0.8.x/ISharedMinterRAMV0.sol +23 -0
- package/contracts/interfaces/v0.8.x/ISharedMinterRequired.sol +20 -0
- package/contracts/interfaces/v0.8.x/ISharedMinterSEAV0.sol +1 -4
- package/contracts/interfaces/v0.8.x/ISharedMinterV0.sol +12 -6
- package/contracts/interfaces/v0.8.x/ISplitAtomicFactoryV0.sol +81 -0
- package/contracts/interfaces/v0.8.x/ISplitAtomicV0.sol +72 -0
- package/contracts/interfaces/v0.8.x/ISplitProviderV0.sol +49 -0
- package/contracts/interfaces/v0.8.x/integration-refs/splits-0x-v2/ISplitFactoryV2.sol +62 -0
- package/contracts/libs/v0.8.x/ABHelpers.sol +18 -4
- package/contracts/libs/v0.8.x/BitMap.sol +112 -0
- package/contracts/libs/v0.8.x/BytecodeStorageV2.sol +593 -0
- package/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol +90 -0
- package/contracts/libs/v0.8.x/ERC721_PackedHashSeedV1.sol +591 -0
- package/contracts/libs/v0.8.x/PackedBools.sol +42 -0
- package/contracts/libs/v0.8.x/V3FlexLib.sol +591 -0
- package/contracts/libs/v0.8.x/minter-libs/DAExpLib.sol +10 -12
- package/contracts/libs/v0.8.x/minter-libs/DALinLib.sol +4 -9
- package/contracts/libs/v0.8.x/minter-libs/GenericMinterEventsLib.sol +44 -44
- package/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol +64 -63
- package/contracts/libs/v0.8.x/minter-libs/MerkleLib.sol +14 -10
- package/contracts/libs/v0.8.x/minter-libs/RAMLib.sol +2927 -0
- package/contracts/libs/v0.8.x/minter-libs/SEALib.sol +60 -62
- package/contracts/libs/v0.8.x/minter-libs/SetPriceLib.sol +4 -8
- package/contracts/libs/v0.8.x/minter-libs/SettlementExpLib.sol +92 -89
- package/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol +21 -15
- package/contracts/libs/v0.8.x/minter-libs/TokenHolderLib.sol +5 -4
- package/contracts/minter-suite/MinterFilter/MinterFilterV2.sol +16 -10
- package/contracts/minter-suite/Minters/MinterDAExpHolderV5.sol +2 -2
- package/contracts/minter-suite/Minters/MinterDAExpSettlementV3.sol +19 -15
- package/contracts/minter-suite/Minters/MinterDAExpV5.sol +2 -2
- package/contracts/minter-suite/Minters/MinterDALinHolderV5.sol +2 -2
- package/contracts/minter-suite/Minters/MinterDALinV5.sol +2 -2
- package/contracts/minter-suite/Minters/MinterRAMV0.sol +1205 -0
- package/contracts/minter-suite/Minters/MinterSEAV1.sol +21 -32
- package/contracts/minter-suite/Minters/MinterSetPriceERC20V5.sol +17 -8
- package/contracts/minter-suite/Minters/MinterSetPriceHolderV5.sol +2 -2
- package/contracts/minter-suite/Minters/MinterSetPriceMerkleV5.sol +2 -2
- package/contracts/minter-suite/Minters/MinterSetPricePolyptychERC20V5.sol +23 -9
- package/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol +2 -2
- package/contracts/minter-suite/Minters/MinterSetPriceV5.sol +2 -2
- package/contracts/minter-suite/Minters/one-off/MinterSetPriceV5_SingleCore.sol +446 -0
- package/contracts/mock/BytecodeV2LibCallsMock.sol +128 -0
- package/contracts/mock/BytecodeV2TextCR_DMock.sol +316 -0
- package/contracts/mock/ForceSendMock.sol +22 -0
- package/contracts/mock/Mock0xSplitsV2PullFactory.sol +75 -0
- package/contracts/mock/Mock0xSplitsV2Splitter.sol +47 -0
- package/contracts/mock/MockAdminACLV0.sol +21 -0
- package/contracts/mock/MockAdminACLV0_PROHIBITION.sol +21 -0
- package/contracts/mock/ReentrancyGenArt721MinterMock.sol +47 -0
- package/contracts/mock/ReentrancySplitterMocks.sol +67 -0
- package/contracts/randomizer/primitive/PseudorandomAtomicBasic.sol +1 -1
- package/contracts/randomizer/shared/SharedRandomizerV0.sol +1 -1
- package/contracts/split/SplitAtomicFactoryV0.sol +121 -0
- package/contracts/split/SplitAtomicV0.sol +265 -0
- package/contracts/split/split-provider/SplitProviderV0.sol +201 -0
- package/package.json +62 -34
- package/artifacts/contracts/GenArt721CoreV3.sol/GenArt721CoreV3.json +0 -1965
- package/artifacts/contracts/explorations/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +0 -1939
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V4.sol/MinterSetPriceERC20V4.json +0 -768
- package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverride.sol/GenArt721RoyaltyOverride.json +0 -208
- package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverride_PBAB.sol/GenArt721RoyaltyOverride_PBAB.json +0 -301
- package/contracts/archive/readme.md +0 -16
- package/contracts/engine/README.md +0 -21
- package/contracts/royalty-registry/GenArt721RoyaltyOverride.sol +0 -168
- package/contracts/royalty-registry/GenArt721RoyaltyOverride_PBAB.sol +0 -221
|
@@ -13,6 +13,7 @@ import "@openzeppelin-4.8/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
|
13
13
|
import "@openzeppelin-4.8/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
14
14
|
import "@openzeppelin-4.5/contracts/utils/math/SafeCast.sol";
|
|
15
15
|
|
|
16
|
+
import "./libs/v0.8.x/DependencyRegistryStorageLib.sol";
|
|
16
17
|
import "./libs/v0.8.x/BytecodeStorageV1.sol";
|
|
17
18
|
import "./libs/v0.8.x/Bytes32Strings.sol";
|
|
18
19
|
|
|
@@ -21,7 +22,7 @@ import "./libs/v0.8.x/Bytes32Strings.sol";
|
|
|
21
22
|
* @author Art Blocks Inc.
|
|
22
23
|
* @notice Privileged Roles and Ownership:
|
|
23
24
|
* Permissions managed by ACL contract. If/when we ever call
|
|
24
|
-
* renounceOwnership() this will
|
|
25
|
+
* renounceOwnership() this will become a frozen, immutable registry
|
|
25
26
|
* as no upgrades will be possible.
|
|
26
27
|
* This contract is intended to be an auxiliary reference registry
|
|
27
28
|
* to our non-upgradeable and immutable ERC-721 conforming core contracts,
|
|
@@ -42,157 +43,152 @@ contract DependencyRegistryV0 is
|
|
|
42
43
|
|
|
43
44
|
uint8 constant AT_CHARACTER_CODE = uint8(bytes1("@")); // 0x40
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
struct Dependency {
|
|
49
|
-
bytes32 licenseType;
|
|
50
|
-
string preferredCDN;
|
|
51
|
-
// mapping from additional CDN index to CDN URLr
|
|
52
|
-
mapping(uint256 => string) additionalCDNs;
|
|
53
|
-
string preferredRepository;
|
|
54
|
-
// mapping from additional repository index to repository URL
|
|
55
|
-
mapping(uint256 => string) additionalRepositories;
|
|
56
|
-
string referenceWebsite;
|
|
57
|
-
// mapping from script index to address storing script in bytecode
|
|
58
|
-
mapping(uint256 => address) scriptBytecodeAddresses;
|
|
59
|
-
uint24 additionalCDNCount;
|
|
60
|
-
uint24 additionalRepositoryCount;
|
|
61
|
-
uint24 scriptCount;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// dependency types, i.e. "type@version"
|
|
65
|
-
EnumerableSet.Bytes32Set private _dependencyTypes;
|
|
66
|
-
// mapping from dependencyTypes to Dependency, which stores the properties of each dependency
|
|
67
|
-
mapping(bytes32 => Dependency) dependencyDetails;
|
|
68
|
-
// source code license types, MIT, GPL, etc.
|
|
69
|
-
EnumerableSet.Bytes32Set private _licenseTypes;
|
|
70
|
-
|
|
71
|
-
// set of supported core ArtBlocks contracts
|
|
72
|
-
EnumerableSet.AddressSet private _supportedCoreContracts;
|
|
73
|
-
mapping(address => mapping(uint256 => bytes32)) projectDependencyTypeOverrides;
|
|
74
|
-
|
|
75
|
-
function _onlyNonZeroAddress(address _address) internal pure {
|
|
76
|
-
require(_address != address(0), "Must input non-zero address");
|
|
46
|
+
function _onlyNonZeroAddress(address address_) internal pure {
|
|
47
|
+
require(address_ != address(0), "Must input non-zero address");
|
|
77
48
|
}
|
|
78
49
|
|
|
79
|
-
function _onlyNonEmptyString(string memory
|
|
80
|
-
require(bytes(
|
|
50
|
+
function _onlyNonEmptyString(string memory string_) internal pure {
|
|
51
|
+
require(bytes(string_).length != 0, "Must input non-empty string");
|
|
81
52
|
}
|
|
82
53
|
|
|
83
|
-
function _onlyAdminACL(bytes4
|
|
54
|
+
function _onlyAdminACL(bytes4 selector) internal {
|
|
84
55
|
require(
|
|
85
|
-
adminACLAllowed(
|
|
56
|
+
adminACLAllowed({
|
|
57
|
+
sender: msg.sender,
|
|
58
|
+
contract_: address(this),
|
|
59
|
+
selector: selector
|
|
60
|
+
}),
|
|
86
61
|
"Only Admin ACL allowed"
|
|
87
62
|
);
|
|
88
63
|
}
|
|
89
64
|
|
|
90
65
|
function _onlySupportedCoreContract(
|
|
91
|
-
address
|
|
66
|
+
address coreContractAddress
|
|
92
67
|
) internal view {
|
|
93
68
|
require(
|
|
94
|
-
|
|
69
|
+
DependencyRegistryStorageLib.s().supportedCoreContracts.contains(
|
|
70
|
+
coreContractAddress
|
|
71
|
+
),
|
|
95
72
|
"Core contract not supported"
|
|
96
73
|
);
|
|
97
74
|
}
|
|
98
75
|
|
|
99
|
-
function
|
|
100
|
-
bytes32
|
|
76
|
+
function _onlyExistingDependency(
|
|
77
|
+
bytes32 dependencyNameAndVersion
|
|
101
78
|
) internal view {
|
|
102
79
|
require(
|
|
103
|
-
|
|
104
|
-
|
|
80
|
+
DependencyRegistryStorageLib.s().dependencyNameVersionIds.contains(
|
|
81
|
+
dependencyNameAndVersion
|
|
82
|
+
),
|
|
83
|
+
"Dependency does not exist"
|
|
105
84
|
);
|
|
106
85
|
}
|
|
107
86
|
|
|
108
|
-
function _onlyInRangeIndex(uint256
|
|
109
|
-
require(
|
|
87
|
+
function _onlyInRangeIndex(uint256 index, uint256 length) internal pure {
|
|
88
|
+
require(index < length, "Index out of range");
|
|
110
89
|
}
|
|
111
90
|
|
|
112
|
-
function _onlyExistingLicenseType(bytes32
|
|
91
|
+
function _onlyExistingLicenseType(bytes32 licenseType) internal view {
|
|
113
92
|
require(
|
|
114
|
-
|
|
93
|
+
DependencyRegistryStorageLib.s().licenseTypes.contains(licenseType),
|
|
115
94
|
"License type does not exist"
|
|
116
95
|
);
|
|
117
96
|
}
|
|
118
97
|
|
|
119
98
|
/**
|
|
120
99
|
* @notice Initializes contract.
|
|
121
|
-
* @param
|
|
100
|
+
* @param adminACLContract_ Address of admin access control contract, to be
|
|
122
101
|
* set as contract owner.
|
|
123
102
|
*/
|
|
124
|
-
function initialize(address
|
|
103
|
+
function initialize(address adminACLContract_) public initializer {
|
|
125
104
|
__Ownable_init();
|
|
105
|
+
|
|
126
106
|
// set AdminACL management contract as owner
|
|
127
|
-
_transferOwnership(
|
|
107
|
+
_transferOwnership(adminACLContract_);
|
|
128
108
|
}
|
|
129
109
|
|
|
130
110
|
/**
|
|
131
111
|
* @notice Adds a new license type that can be used by dependencies.
|
|
112
|
+
* @param licenseType License type to be added.
|
|
132
113
|
*/
|
|
133
|
-
function addLicenseType(bytes32
|
|
114
|
+
function addLicenseType(bytes32 licenseType) external {
|
|
134
115
|
_onlyAdminACL(this.addLicenseType.selector);
|
|
135
|
-
// @dev the add function returns false if set already contains value
|
|
136
|
-
require(_licenseTypes.add(_licenseType), "License type already exists");
|
|
137
116
|
require(
|
|
138
|
-
|
|
117
|
+
licenseType != bytes32(""),
|
|
139
118
|
"License type cannot be empty string"
|
|
140
119
|
);
|
|
141
|
-
|
|
120
|
+
|
|
121
|
+
// @dev the add function returns false if set already contains value
|
|
122
|
+
require(
|
|
123
|
+
DependencyRegistryStorageLib.s().licenseTypes.add(licenseType),
|
|
124
|
+
"License type already exists"
|
|
125
|
+
);
|
|
126
|
+
emit LicenseTypeAdded(licenseType);
|
|
142
127
|
}
|
|
143
128
|
|
|
144
129
|
/**
|
|
145
130
|
* @notice Adds a new dependency.
|
|
146
|
-
* @param
|
|
147
|
-
* @param
|
|
148
|
-
* @param
|
|
149
|
-
* @param
|
|
131
|
+
* @param dependencyNameAndVersion A unique identifier for the dependency, composed of its name and version in the format "name@version".
|
|
132
|
+
* @param licenseType License type for dependency, must be a registered license type.
|
|
133
|
+
* @param preferredCDN Preferred CDN for dependency.
|
|
134
|
+
* @param preferredRepository Preferred repository for dependency.
|
|
150
135
|
*/
|
|
151
136
|
function addDependency(
|
|
152
|
-
bytes32
|
|
153
|
-
bytes32
|
|
154
|
-
string memory
|
|
155
|
-
string memory
|
|
156
|
-
string memory
|
|
137
|
+
bytes32 dependencyNameAndVersion,
|
|
138
|
+
bytes32 licenseType,
|
|
139
|
+
string memory preferredCDN,
|
|
140
|
+
string memory preferredRepository,
|
|
141
|
+
string memory dependencyWebsite
|
|
157
142
|
) external {
|
|
158
143
|
_onlyAdminACL(this.addDependency.selector);
|
|
159
|
-
_onlyExistingLicenseType(
|
|
144
|
+
_onlyExistingLicenseType(licenseType);
|
|
160
145
|
require(
|
|
161
|
-
|
|
146
|
+
dependencyNameAndVersion.containsExactCharacterQty(
|
|
162
147
|
AT_CHARACTER_CODE,
|
|
163
148
|
uint8(1)
|
|
164
149
|
),
|
|
165
150
|
"must contain exactly one @"
|
|
166
151
|
);
|
|
152
|
+
|
|
153
|
+
DependencyRegistryStorageLib.Storage
|
|
154
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
155
|
+
|
|
167
156
|
require(
|
|
168
157
|
// @dev the add function returns false if set already contains value
|
|
169
|
-
|
|
170
|
-
"Dependency
|
|
158
|
+
ds.dependencyNameVersionIds.add(dependencyNameAndVersion),
|
|
159
|
+
"Dependency already exists"
|
|
171
160
|
);
|
|
172
161
|
|
|
173
|
-
Dependency storage dependency =
|
|
174
|
-
|
|
175
|
-
dependency.
|
|
176
|
-
dependency.
|
|
177
|
-
dependency.
|
|
162
|
+
DependencyRegistryStorageLib.Dependency storage dependency = ds
|
|
163
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
164
|
+
dependency.licenseType = licenseType;
|
|
165
|
+
dependency.preferredCDN = preferredCDN;
|
|
166
|
+
dependency.preferredRepository = preferredRepository;
|
|
167
|
+
dependency.website = dependencyWebsite;
|
|
178
168
|
|
|
179
169
|
emit DependencyAdded(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
170
|
+
dependencyNameAndVersion,
|
|
171
|
+
licenseType,
|
|
172
|
+
preferredCDN,
|
|
173
|
+
preferredRepository,
|
|
174
|
+
dependencyWebsite
|
|
185
175
|
);
|
|
186
176
|
}
|
|
187
177
|
|
|
188
178
|
/**
|
|
189
179
|
* @notice Removes a dependency.
|
|
190
|
-
* @param
|
|
180
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
191
181
|
*/
|
|
192
|
-
function removeDependency(bytes32
|
|
182
|
+
function removeDependency(bytes32 dependencyNameAndVersion) external {
|
|
193
183
|
_onlyAdminACL(this.removeDependency.selector);
|
|
194
|
-
|
|
195
|
-
|
|
184
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
185
|
+
|
|
186
|
+
DependencyRegistryStorageLib.Storage
|
|
187
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
188
|
+
|
|
189
|
+
DependencyRegistryStorageLib.Dependency storage dependency = ds
|
|
190
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
191
|
+
|
|
196
192
|
require(
|
|
197
193
|
dependency.additionalCDNCount == 0 &&
|
|
198
194
|
dependency.additionalRepositoryCount == 0 &&
|
|
@@ -200,115 +196,139 @@ contract DependencyRegistryV0 is
|
|
|
200
196
|
"Cannot remove dependency with additional CDNs, repositories, or scripts"
|
|
201
197
|
);
|
|
202
198
|
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
ds.dependencyNameVersionIds.remove(dependencyNameAndVersion);
|
|
200
|
+
// @dev all of the arrays in the dependency struct are required to be empty
|
|
201
|
+
// before this function can be called, so we don't need to delete them here
|
|
202
|
+
delete ds.dependencyRecords[dependencyNameAndVersion];
|
|
205
203
|
|
|
206
|
-
emit DependencyRemoved(
|
|
204
|
+
emit DependencyRemoved(dependencyNameAndVersion);
|
|
207
205
|
}
|
|
208
206
|
|
|
209
207
|
/**
|
|
210
|
-
* @notice Adds a script to dependency `
|
|
208
|
+
* @notice Adds a script to dependency `dependencyNameAndVersion`, by way of
|
|
211
209
|
* providing a string to write to bytecode storage.
|
|
212
|
-
* @param
|
|
213
|
-
* @param
|
|
210
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
211
|
+
* @param script Script to be added. Required to be a non-empty string,
|
|
214
212
|
* but no further validation is performed.
|
|
215
213
|
*/
|
|
216
214
|
function addDependencyScript(
|
|
217
|
-
bytes32
|
|
218
|
-
string memory
|
|
215
|
+
bytes32 dependencyNameAndVersion,
|
|
216
|
+
string memory script
|
|
219
217
|
) external {
|
|
220
218
|
_onlyAdminACL(this.addDependencyScript.selector);
|
|
221
|
-
_onlyNonEmptyString(
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
_onlyNonEmptyString(script);
|
|
220
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
221
|
+
|
|
222
|
+
DependencyRegistryStorageLib.Dependency
|
|
223
|
+
storage dependency = DependencyRegistryStorageLib
|
|
224
|
+
.s()
|
|
225
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
224
226
|
// store script in contract bytecode
|
|
225
|
-
dependency.scriptBytecodeAddresses[dependency.scriptCount] =
|
|
227
|
+
dependency.scriptBytecodeAddresses[dependency.scriptCount] = script
|
|
226
228
|
.writeToBytecode();
|
|
227
229
|
dependency.scriptCount = dependency.scriptCount + 1;
|
|
228
230
|
|
|
229
|
-
emit DependencyScriptUpdated(
|
|
231
|
+
emit DependencyScriptUpdated(dependencyNameAndVersion);
|
|
230
232
|
}
|
|
231
233
|
|
|
232
234
|
/**
|
|
233
|
-
* @notice Updates script for dependencyType `
|
|
235
|
+
* @notice Updates script for dependencyType `dependencyNameAndVersion` at script `index`,
|
|
234
236
|
* by way of providing a string to write to bytecode storage.
|
|
235
|
-
* @param
|
|
236
|
-
* @param
|
|
237
|
-
* @param
|
|
237
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
238
|
+
* @param index The index of a given script, relative to the overall `scriptCount`.
|
|
239
|
+
* @param script The updated script value. Required to be a non-empty
|
|
238
240
|
* string, but no further validation is performed.
|
|
239
241
|
*/
|
|
240
242
|
function updateDependencyScript(
|
|
241
|
-
bytes32
|
|
242
|
-
uint256
|
|
243
|
-
string memory
|
|
243
|
+
bytes32 dependencyNameAndVersion,
|
|
244
|
+
uint256 index,
|
|
245
|
+
string memory script
|
|
244
246
|
) external {
|
|
245
247
|
_onlyAdminACL(this.updateDependencyScript.selector);
|
|
246
|
-
_onlyNonEmptyString(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
_onlyNonEmptyString(script);
|
|
249
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
250
|
+
|
|
251
|
+
DependencyRegistryStorageLib.Dependency
|
|
252
|
+
storage dependency = DependencyRegistryStorageLib
|
|
253
|
+
.s()
|
|
254
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
255
|
+
_onlyInRangeIndex({index: index, length: dependency.scriptCount});
|
|
250
256
|
// store script in contract bytecode, replacing reference address from
|
|
251
257
|
// the contract that no longer exists with the newly created one
|
|
252
|
-
dependency.scriptBytecodeAddresses[
|
|
258
|
+
dependency.scriptBytecodeAddresses[index] = script.writeToBytecode();
|
|
253
259
|
|
|
254
|
-
emit DependencyScriptUpdated(
|
|
260
|
+
emit DependencyScriptUpdated(dependencyNameAndVersion);
|
|
255
261
|
}
|
|
256
262
|
|
|
257
263
|
/**
|
|
258
|
-
* @notice Adds a script to dependency `
|
|
264
|
+
* @notice Adds a script to dependency `dependencyNameAndVersion`, by way of
|
|
259
265
|
* providing an already written chunk of bytecode storage.
|
|
260
|
-
* @param
|
|
261
|
-
* @param
|
|
266
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
267
|
+
* @param scriptPointer Address of script to be added. Required to be a non-zero address,
|
|
262
268
|
* but no further validation is performed.
|
|
263
269
|
*/
|
|
264
270
|
function addDependencyScriptPointer(
|
|
265
|
-
bytes32
|
|
266
|
-
address
|
|
271
|
+
bytes32 dependencyNameAndVersion,
|
|
272
|
+
address scriptPointer
|
|
267
273
|
) external {
|
|
268
274
|
_onlyAdminACL(this.addDependencyScriptPointer.selector);
|
|
269
|
-
_onlyNonZeroAddress(
|
|
270
|
-
|
|
271
|
-
|
|
275
|
+
_onlyNonZeroAddress(scriptPointer);
|
|
276
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
277
|
+
|
|
278
|
+
DependencyRegistryStorageLib.Dependency
|
|
279
|
+
storage dependency = DependencyRegistryStorageLib
|
|
280
|
+
.s()
|
|
281
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
272
282
|
// store script in contract bytecode
|
|
273
283
|
dependency.scriptBytecodeAddresses[
|
|
274
284
|
dependency.scriptCount
|
|
275
|
-
] =
|
|
285
|
+
] = scriptPointer;
|
|
276
286
|
dependency.scriptCount = dependency.scriptCount + 1;
|
|
277
287
|
|
|
278
|
-
emit DependencyScriptUpdated(
|
|
288
|
+
emit DependencyScriptUpdated(dependencyNameAndVersion);
|
|
279
289
|
}
|
|
280
290
|
|
|
281
291
|
/**
|
|
282
|
-
* @notice Updates script for
|
|
292
|
+
* @notice Updates script for dependency id `dependencyNameAndVersion` at script `index`,
|
|
283
293
|
* by way of providing an already written chunk of bytecode storage.
|
|
284
|
-
* @param
|
|
285
|
-
* @param
|
|
286
|
-
* @param
|
|
294
|
+
* @param dependencyNameAndVersion Name of dependency (i.e. "name@version") used to identify dependency.
|
|
295
|
+
* @param index The index of a given script, relative to the overall `scriptCount`.
|
|
296
|
+
* @param scriptPointer The updated script pointer (address of bytecode storage).
|
|
287
297
|
* Required to be a non-zero address, but no further validation is performed.
|
|
288
298
|
*/
|
|
289
299
|
function updateDependencyScriptPointer(
|
|
290
|
-
bytes32
|
|
291
|
-
uint256
|
|
292
|
-
address
|
|
300
|
+
bytes32 dependencyNameAndVersion,
|
|
301
|
+
uint256 index,
|
|
302
|
+
address scriptPointer
|
|
293
303
|
) external {
|
|
294
304
|
_onlyAdminACL(this.updateDependencyScriptPointer.selector);
|
|
295
|
-
_onlyNonZeroAddress(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
305
|
+
_onlyNonZeroAddress(scriptPointer);
|
|
306
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
307
|
+
|
|
308
|
+
DependencyRegistryStorageLib.Dependency
|
|
309
|
+
storage dependency = DependencyRegistryStorageLib
|
|
310
|
+
.s()
|
|
311
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
312
|
+
_onlyInRangeIndex({index: index, length: dependency.scriptCount});
|
|
313
|
+
dependency.scriptBytecodeAddresses[index] = scriptPointer;
|
|
300
314
|
|
|
301
|
-
emit DependencyScriptUpdated(
|
|
315
|
+
emit DependencyScriptUpdated(dependencyNameAndVersion);
|
|
302
316
|
}
|
|
303
317
|
|
|
304
318
|
/**
|
|
305
|
-
* @notice Removes last script from dependency `
|
|
306
|
-
* @param
|
|
319
|
+
* @notice Removes last script from dependency `dependencyNameAndVersion`.
|
|
320
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
307
321
|
*/
|
|
308
|
-
function removeDependencyLastScript(
|
|
322
|
+
function removeDependencyLastScript(
|
|
323
|
+
bytes32 dependencyNameAndVersion
|
|
324
|
+
) external {
|
|
309
325
|
_onlyAdminACL(this.removeDependencyLastScript.selector);
|
|
310
|
-
|
|
311
|
-
|
|
326
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
327
|
+
|
|
328
|
+
DependencyRegistryStorageLib.Dependency
|
|
329
|
+
storage dependency = DependencyRegistryStorageLib
|
|
330
|
+
.s()
|
|
331
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
312
332
|
require(dependency.scriptCount > 0, "there are no scripts to remove");
|
|
313
333
|
// delete reference to old storage contract address
|
|
314
334
|
delete dependency.scriptBytecodeAddresses[dependency.scriptCount - 1];
|
|
@@ -316,365 +336,438 @@ contract DependencyRegistryV0 is
|
|
|
316
336
|
dependency.scriptCount = dependency.scriptCount - 1;
|
|
317
337
|
}
|
|
318
338
|
|
|
319
|
-
emit DependencyScriptUpdated(
|
|
339
|
+
emit DependencyScriptUpdated(dependencyNameAndVersion);
|
|
320
340
|
}
|
|
321
341
|
|
|
322
342
|
/**
|
|
323
|
-
* @notice Updates preferred CDN for dependency `
|
|
324
|
-
* @param
|
|
325
|
-
* @param
|
|
343
|
+
* @notice Updates preferred CDN for dependency `dependencyNameAndVersion`.
|
|
344
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
345
|
+
* @param preferredCDN URL for preferred CDN.
|
|
326
346
|
*/
|
|
327
347
|
function updateDependencyPreferredCDN(
|
|
328
|
-
bytes32
|
|
329
|
-
string memory
|
|
348
|
+
bytes32 dependencyNameAndVersion,
|
|
349
|
+
string memory preferredCDN
|
|
330
350
|
) external {
|
|
331
351
|
_onlyAdminACL(this.updateDependencyPreferredCDN.selector);
|
|
332
|
-
|
|
333
|
-
dependencyDetails[_dependencyType].preferredCDN = _preferredCDN;
|
|
352
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
334
353
|
|
|
335
|
-
|
|
354
|
+
DependencyRegistryStorageLib
|
|
355
|
+
.s()
|
|
356
|
+
.dependencyRecords[dependencyNameAndVersion]
|
|
357
|
+
.preferredCDN = preferredCDN;
|
|
358
|
+
|
|
359
|
+
emit DependencyPreferredCDNUpdated(
|
|
360
|
+
dependencyNameAndVersion,
|
|
361
|
+
preferredCDN
|
|
362
|
+
);
|
|
336
363
|
}
|
|
337
364
|
|
|
338
365
|
/**
|
|
339
|
-
* @notice Updates preferred repository for dependency `
|
|
340
|
-
* @param
|
|
341
|
-
* @param
|
|
366
|
+
* @notice Updates preferred repository for dependency `dependencyNameAndVersion`.
|
|
367
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
368
|
+
* @param preferredRepository URL for preferred repository.
|
|
342
369
|
*/
|
|
343
370
|
function updateDependencyPreferredRepository(
|
|
344
|
-
bytes32
|
|
345
|
-
string memory
|
|
371
|
+
bytes32 dependencyNameAndVersion,
|
|
372
|
+
string memory preferredRepository
|
|
346
373
|
) external {
|
|
347
374
|
_onlyAdminACL(this.updateDependencyPreferredRepository.selector);
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
375
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
376
|
+
|
|
377
|
+
DependencyRegistryStorageLib
|
|
378
|
+
.s()
|
|
379
|
+
.dependencyRecords[dependencyNameAndVersion]
|
|
380
|
+
.preferredRepository = preferredRepository;
|
|
351
381
|
|
|
352
382
|
emit DependencyPreferredRepositoryUpdated(
|
|
353
|
-
|
|
354
|
-
|
|
383
|
+
dependencyNameAndVersion,
|
|
384
|
+
preferredRepository
|
|
355
385
|
);
|
|
356
386
|
}
|
|
357
387
|
|
|
358
388
|
/**
|
|
359
|
-
* @notice Updates project website for dependency `
|
|
360
|
-
* @param
|
|
361
|
-
* @param
|
|
389
|
+
* @notice Updates project website for dependency `dependencyNameAndVersion`.
|
|
390
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
391
|
+
* @param dependencyWebsite URL for project website.
|
|
362
392
|
*/
|
|
363
|
-
function
|
|
364
|
-
bytes32
|
|
365
|
-
string memory
|
|
393
|
+
function updateDependencyWebsite(
|
|
394
|
+
bytes32 dependencyNameAndVersion,
|
|
395
|
+
string memory dependencyWebsite
|
|
366
396
|
) external {
|
|
367
|
-
_onlyAdminACL(this.
|
|
368
|
-
|
|
369
|
-
|
|
397
|
+
_onlyAdminACL(this.updateDependencyWebsite.selector);
|
|
398
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
399
|
+
|
|
400
|
+
DependencyRegistryStorageLib
|
|
401
|
+
.s()
|
|
402
|
+
.dependencyRecords[dependencyNameAndVersion]
|
|
403
|
+
.website = dependencyWebsite;
|
|
370
404
|
|
|
371
|
-
emit
|
|
372
|
-
|
|
373
|
-
|
|
405
|
+
emit DependencyWebsiteUpdated(
|
|
406
|
+
dependencyNameAndVersion,
|
|
407
|
+
dependencyWebsite
|
|
374
408
|
);
|
|
375
409
|
}
|
|
376
410
|
|
|
377
411
|
/**
|
|
378
|
-
* @notice Adds a new CDN url to `
|
|
379
|
-
* @param
|
|
380
|
-
* @param
|
|
412
|
+
* @notice Adds a new CDN url to `dependencyNameAndVersion`.
|
|
413
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
414
|
+
* @param additionalCDN CDN URL to be added. Required to be a non-empty string,
|
|
381
415
|
* but no further validation is performed.
|
|
382
416
|
*/
|
|
383
417
|
function addDependencyAdditionalCDN(
|
|
384
|
-
bytes32
|
|
385
|
-
string memory
|
|
418
|
+
bytes32 dependencyNameAndVersion,
|
|
419
|
+
string memory additionalCDN
|
|
386
420
|
) external {
|
|
387
421
|
_onlyAdminACL(this.addDependencyAdditionalCDN.selector);
|
|
388
|
-
_onlyNonEmptyString(
|
|
389
|
-
|
|
390
|
-
|
|
422
|
+
_onlyNonEmptyString(additionalCDN);
|
|
423
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
424
|
+
|
|
425
|
+
DependencyRegistryStorageLib.Dependency
|
|
426
|
+
storage dependency = DependencyRegistryStorageLib
|
|
427
|
+
.s()
|
|
428
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
391
429
|
|
|
392
430
|
uint256 additionalCDNCount = uint256(dependency.additionalCDNCount);
|
|
393
|
-
dependency.additionalCDNs[additionalCDNCount] =
|
|
431
|
+
dependency.additionalCDNs[additionalCDNCount] = additionalCDN;
|
|
394
432
|
dependency.additionalCDNCount = uint24(additionalCDNCount + 1);
|
|
395
433
|
|
|
396
434
|
emit DependencyAdditionalCDNUpdated(
|
|
397
|
-
|
|
398
|
-
|
|
435
|
+
dependencyNameAndVersion,
|
|
436
|
+
additionalCDN,
|
|
399
437
|
additionalCDNCount
|
|
400
438
|
);
|
|
401
439
|
}
|
|
402
440
|
|
|
403
441
|
/**
|
|
404
|
-
* @notice Removes additional CDN for dependency `_dependencyId` at index `
|
|
442
|
+
* @notice Removes additional CDN for dependency `_dependencyId` at index `index`.
|
|
405
443
|
* Removal is done by swapping the element to be removed with the last element in the array, then deleting this last element.
|
|
406
|
-
* Assets with indices higher than `
|
|
407
|
-
* @param
|
|
408
|
-
* @param
|
|
444
|
+
* Assets with indices higher than `index` can have their indices adjusted as a result of this operation.
|
|
445
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
446
|
+
* @param index The index of an additional CDN, relative to the overall `additionalCDNCount`.
|
|
409
447
|
*/
|
|
410
448
|
function removeDependencyAdditionalCDN(
|
|
411
|
-
bytes32
|
|
412
|
-
uint256
|
|
449
|
+
bytes32 dependencyNameAndVersion,
|
|
450
|
+
uint256 index
|
|
413
451
|
) external {
|
|
414
452
|
_onlyAdminACL(this.removeDependencyAdditionalCDN.selector);
|
|
415
|
-
|
|
416
|
-
|
|
453
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
454
|
+
|
|
455
|
+
DependencyRegistryStorageLib.Dependency
|
|
456
|
+
storage dependency = DependencyRegistryStorageLib
|
|
457
|
+
.s()
|
|
458
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
417
459
|
|
|
418
460
|
uint256 additionalCDNCount = dependency.additionalCDNCount;
|
|
419
|
-
_onlyInRangeIndex({
|
|
461
|
+
_onlyInRangeIndex({index: index, length: additionalCDNCount});
|
|
420
462
|
|
|
421
463
|
uint256 lastElementIndex = additionalCDNCount - 1;
|
|
422
464
|
|
|
423
|
-
dependency.additionalCDNs[
|
|
465
|
+
dependency.additionalCDNs[index] = dependency.additionalCDNs[
|
|
424
466
|
lastElementIndex
|
|
425
467
|
];
|
|
426
468
|
delete dependency.additionalCDNs[lastElementIndex];
|
|
427
469
|
|
|
428
470
|
dependency.additionalCDNCount = uint24(lastElementIndex);
|
|
429
471
|
|
|
430
|
-
emit DependencyAdditionalCDNRemoved(
|
|
472
|
+
emit DependencyAdditionalCDNRemoved(dependencyNameAndVersion, index);
|
|
431
473
|
}
|
|
432
474
|
|
|
433
475
|
/**
|
|
434
|
-
* @notice Updates additional CDN for dependency `
|
|
435
|
-
* @param
|
|
436
|
-
* @param
|
|
437
|
-
* @param
|
|
476
|
+
* @notice Updates additional CDN for dependency `dependencyNameAndVersion` at `index`.
|
|
477
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
478
|
+
* @param index The index of an additional CDN, relative to the overall `additionalCDNCount`.
|
|
479
|
+
* @param additionalCDN New CDN URL.
|
|
438
480
|
*/
|
|
439
481
|
function updateDependencyAdditionalCDN(
|
|
440
|
-
bytes32
|
|
441
|
-
uint256
|
|
442
|
-
string memory
|
|
482
|
+
bytes32 dependencyNameAndVersion,
|
|
483
|
+
uint256 index,
|
|
484
|
+
string memory additionalCDN
|
|
443
485
|
) external {
|
|
444
486
|
_onlyAdminACL(this.updateDependencyAdditionalCDN.selector);
|
|
445
|
-
_onlyNonEmptyString(
|
|
446
|
-
|
|
447
|
-
|
|
487
|
+
_onlyNonEmptyString(additionalCDN);
|
|
488
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
489
|
+
|
|
490
|
+
DependencyRegistryStorageLib.Dependency
|
|
491
|
+
storage dependency = DependencyRegistryStorageLib
|
|
492
|
+
.s()
|
|
493
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
448
494
|
_onlyInRangeIndex({
|
|
449
|
-
|
|
450
|
-
|
|
495
|
+
index: index,
|
|
496
|
+
length: dependency.additionalCDNCount
|
|
451
497
|
});
|
|
452
498
|
|
|
453
|
-
dependency.additionalCDNs[
|
|
499
|
+
dependency.additionalCDNs[index] = additionalCDN;
|
|
454
500
|
|
|
455
501
|
emit DependencyAdditionalCDNUpdated(
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
502
|
+
dependencyNameAndVersion,
|
|
503
|
+
additionalCDN,
|
|
504
|
+
index
|
|
459
505
|
);
|
|
460
506
|
}
|
|
461
507
|
|
|
462
508
|
/**
|
|
463
|
-
* @notice Adds a new repository URL to dependency `
|
|
464
|
-
* @param
|
|
465
|
-
* @param
|
|
509
|
+
* @notice Adds a new repository URL to dependency `dependencyNameAndVersion`.
|
|
510
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
511
|
+
* @param additionalRepository Repository URL to be added. Required to be a non-empty string,
|
|
466
512
|
* but no further validation is performed.
|
|
467
513
|
*/
|
|
468
514
|
function addDependencyAdditionalRepository(
|
|
469
|
-
bytes32
|
|
470
|
-
string memory
|
|
515
|
+
bytes32 dependencyNameAndVersion,
|
|
516
|
+
string memory additionalRepository
|
|
471
517
|
) external {
|
|
472
518
|
_onlyAdminACL(this.addDependencyAdditionalRepository.selector);
|
|
473
|
-
_onlyNonEmptyString(
|
|
474
|
-
|
|
475
|
-
|
|
519
|
+
_onlyNonEmptyString(additionalRepository);
|
|
520
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
521
|
+
|
|
522
|
+
DependencyRegistryStorageLib.Dependency
|
|
523
|
+
storage dependency = DependencyRegistryStorageLib
|
|
524
|
+
.s()
|
|
525
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
476
526
|
uint256 additionalRepositoryCount = uint256(
|
|
477
527
|
dependency.additionalRepositoryCount
|
|
478
528
|
);
|
|
479
529
|
dependency.additionalRepositories[
|
|
480
530
|
additionalRepositoryCount
|
|
481
|
-
] =
|
|
531
|
+
] = additionalRepository;
|
|
482
532
|
dependency.additionalRepositoryCount = uint24(
|
|
483
533
|
additionalRepositoryCount + 1
|
|
484
534
|
);
|
|
485
535
|
|
|
486
536
|
emit DependencyAdditionalRepositoryUpdated(
|
|
487
|
-
|
|
488
|
-
|
|
537
|
+
dependencyNameAndVersion,
|
|
538
|
+
additionalRepository,
|
|
489
539
|
additionalRepositoryCount
|
|
490
540
|
);
|
|
491
541
|
}
|
|
492
542
|
|
|
493
543
|
/**
|
|
494
|
-
* @notice Removes additional repository for depenency `_dependencyId` at index `
|
|
544
|
+
* @notice Removes additional repository for depenency `_dependencyId` at index `index`.
|
|
495
545
|
* Removal is done by swapping the element to be removed with the last element in the array, then deleting this last element.
|
|
496
|
-
* Assets with indices higher than `
|
|
497
|
-
* @param
|
|
498
|
-
* @param
|
|
546
|
+
* Assets with indices higher than `index` can have their indices adjusted as a result of this operation.
|
|
547
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
548
|
+
* @param index The index of an additional repository, relative to the overall `additionalRepositoryCount`.
|
|
499
549
|
*/
|
|
500
550
|
function removeDependencyAdditionalRepository(
|
|
501
|
-
bytes32
|
|
502
|
-
uint256
|
|
551
|
+
bytes32 dependencyNameAndVersion,
|
|
552
|
+
uint256 index
|
|
503
553
|
) external {
|
|
504
554
|
_onlyAdminACL(this.removeDependencyAdditionalRepository.selector);
|
|
505
|
-
|
|
506
|
-
|
|
555
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
556
|
+
|
|
557
|
+
DependencyRegistryStorageLib.Storage
|
|
558
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
559
|
+
|
|
560
|
+
DependencyRegistryStorageLib.Dependency storage dependency = ds
|
|
561
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
507
562
|
uint256 additionalRepositoryCount = dependency
|
|
508
563
|
.additionalRepositoryCount;
|
|
509
|
-
_onlyInRangeIndex({
|
|
564
|
+
_onlyInRangeIndex({index: index, length: additionalRepositoryCount});
|
|
510
565
|
|
|
511
566
|
uint256 lastElementIndex = additionalRepositoryCount - 1;
|
|
512
567
|
|
|
513
|
-
dependency.additionalRepositories[
|
|
514
|
-
|
|
515
|
-
|
|
568
|
+
dependency.additionalRepositories[index] = ds
|
|
569
|
+
.dependencyRecords[dependencyNameAndVersion]
|
|
570
|
+
.additionalRepositories[lastElementIndex];
|
|
516
571
|
delete dependency.additionalRepositories[lastElementIndex];
|
|
517
572
|
|
|
518
573
|
dependency.additionalRepositoryCount = uint24(lastElementIndex);
|
|
519
574
|
|
|
520
|
-
emit DependencyAdditionalRepositoryRemoved(
|
|
575
|
+
emit DependencyAdditionalRepositoryRemoved(
|
|
576
|
+
dependencyNameAndVersion,
|
|
577
|
+
index
|
|
578
|
+
);
|
|
521
579
|
}
|
|
522
580
|
|
|
523
581
|
/**
|
|
524
|
-
* @notice Updates additional repository for dependency `
|
|
525
|
-
* @param
|
|
526
|
-
* @param
|
|
527
|
-
* @param
|
|
582
|
+
* @notice Updates additional repository for dependency `dependencyNameAndVersion` at `index`.
|
|
583
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
584
|
+
* @param index The index of an additional repository, relative to the overall `additionalRepositoryCount`.
|
|
585
|
+
* @param additionalRepository New Repository URL.
|
|
528
586
|
*/
|
|
529
587
|
function updateDependencyAdditionalRepository(
|
|
530
|
-
bytes32
|
|
531
|
-
uint256
|
|
532
|
-
string memory
|
|
588
|
+
bytes32 dependencyNameAndVersion,
|
|
589
|
+
uint256 index,
|
|
590
|
+
string memory additionalRepository
|
|
533
591
|
) external {
|
|
534
592
|
_onlyAdminACL(this.updateDependencyAdditionalRepository.selector);
|
|
535
|
-
_onlyNonEmptyString(
|
|
536
|
-
|
|
537
|
-
|
|
593
|
+
_onlyNonEmptyString(additionalRepository);
|
|
594
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
595
|
+
|
|
596
|
+
DependencyRegistryStorageLib.Dependency
|
|
597
|
+
storage dependency = DependencyRegistryStorageLib
|
|
598
|
+
.s()
|
|
599
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
538
600
|
_onlyInRangeIndex({
|
|
539
|
-
|
|
540
|
-
|
|
601
|
+
index: index,
|
|
602
|
+
length: dependency.additionalRepositoryCount
|
|
541
603
|
});
|
|
542
604
|
|
|
543
|
-
dependency.additionalRepositories[
|
|
605
|
+
dependency.additionalRepositories[index] = additionalRepository;
|
|
544
606
|
|
|
545
607
|
emit DependencyAdditionalRepositoryUpdated(
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
608
|
+
dependencyNameAndVersion,
|
|
609
|
+
additionalRepository,
|
|
610
|
+
index
|
|
549
611
|
);
|
|
550
612
|
}
|
|
551
613
|
|
|
552
614
|
/**
|
|
553
615
|
* @notice Adds a new core contract to the list of supported core contracts.
|
|
554
|
-
* @param
|
|
616
|
+
* @param contractAddress Address of the core contract to be added.
|
|
555
617
|
*/
|
|
556
|
-
function addSupportedCoreContract(address
|
|
618
|
+
function addSupportedCoreContract(address contractAddress) external {
|
|
557
619
|
_onlyAdminACL(this.addSupportedCoreContract.selector);
|
|
558
|
-
_onlyNonZeroAddress(
|
|
620
|
+
_onlyNonZeroAddress(contractAddress);
|
|
621
|
+
|
|
559
622
|
require(
|
|
560
623
|
// @dev the add function returns false if set already contains value
|
|
561
|
-
|
|
624
|
+
DependencyRegistryStorageLib.s().supportedCoreContracts.add(
|
|
625
|
+
contractAddress
|
|
626
|
+
),
|
|
562
627
|
"Contract already supported"
|
|
563
628
|
);
|
|
564
|
-
emit SupportedCoreContractAdded(
|
|
629
|
+
emit SupportedCoreContractAdded(contractAddress);
|
|
565
630
|
}
|
|
566
631
|
|
|
567
632
|
/**
|
|
568
633
|
* @notice Removes a core contract from the list of supported core contracts.
|
|
569
|
-
* @param
|
|
634
|
+
* @param contractAddress Address of the core contract to be removed.
|
|
570
635
|
*/
|
|
571
|
-
function removeSupportedCoreContract(address
|
|
636
|
+
function removeSupportedCoreContract(address contractAddress) external {
|
|
572
637
|
_onlyAdminACL(this.removeSupportedCoreContract.selector);
|
|
573
638
|
require(
|
|
574
639
|
// @dev the remove function returns false if set does not contain value
|
|
575
|
-
|
|
640
|
+
DependencyRegistryStorageLib.s().supportedCoreContracts.remove(
|
|
641
|
+
contractAddress
|
|
642
|
+
),
|
|
576
643
|
"Core contract already removed or not in set"
|
|
577
644
|
);
|
|
578
|
-
emit SupportedCoreContractRemoved(
|
|
645
|
+
emit SupportedCoreContractRemoved(contractAddress);
|
|
579
646
|
}
|
|
580
647
|
|
|
581
648
|
/**
|
|
582
649
|
* @notice Overrides the script type and version that
|
|
583
650
|
* would be returned by the core contract (`_contractAddress`)
|
|
584
651
|
* for a given project (`projectId`) with the given dependency
|
|
585
|
-
*
|
|
586
|
-
* @param
|
|
587
|
-
* @param
|
|
588
|
-
* @param
|
|
589
|
-
*/
|
|
590
|
-
function
|
|
591
|
-
address
|
|
592
|
-
uint256
|
|
593
|
-
bytes32
|
|
652
|
+
* name and version (`dependencyNameAndVersion`).
|
|
653
|
+
* @param contractAddress Core contract address.
|
|
654
|
+
* @param projectId Project to override script type and version for.
|
|
655
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "type`@`version") used to identify dependency.
|
|
656
|
+
*/
|
|
657
|
+
function addProjectDependencyOverride(
|
|
658
|
+
address contractAddress,
|
|
659
|
+
uint256 projectId,
|
|
660
|
+
bytes32 dependencyNameAndVersion
|
|
594
661
|
) external {
|
|
595
|
-
_onlyAdminACL(this.
|
|
596
|
-
|
|
597
|
-
_onlySupportedCoreContract(
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
662
|
+
_onlyAdminACL(this.addProjectDependencyOverride.selector);
|
|
663
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
664
|
+
_onlySupportedCoreContract(contractAddress);
|
|
665
|
+
|
|
666
|
+
DependencyRegistryStorageLib.s().projectDependencyOverrides[
|
|
667
|
+
contractAddress
|
|
668
|
+
][projectId] = dependencyNameAndVersion;
|
|
669
|
+
|
|
670
|
+
emit ProjectDependencyOverrideAdded(
|
|
671
|
+
contractAddress,
|
|
672
|
+
projectId,
|
|
673
|
+
dependencyNameAndVersion
|
|
606
674
|
);
|
|
607
675
|
}
|
|
608
676
|
|
|
609
677
|
/**
|
|
610
678
|
* @notice Removes the script type and version override for a given
|
|
611
679
|
* project (`projectId`) on a given core contract (`_contractAddress`).
|
|
612
|
-
* @param
|
|
613
|
-
* @param
|
|
680
|
+
* @param contractAddress Core contract address.
|
|
681
|
+
* @param projectId Project to remove override for.
|
|
614
682
|
*/
|
|
615
|
-
function
|
|
616
|
-
address
|
|
617
|
-
uint256
|
|
683
|
+
function removeProjectDependencyOverride(
|
|
684
|
+
address contractAddress,
|
|
685
|
+
uint256 projectId
|
|
618
686
|
) external {
|
|
619
|
-
_onlyAdminACL(this.
|
|
687
|
+
_onlyAdminACL(this.removeProjectDependencyOverride.selector);
|
|
688
|
+
|
|
689
|
+
DependencyRegistryStorageLib.Storage
|
|
690
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
691
|
+
|
|
620
692
|
require(
|
|
621
|
-
|
|
693
|
+
ds.projectDependencyOverrides[contractAddress][projectId] !=
|
|
622
694
|
bytes32(""),
|
|
623
695
|
"No override set for project"
|
|
624
696
|
);
|
|
625
697
|
|
|
626
|
-
delete
|
|
698
|
+
delete ds.projectDependencyOverrides[contractAddress][projectId];
|
|
627
699
|
|
|
628
|
-
emit
|
|
700
|
+
emit ProjectDependencyOverrideRemoved(contractAddress, projectId);
|
|
629
701
|
}
|
|
630
702
|
|
|
631
703
|
/**
|
|
632
|
-
* @notice Returns
|
|
633
|
-
*
|
|
634
|
-
* @dev This is
|
|
635
|
-
*
|
|
704
|
+
* @notice Returns an array of strings representing all registered dependencies in the contract.
|
|
705
|
+
* Each string is a combination of the dependency's name and version
|
|
706
|
+
* @dev This function is designed to be called outside of block execution where there is no gas limit,
|
|
707
|
+
* as it may consume a large amount of gas when there are many registered dependencies.
|
|
708
|
+
* @return A string array where each element is a registered dependency in the format "name@version".
|
|
636
709
|
*/
|
|
637
|
-
function
|
|
638
|
-
|
|
639
|
-
|
|
710
|
+
function getDependencyNamesAndVersions()
|
|
711
|
+
external
|
|
712
|
+
view
|
|
713
|
+
returns (string[] memory)
|
|
714
|
+
{
|
|
715
|
+
DependencyRegistryStorageLib.Storage
|
|
716
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
640
717
|
|
|
641
|
-
|
|
642
|
-
|
|
718
|
+
uint256 numDependencies = ds.dependencyNameVersionIds.length();
|
|
719
|
+
string[] memory dependencyTypes = new string[](numDependencies);
|
|
720
|
+
|
|
721
|
+
for (uint256 i = 0; i < numDependencies; i++) {
|
|
722
|
+
dependencyTypes[i] = ds.dependencyNameVersionIds.at(i).toString();
|
|
643
723
|
}
|
|
644
724
|
return dependencyTypes;
|
|
645
725
|
}
|
|
646
726
|
|
|
647
727
|
/**
|
|
648
|
-
* @notice Returns number of registered
|
|
728
|
+
* @notice Returns number of registered dependencies
|
|
649
729
|
* @return Number of registered dependencies.
|
|
650
730
|
*/
|
|
651
|
-
function
|
|
652
|
-
return
|
|
731
|
+
function getDependencyCount() external view returns (uint256) {
|
|
732
|
+
return
|
|
733
|
+
DependencyRegistryStorageLib.s().dependencyNameVersionIds.length();
|
|
653
734
|
}
|
|
654
735
|
|
|
655
736
|
/**
|
|
656
|
-
* @notice Returns registered depenedency
|
|
657
|
-
* @return Registered dependency at `
|
|
737
|
+
* @notice Returns registered depenedency name and version at index `index`.
|
|
738
|
+
* @return Registered dependency at `index`, relative to the overall length of the dependency type set.
|
|
658
739
|
*/
|
|
659
|
-
function
|
|
660
|
-
uint256
|
|
740
|
+
function getDependencyNameAndVersion(
|
|
741
|
+
uint256 index
|
|
661
742
|
) external view returns (string memory) {
|
|
662
|
-
|
|
663
|
-
|
|
743
|
+
DependencyRegistryStorageLib.Storage
|
|
744
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
745
|
+
|
|
746
|
+
_onlyInRangeIndex({
|
|
747
|
+
index: index,
|
|
748
|
+
length: ds.dependencyNameVersionIds.length()
|
|
749
|
+
});
|
|
750
|
+
return ds.dependencyNameVersionIds.at(index).toString();
|
|
664
751
|
}
|
|
665
752
|
|
|
666
753
|
/**
|
|
667
|
-
* @notice Returns
|
|
668
|
-
* @return
|
|
754
|
+
* @notice Returns array of registered license types
|
|
755
|
+
* @return Array of registered license types.
|
|
669
756
|
* @dev This is only intended to be called outside of block
|
|
670
757
|
* execution where there is no gas limit.
|
|
671
758
|
*/
|
|
672
759
|
function getLicenseTypes() external view returns (string[] memory) {
|
|
673
|
-
|
|
760
|
+
DependencyRegistryStorageLib.Storage
|
|
761
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
762
|
+
|
|
763
|
+
uint256 numLicenseTypes = ds.licenseTypes.length();
|
|
674
764
|
string[] memory licenseTypes = new string[](numLicenseTypes);
|
|
675
765
|
|
|
676
|
-
for (uint256 i
|
|
677
|
-
licenseTypes[i] =
|
|
766
|
+
for (uint256 i; i < numLicenseTypes; ) {
|
|
767
|
+
licenseTypes[i] = ds.licenseTypes.at(i).toString();
|
|
768
|
+
unchecked {
|
|
769
|
+
++i;
|
|
770
|
+
}
|
|
678
771
|
}
|
|
679
772
|
return licenseTypes;
|
|
680
773
|
}
|
|
@@ -684,61 +777,202 @@ contract DependencyRegistryV0 is
|
|
|
684
777
|
* @return Number of registered license types.
|
|
685
778
|
*/
|
|
686
779
|
function getLicenseTypeCount() external view returns (uint256) {
|
|
687
|
-
return
|
|
780
|
+
return DependencyRegistryStorageLib.s().licenseTypes.length();
|
|
688
781
|
}
|
|
689
782
|
|
|
690
783
|
/**
|
|
691
|
-
* @notice Returns registered license type at index `
|
|
692
|
-
* @return Registered license type at `
|
|
784
|
+
* @notice Returns registered license type at index `index`.
|
|
785
|
+
* @return Registered license type at `index`, relative to the overall length of the license type set.
|
|
693
786
|
*/
|
|
694
787
|
function getLicenseType(
|
|
695
|
-
uint256
|
|
788
|
+
uint256 index
|
|
696
789
|
) external view returns (string memory) {
|
|
697
|
-
|
|
698
|
-
|
|
790
|
+
DependencyRegistryStorageLib.Storage
|
|
791
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
792
|
+
|
|
793
|
+
_onlyInRangeIndex({index: index, length: ds.licenseTypes.length()});
|
|
794
|
+
return ds.licenseTypes.at(index).toString();
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* @notice Adds a full license text to license `licenseType`, by way of
|
|
799
|
+
* providing a string to write to bytecode storage.
|
|
800
|
+
* @param licenseType Name of license type (e.g. "MIT") used to identify license.
|
|
801
|
+
* @param text Text to be added. Required to be a non-empty string,
|
|
802
|
+
* but no further validation is performed.
|
|
803
|
+
*/
|
|
804
|
+
function addLicenseText(bytes32 licenseType, string memory text) external {
|
|
805
|
+
_onlyAdminACL(this.addLicenseText.selector);
|
|
806
|
+
_onlyNonEmptyString(text);
|
|
807
|
+
_onlyExistingLicenseType(licenseType);
|
|
808
|
+
|
|
809
|
+
DependencyRegistryStorageLib.License
|
|
810
|
+
storage licenseEntry = DependencyRegistryStorageLib.s().allLicenses[
|
|
811
|
+
licenseType
|
|
812
|
+
];
|
|
813
|
+
// store license chunk in contract bytecode
|
|
814
|
+
licenseEntry.licenseBytecodeAddresses[
|
|
815
|
+
licenseEntry.licenseChunkCount
|
|
816
|
+
] = text.writeToBytecode();
|
|
817
|
+
licenseEntry.licenseChunkCount = licenseEntry.licenseChunkCount + 1;
|
|
818
|
+
|
|
819
|
+
emit LicenseTextUpdated(licenseType);
|
|
699
820
|
}
|
|
700
821
|
|
|
701
822
|
/**
|
|
702
|
-
* @notice
|
|
703
|
-
*
|
|
704
|
-
* @
|
|
823
|
+
* @notice Updates the license text for license `licenseType` at index `_index`,
|
|
824
|
+
* by way of providing a string to write to bytecode storage.
|
|
825
|
+
* @param licenseType Name of license type (e.g. "MIT") used to identify license.
|
|
826
|
+
* @param index The index of a given license text chunk, relative to the overall `licenseChunkCount`.
|
|
827
|
+
* @param text The updated license text value. Required to be a non-empty
|
|
828
|
+
* string, but no further validation is performed.
|
|
829
|
+
*/
|
|
830
|
+
function updateLicenseText(
|
|
831
|
+
bytes32 licenseType,
|
|
832
|
+
uint256 index,
|
|
833
|
+
string memory text
|
|
834
|
+
) external {
|
|
835
|
+
_onlyAdminACL(this.updateLicenseText.selector);
|
|
836
|
+
_onlyNonEmptyString(text);
|
|
837
|
+
_onlyExistingLicenseType(licenseType);
|
|
838
|
+
|
|
839
|
+
DependencyRegistryStorageLib.License
|
|
840
|
+
storage licenseEntry = DependencyRegistryStorageLib.s().allLicenses[
|
|
841
|
+
licenseType
|
|
842
|
+
];
|
|
843
|
+
_onlyInRangeIndex({
|
|
844
|
+
index: index,
|
|
845
|
+
length: licenseEntry.licenseChunkCount
|
|
846
|
+
});
|
|
847
|
+
// store license text chunk in contract bytecode, replacing reference address from
|
|
848
|
+
// the contract that is no longer referenced with the newly created one
|
|
849
|
+
licenseEntry.licenseBytecodeAddresses[index] = text.writeToBytecode();
|
|
850
|
+
|
|
851
|
+
emit LicenseTextUpdated(licenseType);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* @notice Removes the last license text chunk from license `licenseType`.
|
|
856
|
+
* @param licenseType Name of license type (e.g. "MIT") used to identify license.
|
|
857
|
+
*/
|
|
858
|
+
function removeLicenseLastText(bytes32 licenseType) external {
|
|
859
|
+
_onlyAdminACL(this.removeLicenseLastText.selector);
|
|
860
|
+
_onlyExistingLicenseType(licenseType);
|
|
861
|
+
|
|
862
|
+
DependencyRegistryStorageLib.License
|
|
863
|
+
storage licenseEntry = DependencyRegistryStorageLib.s().allLicenses[
|
|
864
|
+
licenseType
|
|
865
|
+
];
|
|
866
|
+
uint24 licenseChunkCount = licenseEntry.licenseChunkCount;
|
|
867
|
+
require(licenseChunkCount > 0, "There is no license text to remove");
|
|
868
|
+
// delete reference to old storage contract address
|
|
869
|
+
delete licenseEntry.licenseBytecodeAddresses[licenseChunkCount - 1];
|
|
870
|
+
unchecked {
|
|
871
|
+
licenseEntry.licenseChunkCount = licenseChunkCount - 1;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
emit LicenseTextUpdated(licenseType);
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* @notice Returns license text for license `licenseType` at script index `index`.
|
|
879
|
+
* @param licenseType Name of license type (e.g. "MIT") used to identify license.
|
|
880
|
+
* @param index The index of a given script, relative to the overall `licenseChunkCount`.
|
|
881
|
+
* @return A string containing the license text content at the given script chunk index for a given license.
|
|
882
|
+
* @dev This method attempts to introspectively determine which library version of
|
|
883
|
+
* `BytecodeStorage` was used to write the stored script string that is being
|
|
884
|
+
* read back, in order to use the proper read approach. If the version is
|
|
885
|
+
* non-determinate, a fall-back to reading using the assumption that the bytes
|
|
886
|
+
* were written with `SSTORE2` is used.
|
|
887
|
+
* Also note that in this `SSTORE2` fallback handling, the approach of casting bytes to string
|
|
888
|
+
* can cause failure (e.g. unexpected continuation byte).
|
|
889
|
+
*/
|
|
890
|
+
function getLicenseText(
|
|
891
|
+
bytes32 licenseType,
|
|
892
|
+
uint256 index
|
|
893
|
+
) external view returns (string memory) {
|
|
894
|
+
DependencyRegistryStorageLib.License
|
|
895
|
+
storage licenseEntry = DependencyRegistryStorageLib.s().allLicenses[
|
|
896
|
+
licenseType
|
|
897
|
+
];
|
|
898
|
+
_onlyInRangeIndex({
|
|
899
|
+
index: index,
|
|
900
|
+
length: licenseEntry.licenseChunkCount
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
address licenseAddress = licenseEntry.licenseBytecodeAddresses[index];
|
|
904
|
+
bytes32 storageVersion = BytecodeStorageReader
|
|
905
|
+
.getLibraryVersionForBytecode(licenseAddress);
|
|
906
|
+
if (storageVersion == BytecodeStorageReader.UNKNOWN_VERSION_STRING) {
|
|
907
|
+
return
|
|
908
|
+
string(
|
|
909
|
+
BytecodeStorageReader.readBytesFromSSTORE2Bytecode(
|
|
910
|
+
licenseAddress
|
|
911
|
+
)
|
|
912
|
+
);
|
|
913
|
+
} else {
|
|
914
|
+
return BytecodeStorageReader.readFromBytecode(licenseAddress);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* @notice Returns the count of license chunks for license `licenseType`.
|
|
920
|
+
* @param licenseType Name of license type (e.g. "MIT") used to identify dependency.
|
|
921
|
+
*/
|
|
922
|
+
function getLicenseTextChunkCount(
|
|
923
|
+
bytes32 licenseType
|
|
924
|
+
) external view returns (uint256) {
|
|
925
|
+
return
|
|
926
|
+
DependencyRegistryStorageLib
|
|
927
|
+
.s()
|
|
928
|
+
.allLicenses[licenseType]
|
|
929
|
+
.licenseChunkCount;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* @notice Returns details for a given dependency type `dependencyNameAndVersion`.
|
|
934
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
935
|
+
* @return nameAndVersion String representation of `dependencyNameAndVersion`.
|
|
705
936
|
* (e.g. "p5js(atSymbol)1.0.0")
|
|
706
937
|
* @return licenseType License type for dependency
|
|
707
938
|
* @return preferredCDN Preferred CDN URL for dependency
|
|
708
939
|
* @return additionalCDNCount Count of additional CDN URLs for dependency
|
|
709
940
|
* @return preferredRepository Preferred repository URL for dependency
|
|
710
941
|
* @return additionalRepositoryCount Count of additional repository URLs for dependency
|
|
711
|
-
* @return
|
|
942
|
+
* @return dependencyWebsite Project website URL for dependency
|
|
712
943
|
* @return availableOnChain Whether dependency is available on chain
|
|
713
944
|
* @return scriptCount Count of on-chain scripts for dependency
|
|
714
945
|
*/
|
|
715
946
|
function getDependencyDetails(
|
|
716
|
-
bytes32
|
|
947
|
+
bytes32 dependencyNameAndVersion
|
|
717
948
|
)
|
|
718
949
|
external
|
|
719
950
|
view
|
|
720
951
|
returns (
|
|
721
|
-
string memory
|
|
952
|
+
string memory nameAndVersion,
|
|
722
953
|
string memory licenseType,
|
|
723
954
|
string memory preferredCDN,
|
|
724
955
|
uint24 additionalCDNCount,
|
|
725
956
|
string memory preferredRepository,
|
|
726
957
|
uint24 additionalRepositoryCount,
|
|
727
|
-
string memory
|
|
958
|
+
string memory dependencyWebsite,
|
|
728
959
|
bool availableOnChain,
|
|
729
960
|
uint24 scriptCount
|
|
730
961
|
)
|
|
731
962
|
{
|
|
732
|
-
Dependency
|
|
963
|
+
DependencyRegistryStorageLib.Dependency
|
|
964
|
+
storage dependency = DependencyRegistryStorageLib
|
|
965
|
+
.s()
|
|
966
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
733
967
|
|
|
734
968
|
return (
|
|
735
|
-
|
|
969
|
+
dependencyNameAndVersion.toString(),
|
|
736
970
|
dependency.licenseType.toString(),
|
|
737
971
|
dependency.preferredCDN,
|
|
738
972
|
dependency.additionalCDNCount,
|
|
739
973
|
dependency.preferredRepository,
|
|
740
974
|
dependency.additionalRepositoryCount,
|
|
741
|
-
dependency.
|
|
975
|
+
dependency.website,
|
|
742
976
|
dependency.scriptCount > 0,
|
|
743
977
|
dependency.scriptCount
|
|
744
978
|
);
|
|
@@ -749,23 +983,27 @@ contract DependencyRegistryV0 is
|
|
|
749
983
|
* @return Number of supported core contracts.
|
|
750
984
|
*/
|
|
751
985
|
function getSupportedCoreContractCount() external view returns (uint256) {
|
|
752
|
-
return
|
|
986
|
+
return DependencyRegistryStorageLib.s().supportedCoreContracts.length();
|
|
753
987
|
}
|
|
754
988
|
|
|
755
989
|
/**
|
|
756
|
-
* @notice Returns the address of the supported core contract at index `
|
|
757
|
-
* @param
|
|
990
|
+
* @notice Returns the address of the supported core contract at index `index`.
|
|
991
|
+
* @param index Index of the core contract to be returned, relative to the overall
|
|
758
992
|
* list of supported core contracts.
|
|
759
993
|
* @return address of the core contract.
|
|
760
994
|
*/
|
|
761
995
|
function getSupportedCoreContract(
|
|
762
|
-
uint256
|
|
996
|
+
uint256 index
|
|
763
997
|
) external view returns (address) {
|
|
998
|
+
DependencyRegistryStorageLib.Storage
|
|
999
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
1000
|
+
|
|
764
1001
|
_onlyInRangeIndex({
|
|
765
|
-
|
|
766
|
-
|
|
1002
|
+
index: index,
|
|
1003
|
+
length: ds.supportedCoreContracts.length()
|
|
767
1004
|
});
|
|
768
|
-
|
|
1005
|
+
|
|
1006
|
+
return ds.supportedCoreContracts.at(index);
|
|
769
1007
|
}
|
|
770
1008
|
|
|
771
1009
|
/**
|
|
@@ -776,7 +1014,10 @@ contract DependencyRegistryV0 is
|
|
|
776
1014
|
function isSupportedCoreContract(
|
|
777
1015
|
address coreContractAddress
|
|
778
1016
|
) external view returns (bool) {
|
|
779
|
-
return
|
|
1017
|
+
return
|
|
1018
|
+
DependencyRegistryStorageLib.s().supportedCoreContracts.contains(
|
|
1019
|
+
coreContractAddress
|
|
1020
|
+
);
|
|
780
1021
|
}
|
|
781
1022
|
|
|
782
1023
|
/**
|
|
@@ -790,83 +1031,102 @@ contract DependencyRegistryV0 is
|
|
|
790
1031
|
view
|
|
791
1032
|
returns (address[] memory)
|
|
792
1033
|
{
|
|
793
|
-
|
|
1034
|
+
DependencyRegistryStorageLib.Storage
|
|
1035
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
1036
|
+
|
|
1037
|
+
uint256 supportedCoreContractCount = ds.supportedCoreContracts.length();
|
|
794
1038
|
address[] memory supportedCoreContracts = new address[](
|
|
795
1039
|
supportedCoreContractCount
|
|
796
1040
|
);
|
|
797
1041
|
|
|
798
|
-
for (uint256 i
|
|
799
|
-
supportedCoreContracts[i] =
|
|
1042
|
+
for (uint256 i; i < supportedCoreContractCount; ) {
|
|
1043
|
+
supportedCoreContracts[i] = ds.supportedCoreContracts.at(i);
|
|
1044
|
+
unchecked {
|
|
1045
|
+
++i;
|
|
1046
|
+
}
|
|
800
1047
|
}
|
|
801
1048
|
|
|
802
1049
|
return supportedCoreContracts;
|
|
803
1050
|
}
|
|
804
1051
|
|
|
805
1052
|
/**
|
|
806
|
-
* @notice Returns the additional CDN URL at index `
|
|
807
|
-
* @param
|
|
808
|
-
* @param
|
|
1053
|
+
* @notice Returns the additional CDN URL at index `index` for dependency `dependencyNameAndVersion`.
|
|
1054
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1055
|
+
* @param index The index of an additional CDN, relative to the overall `additionalCDNCount`.
|
|
809
1056
|
*/
|
|
810
1057
|
function getDependencyAdditionalCDN(
|
|
811
|
-
bytes32
|
|
812
|
-
uint256
|
|
1058
|
+
bytes32 dependencyNameAndVersion,
|
|
1059
|
+
uint256 index
|
|
813
1060
|
) external view returns (string memory) {
|
|
814
|
-
Dependency
|
|
1061
|
+
DependencyRegistryStorageLib.Dependency
|
|
1062
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1063
|
+
.s()
|
|
1064
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
815
1065
|
_onlyInRangeIndex({
|
|
816
|
-
|
|
817
|
-
|
|
1066
|
+
index: index,
|
|
1067
|
+
length: dependency.additionalCDNCount
|
|
818
1068
|
});
|
|
819
|
-
return dependency.additionalCDNs[
|
|
1069
|
+
return dependency.additionalCDNs[index];
|
|
820
1070
|
}
|
|
821
1071
|
|
|
822
1072
|
/**
|
|
823
|
-
* @notice Returns the additional repository URL at index `
|
|
824
|
-
* @param
|
|
825
|
-
* @param
|
|
1073
|
+
* @notice Returns the additional repository URL at index `index` for dependency `dependencyNameAndVersion`.
|
|
1074
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1075
|
+
* @param index The index of an additional repository, relative to the overall `additionalRepositoryCount`.
|
|
826
1076
|
*/
|
|
827
1077
|
function getDependencyAdditionalRepository(
|
|
828
|
-
bytes32
|
|
829
|
-
uint256
|
|
1078
|
+
bytes32 dependencyNameAndVersion,
|
|
1079
|
+
uint256 index
|
|
830
1080
|
) external view returns (string memory) {
|
|
831
|
-
Dependency
|
|
1081
|
+
DependencyRegistryStorageLib.Dependency
|
|
1082
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1083
|
+
.s()
|
|
1084
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
832
1085
|
_onlyInRangeIndex({
|
|
833
|
-
|
|
834
|
-
|
|
1086
|
+
index: index,
|
|
1087
|
+
length: dependency.additionalRepositoryCount
|
|
835
1088
|
});
|
|
836
|
-
return dependency.additionalRepositories[
|
|
1089
|
+
return dependency.additionalRepositories[index];
|
|
837
1090
|
}
|
|
838
1091
|
|
|
839
1092
|
/**
|
|
840
|
-
* @notice Returns the count of scripts for dependency `
|
|
841
|
-
* @param
|
|
1093
|
+
* @notice Returns the count of scripts for dependency `dependencyNameAndVersion`.
|
|
1094
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
842
1095
|
*/
|
|
843
1096
|
function getDependencyScriptCount(
|
|
844
|
-
bytes32
|
|
1097
|
+
bytes32 dependencyNameAndVersion
|
|
845
1098
|
) external view returns (uint256) {
|
|
846
|
-
return
|
|
1099
|
+
return
|
|
1100
|
+
DependencyRegistryStorageLib
|
|
1101
|
+
.s()
|
|
1102
|
+
.dependencyRecords[dependencyNameAndVersion]
|
|
1103
|
+
.scriptCount;
|
|
847
1104
|
}
|
|
848
1105
|
|
|
849
1106
|
/**
|
|
850
1107
|
* @notice Returns address with bytecode containing script for
|
|
851
|
-
* dependency `_dependencyTypes` at script index `
|
|
852
|
-
* @param
|
|
853
|
-
* @param
|
|
1108
|
+
* dependency `_dependencyTypes` at script index `index`.
|
|
1109
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1110
|
+
* @param index The index of a given script, relative to the overall `scriptCount`.
|
|
854
1111
|
* @return The address of the bytecode storage for the script at the given index, if it can be determined.
|
|
855
1112
|
*/
|
|
856
1113
|
function getDependencyScriptBytecodeAddress(
|
|
857
|
-
bytes32
|
|
858
|
-
uint256
|
|
1114
|
+
bytes32 dependencyNameAndVersion,
|
|
1115
|
+
uint256 index
|
|
859
1116
|
) external view returns (address) {
|
|
860
|
-
Dependency
|
|
861
|
-
|
|
862
|
-
|
|
1117
|
+
DependencyRegistryStorageLib.Dependency
|
|
1118
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1119
|
+
.s()
|
|
1120
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
1121
|
+
_onlyInRangeIndex({index: index, length: dependency.scriptCount});
|
|
1122
|
+
return dependency.scriptBytecodeAddresses[index];
|
|
863
1123
|
}
|
|
864
1124
|
|
|
865
1125
|
/**
|
|
866
1126
|
* @notice Returns the storage library version for
|
|
867
|
-
* dependency `_dependencyTypes` at script index `
|
|
868
|
-
* @param
|
|
869
|
-
* @param
|
|
1127
|
+
* dependency `_dependencyTypes` at script index `index`.
|
|
1128
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1129
|
+
* @param index The index of a given script, relative to the overall `scriptCount`.
|
|
870
1130
|
* @return The storage library version for the script at the given index, if it can be determined.
|
|
871
1131
|
* @dev Note that we only expect this to be determinable if the script was written using a version
|
|
872
1132
|
* of the Art Blocks `BytecodeStorage` library, and in other cases the fallback will be the
|
|
@@ -875,23 +1135,24 @@ contract DependencyRegistryV0 is
|
|
|
875
1135
|
* that can be fallback-read optimistically.
|
|
876
1136
|
*/
|
|
877
1137
|
function getDependencyScriptBytecodeStorageVersion(
|
|
878
|
-
bytes32
|
|
879
|
-
uint256
|
|
1138
|
+
bytes32 dependencyNameAndVersion,
|
|
1139
|
+
uint256 index
|
|
880
1140
|
) external view returns (bytes32) {
|
|
881
|
-
Dependency
|
|
882
|
-
|
|
1141
|
+
DependencyRegistryStorageLib.Dependency
|
|
1142
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1143
|
+
.s()
|
|
1144
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
1145
|
+
_onlyInRangeIndex({index: index, length: dependency.scriptCount});
|
|
883
1146
|
return
|
|
884
1147
|
BytecodeStorageReader.getLibraryVersionForBytecode(
|
|
885
|
-
|
|
886
|
-
_index
|
|
887
|
-
]
|
|
1148
|
+
dependency.scriptBytecodeAddresses[index]
|
|
888
1149
|
);
|
|
889
1150
|
}
|
|
890
1151
|
|
|
891
1152
|
/**
|
|
892
|
-
* @notice Returns script for dependency `
|
|
893
|
-
* @param
|
|
894
|
-
* @param
|
|
1153
|
+
* @notice Returns script for dependency `dependencyNameAndVersion` at script index `index`.
|
|
1154
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1155
|
+
* @param index The index of a given script, relative to the overall `scriptCount`.
|
|
895
1156
|
* @return A string containing the script content at the given script chunk index for a given dependency.
|
|
896
1157
|
* @dev This method attempts to introspectively determine which library version of
|
|
897
1158
|
* `BytecodeStorage` was used to write the stored script string that is being
|
|
@@ -902,13 +1163,16 @@ contract DependencyRegistryV0 is
|
|
|
902
1163
|
* can cause failure (e.g. unexpected continuation byte).
|
|
903
1164
|
*/
|
|
904
1165
|
function getDependencyScript(
|
|
905
|
-
bytes32
|
|
906
|
-
uint256
|
|
1166
|
+
bytes32 dependencyNameAndVersion,
|
|
1167
|
+
uint256 index
|
|
907
1168
|
) external view returns (string memory) {
|
|
908
|
-
Dependency
|
|
909
|
-
|
|
1169
|
+
DependencyRegistryStorageLib.Dependency
|
|
1170
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1171
|
+
.s()
|
|
1172
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
1173
|
+
_onlyInRangeIndex({index: index, length: dependency.scriptCount});
|
|
910
1174
|
|
|
911
|
-
address scriptAddress = dependency.scriptBytecodeAddresses[
|
|
1175
|
+
address scriptAddress = dependency.scriptBytecodeAddresses[index];
|
|
912
1176
|
bytes32 storageVersion = BytecodeStorageReader
|
|
913
1177
|
.getLibraryVersionForBytecode(scriptAddress);
|
|
914
1178
|
|
|
@@ -925,30 +1189,31 @@ contract DependencyRegistryV0 is
|
|
|
925
1189
|
}
|
|
926
1190
|
|
|
927
1191
|
/**
|
|
928
|
-
* @notice Returns the dependency
|
|
1192
|
+
* @notice Returns the dependency name and version for a given project (`projectId`)
|
|
929
1193
|
* on a given core contract (`_contractAddress`). If no override is set,
|
|
930
1194
|
* the core contract is called to retrieve the script type and version as
|
|
931
1195
|
* dependency type. For any contract earlier than v3, that does not have
|
|
932
1196
|
* an override set, this will revert.
|
|
933
|
-
* @param
|
|
934
|
-
* @param
|
|
935
|
-
* @return dependencyType Identifier for the dependency (i.e. "
|
|
1197
|
+
* @param contractAddress Core contract address.
|
|
1198
|
+
* @param projectId Project to return dependency type for.
|
|
1199
|
+
* @return dependencyType Identifier for the dependency (i.e. "name@version") used by project.
|
|
936
1200
|
*/
|
|
937
|
-
function
|
|
938
|
-
address
|
|
939
|
-
uint256
|
|
1201
|
+
function getDependencyNameAndVersionForProject(
|
|
1202
|
+
address contractAddress,
|
|
1203
|
+
uint256 projectId
|
|
940
1204
|
) external view returns (string memory) {
|
|
941
|
-
_onlySupportedCoreContract(
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1205
|
+
_onlySupportedCoreContract(contractAddress);
|
|
1206
|
+
|
|
1207
|
+
bytes32 dependencyNameAndVersion = DependencyRegistryStorageLib
|
|
1208
|
+
.s()
|
|
1209
|
+
.projectDependencyOverrides[contractAddress][projectId];
|
|
1210
|
+
if (dependencyNameAndVersion != bytes32(0)) {
|
|
1211
|
+
return dependencyNameAndVersion.toString();
|
|
947
1212
|
}
|
|
948
1213
|
|
|
949
1214
|
try
|
|
950
|
-
IDependencyRegistryCompatibleV0(
|
|
951
|
-
.projectScriptDetails(
|
|
1215
|
+
IDependencyRegistryCompatibleV0(contractAddress)
|
|
1216
|
+
.projectScriptDetails(projectId)
|
|
952
1217
|
returns (string memory scriptTypeAndVersion, string memory, uint256) {
|
|
953
1218
|
return scriptTypeAndVersion;
|
|
954
1219
|
} catch {
|
|
@@ -964,13 +1229,13 @@ contract DependencyRegistryV0 is
|
|
|
964
1229
|
* determined by this contract's current Admin ACL contract. Expected use
|
|
965
1230
|
* cases include minter contracts checking if caller is allowed to call
|
|
966
1231
|
* admin-gated functions on minter contracts.
|
|
967
|
-
* @param
|
|
968
|
-
* `
|
|
969
|
-
* @param
|
|
970
|
-
* @param
|
|
971
|
-
* `
|
|
972
|
-
* @return bool Whether `
|
|
973
|
-
* `
|
|
1232
|
+
* @param sender Address of the sender calling function with selector
|
|
1233
|
+
* `selector` on contract `contract_`.
|
|
1234
|
+
* @param contract_ Address of the contract being called by `sender`.
|
|
1235
|
+
* @param selector Function selector of the function being called by
|
|
1236
|
+
* `sender`.
|
|
1237
|
+
* @return bool Whether `sender` is allowed to call function with selector
|
|
1238
|
+
* `selector` on contract `contract_`.
|
|
974
1239
|
* @dev assumes the Admin ACL contract is the owner of this contract, which
|
|
975
1240
|
* is expected to always be true.
|
|
976
1241
|
* @dev adminACLContract is expected to either be null address (if owner
|
|
@@ -978,13 +1243,17 @@ contract DependencyRegistryV0 is
|
|
|
978
1243
|
* null address first to avoid revert when admin has renounced ownership.
|
|
979
1244
|
*/
|
|
980
1245
|
function adminACLAllowed(
|
|
981
|
-
address
|
|
982
|
-
address
|
|
983
|
-
bytes4
|
|
1246
|
+
address sender,
|
|
1247
|
+
address contract_,
|
|
1248
|
+
bytes4 selector
|
|
984
1249
|
) public returns (bool) {
|
|
985
1250
|
return
|
|
986
1251
|
owner() != address(0) &&
|
|
987
|
-
adminACLContract.allowed(
|
|
1252
|
+
DependencyRegistryStorageLib.s().adminACLContract.allowed(
|
|
1253
|
+
sender,
|
|
1254
|
+
contract_,
|
|
1255
|
+
selector
|
|
1256
|
+
);
|
|
988
1257
|
}
|
|
989
1258
|
|
|
990
1259
|
/**
|
|
@@ -1003,6 +1272,14 @@ contract DependencyRegistryV0 is
|
|
|
1003
1272
|
return OwnableUpgradeable.owner();
|
|
1004
1273
|
}
|
|
1005
1274
|
|
|
1275
|
+
/**
|
|
1276
|
+
* @notice This function returns the address of the admin ACL contract.
|
|
1277
|
+
* @return address Address of the admin ACL contract.
|
|
1278
|
+
*/
|
|
1279
|
+
function adminACLContract() public view returns (address) {
|
|
1280
|
+
return address(DependencyRegistryStorageLib.s().adminACLContract);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1006
1283
|
/**
|
|
1007
1284
|
* @notice Transfers ownership of the contract to a new account (`newOwner`).
|
|
1008
1285
|
* Internal function without access restriction.
|
|
@@ -1013,6 +1290,8 @@ contract DependencyRegistryV0 is
|
|
|
1013
1290
|
*/
|
|
1014
1291
|
function _transferOwnership(address newOwner) internal override {
|
|
1015
1292
|
OwnableUpgradeable._transferOwnership(newOwner);
|
|
1016
|
-
adminACLContract = IAdminACLV0(
|
|
1293
|
+
DependencyRegistryStorageLib.s().adminACLContract = IAdminACLV0(
|
|
1294
|
+
newOwner
|
|
1295
|
+
);
|
|
1017
1296
|
}
|
|
1018
1297
|
}
|