@etherisc/gif-next 0.0.2-da0f894-204 → 0.0.2-db1e1e4-828
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -83
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +68 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +64 -14
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +158 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +150 -10
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +184 -149
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +158 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +114 -189
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +68 -0
- 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 +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +127 -182
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +175 -51
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +215 -252
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +472 -126
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +102 -168
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +304 -171
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +71 -23
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +85 -30
- 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/KeyValueStore.sol/KeyValueStore.json +40 -10
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +56 -73
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- 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/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +145 -53
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +21 -13
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +384 -249
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +74 -14
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +104 -41
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +11 -7
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +356 -111
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +57 -45
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +101 -14
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +212 -186
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +80 -14
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +250 -18
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +106 -19
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +511 -14
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +80 -14
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +152 -60
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +27 -19
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +561 -51
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +24 -12
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +114 -51
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +16 -12
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +19 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +0 -24
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +31 -12
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +17 -36
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- 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/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +80 -14
- 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/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.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/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +86 -15
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- 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/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +101 -26
- 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/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +2 -2
- 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/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +161 -0
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +40 -9
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- 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/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- 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/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/components/Component.sol +42 -10
- package/contracts/components/Distribution.sol +0 -13
- package/contracts/components/IComponent.sol +9 -1
- package/contracts/components/IDistributionComponent.sol +0 -8
- package/contracts/components/IPoolComponent.sol +5 -43
- package/contracts/components/Pool.sol +47 -122
- package/contracts/components/Product.sol +4 -0
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +6 -4
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +16 -10
- package/contracts/instance/IInstanceService.sol +18 -5
- package/contracts/instance/Instance.sol +46 -9
- package/contracts/instance/InstanceAccessManager.sol +388 -158
- package/contracts/instance/InstanceReader.sol +8 -10
- package/contracts/instance/InstanceService.sol +184 -179
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +17 -30
- package/contracts/instance/base/KeyValueStore.sol +13 -5
- package/contracts/instance/base/Lifecycle.sol +11 -2
- package/contracts/instance/module/IAccess.sol +21 -14
- package/contracts/instance/module/IBundle.sol +6 -4
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/ISetup.sol +4 -17
- package/contracts/instance/service/ApplicationService.sol +22 -18
- package/contracts/instance/service/BundleService.sol +209 -77
- package/contracts/instance/service/ClaimService.sol +3 -3
- package/contracts/instance/service/DistributionService.sol +118 -77
- package/contracts/instance/service/IApplicationService.sol +1 -0
- package/contracts/instance/service/IBundleService.sol +63 -25
- package/contracts/instance/service/IDistributionService.sol +14 -1
- package/contracts/instance/service/IPolicyService.sol +2 -0
- package/contracts/instance/service/IPoolService.sol +82 -3
- package/contracts/instance/service/PolicyService.sol +96 -138
- package/contracts/instance/service/PoolService.sol +214 -20
- package/contracts/instance/service/ProductService.sol +30 -53
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +2 -0
- package/contracts/registry/IRegistryService.sol +4 -3
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +23 -20
- package/contracts/registry/RegistryService.sol +10 -11
- package/contracts/registry/ReleaseManager.sol +20 -18
- package/contracts/shared/IService.sol +4 -6
- package/contracts/shared/Service.sol +21 -7
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +60 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/Fee.sol +13 -5
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +1 -0
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +6 -4
- package/contracts/types/StateId.sol +1 -0
- package/contracts/types/Timestamp.sol +1 -0
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
@@ -24,6 +24,7 @@ import {TokenHandler} from "../shared/TokenHandler.sol";
|
|
24
24
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
25
25
|
import {IPolicy} from "../instance/module/IPolicy.sol";
|
26
26
|
import {ISetup} from "../instance/module/ISetup.sol";
|
27
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
27
28
|
import {Pool} from "../components/Pool.sol";
|
28
29
|
import {Distribution} from "../components/Distribution.sol";
|
29
30
|
|
@@ -265,6 +266,9 @@ abstract contract Product is
|
|
265
266
|
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
266
267
|
ProductStorage storage $ = _getProductStorage();
|
267
268
|
|
269
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
|
270
|
+
IComponents.PoolInfo memory poolInfo = $._pool.getPoolInfo();
|
271
|
+
|
268
272
|
return ISetup.ProductSetupInfo(
|
269
273
|
getToken(),
|
270
274
|
$._tokenHandler,
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccessManagerUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagerUpgradeable.sol";
|
5
|
+
|
6
|
+
|
7
|
+
contract AccessManagerUpgradeableInitializeable is AccessManagerUpgradeable {
|
8
|
+
|
9
|
+
function initialize(address initialAdmin) initializer public {
|
10
|
+
__AccessManager_init(initialAdmin);
|
11
|
+
}
|
12
|
+
|
13
|
+
}
|
@@ -22,9 +22,10 @@ contract BundleManager is
|
|
22
22
|
event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
|
23
23
|
event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
|
24
24
|
event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
|
25
|
+
event LogBundleManagerBundleClosed(NftId poolNftId, NftId bundleNftId);
|
25
26
|
|
26
|
-
error
|
27
|
-
error
|
27
|
+
error ErrorBundleManagerPolicyAlreadyActivated(NftId policyNftId);
|
28
|
+
error ErrorBundleManagerBundleLocked(NftId bundleNftId, NftId policyNftId);
|
28
29
|
error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
|
29
30
|
error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
|
30
31
|
error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
|
@@ -32,7 +33,7 @@ contract BundleManager is
|
|
32
33
|
|
33
34
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
34
35
|
|
35
|
-
/// @dev links a policy
|
36
|
+
/// @dev links a policy to its bundle
|
36
37
|
// to link a policy it MUST NOT yet have been activated
|
37
38
|
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
38
39
|
function linkPolicy(NftId policyNftId) external restricted() {
|
@@ -42,7 +43,7 @@ contract BundleManager is
|
|
42
43
|
|
43
44
|
// ensure bundle is unlocked (in active set) and registered with this instance
|
44
45
|
if (!_isActive(poolNftId, bundleNftId)) {
|
45
|
-
revert
|
46
|
+
revert ErrorBundleManagerBundleLocked(bundleNftId, policyNftId);
|
46
47
|
}
|
47
48
|
|
48
49
|
LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
|
@@ -85,6 +86,7 @@ contract BundleManager is
|
|
85
86
|
emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
|
86
87
|
}
|
87
88
|
|
89
|
+
|
88
90
|
/// @dev unlocked (active) bundles are available to underwrite new policies
|
89
91
|
function unlock(NftId bundleNftId) external restricted() {
|
90
92
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
@@ -10,7 +10,8 @@ abstract contract Cloneable is
|
|
10
10
|
AccessManagedUpgradeable
|
11
11
|
{
|
12
12
|
event CloneableInitialized(address authority, address registry);
|
13
|
-
|
13
|
+
|
14
|
+
error CloneableAuthorityZero();
|
14
15
|
error CloneableRegistryInvalid(address registry);
|
15
16
|
|
16
17
|
IRegistry internal _registry;
|
@@ -25,9 +26,13 @@ abstract contract Cloneable is
|
|
25
26
|
address registry
|
26
27
|
)
|
27
28
|
public
|
28
|
-
|
29
|
+
onlyInitializing
|
29
30
|
{
|
30
31
|
// check/handle access managed
|
32
|
+
if(authority == address(0)) {
|
33
|
+
revert CloneableAuthorityZero();
|
34
|
+
}
|
35
|
+
|
31
36
|
__AccessManaged_init(authority);
|
32
37
|
|
33
38
|
// check/handle registry
|
@@ -6,15 +6,20 @@ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessMana
|
|
6
6
|
import {NftId} from "../types/NftId.sol";
|
7
7
|
import {StateId} from "../types/StateId.sol";
|
8
8
|
import {RiskId} from "../types/RiskId.sol";
|
9
|
+
import {VersionPart} from "../types/Version.sol";
|
10
|
+
import {Key32} from "../types/Key32.sol";
|
9
11
|
|
10
12
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
13
|
|
14
|
+
import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
|
15
|
+
|
12
16
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
13
17
|
import {BundleManager} from "./BundleManager.sol";
|
14
18
|
import {InstanceReader} from "./InstanceReader.sol";
|
15
19
|
|
16
20
|
import {IBundle} from "./module/IBundle.sol";
|
17
21
|
import {IBundleService} from "./service/IBundleService.sol";
|
22
|
+
import {IComponents} from "./module/IComponents.sol";
|
18
23
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
19
24
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
20
25
|
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
@@ -27,17 +32,15 @@ import {IPolicyService} from "./service/IPolicyService.sol";
|
|
27
32
|
import {IBundleService} from "./service/IBundleService.sol";
|
28
33
|
import {IRisk} from "./module/IRisk.sol";
|
29
34
|
import {ISetup} from "./module/ISetup.sol";
|
30
|
-
import {NftId} from "../types/NftId.sol";
|
31
|
-
import {RiskId} from "../types/RiskId.sol";
|
32
|
-
import {StateId} from "../types/StateId.sol";
|
33
|
-
import {VersionPart} from "../types/Version.sol";
|
34
|
-
import {Key32} from "../types/Key32.sol";
|
35
|
-
|
36
35
|
|
37
36
|
|
38
37
|
|
39
|
-
interface IInstance is
|
40
|
-
|
38
|
+
interface IInstance is
|
39
|
+
IRegisterable,
|
40
|
+
ITransferInterceptor,
|
41
|
+
IAccessManaged,
|
42
|
+
IKeyValueStore
|
43
|
+
{
|
41
44
|
function getDistributionService() external view returns (IDistributionService);
|
42
45
|
function getProductService() external view returns (IProductService);
|
43
46
|
function getPoolService() external view returns (IPoolService);
|
@@ -48,8 +51,8 @@ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
|
|
48
51
|
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
|
49
52
|
function updateDistributionSetupState(NftId distributionNftId, StateId newState) external;
|
50
53
|
|
51
|
-
function createPoolSetup(NftId poolNftId,
|
52
|
-
function updatePoolSetup(NftId poolNftId,
|
54
|
+
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external;
|
55
|
+
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external;
|
53
56
|
function updatePoolSetupState(NftId poolNftId, StateId newState) external;
|
54
57
|
|
55
58
|
function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external;
|
@@ -89,4 +92,7 @@ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
|
|
89
92
|
function getMajorVersion() external pure returns (VersionPart majorVersion);
|
90
93
|
function getInstanceReader() external view returns (InstanceReader);
|
91
94
|
function getBundleManager() external view returns (BundleManager);
|
95
|
+
|
96
|
+
function setInstanceAccessManager(InstanceAccessManager accessManager) external;
|
97
|
+
function getInstanceAccessManager() external view returns (InstanceAccessManager);
|
92
98
|
}
|
@@ -10,6 +10,7 @@ import {IRegistry} from "../registry/IRegistry.sol";
|
|
10
10
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
11
|
import {IComponent} from "../components/IComponent.sol";
|
12
12
|
|
13
|
+
import {AccessManagerUpgradeableInitializeable} from "./AccessManagerUpgradeableInitializeable.sol";
|
13
14
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
14
15
|
import {Instance} from "./Instance.sol";
|
15
16
|
import {InstanceReader} from "./InstanceReader.sol";
|
@@ -18,6 +19,7 @@ import {BundleManager} from "./BundleManager.sol";
|
|
18
19
|
interface IInstanceService is IService {
|
19
20
|
|
20
21
|
error ErrorInstanceServiceMasterInstanceAlreadySet();
|
22
|
+
error ErrorInstanceServiceMasterOzAccessManagerAlreadySet();
|
21
23
|
error ErrorInstanceServiceMasterInstanceAccessManagerAlreadySet();
|
22
24
|
error ErrorInstanceServiceMasterBundleManagerAlreadySet();
|
23
25
|
error ErrorInstanceServiceInstanceAddressZero();
|
@@ -27,33 +29,44 @@ interface IInstanceService is IService {
|
|
27
29
|
error ErrorInstanceServiceInstanceReaderSameAsMasterInstanceReader();
|
28
30
|
error ErrorInstanceServiceInstanceReaderInstanceMismatch();
|
29
31
|
|
30
|
-
error
|
32
|
+
error ErrorInstanceServiceOzAccessManagerZero();
|
33
|
+
error ErrorInstanceServiceInstanceAccessManagerZero();
|
31
34
|
error ErrorInstanceServiceInstanceReaderZero();
|
32
35
|
error ErrorInstanceServiceBundleManagerZero();
|
33
36
|
|
34
37
|
error ErrorInstanceServiceInstanceAuthorityMismatch();
|
38
|
+
error ErrorInstanceServiceBundleManagerAuthorityMismatch();
|
35
39
|
error ErrorInstanceServiceInstanceReaderInstanceMismatch2();
|
36
40
|
error ErrorInstanceServiceBundleMangerInstanceMismatch();
|
37
41
|
|
38
42
|
error ErrorInstanceServiceRequestUnauhorized(address caller);
|
39
43
|
error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
|
44
|
+
error ErrorInstanceServiceNotInstance(NftId nftId);
|
40
45
|
error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
|
46
|
+
error ErrorInstanceServiceInstanceComponentMismatch(NftId instanceNftId, NftId componentNftId);
|
41
47
|
error ErrorInstanceServiceInvalidComponentType(address componentAddress, ObjectType expectedType, ObjectType componentType);
|
42
48
|
|
43
|
-
event LogInstanceCloned(address
|
49
|
+
event LogInstanceCloned(address clonedOzAccessManager, address clonedInstanceAccessManager, address clonedInstance, address clonedBundleManager, address clonedInstanceReader, NftId clonedInstanceNftId);
|
44
50
|
|
45
51
|
function createInstanceClone()
|
46
52
|
external
|
47
53
|
returns (
|
48
|
-
|
54
|
+
AccessManagerUpgradeableInitializeable clonedOzAccessManager,
|
55
|
+
InstanceAccessManager clonedInstanceAccessManager,
|
49
56
|
Instance clonedInstance,
|
50
57
|
NftId instanceNftId,
|
51
58
|
InstanceReader clonedInstanceReader,
|
52
59
|
BundleManager clonedBundleManager
|
53
60
|
);
|
54
61
|
|
55
|
-
function
|
56
|
-
|
62
|
+
function createGifTarget(
|
63
|
+
NftId instanceNftId,
|
64
|
+
address targetAddress,
|
65
|
+
string memory targetName,
|
66
|
+
bytes4[][] memory selectors,
|
67
|
+
RoleId[] memory roles
|
68
|
+
) external;
|
57
69
|
|
70
|
+
function setComponentLocked(bool locked) external;
|
58
71
|
}
|
59
72
|
|
@@ -9,14 +9,16 @@ import {ClaimId} from "../types/ClaimId.sol";
|
|
9
9
|
import {NumberId} from "../types/NumberId.sol";
|
10
10
|
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../types/ObjectType.sol";
|
11
11
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
12
|
-
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
12
|
+
import {RoleId, RoleIdLib, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
|
13
13
|
import {StateId, ACTIVE} from "../types/StateId.sol";
|
14
14
|
import {TimestampLib} from "../types/Timestamp.sol";
|
15
|
-
import {VersionPart} from "../types/Version.sol";
|
15
|
+
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
16
16
|
|
17
17
|
import {ERC165} from "../shared/ERC165.sol";
|
18
18
|
import {Registerable} from "../shared/Registerable.sol";
|
19
19
|
|
20
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
21
|
+
|
20
22
|
import {IInstance} from "./IInstance.sol";
|
21
23
|
import {InstanceReader} from "./InstanceReader.sol";
|
22
24
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
@@ -26,6 +28,7 @@ import {KeyValueStore} from "./base/KeyValueStore.sol";
|
|
26
28
|
|
27
29
|
import {IAccess} from "./module/IAccess.sol";
|
28
30
|
import {IBundle} from "./module/IBundle.sol";
|
31
|
+
import {IComponents} from "./module/IComponents.sol";
|
29
32
|
import {IDistribution} from "./module/IDistribution.sol";
|
30
33
|
import {IPolicy} from "./module/IPolicy.sol";
|
31
34
|
import {IRisk} from "./module/IRisk.sol";
|
@@ -36,6 +39,7 @@ import {IPoolService} from "./service/IPoolService.sol";
|
|
36
39
|
import {IProductService} from "./service/IProductService.sol";
|
37
40
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
38
41
|
import {IBundleService} from "./service/IBundleService.sol";
|
42
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
39
43
|
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
40
44
|
|
41
45
|
contract Instance is
|
@@ -59,13 +63,23 @@ contract Instance is
|
|
59
63
|
InstanceReader internal _instanceReader;
|
60
64
|
BundleManager internal _bundleManager;
|
61
65
|
|
62
|
-
|
66
|
+
modifier onlyChainNft() {
|
67
|
+
if(msg.sender != getRegistry().getChainNftAddress()) {
|
68
|
+
revert();
|
69
|
+
}
|
70
|
+
_;
|
71
|
+
}
|
72
|
+
|
73
|
+
function initialize(address authority, address registryAddress, address initialOwner)
|
63
74
|
public
|
64
75
|
initializer()
|
65
76
|
{
|
66
|
-
__AccessManaged_init(
|
77
|
+
__AccessManaged_init(authority);
|
67
78
|
|
68
|
-
|
79
|
+
IRegistry registry = IRegistry(registryAddress);
|
80
|
+
initializeRegisterable(registryAddress, registry.getNftId(), INSTANCE(), true, initialOwner, "");
|
81
|
+
initializeLifecycle();
|
82
|
+
|
69
83
|
registerInterface(type(IInstance).interfaceId);
|
70
84
|
}
|
71
85
|
|
@@ -96,12 +110,12 @@ contract Instance is
|
|
96
110
|
}
|
97
111
|
|
98
112
|
//--- PoolSetup ------------------------------------------------------//
|
99
|
-
function createPoolSetup(NftId poolNftId,
|
100
|
-
create(_toNftKey32(poolNftId, POOL()), abi.encode(
|
113
|
+
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
|
114
|
+
create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
|
101
115
|
}
|
102
116
|
|
103
|
-
function updatePoolSetup(NftId poolNftId,
|
104
|
-
update(_toNftKey32(poolNftId, POOL()), abi.encode(
|
117
|
+
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
|
118
|
+
update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
|
105
119
|
}
|
106
120
|
|
107
121
|
function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
|
@@ -221,6 +235,17 @@ contract Instance is
|
|
221
235
|
updateState(toPolicyKey32(policyNftId), newState);
|
222
236
|
}
|
223
237
|
|
238
|
+
//--- ITransferInterceptor ------------------------------------------------------------//
|
239
|
+
function nftMint(address to, uint256 tokenId) external onlyChainNft {
|
240
|
+
assert(_accessManager.roleMembers(INSTANCE_OWNER_ROLE()) == 0);// temp
|
241
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
242
|
+
}
|
243
|
+
|
244
|
+
function nftTransferFrom(address from, address to, uint256 tokenId) external onlyChainNft {
|
245
|
+
assert(_accessManager.revokeRole(INSTANCE_OWNER_ROLE(), from) == true);
|
246
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
247
|
+
}
|
248
|
+
|
224
249
|
//--- internal view/pure functions --------------------------------------//
|
225
250
|
function _toNftKey32(NftId nftId, ObjectType objectType) internal pure returns (Key32) {
|
226
251
|
return nftId.toKey32(objectType);
|
@@ -282,10 +307,22 @@ contract Instance is
|
|
282
307
|
function setBundleManager(BundleManager bundleManager) external restricted() {
|
283
308
|
require(address(_bundleManager) == address(0), "BundleManager is set");
|
284
309
|
require(bundleManager.getInstance() == Instance(this), "BundleManager instance mismatch");
|
310
|
+
require(bundleManager.authority() == authority(), "BundleManager authority mismatch");
|
285
311
|
_bundleManager = bundleManager;
|
286
312
|
}
|
287
313
|
|
288
314
|
function getBundleManager() external view returns (BundleManager) {
|
289
315
|
return _bundleManager;
|
290
316
|
}
|
317
|
+
|
318
|
+
function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
|
319
|
+
require(address(_accessManager) == address(0), "InstanceAccessManager is set");
|
320
|
+
require(accessManager.authority() == authority(), "InstanceAccessManager authority mismatch");
|
321
|
+
_accessManager = accessManager;
|
322
|
+
}
|
323
|
+
|
324
|
+
function getInstanceAccessManager() external view returns (InstanceAccessManager) {
|
325
|
+
return _accessManager;
|
326
|
+
}
|
327
|
+
|
291
328
|
}
|