@etherisc/gif-next 0.0.2-c8acbd3-764 → 0.0.2-ce2fc91-485
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 +25 -0
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.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/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +2 -2
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +2 -2
- 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/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +69 -19
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +121 -87
- 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/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.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/base/ModuleBase.sol/ModuleBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.dbg.json +1 -1
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +65 -12
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.json +64 -11
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +12 -2
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +12 -2
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +14 -30
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.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/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.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/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.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/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.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/TestPool.sol/TestPool.dbg.json +1 -1
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +2 -2
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +2 -2
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +2 -2
- 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/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/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- 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/UFixedMathLib.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/instance/IInstance.sol +1 -1
- package/contracts/instance/Instance.sol +1 -1
- package/contracts/instance/module/component/ComponentModule.sol +53 -44
- package/contracts/instance/module/component/IComponent.sol +17 -7
- package/contracts/instance/module/policy/IPolicy.sol +2 -1
- package/contracts/instance/module/policy/PolicyModule.sol +2 -1
- package/contracts/instance/service/ComponentOwnerService.sol +22 -16
- package/contracts/instance/service/ProductService.sol +1 -1
- package/contracts/registry/Registry.sol +2 -2
- package/contracts/types/ObjectType.sol +8 -4
- package/package.json +1 -1
@@ -44,7 +44,7 @@ interface IInstance is
|
|
44
44
|
|
45
45
|
function hasRole(RoleId role, address member) external view override (IAccessModule, IComponentModule) returns (bool hasRole);
|
46
46
|
|
47
|
-
function getKeyValueStore() external view override (IBundleModule, IInstanceBase) returns (IKeyValueStore keyValueStore);
|
47
|
+
function getKeyValueStore() external view override (IBundleModule, IComponentModule, IInstanceBase) returns (IKeyValueStore keyValueStore);
|
48
48
|
function getComponentOwnerService() external view override (IInstanceBase, IComponentModule) returns(IComponentOwnerService);
|
49
49
|
function getProductService() external view override (IInstanceBase, IBundleModule, IPolicyModule) returns(IProductService);
|
50
50
|
function getPoolService() external view override (IInstanceBase, IBundleModule, IPoolModule) returns(IPoolService);
|
@@ -56,7 +56,7 @@ contract Instance is
|
|
56
56
|
}
|
57
57
|
|
58
58
|
function getRegistry() public view override (Registerable, IBundleModule, IComponentModule, IPolicyModule) returns (IRegistry registry) { return super.getRegistry(); }
|
59
|
-
function getKeyValueStore() public view override (InstanceBase, IBundleModule) returns (IKeyValueStore keyValueStore) { return super.getKeyValueStore(); }
|
59
|
+
function getKeyValueStore() public view override (InstanceBase, IComponentModule, IBundleModule) returns (IKeyValueStore keyValueStore) { return super.getKeyValueStore(); }
|
60
60
|
|
61
61
|
function hasRole(RoleId role, address member) public view override (AccessModule, IComponentModule) returns (bool) { return super.hasRole(role, member); }
|
62
62
|
|
@@ -4,25 +4,30 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
6
|
import {IRegistry} from "../../../registry/IRegistry.sol";
|
7
|
-
import {IInstance} from "../../IInstance.sol";
|
8
7
|
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {ObjectType, PRODUCT, ORACLE, POOL} from "../../../types/ObjectType.sol";
|
12
|
-
import {StateId, ACTIVE, PAUSED} from "../../../types/StateId.sol";
|
13
|
-
import {NftId, NftIdLib, zeroNftId} from "../../../types/NftId.sol";
|
14
|
-
import {Fee} from "../../../types/Fee.sol";
|
8
|
+
import {IProductService} from "../../service/IProductService.sol";
|
9
|
+
import {IPoolService} from "../../service/IPoolService.sol";
|
15
10
|
|
16
|
-
|
11
|
+
import {NftId} from "../../../types/NftId.sol";
|
12
|
+
import {Key32, KeyId} from "../../../types/Key32.sol";
|
13
|
+
import {LibNftIdSet} from "../../../types/NftIdSet.sol";
|
14
|
+
import {ObjectType, COMPONENT, PRODUCT, ORACLE, POOL, BUNDLE, POLICY} from "../../../types/ObjectType.sol";
|
15
|
+
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, REVOKED, DECLINED} from "../../../types/StateId.sol";
|
16
|
+
import {Timestamp, blockTimestamp, zeroTimestamp} from "../../../types/Timestamp.sol";
|
17
|
+
import {Blocknumber, blockNumber} from "../../../types/Blocknumber.sol";
|
18
|
+
|
19
|
+
import {IKeyValueStore} from "../../base/IKeyValueStore.sol";
|
20
|
+
import {ModuleBase} from "../../base/ModuleBase.sol";
|
21
|
+
|
22
|
+
import {IComponentModule} from "./IComponent.sol";
|
23
|
+
|
24
|
+
abstract contract ComponentModule is
|
25
|
+
ModuleBase,
|
17
26
|
IComponentModule
|
18
27
|
{
|
19
|
-
using NftIdLib for NftId;
|
20
28
|
|
21
|
-
mapping(NftId nftId => ComponentInfo info) private _componentInfo;
|
22
29
|
NftId[] private _nftIds;
|
23
30
|
|
24
|
-
mapping(ObjectType cType => bytes32 role) private _componentOwnerRole;
|
25
|
-
|
26
31
|
modifier onlyComponentOwnerService() {
|
27
32
|
require(
|
28
33
|
msg.sender == address(this.getComponentOwnerService()),
|
@@ -31,45 +36,43 @@ abstract contract ComponentModule is
|
|
31
36
|
_;
|
32
37
|
}
|
33
38
|
|
39
|
+
function initializeComponentModule(IKeyValueStore keyValueStore) internal {
|
40
|
+
_initialize(keyValueStore, COMPONENT());
|
41
|
+
}
|
42
|
+
|
34
43
|
function registerComponent(
|
35
44
|
NftId nftId,
|
36
|
-
ObjectType objectType,
|
45
|
+
ObjectType, // objectType,
|
37
46
|
IERC20Metadata token
|
38
|
-
)
|
39
|
-
|
40
|
-
|
41
|
-
|
47
|
+
)
|
48
|
+
external
|
49
|
+
onlyComponentOwnerService
|
50
|
+
override
|
51
|
+
{
|
52
|
+
ComponentInfo memory info = ComponentInfo(
|
42
53
|
nftId,
|
43
|
-
// _lifecycleModule.getInitialState(objectType),
|
44
|
-
ACTIVE(),
|
45
54
|
token
|
46
55
|
);
|
47
56
|
|
48
57
|
_nftIds.push(nftId);
|
49
58
|
|
50
|
-
|
59
|
+
_create(nftId, abi.encode(info));
|
51
60
|
}
|
52
61
|
|
53
|
-
function setComponentInfo(
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
);
|
62
|
+
function setComponentInfo(ComponentInfo memory info)
|
63
|
+
external
|
64
|
+
override
|
65
|
+
onlyComponentOwnerService
|
66
|
+
{
|
67
|
+
_updateData(info.nftId, abi.encode(info));
|
68
|
+
}
|
61
69
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
// objectType,
|
69
|
-
// _componentInfo[nftId].state,
|
70
|
-
// info.state
|
71
|
-
// );
|
72
|
-
_componentInfo[nftId] = info;
|
70
|
+
function updateComponentState(NftId nftId, StateId state)
|
71
|
+
external
|
72
|
+
override
|
73
|
+
onlyComponentOwnerService
|
74
|
+
{
|
75
|
+
_updateState(nftId, state);
|
73
76
|
}
|
74
77
|
|
75
78
|
function getComponentCount()
|
@@ -87,9 +90,15 @@ abstract contract ComponentModule is
|
|
87
90
|
return _nftIds[idx];
|
88
91
|
}
|
89
92
|
|
90
|
-
function getComponentInfo(
|
91
|
-
|
92
|
-
) external view override returns (ComponentInfo memory) {
|
93
|
-
return _componentInfo[nftId];
|
93
|
+
function getComponentInfo(NftId nftId) external view override returns(ComponentInfo memory info) {
|
94
|
+
return abi.decode(_getData(nftId), (ComponentInfo));
|
94
95
|
}
|
95
|
-
|
96
|
+
|
97
|
+
function getComponentState(NftId nftId) external view returns (StateId state) {
|
98
|
+
return _getState(nftId);
|
99
|
+
}
|
100
|
+
|
101
|
+
function toComponentKey32(NftId nftId) external view override returns (Key32 key32) {
|
102
|
+
return _toKey32(nftId);
|
103
|
+
}
|
104
|
+
}
|
@@ -7,26 +7,24 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
|
|
7
7
|
import {IRegistry} from "../../../registry/IRegistry.sol";
|
8
8
|
import {IInstance} from "../../IInstance.sol";
|
9
9
|
import {StateId} from "../../../types/StateId.sol";
|
10
|
+
import {Key32} from "../../../types/Key32.sol";
|
10
11
|
import {NftId} from "../../../types/NftId.sol";
|
11
12
|
import {ObjectType} from "../../../types/ObjectType.sol";
|
12
13
|
import {RoleId} from "../../../types/RoleId.sol";
|
13
14
|
import {Fee} from "../../../types/Fee.sol";
|
14
15
|
import {UFixed} from "../../../types/UFixed.sol";
|
15
16
|
|
17
|
+
import {IKeyValueStore} from "../../base/IKeyValueStore.sol";
|
16
18
|
import {IComponentOwnerService} from "../../service/IComponentOwnerService.sol";
|
17
|
-
// import {IComponentBase} from "../../../components/IComponentBase.sol";
|
18
19
|
|
19
20
|
interface IComponent {
|
20
|
-
// component dynamic info (static info kept in registry)
|
21
21
|
struct ComponentInfo {
|
22
22
|
NftId nftId;
|
23
|
-
StateId state;
|
24
23
|
IERC20Metadata token;
|
25
24
|
}
|
26
25
|
}
|
27
26
|
|
28
27
|
interface IComponentModule is IComponent {
|
29
|
-
function getRegistry() external view returns (IRegistry registry);
|
30
28
|
|
31
29
|
function registerComponent(
|
32
30
|
NftId nftId,
|
@@ -36,18 +34,30 @@ interface IComponentModule is IComponent {
|
|
36
34
|
|
37
35
|
function setComponentInfo(
|
38
36
|
ComponentInfo memory info
|
39
|
-
) external
|
37
|
+
) external;
|
38
|
+
|
39
|
+
function updateComponentState(NftId nftId, StateId state) external;
|
40
40
|
|
41
41
|
function getComponentInfo(
|
42
42
|
NftId nftId
|
43
43
|
) external view returns (ComponentInfo memory info);
|
44
44
|
|
45
|
+
function getComponentState(NftId nftId) external view returns (StateId state);
|
46
|
+
|
45
47
|
function getComponentCount() external view returns (uint256 numberOfCompnents);
|
46
48
|
|
47
49
|
function getComponentId(uint256 idx) external view returns (NftId nftId);
|
48
50
|
|
51
|
+
function hasRole(RoleId role, address member) external view returns (bool);
|
52
|
+
|
53
|
+
function toComponentKey32(NftId nftId) external view returns (Key32 key32);
|
54
|
+
|
55
|
+
// repeat registry linked signature
|
56
|
+
function getRegistry() external view returns (IRegistry registry);
|
57
|
+
|
58
|
+
// repeat instance base signature
|
59
|
+
function getKeyValueStore() external view returns (IKeyValueStore keyValueStore);
|
60
|
+
|
49
61
|
// repeat service linked signaturea to avoid linearization issues
|
50
62
|
function getComponentOwnerService() external view returns(IComponentOwnerService);
|
51
|
-
|
52
|
-
function hasRole(RoleId role, address member) external view returns (bool);
|
53
63
|
}
|
@@ -21,7 +21,8 @@ interface IPolicy {
|
|
21
21
|
uint256 premiumAmount;
|
22
22
|
uint256 premiumPaidAmount;
|
23
23
|
uint256 lifetime;
|
24
|
-
bytes
|
24
|
+
bytes applicationData;
|
25
|
+
bytes policyData;
|
25
26
|
Timestamp createdAt;
|
26
27
|
Timestamp activatedAt; // time of underwriting
|
27
28
|
Timestamp expiredAt; // no new claims (activatedAt + lifetime)
|
@@ -48,7 +48,8 @@ abstract contract PolicyModule is IPolicyModule {
|
|
48
48
|
premiumAmount,
|
49
49
|
0, // premium paid amount
|
50
50
|
lifetime,
|
51
|
-
"", //
|
51
|
+
"", // applicationData
|
52
|
+
"", // policyData
|
52
53
|
blockTimestamp(), // createdAt
|
53
54
|
zeroTimestamp(), // activatedAt
|
54
55
|
zeroTimestamp(), // expiredAt
|
@@ -143,28 +143,34 @@ contract ComponentOwnerService is
|
|
143
143
|
function lock(
|
144
144
|
IBaseComponent component
|
145
145
|
) external override onlyRegisteredComponent(component) {
|
146
|
+
// TODO use msg.sender to get component and get instance via registered parent nft id
|
146
147
|
IInstance instance = component.getInstance();
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
info.
|
153
|
-
|
154
|
-
|
148
|
+
instance.updateComponentState(component.getNftId(), PAUSED());
|
149
|
+
// IInstance instance = component.getInstance();
|
150
|
+
// IComponent.ComponentInfo memory info = instance.getComponentInfo(
|
151
|
+
// component.getNftId()
|
152
|
+
// );
|
153
|
+
// require(info.nftId.gtz(), "ERROR_COMPONENT_UNKNOWN");
|
154
|
+
|
155
|
+
// info.state = PAUSED();
|
156
|
+
// // setComponentInfo checks for valid state changes
|
157
|
+
// instance.setComponentInfo(info);
|
155
158
|
}
|
156
159
|
|
157
160
|
function unlock(
|
158
161
|
IBaseComponent component
|
159
162
|
) external override onlyRegisteredComponent(component) {
|
163
|
+
// TODO use msg.sender to get component and get instance via registered parent nft id
|
160
164
|
IInstance instance = component.getInstance();
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
info.
|
167
|
-
|
168
|
-
|
165
|
+
instance.updateComponentState(component.getNftId(), ACTIVE());
|
166
|
+
// IInstance instance = component.getInstance();
|
167
|
+
// IComponent.ComponentInfo memory info = instance.getComponentInfo(
|
168
|
+
// component.getNftId()
|
169
|
+
// );
|
170
|
+
// require(info.nftId.gtz(), "ERROR_COMPONENT_UNKNOWN");
|
171
|
+
|
172
|
+
// info.state = ACTIVE();
|
173
|
+
// // setComponentInfo checks for valid state changes
|
174
|
+
// instance.setComponentInfo(info);
|
169
175
|
}
|
170
176
|
}
|
@@ -150,7 +150,7 @@ contract ProductService is ComponentServiceBase, IProductService {
|
|
150
150
|
IPoolComponent pool = IPoolComponent(poolAddress);
|
151
151
|
pool.underwrite(
|
152
152
|
policyInfo.nftId,
|
153
|
-
policyInfo.
|
153
|
+
policyInfo.applicationData,
|
154
154
|
bundleFilter,
|
155
155
|
collateralAmount);
|
156
156
|
}
|
@@ -9,7 +9,7 @@ import {ChainNft} from "./ChainNft.sol";
|
|
9
9
|
import {IRegistry} from "./IRegistry.sol";
|
10
10
|
import {NftId, toNftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
11
11
|
import {VersionPart} from "../types/Version.sol";
|
12
|
-
import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT,
|
12
|
+
import {ObjectType, PROTOCOL, REGISTRY, TOKEN, SERVICE, INSTANCE, STAKE, PRODUCT, COMPENSATION, ORACLE, POOL, POLICY, BUNDLE} from "../types/ObjectType.sol";
|
13
13
|
|
14
14
|
// TODO make registry upgradable
|
15
15
|
contract Registry is
|
@@ -293,7 +293,7 @@ contract Registry is
|
|
293
293
|
|
294
294
|
// instance as parent
|
295
295
|
_isValidParentType[PRODUCT()][INSTANCE()] = true;
|
296
|
-
_isValidParentType[
|
296
|
+
_isValidParentType[COMPENSATION()][INSTANCE()] = true;
|
297
297
|
_isValidParentType[ORACLE()][INSTANCE()] = true;
|
298
298
|
_isValidParentType[POOL()][INSTANCE()] = true;
|
299
299
|
|
@@ -37,22 +37,26 @@ function STAKE() pure returns (ObjectType) {
|
|
37
37
|
return toObjectType(60);
|
38
38
|
}
|
39
39
|
|
40
|
-
function
|
40
|
+
function COMPONENT() pure returns (ObjectType) {
|
41
41
|
return toObjectType(100);
|
42
42
|
}
|
43
43
|
|
44
|
-
function
|
44
|
+
function PRODUCT() pure returns (ObjectType) {
|
45
45
|
return toObjectType(110);
|
46
46
|
}
|
47
47
|
|
48
|
-
function
|
48
|
+
function COMPENSATION() pure returns (ObjectType) {
|
49
49
|
return toObjectType(120);
|
50
50
|
}
|
51
51
|
|
52
|
-
function
|
52
|
+
function ORACLE() pure returns (ObjectType) {
|
53
53
|
return toObjectType(130);
|
54
54
|
}
|
55
55
|
|
56
|
+
function POOL() pure returns (ObjectType) {
|
57
|
+
return toObjectType(140);
|
58
|
+
}
|
59
|
+
|
56
60
|
function POLICY() pure returns (ObjectType) {
|
57
61
|
return toObjectType(200);
|
58
62
|
}
|
package/package.json
CHANGED