@etherisc/gif-next 0.0.2-e922e07-736 → 0.0.2-e94f4c7-084
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 +84 -0
- 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 +158 -0
- 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 +457 -268
- 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 +426 -476
- 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 +217 -169
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +304 -210
- 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 +175 -83
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +29 -13
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +426 -233
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +78 -14
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +372 -86
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +55 -7
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +189 -139
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +48 -56
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +111 -40
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +246 -170
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +251 -58
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +101 -24
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +470 -41
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +627 -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 +607 -85
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +71 -19
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +777 -55
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +72 -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 +209 -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/ClaimId.sol/ClaimIdLib.json +83 -4
- 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/PayoutId.sol/PayoutIdLib.json +116 -7
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +2 -2
- 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 +17 -4
- 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 +6 -2
- package/contracts/components/IComponent.sol +9 -1
- package/contracts/components/IPoolComponent.sol +6 -44
- package/contracts/components/Pool.sol +50 -126
- package/contracts/components/Product.sol +141 -59
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +9 -8
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +37 -27
- package/contracts/instance/IInstanceService.sol +18 -9
- package/contracts/instance/Instance.sol +117 -98
- package/contracts/instance/InstanceAccessManager.sol +388 -158
- package/contracts/instance/InstanceReader.sol +36 -12
- package/contracts/instance/InstanceService.sol +193 -204
- 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 +23 -6
- 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/IPolicy.sol +11 -6
- package/contracts/instance/module/ISetup.sol +3 -16
- package/contracts/instance/service/ApplicationService.sol +25 -19
- package/contracts/instance/service/BundleService.sol +224 -80
- package/contracts/instance/service/ClaimService.sol +114 -26
- package/contracts/instance/service/DistributionService.sol +58 -77
- package/contracts/instance/service/IApplicationService.sol +3 -7
- package/contracts/instance/service/IBundleService.sol +72 -25
- package/contracts/instance/service/IClaimService.sol +46 -15
- package/contracts/instance/service/IDistributionService.sol +1 -0
- package/contracts/instance/service/IPolicyService.sol +72 -5
- package/contracts/instance/service/IPoolService.sol +85 -3
- package/contracts/instance/service/PolicyService.sol +320 -143
- package/contracts/instance/service/PoolService.sol +245 -18
- package/contracts/instance/service/ProductService.sol +31 -54
- 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 +70 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +25 -2
- package/contracts/types/Fee.sol +13 -5
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +6 -5
- package/contracts/types/PayoutId.sol +33 -5
- package/contracts/types/RoleId.sol +6 -4
- package/contracts/types/StateId.sol +7 -2
- package/contracts/types/Timestamp.sol +6 -0
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
@@ -6,25 +6,30 @@ import {IRegistry} from "../../registry/IRegistry.sol";
|
|
6
6
|
import {IInstance} from "../../instance/IInstance.sol";
|
7
7
|
import {IBundle} from "../../instance/module/IBundle.sol";
|
8
8
|
import {TokenHandler} from "../../instance/module/ITreasury.sol";
|
9
|
-
import {
|
9
|
+
import {IComponents} from "../module/IComponents.sol";
|
10
10
|
import {IPolicy} from "../module/IPolicy.sol";
|
11
11
|
|
12
12
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
13
13
|
import {Versionable} from "../../shared/Versionable.sol";
|
14
14
|
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
15
15
|
|
16
|
+
import {Amount, AmountLib} from "../../types/Amount.sol";
|
17
|
+
import {Fee, FeeLib} from "../../types/Fee.sol";
|
16
18
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
17
19
|
import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
|
18
|
-
import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
|
20
|
+
import {PUBLIC_ROLE, POOL_OWNER_ROLE, POLICY_SERVICE_ROLE, RoleId} from "../../types/RoleId.sol";
|
19
21
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
20
22
|
import {Version, VersionLib} from "../../types/Version.sol";
|
21
23
|
import {KEEP_STATE, StateId} from "../../types/StateId.sol";
|
24
|
+
import {Seconds} from "../../types/Seconds.sol";
|
22
25
|
import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
26
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
23
27
|
|
24
28
|
import {IService} from "../../shared/IService.sol";
|
25
29
|
import {Service} from "../../shared/Service.sol";
|
26
30
|
import {BundleManager} from "../BundleManager.sol";
|
27
31
|
import {ComponentService} from "../base/ComponentService.sol";
|
32
|
+
import {IBundleService} from "./IBundleService.sol";
|
28
33
|
import {IPoolService} from "./IPoolService.sol";
|
29
34
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
30
35
|
import {InstanceService} from "../InstanceService.sol";
|
@@ -39,8 +44,9 @@ contract PoolService is
|
|
39
44
|
IPoolService
|
40
45
|
{
|
41
46
|
using NftIdLib for NftId;
|
47
|
+
using AmountLib for Amount;
|
42
48
|
|
43
|
-
|
49
|
+
IBundleService internal _bundleService;
|
44
50
|
|
45
51
|
function _initialize(
|
46
52
|
address owner,
|
@@ -55,11 +61,14 @@ contract PoolService is
|
|
55
61
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
56
62
|
// TODO while PoolService is not deployed in PoolServiceManager constructor
|
57
63
|
// owner is PoolServiceManager deployer
|
58
|
-
initializeService(registryAddress, owner);
|
64
|
+
initializeService(registryAddress, address(0), owner);
|
65
|
+
|
66
|
+
_bundleService = IBundleService(getRegistry().getServiceAddress(BUNDLE(), getVersion().toMajorPart()));
|
67
|
+
|
59
68
|
registerInterface(type(IPoolService).interfaceId);
|
60
69
|
}
|
61
70
|
|
62
|
-
function getDomain() public pure override
|
71
|
+
function getDomain() public pure override returns(ObjectType) {
|
63
72
|
return POOL();
|
64
73
|
}
|
65
74
|
|
@@ -78,32 +87,250 @@ contract PoolService is
|
|
78
87
|
POOL_OWNER_ROLE());
|
79
88
|
|
80
89
|
IPoolComponent pool = IPoolComponent(poolAddress);
|
81
|
-
IRegistry.ObjectInfo memory
|
90
|
+
IRegistry.ObjectInfo memory registryInfo = getRegistryService().registerPool(pool, owner);
|
82
91
|
pool.linkToRegisteredNftId();
|
83
|
-
poolNftId =
|
92
|
+
poolNftId = registryInfo.nftId;
|
93
|
+
|
94
|
+
// amend component info with pool specific token handler
|
95
|
+
IComponents.ComponentInfo memory componentInfo = pool.getComponentInfo();
|
96
|
+
componentInfo.tokenHandler = new TokenHandler(address(componentInfo.token));
|
84
97
|
|
85
|
-
instance
|
86
|
-
|
87
|
-
|
98
|
+
// save amended component info with instance
|
99
|
+
instance.createPoolSetup(poolNftId, componentInfo);
|
100
|
+
|
101
|
+
bytes4[][] memory selectors = new bytes4[][](2);
|
102
|
+
selectors[0] = new bytes4[](1);
|
103
|
+
selectors[1] = new bytes4[](1);
|
104
|
+
|
105
|
+
selectors[0][0] = IPoolComponent.setFees.selector;
|
106
|
+
selectors[1][0] = IPoolComponent.verifyApplication.selector;
|
107
|
+
|
108
|
+
RoleId[] memory roles = new RoleId[](2);
|
109
|
+
roles[0] = POOL_OWNER_ROLE();
|
110
|
+
roles[1] = POLICY_SERVICE_ROLE();
|
111
|
+
|
112
|
+
getInstanceService().createGifTarget(
|
113
|
+
instanceNftId,
|
114
|
+
poolAddress,
|
115
|
+
pool.getName(),
|
116
|
+
selectors,
|
117
|
+
roles);
|
88
118
|
}
|
89
119
|
|
120
|
+
|
121
|
+
function setMaxCapitalAmount(uint256 maxCapitalAmount)
|
122
|
+
external
|
123
|
+
virtual
|
124
|
+
{
|
125
|
+
(NftId poolNftId, IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
126
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
127
|
+
|
128
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
129
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
130
|
+
uint256 previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
|
131
|
+
|
132
|
+
poolInfo.maxCapitalAmount = maxCapitalAmount;
|
133
|
+
componentInfo.data = abi.encode(poolInfo);
|
134
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
135
|
+
|
136
|
+
emit LogPoolServiceMaxCapitalAmountUpdated(poolNftId, previousMaxCapitalAmount, maxCapitalAmount);
|
137
|
+
}
|
138
|
+
|
139
|
+
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
140
|
+
external
|
141
|
+
virtual
|
142
|
+
{
|
143
|
+
(NftId poolNftId, IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
144
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
145
|
+
|
146
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
147
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
148
|
+
|
149
|
+
// bundle owner role may only be set once per pool
|
150
|
+
if(poolInfo.bundleOwnerRole != PUBLIC_ROLE()) {
|
151
|
+
revert ErrorPoolServiceBundleOwnerRoleAlreadySet(poolNftId);
|
152
|
+
}
|
153
|
+
|
154
|
+
poolInfo.bundleOwnerRole = bundleOwnerRole;
|
155
|
+
componentInfo.data = abi.encode(poolInfo);
|
156
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
157
|
+
|
158
|
+
emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
|
159
|
+
}
|
160
|
+
|
161
|
+
|
90
162
|
function setFees(
|
91
163
|
Fee memory poolFee,
|
92
164
|
Fee memory stakingFee,
|
93
165
|
Fee memory performanceFee
|
94
166
|
)
|
95
167
|
external
|
96
|
-
|
168
|
+
virtual
|
169
|
+
{
|
170
|
+
(NftId poolNftId, IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
171
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
172
|
+
|
173
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
174
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
175
|
+
|
176
|
+
poolInfo.poolFee = poolFee;
|
177
|
+
poolInfo.stakingFee = stakingFee;
|
178
|
+
poolInfo.performanceFee = performanceFee;
|
179
|
+
componentInfo.data = abi.encode(poolInfo);
|
180
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
181
|
+
|
182
|
+
// TODO add logging
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
function createBundle(
|
187
|
+
address owner, // initial bundle owner
|
188
|
+
Fee memory fee, // fees deducted from premium that go to bundle owner
|
189
|
+
Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
|
190
|
+
Seconds lifetime, // initial duration for which new policies are covered
|
191
|
+
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
192
|
+
)
|
193
|
+
external
|
194
|
+
virtual
|
195
|
+
returns(NftId bundleNftId)
|
97
196
|
{
|
98
|
-
(
|
197
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
99
198
|
InstanceReader instanceReader = instance.getInstanceReader();
|
100
|
-
NftId poolNftId = poolInfo.nftId;
|
101
199
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
200
|
+
// TODO add implementation that takes care of staking fees
|
201
|
+
Amount stakingAfterFeesAmount = stakingAmount;
|
202
|
+
|
203
|
+
bundleNftId = _bundleService.create(
|
204
|
+
instance,
|
205
|
+
poolNftId,
|
206
|
+
owner,
|
207
|
+
fee,
|
208
|
+
stakingAfterFeesAmount,
|
209
|
+
lifetime,
|
210
|
+
filter);
|
211
|
+
|
212
|
+
emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
function closeBundle(NftId bundleNftId)
|
217
|
+
external
|
218
|
+
virtual
|
219
|
+
{
|
220
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
221
|
+
|
222
|
+
// TODO book keeping for pool collateral released outside of retention level
|
223
|
+
|
224
|
+
// releasing collateral in bundle
|
225
|
+
_bundleService.close(instance, bundleNftId);
|
226
|
+
|
227
|
+
// TODO get performance fee for pool, transfer of remaining funds + bundle fees to bundle owner
|
228
|
+
|
229
|
+
emit LogPoolServiceBundleClosed(instance.getNftId(), poolNftId, bundleNftId);
|
230
|
+
}
|
231
|
+
|
232
|
+
function processSale(
|
233
|
+
NftId bundleNftId,
|
234
|
+
IPolicy.Premium memory premium,
|
235
|
+
uint256 actualAmountTransferred
|
236
|
+
)
|
237
|
+
external
|
238
|
+
virtual
|
239
|
+
{
|
240
|
+
IRegistry registry = getRegistry();
|
241
|
+
IRegistry.ObjectInfo memory bundleObjectInfo = registry.getObjectInfo(bundleNftId);
|
242
|
+
IRegistry.ObjectInfo memory poolObjectInfo = registry.getObjectInfo(bundleObjectInfo.parentNftId);
|
243
|
+
IRegistry.ObjectInfo memory instanceObjectInfo = registry.getObjectInfo(poolObjectInfo.parentNftId);
|
244
|
+
IInstance instance = IInstance(instanceObjectInfo.objectAddress);
|
245
|
+
|
246
|
+
Amount poolFeeAmount = AmountLib.toAmount(premium.poolFeeFixAmount + premium.poolFeeVarAmount);
|
247
|
+
Amount bundleFeeAmount = AmountLib.toAmount(premium.bundleFeeFixAmount + premium.bundleFeeVarAmount);
|
248
|
+
Amount expectedTransferAmount = AmountLib.toAmount(premium.netPremiumAmount).add(poolFeeAmount).add(bundleFeeAmount);
|
249
|
+
if (! AmountLib.toAmount(actualAmountTransferred).eq(expectedTransferAmount)) {
|
250
|
+
revert ErrorPoolServiceInvalidTransferAmount(expectedTransferAmount, AmountLib.toAmount(actualAmountTransferred));
|
251
|
+
}
|
106
252
|
|
107
|
-
|
253
|
+
// update pool fee balance
|
254
|
+
if (poolFeeAmount.gtz()) {
|
255
|
+
IComponents.ComponentInfo memory poolComponentInfo = instance.getInstanceReader().getComponentInfo(poolObjectInfo.nftId);
|
256
|
+
poolComponentInfo.feeAmount = poolComponentInfo.feeAmount.add(poolFeeAmount);
|
257
|
+
instance.updatePoolSetup(poolObjectInfo.nftId, poolComponentInfo, KEEP_STATE());
|
258
|
+
}
|
259
|
+
|
260
|
+
if (bundleFeeAmount.gtz()) {
|
261
|
+
_bundleService.updateBundleFees(instance, bundleNftId, bundleFeeAmount);
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
function lockCollateral(
|
266
|
+
IInstance instance,
|
267
|
+
NftId productNftId,
|
268
|
+
NftId applicationNftId,
|
269
|
+
IPolicy.PolicyInfo memory applicationInfo,
|
270
|
+
uint256 premiumAmount // premium amount after product and distribution fees
|
271
|
+
)
|
272
|
+
external
|
273
|
+
virtual
|
274
|
+
// TODO add restricted and granting for policy service
|
275
|
+
{
|
276
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
277
|
+
NftId poolNftId = instanceReader.getProductSetupInfo(productNftId).poolNftId;
|
278
|
+
NftId bundleNftId = applicationInfo.bundleNftId;
|
279
|
+
|
280
|
+
// TODO move this check to application creation and don't repeat this here
|
281
|
+
// ensure that pool for bundle from application matches with pool for product of application
|
282
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
283
|
+
if(bundleInfo.poolNftId != poolNftId) {
|
284
|
+
revert ErrorPoolServiceBundlePoolMismatch(bundleInfo.poolNftId, poolNftId);
|
285
|
+
}
|
286
|
+
|
287
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
288
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
289
|
+
|
290
|
+
// TODO add correct required collateral calculation (collateralization level mibht be != 1, retention level might be < 1)
|
291
|
+
uint256 collateralAmount = applicationInfo.sumInsuredAmount;
|
292
|
+
|
293
|
+
// TODO add correct net premium calculation (pool fee might be > 0)
|
294
|
+
uint256 premiumAfterPoolFeeAmount = premiumAmount;
|
295
|
+
|
296
|
+
// lock collateral amount from involvedd bundle
|
297
|
+
_bundleService.lockCollateral(
|
298
|
+
instance,
|
299
|
+
applicationNftId,
|
300
|
+
bundleNftId,
|
301
|
+
collateralAmount,
|
302
|
+
premiumAfterPoolFeeAmount);
|
303
|
+
|
304
|
+
// also verify/confirm application by pool if necessary
|
305
|
+
if(poolInfo.isVerifyingApplications) {
|
306
|
+
address poolAddress = getRegistry().getObjectInfo(poolNftId).objectAddress;
|
307
|
+
IPoolComponent(poolAddress).verifyApplication(
|
308
|
+
applicationNftId,
|
309
|
+
applicationInfo.applicationData,
|
310
|
+
bundleNftId,
|
311
|
+
bundleInfo.filter,
|
312
|
+
collateralAmount);
|
313
|
+
}
|
108
314
|
}
|
315
|
+
|
316
|
+
|
317
|
+
/// @dev releases the remaining collateral linked to the specified policy
|
318
|
+
/// may only be called by the policy service for unlocked pool components
|
319
|
+
function releaseCollateral(
|
320
|
+
IInstance instance,
|
321
|
+
NftId policyNftId,
|
322
|
+
IPolicy.PolicyInfo memory policyInfo
|
323
|
+
)
|
324
|
+
external
|
325
|
+
virtual
|
326
|
+
// TODO add restricted and granting for policy service
|
327
|
+
{
|
328
|
+
// release collateral from involved bundle
|
329
|
+
_bundleService.releaseCollateral(
|
330
|
+
instance,
|
331
|
+
policyNftId,
|
332
|
+
policyInfo.bundleNftId,
|
333
|
+
policyInfo.sumInsuredAmount);
|
334
|
+
}
|
335
|
+
|
109
336
|
}
|
@@ -24,7 +24,7 @@ import {Timestamp, zeroTimestamp} from "../../types/Timestamp.sol";
|
|
24
24
|
import {UFixed, UFixedLib} from "../../types/UFixed.sol";
|
25
25
|
import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
|
26
26
|
import {ObjectType, PRODUCT, POOL, POLICY} from "../../types/ObjectType.sol";
|
27
|
-
import {APPLIED,
|
27
|
+
import {APPLIED, ACTIVE, KEEP_STATE} from "../../types/StateId.sol";
|
28
28
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
29
29
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
30
30
|
import {ReferralId} from "../../types/Referral.sol";
|
@@ -60,9 +60,9 @@ contract ProductService is ComponentService, IProductService {
|
|
60
60
|
address initialOwner;
|
61
61
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
62
62
|
|
63
|
-
initializeService(registryAddress, owner);
|
63
|
+
initializeService(registryAddress, address(0), owner);
|
64
64
|
|
65
|
-
_poolService = IPoolService(getRegistry().getServiceAddress(POOL(),
|
65
|
+
_poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getVersion().toMajorPart()));
|
66
66
|
|
67
67
|
registerInterface(type(IProductService).interfaceId);
|
68
68
|
}
|
@@ -113,15 +113,23 @@ contract ProductService is ComponentService, IProductService {
|
|
113
113
|
// create product setup in instance
|
114
114
|
instance.createProductSetup(productNftId, product.getSetupInfo());
|
115
115
|
|
116
|
+
bytes4[][] memory selectors = new bytes4[][](1);
|
117
|
+
selectors[0] = new bytes4[](1);
|
118
|
+
selectors[0][0] = IProductComponent.setFees.selector;
|
119
|
+
|
120
|
+
RoleId[] memory roles = new RoleId[](1);
|
121
|
+
roles[0] = PRODUCT_OWNER_ROLE();
|
122
|
+
|
116
123
|
// create target for instane access manager
|
117
124
|
getInstanceService().createGifTarget(
|
118
125
|
getRegistry().getNftId(address(instance)),
|
119
126
|
address(product),
|
120
|
-
product.getName()
|
121
|
-
|
127
|
+
product.getName(),
|
128
|
+
selectors,
|
129
|
+
roles);
|
122
130
|
}
|
123
131
|
|
124
|
-
function getDomain() public pure override
|
132
|
+
function getDomain() public pure override returns(ObjectType) {
|
125
133
|
return PRODUCT();
|
126
134
|
}
|
127
135
|
|
@@ -139,38 +147,6 @@ contract ProductService is ComponentService, IProductService {
|
|
139
147
|
// if(wallet == address(0)) {
|
140
148
|
// revert WalletIsZero();
|
141
149
|
// }
|
142
|
-
|
143
|
-
// IRegistry.ObjectInfo memory tokenInfo = getRegistry().getObjectInfo(address(info.token));
|
144
|
-
|
145
|
-
// if(tokenInfo.objectType != TOKEN()) {
|
146
|
-
// revert InvalidToken();
|
147
|
-
// }
|
148
|
-
|
149
|
-
// IRegistry.ObjectInfo memory poolInfo = getRegistry().getObjectInfo(info.poolNftId);
|
150
|
-
|
151
|
-
// if(poolInfo.objectType != POOL()) {
|
152
|
-
// revert InvalidPool();
|
153
|
-
// }
|
154
|
-
|
155
|
-
// if(poolInfo.parentNftId != instanceNftId) {
|
156
|
-
// revert InvalidPoolsInstance();
|
157
|
-
// }
|
158
|
-
// // TODO pool have the same token
|
159
|
-
// //ITreasury.PoolSetup memory poolSetup = instance.getPoolSetup(info.poolNftId);
|
160
|
-
// //require(tokenInfo.objectAddress == address(poolSetup.token), "ERROR:COS-018:PRODUCT_POOL_TOKEN_MISMATCH");
|
161
|
-
// // TODO pool is not linked
|
162
|
-
|
163
|
-
// IRegistry.ObjectInfo memory distributionInfo = getRegistry().getObjectInfo(info.distributionNftId);
|
164
|
-
|
165
|
-
// if(distributionInfo.objectType != DISTRIBUTION()) {
|
166
|
-
// revert InvalidDistribution();
|
167
|
-
// }
|
168
|
-
|
169
|
-
// if(distributionInfo.parentNftId != instanceNftId) {
|
170
|
-
// revert InvalidDistributionsInstance();
|
171
|
-
// }
|
172
|
-
// // TODO distribution have the same token
|
173
|
-
// // TODO distribution is not linked
|
174
150
|
}
|
175
151
|
|
176
152
|
function setFees(
|
@@ -181,13 +157,9 @@ contract ProductService is ComponentService, IProductService {
|
|
181
157
|
{
|
182
158
|
// TODO check args
|
183
159
|
|
184
|
-
(
|
185
|
-
IRegistry.ObjectInfo memory productInfo,
|
186
|
-
IInstance instance
|
187
|
-
) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
188
|
-
|
160
|
+
(NftId productNftId, IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
189
161
|
InstanceReader instanceReader = instance.getInstanceReader();
|
190
|
-
|
162
|
+
|
191
163
|
ISetup.ProductSetupInfo memory productSetupInfo = instanceReader.getProductSetupInfo(productNftId);
|
192
164
|
|
193
165
|
productSetupInfo.productFee = productFee;
|
@@ -199,13 +171,13 @@ contract ProductService is ComponentService, IProductService {
|
|
199
171
|
function createRisk(
|
200
172
|
RiskId riskId,
|
201
173
|
bytes memory data
|
202
|
-
)
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
207
|
-
NftId productNftId = productInfo.nftId;
|
174
|
+
)
|
175
|
+
external
|
176
|
+
override
|
177
|
+
{
|
178
|
+
(NftId productNftId, IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
208
179
|
IRisk.RiskInfo memory riskInfo = IRisk.RiskInfo(productNftId, data);
|
180
|
+
|
209
181
|
instance.createRisk(
|
210
182
|
riskId,
|
211
183
|
riskInfo
|
@@ -215,9 +187,12 @@ contract ProductService is ComponentService, IProductService {
|
|
215
187
|
function updateRisk(
|
216
188
|
RiskId riskId,
|
217
189
|
bytes memory data
|
218
|
-
)
|
219
|
-
|
190
|
+
)
|
191
|
+
external
|
192
|
+
{
|
193
|
+
(,, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
220
194
|
InstanceReader instanceReader = instance.getInstanceReader();
|
195
|
+
|
221
196
|
IRisk.RiskInfo memory riskInfo = instanceReader.getRiskInfo(riskId);
|
222
197
|
riskInfo.data = data;
|
223
198
|
instance.updateRisk(riskId, riskInfo, KEEP_STATE());
|
@@ -226,8 +201,10 @@ contract ProductService is ComponentService, IProductService {
|
|
226
201
|
function updateRiskState(
|
227
202
|
RiskId riskId,
|
228
203
|
StateId state
|
229
|
-
)
|
230
|
-
|
204
|
+
)
|
205
|
+
external
|
206
|
+
{
|
207
|
+
(,, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
231
208
|
instance.updateRiskState(riskId, state);
|
232
209
|
}
|
233
210
|
}
|
@@ -95,6 +95,10 @@ contract ChainNft is ERC721Enumerable {
|
|
95
95
|
|
96
96
|
_totalMinted++;
|
97
97
|
_safeMint(to, tokenId);
|
98
|
+
|
99
|
+
if(interceptor != address(0)) {
|
100
|
+
ITransferInterceptor(interceptor).nftMint(to, tokenId);
|
101
|
+
}
|
98
102
|
}
|
99
103
|
|
100
104
|
|
@@ -195,6 +199,10 @@ contract ChainNft is ERC721Enumerable {
|
|
195
199
|
_chainIdDigits;
|
196
200
|
}
|
197
201
|
|
202
|
+
function getNextTokenId() external view returns (uint256) {
|
203
|
+
return calculateTokenId(_idNext);
|
204
|
+
}
|
205
|
+
|
198
206
|
function _getNextTokenId() private returns (uint256 id) {
|
199
207
|
id = calculateTokenId(_idNext);
|
200
208
|
_idNext++;
|
@@ -84,6 +84,8 @@ interface IRegistry is IERC165 {
|
|
84
84
|
|
85
85
|
function isRegisteredService(address contractAddress) external view returns (bool);
|
86
86
|
|
87
|
+
function isRegisteredComponent(address object) external view returns (bool);
|
88
|
+
|
87
89
|
function isValidRelease(VersionPart version) external view returns (bool);
|
88
90
|
|
89
91
|
function getServiceAddress(
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
4
|
+
// import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
5
5
|
|
6
6
|
import {NftId} from "../types/NftId.sol";
|
7
7
|
import {ObjectType} from "../types/ObjectType.sol";
|
@@ -13,8 +13,9 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
|
|
13
13
|
import {IComponent} from "../components/IComponent.sol";
|
14
14
|
|
15
15
|
interface IRegistryService is
|
16
|
-
IService
|
17
|
-
|
16
|
+
IService
|
17
|
+
// TODO cleanup
|
18
|
+
// IAccessManaged
|
18
19
|
{
|
19
20
|
error SelfRegistration();
|
20
21
|
error NotRegistryOwner();
|
@@ -149,7 +149,6 @@ contract Registry is
|
|
149
149
|
}
|
150
150
|
|
151
151
|
if(
|
152
|
-
|
153
152
|
parentType == PROTOCOL() ||
|
154
153
|
parentType == REGISTRY() ||
|
155
154
|
parentType == SERVICE()
|
@@ -186,7 +185,7 @@ contract Registry is
|
|
186
185
|
return _releaseManager.getReleaseInfo(version);
|
187
186
|
}
|
188
187
|
|
189
|
-
function getObjectCount() external view
|
188
|
+
function getObjectCount() external view returns (uint256) {
|
190
189
|
return _chainNft.totalSupply();
|
191
190
|
}
|
192
191
|
|
@@ -198,11 +197,11 @@ contract Registry is
|
|
198
197
|
return _registryNftId;
|
199
198
|
}
|
200
199
|
|
201
|
-
function getNftId(address object) external view
|
200
|
+
function getNftId(address object) external view returns (NftId id) {
|
202
201
|
return _nftIdByAddress[object];
|
203
202
|
}
|
204
203
|
|
205
|
-
function ownerOf(NftId nftId) public view
|
204
|
+
function ownerOf(NftId nftId) public view returns (address) {
|
206
205
|
return _chainNft.ownerOf(nftId.toInt());
|
207
206
|
}
|
208
207
|
|
@@ -210,26 +209,31 @@ contract Registry is
|
|
210
209
|
return _chainNft.ownerOf(_nftIdByAddress[contractAddress].toInt());
|
211
210
|
}
|
212
211
|
|
213
|
-
function getObjectInfo(NftId nftId) external view
|
212
|
+
function getObjectInfo(NftId nftId) external view returns (ObjectInfo memory) {
|
214
213
|
return _info[nftId];
|
215
214
|
}
|
216
215
|
|
217
|
-
function getObjectInfo(address object) external view
|
216
|
+
function getObjectInfo(address object) external view returns (ObjectInfo memory) {
|
218
217
|
return _info[_nftIdByAddress[object]];
|
219
218
|
}
|
220
219
|
|
221
|
-
function isRegistered(NftId nftId) public view
|
220
|
+
function isRegistered(NftId nftId) public view returns (bool) {
|
222
221
|
return _info[nftId].objectType.gtz();
|
223
222
|
}
|
224
223
|
|
225
|
-
function isRegistered(address object) external view
|
224
|
+
function isRegistered(address object) external view returns (bool) {
|
226
225
|
return _nftIdByAddress[object].gtz();
|
227
226
|
}
|
228
227
|
|
229
|
-
function isRegisteredService(address object) external view
|
228
|
+
function isRegisteredService(address object) external view returns (bool) {
|
230
229
|
return _info[_nftIdByAddress[object]].objectType == SERVICE();
|
231
230
|
}
|
232
231
|
|
232
|
+
function isRegisteredComponent(address object) external view returns (bool) {
|
233
|
+
NftId objectParentNftId = _info[_nftIdByAddress[object]].parentNftId;
|
234
|
+
return _info[objectParentNftId].objectType == INSTANCE();
|
235
|
+
}
|
236
|
+
|
233
237
|
function isValidRelease(VersionPart version) external view returns (bool)
|
234
238
|
{
|
235
239
|
return _releaseManager.isValidRelease(version);
|
@@ -287,18 +291,9 @@ contract Registry is
|
|
287
291
|
}
|
288
292
|
|
289
293
|
address interceptor = _getInterceptor(info.isInterceptor, info.objectAddress, parentInfo.isInterceptor, parentAddress);
|
294
|
+
uint256 tokenId = _chainNft.getNextTokenId();
|
295
|
+
nftId = toNftId(tokenId);
|
290
296
|
|
291
|
-
// TODO does external call
|
292
|
-
// compute next nftId, do all checks and stores, mint() at most end...
|
293
|
-
uint256 mintedTokenId = _chainNft.mint(
|
294
|
-
info.initialOwner,
|
295
|
-
interceptor,
|
296
|
-
EMPTY_URI);
|
297
|
-
nftId = toNftId(mintedTokenId);
|
298
|
-
|
299
|
-
// TODO move nftId out of info struct
|
300
|
-
// getters by nftId -> return struct without nftId
|
301
|
-
// getters by address -> return nftId AND struct
|
302
297
|
info.nftId = nftId;
|
303
298
|
_info[nftId] = info;
|
304
299
|
|
@@ -314,6 +309,14 @@ contract Registry is
|
|
314
309
|
}
|
315
310
|
|
316
311
|
emit LogRegistration(nftId, parentNftId, objectType, info.isInterceptor, info.objectAddress, info.initialOwner);
|
312
|
+
|
313
|
+
// calls nft receiver(1) and interceptor(2)
|
314
|
+
uint256 mintedTokenId = _chainNft.mint(
|
315
|
+
info.initialOwner,
|
316
|
+
interceptor,
|
317
|
+
EMPTY_URI);
|
318
|
+
assert(mintedTokenId == tokenId);
|
319
|
+
|
317
320
|
}
|
318
321
|
|
319
322
|
/// @dev obtain interceptor address for this nft if applicable, address(0) otherwise
|