@artblocks/contracts 1.1.0 → 1.2.1
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 +86 -34
- package/artifacts/contracts/AdminACLV0.sol/AdminACLV0.json +2 -2
- package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
- package/artifacts/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2.sol/BytecodeStorageReaderContractV2.json +201 -0
- package/artifacts/contracts/BytecodeStorageReaders/UniversalBytecodeStorageReader.sol/UniversalBytecodeStorageReader.json +154 -0
- package/artifacts/contracts/BytecodeStorageV2Writer.sol/BytecodeStorageV2Writer.json +87 -0
- package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +403 -155
- package/artifacts/contracts/GenArt721CoreV3_Curated.sol/GenArt721CoreV3_Curated.json +2493 -0
- package/artifacts/contracts/OwnedCreate2FactoryV0.sol/OwnedCreate2FactoryV0.json +311 -0
- package/artifacts/contracts/archive/GenArt721CoreV3.sol/GenArt721CoreV3.json +2060 -0
- package/artifacts/contracts/archive/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +2034 -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 +54 -49
- 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 +624 -0
- package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +613 -216
- package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +805 -206
- package/artifacts/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol/GenArt721CoreV3_Engine_Flex_PROOF.json +51 -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 +51 -8
- package/artifacts/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.json +59 -54
- package/artifacts/contracts/engine-registry/CoreRegistryV1.sol/CoreRegistryV1.json +2 -2
- package/artifacts/contracts/generator/AddressChunks.sol/AddressChunks.json +10 -0
- package/artifacts/contracts/generator/GenArt721GeneratorV0.sol/GenArt721GeneratorV0.json +333 -0
- package/artifacts/contracts/generator/GenArt721GeneratorV0.sol/ILegacyGenArt721CoreV2_PBAB_Flex.json +47 -0
- package/artifacts/contracts/interfaces/v0.8.x/IAdminACLV0_Extended.sol/IAdminACLV0_Extended.json +140 -0
- package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReader.sol/IBytecodeStorageReader.json +7 -7
- package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReaderV2.sol/IBytecodeStorageReaderV2.json +130 -0
- package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReader_Base.sol/IBytecodeStorageReader_Base.json +30 -0
- package/artifacts/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol/ICoreRegistryV1.json +13 -0
- package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +228 -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 +53 -48
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol/IGenArt721CoreContractV3_Base.json +53 -48
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol/IGenArt721CoreContractV3_Engine.json +198 -90
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol/IGenArt721CoreContractV3_Engine_Flex.json +198 -90
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.sol/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.json +1065 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_PreV3p2.sol/IGenArt721CoreContractV3_Engine_PreV3p2.json +778 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_ProjectFinance.sol/IGenArt721CoreContractV3_ProjectFinance.json +87 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV0.sol/IGenArt721CoreProjectScriptV0.json +59 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV1.sol/IGenArt721CoreProjectScriptV1.json +64 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV0.sol/IGenArt721CoreTokenHashProviderV0.json +30 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV1.sol/IGenArt721CoreTokenHashProviderV1.json +30 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721GeneratorV0.sol/IGenArt721GeneratorV0.json +63 -0
- package/artifacts/contracts/interfaces/v0.8.x/IGenArt721Minter_PBAB.sol/IGenArt721Minter_PBAB.json +279 -0
- package/artifacts/contracts/interfaces/v0.8.x/IOwnedCreate2FactoryV0.sol/IOwnedCreate2FactoryV0.json +74 -0
- package/artifacts/contracts/interfaces/v0.8.x/IPseudorandomAtomic.sol/IPseudorandomAtomic.json +1 -1
- package/artifacts/contracts/interfaces/v0.8.x/ISeaDropShimForContract.sol/ISeaDropShimForContract.json +37 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAExpSettlementV0.sol/ISharedMinterDAExpSettlementV0.json +18 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterMinPriceV0.sol/ISharedMinterMinPriceV0.json +37 -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/IUniversalBytecodeStorageReader.sol/IUniversalBytecodeStorageReader.json +56 -0
- package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ERC721SeaDropStructsErrorsAndEvents.sol/ERC721SeaDropStructsErrorsAndEvents.json +43 -0
- package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/INonFungibleSeaDropToken.sol/INonFungibleSeaDropToken.json +715 -0
- package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDrop.sol/ISeaDrop.json +1571 -0
- package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDropTokenContractMetadata.sol/ISeaDropTokenContractMetadata.json +345 -0
- package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/SeaDropErrorsAndEvents.sol/SeaDropErrorsAndEvents.json +717 -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/JsonStatic.sol/JsonStatic.json +10 -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 +195 -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/MinPriceLib.sol/MinPriceLib.json +24 -0
- package/artifacts/contracts/libs/v0.8.x/minter-libs/PolyptychLib.sol/PolyptychLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/RAMLib.sol/RAMLib.json +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/MinterMinPriceMerkleV0.sol/MinterMinPriceMerkleV0.json +664 -0
- package/artifacts/contracts/minter-suite/Minters/MinterMinPriceV0.sol/MinterMinPriceV0.json +387 -0
- 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/minter-suite/Minters/one-off/SeaDropXArtBlocksShim.sol/SeaDropXArtBlocksShim.json +1206 -0
- package/artifacts/contracts/mock/BytecodeV1LibCallsMock.sol/BytecodeV1LibCallsMock.json +2 -2
- 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/ERC20MockAltDecimals.sol/ERC20MockAltDecimals.json +318 -0
- 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/MockFileStore.sol/MockFileStore.json +35 -0
- package/artifacts/contracts/mock/OriginRegisterMock.sol/OriginRegisterMock.json +2 -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/BytecodeStorageReaders/BytecodeStorageReaderContractV2.sol +103 -0
- package/contracts/BytecodeStorageReaders/UniversalBytecodeStorageReader.sol +70 -0
- package/contracts/BytecodeStorageV2Writer.sol +69 -0
- package/contracts/DependencyRegistryV0.sol +878 -430
- package/contracts/GenArt721CoreV3_Curated.sol +133 -0
- package/contracts/OwnedCreate2FactoryV0.sol +173 -0
- 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 +427 -0
- package/contracts/engine/V3/GenArt721CoreV3_Engine.sol +977 -502
- package/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol +1137 -663
- 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/generator/AddressChunks.sol +106 -0
- package/contracts/generator/GenArt721GeneratorV0.sol +1094 -0
- package/contracts/generator/scripty-support/Scripty.sol +5 -0
- package/contracts/interfaces/v0.8.x/IAdminACLV0_Extended.sol +20 -0
- package/contracts/interfaces/v0.8.x/IBytecodeStorageReader.sol +34 -36
- package/contracts/interfaces/v0.8.x/IBytecodeStorageReaderV2.sol +25 -0
- package/contracts/interfaces/v0.8.x/IBytecodeStorageReader_Base.sol +20 -0
- package/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol +5 -0
- package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +141 -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 +126 -11
- package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol +86 -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/IGenArt721CoreProjectScriptV0.sol +22 -0
- package/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV1.sol +23 -0
- package/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV0.sol +11 -0
- package/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV1.sol +9 -0
- package/contracts/interfaces/v0.8.x/IGenArt721GeneratorV0.sol +14 -0
- package/contracts/interfaces/v0.8.x/IGenArt721Minter_PBAB.sol +91 -0
- package/contracts/interfaces/v0.8.x/IOwnedCreate2FactoryV0.sol +40 -0
- package/contracts/interfaces/v0.8.x/IPseudorandomAtomic.sol +1 -3
- package/contracts/interfaces/v0.8.x/ISeaDropShimForContract.sol +19 -0
- package/contracts/interfaces/v0.8.x/ISharedMinterDAExpSettlementV0.sol +19 -0
- package/contracts/interfaces/v0.8.x/ISharedMinterMinPriceV0.sol +22 -0
- package/contracts/interfaces/v0.8.x/ISharedMinterRAMV0.sol +23 -0
- package/contracts/interfaces/v0.8.x/ISharedMinterRequired.sol +26 -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/IUniversalBytecodeStorageReader.sol +28 -0
- package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ERC721SeaDropStructsErrorsAndEvents.sol +58 -0
- package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/INonFungibleSeaDropToken.sol +186 -0
- package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDrop.sol +337 -0
- package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDropTokenContractMetadata.sol +152 -0
- package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/SeaDropErrorsAndEvents.sol +320 -0
- package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/SeaDropStructs.sol +146 -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/Bytes32Strings.sol +20 -0
- package/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol +98 -0
- package/contracts/libs/v0.8.x/ERC721_PackedHashSeedV1.sol +591 -0
- package/contracts/libs/v0.8.x/JsonStatic.sol +373 -0
- package/contracts/libs/v0.8.x/PackedBools.sol +42 -0
- package/contracts/libs/v0.8.x/V3FlexLib.sol +597 -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/MinPriceLib.sol +64 -0
- 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 +128 -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/MinterMinPriceMerkleV0.sol +765 -0
- package/contracts/minter-suite/Minters/MinterMinPriceV0.sol +462 -0
- 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/minter-suite/Minters/one-off/SeaDropXArtBlocksShim.sol +869 -0
- package/contracts/mock/BytecodeV2LibCallsMock.sol +128 -0
- package/contracts/mock/BytecodeV2TextCR_DMock.sol +316 -0
- package/contracts/mock/ERC20MockAltDecimals.sol +31 -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/MockFileStore.sol +22 -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 +66 -36
- 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
|
@@ -6,6 +6,7 @@ pragma solidity 0.8.19;
|
|
|
6
6
|
import "./interfaces/v0.8.x/IAdminACLV0.sol";
|
|
7
7
|
import "./interfaces/v0.8.x/IDependencyRegistryCompatibleV0.sol";
|
|
8
8
|
import "./interfaces/v0.8.x/IDependencyRegistryV0.sol";
|
|
9
|
+
import "./interfaces/v0.8.x/ICoreRegistryV1.sol";
|
|
9
10
|
|
|
10
11
|
import "@openzeppelin-4.7/contracts/utils/Strings.sol";
|
|
11
12
|
import "@openzeppelin-4.7/contracts/utils/structs/EnumerableSet.sol";
|
|
@@ -13,6 +14,7 @@ import "@openzeppelin-4.8/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
|
13
14
|
import "@openzeppelin-4.8/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
14
15
|
import "@openzeppelin-4.5/contracts/utils/math/SafeCast.sol";
|
|
15
16
|
|
|
17
|
+
import "./libs/v0.8.x/DependencyRegistryStorageLib.sol";
|
|
16
18
|
import "./libs/v0.8.x/BytecodeStorageV1.sol";
|
|
17
19
|
import "./libs/v0.8.x/Bytes32Strings.sol";
|
|
18
20
|
|
|
@@ -21,7 +23,7 @@ import "./libs/v0.8.x/Bytes32Strings.sol";
|
|
|
21
23
|
* @author Art Blocks Inc.
|
|
22
24
|
* @notice Privileged Roles and Ownership:
|
|
23
25
|
* Permissions managed by ACL contract. If/when we ever call
|
|
24
|
-
* renounceOwnership() this will
|
|
26
|
+
* renounceOwnership() this will become a frozen, immutable registry
|
|
25
27
|
* as no upgrades will be possible.
|
|
26
28
|
* This contract is intended to be an auxiliary reference registry
|
|
27
29
|
* to our non-upgradeable and immutable ERC-721 conforming core contracts,
|
|
@@ -35,6 +37,7 @@ contract DependencyRegistryV0 is
|
|
|
35
37
|
{
|
|
36
38
|
using BytecodeStorageWriter for string;
|
|
37
39
|
using Bytes32Strings for bytes32;
|
|
40
|
+
using Bytes32Strings for string;
|
|
38
41
|
using Strings for uint256;
|
|
39
42
|
using EnumerableSet for EnumerableSet.Bytes32Set;
|
|
40
43
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
@@ -42,157 +45,170 @@ contract DependencyRegistryV0 is
|
|
|
42
45
|
|
|
43
46
|
uint8 constant AT_CHARACTER_CODE = uint8(bytes1("@")); // 0x40
|
|
44
47
|
|
|
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;
|
|
48
|
+
function _onlyNonZeroAddress(address address_) internal pure {
|
|
49
|
+
require(address_ != address(0), "Must input non-zero address");
|
|
62
50
|
}
|
|
63
51
|
|
|
64
|
-
|
|
65
|
-
|
|
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");
|
|
52
|
+
function _onlyNonEmptyString(string memory string_) internal pure {
|
|
53
|
+
require(bytes(string_).length != 0, "Must input non-empty string");
|
|
77
54
|
}
|
|
78
55
|
|
|
79
|
-
function
|
|
80
|
-
require(bytes(_string).length != 0, "Must input non-empty string");
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function _onlyAdminACL(bytes4 _selector) internal {
|
|
56
|
+
function _onlyAdminACL(bytes4 selector) internal {
|
|
84
57
|
require(
|
|
85
|
-
adminACLAllowed(
|
|
58
|
+
adminACLAllowed({
|
|
59
|
+
sender: msg.sender,
|
|
60
|
+
contract_: address(this),
|
|
61
|
+
selector: selector
|
|
62
|
+
}),
|
|
86
63
|
"Only Admin ACL allowed"
|
|
87
64
|
);
|
|
88
65
|
}
|
|
89
66
|
|
|
90
67
|
function _onlySupportedCoreContract(
|
|
91
|
-
address
|
|
68
|
+
address coreContractAddress
|
|
92
69
|
) internal view {
|
|
70
|
+
// defer to public function logic
|
|
93
71
|
require(
|
|
94
|
-
|
|
72
|
+
isSupportedCoreContract(coreContractAddress),
|
|
95
73
|
"Core contract not supported"
|
|
96
74
|
);
|
|
97
75
|
}
|
|
98
76
|
|
|
99
|
-
function
|
|
100
|
-
bytes32
|
|
77
|
+
function _onlyExistingDependency(
|
|
78
|
+
bytes32 dependencyNameAndVersion
|
|
101
79
|
) internal view {
|
|
102
80
|
require(
|
|
103
|
-
|
|
104
|
-
|
|
81
|
+
DependencyRegistryStorageLib.s().dependencyNameVersionIds.contains(
|
|
82
|
+
dependencyNameAndVersion
|
|
83
|
+
),
|
|
84
|
+
"Dependency does not exist"
|
|
105
85
|
);
|
|
106
86
|
}
|
|
107
87
|
|
|
108
|
-
function _onlyInRangeIndex(uint256
|
|
109
|
-
require(
|
|
88
|
+
function _onlyInRangeIndex(uint256 index, uint256 length) internal pure {
|
|
89
|
+
require(index < length, "Index out of range");
|
|
110
90
|
}
|
|
111
91
|
|
|
112
|
-
function _onlyExistingLicenseType(bytes32
|
|
92
|
+
function _onlyExistingLicenseType(bytes32 licenseType) internal view {
|
|
113
93
|
require(
|
|
114
|
-
|
|
94
|
+
DependencyRegistryStorageLib.s().licenseTypes.contains(licenseType),
|
|
115
95
|
"License type does not exist"
|
|
116
96
|
);
|
|
117
97
|
}
|
|
118
98
|
|
|
99
|
+
function _onlyBytes32String(string memory input) internal pure {
|
|
100
|
+
require(bytes(input).length <= 32, "String too long");
|
|
101
|
+
}
|
|
102
|
+
|
|
119
103
|
/**
|
|
120
104
|
* @notice Initializes contract.
|
|
121
|
-
* @param
|
|
105
|
+
* @param adminACLContract_ Address of admin access control contract, to be
|
|
122
106
|
* set as contract owner.
|
|
123
107
|
*/
|
|
124
|
-
function initialize(address
|
|
108
|
+
function initialize(address adminACLContract_) public initializer {
|
|
125
109
|
__Ownable_init();
|
|
110
|
+
|
|
126
111
|
// set AdminACL management contract as owner
|
|
127
|
-
_transferOwnership(
|
|
112
|
+
_transferOwnership(adminACLContract_);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @notice Updates the core registry address.
|
|
117
|
+
* @param _coreRegistryAddress Address of core registry contract.
|
|
118
|
+
*/
|
|
119
|
+
function updateCoreRegistryAddress(address _coreRegistryAddress) external {
|
|
120
|
+
_onlyAdminACL(this.updateCoreRegistryAddress.selector);
|
|
121
|
+
_onlyNonZeroAddress(_coreRegistryAddress);
|
|
122
|
+
DependencyRegistryStorageLib.s().coreRegistryContract = ICoreRegistryV1(
|
|
123
|
+
_coreRegistryAddress
|
|
124
|
+
);
|
|
125
|
+
emit CoreRegistryAddressUpdated({
|
|
126
|
+
coreRegistryAddress: _coreRegistryAddress
|
|
127
|
+
});
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* @notice Adds a new license type that can be used by dependencies.
|
|
132
|
+
* @param licenseType License type to be added.
|
|
132
133
|
*/
|
|
133
|
-
function addLicenseType(bytes32
|
|
134
|
+
function addLicenseType(bytes32 licenseType) external {
|
|
134
135
|
_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
136
|
require(
|
|
138
|
-
|
|
137
|
+
licenseType != bytes32(""),
|
|
139
138
|
"License type cannot be empty string"
|
|
140
139
|
);
|
|
141
|
-
|
|
140
|
+
|
|
141
|
+
// @dev the add function returns false if set already contains value
|
|
142
|
+
require(
|
|
143
|
+
DependencyRegistryStorageLib.s().licenseTypes.add(licenseType),
|
|
144
|
+
"License type already exists"
|
|
145
|
+
);
|
|
146
|
+
emit LicenseTypeAdded(licenseType);
|
|
142
147
|
}
|
|
143
148
|
|
|
144
149
|
/**
|
|
145
150
|
* @notice Adds a new dependency.
|
|
146
|
-
* @param
|
|
147
|
-
* @param
|
|
148
|
-
* @param
|
|
149
|
-
* @param
|
|
151
|
+
* @param dependencyNameAndVersion A unique identifier for the dependency, composed of its name and version in the format "name@version".
|
|
152
|
+
* @param licenseType License type for dependency, must be a registered license type.
|
|
153
|
+
* @param preferredCDN Preferred CDN for dependency.
|
|
154
|
+
* @param preferredRepository Preferred repository for dependency.
|
|
150
155
|
*/
|
|
151
156
|
function addDependency(
|
|
152
|
-
bytes32
|
|
153
|
-
bytes32
|
|
154
|
-
string memory
|
|
155
|
-
string memory
|
|
156
|
-
string memory
|
|
157
|
+
bytes32 dependencyNameAndVersion,
|
|
158
|
+
bytes32 licenseType,
|
|
159
|
+
string memory preferredCDN,
|
|
160
|
+
string memory preferredRepository,
|
|
161
|
+
string memory dependencyWebsite
|
|
157
162
|
) external {
|
|
158
163
|
_onlyAdminACL(this.addDependency.selector);
|
|
159
|
-
_onlyExistingLicenseType(
|
|
164
|
+
_onlyExistingLicenseType(licenseType);
|
|
160
165
|
require(
|
|
161
|
-
|
|
166
|
+
dependencyNameAndVersion.containsExactCharacterQty(
|
|
162
167
|
AT_CHARACTER_CODE,
|
|
163
168
|
uint8(1)
|
|
164
169
|
),
|
|
165
170
|
"must contain exactly one @"
|
|
166
171
|
);
|
|
172
|
+
|
|
173
|
+
DependencyRegistryStorageLib.Storage
|
|
174
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
175
|
+
|
|
167
176
|
require(
|
|
168
177
|
// @dev the add function returns false if set already contains value
|
|
169
|
-
|
|
170
|
-
"Dependency
|
|
178
|
+
ds.dependencyNameVersionIds.add(dependencyNameAndVersion),
|
|
179
|
+
"Dependency already exists"
|
|
171
180
|
);
|
|
172
181
|
|
|
173
|
-
Dependency storage dependency =
|
|
174
|
-
|
|
175
|
-
dependency.
|
|
176
|
-
dependency.
|
|
177
|
-
dependency.
|
|
182
|
+
DependencyRegistryStorageLib.Dependency storage dependency = ds
|
|
183
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
184
|
+
dependency.licenseType = licenseType;
|
|
185
|
+
dependency.preferredCDN = preferredCDN;
|
|
186
|
+
dependency.preferredRepository = preferredRepository;
|
|
187
|
+
dependency.website = dependencyWebsite;
|
|
178
188
|
|
|
179
189
|
emit DependencyAdded(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
190
|
+
dependencyNameAndVersion,
|
|
191
|
+
licenseType,
|
|
192
|
+
preferredCDN,
|
|
193
|
+
preferredRepository,
|
|
194
|
+
dependencyWebsite
|
|
185
195
|
);
|
|
186
196
|
}
|
|
187
197
|
|
|
188
198
|
/**
|
|
189
199
|
* @notice Removes a dependency.
|
|
190
|
-
* @param
|
|
200
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
191
201
|
*/
|
|
192
|
-
function removeDependency(bytes32
|
|
202
|
+
function removeDependency(bytes32 dependencyNameAndVersion) external {
|
|
193
203
|
_onlyAdminACL(this.removeDependency.selector);
|
|
194
|
-
|
|
195
|
-
|
|
204
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
205
|
+
|
|
206
|
+
DependencyRegistryStorageLib.Storage
|
|
207
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
208
|
+
|
|
209
|
+
DependencyRegistryStorageLib.Dependency storage dependency = ds
|
|
210
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
211
|
+
|
|
196
212
|
require(
|
|
197
213
|
dependency.additionalCDNCount == 0 &&
|
|
198
214
|
dependency.additionalRepositoryCount == 0 &&
|
|
@@ -200,115 +216,139 @@ contract DependencyRegistryV0 is
|
|
|
200
216
|
"Cannot remove dependency with additional CDNs, repositories, or scripts"
|
|
201
217
|
);
|
|
202
218
|
|
|
203
|
-
|
|
204
|
-
|
|
219
|
+
ds.dependencyNameVersionIds.remove(dependencyNameAndVersion);
|
|
220
|
+
// @dev all of the arrays in the dependency struct are required to be empty
|
|
221
|
+
// before this function can be called, so we don't need to delete them here
|
|
222
|
+
delete ds.dependencyRecords[dependencyNameAndVersion];
|
|
205
223
|
|
|
206
|
-
emit DependencyRemoved(
|
|
224
|
+
emit DependencyRemoved(dependencyNameAndVersion);
|
|
207
225
|
}
|
|
208
226
|
|
|
209
227
|
/**
|
|
210
|
-
* @notice Adds a script to dependency `
|
|
228
|
+
* @notice Adds a script to dependency `dependencyNameAndVersion`, by way of
|
|
211
229
|
* providing a string to write to bytecode storage.
|
|
212
|
-
* @param
|
|
213
|
-
* @param
|
|
230
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
231
|
+
* @param script Script to be added. Required to be a non-empty string,
|
|
214
232
|
* but no further validation is performed.
|
|
215
233
|
*/
|
|
216
234
|
function addDependencyScript(
|
|
217
|
-
bytes32
|
|
218
|
-
string memory
|
|
235
|
+
bytes32 dependencyNameAndVersion,
|
|
236
|
+
string memory script
|
|
219
237
|
) external {
|
|
220
238
|
_onlyAdminACL(this.addDependencyScript.selector);
|
|
221
|
-
_onlyNonEmptyString(
|
|
222
|
-
|
|
223
|
-
|
|
239
|
+
_onlyNonEmptyString(script);
|
|
240
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
241
|
+
|
|
242
|
+
DependencyRegistryStorageLib.Dependency
|
|
243
|
+
storage dependency = DependencyRegistryStorageLib
|
|
244
|
+
.s()
|
|
245
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
224
246
|
// store script in contract bytecode
|
|
225
|
-
dependency.scriptBytecodeAddresses[dependency.scriptCount] =
|
|
247
|
+
dependency.scriptBytecodeAddresses[dependency.scriptCount] = script
|
|
226
248
|
.writeToBytecode();
|
|
227
249
|
dependency.scriptCount = dependency.scriptCount + 1;
|
|
228
250
|
|
|
229
|
-
emit DependencyScriptUpdated(
|
|
251
|
+
emit DependencyScriptUpdated(dependencyNameAndVersion);
|
|
230
252
|
}
|
|
231
253
|
|
|
232
254
|
/**
|
|
233
|
-
* @notice Updates script for dependencyType `
|
|
255
|
+
* @notice Updates script for dependencyType `dependencyNameAndVersion` at script `index`,
|
|
234
256
|
* by way of providing a string to write to bytecode storage.
|
|
235
|
-
* @param
|
|
236
|
-
* @param
|
|
237
|
-
* @param
|
|
257
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
258
|
+
* @param index The index of a given script, relative to the overall `scriptCount`.
|
|
259
|
+
* @param script The updated script value. Required to be a non-empty
|
|
238
260
|
* string, but no further validation is performed.
|
|
239
261
|
*/
|
|
240
262
|
function updateDependencyScript(
|
|
241
|
-
bytes32
|
|
242
|
-
uint256
|
|
243
|
-
string memory
|
|
263
|
+
bytes32 dependencyNameAndVersion,
|
|
264
|
+
uint256 index,
|
|
265
|
+
string memory script
|
|
244
266
|
) external {
|
|
245
267
|
_onlyAdminACL(this.updateDependencyScript.selector);
|
|
246
|
-
_onlyNonEmptyString(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
268
|
+
_onlyNonEmptyString(script);
|
|
269
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
270
|
+
|
|
271
|
+
DependencyRegistryStorageLib.Dependency
|
|
272
|
+
storage dependency = DependencyRegistryStorageLib
|
|
273
|
+
.s()
|
|
274
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
275
|
+
_onlyInRangeIndex({index: index, length: dependency.scriptCount});
|
|
250
276
|
// store script in contract bytecode, replacing reference address from
|
|
251
277
|
// the contract that no longer exists with the newly created one
|
|
252
|
-
dependency.scriptBytecodeAddresses[
|
|
278
|
+
dependency.scriptBytecodeAddresses[index] = script.writeToBytecode();
|
|
253
279
|
|
|
254
|
-
emit DependencyScriptUpdated(
|
|
280
|
+
emit DependencyScriptUpdated(dependencyNameAndVersion);
|
|
255
281
|
}
|
|
256
282
|
|
|
257
283
|
/**
|
|
258
|
-
* @notice Adds a script to dependency `
|
|
284
|
+
* @notice Adds a script to dependency `dependencyNameAndVersion`, by way of
|
|
259
285
|
* providing an already written chunk of bytecode storage.
|
|
260
|
-
* @param
|
|
261
|
-
* @param
|
|
286
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
287
|
+
* @param scriptPointer Address of script to be added. Required to be a non-zero address,
|
|
262
288
|
* but no further validation is performed.
|
|
263
289
|
*/
|
|
264
290
|
function addDependencyScriptPointer(
|
|
265
|
-
bytes32
|
|
266
|
-
address
|
|
291
|
+
bytes32 dependencyNameAndVersion,
|
|
292
|
+
address scriptPointer
|
|
267
293
|
) external {
|
|
268
294
|
_onlyAdminACL(this.addDependencyScriptPointer.selector);
|
|
269
|
-
_onlyNonZeroAddress(
|
|
270
|
-
|
|
271
|
-
|
|
295
|
+
_onlyNonZeroAddress(scriptPointer);
|
|
296
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
297
|
+
|
|
298
|
+
DependencyRegistryStorageLib.Dependency
|
|
299
|
+
storage dependency = DependencyRegistryStorageLib
|
|
300
|
+
.s()
|
|
301
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
272
302
|
// store script in contract bytecode
|
|
273
303
|
dependency.scriptBytecodeAddresses[
|
|
274
304
|
dependency.scriptCount
|
|
275
|
-
] =
|
|
305
|
+
] = scriptPointer;
|
|
276
306
|
dependency.scriptCount = dependency.scriptCount + 1;
|
|
277
307
|
|
|
278
|
-
emit DependencyScriptUpdated(
|
|
308
|
+
emit DependencyScriptUpdated(dependencyNameAndVersion);
|
|
279
309
|
}
|
|
280
310
|
|
|
281
311
|
/**
|
|
282
|
-
* @notice Updates script for
|
|
312
|
+
* @notice Updates script for dependency id `dependencyNameAndVersion` at script `index`,
|
|
283
313
|
* by way of providing an already written chunk of bytecode storage.
|
|
284
|
-
* @param
|
|
285
|
-
* @param
|
|
286
|
-
* @param
|
|
314
|
+
* @param dependencyNameAndVersion Name of dependency (i.e. "name@version") used to identify dependency.
|
|
315
|
+
* @param index The index of a given script, relative to the overall `scriptCount`.
|
|
316
|
+
* @param scriptPointer The updated script pointer (address of bytecode storage).
|
|
287
317
|
* Required to be a non-zero address, but no further validation is performed.
|
|
288
318
|
*/
|
|
289
319
|
function updateDependencyScriptPointer(
|
|
290
|
-
bytes32
|
|
291
|
-
uint256
|
|
292
|
-
address
|
|
320
|
+
bytes32 dependencyNameAndVersion,
|
|
321
|
+
uint256 index,
|
|
322
|
+
address scriptPointer
|
|
293
323
|
) external {
|
|
294
324
|
_onlyAdminACL(this.updateDependencyScriptPointer.selector);
|
|
295
|
-
_onlyNonZeroAddress(
|
|
296
|
-
|
|
297
|
-
Dependency storage dependency = dependencyDetails[_dependencyType];
|
|
298
|
-
_onlyInRangeIndex({_index: _index, _length: dependency.scriptCount});
|
|
299
|
-
dependency.scriptBytecodeAddresses[_index] = _scriptPointer;
|
|
325
|
+
_onlyNonZeroAddress(scriptPointer);
|
|
326
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
300
327
|
|
|
301
|
-
|
|
328
|
+
DependencyRegistryStorageLib.Dependency
|
|
329
|
+
storage dependency = DependencyRegistryStorageLib
|
|
330
|
+
.s()
|
|
331
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
332
|
+
_onlyInRangeIndex({index: index, length: dependency.scriptCount});
|
|
333
|
+
dependency.scriptBytecodeAddresses[index] = scriptPointer;
|
|
334
|
+
|
|
335
|
+
emit DependencyScriptUpdated(dependencyNameAndVersion);
|
|
302
336
|
}
|
|
303
337
|
|
|
304
338
|
/**
|
|
305
|
-
* @notice Removes last script from dependency `
|
|
306
|
-
* @param
|
|
339
|
+
* @notice Removes last script from dependency `dependencyNameAndVersion`.
|
|
340
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
307
341
|
*/
|
|
308
|
-
function removeDependencyLastScript(
|
|
342
|
+
function removeDependencyLastScript(
|
|
343
|
+
bytes32 dependencyNameAndVersion
|
|
344
|
+
) external {
|
|
309
345
|
_onlyAdminACL(this.removeDependencyLastScript.selector);
|
|
310
|
-
|
|
311
|
-
|
|
346
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
347
|
+
|
|
348
|
+
DependencyRegistryStorageLib.Dependency
|
|
349
|
+
storage dependency = DependencyRegistryStorageLib
|
|
350
|
+
.s()
|
|
351
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
312
352
|
require(dependency.scriptCount > 0, "there are no scripts to remove");
|
|
313
353
|
// delete reference to old storage contract address
|
|
314
354
|
delete dependency.scriptBytecodeAddresses[dependency.scriptCount - 1];
|
|
@@ -316,365 +356,486 @@ contract DependencyRegistryV0 is
|
|
|
316
356
|
dependency.scriptCount = dependency.scriptCount - 1;
|
|
317
357
|
}
|
|
318
358
|
|
|
319
|
-
emit DependencyScriptUpdated(
|
|
359
|
+
emit DependencyScriptUpdated(dependencyNameAndVersion);
|
|
320
360
|
}
|
|
321
361
|
|
|
322
362
|
/**
|
|
323
|
-
* @notice Updates preferred CDN for dependency `
|
|
324
|
-
* @param
|
|
325
|
-
* @param
|
|
363
|
+
* @notice Updates preferred CDN for dependency `dependencyNameAndVersion`.
|
|
364
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
365
|
+
* @param preferredCDN URL for preferred CDN.
|
|
326
366
|
*/
|
|
327
367
|
function updateDependencyPreferredCDN(
|
|
328
|
-
bytes32
|
|
329
|
-
string memory
|
|
368
|
+
bytes32 dependencyNameAndVersion,
|
|
369
|
+
string memory preferredCDN
|
|
330
370
|
) external {
|
|
331
371
|
_onlyAdminACL(this.updateDependencyPreferredCDN.selector);
|
|
332
|
-
|
|
333
|
-
dependencyDetails[_dependencyType].preferredCDN = _preferredCDN;
|
|
372
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
334
373
|
|
|
335
|
-
|
|
374
|
+
DependencyRegistryStorageLib
|
|
375
|
+
.s()
|
|
376
|
+
.dependencyRecords[dependencyNameAndVersion]
|
|
377
|
+
.preferredCDN = preferredCDN;
|
|
378
|
+
|
|
379
|
+
emit DependencyPreferredCDNUpdated(
|
|
380
|
+
dependencyNameAndVersion,
|
|
381
|
+
preferredCDN
|
|
382
|
+
);
|
|
336
383
|
}
|
|
337
384
|
|
|
338
385
|
/**
|
|
339
|
-
* @notice Updates preferred repository for dependency `
|
|
340
|
-
* @param
|
|
341
|
-
* @param
|
|
386
|
+
* @notice Updates preferred repository for dependency `dependencyNameAndVersion`.
|
|
387
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
388
|
+
* @param preferredRepository URL for preferred repository.
|
|
342
389
|
*/
|
|
343
390
|
function updateDependencyPreferredRepository(
|
|
344
|
-
bytes32
|
|
345
|
-
string memory
|
|
391
|
+
bytes32 dependencyNameAndVersion,
|
|
392
|
+
string memory preferredRepository
|
|
346
393
|
) external {
|
|
347
394
|
_onlyAdminACL(this.updateDependencyPreferredRepository.selector);
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
395
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
396
|
+
|
|
397
|
+
DependencyRegistryStorageLib
|
|
398
|
+
.s()
|
|
399
|
+
.dependencyRecords[dependencyNameAndVersion]
|
|
400
|
+
.preferredRepository = preferredRepository;
|
|
351
401
|
|
|
352
402
|
emit DependencyPreferredRepositoryUpdated(
|
|
353
|
-
|
|
354
|
-
|
|
403
|
+
dependencyNameAndVersion,
|
|
404
|
+
preferredRepository
|
|
355
405
|
);
|
|
356
406
|
}
|
|
357
407
|
|
|
358
408
|
/**
|
|
359
|
-
* @notice Updates project website for dependency `
|
|
360
|
-
* @param
|
|
361
|
-
* @param
|
|
409
|
+
* @notice Updates project website for dependency `dependencyNameAndVersion`.
|
|
410
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
411
|
+
* @param dependencyWebsite URL for project website.
|
|
362
412
|
*/
|
|
363
|
-
function
|
|
364
|
-
bytes32
|
|
365
|
-
string memory
|
|
413
|
+
function updateDependencyWebsite(
|
|
414
|
+
bytes32 dependencyNameAndVersion,
|
|
415
|
+
string memory dependencyWebsite
|
|
366
416
|
) external {
|
|
367
|
-
_onlyAdminACL(this.
|
|
368
|
-
|
|
369
|
-
dependencyDetails[_dependencyType].referenceWebsite = _referenceWebsite;
|
|
417
|
+
_onlyAdminACL(this.updateDependencyWebsite.selector);
|
|
418
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
370
419
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
420
|
+
DependencyRegistryStorageLib
|
|
421
|
+
.s()
|
|
422
|
+
.dependencyRecords[dependencyNameAndVersion]
|
|
423
|
+
.website = dependencyWebsite;
|
|
424
|
+
|
|
425
|
+
emit DependencyWebsiteUpdated(
|
|
426
|
+
dependencyNameAndVersion,
|
|
427
|
+
dependencyWebsite
|
|
374
428
|
);
|
|
375
429
|
}
|
|
376
430
|
|
|
377
431
|
/**
|
|
378
|
-
* @notice Adds a new CDN url to `
|
|
379
|
-
* @param
|
|
380
|
-
* @param
|
|
432
|
+
* @notice Adds a new CDN url to `dependencyNameAndVersion`.
|
|
433
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
434
|
+
* @param additionalCDN CDN URL to be added. Required to be a non-empty string,
|
|
381
435
|
* but no further validation is performed.
|
|
382
436
|
*/
|
|
383
437
|
function addDependencyAdditionalCDN(
|
|
384
|
-
bytes32
|
|
385
|
-
string memory
|
|
438
|
+
bytes32 dependencyNameAndVersion,
|
|
439
|
+
string memory additionalCDN
|
|
386
440
|
) external {
|
|
387
441
|
_onlyAdminACL(this.addDependencyAdditionalCDN.selector);
|
|
388
|
-
_onlyNonEmptyString(
|
|
389
|
-
|
|
390
|
-
|
|
442
|
+
_onlyNonEmptyString(additionalCDN);
|
|
443
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
444
|
+
|
|
445
|
+
DependencyRegistryStorageLib.Dependency
|
|
446
|
+
storage dependency = DependencyRegistryStorageLib
|
|
447
|
+
.s()
|
|
448
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
391
449
|
|
|
392
450
|
uint256 additionalCDNCount = uint256(dependency.additionalCDNCount);
|
|
393
|
-
dependency.additionalCDNs[additionalCDNCount] =
|
|
451
|
+
dependency.additionalCDNs[additionalCDNCount] = additionalCDN;
|
|
394
452
|
dependency.additionalCDNCount = uint24(additionalCDNCount + 1);
|
|
395
453
|
|
|
396
454
|
emit DependencyAdditionalCDNUpdated(
|
|
397
|
-
|
|
398
|
-
|
|
455
|
+
dependencyNameAndVersion,
|
|
456
|
+
additionalCDN,
|
|
399
457
|
additionalCDNCount
|
|
400
458
|
);
|
|
401
459
|
}
|
|
402
460
|
|
|
403
461
|
/**
|
|
404
|
-
* @notice Removes additional CDN for dependency `_dependencyId` at index `
|
|
462
|
+
* @notice Removes additional CDN for dependency `_dependencyId` at index `index`.
|
|
405
463
|
* 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
|
|
464
|
+
* Assets with indices higher than `index` can have their indices adjusted as a result of this operation.
|
|
465
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
466
|
+
* @param index The index of an additional CDN, relative to the overall `additionalCDNCount`.
|
|
409
467
|
*/
|
|
410
468
|
function removeDependencyAdditionalCDN(
|
|
411
|
-
bytes32
|
|
412
|
-
uint256
|
|
469
|
+
bytes32 dependencyNameAndVersion,
|
|
470
|
+
uint256 index
|
|
413
471
|
) external {
|
|
414
472
|
_onlyAdminACL(this.removeDependencyAdditionalCDN.selector);
|
|
415
|
-
|
|
416
|
-
|
|
473
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
474
|
+
|
|
475
|
+
DependencyRegistryStorageLib.Dependency
|
|
476
|
+
storage dependency = DependencyRegistryStorageLib
|
|
477
|
+
.s()
|
|
478
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
417
479
|
|
|
418
480
|
uint256 additionalCDNCount = dependency.additionalCDNCount;
|
|
419
|
-
_onlyInRangeIndex({
|
|
481
|
+
_onlyInRangeIndex({index: index, length: additionalCDNCount});
|
|
420
482
|
|
|
421
483
|
uint256 lastElementIndex = additionalCDNCount - 1;
|
|
422
484
|
|
|
423
|
-
dependency.additionalCDNs[
|
|
485
|
+
dependency.additionalCDNs[index] = dependency.additionalCDNs[
|
|
424
486
|
lastElementIndex
|
|
425
487
|
];
|
|
426
488
|
delete dependency.additionalCDNs[lastElementIndex];
|
|
427
489
|
|
|
428
490
|
dependency.additionalCDNCount = uint24(lastElementIndex);
|
|
429
491
|
|
|
430
|
-
emit DependencyAdditionalCDNRemoved(
|
|
492
|
+
emit DependencyAdditionalCDNRemoved(dependencyNameAndVersion, index);
|
|
431
493
|
}
|
|
432
494
|
|
|
433
495
|
/**
|
|
434
|
-
* @notice Updates additional CDN for dependency `
|
|
435
|
-
* @param
|
|
436
|
-
* @param
|
|
437
|
-
* @param
|
|
496
|
+
* @notice Updates additional CDN for dependency `dependencyNameAndVersion` at `index`.
|
|
497
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
498
|
+
* @param index The index of an additional CDN, relative to the overall `additionalCDNCount`.
|
|
499
|
+
* @param additionalCDN New CDN URL.
|
|
438
500
|
*/
|
|
439
501
|
function updateDependencyAdditionalCDN(
|
|
440
|
-
bytes32
|
|
441
|
-
uint256
|
|
442
|
-
string memory
|
|
502
|
+
bytes32 dependencyNameAndVersion,
|
|
503
|
+
uint256 index,
|
|
504
|
+
string memory additionalCDN
|
|
443
505
|
) external {
|
|
444
506
|
_onlyAdminACL(this.updateDependencyAdditionalCDN.selector);
|
|
445
|
-
_onlyNonEmptyString(
|
|
446
|
-
|
|
447
|
-
|
|
507
|
+
_onlyNonEmptyString(additionalCDN);
|
|
508
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
509
|
+
|
|
510
|
+
DependencyRegistryStorageLib.Dependency
|
|
511
|
+
storage dependency = DependencyRegistryStorageLib
|
|
512
|
+
.s()
|
|
513
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
448
514
|
_onlyInRangeIndex({
|
|
449
|
-
|
|
450
|
-
|
|
515
|
+
index: index,
|
|
516
|
+
length: dependency.additionalCDNCount
|
|
451
517
|
});
|
|
452
518
|
|
|
453
|
-
dependency.additionalCDNs[
|
|
519
|
+
dependency.additionalCDNs[index] = additionalCDN;
|
|
454
520
|
|
|
455
521
|
emit DependencyAdditionalCDNUpdated(
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
522
|
+
dependencyNameAndVersion,
|
|
523
|
+
additionalCDN,
|
|
524
|
+
index
|
|
459
525
|
);
|
|
460
526
|
}
|
|
461
527
|
|
|
462
528
|
/**
|
|
463
|
-
* @notice Adds a new repository URL to dependency `
|
|
464
|
-
* @param
|
|
465
|
-
* @param
|
|
529
|
+
* @notice Adds a new repository URL to dependency `dependencyNameAndVersion`.
|
|
530
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
531
|
+
* @param additionalRepository Repository URL to be added. Required to be a non-empty string,
|
|
466
532
|
* but no further validation is performed.
|
|
467
533
|
*/
|
|
468
534
|
function addDependencyAdditionalRepository(
|
|
469
|
-
bytes32
|
|
470
|
-
string memory
|
|
535
|
+
bytes32 dependencyNameAndVersion,
|
|
536
|
+
string memory additionalRepository
|
|
471
537
|
) external {
|
|
472
538
|
_onlyAdminACL(this.addDependencyAdditionalRepository.selector);
|
|
473
|
-
_onlyNonEmptyString(
|
|
474
|
-
|
|
475
|
-
|
|
539
|
+
_onlyNonEmptyString(additionalRepository);
|
|
540
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
541
|
+
|
|
542
|
+
DependencyRegistryStorageLib.Dependency
|
|
543
|
+
storage dependency = DependencyRegistryStorageLib
|
|
544
|
+
.s()
|
|
545
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
476
546
|
uint256 additionalRepositoryCount = uint256(
|
|
477
547
|
dependency.additionalRepositoryCount
|
|
478
548
|
);
|
|
479
549
|
dependency.additionalRepositories[
|
|
480
550
|
additionalRepositoryCount
|
|
481
|
-
] =
|
|
551
|
+
] = additionalRepository;
|
|
482
552
|
dependency.additionalRepositoryCount = uint24(
|
|
483
553
|
additionalRepositoryCount + 1
|
|
484
554
|
);
|
|
485
555
|
|
|
486
556
|
emit DependencyAdditionalRepositoryUpdated(
|
|
487
|
-
|
|
488
|
-
|
|
557
|
+
dependencyNameAndVersion,
|
|
558
|
+
additionalRepository,
|
|
489
559
|
additionalRepositoryCount
|
|
490
560
|
);
|
|
491
561
|
}
|
|
492
562
|
|
|
493
563
|
/**
|
|
494
|
-
* @notice Removes additional repository for depenency `_dependencyId` at index `
|
|
564
|
+
* @notice Removes additional repository for depenency `_dependencyId` at index `index`.
|
|
495
565
|
* 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
|
|
566
|
+
* Assets with indices higher than `index` can have their indices adjusted as a result of this operation.
|
|
567
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
568
|
+
* @param index The index of an additional repository, relative to the overall `additionalRepositoryCount`.
|
|
499
569
|
*/
|
|
500
570
|
function removeDependencyAdditionalRepository(
|
|
501
|
-
bytes32
|
|
502
|
-
uint256
|
|
571
|
+
bytes32 dependencyNameAndVersion,
|
|
572
|
+
uint256 index
|
|
503
573
|
) external {
|
|
504
574
|
_onlyAdminACL(this.removeDependencyAdditionalRepository.selector);
|
|
505
|
-
|
|
506
|
-
|
|
575
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
576
|
+
|
|
577
|
+
DependencyRegistryStorageLib.Storage
|
|
578
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
579
|
+
|
|
580
|
+
DependencyRegistryStorageLib.Dependency storage dependency = ds
|
|
581
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
507
582
|
uint256 additionalRepositoryCount = dependency
|
|
508
583
|
.additionalRepositoryCount;
|
|
509
|
-
_onlyInRangeIndex({
|
|
584
|
+
_onlyInRangeIndex({index: index, length: additionalRepositoryCount});
|
|
510
585
|
|
|
511
586
|
uint256 lastElementIndex = additionalRepositoryCount - 1;
|
|
512
587
|
|
|
513
|
-
dependency.additionalRepositories[
|
|
514
|
-
|
|
515
|
-
|
|
588
|
+
dependency.additionalRepositories[index] = ds
|
|
589
|
+
.dependencyRecords[dependencyNameAndVersion]
|
|
590
|
+
.additionalRepositories[lastElementIndex];
|
|
516
591
|
delete dependency.additionalRepositories[lastElementIndex];
|
|
517
592
|
|
|
518
593
|
dependency.additionalRepositoryCount = uint24(lastElementIndex);
|
|
519
594
|
|
|
520
|
-
emit DependencyAdditionalRepositoryRemoved(
|
|
595
|
+
emit DependencyAdditionalRepositoryRemoved(
|
|
596
|
+
dependencyNameAndVersion,
|
|
597
|
+
index
|
|
598
|
+
);
|
|
521
599
|
}
|
|
522
600
|
|
|
523
601
|
/**
|
|
524
|
-
* @notice Updates additional repository for dependency `
|
|
525
|
-
* @param
|
|
526
|
-
* @param
|
|
527
|
-
* @param
|
|
602
|
+
* @notice Updates additional repository for dependency `dependencyNameAndVersion` at `index`.
|
|
603
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
604
|
+
* @param index The index of an additional repository, relative to the overall `additionalRepositoryCount`.
|
|
605
|
+
* @param additionalRepository New Repository URL.
|
|
528
606
|
*/
|
|
529
607
|
function updateDependencyAdditionalRepository(
|
|
530
|
-
bytes32
|
|
531
|
-
uint256
|
|
532
|
-
string memory
|
|
608
|
+
bytes32 dependencyNameAndVersion,
|
|
609
|
+
uint256 index,
|
|
610
|
+
string memory additionalRepository
|
|
533
611
|
) external {
|
|
534
612
|
_onlyAdminACL(this.updateDependencyAdditionalRepository.selector);
|
|
535
|
-
_onlyNonEmptyString(
|
|
536
|
-
|
|
537
|
-
|
|
613
|
+
_onlyNonEmptyString(additionalRepository);
|
|
614
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
615
|
+
|
|
616
|
+
DependencyRegistryStorageLib.Dependency
|
|
617
|
+
storage dependency = DependencyRegistryStorageLib
|
|
618
|
+
.s()
|
|
619
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
538
620
|
_onlyInRangeIndex({
|
|
539
|
-
|
|
540
|
-
|
|
621
|
+
index: index,
|
|
622
|
+
length: dependency.additionalRepositoryCount
|
|
541
623
|
});
|
|
542
624
|
|
|
543
|
-
dependency.additionalRepositories[
|
|
625
|
+
dependency.additionalRepositories[index] = additionalRepository;
|
|
544
626
|
|
|
545
627
|
emit DependencyAdditionalRepositoryUpdated(
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
628
|
+
dependencyNameAndVersion,
|
|
629
|
+
additionalRepository,
|
|
630
|
+
index
|
|
549
631
|
);
|
|
550
632
|
}
|
|
551
633
|
|
|
552
634
|
/**
|
|
553
|
-
* @notice
|
|
554
|
-
*
|
|
635
|
+
* @notice These functions were removed in an upgrade, registering and unregistering
|
|
636
|
+
* contracts are handled by the core registry.
|
|
555
637
|
*/
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
638
|
+
// /**
|
|
639
|
+
// * @notice Adds a new core contract to the list of supported core contracts.
|
|
640
|
+
// * @param contractAddress Address of the core contract to be added.
|
|
641
|
+
// */
|
|
642
|
+
// function addSupportedCoreContract(address contractAddress) external {
|
|
643
|
+
// _onlyAdminACL(this.addSupportedCoreContract.selector);
|
|
644
|
+
// _onlyNonZeroAddress(contractAddress);
|
|
645
|
+
|
|
646
|
+
// require(
|
|
647
|
+
// // @dev the add function returns false if set already contains value
|
|
648
|
+
// DependencyRegistryStorageLib.s().supportedCoreContracts.add(
|
|
649
|
+
// contractAddress
|
|
650
|
+
// ),
|
|
651
|
+
// "Contract already supported"
|
|
652
|
+
// );
|
|
653
|
+
// emit SupportedCoreContractAdded(contractAddress);
|
|
654
|
+
// }
|
|
655
|
+
|
|
656
|
+
// /**
|
|
657
|
+
// * @notice Removes a core contract from the list of supported core contracts.
|
|
658
|
+
// * @param contractAddress Address of the core contract to be removed.
|
|
659
|
+
// */
|
|
660
|
+
// function removeSupportedCoreContract(address contractAddress) external {
|
|
661
|
+
// _onlyAdminACL(this.removeSupportedCoreContract.selector);
|
|
662
|
+
// require(
|
|
663
|
+
// // @dev the remove function returns false if set does not contain value
|
|
664
|
+
// DependencyRegistryStorageLib.s().supportedCoreContracts.remove(
|
|
665
|
+
// contractAddress
|
|
666
|
+
// ),
|
|
667
|
+
// "Core contract already removed or not in set"
|
|
668
|
+
// );
|
|
669
|
+
// emit SupportedCoreContractRemoved(contractAddress);
|
|
670
|
+
// }
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* @notice Adds a new core contract to be supported by the dependency registry.
|
|
674
|
+
* This is in addition to the set of contracts specified as supported by the core registry.
|
|
675
|
+
* @dev use case is a contract not allowed to mint on minter filter, but still needs to be
|
|
676
|
+
* supported by dependency registry.
|
|
677
|
+
* @param contractAddress Address of the core contract.
|
|
678
|
+
*/
|
|
679
|
+
function addSupportedCoreContractOverride(
|
|
680
|
+
address contractAddress
|
|
681
|
+
) external {
|
|
682
|
+
_onlyAdminACL(this.addSupportedCoreContractOverride.selector);
|
|
683
|
+
_onlyNonZeroAddress(contractAddress);
|
|
684
|
+
|
|
559
685
|
require(
|
|
560
686
|
// @dev the add function returns false if set already contains value
|
|
561
|
-
|
|
687
|
+
DependencyRegistryStorageLib.s().supportedCoreContractsOverride.add(
|
|
688
|
+
contractAddress
|
|
689
|
+
),
|
|
562
690
|
"Contract already supported"
|
|
563
691
|
);
|
|
564
|
-
emit
|
|
692
|
+
emit SupportedCoreContractOverrideAdded(contractAddress);
|
|
565
693
|
}
|
|
566
694
|
|
|
567
695
|
/**
|
|
568
|
-
* @notice Removes a core contract
|
|
569
|
-
*
|
|
696
|
+
* @notice Removes a core contract previously listed as override supported by the dependency registry.
|
|
697
|
+
* This removes from the set of core contracts that are suppported by the dependency in addition to
|
|
698
|
+
* the set of contracts specified as supported by the core registry.
|
|
699
|
+
* @param contractAddress Address of the core contract.
|
|
570
700
|
*/
|
|
571
|
-
function
|
|
572
|
-
|
|
701
|
+
function removeSupportedCoreContractOverride(
|
|
702
|
+
address contractAddress
|
|
703
|
+
) external {
|
|
704
|
+
_onlyAdminACL(this.removeSupportedCoreContractOverride.selector);
|
|
573
705
|
require(
|
|
574
706
|
// @dev the remove function returns false if set does not contain value
|
|
575
|
-
|
|
707
|
+
DependencyRegistryStorageLib
|
|
708
|
+
.s()
|
|
709
|
+
.supportedCoreContractsOverride
|
|
710
|
+
.remove(contractAddress),
|
|
576
711
|
"Core contract already removed or not in set"
|
|
577
712
|
);
|
|
578
|
-
emit
|
|
713
|
+
emit SupportedCoreContractOverrideRemoved(contractAddress);
|
|
579
714
|
}
|
|
580
715
|
|
|
581
716
|
/**
|
|
582
717
|
* @notice Overrides the script type and version that
|
|
583
718
|
* would be returned by the core contract (`_contractAddress`)
|
|
584
719
|
* 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
|
|
720
|
+
* name and version (`dependencyNameAndVersion`).
|
|
721
|
+
* @param contractAddress Core contract address.
|
|
722
|
+
* @param projectId Project to override script type and version for.
|
|
723
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "type`@`version") used to identify dependency.
|
|
724
|
+
*/
|
|
725
|
+
function addProjectDependencyOverride(
|
|
726
|
+
address contractAddress,
|
|
727
|
+
uint256 projectId,
|
|
728
|
+
bytes32 dependencyNameAndVersion
|
|
594
729
|
) external {
|
|
595
|
-
_onlyAdminACL(this.
|
|
596
|
-
|
|
597
|
-
_onlySupportedCoreContract(
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
730
|
+
_onlyAdminACL(this.addProjectDependencyOverride.selector);
|
|
731
|
+
_onlyExistingDependency(dependencyNameAndVersion);
|
|
732
|
+
_onlySupportedCoreContract(contractAddress);
|
|
733
|
+
|
|
734
|
+
DependencyRegistryStorageLib.s().projectDependencyOverrides[
|
|
735
|
+
contractAddress
|
|
736
|
+
][projectId] = dependencyNameAndVersion;
|
|
737
|
+
|
|
738
|
+
emit ProjectDependencyOverrideAdded(
|
|
739
|
+
contractAddress,
|
|
740
|
+
projectId,
|
|
741
|
+
dependencyNameAndVersion
|
|
606
742
|
);
|
|
607
743
|
}
|
|
608
744
|
|
|
609
745
|
/**
|
|
610
746
|
* @notice Removes the script type and version override for a given
|
|
611
747
|
* project (`projectId`) on a given core contract (`_contractAddress`).
|
|
612
|
-
* @param
|
|
613
|
-
* @param
|
|
748
|
+
* @param contractAddress Core contract address.
|
|
749
|
+
* @param projectId Project to remove override for.
|
|
614
750
|
*/
|
|
615
|
-
function
|
|
616
|
-
address
|
|
617
|
-
uint256
|
|
751
|
+
function removeProjectDependencyOverride(
|
|
752
|
+
address contractAddress,
|
|
753
|
+
uint256 projectId
|
|
618
754
|
) external {
|
|
619
|
-
_onlyAdminACL(this.
|
|
755
|
+
_onlyAdminACL(this.removeProjectDependencyOverride.selector);
|
|
756
|
+
|
|
757
|
+
DependencyRegistryStorageLib.Storage
|
|
758
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
759
|
+
|
|
620
760
|
require(
|
|
621
|
-
|
|
761
|
+
ds.projectDependencyOverrides[contractAddress][projectId] !=
|
|
622
762
|
bytes32(""),
|
|
623
763
|
"No override set for project"
|
|
624
764
|
);
|
|
625
765
|
|
|
626
|
-
delete
|
|
766
|
+
delete ds.projectDependencyOverrides[contractAddress][projectId];
|
|
627
767
|
|
|
628
|
-
emit
|
|
768
|
+
emit ProjectDependencyOverrideRemoved(contractAddress, projectId);
|
|
629
769
|
}
|
|
630
770
|
|
|
631
771
|
/**
|
|
632
|
-
* @notice Returns
|
|
633
|
-
*
|
|
634
|
-
* @dev This is
|
|
635
|
-
*
|
|
772
|
+
* @notice Returns an array of strings representing all registered dependencies in the contract.
|
|
773
|
+
* Each string is a combination of the dependency's name and version
|
|
774
|
+
* @dev This function is designed to be called outside of block execution where there is no gas limit,
|
|
775
|
+
* as it may consume a large amount of gas when there are many registered dependencies.
|
|
776
|
+
* @return A string array where each element is a registered dependency in the format "name@version".
|
|
636
777
|
*/
|
|
637
|
-
function
|
|
638
|
-
|
|
639
|
-
|
|
778
|
+
function getDependencyNamesAndVersions()
|
|
779
|
+
external
|
|
780
|
+
view
|
|
781
|
+
returns (string[] memory)
|
|
782
|
+
{
|
|
783
|
+
DependencyRegistryStorageLib.Storage
|
|
784
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
640
785
|
|
|
641
|
-
|
|
642
|
-
|
|
786
|
+
uint256 numDependencies = ds.dependencyNameVersionIds.length();
|
|
787
|
+
string[] memory dependencyTypes = new string[](numDependencies);
|
|
788
|
+
|
|
789
|
+
for (uint256 i = 0; i < numDependencies; i++) {
|
|
790
|
+
dependencyTypes[i] = ds.dependencyNameVersionIds.at(i).toString();
|
|
643
791
|
}
|
|
644
792
|
return dependencyTypes;
|
|
645
793
|
}
|
|
646
794
|
|
|
647
795
|
/**
|
|
648
|
-
* @notice Returns number of registered
|
|
796
|
+
* @notice Returns number of registered dependencies
|
|
649
797
|
* @return Number of registered dependencies.
|
|
650
798
|
*/
|
|
651
|
-
function
|
|
652
|
-
return
|
|
799
|
+
function getDependencyCount() external view returns (uint256) {
|
|
800
|
+
return
|
|
801
|
+
DependencyRegistryStorageLib.s().dependencyNameVersionIds.length();
|
|
653
802
|
}
|
|
654
803
|
|
|
655
804
|
/**
|
|
656
|
-
* @notice Returns registered depenedency
|
|
657
|
-
* @return Registered dependency at `
|
|
805
|
+
* @notice Returns registered depenedency name and version at index `index`.
|
|
806
|
+
* @return Registered dependency at `index`, relative to the overall length of the dependency type set.
|
|
658
807
|
*/
|
|
659
|
-
function
|
|
660
|
-
uint256
|
|
808
|
+
function getDependencyNameAndVersion(
|
|
809
|
+
uint256 index
|
|
661
810
|
) external view returns (string memory) {
|
|
662
|
-
|
|
663
|
-
|
|
811
|
+
DependencyRegistryStorageLib.Storage
|
|
812
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
813
|
+
|
|
814
|
+
_onlyInRangeIndex({
|
|
815
|
+
index: index,
|
|
816
|
+
length: ds.dependencyNameVersionIds.length()
|
|
817
|
+
});
|
|
818
|
+
return ds.dependencyNameVersionIds.at(index).toString();
|
|
664
819
|
}
|
|
665
820
|
|
|
666
821
|
/**
|
|
667
|
-
* @notice Returns
|
|
668
|
-
* @return
|
|
822
|
+
* @notice Returns array of registered license types
|
|
823
|
+
* @return Array of registered license types.
|
|
669
824
|
* @dev This is only intended to be called outside of block
|
|
670
825
|
* execution where there is no gas limit.
|
|
671
826
|
*/
|
|
672
827
|
function getLicenseTypes() external view returns (string[] memory) {
|
|
673
|
-
|
|
828
|
+
DependencyRegistryStorageLib.Storage
|
|
829
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
830
|
+
|
|
831
|
+
uint256 numLicenseTypes = ds.licenseTypes.length();
|
|
674
832
|
string[] memory licenseTypes = new string[](numLicenseTypes);
|
|
675
833
|
|
|
676
|
-
for (uint256 i
|
|
677
|
-
licenseTypes[i] =
|
|
834
|
+
for (uint256 i; i < numLicenseTypes; ) {
|
|
835
|
+
licenseTypes[i] = ds.licenseTypes.at(i).toString();
|
|
836
|
+
unchecked {
|
|
837
|
+
++i;
|
|
838
|
+
}
|
|
678
839
|
}
|
|
679
840
|
return licenseTypes;
|
|
680
841
|
}
|
|
@@ -684,99 +845,270 @@ contract DependencyRegistryV0 is
|
|
|
684
845
|
* @return Number of registered license types.
|
|
685
846
|
*/
|
|
686
847
|
function getLicenseTypeCount() external view returns (uint256) {
|
|
687
|
-
return
|
|
848
|
+
return DependencyRegistryStorageLib.s().licenseTypes.length();
|
|
688
849
|
}
|
|
689
850
|
|
|
690
851
|
/**
|
|
691
|
-
* @notice Returns registered license type at index `
|
|
692
|
-
* @return Registered license type at `
|
|
852
|
+
* @notice Returns registered license type at index `index`.
|
|
853
|
+
* @return Registered license type at `index`, relative to the overall length of the license type set.
|
|
693
854
|
*/
|
|
694
855
|
function getLicenseType(
|
|
695
|
-
uint256
|
|
856
|
+
uint256 index
|
|
696
857
|
) external view returns (string memory) {
|
|
697
|
-
|
|
698
|
-
|
|
858
|
+
DependencyRegistryStorageLib.Storage
|
|
859
|
+
storage ds = DependencyRegistryStorageLib.s();
|
|
860
|
+
|
|
861
|
+
_onlyInRangeIndex({index: index, length: ds.licenseTypes.length()});
|
|
862
|
+
return ds.licenseTypes.at(index).toString();
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* @notice Adds a full license text to license `licenseType`, by way of
|
|
867
|
+
* providing a string to write to bytecode storage.
|
|
868
|
+
* @param licenseType Name of license type (e.g. "MIT") used to identify license.
|
|
869
|
+
* @param text Text to be added. Required to be a non-empty string,
|
|
870
|
+
* but no further validation is performed.
|
|
871
|
+
*/
|
|
872
|
+
function addLicenseText(bytes32 licenseType, string memory text) external {
|
|
873
|
+
_onlyAdminACL(this.addLicenseText.selector);
|
|
874
|
+
_onlyNonEmptyString(text);
|
|
875
|
+
_onlyExistingLicenseType(licenseType);
|
|
876
|
+
|
|
877
|
+
DependencyRegistryStorageLib.License
|
|
878
|
+
storage licenseEntry = DependencyRegistryStorageLib.s().allLicenses[
|
|
879
|
+
licenseType
|
|
880
|
+
];
|
|
881
|
+
// store license chunk in contract bytecode
|
|
882
|
+
licenseEntry.licenseBytecodeAddresses[
|
|
883
|
+
licenseEntry.licenseChunkCount
|
|
884
|
+
] = text.writeToBytecode();
|
|
885
|
+
licenseEntry.licenseChunkCount = licenseEntry.licenseChunkCount + 1;
|
|
886
|
+
|
|
887
|
+
emit LicenseTextUpdated(licenseType);
|
|
699
888
|
}
|
|
700
889
|
|
|
701
890
|
/**
|
|
702
|
-
* @notice
|
|
703
|
-
*
|
|
704
|
-
* @
|
|
891
|
+
* @notice Updates the license text for license `licenseType` at index `_index`,
|
|
892
|
+
* by way of providing a string to write to bytecode storage.
|
|
893
|
+
* @param licenseType Name of license type (e.g. "MIT") used to identify license.
|
|
894
|
+
* @param index The index of a given license text chunk, relative to the overall `licenseChunkCount`.
|
|
895
|
+
* @param text The updated license text value. Required to be a non-empty
|
|
896
|
+
* string, but no further validation is performed.
|
|
897
|
+
*/
|
|
898
|
+
function updateLicenseText(
|
|
899
|
+
bytes32 licenseType,
|
|
900
|
+
uint256 index,
|
|
901
|
+
string memory text
|
|
902
|
+
) external {
|
|
903
|
+
_onlyAdminACL(this.updateLicenseText.selector);
|
|
904
|
+
_onlyNonEmptyString(text);
|
|
905
|
+
_onlyExistingLicenseType(licenseType);
|
|
906
|
+
|
|
907
|
+
DependencyRegistryStorageLib.License
|
|
908
|
+
storage licenseEntry = DependencyRegistryStorageLib.s().allLicenses[
|
|
909
|
+
licenseType
|
|
910
|
+
];
|
|
911
|
+
_onlyInRangeIndex({
|
|
912
|
+
index: index,
|
|
913
|
+
length: licenseEntry.licenseChunkCount
|
|
914
|
+
});
|
|
915
|
+
// store license text chunk in contract bytecode, replacing reference address from
|
|
916
|
+
// the contract that is no longer referenced with the newly created one
|
|
917
|
+
licenseEntry.licenseBytecodeAddresses[index] = text.writeToBytecode();
|
|
918
|
+
|
|
919
|
+
emit LicenseTextUpdated(licenseType);
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* @notice Removes the last license text chunk from license `licenseType`.
|
|
924
|
+
* @param licenseType Name of license type (e.g. "MIT") used to identify license.
|
|
925
|
+
*/
|
|
926
|
+
function removeLicenseLastText(bytes32 licenseType) external {
|
|
927
|
+
_onlyAdminACL(this.removeLicenseLastText.selector);
|
|
928
|
+
_onlyExistingLicenseType(licenseType);
|
|
929
|
+
|
|
930
|
+
DependencyRegistryStorageLib.License
|
|
931
|
+
storage licenseEntry = DependencyRegistryStorageLib.s().allLicenses[
|
|
932
|
+
licenseType
|
|
933
|
+
];
|
|
934
|
+
uint24 licenseChunkCount = licenseEntry.licenseChunkCount;
|
|
935
|
+
require(licenseChunkCount > 0, "There is no license text to remove");
|
|
936
|
+
// delete reference to old storage contract address
|
|
937
|
+
delete licenseEntry.licenseBytecodeAddresses[licenseChunkCount - 1];
|
|
938
|
+
unchecked {
|
|
939
|
+
licenseEntry.licenseChunkCount = licenseChunkCount - 1;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
emit LicenseTextUpdated(licenseType);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* @notice Returns license text for license `licenseType` at script index `index`.
|
|
947
|
+
* @param licenseType Name of license type (e.g. "MIT") used to identify license.
|
|
948
|
+
* @param index The index of a given script, relative to the overall `licenseChunkCount`.
|
|
949
|
+
* @return A string containing the license text content at the given script chunk index for a given license.
|
|
950
|
+
* @dev This method attempts to introspectively determine which library version of
|
|
951
|
+
* `BytecodeStorage` was used to write the stored script string that is being
|
|
952
|
+
* read back, in order to use the proper read approach. If the version is
|
|
953
|
+
* non-determinate, a fall-back to reading using the assumption that the bytes
|
|
954
|
+
* were written with `SSTORE2` is used.
|
|
955
|
+
* Also note that in this `SSTORE2` fallback handling, the approach of casting bytes to string
|
|
956
|
+
* can cause failure (e.g. unexpected continuation byte).
|
|
957
|
+
*/
|
|
958
|
+
function getLicenseText(
|
|
959
|
+
bytes32 licenseType,
|
|
960
|
+
uint256 index
|
|
961
|
+
) external view returns (string memory) {
|
|
962
|
+
DependencyRegistryStorageLib.License
|
|
963
|
+
storage licenseEntry = DependencyRegistryStorageLib.s().allLicenses[
|
|
964
|
+
licenseType
|
|
965
|
+
];
|
|
966
|
+
_onlyInRangeIndex({
|
|
967
|
+
index: index,
|
|
968
|
+
length: licenseEntry.licenseChunkCount
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
address licenseAddress = licenseEntry.licenseBytecodeAddresses[index];
|
|
972
|
+
bytes32 storageVersion = BytecodeStorageReader
|
|
973
|
+
.getLibraryVersionForBytecode(licenseAddress);
|
|
974
|
+
if (storageVersion == BytecodeStorageReader.UNKNOWN_VERSION_STRING) {
|
|
975
|
+
return
|
|
976
|
+
string(
|
|
977
|
+
BytecodeStorageReader.readBytesFromSSTORE2Bytecode(
|
|
978
|
+
licenseAddress
|
|
979
|
+
)
|
|
980
|
+
);
|
|
981
|
+
} else {
|
|
982
|
+
return BytecodeStorageReader.readFromBytecode(licenseAddress);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* @notice Returns the count of license chunks for license `licenseType`.
|
|
988
|
+
* @param licenseType Name of license type (e.g. "MIT") used to identify dependency.
|
|
989
|
+
*/
|
|
990
|
+
function getLicenseTextChunkCount(
|
|
991
|
+
bytes32 licenseType
|
|
992
|
+
) external view returns (uint256) {
|
|
993
|
+
return
|
|
994
|
+
DependencyRegistryStorageLib
|
|
995
|
+
.s()
|
|
996
|
+
.allLicenses[licenseType]
|
|
997
|
+
.licenseChunkCount;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
/**
|
|
1001
|
+
* @notice Returns details for a given dependency type `dependencyNameAndVersion` input as string.
|
|
1002
|
+
* Reverts if input string does not fit within 32 bytes.
|
|
1003
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1004
|
+
* @return nameAndVersion String representation of `dependencyNameAndVersion`.
|
|
705
1005
|
* (e.g. "p5js(atSymbol)1.0.0")
|
|
706
1006
|
* @return licenseType License type for dependency
|
|
707
1007
|
* @return preferredCDN Preferred CDN URL for dependency
|
|
708
1008
|
* @return additionalCDNCount Count of additional CDN URLs for dependency
|
|
709
1009
|
* @return preferredRepository Preferred repository URL for dependency
|
|
710
1010
|
* @return additionalRepositoryCount Count of additional repository URLs for dependency
|
|
711
|
-
* @return
|
|
1011
|
+
* @return dependencyWebsite Project website URL for dependency
|
|
712
1012
|
* @return availableOnChain Whether dependency is available on chain
|
|
713
1013
|
* @return scriptCount Count of on-chain scripts for dependency
|
|
714
1014
|
*/
|
|
715
|
-
function
|
|
716
|
-
|
|
1015
|
+
function getDependencyDetailsFromString(
|
|
1016
|
+
string memory dependencyNameAndVersion
|
|
717
1017
|
)
|
|
718
1018
|
external
|
|
719
1019
|
view
|
|
720
1020
|
returns (
|
|
721
|
-
string memory
|
|
1021
|
+
string memory nameAndVersion,
|
|
722
1022
|
string memory licenseType,
|
|
723
1023
|
string memory preferredCDN,
|
|
724
1024
|
uint24 additionalCDNCount,
|
|
725
1025
|
string memory preferredRepository,
|
|
726
1026
|
uint24 additionalRepositoryCount,
|
|
727
|
-
string memory
|
|
1027
|
+
string memory dependencyWebsite,
|
|
728
1028
|
bool availableOnChain,
|
|
729
1029
|
uint24 scriptCount
|
|
730
1030
|
)
|
|
731
1031
|
{
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
return (
|
|
735
|
-
_dependencyType.toString(),
|
|
736
|
-
dependency.licenseType.toString(),
|
|
737
|
-
dependency.preferredCDN,
|
|
738
|
-
dependency.additionalCDNCount,
|
|
739
|
-
dependency.preferredRepository,
|
|
740
|
-
dependency.additionalRepositoryCount,
|
|
741
|
-
dependency.referenceWebsite,
|
|
742
|
-
dependency.scriptCount > 0,
|
|
743
|
-
dependency.scriptCount
|
|
744
|
-
);
|
|
1032
|
+
_onlyBytes32String(dependencyNameAndVersion);
|
|
1033
|
+
return getDependencyDetails(dependencyNameAndVersion.stringToBytes32());
|
|
745
1034
|
}
|
|
746
1035
|
|
|
747
1036
|
/**
|
|
748
1037
|
* @notice Returns the count of supported core contracts
|
|
1038
|
+
* @dev This concatenates the core contracts from the core registry with the
|
|
1039
|
+
* core contracts that are overridden as supported by the dependency registry.
|
|
1040
|
+
* Some duplicate entries may exist between the two sets, although this is not
|
|
1041
|
+
* intended to be the case.
|
|
749
1042
|
* @return Number of supported core contracts.
|
|
750
1043
|
*/
|
|
751
1044
|
function getSupportedCoreContractCount() external view returns (uint256) {
|
|
752
|
-
|
|
1045
|
+
uint256 coreRegistryCount = ICoreRegistryV1(
|
|
1046
|
+
DependencyRegistryStorageLib.s().coreRegistryContract
|
|
1047
|
+
).getNumRegisteredContracts();
|
|
1048
|
+
uint256 overrideCount = DependencyRegistryStorageLib
|
|
1049
|
+
.s()
|
|
1050
|
+
.supportedCoreContractsOverride
|
|
1051
|
+
.length();
|
|
1052
|
+
return coreRegistryCount + overrideCount;
|
|
753
1053
|
}
|
|
754
1054
|
|
|
755
1055
|
/**
|
|
756
|
-
* @notice Returns the address of the supported core contract at index `
|
|
757
|
-
* @
|
|
758
|
-
*
|
|
1056
|
+
* @notice Returns the address of the supported core contract at index `index`.
|
|
1057
|
+
* @dev This concatenates the core contracts from the core registry with the
|
|
1058
|
+
* core contracts that are overridden as supported by the dependency registry, and
|
|
1059
|
+
* consistent with the length returned by `getSupportedCoreContractCount`.
|
|
1060
|
+
* @param index Index of the core contract to be returned, relative to the overall
|
|
1061
|
+
* list of supported core contracts.
|
|
759
1062
|
* @return address of the core contract.
|
|
760
1063
|
*/
|
|
761
1064
|
function getSupportedCoreContract(
|
|
762
|
-
uint256
|
|
1065
|
+
uint256 index
|
|
763
1066
|
) external view returns (address) {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
1067
|
+
uint256 coreRegistryCount = ICoreRegistryV1(
|
|
1068
|
+
DependencyRegistryStorageLib.s().coreRegistryContract
|
|
1069
|
+
).getNumRegisteredContracts();
|
|
1070
|
+
if (index < coreRegistryCount) {
|
|
1071
|
+
return
|
|
1072
|
+
ICoreRegistryV1(
|
|
1073
|
+
DependencyRegistryStorageLib.s().coreRegistryContract
|
|
1074
|
+
).getRegisteredContractAt(index);
|
|
1075
|
+
}
|
|
1076
|
+
uint256 overrideCount = DependencyRegistryStorageLib
|
|
1077
|
+
.s()
|
|
1078
|
+
.supportedCoreContractsOverride
|
|
1079
|
+
.length();
|
|
1080
|
+
require(
|
|
1081
|
+
index < coreRegistryCount + overrideCount,
|
|
1082
|
+
"Index out of range"
|
|
1083
|
+
);
|
|
1084
|
+
|
|
1085
|
+
unchecked {
|
|
1086
|
+
return
|
|
1087
|
+
DependencyRegistryStorageLib
|
|
1088
|
+
.s()
|
|
1089
|
+
.supportedCoreContractsOverride
|
|
1090
|
+
.at(index - coreRegistryCount);
|
|
1091
|
+
}
|
|
769
1092
|
}
|
|
770
1093
|
|
|
771
1094
|
/**
|
|
772
1095
|
* @notice Returns whether the given contract address is a supported core contract.
|
|
1096
|
+
* @dev This checks if the given contract address is registered in the core registry
|
|
1097
|
+
* or if it is overridden as supported by the dependency registry.
|
|
773
1098
|
* @param coreContractAddress Address of the core contract to be queried.
|
|
774
1099
|
* @return True if the given contract address is a supported core contract.
|
|
775
1100
|
*/
|
|
776
1101
|
function isSupportedCoreContract(
|
|
777
1102
|
address coreContractAddress
|
|
778
|
-
)
|
|
779
|
-
return
|
|
1103
|
+
) public view returns (bool) {
|
|
1104
|
+
return
|
|
1105
|
+
ICoreRegistryV1(
|
|
1106
|
+
DependencyRegistryStorageLib.s().coreRegistryContract
|
|
1107
|
+
).isRegisteredContract(coreContractAddress) ||
|
|
1108
|
+
DependencyRegistryStorageLib
|
|
1109
|
+
.s()
|
|
1110
|
+
.supportedCoreContractsOverride
|
|
1111
|
+
.contains(coreContractAddress);
|
|
780
1112
|
}
|
|
781
1113
|
|
|
782
1114
|
/**
|
|
@@ -790,83 +1122,117 @@ contract DependencyRegistryV0 is
|
|
|
790
1122
|
view
|
|
791
1123
|
returns (address[] memory)
|
|
792
1124
|
{
|
|
793
|
-
|
|
1125
|
+
// get all registered contracts on the core registry
|
|
1126
|
+
address[] memory coreRegistryRegisteredContracts = ICoreRegistryV1(
|
|
1127
|
+
DependencyRegistryStorageLib.s().coreRegistryContract
|
|
1128
|
+
).getAllRegisteredContracts();
|
|
1129
|
+
// @dev memoize for efficiency
|
|
1130
|
+
uint256 coreRegistryRegisteredContractsLength = coreRegistryRegisteredContracts
|
|
1131
|
+
.length;
|
|
1132
|
+
// get all overridden contracts in the supportedCoreContractsOverride set
|
|
1133
|
+
address[]
|
|
1134
|
+
memory supportedCoreContractsOverride = DependencyRegistryStorageLib
|
|
1135
|
+
.s()
|
|
1136
|
+
.supportedCoreContractsOverride
|
|
1137
|
+
.values();
|
|
1138
|
+
|
|
1139
|
+
// concat the two address arrays and return the result
|
|
794
1140
|
address[] memory supportedCoreContracts = new address[](
|
|
795
|
-
|
|
1141
|
+
coreRegistryRegisteredContracts.length +
|
|
1142
|
+
supportedCoreContractsOverride.length
|
|
796
1143
|
);
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
1144
|
+
// @dev memoize for efficiency
|
|
1145
|
+
uint256 supportedCoreContractsLength = supportedCoreContracts.length;
|
|
1146
|
+
for (uint i = 0; i < supportedCoreContractsLength; i++) {
|
|
1147
|
+
if (i < coreRegistryRegisteredContractsLength) {
|
|
1148
|
+
supportedCoreContracts[i] = coreRegistryRegisteredContracts[i];
|
|
1149
|
+
} else {
|
|
1150
|
+
supportedCoreContracts[i] = supportedCoreContractsOverride[
|
|
1151
|
+
i - coreRegistryRegisteredContractsLength
|
|
1152
|
+
];
|
|
1153
|
+
}
|
|
800
1154
|
}
|
|
801
|
-
|
|
802
1155
|
return supportedCoreContracts;
|
|
803
1156
|
}
|
|
804
1157
|
|
|
805
1158
|
/**
|
|
806
|
-
* @notice Returns the additional CDN URL at index `
|
|
807
|
-
* @param
|
|
808
|
-
* @param
|
|
1159
|
+
* @notice Returns the additional CDN URL at index `index` for dependency `dependencyNameAndVersion`.
|
|
1160
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1161
|
+
* @param index The index of an additional CDN, relative to the overall `additionalCDNCount`.
|
|
809
1162
|
*/
|
|
810
1163
|
function getDependencyAdditionalCDN(
|
|
811
|
-
bytes32
|
|
812
|
-
uint256
|
|
1164
|
+
bytes32 dependencyNameAndVersion,
|
|
1165
|
+
uint256 index
|
|
813
1166
|
) external view returns (string memory) {
|
|
814
|
-
Dependency
|
|
1167
|
+
DependencyRegistryStorageLib.Dependency
|
|
1168
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1169
|
+
.s()
|
|
1170
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
815
1171
|
_onlyInRangeIndex({
|
|
816
|
-
|
|
817
|
-
|
|
1172
|
+
index: index,
|
|
1173
|
+
length: dependency.additionalCDNCount
|
|
818
1174
|
});
|
|
819
|
-
return dependency.additionalCDNs[
|
|
1175
|
+
return dependency.additionalCDNs[index];
|
|
820
1176
|
}
|
|
821
1177
|
|
|
822
1178
|
/**
|
|
823
|
-
* @notice Returns the additional repository URL at index `
|
|
824
|
-
* @param
|
|
825
|
-
* @param
|
|
1179
|
+
* @notice Returns the additional repository URL at index `index` for dependency `dependencyNameAndVersion`.
|
|
1180
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1181
|
+
* @param index The index of an additional repository, relative to the overall `additionalRepositoryCount`.
|
|
826
1182
|
*/
|
|
827
1183
|
function getDependencyAdditionalRepository(
|
|
828
|
-
bytes32
|
|
829
|
-
uint256
|
|
1184
|
+
bytes32 dependencyNameAndVersion,
|
|
1185
|
+
uint256 index
|
|
830
1186
|
) external view returns (string memory) {
|
|
831
|
-
Dependency
|
|
1187
|
+
DependencyRegistryStorageLib.Dependency
|
|
1188
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1189
|
+
.s()
|
|
1190
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
832
1191
|
_onlyInRangeIndex({
|
|
833
|
-
|
|
834
|
-
|
|
1192
|
+
index: index,
|
|
1193
|
+
length: dependency.additionalRepositoryCount
|
|
835
1194
|
});
|
|
836
|
-
return dependency.additionalRepositories[
|
|
1195
|
+
return dependency.additionalRepositories[index];
|
|
837
1196
|
}
|
|
838
1197
|
|
|
839
1198
|
/**
|
|
840
|
-
* @notice Returns the count of scripts for dependency `
|
|
841
|
-
* @param
|
|
1199
|
+
* @notice Returns the count of scripts for dependency `dependencyNameAndVersion`.
|
|
1200
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
842
1201
|
*/
|
|
843
1202
|
function getDependencyScriptCount(
|
|
844
|
-
bytes32
|
|
1203
|
+
bytes32 dependencyNameAndVersion
|
|
845
1204
|
) external view returns (uint256) {
|
|
846
|
-
return
|
|
1205
|
+
return
|
|
1206
|
+
DependencyRegistryStorageLib
|
|
1207
|
+
.s()
|
|
1208
|
+
.dependencyRecords[dependencyNameAndVersion]
|
|
1209
|
+
.scriptCount;
|
|
847
1210
|
}
|
|
848
1211
|
|
|
849
1212
|
/**
|
|
850
1213
|
* @notice Returns address with bytecode containing script for
|
|
851
|
-
* dependency `_dependencyTypes` at script index `
|
|
852
|
-
* @param
|
|
853
|
-
* @param
|
|
1214
|
+
* dependency `_dependencyTypes` at script index `index`.
|
|
1215
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1216
|
+
* @param index The index of a given script, relative to the overall `scriptCount`.
|
|
854
1217
|
* @return The address of the bytecode storage for the script at the given index, if it can be determined.
|
|
855
1218
|
*/
|
|
856
1219
|
function getDependencyScriptBytecodeAddress(
|
|
857
|
-
bytes32
|
|
858
|
-
uint256
|
|
1220
|
+
bytes32 dependencyNameAndVersion,
|
|
1221
|
+
uint256 index
|
|
859
1222
|
) external view returns (address) {
|
|
860
|
-
Dependency
|
|
861
|
-
|
|
862
|
-
|
|
1223
|
+
DependencyRegistryStorageLib.Dependency
|
|
1224
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1225
|
+
.s()
|
|
1226
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
1227
|
+
_onlyInRangeIndex({index: index, length: dependency.scriptCount});
|
|
1228
|
+
return dependency.scriptBytecodeAddresses[index];
|
|
863
1229
|
}
|
|
864
1230
|
|
|
865
1231
|
/**
|
|
866
1232
|
* @notice Returns the storage library version for
|
|
867
|
-
* dependency `_dependencyTypes` at script index `
|
|
868
|
-
* @param
|
|
869
|
-
* @param
|
|
1233
|
+
* dependency `_dependencyTypes` at script index `index`.
|
|
1234
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1235
|
+
* @param index The index of a given script, relative to the overall `scriptCount`.
|
|
870
1236
|
* @return The storage library version for the script at the given index, if it can be determined.
|
|
871
1237
|
* @dev Note that we only expect this to be determinable if the script was written using a version
|
|
872
1238
|
* of the Art Blocks `BytecodeStorage` library, and in other cases the fallback will be the
|
|
@@ -875,23 +1241,24 @@ contract DependencyRegistryV0 is
|
|
|
875
1241
|
* that can be fallback-read optimistically.
|
|
876
1242
|
*/
|
|
877
1243
|
function getDependencyScriptBytecodeStorageVersion(
|
|
878
|
-
bytes32
|
|
879
|
-
uint256
|
|
1244
|
+
bytes32 dependencyNameAndVersion,
|
|
1245
|
+
uint256 index
|
|
880
1246
|
) external view returns (bytes32) {
|
|
881
|
-
Dependency
|
|
882
|
-
|
|
1247
|
+
DependencyRegistryStorageLib.Dependency
|
|
1248
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1249
|
+
.s()
|
|
1250
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
1251
|
+
_onlyInRangeIndex({index: index, length: dependency.scriptCount});
|
|
883
1252
|
return
|
|
884
1253
|
BytecodeStorageReader.getLibraryVersionForBytecode(
|
|
885
|
-
|
|
886
|
-
_index
|
|
887
|
-
]
|
|
1254
|
+
dependency.scriptBytecodeAddresses[index]
|
|
888
1255
|
);
|
|
889
1256
|
}
|
|
890
1257
|
|
|
891
1258
|
/**
|
|
892
|
-
* @notice Returns script for dependency `
|
|
893
|
-
* @param
|
|
894
|
-
* @param
|
|
1259
|
+
* @notice Returns script for dependency `dependencyNameAndVersion` at script index `index`.
|
|
1260
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1261
|
+
* @param index The index of a given script, relative to the overall `scriptCount`.
|
|
895
1262
|
* @return A string containing the script content at the given script chunk index for a given dependency.
|
|
896
1263
|
* @dev This method attempts to introspectively determine which library version of
|
|
897
1264
|
* `BytecodeStorage` was used to write the stored script string that is being
|
|
@@ -902,13 +1269,16 @@ contract DependencyRegistryV0 is
|
|
|
902
1269
|
* can cause failure (e.g. unexpected continuation byte).
|
|
903
1270
|
*/
|
|
904
1271
|
function getDependencyScript(
|
|
905
|
-
bytes32
|
|
906
|
-
uint256
|
|
1272
|
+
bytes32 dependencyNameAndVersion,
|
|
1273
|
+
uint256 index
|
|
907
1274
|
) external view returns (string memory) {
|
|
908
|
-
Dependency
|
|
909
|
-
|
|
1275
|
+
DependencyRegistryStorageLib.Dependency
|
|
1276
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1277
|
+
.s()
|
|
1278
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
1279
|
+
_onlyInRangeIndex({index: index, length: dependency.scriptCount});
|
|
910
1280
|
|
|
911
|
-
address scriptAddress = dependency.scriptBytecodeAddresses[
|
|
1281
|
+
address scriptAddress = dependency.scriptBytecodeAddresses[index];
|
|
912
1282
|
bytes32 storageVersion = BytecodeStorageReader
|
|
913
1283
|
.getLibraryVersionForBytecode(scriptAddress);
|
|
914
1284
|
|
|
@@ -925,30 +1295,31 @@ contract DependencyRegistryV0 is
|
|
|
925
1295
|
}
|
|
926
1296
|
|
|
927
1297
|
/**
|
|
928
|
-
* @notice Returns the dependency
|
|
1298
|
+
* @notice Returns the dependency name and version for a given project (`projectId`)
|
|
929
1299
|
* on a given core contract (`_contractAddress`). If no override is set,
|
|
930
1300
|
* the core contract is called to retrieve the script type and version as
|
|
931
1301
|
* dependency type. For any contract earlier than v3, that does not have
|
|
932
1302
|
* an override set, this will revert.
|
|
933
|
-
* @param
|
|
934
|
-
* @param
|
|
935
|
-
* @return dependencyType Identifier for the dependency (i.e. "
|
|
1303
|
+
* @param contractAddress Core contract address.
|
|
1304
|
+
* @param projectId Project to return dependency type for.
|
|
1305
|
+
* @return dependencyType Identifier for the dependency (i.e. "name@version") used by project.
|
|
936
1306
|
*/
|
|
937
|
-
function
|
|
938
|
-
address
|
|
939
|
-
uint256
|
|
1307
|
+
function getDependencyNameAndVersionForProject(
|
|
1308
|
+
address contractAddress,
|
|
1309
|
+
uint256 projectId
|
|
940
1310
|
) external view returns (string memory) {
|
|
941
|
-
_onlySupportedCoreContract(
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1311
|
+
_onlySupportedCoreContract(contractAddress);
|
|
1312
|
+
|
|
1313
|
+
bytes32 dependencyNameAndVersion = DependencyRegistryStorageLib
|
|
1314
|
+
.s()
|
|
1315
|
+
.projectDependencyOverrides[contractAddress][projectId];
|
|
1316
|
+
if (dependencyNameAndVersion != bytes32(0)) {
|
|
1317
|
+
return dependencyNameAndVersion.toString();
|
|
947
1318
|
}
|
|
948
1319
|
|
|
949
1320
|
try
|
|
950
|
-
IDependencyRegistryCompatibleV0(
|
|
951
|
-
.projectScriptDetails(
|
|
1321
|
+
IDependencyRegistryCompatibleV0(contractAddress)
|
|
1322
|
+
.projectScriptDetails(projectId)
|
|
952
1323
|
returns (string memory scriptTypeAndVersion, string memory, uint256) {
|
|
953
1324
|
return scriptTypeAndVersion;
|
|
954
1325
|
} catch {
|
|
@@ -958,19 +1329,33 @@ contract DependencyRegistryV0 is
|
|
|
958
1329
|
}
|
|
959
1330
|
}
|
|
960
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
* @notice utility function to convert from string to bytes32.
|
|
1334
|
+
* Useful when a human is calling functions that take bytes32 as input.
|
|
1335
|
+
* Reverts if input string does not fit within 32 bytes.
|
|
1336
|
+
* @param input String to convert to bytes32.
|
|
1337
|
+
* @return bytes32 representation of input.
|
|
1338
|
+
*/
|
|
1339
|
+
function stringToBytes32(
|
|
1340
|
+
string memory input
|
|
1341
|
+
) external pure returns (bytes32) {
|
|
1342
|
+
_onlyBytes32String(input);
|
|
1343
|
+
return input.stringToBytes32();
|
|
1344
|
+
}
|
|
1345
|
+
|
|
961
1346
|
/**
|
|
962
1347
|
* @notice Convenience function that returns whether `_sender` is allowed
|
|
963
1348
|
* to call function with selector `_selector` on contract `_contract`, as
|
|
964
1349
|
* determined by this contract's current Admin ACL contract. Expected use
|
|
965
1350
|
* cases include minter contracts checking if caller is allowed to call
|
|
966
1351
|
* admin-gated functions on minter contracts.
|
|
967
|
-
* @param
|
|
968
|
-
* `
|
|
969
|
-
* @param
|
|
970
|
-
* @param
|
|
971
|
-
* `
|
|
972
|
-
* @return bool Whether `
|
|
973
|
-
* `
|
|
1352
|
+
* @param sender Address of the sender calling function with selector
|
|
1353
|
+
* `selector` on contract `contract_`.
|
|
1354
|
+
* @param contract_ Address of the contract being called by `sender`.
|
|
1355
|
+
* @param selector Function selector of the function being called by
|
|
1356
|
+
* `sender`.
|
|
1357
|
+
* @return bool Whether `sender` is allowed to call function with selector
|
|
1358
|
+
* `selector` on contract `contract_`.
|
|
974
1359
|
* @dev assumes the Admin ACL contract is the owner of this contract, which
|
|
975
1360
|
* is expected to always be true.
|
|
976
1361
|
* @dev adminACLContract is expected to either be null address (if owner
|
|
@@ -978,13 +1363,66 @@ contract DependencyRegistryV0 is
|
|
|
978
1363
|
* null address first to avoid revert when admin has renounced ownership.
|
|
979
1364
|
*/
|
|
980
1365
|
function adminACLAllowed(
|
|
981
|
-
address
|
|
982
|
-
address
|
|
983
|
-
bytes4
|
|
1366
|
+
address sender,
|
|
1367
|
+
address contract_,
|
|
1368
|
+
bytes4 selector
|
|
984
1369
|
) public returns (bool) {
|
|
985
1370
|
return
|
|
986
1371
|
owner() != address(0) &&
|
|
987
|
-
adminACLContract.allowed(
|
|
1372
|
+
DependencyRegistryStorageLib.s().adminACLContract.allowed(
|
|
1373
|
+
sender,
|
|
1374
|
+
contract_,
|
|
1375
|
+
selector
|
|
1376
|
+
);
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* @notice Returns details for a given dependency type `dependencyNameAndVersion`.
|
|
1381
|
+
* @param dependencyNameAndVersion Name and version of dependency (i.e. "name@version") used to identify dependency.
|
|
1382
|
+
* @return nameAndVersion String representation of `dependencyNameAndVersion`.
|
|
1383
|
+
* (e.g. "p5js(atSymbol)1.0.0")
|
|
1384
|
+
* @return licenseType License type for dependency
|
|
1385
|
+
* @return preferredCDN Preferred CDN URL for dependency
|
|
1386
|
+
* @return additionalCDNCount Count of additional CDN URLs for dependency
|
|
1387
|
+
* @return preferredRepository Preferred repository URL for dependency
|
|
1388
|
+
* @return additionalRepositoryCount Count of additional repository URLs for dependency
|
|
1389
|
+
* @return dependencyWebsite Project website URL for dependency
|
|
1390
|
+
* @return availableOnChain Whether dependency is available on chain
|
|
1391
|
+
* @return scriptCount Count of on-chain scripts for dependency
|
|
1392
|
+
*/
|
|
1393
|
+
function getDependencyDetails(
|
|
1394
|
+
bytes32 dependencyNameAndVersion
|
|
1395
|
+
)
|
|
1396
|
+
public
|
|
1397
|
+
view
|
|
1398
|
+
returns (
|
|
1399
|
+
string memory nameAndVersion,
|
|
1400
|
+
string memory licenseType,
|
|
1401
|
+
string memory preferredCDN,
|
|
1402
|
+
uint24 additionalCDNCount,
|
|
1403
|
+
string memory preferredRepository,
|
|
1404
|
+
uint24 additionalRepositoryCount,
|
|
1405
|
+
string memory dependencyWebsite,
|
|
1406
|
+
bool availableOnChain,
|
|
1407
|
+
uint24 scriptCount
|
|
1408
|
+
)
|
|
1409
|
+
{
|
|
1410
|
+
DependencyRegistryStorageLib.Dependency
|
|
1411
|
+
storage dependency = DependencyRegistryStorageLib
|
|
1412
|
+
.s()
|
|
1413
|
+
.dependencyRecords[dependencyNameAndVersion];
|
|
1414
|
+
|
|
1415
|
+
return (
|
|
1416
|
+
dependencyNameAndVersion.toString(),
|
|
1417
|
+
dependency.licenseType.toString(),
|
|
1418
|
+
dependency.preferredCDN,
|
|
1419
|
+
dependency.additionalCDNCount,
|
|
1420
|
+
dependency.preferredRepository,
|
|
1421
|
+
dependency.additionalRepositoryCount,
|
|
1422
|
+
dependency.website,
|
|
1423
|
+
dependency.scriptCount > 0,
|
|
1424
|
+
dependency.scriptCount
|
|
1425
|
+
);
|
|
988
1426
|
}
|
|
989
1427
|
|
|
990
1428
|
/**
|
|
@@ -1003,6 +1441,14 @@ contract DependencyRegistryV0 is
|
|
|
1003
1441
|
return OwnableUpgradeable.owner();
|
|
1004
1442
|
}
|
|
1005
1443
|
|
|
1444
|
+
/**
|
|
1445
|
+
* @notice This function returns the address of the admin ACL contract.
|
|
1446
|
+
* @return address Address of the admin ACL contract.
|
|
1447
|
+
*/
|
|
1448
|
+
function adminACLContract() public view returns (address) {
|
|
1449
|
+
return address(DependencyRegistryStorageLib.s().adminACLContract);
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1006
1452
|
/**
|
|
1007
1453
|
* @notice Transfers ownership of the contract to a new account (`newOwner`).
|
|
1008
1454
|
* Internal function without access restriction.
|
|
@@ -1013,6 +1459,8 @@ contract DependencyRegistryV0 is
|
|
|
1013
1459
|
*/
|
|
1014
1460
|
function _transferOwnership(address newOwner) internal override {
|
|
1015
1461
|
OwnableUpgradeable._transferOwnership(newOwner);
|
|
1016
|
-
adminACLContract = IAdminACLV0(
|
|
1462
|
+
DependencyRegistryStorageLib.s().adminACLContract = IAdminACLV0(
|
|
1463
|
+
newOwner
|
|
1464
|
+
);
|
|
1017
1465
|
}
|
|
1018
1466
|
}
|