@etherisc/gif-next 0.0.2-b9e43cf-870 → 0.0.2-bb1081a-994
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/{IBaseComponent.sol/IBaseComponent.json → Component.sol/Component.json} +230 -14
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +141 -10
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +107 -87
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +543 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +623 -45
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +643 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +227 -73
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +146 -15
- 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/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +38 -62
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +181 -15
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +0 -5
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +113 -76
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +47 -60
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +42 -83
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +59 -58
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +37 -24
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -32
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +102 -31
- 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 +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +229 -93
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +31 -18
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +126 -47
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +31 -14
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +98 -38
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +0 -5
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +0 -5
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +0 -5
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +0 -5
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +153 -82
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +44 -31
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +126 -47
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +31 -14
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +126 -47
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +31 -14
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +83 -3
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +33 -28
- 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 +96 -24
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +18 -18
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +61 -56
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +28 -15
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +70 -53
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +23 -26
- 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/IRegisterable.sol/IRegisterable.json +0 -5
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +0 -5
- 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 +19 -6
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +19 -6
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -11
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +13 -5
- 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 +19 -11
- 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 +29 -21
- 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/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/Component.sol +247 -0
- package/contracts/components/Distribution.sol +27 -48
- package/contracts/components/IComponent.sol +50 -0
- package/contracts/components/IDistributionComponent.sol +5 -2
- package/contracts/components/IPoolComponent.sol +40 -29
- package/contracts/components/IProductComponent.sol +7 -3
- package/contracts/components/Pool.sol +123 -138
- package/contracts/components/Product.sol +48 -86
- package/contracts/instance/BundleManager.sol +7 -11
- package/contracts/instance/IInstance.sol +20 -10
- package/contracts/instance/IInstanceService.sol +1 -1
- package/contracts/instance/Instance.sol +28 -31
- package/contracts/instance/InstanceAccessManager.sol +6 -11
- package/contracts/instance/InstanceReader.sol +3 -25
- package/contracts/instance/InstanceService.sol +31 -14
- package/contracts/instance/ObjectManager.sol +7 -24
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/module/ISetup.sol +2 -2
- package/contracts/instance/service/BundleService.sol +11 -6
- package/contracts/instance/service/DistributionService.sol +22 -36
- package/contracts/instance/service/IBundleService.sol +11 -1
- package/contracts/instance/service/PolicyService.sol +56 -76
- package/contracts/instance/service/PoolService.sol +19 -55
- package/contracts/instance/service/ProductService.sol +49 -30
- package/contracts/registry/IRegistry.sol +13 -6
- package/contracts/registry/IRegistryService.sol +16 -9
- package/contracts/registry/Registry.sol +100 -44
- package/contracts/registry/RegistryAccessManager.sol +31 -25
- package/contracts/registry/RegistryService.sol +27 -85
- package/contracts/registry/ReleaseManager.sol +72 -82
- package/contracts/registry/TokenRegistry.sol +5 -3
- package/contracts/shared/IRegisterable.sol +1 -3
- package/contracts/shared/NftOwnable.sol +5 -0
- package/contracts/shared/Registerable.sol +10 -14
- package/contracts/shared/Service.sol +4 -2
- package/contracts/types/RoleId.sol +2 -2
- package/package.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -814
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
- package/contracts/components/BaseComponent.sol +0 -159
- package/contracts/components/IBaseComponent.sol +0 -34
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +0 -23
- package/contracts/instance/IInstanceBase.sol +0 -26
- package/contracts/instance/InstanceBase.sol +0 -41
- package/contracts/instance/base/ComponentServiceBase.sol +0 -76
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/service/ComponentOwnerService.sol +0 -315
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -21,7 +21,7 @@ contract ReleaseManager is AccessManaged
|
|
21
21
|
{
|
22
22
|
using ObjectTypeLib for ObjectType;
|
23
23
|
|
24
|
-
event LogReleaseCreation(VersionPart version
|
24
|
+
event LogReleaseCreation(VersionPart version);
|
25
25
|
event LogReleaseActivation(VersionPart version);
|
26
26
|
|
27
27
|
// createNextRelease
|
@@ -32,8 +32,8 @@ contract ReleaseManager is AccessManaged
|
|
32
32
|
error NotService();
|
33
33
|
|
34
34
|
// activateNextRelease
|
35
|
-
|
36
|
-
|
35
|
+
error ReleaseNotCreated();
|
36
|
+
error ReleaseRegistrationNotFinished();
|
37
37
|
|
38
38
|
// _getAndVerifyContractInfo
|
39
39
|
error UnexpectedRegisterableType(ObjectType expected, ObjectType found);
|
@@ -55,8 +55,9 @@ contract ReleaseManager is AccessManaged
|
|
55
55
|
RegistryAccessManager private immutable _accessManager;
|
56
56
|
IRegistry private immutable _registry;
|
57
57
|
|
58
|
+
VersionPart immutable _initial;// first active version
|
58
59
|
VersionPart _latest;// latest active version
|
59
|
-
VersionPart
|
60
|
+
VersionPart _next;// version to create and activate
|
60
61
|
|
61
62
|
mapping(VersionPart version => IRegistry.ReleaseInfo info) _release;
|
62
63
|
|
@@ -66,6 +67,8 @@ contract ReleaseManager is AccessManaged
|
|
66
67
|
|
67
68
|
mapping(address registryService => bool isActive) _active;
|
68
69
|
|
70
|
+
mapping(VersionPart version => bool isValid) _valid; // TODO refactor to use _active only
|
71
|
+
|
69
72
|
constructor(
|
70
73
|
RegistryAccessManager accessManager,
|
71
74
|
VersionPart initialVersion)
|
@@ -76,20 +79,63 @@ contract ReleaseManager is AccessManaged
|
|
76
79
|
_accessManager = accessManager;
|
77
80
|
|
78
81
|
_initial = initialVersion;
|
82
|
+
_next = initialVersion;
|
79
83
|
|
80
84
|
_registry = new Registry();
|
81
85
|
}
|
82
86
|
|
87
|
+
/// @dev skips previous release if was not activated
|
88
|
+
function createNextRelease()
|
89
|
+
external
|
90
|
+
restricted // GIF_ADMIN_ROLE
|
91
|
+
{
|
92
|
+
// allow to register new registry service for next version
|
93
|
+
VersionPartLib.toVersionPart(_next.toInt() + 1);
|
94
|
+
// disallow registration of regular services for next version while registry service is not registered
|
95
|
+
_awaitingRegistration = 0;
|
96
|
+
|
97
|
+
emit LogReleaseCreation(_next);
|
98
|
+
}
|
99
|
+
|
100
|
+
function activateNextRelease()
|
101
|
+
external
|
102
|
+
restricted // GIF_ADMIN_ROLE
|
103
|
+
{
|
104
|
+
VersionPart version = _next;
|
105
|
+
address service = _registry.getServiceAddress(REGISTRY(), version);
|
106
|
+
|
107
|
+
// release was created
|
108
|
+
if(service == address(0)) {
|
109
|
+
revert ReleaseNotCreated();
|
110
|
+
}
|
111
|
+
|
112
|
+
// release fully deployed
|
113
|
+
if(_awaitingRegistration > 0) {
|
114
|
+
revert ReleaseRegistrationNotFinished();
|
115
|
+
}
|
116
|
+
|
117
|
+
//setTargetClosed(service, false);
|
118
|
+
|
119
|
+
_latest = version;
|
120
|
+
|
121
|
+
_active[service] = true;
|
122
|
+
_valid[version] = true;
|
123
|
+
|
124
|
+
emit LogReleaseActivation(version);
|
125
|
+
}
|
126
|
+
|
83
127
|
// TODO deploy proxy and initialize with given implementation instead of using given proxy?
|
84
128
|
// IMPORTANT: MUST never be possible to create with access/release manager, token registry
|
85
|
-
|
129
|
+
// callable once per release after release creation, can not register regular services while registry service is not registered
|
130
|
+
function registerRegistryService(IRegistryService service)
|
86
131
|
external
|
87
|
-
restricted //
|
132
|
+
restricted // GIF_MANAGER_ROLE
|
88
133
|
returns(NftId nftId)
|
89
134
|
{
|
90
135
|
if(!service.supportsInterface(type(IRegistryService).interfaceId)) {
|
91
136
|
revert NotRegistryService();
|
92
137
|
}
|
138
|
+
|
93
139
|
// TODO unreliable! MUST guarantee the same authority -> how?
|
94
140
|
address serviceAuthority = service.authority();
|
95
141
|
if(serviceAuthority != authority()) {
|
@@ -98,16 +144,14 @@ contract ReleaseManager is AccessManaged
|
|
98
144
|
serviceAuthority);
|
99
145
|
}
|
100
146
|
|
101
|
-
(
|
102
|
-
IRegistry.ObjectInfo memory info,
|
103
|
-
bytes memory data
|
104
|
-
) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
147
|
+
IRegistry.ObjectInfo memory info = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
105
148
|
|
106
|
-
VersionPart version =
|
149
|
+
VersionPart version = _next;
|
107
150
|
ObjectType domain = REGISTRY();
|
108
151
|
_verifyServiceInfo(info, version, domain);
|
109
152
|
|
110
|
-
|
153
|
+
// data: config bytes
|
154
|
+
_createRelease(service.getFunctionConfigs());
|
111
155
|
|
112
156
|
//setTargetClosed(service, true);
|
113
157
|
|
@@ -115,8 +159,6 @@ contract ReleaseManager is AccessManaged
|
|
115
159
|
|
116
160
|
// external call
|
117
161
|
service.linkToRegisteredNftId();
|
118
|
-
|
119
|
-
emit LogReleaseCreation(version, service);
|
120
162
|
}
|
121
163
|
|
122
164
|
// TODO adding service to release -> synchronized with proxy upgrades or simple addServiceToRelease(service, version, selector)?
|
@@ -130,67 +172,30 @@ contract ReleaseManager is AccessManaged
|
|
130
172
|
revert NotService();
|
131
173
|
}
|
132
174
|
|
133
|
-
(
|
134
|
-
IRegistry.ObjectInfo memory info,
|
135
|
-
//bytes memory data
|
136
|
-
) = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
137
|
-
|
175
|
+
IRegistry.ObjectInfo memory info = _getAndVerifyContractInfo(service, SERVICE(), msg.sender);
|
138
176
|
VersionPart version = getNextVersion();
|
139
177
|
ObjectType domain = _release[version].domains[_awaitingRegistration];// reversed registration order of services specified in RegistryService config
|
140
178
|
_verifyServiceInfo(info, version, domain);
|
141
179
|
|
142
180
|
// setup and grant unique role if service does registrations
|
143
|
-
address registryService = _registry.getServiceAddress(REGISTRY(), version);
|
144
181
|
bytes4[] memory selector = new bytes4[](1);
|
145
182
|
selector[0] = _selector[version][domain];
|
183
|
+
address registryService = _registry.getServiceAddress(REGISTRY(), version);
|
146
184
|
if(selector[0] != 0) {
|
147
185
|
_accessManager.setAndGrantUniqueRole(
|
148
186
|
address(service),
|
149
187
|
registryService,
|
150
188
|
selector);
|
151
189
|
}
|
152
|
-
|
190
|
+
|
153
191
|
_awaitingRegistration--;
|
154
192
|
|
155
|
-
// activate release
|
156
|
-
if(_awaitingRegistration == 0) {
|
157
|
-
_latest = version;
|
158
|
-
_active[registryService] = true;
|
159
|
-
|
160
|
-
emit LogReleaseActivation(version);
|
161
|
-
}
|
162
|
-
|
163
193
|
nftId = _registry.registerService(info, version, domain);
|
164
194
|
|
165
195
|
// external call
|
166
196
|
service.linkToRegisteredNftId();
|
167
197
|
}
|
168
198
|
|
169
|
-
/*function activateNextRelease()
|
170
|
-
external
|
171
|
-
restricted // GIF_ADMIN_ROLE
|
172
|
-
{
|
173
|
-
VersionPart version = getNextVersion();
|
174
|
-
address service = _registry.getServiceAddress(REGISTRY(), version);
|
175
|
-
|
176
|
-
// release was created
|
177
|
-
if(service == address(0)) {
|
178
|
-
revert ReleaseNotCreated();
|
179
|
-
}
|
180
|
-
|
181
|
-
// release fully deployed
|
182
|
-
if(_awaitingRegistration > 0) {
|
183
|
-
revert ReleaseRegistrationNotFinished();
|
184
|
-
}
|
185
|
-
|
186
|
-
//setTargetClosed(service, false);
|
187
|
-
|
188
|
-
_latest = version;
|
189
|
-
_active[service] = true;
|
190
|
-
|
191
|
-
LogReleaseActivation(version);
|
192
|
-
}*/
|
193
|
-
|
194
199
|
//--- view functions ----------------------------------------------------//
|
195
200
|
|
196
201
|
function isActiveRegistryService(address service) external view returns(bool)
|
@@ -198,6 +203,11 @@ contract ReleaseManager is AccessManaged
|
|
198
203
|
return _active[service];
|
199
204
|
}
|
200
205
|
|
206
|
+
function isValidRelease(VersionPart version) external view returns(bool)
|
207
|
+
{
|
208
|
+
return _valid[version];
|
209
|
+
}
|
210
|
+
|
201
211
|
function getRegistry() external view returns(address)
|
202
212
|
{
|
203
213
|
return (address(_registry));
|
@@ -210,11 +220,7 @@ contract ReleaseManager is AccessManaged
|
|
210
220
|
|
211
221
|
function getNextVersion() public view returns(VersionPart)
|
212
222
|
{
|
213
|
-
|
214
|
-
|
215
|
-
return latest == 0 ?
|
216
|
-
_initial : // no active releases yet
|
217
|
-
VersionPartLib.toVersionPart(latest + 1);
|
223
|
+
return _next;
|
218
224
|
}
|
219
225
|
|
220
226
|
function getLatestVersion() external view returns(VersionPart) {
|
@@ -233,13 +239,12 @@ contract ReleaseManager is AccessManaged
|
|
233
239
|
address expectedOwner // assume always valid, can not be 0
|
234
240
|
)
|
235
241
|
internal
|
236
|
-
view
|
242
|
+
// view
|
237
243
|
returns(
|
238
|
-
IRegistry.ObjectInfo memory info
|
239
|
-
bytes memory data
|
244
|
+
IRegistry.ObjectInfo memory info
|
240
245
|
)
|
241
246
|
{
|
242
|
-
|
247
|
+
info = service.getInitialInfo();
|
243
248
|
info.objectAddress = address(service);
|
244
249
|
info.isInterceptor = false; // service is never interceptor, at least now
|
245
250
|
|
@@ -256,23 +261,10 @@ contract ReleaseManager is AccessManaged
|
|
256
261
|
if(owner == address(service)) {
|
257
262
|
revert SelfRegistration();
|
258
263
|
}
|
259
|
-
|
260
|
-
/*if(owner == address(0)) { // never 0
|
261
|
-
revert();// RegisterableOwnerIsZero();
|
262
|
-
}*/
|
263
264
|
|
264
265
|
if(_registry.isRegistered(owner)) {
|
265
266
|
revert RegisterableOwnerIsRegistered();
|
266
267
|
}
|
267
|
-
|
268
|
-
/*NftId parentNftId = info.parentNftId;
|
269
|
-
IRegistry.ObjectInfo memory parentInfo = getRegistry().getObjectInfo(parentNftId);
|
270
|
-
|
271
|
-
if(parentInfo.objectType != parentType) { // parent registration + type
|
272
|
-
revert InvalidParent(parentNftId);
|
273
|
-
}*/
|
274
|
-
|
275
|
-
return(info, data);
|
276
268
|
}
|
277
269
|
|
278
270
|
function _verifyServiceInfo(
|
@@ -293,21 +285,18 @@ contract ReleaseManager is AccessManaged
|
|
293
285
|
revert UnexpectedServiceVersion(expectedVersion, version);
|
294
286
|
}
|
295
287
|
|
296
|
-
if(expectedDomain
|
297
|
-
|
298
|
-
revert UnexpectedServiceDomain(expectedDomain, domain);
|
299
|
-
}
|
288
|
+
if(domain != expectedDomain) {
|
289
|
+
revert UnexpectedServiceDomain(expectedDomain, domain);
|
300
290
|
}
|
301
291
|
|
302
292
|
return domain;
|
303
293
|
}
|
304
294
|
|
305
295
|
// TODO check if registry supports types specified in the config array
|
306
|
-
function _createRelease(
|
296
|
+
function _createRelease(IRegistryService.FunctionConfig[] memory config)
|
307
297
|
internal
|
308
298
|
{
|
309
299
|
VersionPart version = getNextVersion();
|
310
|
-
IRegistryService.FunctionConfig[] memory config = abi.decode(configBytes, (IRegistryService.FunctionConfig[]));
|
311
300
|
|
312
301
|
if(config.length == 0) {
|
313
302
|
revert ConfigMissing();
|
@@ -325,6 +314,7 @@ contract ReleaseManager is AccessManaged
|
|
325
314
|
domain.eqz()
|
326
315
|
) { revert ConfigServiceDomainInvalid(idx, domain); }
|
327
316
|
|
317
|
+
// TODO can be zero -> e.g. duplicate domain, first with zero selector, second with non zero selector -> need to check _release[version].domains.contains(domain) instead
|
328
318
|
// no overwrite
|
329
319
|
if(_selector[version][domain] > 0) {
|
330
320
|
revert SelectorAlreadyExists(version, domain);
|
@@ -32,13 +32,15 @@ contract TokenRegistry is
|
|
32
32
|
|
33
33
|
|
34
34
|
/// @dev link ownership of token registry to nft owner of registry service
|
35
|
+
// TODO latter registry service will get new release, new address, new nft, TokenRegistry will not catch that -> use AccessManaged only for services
|
35
36
|
function linkToNftOwnable(address registryAddress)
|
36
37
|
external
|
37
38
|
onlyOwner
|
38
39
|
{
|
39
40
|
IRegistry registry = IRegistry(registryAddress);
|
40
|
-
// TODO use _latest instead of
|
41
|
-
address registryServiceAddress = registry.getServiceAddress(REGISTRY(), registry.
|
41
|
+
// TODO use _latest instead of _initial -> but _latest is 0 before first release activation
|
42
|
+
address registryServiceAddress = registry.getServiceAddress(REGISTRY(), registry.getNextVersion());
|
43
|
+
//address registryServiceAddress = registry.getServiceAddress(REGISTRY(), registry.getInitialVersion());
|
42
44
|
|
43
45
|
_linkToNftOwnable(registryAddress, registryServiceAddress);
|
44
46
|
}
|
@@ -58,7 +60,7 @@ contract TokenRegistry is
|
|
58
60
|
// verify valid major version
|
59
61
|
// ensure major version increments is one
|
60
62
|
uint256 version = majorVersion.toInt();
|
61
|
-
if (
|
63
|
+
if (!_registry.isValidRelease(majorVersion)) {
|
62
64
|
revert TokenMajorVersionInvalid(majorVersion);
|
63
65
|
}
|
64
66
|
|
@@ -5,13 +5,11 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
5
5
|
|
6
6
|
import {INftOwnable} from "./INftOwnable.sol";
|
7
7
|
import {IRegistry} from "../registry/IRegistry.sol";
|
8
|
-
import {NftId} from "../types/NftId.sol";
|
9
|
-
import {ObjectType} from "../types/ObjectType.sol";
|
10
8
|
|
11
9
|
interface IRegisterable is IERC165, INftOwnable {
|
12
10
|
|
13
11
|
function getInitialInfo()
|
14
12
|
external
|
15
13
|
view
|
16
|
-
returns (IRegistry.ObjectInfo memory
|
14
|
+
returns (IRegistry.ObjectInfo memory);
|
17
15
|
}
|
@@ -5,8 +5,10 @@ import {INftOwnable} from "./INftOwnable.sol";
|
|
5
5
|
import {IRegistry} from "../registry/IRegistry.sol";
|
6
6
|
import {NftId, zeroNftId} from "../types/NftId.sol";
|
7
7
|
|
8
|
+
// TODO make contract upgradeable
|
8
9
|
contract NftOwnable is INftOwnable {
|
9
10
|
|
11
|
+
// TODO move vars to struct and add _getNftOwnableStorage
|
10
12
|
IRegistry internal _registry;
|
11
13
|
NftId private _nftId;
|
12
14
|
address private _initialOwner;
|
@@ -55,6 +57,9 @@ contract NftOwnable is INftOwnable {
|
|
55
57
|
return _nftId;
|
56
58
|
}
|
57
59
|
|
60
|
+
function getInitialOwner() public view returns (address) {
|
61
|
+
return _initialOwner;
|
62
|
+
}
|
58
63
|
|
59
64
|
function getOwner() public view virtual override returns (address) {
|
60
65
|
if (_nftId.gtz()) {
|
@@ -71,20 +71,16 @@ contract Registerable is
|
|
71
71
|
public
|
72
72
|
view
|
73
73
|
virtual
|
74
|
-
returns (IRegistry.ObjectInfo memory
|
74
|
+
returns (IRegistry.ObjectInfo memory info)
|
75
75
|
{
|
76
|
-
RegisterableStorage
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
$._data
|
86
|
-
),
|
87
|
-
bytes("")
|
88
|
-
);
|
76
|
+
RegisterableStorage memory $ = _getRegisterableStorage();
|
77
|
+
info = IRegistry.ObjectInfo(
|
78
|
+
zeroNftId(),
|
79
|
+
$._parentNftId,
|
80
|
+
$._objectType,
|
81
|
+
$._isInterceptor,
|
82
|
+
address(this),
|
83
|
+
getInitialOwner(),
|
84
|
+
$._data);
|
89
85
|
}
|
90
86
|
}
|
@@ -8,14 +8,16 @@ import {Version, VersionPart, VersionLib} from "../types/Version.sol";
|
|
8
8
|
import {Versionable} from "./Versionable.sol";
|
9
9
|
import {IService} from "./IService.sol";
|
10
10
|
import {IVersionable} from "./IVersionable.sol";
|
11
|
-
import {
|
11
|
+
import {Versionable} from "./Versionable.sol";
|
12
|
+
import {Registerable} from "./Registerable.sol";
|
12
13
|
|
13
14
|
import {IRegistry} from "../registry/IRegistry.sol";
|
14
15
|
|
15
16
|
|
16
17
|
/// @dev service base contract
|
17
18
|
abstract contract Service is
|
18
|
-
|
19
|
+
Registerable,
|
20
|
+
Versionable,
|
19
21
|
IService
|
20
22
|
{
|
21
23
|
function getDomain() public pure virtual override returns(ObjectType);
|
@@ -38,8 +38,8 @@ function POLICY_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId
|
|
38
38
|
function BUNDLE_SERVICE_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(2500); }
|
39
39
|
|
40
40
|
|
41
|
-
function
|
42
|
-
function
|
41
|
+
function GIF_ADMIN_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1500); }
|
42
|
+
function GIF_MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1600); }
|
43
43
|
function RELEASE_MANAGER_ROLE() pure returns (RoleId) { return RoleIdLib.toRoleId(1700); }
|
44
44
|
|
45
45
|
// @dev Returns true iff role ids a and b are identical
|
package/package.json
CHANGED