@etherisc/gif-next 0.0.2-b9e43cf-870 → 0.0.2-bb7b80e-316
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +11 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +11 -0
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +11 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +5 -5
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +11 -0
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +16 -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/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/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.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 +0 -13
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +56 -69
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +2 -2
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +2 -2
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +2 -2
- 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/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -13
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +2 -2
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +2 -2
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- 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 +2 -2
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +2 -2
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +2 -2
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +2 -2
- 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/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- 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 +2 -2
- 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 +2 -2
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +2 -2
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/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/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/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/BaseComponent.sol +15 -6
- package/contracts/components/Distribution.sol +0 -10
- package/contracts/components/IBaseComponent.sol +3 -2
- package/contracts/components/IProductComponent.sol +2 -2
- package/contracts/components/Pool.sol +3 -17
- package/contracts/components/Product.sol +5 -11
- package/contracts/instance/IInstance.sol +0 -2
- package/contracts/instance/IInstanceBase.sol +0 -1
- package/contracts/instance/Instance.sol +2 -12
- package/contracts/instance/InstanceBase.sol +0 -2
- package/contracts/instance/base/IInstanceBase.sol +0 -2
- package/package.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -814
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
- package/contracts/instance/service/ComponentOwnerService.sol +0 -315
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
@@ -5,26 +5,27 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
|
|
5
5
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
6
6
|
|
7
7
|
import {IBaseComponent} from "./IBaseComponent.sol";
|
8
|
-
import {
|
8
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
9
9
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
10
10
|
import {IInstance} from "../instance/IInstance.sol";
|
11
11
|
import {InstanceAccessManager} from "../instance/InstanceAccessManager.sol";
|
12
12
|
import {IRegistry} from "../registry/IRegistry.sol";
|
13
13
|
import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
14
|
-
import {ObjectType, INSTANCE} from "../types/ObjectType.sol";
|
14
|
+
import {ObjectType, INSTANCE, PRODUCT} from "../types/ObjectType.sol";
|
15
15
|
import {VersionLib} from "../types/Version.sol";
|
16
16
|
import {Registerable} from "../shared/Registerable.sol";
|
17
17
|
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
18
18
|
import {IAccess} from "../instance/module/IAccess.sol";
|
19
19
|
|
20
|
+
// TODO also inherit oz accessmanaged
|
20
21
|
abstract contract BaseComponent is
|
21
22
|
Registerable,
|
22
23
|
IBaseComponent
|
23
24
|
{
|
24
25
|
using NftIdLib for NftId;
|
25
26
|
|
26
|
-
IComponentOwnerService internal _componentOwnerService;
|
27
27
|
IInstanceService internal _instanceService;
|
28
|
+
IProductService internal _productService;
|
28
29
|
|
29
30
|
address internal _deployer;
|
30
31
|
address internal _wallet;
|
@@ -32,6 +33,13 @@ abstract contract BaseComponent is
|
|
32
33
|
IInstance internal _instance;
|
33
34
|
NftId internal _productNftId;
|
34
35
|
|
36
|
+
modifier onlyProductService() {
|
37
|
+
if(msg.sender != address(_productService)) {
|
38
|
+
revert ErrorBaseComponentNotProductService(msg.sender);
|
39
|
+
}
|
40
|
+
_;
|
41
|
+
}
|
42
|
+
|
35
43
|
modifier onlyInstanceRole(uint64 roleIdNum) {
|
36
44
|
RoleId roleId = RoleIdLib.toRoleId(roleIdNum);
|
37
45
|
InstanceAccessManager accessManager = InstanceAccessManager(_instance.authority());
|
@@ -41,6 +49,7 @@ abstract contract BaseComponent is
|
|
41
49
|
_;
|
42
50
|
}
|
43
51
|
|
52
|
+
// TODO move to oz accessmanaged locked (which is included in restricted modifier)
|
44
53
|
modifier isNotLocked() {
|
45
54
|
InstanceAccessManager accessManager = InstanceAccessManager(_instance.authority());
|
46
55
|
if (accessManager.isTargetLocked(address(this))) {
|
@@ -61,15 +70,15 @@ abstract contract BaseComponent is
|
|
61
70
|
bytes memory data = "";
|
62
71
|
_initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
|
63
72
|
|
64
|
-
IRegistry.ObjectInfo memory instanceInfo =
|
73
|
+
IRegistry.ObjectInfo memory instanceInfo = _registry.getObjectInfo(instanceNftId);
|
65
74
|
_instance = IInstance(instanceInfo.objectAddress);
|
66
75
|
require(
|
67
76
|
_instance.supportsInterface(type(IInstance).interfaceId),
|
68
77
|
""
|
69
78
|
);
|
70
79
|
|
71
|
-
|
72
|
-
|
80
|
+
_instanceService = IInstanceService(_registry.getServiceAddress(INSTANCE(), VersionLib.toVersion(3, 0, 0).toMajorPart()));
|
81
|
+
_productService = IProductService(_registry.getServiceAddress(PRODUCT(), VersionLib.toVersion(3, 0, 0).toMajorPart()));
|
73
82
|
_wallet = address(this);
|
74
83
|
_token = IERC20Metadata(token);
|
75
84
|
|
@@ -28,14 +28,6 @@ abstract contract Distribution is
|
|
28
28
|
TokenHandler internal _tokenHandler;
|
29
29
|
|
30
30
|
IDistributionService private _distributionService;
|
31
|
-
IProductService private _productService;
|
32
|
-
|
33
|
-
modifier onlyProductService() {
|
34
|
-
require(
|
35
|
-
msg.sender == address(_productService),
|
36
|
-
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
37
|
-
_;
|
38
|
-
}
|
39
31
|
|
40
32
|
constructor(
|
41
33
|
address registry,
|
@@ -52,9 +44,7 @@ abstract contract Distribution is
|
|
52
44
|
_initialDistributionFee = distributionFee;
|
53
45
|
|
54
46
|
_tokenHandler = TokenHandler(token);
|
55
|
-
|
56
47
|
_distributionService = _instance.getDistributionService();
|
57
|
-
_productService = _instance.getProductService();
|
58
48
|
|
59
49
|
_registerInterface(type(IDistributionComponent).interfaceId);
|
60
50
|
}
|
@@ -11,14 +11,15 @@ interface IBaseComponent is IRegisterable {
|
|
11
11
|
error ErrorBaseComponentWalletAddressIsSameAsCurrent(address newWallet);
|
12
12
|
error ErrorBaseComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
|
13
13
|
error ErrorBaseComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
|
14
|
+
error ErrorBaseComponentNotProductService(address caller);
|
14
15
|
|
15
16
|
event LogBaseComponentWalletAddressChanged(address newWallet);
|
16
17
|
event LogBaseComponentWalletTokensTransferred(address from, address to, uint256 amount);
|
17
18
|
|
18
|
-
function getName() external pure
|
19
|
+
function getName() external pure returns (string memory name);
|
19
20
|
|
21
|
+
// TODO remove and replace with accessmanaged target locking mechanism
|
20
22
|
function lock() external;
|
21
|
-
|
22
23
|
function unlock() external;
|
23
24
|
|
24
25
|
function getToken() external view returns (IERC20Metadata token);
|
@@ -18,8 +18,8 @@ interface IProductComponent {
|
|
18
18
|
RiskId riskId,
|
19
19
|
uint256 lifetime,
|
20
20
|
bytes memory applicationData,
|
21
|
-
|
22
|
-
|
21
|
+
NftId bundleNftId,
|
22
|
+
ReferralId referralId
|
23
23
|
) external view returns (uint256 premiumAmount);
|
24
24
|
|
25
25
|
function calculateNetPremium(
|
@@ -1,11 +1,10 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {IProductService} from "../instance/service/IProductService.sol";
|
4
|
+
import {POOL} from "../types/ObjectType.sol";
|
6
5
|
import {IPoolService} from "../instance/service/IPoolService.sol";
|
7
6
|
import {IBundleService} from "../instance/service/IBundleService.sol";
|
8
|
-
import {NftId,
|
7
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
9
8
|
import {Fee} from "../types/Fee.sol";
|
10
9
|
import {UFixed} from "../types/UFixed.sol";
|
11
10
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
@@ -15,8 +14,6 @@ import {ISetup} from "../instance/module/ISetup.sol";
|
|
15
14
|
|
16
15
|
import {IRegistry} from "../registry/IRegistry.sol";
|
17
16
|
|
18
|
-
// import {IPool} from "../instance/module/pool/IPoolModule.sol";
|
19
|
-
import {ITreasury} from "../instance/module/ITreasury.sol";
|
20
17
|
import {ISetup} from "../instance/module/ISetup.sol";
|
21
18
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
22
19
|
|
@@ -37,10 +34,6 @@ abstract contract Pool is BaseComponent, IPoolComponent {
|
|
37
34
|
|
38
35
|
// may be used to interact with instance by derived contracts
|
39
36
|
IPoolService internal _poolService;
|
40
|
-
|
41
|
-
// only relevant to protect callback functions for "active" pools
|
42
|
-
IProductService private _productService;
|
43
|
-
|
44
37
|
IBundleService private _bundleService;
|
45
38
|
|
46
39
|
modifier onlyPoolService() {
|
@@ -50,13 +43,6 @@ abstract contract Pool is BaseComponent, IPoolComponent {
|
|
50
43
|
_;
|
51
44
|
}
|
52
45
|
|
53
|
-
modifier onlyProductService() {
|
54
|
-
require(
|
55
|
-
msg.sender == address(_productService),
|
56
|
-
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
57
|
-
_;
|
58
|
-
}
|
59
|
-
|
60
46
|
constructor(
|
61
47
|
address registry,
|
62
48
|
NftId instanceNftId,
|
@@ -82,7 +68,7 @@ abstract contract Pool is BaseComponent, IPoolComponent {
|
|
82
68
|
_tokenHandler = new TokenHandler(token);
|
83
69
|
|
84
70
|
_poolService = _instance.getPoolService();
|
85
|
-
_productService = _instance.getProductService();
|
71
|
+
// _productService = _instance.getProductService();
|
86
72
|
_bundleService = _instance.getBundleService();
|
87
73
|
|
88
74
|
_registerInterface(type(IPoolComponent).interfaceId);
|
@@ -4,17 +4,15 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
6
|
import {IRisk} from "../instance/module/IRisk.sol";
|
7
|
-
import {ITreasury} from "../instance/module/ITreasury.sol";
|
8
|
-
import {IProductService} from "../instance/service/IProductService.sol";
|
9
7
|
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
10
8
|
import {IProductComponent} from "./IProductComponent.sol";
|
11
|
-
import {NftId,
|
12
|
-
import {
|
9
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
10
|
+
import {PRODUCT} from "../types/ObjectType.sol";
|
13
11
|
import {ReferralId} from "../types/Referral.sol";
|
14
12
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
15
13
|
import {StateId} from "../types/StateId.sol";
|
16
14
|
import {Timestamp} from "../types/Timestamp.sol";
|
17
|
-
import {Fee
|
15
|
+
import {Fee} from "../types/Fee.sol";
|
18
16
|
import {BaseComponent} from "./BaseComponent.sol";
|
19
17
|
|
20
18
|
import {IRegistry} from "../registry/IRegistry.sol";
|
@@ -27,12 +25,9 @@ import {ISetup} from "../instance/module/ISetup.sol";
|
|
27
25
|
import {Pool} from "../components/Pool.sol";
|
28
26
|
import {Distribution} from "../components/Distribution.sol";
|
29
27
|
|
30
|
-
import {zeroNftId} from "../types/NftId.sol";
|
31
|
-
|
32
28
|
abstract contract Product is BaseComponent, IProductComponent {
|
33
29
|
using NftIdLib for NftId;
|
34
30
|
|
35
|
-
IProductService internal _productService;
|
36
31
|
IPolicyService internal _policyService;
|
37
32
|
Pool internal _pool;
|
38
33
|
Distribution internal _distribution;
|
@@ -55,7 +50,6 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
55
50
|
address initialOwner
|
56
51
|
) BaseComponent(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner) {
|
57
52
|
// TODO add validation
|
58
|
-
_productService = _instance.getProductService();
|
59
53
|
_policyService = _instance.getPolicyService();
|
60
54
|
_pool = Pool(pool);
|
61
55
|
_distribution = Distribution(distribution);
|
@@ -76,8 +70,8 @@ abstract contract Product is BaseComponent, IProductComponent {
|
|
76
70
|
RiskId riskId,
|
77
71
|
uint256 lifetime,
|
78
72
|
bytes memory applicationData,
|
79
|
-
|
80
|
-
|
73
|
+
NftId bundleNftId,
|
74
|
+
ReferralId referralId
|
81
75
|
)
|
82
76
|
external
|
83
77
|
view
|
@@ -8,7 +8,6 @@ import {BundleManager} from "./BundleManager.sol";
|
|
8
8
|
import {InstanceReader} from "./InstanceReader.sol";
|
9
9
|
|
10
10
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
11
|
-
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
12
11
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
13
12
|
import {IPoolService} from "./service/IPoolService.sol";
|
14
13
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -26,7 +25,6 @@ import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
|
26
25
|
|
27
26
|
interface IInstance is IERC165, IKeyValueStore, IAccessManaged {
|
28
27
|
|
29
|
-
function getComponentOwnerService() external view returns (IComponentOwnerService);
|
30
28
|
function getDistributionService() external view returns (IDistributionService);
|
31
29
|
function getProductService() external view returns (IProductService);
|
32
30
|
function getPoolService() external view returns (IPoolService);
|
@@ -6,7 +6,6 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
6
6
|
import {BundleManager} from "./BundleManager.sol";
|
7
7
|
import {InstanceReader} from "./InstanceReader.sol";
|
8
8
|
|
9
|
-
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
10
9
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
11
10
|
import {IPoolService} from "./service/IPoolService.sol";
|
12
11
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -20,14 +20,8 @@ import {BundleManager} from "./BundleManager.sol";
|
|
20
20
|
import {NftId} from "../types/NftId.sol";
|
21
21
|
import {NumberId} from "../types/NumberId.sol";
|
22
22
|
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT} from "../types/ObjectType.sol";
|
23
|
-
import {RiskId
|
24
|
-
import {
|
25
|
-
import {StateId, ACTIVE} from "../types/StateId.sol";
|
26
|
-
import {TimestampLib} from "../types/Timestamp.sol";
|
27
|
-
import {ERC165} from "../shared/ERC165.sol";
|
28
|
-
import {Registerable} from "../shared/Registerable.sol";
|
29
|
-
import {ComponentOwnerService} from "./service/ComponentOwnerService.sol";
|
30
|
-
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
23
|
+
import {RiskId} from "../types/RiskId.sol";
|
24
|
+
import {StateId} from "../types/StateId.sol";
|
31
25
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
32
26
|
import {IPoolService} from "./service/IPoolService.sol";
|
33
27
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -227,10 +221,6 @@ contract Instance is
|
|
227
221
|
return policyNftId.toKey32(POLICY());
|
228
222
|
}
|
229
223
|
|
230
|
-
function getComponentOwnerService() external view returns (IComponentOwnerService) {
|
231
|
-
return ComponentOwnerService(_registry.getServiceAddress(COMPONENT(), VersionPart.wrap(3)));
|
232
|
-
}
|
233
|
-
|
234
224
|
function getDistributionService() external view returns (IDistributionService) {
|
235
225
|
return IDistributionService(_registry.getServiceAddress(DISTRIBUTION(), VersionPart.wrap(3)));
|
236
226
|
}
|
@@ -22,8 +22,6 @@ import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
|
22
22
|
import {StateId, ACTIVE} from "../types/StateId.sol";
|
23
23
|
import {ERC165} from "../shared/ERC165.sol";
|
24
24
|
import {Registerable} from "../shared/Registerable.sol";
|
25
|
-
import {ComponentOwnerService} from "./service/ComponentOwnerService.sol";
|
26
|
-
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
27
25
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
28
26
|
import {IPoolService} from "./service/IPoolService.sol";
|
29
27
|
import {IProductService} from "./service/IProductService.sol";
|
@@ -6,7 +6,6 @@ import {StateId} from "../../types/StateId.sol";
|
|
6
6
|
|
7
7
|
import {IKeyValueStore} from "./IKeyValueStore.sol";
|
8
8
|
|
9
|
-
import {IComponentOwnerService} from "../service/IComponentOwnerService.sol";
|
10
9
|
import {IDistributionService} from "../service/IDistributionService.sol";
|
11
10
|
import {IProductService} from "../service/IProductService.sol";
|
12
11
|
import {IPoolService} from "../service/IPoolService.sol";
|
@@ -16,7 +15,6 @@ interface IInstanceBase {
|
|
16
15
|
function updateState(Key32 key, StateId state) external;
|
17
16
|
function getState(Key32 key) external view returns (StateId state);
|
18
17
|
|
19
|
-
function getComponentOwnerService() external view returns(IComponentOwnerService);
|
20
18
|
function getDistributionService() external view returns(IDistributionService);
|
21
19
|
function getProductService() external view returns(IProductService service);
|
22
20
|
function getPoolService() external view returns(IPoolService service);
|
package/package.json
CHANGED