@etherisc/gif-next 0.0.2-2a0a7d0-893 → 0.0.2-2a59cd5-352
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -1
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +405 -6
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +883 -141
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +113 -6
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +798 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +662 -43
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +656 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +583 -75
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +504 -5
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +450 -35
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +111 -7
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +589 -223
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +39 -89
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +58 -53
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +400 -96
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +175 -25
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +166 -7
- 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 +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +13 -13
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1117 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +290 -66
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +169 -19
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +439 -27
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +194 -16
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +638 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +118 -40
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +217 -7
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +33 -20
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +20 -7
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +20 -7
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +223 -64
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +182 -32
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +186 -27
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +166 -16
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +186 -27
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +166 -16
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +15 -2
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +100 -26
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +28 -15
- 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 +260 -40
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +166 -16
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +11 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +160 -10
- 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/ERC165.sol/ERC165.json +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +37 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +18 -5
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +69 -0
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +20 -7
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +156 -11
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +269 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +156 -6
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +152 -11
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +105 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +166 -7
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -2
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +152 -11
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +184 -25
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -8
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/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 +2 -2
- 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/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/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +121 -62
- package/contracts/components/Distribution.sol +207 -53
- package/contracts/components/IComponent.sol +16 -3
- package/contracts/components/IDistributionComponent.sol +59 -3
- package/contracts/components/IPoolComponent.sol +50 -29
- package/contracts/components/IProductComponent.sol +5 -1
- package/contracts/components/Pool.sol +133 -137
- package/contracts/components/Product.sol +90 -107
- package/contracts/instance/IInstance.sol +26 -6
- package/contracts/instance/IInstanceService.sol +19 -0
- package/contracts/instance/Instance.sol +58 -30
- package/contracts/instance/InstanceAccessManager.sol +12 -13
- package/contracts/instance/InstanceService.sol +119 -39
- package/contracts/instance/base/ComponentService.sol +3 -2
- package/contracts/instance/module/IAccess.sol +3 -4
- package/contracts/instance/module/ISetup.sol +5 -4
- package/contracts/instance/service/ApplicationService.sol +268 -0
- package/contracts/instance/service/BundleService.sol +11 -6
- package/contracts/instance/service/DistributionService.sol +197 -30
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +11 -1
- package/contracts/instance/service/IDistributionService.sol +53 -0
- package/contracts/instance/service/IPolicyService.sol +10 -16
- package/contracts/instance/service/PolicyService.sol +84 -98
- package/contracts/instance/service/PoolService.sol +9 -42
- package/contracts/instance/service/ProductService.sol +20 -28
- package/contracts/registry/IRegistry.sol +3 -2
- package/contracts/registry/IRegistryService.sol +16 -6
- package/contracts/registry/Registry.sol +20 -8
- package/contracts/registry/RegistryService.sol +50 -85
- package/contracts/registry/ReleaseManager.sol +19 -40
- package/contracts/registry/TokenRegistry.sol +4 -3
- package/contracts/shared/ERC165.sol +12 -11
- package/contracts/shared/INftOwnable.sol +12 -6
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +4 -4
- package/contracts/shared/IRegistryLinked.sol +15 -0
- package/contracts/shared/IVersionable.sol +2 -2
- package/contracts/shared/NftOwnable.sol +113 -59
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +5 -4
- package/contracts/shared/Registerable.sol +15 -24
- package/contracts/shared/RegistryLinked.sol +64 -0
- package/contracts/shared/Service.sol +5 -5
- package/contracts/shared/Versionable.sol +3 -2
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/ObjectType.sol +6 -2
- package/package.json +3 -3
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -100
- package/contracts/instance/base/IInstanceBase.sol +0 -21
|
@@ -5,124 +5,143 @@ import {POOL} from "../types/ObjectType.sol";
|
|
|
5
5
|
import {IPoolService} from "../instance/service/IPoolService.sol";
|
|
6
6
|
import {IBundleService} from "../instance/service/IBundleService.sol";
|
|
7
7
|
import {NftId, NftIdLib} from "../types/NftId.sol";
|
|
8
|
-
import {Fee} from "../types/Fee.sol";
|
|
8
|
+
import {Fee, FeeLib} from "../types/Fee.sol";
|
|
9
9
|
import {UFixed} from "../types/UFixed.sol";
|
|
10
10
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
|
11
11
|
import {Component} from "./Component.sol";
|
|
12
12
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
|
13
13
|
import {ISetup} from "../instance/module/ISetup.sol";
|
|
14
14
|
|
|
15
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
|
16
|
-
|
|
17
15
|
import {ISetup} from "../instance/module/ISetup.sol";
|
|
18
16
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
|
19
17
|
|
|
20
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
|
21
|
-
import {Registerable} from "../shared/Registerable.sol";
|
|
22
18
|
|
|
23
|
-
abstract contract Pool is
|
|
24
|
-
|
|
19
|
+
abstract contract Pool is
|
|
20
|
+
Component,
|
|
21
|
+
IPoolComponent
|
|
22
|
+
{
|
|
23
|
+
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.Pool")) - 1)) & ~bytes32(uint256(0xff));
|
|
24
|
+
bytes32 public constant POOL_STORAGE_LOCATION_V1 = 0x25e3e51823fbfffb988e0a2744bb93722d9f3e906c07cc0a9e77884c46c58300;
|
|
25
|
+
|
|
26
|
+
struct PoolStorage {
|
|
27
|
+
UFixed _collateralizationLevel;
|
|
28
|
+
UFixed _retentionLevel;
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
bool _isExternallyManaged;
|
|
31
|
+
bool _isInterceptingBundleTransfers;
|
|
32
|
+
bool _isVerifyingApplications;
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
Fee _initialPoolFee;
|
|
35
|
+
Fee _initialStakingFee;
|
|
36
|
+
Fee _initialPerformanceFee;
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
TokenHandler _tokenHandler;
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
// may be used to interact with instance by derived contracts
|
|
41
|
+
IPoolService _poolService;
|
|
42
|
+
IBundleService _bundleService;
|
|
43
|
+
}
|
|
38
44
|
|
|
39
45
|
modifier onlyPoolService() {
|
|
40
|
-
|
|
41
|
-
msg.sender
|
|
42
|
-
|
|
46
|
+
if(msg.sender != address(_getPoolStorage()._poolService)) {
|
|
47
|
+
revert ErrorPoolNotPoolService(msg.sender);
|
|
48
|
+
}
|
|
43
49
|
_;
|
|
44
50
|
}
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
|
|
53
|
+
function initializePool(
|
|
47
54
|
address registry,
|
|
48
55
|
NftId instanceNftId,
|
|
56
|
+
string memory name,
|
|
49
57
|
// TODO refactor into tokenNftId
|
|
50
58
|
address token,
|
|
51
|
-
bool
|
|
52
|
-
bool
|
|
59
|
+
bool isInterceptingNftTransfers,
|
|
60
|
+
bool isExternallyManaging,
|
|
61
|
+
bool isVerifying,
|
|
53
62
|
UFixed collateralizationLevel,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
address initialOwner
|
|
63
|
+
UFixed retentionLevel,
|
|
64
|
+
address initialOwner,
|
|
65
|
+
bytes memory data
|
|
58
66
|
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// TODO add validation
|
|
63
|
-
_collateralizationLevel = collateralizationLevel;
|
|
64
|
-
_initialPoolFee = poolFee;
|
|
65
|
-
_initialStakingFee = stakingFee;
|
|
66
|
-
_initialPerformanceFee = performanceFee;
|
|
67
|
-
|
|
68
|
-
_tokenHandler = new TokenHandler(token);
|
|
69
|
-
|
|
70
|
-
_poolService = _instance.getPoolService();
|
|
71
|
-
// _productService = _instance.getProductService();
|
|
72
|
-
_bundleService = _instance.getBundleService();
|
|
73
|
-
|
|
74
|
-
_registerInterface(type(IPoolComponent).interfaceId);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function createBundle(
|
|
78
|
-
Fee memory fee,
|
|
79
|
-
uint256 initialAmount,
|
|
80
|
-
uint256 lifetime,
|
|
81
|
-
bytes memory filter
|
|
82
|
-
)
|
|
83
|
-
external
|
|
84
|
-
virtual override
|
|
85
|
-
returns(NftId bundleNftId)
|
|
67
|
+
public
|
|
68
|
+
virtual
|
|
69
|
+
onlyInitializing()
|
|
86
70
|
{
|
|
87
|
-
|
|
88
|
-
bundleNftId = _bundleService.createBundle(
|
|
89
|
-
owner,
|
|
90
|
-
fee,
|
|
91
|
-
initialAmount,
|
|
92
|
-
lifetime,
|
|
93
|
-
filter
|
|
94
|
-
);
|
|
71
|
+
initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, data);
|
|
95
72
|
|
|
96
|
-
|
|
73
|
+
PoolStorage storage $ = _getPoolStorage();
|
|
74
|
+
// TODO add validation
|
|
75
|
+
$._tokenHandler = new TokenHandler(token);
|
|
76
|
+
$._isExternallyManaged = isExternallyManaging;
|
|
77
|
+
$._isVerifyingApplications = isVerifying;
|
|
78
|
+
$._collateralizationLevel = collateralizationLevel;
|
|
79
|
+
$._retentionLevel = retentionLevel;
|
|
80
|
+
$._initialPoolFee = FeeLib.zeroFee();
|
|
81
|
+
$._initialStakingFee = FeeLib.zeroFee();
|
|
82
|
+
$._initialPerformanceFee = FeeLib.zeroFee();
|
|
83
|
+
$._poolService = getInstance().getPoolService();
|
|
84
|
+
$._bundleService = getInstance().getBundleService();
|
|
85
|
+
|
|
86
|
+
registerInterface(type(IPoolComponent).interfaceId);
|
|
97
87
|
}
|
|
98
88
|
|
|
99
89
|
/**
|
|
100
|
-
* @dev see {IPool.
|
|
90
|
+
* @dev see {IPool.verifyApplication}.
|
|
101
91
|
* Default implementation that only writes a {LogUnderwrittenByPool} entry.
|
|
102
92
|
*/
|
|
103
|
-
function
|
|
104
|
-
NftId
|
|
105
|
-
bytes memory
|
|
93
|
+
function verifyApplication(
|
|
94
|
+
NftId applicationNftId,
|
|
95
|
+
bytes memory applicationData,
|
|
106
96
|
bytes memory bundleFilter,
|
|
107
97
|
uint256 collateralizationAmount
|
|
108
98
|
)
|
|
109
99
|
external
|
|
110
|
-
|
|
100
|
+
restricted()
|
|
111
101
|
virtual override
|
|
112
102
|
{
|
|
113
|
-
|
|
103
|
+
require(
|
|
104
|
+
policyMatchesBundle(applicationData, bundleFilter),
|
|
105
|
+
"ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
emit LogUnderwrittenByPool(applicationNftId, collateralizationAmount, address(this));
|
|
114
109
|
}
|
|
115
110
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
|
|
112
|
+
function isInterceptingBundleTransfers() external view override returns (bool) {
|
|
113
|
+
return isNftInterceptor();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
function isExternallyManaged() external view override returns (bool) {
|
|
118
|
+
return _getPoolStorage()._isExternallyManaged;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
function getRetentionLevel() external view override returns (UFixed retentionLevel) {
|
|
123
|
+
return _getPoolStorage()._retentionLevel;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
|
|
128
|
+
return _getPoolStorage()._collateralizationLevel;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
function isVerifyingApplications() external view override returns (bool isConfirmingApplication) {
|
|
133
|
+
return _getPoolStorage()._isVerifyingApplications;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
/// @dev see {IPoolComponent.policyMatchesBundle}.
|
|
138
|
+
/// Default implementation always returns true
|
|
120
139
|
function policyMatchesBundle(
|
|
121
140
|
bytes memory, // policyData
|
|
122
141
|
bytes memory // bundleFilter
|
|
123
142
|
)
|
|
124
143
|
public
|
|
125
|
-
|
|
144
|
+
pure
|
|
126
145
|
virtual override
|
|
127
146
|
returns (bool isMatching)
|
|
128
147
|
{
|
|
@@ -130,14 +149,6 @@ abstract contract Pool is Component, IPoolComponent {
|
|
|
130
149
|
}
|
|
131
150
|
|
|
132
151
|
|
|
133
|
-
function isConfirmingApplication() external view override returns (bool isConfirmingApplication) {
|
|
134
|
-
return _isConfirmingApplication;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
|
|
138
|
-
return _collateralizationLevel;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
152
|
function setFees(
|
|
142
153
|
Fee memory poolFee,
|
|
143
154
|
Fee memory stakingFee,
|
|
@@ -145,9 +156,10 @@ abstract contract Pool is Component, IPoolComponent {
|
|
|
145
156
|
)
|
|
146
157
|
external
|
|
147
158
|
onlyOwner
|
|
159
|
+
restricted()
|
|
148
160
|
override
|
|
149
161
|
{
|
|
150
|
-
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
|
162
|
+
_getPoolStorage()._poolService.setFees(poolFee, stakingFee, performanceFee);
|
|
151
163
|
}
|
|
152
164
|
|
|
153
165
|
function setBundleFee(
|
|
@@ -158,7 +170,7 @@ abstract contract Pool is Component, IPoolComponent {
|
|
|
158
170
|
override
|
|
159
171
|
// TODO add onlyBundleOwner
|
|
160
172
|
{
|
|
161
|
-
_bundleService.setBundleFee(bundleNftId, fee);
|
|
173
|
+
_getPoolStorage()._bundleService.setBundleFee(bundleNftId, fee);
|
|
162
174
|
}
|
|
163
175
|
|
|
164
176
|
function lockBundle(
|
|
@@ -168,7 +180,7 @@ abstract contract Pool is Component, IPoolComponent {
|
|
|
168
180
|
override
|
|
169
181
|
// TODO add onlyBundleOwner
|
|
170
182
|
{
|
|
171
|
-
_bundleService.lockBundle(bundleNftId);
|
|
183
|
+
_getPoolStorage()._bundleService.lockBundle(bundleNftId);
|
|
172
184
|
}
|
|
173
185
|
|
|
174
186
|
function unlockBundle(
|
|
@@ -178,81 +190,65 @@ abstract contract Pool is Component, IPoolComponent {
|
|
|
178
190
|
override
|
|
179
191
|
// TODO add onlyBundleOwner
|
|
180
192
|
{
|
|
181
|
-
_bundleService.unlockBundle(bundleNftId);
|
|
193
|
+
_getPoolStorage()._bundleService.unlockBundle(bundleNftId);
|
|
182
194
|
}
|
|
183
195
|
|
|
184
196
|
function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
|
|
185
|
-
InstanceReader reader =
|
|
186
|
-
|
|
187
|
-
}
|
|
197
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
|
198
|
+
setupInfo = reader.getPoolSetupInfo(getNftId());
|
|
188
199
|
|
|
189
|
-
|
|
200
|
+
// fallback to initial setup info (wallet is always != address(0))
|
|
201
|
+
if(setupInfo.wallet == address(0)) {
|
|
202
|
+
setupInfo = _getInitialSetupInfo();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
190
205
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
abi.encode(
|
|
206
|
-
getName(),
|
|
207
|
-
ISetup.PoolSetupInfo(
|
|
208
|
-
_productNftId,
|
|
209
|
-
_tokenHandler,
|
|
210
|
-
_collateralizationLevel,
|
|
211
|
-
_initialPoolFee,
|
|
212
|
-
_initialStakingFee,
|
|
213
|
-
_initialPerformanceFee,
|
|
214
|
-
false,
|
|
215
|
-
_isConfirmingApplication,
|
|
216
|
-
_wallet
|
|
217
|
-
)
|
|
218
|
-
)
|
|
206
|
+
function _getInitialSetupInfo() internal view returns (ISetup.PoolSetupInfo memory) {
|
|
207
|
+
PoolStorage storage $ = _getPoolStorage();
|
|
208
|
+
return ISetup.PoolSetupInfo(
|
|
209
|
+
getProductNftId(),
|
|
210
|
+
$._tokenHandler,
|
|
211
|
+
isNftInterceptor(),
|
|
212
|
+
$._isExternallyManaged,
|
|
213
|
+
$._isVerifyingApplications,
|
|
214
|
+
$._collateralizationLevel,
|
|
215
|
+
$._retentionLevel,
|
|
216
|
+
$._initialPoolFee,
|
|
217
|
+
$._initialStakingFee,
|
|
218
|
+
$._initialPerformanceFee,
|
|
219
|
+
getWallet()
|
|
219
220
|
);
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
// Internals
|
|
223
224
|
|
|
224
|
-
function _underwrite(
|
|
225
|
-
NftId policyNftId,
|
|
226
|
-
bytes memory policyData,
|
|
227
|
-
bytes memory bundleFilter,
|
|
228
|
-
uint256 collateralizationAmount
|
|
229
|
-
)
|
|
230
|
-
internal
|
|
231
|
-
{
|
|
232
|
-
require(
|
|
233
|
-
policyMatchesBundle(policyData, bundleFilter),
|
|
234
|
-
"ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
emit LogUnderwrittenByPool(policyNftId, collateralizationAmount, address(this));
|
|
238
|
-
}
|
|
239
|
-
|
|
240
225
|
function _createBundle(
|
|
241
226
|
address bundleOwner,
|
|
242
227
|
Fee memory fee,
|
|
243
228
|
uint256 amount,
|
|
244
229
|
uint256 lifetime,
|
|
245
|
-
bytes
|
|
230
|
+
bytes memory filter
|
|
246
231
|
)
|
|
247
232
|
internal
|
|
248
233
|
returns(NftId bundleNftId)
|
|
249
234
|
{
|
|
250
|
-
bundleNftId = _bundleService.createBundle(
|
|
235
|
+
bundleNftId = _getPoolStorage()._bundleService.createBundle(
|
|
251
236
|
bundleOwner,
|
|
252
237
|
fee,
|
|
253
238
|
amount,
|
|
254
239
|
lifetime,
|
|
255
|
-
filter
|
|
256
|
-
|
|
240
|
+
filter);
|
|
241
|
+
|
|
242
|
+
// TODO add logging
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function getContractLocation(bytes memory name) external pure returns (bytes32 hash) {
|
|
246
|
+
return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function _getPoolStorage() private pure returns (PoolStorage storage $) {
|
|
250
|
+
assembly {
|
|
251
|
+
$.slot := POOL_STORAGE_LOCATION_V1
|
|
252
|
+
}
|
|
257
253
|
}
|
|
258
254
|
}
|
|
@@ -15,9 +15,6 @@ import {Timestamp} from "../types/Timestamp.sol";
|
|
|
15
15
|
import {Fee} from "../types/Fee.sol";
|
|
16
16
|
import {Component} from "./Component.sol";
|
|
17
17
|
|
|
18
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
|
19
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
|
20
|
-
import {Registerable} from "../shared/Registerable.sol";
|
|
21
18
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
|
22
19
|
|
|
23
20
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
|
@@ -25,43 +22,55 @@ import {ISetup} from "../instance/module/ISetup.sol";
|
|
|
25
22
|
import {Pool} from "../components/Pool.sol";
|
|
26
23
|
import {Distribution} from "../components/Distribution.sol";
|
|
27
24
|
|
|
28
|
-
abstract contract Product is
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
abstract contract Product is
|
|
26
|
+
Component,
|
|
27
|
+
IProductComponent
|
|
28
|
+
{
|
|
29
|
+
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.Product")) - 1)) & ~bytes32(uint256(0xff));
|
|
30
|
+
bytes32 public constant PRODUCT_STORAGE_LOCATION_V1 = 0x0bb7aafdb8e380f81267337bc5b5dfdf76e6d3a380ecadb51ec665246d9d6800;
|
|
31
|
+
|
|
32
|
+
struct ProductStorage {
|
|
33
|
+
IPolicyService _policyService;
|
|
34
|
+
Pool _pool;
|
|
35
|
+
Distribution _distribution;
|
|
36
|
+
Fee _initialProductFee;
|
|
37
|
+
Fee _initialProcessingFee;
|
|
38
|
+
TokenHandler _tokenHandler;
|
|
39
|
+
NftId _poolNftId;
|
|
40
|
+
NftId _distributionNftId;
|
|
41
|
+
}
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
function initializeProduct(
|
|
42
44
|
address registry,
|
|
43
|
-
NftId
|
|
45
|
+
NftId instanceNftId,
|
|
46
|
+
string memory name,
|
|
44
47
|
address token,
|
|
45
48
|
bool isInterceptor,
|
|
46
49
|
address pool,
|
|
47
50
|
address distribution,
|
|
48
51
|
Fee memory productFee,
|
|
49
52
|
Fee memory processingFee,
|
|
50
|
-
address initialOwner
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
_tokenHandler = new TokenHandler(token);
|
|
60
|
-
|
|
61
|
-
_poolNftId = getRegistry().getNftId(address(_pool));
|
|
62
|
-
_distributionNftId = getRegistry().getNftId(address(_distribution));
|
|
53
|
+
address initialOwner,
|
|
54
|
+
bytes memory data
|
|
55
|
+
)
|
|
56
|
+
public
|
|
57
|
+
virtual
|
|
58
|
+
onlyInitializing()
|
|
59
|
+
{
|
|
60
|
+
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, data);
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
ProductStorage storage $ = _getProductStorage();
|
|
63
|
+
// TODO add validation
|
|
64
|
+
$._policyService = getInstance().getPolicyService();
|
|
65
|
+
$._pool = Pool(pool);
|
|
66
|
+
$._distribution = Distribution(distribution);
|
|
67
|
+
$._initialProductFee = productFee;
|
|
68
|
+
$._initialProcessingFee = processingFee;
|
|
69
|
+
$._tokenHandler = new TokenHandler(token);
|
|
70
|
+
$._poolNftId = getRegistry().getNftId(pool);
|
|
71
|
+
$._distributionNftId = getRegistry().getNftId(distribution);
|
|
72
|
+
|
|
73
|
+
registerInterface(type(IProductComponent).interfaceId);
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
|
|
@@ -78,7 +87,7 @@ abstract contract Product is Component, IProductComponent {
|
|
|
78
87
|
override
|
|
79
88
|
returns (uint256 premiumAmount)
|
|
80
89
|
{
|
|
81
|
-
(premiumAmount,,,,) = _policyService.calculatePremium(
|
|
90
|
+
(premiumAmount,,,,) = _getProductStorage()._policyService.calculatePremium(
|
|
82
91
|
riskId,
|
|
83
92
|
sumInsuredAmount,
|
|
84
93
|
lifetime,
|
|
@@ -112,7 +121,7 @@ abstract contract Product is Component, IProductComponent {
|
|
|
112
121
|
RiskId id,
|
|
113
122
|
bytes memory data
|
|
114
123
|
) internal {
|
|
115
|
-
|
|
124
|
+
getProductService().createRisk(
|
|
116
125
|
id,
|
|
117
126
|
data
|
|
118
127
|
);
|
|
@@ -122,7 +131,7 @@ abstract contract Product is Component, IProductComponent {
|
|
|
122
131
|
RiskId id,
|
|
123
132
|
bytes memory data
|
|
124
133
|
) internal {
|
|
125
|
-
|
|
134
|
+
getProductService().updateRisk(
|
|
126
135
|
id,
|
|
127
136
|
data
|
|
128
137
|
);
|
|
@@ -132,14 +141,14 @@ abstract contract Product is Component, IProductComponent {
|
|
|
132
141
|
RiskId id,
|
|
133
142
|
StateId state
|
|
134
143
|
) internal {
|
|
135
|
-
|
|
144
|
+
getProductService().updateRiskState(
|
|
136
145
|
id,
|
|
137
146
|
state
|
|
138
147
|
);
|
|
139
148
|
}
|
|
140
149
|
|
|
141
150
|
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
|
142
|
-
return
|
|
151
|
+
return getInstance().getInstanceReader().getRiskInfo(id);
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
function _createApplication(
|
|
@@ -150,8 +159,11 @@ abstract contract Product is Component, IProductComponent {
|
|
|
150
159
|
bytes memory applicationData,
|
|
151
160
|
NftId bundleNftId,
|
|
152
161
|
ReferralId referralId
|
|
153
|
-
)
|
|
154
|
-
|
|
162
|
+
)
|
|
163
|
+
internal
|
|
164
|
+
returns (NftId nftId)
|
|
165
|
+
{
|
|
166
|
+
return _getProductStorage()._policyService.createApplication(
|
|
155
167
|
applicationOwner,
|
|
156
168
|
riskId,
|
|
157
169
|
sumInsuredAmount,
|
|
@@ -169,7 +181,7 @@ abstract contract Product is Component, IProductComponent {
|
|
|
169
181
|
)
|
|
170
182
|
internal
|
|
171
183
|
{
|
|
172
|
-
_policyService.underwrite(
|
|
184
|
+
_getProductStorage()._policyService.underwrite(
|
|
173
185
|
policyNftId,
|
|
174
186
|
requirePremiumPayment,
|
|
175
187
|
activateAt);
|
|
@@ -181,7 +193,7 @@ abstract contract Product is Component, IProductComponent {
|
|
|
181
193
|
)
|
|
182
194
|
internal
|
|
183
195
|
{
|
|
184
|
-
_policyService.collectPremium(
|
|
196
|
+
_getProductStorage()._policyService.collectPremium(
|
|
185
197
|
policyNftId,
|
|
186
198
|
activateAt);
|
|
187
199
|
}
|
|
@@ -192,7 +204,7 @@ abstract contract Product is Component, IProductComponent {
|
|
|
192
204
|
)
|
|
193
205
|
internal
|
|
194
206
|
{
|
|
195
|
-
_policyService.activate(
|
|
207
|
+
_getProductStorage()._policyService.activate(
|
|
196
208
|
policyNftId,
|
|
197
209
|
activateAt);
|
|
198
210
|
}
|
|
@@ -202,15 +214,15 @@ abstract contract Product is Component, IProductComponent {
|
|
|
202
214
|
)
|
|
203
215
|
internal
|
|
204
216
|
{
|
|
205
|
-
_policyService.close(policyNftId);
|
|
217
|
+
_getProductStorage()._policyService.close(policyNftId);
|
|
206
218
|
}
|
|
207
219
|
|
|
208
220
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
|
209
|
-
return getRegistry().getNftId(address(_pool));
|
|
221
|
+
return getRegistry().getNftId(address(_getProductStorage()._pool));
|
|
210
222
|
}
|
|
211
223
|
|
|
212
224
|
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
|
213
|
-
return getRegistry().getNftId(address(_distribution));
|
|
225
|
+
return getRegistry().getNftId(address(_getProductStorage()._distribution));
|
|
214
226
|
}
|
|
215
227
|
|
|
216
228
|
// from product component
|
|
@@ -220,76 +232,47 @@ abstract contract Product is Component, IProductComponent {
|
|
|
220
232
|
)
|
|
221
233
|
external
|
|
222
234
|
onlyOwner
|
|
235
|
+
restricted()
|
|
223
236
|
override
|
|
224
237
|
{
|
|
225
|
-
|
|
238
|
+
getProductService().setFees(productFee, processingFee);
|
|
226
239
|
}
|
|
227
240
|
|
|
228
241
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
|
229
|
-
InstanceReader reader =
|
|
230
|
-
|
|
231
|
-
}
|
|
242
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
|
243
|
+
setupInfo = reader.getProductSetupInfo(getNftId());
|
|
232
244
|
|
|
233
|
-
|
|
245
|
+
// fallback to initial setup info (wallet is always != address(0))
|
|
246
|
+
if(setupInfo.wallet == address(0)) {
|
|
247
|
+
setupInfo = _getInitialSetupInfo();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
234
250
|
|
|
235
|
-
function
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
// from PoolComponent
|
|
255
|
-
(
|
|
256
|
-
,
|
|
257
|
-
bytes memory poolData
|
|
258
|
-
) = _pool.getInitialInfo();
|
|
259
|
-
|
|
260
|
-
(
|
|
261
|
-
, ISetup.PoolSetupInfo memory poolSetupInfo
|
|
262
|
-
) = abi.decode(poolData, (string, ISetup.PoolSetupInfo));
|
|
263
|
-
|
|
264
|
-
// from DistributionComponent
|
|
265
|
-
(
|
|
266
|
-
,
|
|
267
|
-
bytes memory distributionData
|
|
268
|
-
) = _distribution.getInitialInfo();
|
|
269
|
-
|
|
270
|
-
(
|
|
271
|
-
, ISetup.DistributionSetupInfo memory distributionSetupInfo
|
|
272
|
-
) = abi.decode(distributionData, (string, ISetup.DistributionSetupInfo));
|
|
273
|
-
|
|
274
|
-
return (
|
|
275
|
-
productInfo,
|
|
276
|
-
abi.encode(
|
|
277
|
-
getName(),
|
|
278
|
-
ISetup.ProductSetupInfo(
|
|
279
|
-
_token,
|
|
280
|
-
_tokenHandler,
|
|
281
|
-
_distributionNftId,
|
|
282
|
-
_poolNftId,
|
|
283
|
-
distributionSetupInfo.distributionFee,
|
|
284
|
-
_initialProductFee,
|
|
285
|
-
_initialProcessingFee,
|
|
286
|
-
poolSetupInfo.poolFee,
|
|
287
|
-
poolSetupInfo.stakingFee,
|
|
288
|
-
poolSetupInfo.performanceFee,
|
|
289
|
-
false,
|
|
290
|
-
_wallet
|
|
291
|
-
)
|
|
292
|
-
)
|
|
251
|
+
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
|
252
|
+
ProductStorage storage $ = _getProductStorage();
|
|
253
|
+
|
|
254
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
|
|
255
|
+
ISetup.PoolSetupInfo memory poolSetupInfo = $._pool.getSetupInfo();
|
|
256
|
+
|
|
257
|
+
return ISetup.ProductSetupInfo(
|
|
258
|
+
getToken(),
|
|
259
|
+
$._tokenHandler,
|
|
260
|
+
$._distributionNftId,
|
|
261
|
+
$._poolNftId,
|
|
262
|
+
distributionSetupInfo.distributionFee,
|
|
263
|
+
$._initialProductFee,
|
|
264
|
+
$._initialProcessingFee,
|
|
265
|
+
poolSetupInfo.poolFee,
|
|
266
|
+
poolSetupInfo.stakingFee,
|
|
267
|
+
poolSetupInfo.performanceFee,
|
|
268
|
+
false,
|
|
269
|
+
getWallet()
|
|
293
270
|
);
|
|
294
271
|
}
|
|
272
|
+
|
|
273
|
+
function _getProductStorage() private pure returns (ProductStorage storage $) {
|
|
274
|
+
assembly {
|
|
275
|
+
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
|
276
|
+
}
|
|
277
|
+
}
|
|
295
278
|
}
|