@etherisc/gif-next 0.0.2-f29e479-370 → 0.0.2-f30e0eb-805
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 +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +68 -89
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +113 -140
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +65 -73
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +91 -122
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +256 -189
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +69 -145
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +279 -245
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +73 -162
- 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 +171 -308
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +98 -40
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +260 -379
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +448 -121
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +120 -227
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +148 -161
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +31 -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 +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/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 +54 -71
- 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 +161 -62
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +33 -25
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +137 -140
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +12 -12
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +3 -3
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +505 -91
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +78 -42
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +110 -27
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +93 -96
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +350 -8
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +21 -64
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +81 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +58 -157
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +19 -47
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +114 -17
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +17 -9
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +7 -7
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +4 -4
- 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/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 +5 -5
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +3 -3
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +7 -7
- 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/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 +3 -3
- 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 +1 -1
- 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 +3 -3
- 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 +3 -3
- 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/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 +2 -2
- 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 +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- 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 +25 -7
- 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 +95 -85
- package/contracts/components/Distribution.sol +12 -19
- package/contracts/components/IComponent.sol +37 -17
- package/contracts/components/IDistributionComponent.sol +1 -22
- package/contracts/components/IPoolComponent.sol +73 -47
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +171 -126
- package/contracts/components/Product.sol +26 -18
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +7 -5
- 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 +45 -9
- package/contracts/instance/InstanceAccessManager.sol +382 -157
- package/contracts/instance/InstanceReader.sol +7 -10
- package/contracts/instance/InstanceService.sol +174 -155
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +5 -5
- package/contracts/instance/base/KeyValueStore.sol +5 -2
- package/contracts/instance/base/Lifecycle.sol +11 -2
- package/contracts/instance/module/IAccess.sol +20 -13
- package/contracts/instance/module/IBundle.sol +2 -1
- package/contracts/instance/module/IComponents.sol +35 -0
- package/contracts/instance/module/IDistribution.sol +2 -1
- package/contracts/instance/module/IPolicy.sol +26 -1
- package/contracts/instance/module/ISetup.sol +7 -22
- package/contracts/instance/service/ApplicationService.sol +123 -41
- package/contracts/instance/service/BundleService.sol +76 -38
- package/contracts/instance/service/DistributionService.sol +139 -47
- package/contracts/instance/service/IApplicationService.sol +7 -7
- package/contracts/instance/service/IBundleService.sol +19 -11
- package/contracts/instance/service/IDistributionService.sol +19 -4
- package/contracts/instance/service/IPolicyService.sol +3 -20
- package/contracts/instance/service/IPoolService.sol +17 -2
- package/contracts/instance/service/PolicyService.sol +59 -132
- package/contracts/instance/service/PoolService.sol +128 -17
- package/contracts/instance/service/ProductService.sol +10 -2
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +2 -0
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +23 -20
- package/contracts/registry/RegistryService.sol +5 -5
- package/contracts/shared/Registerable.sol +2 -2
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/Fee.sol +1 -0
- 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 +13 -6
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +1 -0
- package/contracts/types/Timestamp.sol +13 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
@@ -6,12 +6,14 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
|
|
6
6
|
import {IRisk} from "../instance/module/IRisk.sol";
|
7
7
|
import {IApplicationService} from "../instance/service/IApplicationService.sol";
|
8
8
|
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
9
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
9
10
|
import {IClaimService} from "../instance/service/IClaimService.sol";
|
10
11
|
import {IProductComponent} from "./IProductComponent.sol";
|
11
12
|
import {NftId, NftIdLib} from "../types/NftId.sol";
|
12
13
|
import {PRODUCT, APPLICATION, POLICY, CLAIM } from "../types/ObjectType.sol";
|
13
14
|
import {ReferralId} from "../types/Referral.sol";
|
14
15
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
16
|
+
import {Seconds} from "../types/Seconds.sol";
|
15
17
|
import {StateId} from "../types/StateId.sol";
|
16
18
|
import {Timestamp} from "../types/Timestamp.sol";
|
17
19
|
import {Fee} from "../types/Fee.sol";
|
@@ -20,7 +22,9 @@ import {Component} from "./Component.sol";
|
|
20
22
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
21
23
|
|
22
24
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
25
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
23
26
|
import {ISetup} from "../instance/module/ISetup.sol";
|
27
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
24
28
|
import {Pool} from "../components/Pool.sol";
|
25
29
|
import {Distribution} from "../components/Distribution.sol";
|
26
30
|
|
@@ -32,6 +36,7 @@ abstract contract Product is
|
|
32
36
|
bytes32 public constant PRODUCT_STORAGE_LOCATION_V1 = 0x0bb7aafdb8e380f81267337bc5b5dfdf76e6d3a380ecadb51ec665246d9d6800;
|
33
37
|
|
34
38
|
struct ProductStorage {
|
39
|
+
IProductService _productService;
|
35
40
|
IApplicationService _applicationService;
|
36
41
|
IPolicyService _policyService;
|
37
42
|
IClaimService _claimService;
|
@@ -55,20 +60,21 @@ abstract contract Product is
|
|
55
60
|
Fee memory productFee,
|
56
61
|
Fee memory processingFee,
|
57
62
|
address initialOwner,
|
58
|
-
bytes memory data
|
63
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
59
64
|
)
|
60
65
|
public
|
61
66
|
virtual
|
62
67
|
onlyInitializing()
|
63
68
|
{
|
64
|
-
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner,
|
69
|
+
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, registryData);
|
65
70
|
|
66
71
|
ProductStorage storage $ = _getProductStorage();
|
67
72
|
// TODO add validation
|
68
73
|
// TODO refactor to go via registry
|
69
|
-
$.
|
70
|
-
$.
|
71
|
-
$.
|
74
|
+
$._productService = IProductService(_getServiceAddress(PRODUCT()));
|
75
|
+
$._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
|
76
|
+
$._policyService = IPolicyService(_getServiceAddress(POLICY()));
|
77
|
+
$._claimService = IClaimService(_getServiceAddress(CLAIM()));
|
72
78
|
$._pool = Pool(pool);
|
73
79
|
$._distribution = Distribution(distribution);
|
74
80
|
$._initialProductFee = productFee;
|
@@ -84,7 +90,7 @@ abstract contract Product is
|
|
84
90
|
function calculatePremium(
|
85
91
|
uint256 sumInsuredAmount,
|
86
92
|
RiskId riskId,
|
87
|
-
|
93
|
+
Seconds lifetime,
|
88
94
|
bytes memory applicationData,
|
89
95
|
NftId bundleNftId,
|
90
96
|
ReferralId referralId
|
@@ -94,7 +100,8 @@ abstract contract Product is
|
|
94
100
|
override
|
95
101
|
returns (uint256 premiumAmount)
|
96
102
|
{
|
97
|
-
|
103
|
+
IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
|
104
|
+
getNftId(),
|
98
105
|
riskId,
|
99
106
|
sumInsuredAmount,
|
100
107
|
lifetime,
|
@@ -102,13 +109,14 @@ abstract contract Product is
|
|
102
109
|
bundleNftId,
|
103
110
|
referralId
|
104
111
|
);
|
112
|
+
premiumAmount = premium.premiumAmount;
|
105
113
|
}
|
106
114
|
|
107
115
|
|
108
116
|
function calculateNetPremium(
|
109
117
|
uint256 sumInsuredAmount,
|
110
118
|
RiskId riskId,
|
111
|
-
|
119
|
+
Seconds lifetime,
|
112
120
|
bytes memory applicationData
|
113
121
|
)
|
114
122
|
external
|
@@ -128,7 +136,7 @@ abstract contract Product is
|
|
128
136
|
RiskId id,
|
129
137
|
bytes memory data
|
130
138
|
) internal {
|
131
|
-
|
139
|
+
_getProductService().createRisk(
|
132
140
|
id,
|
133
141
|
data
|
134
142
|
);
|
@@ -138,7 +146,7 @@ abstract contract Product is
|
|
138
146
|
RiskId id,
|
139
147
|
bytes memory data
|
140
148
|
) internal {
|
141
|
-
|
149
|
+
_getProductService().updateRisk(
|
142
150
|
id,
|
143
151
|
data
|
144
152
|
);
|
@@ -148,7 +156,7 @@ abstract contract Product is
|
|
148
156
|
RiskId id,
|
149
157
|
StateId state
|
150
158
|
) internal {
|
151
|
-
|
159
|
+
_getProductService().updateRiskState(
|
152
160
|
id,
|
153
161
|
state
|
154
162
|
);
|
@@ -162,7 +170,7 @@ abstract contract Product is
|
|
162
170
|
address applicationOwner,
|
163
171
|
RiskId riskId,
|
164
172
|
uint256 sumInsuredAmount,
|
165
|
-
|
173
|
+
Seconds lifetime,
|
166
174
|
NftId bundleNftId,
|
167
175
|
ReferralId referralId,
|
168
176
|
bytes memory applicationData
|
@@ -242,7 +250,7 @@ abstract contract Product is
|
|
242
250
|
restricted()
|
243
251
|
override
|
244
252
|
{
|
245
|
-
|
253
|
+
_getProductService().setFees(productFee, processingFee);
|
246
254
|
}
|
247
255
|
|
248
256
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
@@ -259,19 +267,15 @@ abstract contract Product is
|
|
259
267
|
ProductStorage storage $ = _getProductStorage();
|
260
268
|
|
261
269
|
ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
|
262
|
-
|
270
|
+
IComponents.PoolInfo memory poolInfo = $._pool.getPoolInfo();
|
263
271
|
|
264
272
|
return ISetup.ProductSetupInfo(
|
265
273
|
getToken(),
|
266
274
|
$._tokenHandler,
|
267
275
|
$._distributionNftId,
|
268
276
|
$._poolNftId,
|
269
|
-
distributionSetupInfo.distributionFee,
|
270
277
|
$._initialProductFee,
|
271
278
|
$._initialProcessingFee,
|
272
|
-
poolSetupInfo.poolFee,
|
273
|
-
poolSetupInfo.stakingFee,
|
274
|
-
poolSetupInfo.performanceFee,
|
275
279
|
false,
|
276
280
|
getWallet()
|
277
281
|
);
|
@@ -282,4 +286,8 @@ abstract contract Product is
|
|
282
286
|
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
283
287
|
}
|
284
288
|
}
|
289
|
+
|
290
|
+
function _getProductService() internal view returns (IProductService) {
|
291
|
+
return _getProductStorage()._productService;
|
292
|
+
}
|
285
293
|
}
|
@@ -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);
|
@@ -71,7 +72,7 @@ contract BundleManager is
|
|
71
72
|
}
|
72
73
|
|
73
74
|
|
74
|
-
/// @dev add a new bundle to a
|
75
|
+
/// @dev add a new bundle to a pool registerd with this instance
|
75
76
|
// the corresponding pool is fetched via instance reader
|
76
77
|
function add(NftId bundleNftId) external restricted() {
|
77
78
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
@@ -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,21 @@ 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
|
+
}
|
291
327
|
}
|