@etherisc/gif-next 0.0.2-aa8d0c4-506 → 0.0.2-ab4c2da-820
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 +63 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +126 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +136 -62
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +88 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +0 -52
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +28 -2
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +168 -102
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +144 -64
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +788 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/{AccessManagedSimple.sol/AccessManagedSimple.json → Cloneable.sol/Cloneable.json} +86 -2
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +981 -10
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +448 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +30 -14
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +169 -139
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +55 -32
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +763 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +74 -40
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +269 -94
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +102 -34
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +285 -0
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +30 -19
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +923 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +440 -0
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +39 -52
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +43 -53
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +15 -23
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +669 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +13 -13
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -13
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +664 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +15 -77
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +25 -240
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +971 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +464 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +42 -157
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +15 -35
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +755 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +420 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +82 -262
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +188 -65
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +112 -331
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +37 -79
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +38 -112
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +551 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +14 -27
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +13 -13
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +13 -13
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +4 -4
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +31 -31
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/BaseComponent.sol +49 -8
- package/contracts/components/Distribution.sol +12 -15
- package/contracts/components/IBaseComponent.sol +6 -0
- package/contracts/components/IDistributionComponent.sol +0 -2
- package/contracts/components/IPoolComponent.sol +5 -1
- package/contracts/components/Pool.sol +49 -25
- package/contracts/components/Product.sol +41 -46
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +23 -0
- package/contracts/instance/BundleManager.sol +129 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +25 -4
- package/contracts/instance/IInstanceBase.sol +26 -0
- package/contracts/instance/IInstanceService.sol +7 -3
- package/contracts/instance/Instance.sol +44 -23
- package/contracts/instance/InstanceAccessManager.sol +6 -6
- package/contracts/instance/InstanceBase.sol +41 -0
- package/contracts/instance/InstanceReader.sol +9 -0
- package/contracts/instance/InstanceService.sol +190 -73
- package/contracts/instance/InstanceServiceManager.sol +8 -6
- package/contracts/instance/ObjectManager.sol +101 -0
- package/contracts/instance/base/ComponentServiceBase.sol +36 -24
- package/contracts/instance/module/ISetup.sol +3 -1
- package/contracts/instance/service/BundleService.sol +260 -0
- package/contracts/instance/service/BundleServiceManager.sol +55 -0
- package/contracts/instance/service/ComponentOwnerService.sol +4 -6
- package/contracts/instance/service/DistributionService.sol +41 -26
- package/contracts/instance/service/DistributionServiceManager.sol +8 -6
- package/contracts/instance/service/IBundleService.sol +45 -0
- package/contracts/instance/service/IPolicyService.sol +87 -0
- package/contracts/instance/service/IPoolService.sol +6 -23
- package/contracts/instance/service/IProductService.sol +6 -73
- package/contracts/instance/service/PolicyService.sol +503 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +46 -129
- package/contracts/instance/service/PoolServiceManager.sol +8 -6
- package/contracts/instance/service/ProductService.sol +168 -0
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +16 -33
- package/contracts/registry/IRegistryService.sol +37 -12
- package/contracts/registry/Registry.sol +138 -242
- package/contracts/registry/RegistryAccessManager.sol +207 -0
- package/contracts/registry/RegistryService.sol +83 -152
- package/contracts/registry/RegistryServiceManager.sol +18 -36
- package/contracts/registry/ReleaseManager.sol +382 -0
- package/contracts/registry/TokenRegistry.sol +5 -6
- package/contracts/shared/IService.sol +2 -1
- package/contracts/shared/NftOwnable.sol +2 -4
- package/contracts/shared/ProxyManager.sol +1 -1
- package/contracts/shared/Service.sol +11 -7
- package/contracts/test/TestService.sol +3 -2
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/RoleId.sol +7 -5
- package/package.json +1 -1
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +0 -1132
- package/contracts/instance/AccessManagedSimple.sol +0 -115
- package/contracts/instance/AccessManagerSimple.sol +0 -692
@@ -0,0 +1,382 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccessManaged} from "@openzeppelin/contracts/access/manager/AccessManaged.sol";
|
5
|
+
import {AccessManager} from "@openzeppelin/contracts/access/manager/AccessManager.sol";
|
6
|
+
|
7
|
+
import {NftId} from "../types/NftId.sol";
|
8
|
+
import {RoleId} from "../types/RoleId.sol";
|
9
|
+
import {ObjectType, zeroObjectType, SERVICE} from "../types/ObjectType.sol";
|
10
|
+
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
11
|
+
|
12
|
+
import {IVersionable} from "../shared/IVersionable.sol";
|
13
|
+
import {IService} from "../shared/IService.sol";
|
14
|
+
import {ProxyManager} from "../shared/ProxyManager.sol";
|
15
|
+
|
16
|
+
import {IRegistry} from "./IRegistry.sol";
|
17
|
+
import {Registry} from "./Registry.sol";
|
18
|
+
import {IRegistryService} from "./IRegistryService.sol";
|
19
|
+
import {RegistryService} from "./RegistryService.sol";
|
20
|
+
import {RegistryServiceManager} from "./RegistryServiceManager.sol";
|
21
|
+
import {RegistryAccessManager} from "./RegistryAccessManager.sol";
|
22
|
+
|
23
|
+
|
24
|
+
contract ReleaseManager is AccessManaged
|
25
|
+
{
|
26
|
+
event LogReleaseCreation(VersionPart version, IService registryService);
|
27
|
+
event LogServiceRegistration(VersionPart majorVersion, ObjectType serviceDomain);
|
28
|
+
event LogReleaseActivation(VersionPart version);
|
29
|
+
|
30
|
+
// createNextRelease
|
31
|
+
error NotRegistryService();
|
32
|
+
error UnexpectedServiceAuthority(address expected, address found);
|
33
|
+
|
34
|
+
// registerService
|
35
|
+
error NotService();
|
36
|
+
error ServiceNotInRelease(IService service, ObjectType serviceDomain);
|
37
|
+
error ServiceAlreadyRegistered(address service);
|
38
|
+
|
39
|
+
// activateNextRelease
|
40
|
+
//error ReleaseNotCreated();
|
41
|
+
//error ReleaseRegistrationNotFinished();
|
42
|
+
|
43
|
+
// _getAndVerifyContractInfo
|
44
|
+
error UnexpectedRegisterableType(ObjectType expected, ObjectType found);
|
45
|
+
error NotRegisterableOwner(address expectedOwner);
|
46
|
+
error SelfRegistration();
|
47
|
+
error RegisterableOwnerIsRegistered();
|
48
|
+
|
49
|
+
// _verifyServiceInfo
|
50
|
+
error UnexpectedServiceVersion(VersionPart expected, VersionPart found);
|
51
|
+
error UnexpectedServiceDomain(ObjectType expected, ObjectType found);
|
52
|
+
|
53
|
+
// _verifyAndStoreConfig
|
54
|
+
error ConfigMissing();
|
55
|
+
error ConfigServiceDomainInvalid();
|
56
|
+
error ConfigSelectorMissing();
|
57
|
+
error ConfigSelectorZero();
|
58
|
+
error ConfigSelectorAlreadyExists(VersionPart serviceVersion, ObjectType serviceDomain);
|
59
|
+
|
60
|
+
struct ReleaseInfo {
|
61
|
+
ObjectType[] types; // service types in release
|
62
|
+
}
|
63
|
+
|
64
|
+
// unique role for some service function
|
65
|
+
struct ConfigInfo {
|
66
|
+
bytes4[] selector; // selector used by service
|
67
|
+
RoleId roleId; // roleId granted to service
|
68
|
+
}
|
69
|
+
|
70
|
+
RegistryAccessManager private immutable _accessManager;
|
71
|
+
IRegistry private immutable _registry;
|
72
|
+
|
73
|
+
VersionPart _latest;// latest active version
|
74
|
+
VersionPart immutable _initial;// first active version
|
75
|
+
|
76
|
+
mapping(VersionPart version => ReleaseInfo info) _release;
|
77
|
+
|
78
|
+
mapping(VersionPart version => mapping(ObjectType serviceDomain => ConfigInfo)) _config;
|
79
|
+
|
80
|
+
mapping(VersionPart version => mapping(ObjectType serviceDomain => address)) _service;
|
81
|
+
|
82
|
+
uint _awaitingRegistration; // "services left to register" counter
|
83
|
+
|
84
|
+
mapping(address registryService => bool isActive) _active;
|
85
|
+
|
86
|
+
constructor(
|
87
|
+
RegistryAccessManager accessManager,
|
88
|
+
VersionPart initialVersion)
|
89
|
+
AccessManaged(accessManager.authority())
|
90
|
+
{
|
91
|
+
require(address(accessManager) > address(0));
|
92
|
+
require(initialVersion.toInt() > 0);
|
93
|
+
|
94
|
+
_accessManager = accessManager;
|
95
|
+
|
96
|
+
_initial = initialVersion;
|
97
|
+
|
98
|
+
_registry = new Registry(address(this), initialVersion);
|
99
|
+
}
|
100
|
+
|
101
|
+
// TODO deploy proxy and initialize with given implementation instead of using given proxy?
|
102
|
+
// IMPORTANT: MUST never be possible to create with access/release manager, token registry
|
103
|
+
function createNextRelease(IRegistryService registryService)
|
104
|
+
external
|
105
|
+
restricted // GIF_ADMIN_ROLE
|
106
|
+
returns(NftId nftId)
|
107
|
+
{
|
108
|
+
if(!registryService.supportsInterface(type(IRegistryService).interfaceId)) {
|
109
|
+
revert NotRegistryService();
|
110
|
+
}
|
111
|
+
// TODO unreliable! MUST guarantee the same authority -> how?
|
112
|
+
if(registryService.authority() != authority()) {
|
113
|
+
revert UnexpectedServiceAuthority(
|
114
|
+
authority(),
|
115
|
+
registryService.authority());
|
116
|
+
}
|
117
|
+
|
118
|
+
(
|
119
|
+
IRegistry.ObjectInfo memory info,
|
120
|
+
bytes memory data
|
121
|
+
) = _getAndVerifyContractInfo(registryService, SERVICE(), msg.sender);
|
122
|
+
|
123
|
+
VersionPart nextVersion = getNextVersion();
|
124
|
+
_verifyServiceInfo(info, nextVersion, SERVICE());
|
125
|
+
|
126
|
+
_verifyAndStoreConfig(data);
|
127
|
+
|
128
|
+
//setTargetClosed(newRegistryService, true);
|
129
|
+
|
130
|
+
_registerService(address(registryService), nextVersion, SERVICE());
|
131
|
+
|
132
|
+
nftId = _registry.registerService(info);
|
133
|
+
|
134
|
+
// external call
|
135
|
+
registryService.linkToRegisteredNftId();
|
136
|
+
|
137
|
+
emit LogReleaseCreation(nextVersion, registryService);
|
138
|
+
}
|
139
|
+
|
140
|
+
function registerService(IService service)
|
141
|
+
external
|
142
|
+
restricted // GIF_MANAGER_ROLE
|
143
|
+
returns(NftId nftId)
|
144
|
+
{
|
145
|
+
if(!service.supportsInterface(type(IService).interfaceId)) {
|
146
|
+
revert NotService();
|
147
|
+
}
|
148
|
+
|
149
|
+
(
|
150
|
+
IRegistry.ObjectInfo memory info,
|
151
|
+
//bytes memory data
|
152
|
+
) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
153
|
+
|
154
|
+
VersionPart nextVersion = getNextVersion();
|
155
|
+
ObjectType serviceDomain = _verifyServiceInfo(info, nextVersion, zeroObjectType());
|
156
|
+
|
157
|
+
bytes4[] memory selector = _config[nextVersion][serviceDomain].selector;
|
158
|
+
|
159
|
+
// service type is in release
|
160
|
+
if(selector.length == 0) {
|
161
|
+
revert ServiceNotInRelease(service, serviceDomain);
|
162
|
+
}
|
163
|
+
|
164
|
+
// setup and grant unique role
|
165
|
+
address registryService = getService(nextVersion, SERVICE());
|
166
|
+
RoleId roleId = _accessManager.setAndGrantUniqueRole(
|
167
|
+
address(service),
|
168
|
+
registryService,
|
169
|
+
selector);
|
170
|
+
|
171
|
+
_config[nextVersion][serviceDomain].roleId = roleId;
|
172
|
+
_awaitingRegistration--;
|
173
|
+
|
174
|
+
// activate release
|
175
|
+
if(_awaitingRegistration == 0) {
|
176
|
+
_latest = nextVersion;
|
177
|
+
_active[registryService] = true;
|
178
|
+
|
179
|
+
emit LogReleaseActivation(nextVersion);
|
180
|
+
}
|
181
|
+
|
182
|
+
_registerService(address(service), nextVersion, serviceDomain);
|
183
|
+
|
184
|
+
nftId = _registry.registerService(info);
|
185
|
+
|
186
|
+
// external call
|
187
|
+
service.linkToRegisteredNftId();
|
188
|
+
}
|
189
|
+
|
190
|
+
/*function activateNextRelease()
|
191
|
+
external
|
192
|
+
restricted // GIF_ADMIN_ROLE
|
193
|
+
{
|
194
|
+
VersionPart nextVersion = getNextVersion();
|
195
|
+
address service = _service[nextVersion][SERVICE()];
|
196
|
+
|
197
|
+
// release was created
|
198
|
+
if(service == address(0)) {
|
199
|
+
revert ReleaseNotCreated();
|
200
|
+
}
|
201
|
+
|
202
|
+
// release fully deployed
|
203
|
+
if(_awaitingRegistration > 0) {
|
204
|
+
revert ReleaseRegistrationNotFinished();
|
205
|
+
}
|
206
|
+
|
207
|
+
//setTargetClosed(newRegistryService, false);
|
208
|
+
|
209
|
+
_latest = nextVersion;
|
210
|
+
_active[service] = true;
|
211
|
+
|
212
|
+
LogReleaseActivation(nextVersion);
|
213
|
+
}*/
|
214
|
+
|
215
|
+
//--- view functions ----------------------------------------------------//
|
216
|
+
|
217
|
+
function isActiveRegistryService(address service) external view returns(bool)
|
218
|
+
{
|
219
|
+
return _active[service];
|
220
|
+
}
|
221
|
+
|
222
|
+
function getRegistry() external view returns(address)
|
223
|
+
{
|
224
|
+
return (address(_registry));
|
225
|
+
}
|
226
|
+
|
227
|
+
function getService(VersionPart serviceVersion, ObjectType serviceDomain) public view returns(address)
|
228
|
+
{
|
229
|
+
return _service[serviceVersion][serviceDomain];
|
230
|
+
}
|
231
|
+
|
232
|
+
function getReleaseInfo(VersionPart releaseVersion) external view returns(ReleaseInfo memory)
|
233
|
+
{
|
234
|
+
return _release[releaseVersion];
|
235
|
+
}
|
236
|
+
|
237
|
+
function getNextVersion() public view returns(VersionPart)
|
238
|
+
{
|
239
|
+
uint256 latest = _latest.toInt();
|
240
|
+
|
241
|
+
return latest == 0 ?
|
242
|
+
_initial : // no active releases yet
|
243
|
+
VersionPartLib.toVersionPart(latest + 1);
|
244
|
+
}
|
245
|
+
|
246
|
+
function getLatestVersion() external view returns(VersionPart) {
|
247
|
+
return _latest;
|
248
|
+
}
|
249
|
+
|
250
|
+
function getInitialVersion() external view returns(VersionPart) {
|
251
|
+
return _initial;
|
252
|
+
}
|
253
|
+
|
254
|
+
//--- private functions ----------------------------------------------------//
|
255
|
+
|
256
|
+
function _registerService(address service, VersionPart version, ObjectType serviceDomain)
|
257
|
+
internal
|
258
|
+
{
|
259
|
+
if(_service[version][serviceDomain] > address(0)) {
|
260
|
+
revert ServiceAlreadyRegistered(service);
|
261
|
+
}
|
262
|
+
|
263
|
+
_service[version][serviceDomain] = service;
|
264
|
+
|
265
|
+
emit LogServiceRegistration(version, serviceDomain);
|
266
|
+
}
|
267
|
+
|
268
|
+
function _getAndVerifyContractInfo(
|
269
|
+
IService service,
|
270
|
+
ObjectType expectedType,
|
271
|
+
address expectedOwner // assume always valid, can not be 0
|
272
|
+
)
|
273
|
+
internal
|
274
|
+
view
|
275
|
+
returns(
|
276
|
+
IRegistry.ObjectInfo memory info,
|
277
|
+
bytes memory data
|
278
|
+
)
|
279
|
+
{
|
280
|
+
(info, data) = service.getInitialInfo();
|
281
|
+
info.objectAddress = address(service);
|
282
|
+
info.isInterceptor = false; // service is never interceptor, at least now
|
283
|
+
|
284
|
+
if(info.objectType != expectedType) {// type is checked in registry anyway...but service logic may depend on expected value
|
285
|
+
revert UnexpectedRegisterableType(expectedType, info.objectType);
|
286
|
+
}
|
287
|
+
|
288
|
+
address owner = info.initialOwner;
|
289
|
+
|
290
|
+
if(owner != expectedOwner) { // registerable owner protection
|
291
|
+
revert NotRegisterableOwner(expectedOwner);
|
292
|
+
}
|
293
|
+
|
294
|
+
if(owner == address(service)) {
|
295
|
+
revert SelfRegistration();
|
296
|
+
}
|
297
|
+
|
298
|
+
/*if(owner == address(0)) { // never 0
|
299
|
+
revert();// RegisterableOwnerIsZero();
|
300
|
+
}*/
|
301
|
+
|
302
|
+
if(_registry.isRegistered(owner)) {
|
303
|
+
revert RegisterableOwnerIsRegistered();
|
304
|
+
}
|
305
|
+
|
306
|
+
/*NftId parentNftId = info.parentNftId;
|
307
|
+
IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
|
308
|
+
|
309
|
+
if(parentInfo.objectType != parentType) { // parent registration + type
|
310
|
+
revert InvalidParent(parentNftId);
|
311
|
+
}*/
|
312
|
+
|
313
|
+
return(info, data);
|
314
|
+
}
|
315
|
+
|
316
|
+
function _verifyServiceInfo(
|
317
|
+
IRegistry.ObjectInfo memory info,
|
318
|
+
VersionPart expectedVersion,
|
319
|
+
ObjectType expectedType
|
320
|
+
)
|
321
|
+
internal
|
322
|
+
view
|
323
|
+
returns(ObjectType)
|
324
|
+
{
|
325
|
+
(
|
326
|
+
ObjectType serviceDomain,
|
327
|
+
VersionPart serviceVersion
|
328
|
+
) = abi.decode(info.data, (ObjectType, VersionPart));
|
329
|
+
|
330
|
+
if(serviceVersion != expectedVersion) {
|
331
|
+
revert UnexpectedServiceVersion(expectedVersion, serviceVersion);
|
332
|
+
}
|
333
|
+
|
334
|
+
if(expectedType != zeroObjectType()) {
|
335
|
+
if(serviceDomain != expectedType) {
|
336
|
+
revert UnexpectedServiceDomain(expectedType, serviceDomain);
|
337
|
+
}
|
338
|
+
}
|
339
|
+
|
340
|
+
return serviceDomain;
|
341
|
+
}
|
342
|
+
|
343
|
+
function _verifyAndStoreConfig(bytes memory configBytes)
|
344
|
+
internal
|
345
|
+
{
|
346
|
+
VersionPart nextVersion = getNextVersion();
|
347
|
+
IRegistryService.FunctionConfig[] memory config = abi.decode(configBytes, (IRegistryService.FunctionConfig[]));
|
348
|
+
|
349
|
+
if(config.length == 0) {
|
350
|
+
revert ConfigMissing();
|
351
|
+
}
|
352
|
+
// always in release
|
353
|
+
_release[nextVersion].types.push(SERVICE());
|
354
|
+
|
355
|
+
for(uint idx = 0; idx < config.length; idx++)
|
356
|
+
{
|
357
|
+
ObjectType serviceDomain = config[idx].serviceDomain;
|
358
|
+
bytes4[] memory selector = config[idx].selector;
|
359
|
+
|
360
|
+
// not "registry service" type
|
361
|
+
if(serviceDomain == SERVICE()) { revert ConfigServiceDomainInvalid(); }
|
362
|
+
|
363
|
+
// at least one selector exists
|
364
|
+
if(selector.length == 0) { revert ConfigSelectorMissing(); }
|
365
|
+
|
366
|
+
// no zero selectors
|
367
|
+
for(uint jdx = 0; jdx < selector.length; jdx++) {
|
368
|
+
if(selector[jdx] == 0) { revert ConfigSelectorZero(); }
|
369
|
+
}
|
370
|
+
|
371
|
+
// no overwrite
|
372
|
+
if(_config[nextVersion][serviceDomain].selector.length > 0) {
|
373
|
+
revert ConfigSelectorAlreadyExists(nextVersion, serviceDomain);
|
374
|
+
}
|
375
|
+
|
376
|
+
_config[nextVersion][serviceDomain].selector = selector;
|
377
|
+
_release[nextVersion].types.push(serviceDomain);
|
378
|
+
}
|
379
|
+
|
380
|
+
_awaitingRegistration = config.length;
|
381
|
+
}
|
382
|
+
}
|
@@ -6,16 +6,14 @@ import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165C
|
|
6
6
|
|
7
7
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
8
8
|
import {IRegistry} from "./IRegistry.sol";
|
9
|
-
import {
|
9
|
+
import {VersionPart} from "../types/Version.sol";
|
10
|
+
import {SERVICE} from "../types/ObjectType.sol";
|
10
11
|
import {NftOwnable} from "../shared/NftOwnable.sol";
|
11
12
|
|
12
13
|
/// @title contract to register token per GIF major release.
|
13
14
|
contract TokenRegistry is
|
14
15
|
NftOwnable
|
15
16
|
{
|
16
|
-
|
17
|
-
string public constant REGISTRY_SERVICE_NAME = "RegistryService";
|
18
|
-
|
19
17
|
event LogRegistered(address token, string symbol, uint256 decimals);
|
20
18
|
event LogTokenStateSet(address token, VersionPart majorVersion, bool active);
|
21
19
|
|
@@ -39,7 +37,8 @@ contract TokenRegistry is
|
|
39
37
|
onlyOwner
|
40
38
|
{
|
41
39
|
IRegistry registry = IRegistry(registryAddress);
|
42
|
-
|
40
|
+
// TODO use _latest instead of `next version` -> but _latest is 0 before first release activation
|
41
|
+
address registryServiceAddress = registry.getServiceAddress(SERVICE(), registry.getMajorVersionMax());
|
43
42
|
|
44
43
|
_linkToNftOwnable(registryAddress, registryServiceAddress);
|
45
44
|
}
|
@@ -80,7 +79,7 @@ contract TokenRegistry is
|
|
80
79
|
return _registered[token];
|
81
80
|
}
|
82
81
|
|
83
|
-
|
82
|
+
function isActive(address token, VersionPart majorVersion) external view returns (bool) {
|
84
83
|
return _active[token][majorVersion];
|
85
84
|
}
|
86
85
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {VersionPart} from "../types/Version.sol";
|
5
|
+
import {ObjectType} from "../types/ObjectType.sol";
|
5
6
|
|
6
7
|
import {IRegisterable} from "./IRegisterable.sol";
|
7
8
|
import {IVersionable} from "./IVersionable.sol";
|
@@ -10,6 +11,6 @@ interface IService is
|
|
10
11
|
IRegisterable,
|
11
12
|
IVersionable
|
12
13
|
{
|
13
|
-
function
|
14
|
+
function getDomain() external pure returns(ObjectType serviceDomain);
|
14
15
|
function getMajorVersion() external view returns(VersionPart majorVersion);
|
15
16
|
}
|
@@ -13,10 +13,7 @@ contract NftOwnable is INftOwnable {
|
|
13
13
|
|
14
14
|
/// @dev enforces msg.sender is owner of nft (or initial owner of nft ownable)
|
15
15
|
modifier onlyOwner() {
|
16
|
-
|
17
|
-
|
18
|
-
// owner == address(0) is eg uninitialized upgradable contract
|
19
|
-
if (owner != address(0) && msg.sender != owner) {
|
16
|
+
if (msg.sender != getOwner()) {
|
20
17
|
revert ErrorNotOwner(msg.sender);
|
21
18
|
}
|
22
19
|
_;
|
@@ -77,6 +74,7 @@ contract NftOwnable is INftOwnable {
|
|
77
74
|
internal
|
78
75
|
virtual
|
79
76
|
{
|
77
|
+
require(initialOwner > address(0), "NftOwnable: initial owner is 0");
|
80
78
|
_initialOwner = initialOwner;
|
81
79
|
_setRegistry(registryAddress);
|
82
80
|
}
|
@@ -38,6 +38,7 @@ contract ProxyManager is
|
|
38
38
|
returns (IVersionable versionable)
|
39
39
|
{
|
40
40
|
if (_isDeployed) { revert ErrorAlreadyDeployed(); }
|
41
|
+
_isDeployed = true;
|
41
42
|
|
42
43
|
address currentProxyOwner = getOwner(); // used by implementation
|
43
44
|
address initialProxyAdminOwner = address(this); // used by proxy
|
@@ -49,7 +50,6 @@ contract ProxyManager is
|
|
49
50
|
data
|
50
51
|
);
|
51
52
|
|
52
|
-
_isDeployed = true;
|
53
53
|
versionable = IVersionable(address(_proxy));
|
54
54
|
|
55
55
|
emit LogProxyDeployed(address(_proxy), initialImplementation);
|
@@ -1,21 +1,24 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {IService} from "./IService.sol";
|
6
|
-
import {IVersionable} from "./IVersionable.sol";
|
4
|
+
import {ObjectType, SERVICE} from "../types/ObjectType.sol";
|
7
5
|
import {NftId, zeroNftId} from "../types/NftId.sol";
|
8
|
-
import {RegisterableUpgradable} from "./RegisterableUpgradable.sol";
|
9
|
-
import {SERVICE} from "../types/ObjectType.sol";
|
10
6
|
import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
7
|
+
|
11
8
|
import {Versionable} from "./Versionable.sol";
|
9
|
+
import {IService} from "./IService.sol";
|
10
|
+
import {IVersionable} from "./IVersionable.sol";
|
11
|
+
import {RegisterableUpgradable} from "./RegisterableUpgradable.sol";
|
12
|
+
|
13
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
14
|
+
|
12
15
|
|
13
16
|
/// @dev service base contract
|
14
17
|
abstract contract Service is
|
15
18
|
RegisterableUpgradable,
|
16
19
|
IService
|
17
20
|
{
|
18
|
-
function
|
21
|
+
function getDomain() public pure virtual override returns(ObjectType);
|
19
22
|
|
20
23
|
function getMajorVersion() public view virtual override returns(VersionPart majorVersion) {
|
21
24
|
return getVersion().toMajorPart();
|
@@ -36,10 +39,11 @@ abstract contract Service is
|
|
36
39
|
address initialOwner
|
37
40
|
)
|
38
41
|
internal
|
42
|
+
virtual
|
39
43
|
//onlyInitializing //TODO uncomment when "fully" upgradeable
|
40
44
|
{
|
41
45
|
// service must provide its name and version upon registration
|
42
|
-
bytes memory data = abi.encode(
|
46
|
+
bytes memory data = abi.encode(getDomain(), getMajorVersion());
|
43
47
|
NftId registryNftId = _getRegistryNftId(registry);
|
44
48
|
bool isInterceptor = false;
|
45
49
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
+
import {ObjectType, PRODUCT} from "../../contracts/types/ObjectType.sol";
|
4
5
|
import {NftId} from "../../contracts/types/NftId.sol";
|
5
6
|
import {Version, VersionLib} from "../../contracts/types/Version.sol";
|
6
7
|
import {Service} from "../../contracts/shared/Service.sol";
|
@@ -18,7 +19,7 @@ contract TestService is Service {
|
|
18
19
|
_initializeService(registry, initialOwner);
|
19
20
|
}
|
20
21
|
|
21
|
-
function
|
22
|
-
return
|
22
|
+
function getDomain() public pure override returns(ObjectType) {
|
23
|
+
return PRODUCT();
|
23
24
|
}
|
24
25
|
}
|
@@ -11,35 +11,37 @@ library LibNftIdSet {
|
|
11
11
|
mapping(NftId nftid => uint256 index) at;
|
12
12
|
}
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
error ErrorNftIdSetAlreadyAdded(NftId nftId);
|
15
|
+
error ErrorNftIdSetNotInSet(NftId nftId);
|
16
|
+
|
17
|
+
|
18
|
+
function add(Set storage set, NftId nftId) external {
|
19
|
+
if (set.at[nftId] > 0) {
|
20
|
+
revert ErrorNftIdSetAlreadyAdded(nftId);
|
21
21
|
}
|
22
|
+
|
23
|
+
set.ids.push(nftId);
|
24
|
+
set.at[nftId] = set.ids.length;
|
22
25
|
}
|
23
26
|
|
24
|
-
function remove(Set storage set, NftId nftId) external
|
27
|
+
function remove(Set storage set, NftId nftId) external {
|
25
28
|
uint256 nftIdIndex = set.at[nftId];
|
26
29
|
|
27
|
-
if (nftIdIndex
|
28
|
-
|
29
|
-
uint256 lastIndex = set.ids.length - 1;
|
30
|
-
|
31
|
-
if (lastIndex != toDeleteIndex) {
|
32
|
-
NftId lastId = set.ids[lastIndex];
|
33
|
-
set.ids[toDeleteIndex] = lastId;
|
34
|
-
set.at[lastId] = nftIdIndex; // Replace lastValue's index to valueIndex
|
35
|
-
}
|
36
|
-
|
37
|
-
set.ids.pop();
|
38
|
-
delete set.at[nftId];
|
39
|
-
return true;
|
40
|
-
} else {
|
41
|
-
return false;
|
30
|
+
if (nftIdIndex == 0) {
|
31
|
+
revert ErrorNftIdSetNotInSet(nftId);
|
42
32
|
}
|
33
|
+
|
34
|
+
uint256 toDeleteIndex = nftIdIndex - 1;
|
35
|
+
uint256 lastIndex = set.ids.length - 1;
|
36
|
+
|
37
|
+
if (lastIndex != toDeleteIndex) {
|
38
|
+
NftId lastId = set.ids[lastIndex];
|
39
|
+
set.ids[toDeleteIndex] = lastId;
|
40
|
+
set.at[lastId] = nftIdIndex; // Replace lastValue's index to valueIndex
|
41
|
+
}
|
42
|
+
|
43
|
+
set.ids.pop();
|
44
|
+
delete set.at[nftId];
|
43
45
|
}
|
44
46
|
|
45
47
|
function isEmpty(Set storage set) external view returns(bool empty) {
|
@@ -50,7 +52,7 @@ library LibNftIdSet {
|
|
50
52
|
return set.at[nftId] > 0;
|
51
53
|
}
|
52
54
|
|
53
|
-
function
|
55
|
+
function size(Set storage set) external view returns(uint256 length) {
|
54
56
|
return set.ids.length;
|
55
57
|
}
|
56
58
|
|
@@ -30,17 +30,19 @@ function ORACLE_OWNER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2
|
|
30
30
|
function POOL_OWNER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(300); }
|
31
31
|
function PRODUCT_OWNER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(400); }
|
32
32
|
|
33
|
-
function DISTRIBUTION_REGISTRAR_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1000); }
|
34
|
-
function POLICY_REGISTRAR_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1100); }
|
35
|
-
function BUNDLE_REGISTRAR_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1200); }
|
36
|
-
function POOL_REGISTRAR_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1300); }
|
37
|
-
function PRODUCT_REGISTRAR_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1400); }
|
38
33
|
|
39
34
|
function DISTRIBUTION_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10000); }
|
40
35
|
function POOL_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10100); }
|
36
|
+
function PRODUCT_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10200); }
|
37
|
+
function POLICY_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10300); }
|
38
|
+
function BUNDLE_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(10400); }
|
41
39
|
|
42
40
|
function INSTANCE_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(11000); }
|
43
41
|
|
42
|
+
function REGISTRY_SERVICE_ADMIN_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1500); }
|
43
|
+
function REGISTRY_SERVICE_MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1600); }
|
44
|
+
function RELEASE_MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1700); }
|
45
|
+
|
44
46
|
// @dev Returns true iff role ids a and b are identical
|
45
47
|
function eqRoleId(RoleId a, RoleId b) pure returns (bool isSame) {
|
46
48
|
return RoleId.unwrap(a) == RoleId.unwrap(b);
|
package/package.json
CHANGED