@etherisc/gif-next 0.0.2-dc7e4cb-141 → 0.0.2-e42b0ca-323
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 +5 -14
- 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/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- 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 +42 -193
- 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 +189 -266
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{service → base}/ComponentServiceBase.sol/ComponentServiceBase.json +1 -1
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{IServiceLinked.sol/IServiceLinked.json → base/IInstanceBase.sol/IInstanceBase.json} +15 -2
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +511 -0
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/{module/lifecycle/ILifecycle.sol/ILifecycleModule.json → base/ILifecycle.sol/ILifecycle.json} +10 -77
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/instance/{service → base}/IService.sol/IService.json +1 -1
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{InstanceBase.sol → base/InstanceBase.sol}/InstanceBase.json +14 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +692 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +169 -0
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.json +10 -0
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{service → base}/ServiceBase.sol/ServiceBase.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/BundleModule.sol/BundleModule.json +50 -30
- 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/bundle/IBundle.sol/IBundleModule.json +50 -30
- 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/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/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/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- 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 +34 -2
- 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 +4 -4
- 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/TestRoleId.sol/TestRoleId.json +38 -4
- 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 +4 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +111 -0
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +65 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +30 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/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/components/BaseComponent.sol +0 -1
- package/contracts/instance/IInstance.sol +9 -10
- package/contracts/instance/Instance.sol +9 -7
- package/contracts/instance/{service → base}/ComponentServiceBase.sol +1 -0
- package/contracts/instance/base/IInstanceBase.sol +14 -0
- package/contracts/instance/base/IKeyValueStore.sol +49 -0
- package/contracts/instance/base/ILifecycle.sol +30 -0
- package/contracts/instance/{InstanceBase.sol → base/InstanceBase.sol} +20 -11
- package/contracts/instance/base/KeyValueStore.sol +156 -0
- package/contracts/instance/{module/lifecycle/LifecycleModule.sol → base/Lifecycle.sol} +36 -30
- package/contracts/instance/base/ModuleBase.sol +52 -0
- package/contracts/instance/{service → base}/ServiceBase.sol +0 -2
- package/contracts/instance/module/access/Access.sol +3 -3
- package/contracts/instance/module/bundle/BundleModule.sol +24 -116
- package/contracts/instance/module/bundle/IBundle.sol +8 -3
- package/contracts/instance/module/component/ComponentModule.sol +9 -17
- package/contracts/instance/module/policy/PolicyModule.sol +2 -10
- package/contracts/instance/service/ComponentOwnerService.sol +1 -2
- package/contracts/instance/service/IComponentOwnerService.sol +1 -1
- package/contracts/instance/service/IPoolService.sol +1 -1
- package/contracts/instance/service/IProductService.sol +1 -1
- package/contracts/instance/service/PoolService.sol +1 -1
- package/contracts/instance/service/ProductService.sol +1 -2
- package/contracts/registry/Registry.sol +1 -1
- package/contracts/test/TestRoleId.sol +2 -2
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Key32.sol +45 -0
- package/contracts/types/NftId.sol +16 -1
- package/contracts/types/RoleId.sol +11 -9
- package/contracts/types/StateId.sol +7 -1
- package/package.json +1 -1
- package/artifacts/contracts/instance/IServiceLinked.sol/IServiceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycle.json +0 -134
- package/artifacts/contracts/instance/module/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/lifecycle/LifecycleModule.sol/LifecycleModule.json +0 -221
- package/artifacts/contracts/instance/service/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ServiceBase.sol/ServiceBase.dbg.json +0 -4
- package/contracts/instance/IServiceLinked.sol +0 -12
- package/contracts/instance/module/lifecycle/ILifecycle.sol +0 -47
- /package/contracts/instance/{service → base}/IService.sol +0 -0
@@ -0,0 +1,156 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {Blocknumber, blockBlocknumber, zeroBlocknumber} from "../../types/Blocknumber.sol";
|
5
|
+
import {Key32, KeyId, Key32Lib} from "../../types/Key32.sol";
|
6
|
+
import {NftId} from "../../types/NftId.sol";
|
7
|
+
import {ObjectType} from "../../types/ObjectType.sol";
|
8
|
+
import {StateId, ACTIVE} from "../../types/StateId.sol";
|
9
|
+
import {Timestamp, blockTimestamp, zeroTimestamp} from "../../types/Timestamp.sol";
|
10
|
+
|
11
|
+
import {Lifecycle} from "./Lifecycle.sol";
|
12
|
+
import {IKeyValueStore} from "./IKeyValueStore.sol";
|
13
|
+
|
14
|
+
contract KeyValueStore is Lifecycle, IKeyValueStore {
|
15
|
+
|
16
|
+
mapping(Key32 key32 => Value value) private _value;
|
17
|
+
address private _owner;
|
18
|
+
|
19
|
+
modifier onlyOwner() {
|
20
|
+
require(
|
21
|
+
msg.sender == _owner,
|
22
|
+
"ERROR:KVS-001:NOT_OWNER");
|
23
|
+
_;
|
24
|
+
}
|
25
|
+
|
26
|
+
constructor() {
|
27
|
+
_owner = msg.sender;
|
28
|
+
}
|
29
|
+
|
30
|
+
function create(
|
31
|
+
Key32 key32,
|
32
|
+
ObjectType objectType,
|
33
|
+
bytes memory data
|
34
|
+
)
|
35
|
+
public
|
36
|
+
onlyOwner
|
37
|
+
{
|
38
|
+
require(objectType.gtz(), "ERROR:KVS-010:TYPE_UNDEFINED");
|
39
|
+
|
40
|
+
Metadata storage metadata = _value[key32].metadata;
|
41
|
+
require(metadata.state.eqz(), "ERROR:KVS-012:ALREADY_CREATED");
|
42
|
+
|
43
|
+
address createdBy = msg.sender;
|
44
|
+
Blocknumber blocknumber = blockBlocknumber();
|
45
|
+
StateId initialState = hasLifecycle(objectType) ? getInitialState(objectType) : ACTIVE();
|
46
|
+
|
47
|
+
// set metadata
|
48
|
+
metadata.objectType = objectType;
|
49
|
+
metadata.state = initialState;
|
50
|
+
metadata.updatedBy = createdBy;
|
51
|
+
metadata.updatedIn = blocknumber;
|
52
|
+
metadata.createdIn = blocknumber;
|
53
|
+
|
54
|
+
// set data
|
55
|
+
_value[key32].data = data;
|
56
|
+
|
57
|
+
emit LogInfoCreated(toKey(key32), initialState, createdBy);
|
58
|
+
}
|
59
|
+
|
60
|
+
function update(Key32 key32, StateId state, bytes memory data)
|
61
|
+
public
|
62
|
+
onlyOwner
|
63
|
+
{
|
64
|
+
require(state.gtz(), "ERROR:KVS-020:STATE_UNDEFINED");
|
65
|
+
Metadata storage metadata = _value[key32].metadata;
|
66
|
+
StateId stateOld = metadata.state;
|
67
|
+
require(stateOld.gtz(), "ERROR:KVS-021:NOT_EXISTING");
|
68
|
+
|
69
|
+
// update data
|
70
|
+
_value[key32].data = data;
|
71
|
+
|
72
|
+
// update metadata (and state)
|
73
|
+
address updatedBy = msg.sender;
|
74
|
+
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
75
|
+
metadata.state = state;
|
76
|
+
metadata.updatedBy = updatedBy;
|
77
|
+
metadata.updatedIn = blockBlocknumber();
|
78
|
+
|
79
|
+
// create log entries
|
80
|
+
Key memory key = toKey(key32);
|
81
|
+
emit LogStateUpdated(key, state, stateOld, updatedBy, lastUpdatedIn);
|
82
|
+
emit LogInfoUpdated(key, state, updatedBy, lastUpdatedIn);
|
83
|
+
}
|
84
|
+
|
85
|
+
function updateData(Key32 key32, bytes memory data)
|
86
|
+
public
|
87
|
+
onlyOwner
|
88
|
+
{
|
89
|
+
Metadata storage metadata = _value[key32].metadata;
|
90
|
+
StateId state = metadata.state;
|
91
|
+
require(state.gtz(), "ERROR:KVS-030:NOT_EXISTING");
|
92
|
+
|
93
|
+
// update data
|
94
|
+
_value[key32].data = data;
|
95
|
+
|
96
|
+
// update metadata
|
97
|
+
address updatedBy = msg.sender;
|
98
|
+
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
99
|
+
metadata.updatedBy = updatedBy;
|
100
|
+
metadata.updatedIn = blockBlocknumber();
|
101
|
+
|
102
|
+
// create log entry
|
103
|
+
Key memory key = toKey(key32);
|
104
|
+
emit LogInfoUpdated(key, state, updatedBy, lastUpdatedIn);
|
105
|
+
}
|
106
|
+
|
107
|
+
function updateState(Key32 key32, StateId state)
|
108
|
+
public
|
109
|
+
onlyOwner
|
110
|
+
{
|
111
|
+
require(state.gtz(), "ERROR:KVS-040:STATE_UNDEFINED");
|
112
|
+
Metadata storage metadata = _value[key32].metadata;
|
113
|
+
StateId stateOld = metadata.state;
|
114
|
+
require(stateOld.gtz(), "ERROR:KVS-041:NOT_EXISTING");
|
115
|
+
|
116
|
+
// update metadata (and state)
|
117
|
+
address updatedBy = msg.sender;
|
118
|
+
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
119
|
+
metadata.state = state;
|
120
|
+
metadata.updatedBy = updatedBy;
|
121
|
+
metadata.updatedIn = blockBlocknumber();
|
122
|
+
|
123
|
+
// create log entry
|
124
|
+
Key memory key = toKey(key32);
|
125
|
+
emit LogStateUpdated(key, state, stateOld, updatedBy, lastUpdatedIn);
|
126
|
+
}
|
127
|
+
|
128
|
+
function exists(Key32 key32) public view returns (bool) {
|
129
|
+
return _value[key32].metadata.state.gtz();
|
130
|
+
}
|
131
|
+
|
132
|
+
function get(Key32 key32) public view returns (Value memory value) {
|
133
|
+
return _value[key32];
|
134
|
+
}
|
135
|
+
|
136
|
+
function getMetadata(Key32 key32) public view returns (Metadata memory metadata) {
|
137
|
+
return _value[key32].metadata;
|
138
|
+
}
|
139
|
+
|
140
|
+
function getData(Key32 key32) public view returns (bytes memory data) {
|
141
|
+
return _value[key32].data;
|
142
|
+
}
|
143
|
+
|
144
|
+
function getState(Key32 key32) public view returns (StateId state) {
|
145
|
+
return _value[key32].metadata.state;
|
146
|
+
}
|
147
|
+
|
148
|
+
function toKey32(ObjectType objectType, KeyId id) external pure returns(Key32) {
|
149
|
+
return Key32Lib.toKey32(objectType, id);
|
150
|
+
}
|
151
|
+
|
152
|
+
function toKey(Key32 key32) public pure returns (Key memory key) {
|
153
|
+
(ObjectType objectType, KeyId id) = key32.toKey();
|
154
|
+
return Key(objectType, id);
|
155
|
+
}
|
156
|
+
}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {NftId} from "
|
5
|
-
import {ObjectType, PRODUCT, ORACLE, POOL, BUNDLE, POLICY} from "
|
6
|
-
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, UNDERWRITTEN, REVOKED, DECLINED} from "
|
7
|
-
import {
|
4
|
+
import {NftId} from "../../types/NftId.sol";
|
5
|
+
import {ObjectType, PRODUCT, ORACLE, POOL, BUNDLE, POLICY} from "../../types/ObjectType.sol";
|
6
|
+
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, UNDERWRITTEN, REVOKED, DECLINED} from "../../types/StateId.sol";
|
7
|
+
import {ILifecycle} from "./ILifecycle.sol";
|
8
8
|
|
9
|
-
contract
|
9
|
+
contract Lifecycle is ILifecycle {
|
10
10
|
mapping(ObjectType objectType => StateId initialState)
|
11
11
|
private _initialState;
|
12
12
|
|
@@ -22,38 +22,44 @@ contract LifecycleModule is ILifecycleModule {
|
|
22
22
|
_setupPolicyLifecycle();
|
23
23
|
}
|
24
24
|
|
25
|
-
function
|
26
|
-
|
25
|
+
function hasLifecycle(
|
26
|
+
ObjectType objectType
|
27
|
+
)
|
28
|
+
public
|
29
|
+
view
|
30
|
+
override
|
31
|
+
returns (bool)
|
32
|
+
{
|
33
|
+
return _initialState[objectType].gtz();
|
34
|
+
}
|
35
|
+
|
36
|
+
function getInitialState(
|
37
|
+
ObjectType objectType
|
38
|
+
)
|
39
|
+
public
|
40
|
+
view
|
41
|
+
returns (StateId)
|
42
|
+
{
|
43
|
+
return _initialState[objectType];
|
44
|
+
}
|
45
|
+
|
46
|
+
function checkTransition(
|
27
47
|
ObjectType objectType,
|
28
48
|
StateId fromId,
|
29
49
|
StateId toId
|
30
|
-
)
|
50
|
+
)
|
51
|
+
public
|
52
|
+
view
|
31
53
|
{
|
32
|
-
if
|
33
|
-
|
54
|
+
// return if no life cycle support
|
55
|
+
if (_initialState[objectType].eqz()) {
|
56
|
+
return;
|
34
57
|
}
|
35
58
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
emit LogBundleStateChanged(nftId, fromId, toId);
|
40
|
-
} else if (
|
41
|
-
objectType == PRODUCT() ||
|
42
|
-
objectType == ORACLE() ||
|
43
|
-
objectType == POOL()
|
44
|
-
) {
|
45
|
-
emit LogComponentStateChanged(nftId, objectType, fromId, toId);
|
46
|
-
} else {
|
47
|
-
revert ErrorNoLifecycle(nftId, objectType);
|
59
|
+
// enforce valid state transition
|
60
|
+
if (!_isValidTransition[objectType][fromId][toId]) {
|
61
|
+
revert ErrorInvalidStateTransition(objectType, fromId, toId);
|
48
62
|
}
|
49
|
-
|
50
|
-
return toId;
|
51
|
-
}
|
52
|
-
|
53
|
-
function getInitialState(
|
54
|
-
ObjectType objectType
|
55
|
-
) public view returns (StateId) {
|
56
|
-
return _initialState[objectType];
|
57
63
|
}
|
58
64
|
|
59
65
|
function isValidTransition(
|
@@ -0,0 +1,52 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
|
+
|
6
|
+
import {Blocknumber, blockNumber} from "../../types/Blocknumber.sol";
|
7
|
+
import {Key32, KeyId} from "../../types/Key32.sol";
|
8
|
+
import {LibNftIdSet} from "../../types/NftIdSet.sol";
|
9
|
+
import {NftId} from "../../types/NftId.sol";
|
10
|
+
import {ObjectType, PRODUCT, ORACLE, POOL, BUNDLE, POLICY} from "../../types/ObjectType.sol";
|
11
|
+
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, REVOKED, DECLINED} from "../../types/StateId.sol";
|
12
|
+
import {Timestamp, blockTimestamp, zeroTimestamp} from "../../types/Timestamp.sol";
|
13
|
+
|
14
|
+
import {IKeyValueStore} from "./IKeyValueStore.sol";
|
15
|
+
|
16
|
+
abstract contract ModuleBase {
|
17
|
+
|
18
|
+
IKeyValueStore private _store;
|
19
|
+
ObjectType private _type;
|
20
|
+
|
21
|
+
function _initialize(IKeyValueStore keyValueStore, ObjectType objectType) internal {
|
22
|
+
_store = keyValueStore;
|
23
|
+
_type = objectType;
|
24
|
+
}
|
25
|
+
|
26
|
+
function _create(NftId nftId, bytes memory data) internal {
|
27
|
+
_store.create(
|
28
|
+
_toKey32(nftId),
|
29
|
+
_type,
|
30
|
+
data);
|
31
|
+
}
|
32
|
+
|
33
|
+
function _updateData(NftId nftId, bytes memory data) internal {
|
34
|
+
_store.updateData(_toKey32(nftId), data);
|
35
|
+
}
|
36
|
+
|
37
|
+
function _updateState(NftId nftId, StateId state) internal {
|
38
|
+
_store.updateState(_toKey32(nftId), state);
|
39
|
+
}
|
40
|
+
|
41
|
+
function _getData(NftId nftId) internal view returns(bytes memory data) {
|
42
|
+
return _store.getData(_toKey32(nftId));
|
43
|
+
}
|
44
|
+
|
45
|
+
function _getState(NftId nftId) internal view returns(StateId) {
|
46
|
+
return _store.getState(_toKey32(nftId));
|
47
|
+
}
|
48
|
+
|
49
|
+
function _toKey32(NftId nftId) internal view returns (Key32 key32) {
|
50
|
+
return nftId.toKey32(_type);
|
51
|
+
}
|
52
|
+
}
|
@@ -1,8 +1,6 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
// import {IRegistry} from "../../registry/IRegistry.sol";
|
5
|
-
// import {ITreasury, ITreasuryModule, TokenHandler} from "../../instance/module/treasury/ITreasury.sol";
|
6
4
|
import {NftId, zeroNftId} from "../../types/NftId.sol";
|
7
5
|
import {ObjectType, SERVICE} from "../../types/ObjectType.sol";
|
8
6
|
import {Version, VersionPart} from "../../types/Version.sol";
|
@@ -5,7 +5,7 @@ pragma solidity ^0.8.19;
|
|
5
5
|
// import {AccessControlEnumerable} from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
|
6
6
|
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
7
7
|
|
8
|
-
import {RoleId,
|
8
|
+
import {RoleId, RoleIdLib} from "../../../types/RoleId.sol";
|
9
9
|
import {DISTRIBUTOR_OWNER_ROLE, ORACLE_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE} from "../../../types/RoleId.sol";
|
10
10
|
import {DISTRIBUTOR_OWNER_ROLE_NAME, ORACLE_OWNER_ROLE_NAME, POOL_OWNER_ROLE_NAME, PRODUCT_OWNER_ROLE_NAME} from "../../../types/RoleId.sol";
|
11
11
|
import {IAccessModule} from "./IAccess.sol";
|
@@ -45,7 +45,7 @@ abstract contract AccessModule is IAccessModule {
|
|
45
45
|
function createRole(
|
46
46
|
string memory roleName
|
47
47
|
) public override onlyAccessOwner returns (RoleId role) {
|
48
|
-
role = toRoleId(roleName);
|
48
|
+
role = RoleIdLib.toRoleId(roleName);
|
49
49
|
require(
|
50
50
|
!roleExists(role),
|
51
51
|
"ERROR:ACS-010:ROLE_ALREADY_EXISTS");
|
@@ -95,7 +95,7 @@ abstract contract AccessModule is IAccessModule {
|
|
95
95
|
}
|
96
96
|
|
97
97
|
function getRoleId(string memory roleName) external pure override returns (RoleId role) {
|
98
|
-
return toRoleId(roleName);
|
98
|
+
return RoleIdLib.toRoleId(roleName);
|
99
99
|
}
|
100
100
|
|
101
101
|
function getRoleInfo(
|
@@ -3,32 +3,32 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IRegistry} from "../../../registry/IRegistry.sol";
|
5
5
|
|
6
|
-
import {LifecycleModule} from "../lifecycle/LifecycleModule.sol";
|
7
6
|
import {IProductService} from "../../service/IProductService.sol";
|
8
7
|
import {IPoolService} from "../../service/IPoolService.sol";
|
9
8
|
|
10
9
|
import {NftId} from "../../../types/NftId.sol";
|
10
|
+
import {Key32, KeyId} from "../../../types/Key32.sol";
|
11
11
|
import {LibNftIdSet} from "../../../types/NftIdSet.sol";
|
12
12
|
import {ObjectType, PRODUCT, ORACLE, POOL, BUNDLE, POLICY} from "../../../types/ObjectType.sol";
|
13
13
|
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, REVOKED, DECLINED} from "../../../types/StateId.sol";
|
14
14
|
import {Timestamp, blockTimestamp, zeroTimestamp} from "../../../types/Timestamp.sol";
|
15
15
|
import {Blocknumber, blockNumber} from "../../../types/Blocknumber.sol";
|
16
16
|
|
17
|
-
import {
|
17
|
+
import {IKeyValueStore} from "../../base/IKeyValueStore.sol";
|
18
|
+
import {ModuleBase} from "../../base/ModuleBase.sol";
|
19
|
+
|
18
20
|
import {IBundleModule} from "./IBundle.sol";
|
19
21
|
|
20
|
-
abstract contract BundleModule is
|
22
|
+
abstract contract BundleModule is
|
23
|
+
ModuleBase,
|
21
24
|
IBundleModule
|
22
25
|
{
|
23
26
|
|
24
27
|
using LibNftIdSet for LibNftIdSet.Set;
|
25
28
|
|
26
|
-
mapping(NftId bundleNftId => BundleInfo info) private _bundleInfo;
|
27
29
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) private _collateralizedPolicies;
|
28
30
|
mapping(NftId bundleNftId => mapping(NftId policyNftId => uint256 amount)) private _collateralizationAmount;
|
29
31
|
|
30
|
-
LifecycleModule private _lifecycleModule;
|
31
|
-
|
32
32
|
modifier onlyBundlePoolService() {
|
33
33
|
require(
|
34
34
|
msg.sender == address(this.getPoolService()),
|
@@ -54,8 +54,8 @@ abstract contract BundleModule is
|
|
54
54
|
_;
|
55
55
|
}
|
56
56
|
|
57
|
-
|
58
|
-
|
57
|
+
function initializeBundleModule(IKeyValueStore keyValueStore) internal {
|
58
|
+
_initialize(keyValueStore, BUNDLE());
|
59
59
|
}
|
60
60
|
|
61
61
|
function createBundleInfo(
|
@@ -69,22 +69,18 @@ abstract contract BundleModule is
|
|
69
69
|
onlyBundlePoolService
|
70
70
|
override
|
71
71
|
{
|
72
|
-
|
73
|
-
_bundleInfo[bundleNftId] = BundleInfo(
|
72
|
+
BundleInfo memory bundleInfo = BundleInfo(
|
74
73
|
bundleNftId,
|
75
74
|
poolNftId,
|
76
|
-
_lifecycleModule.getInitialState(BUNDLE()),
|
77
75
|
filter,
|
78
76
|
amount, // capital
|
79
77
|
0, // locked capital
|
80
78
|
amount, // balance
|
81
|
-
blockTimestamp(), // createdAt
|
82
79
|
blockTimestamp().addSeconds(lifetime), // expiredAt
|
83
|
-
zeroTimestamp()
|
84
|
-
blockNumber() // updatedIn
|
80
|
+
zeroTimestamp() // closedAt
|
85
81
|
);
|
86
82
|
|
87
|
-
|
83
|
+
_create(bundleNftId, abi.encode(bundleInfo));
|
88
84
|
}
|
89
85
|
|
90
86
|
function setBundleInfo(BundleInfo memory bundleInfo)
|
@@ -92,78 +88,16 @@ abstract contract BundleModule is
|
|
92
88
|
override
|
93
89
|
onlyPoolOrProductService
|
94
90
|
{
|
95
|
-
|
91
|
+
_updateData(bundleInfo.nftId, abi.encode(bundleInfo));
|
96
92
|
}
|
97
93
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
// {
|
106
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
107
|
-
// info.state = newState;
|
108
|
-
// info.updatedIn = blockNumber();
|
109
|
-
// }
|
110
|
-
|
111
|
-
// function extendBundle(
|
112
|
-
// NftId bundleNftId,
|
113
|
-
// uint256 lifetimeExtension
|
114
|
-
// )
|
115
|
-
// external
|
116
|
-
// onlyBundlePoolService
|
117
|
-
// override
|
118
|
-
// {
|
119
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
120
|
-
// info.expiredAt = info.expiredAt.addSeconds(lifetimeExtension);
|
121
|
-
// info.updatedIn = blockNumber();
|
122
|
-
// }
|
123
|
-
|
124
|
-
// function closeBundle(
|
125
|
-
// NftId bundleNftId
|
126
|
-
// )
|
127
|
-
// external
|
128
|
-
// onlyBundlePoolService
|
129
|
-
// override
|
130
|
-
// {
|
131
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
132
|
-
// info.state = CLOSED();
|
133
|
-
// info.closedAt = blockTimestamp();
|
134
|
-
// info.updatedIn = blockNumber();
|
135
|
-
// }
|
136
|
-
|
137
|
-
// function processStake(
|
138
|
-
// NftId nftId,
|
139
|
-
// uint256 amount
|
140
|
-
// )
|
141
|
-
// external
|
142
|
-
// onlyBundlePoolService
|
143
|
-
// override
|
144
|
-
// {
|
145
|
-
// BundleInfo storage info = _bundleInfo[nftId];
|
146
|
-
// info.capitalAmount += amount;
|
147
|
-
// info.balanceAmount += amount;
|
148
|
-
// info.updatedIn = blockNumber();
|
149
|
-
// }
|
150
|
-
|
151
|
-
// function processUnstake(
|
152
|
-
// NftId nftId,
|
153
|
-
// uint256 amount
|
154
|
-
// )
|
155
|
-
// external
|
156
|
-
// onlyBundlePoolService
|
157
|
-
// override
|
158
|
-
// {
|
159
|
-
// BundleInfo storage info = _bundleInfo[nftId];
|
160
|
-
// // TODO fix book keeping in a way that provides
|
161
|
-
// // continuous infor regarding profitability
|
162
|
-
// // this is needed to properly apply performance fees
|
163
|
-
// info.capitalAmount -= amount;
|
164
|
-
// info.balanceAmount -= amount;
|
165
|
-
// info.updatedIn = blockNumber();
|
166
|
-
// }
|
94
|
+
function updateBundleState(NftId bundleNftId, StateId state)
|
95
|
+
external
|
96
|
+
override
|
97
|
+
onlyBundlePoolService
|
98
|
+
{
|
99
|
+
_updateState(bundleNftId, state);
|
100
|
+
}
|
167
101
|
|
168
102
|
function collateralizePolicy(
|
169
103
|
NftId bundleNftId,
|
@@ -187,42 +121,16 @@ abstract contract BundleModule is
|
|
187
121
|
override
|
188
122
|
returns(uint256 collateralAmount)
|
189
123
|
{
|
190
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
191
|
-
// info.lockedAmount -= collateralAmount;
|
192
|
-
// info.updatedIn = blockNumber();
|
193
|
-
|
194
124
|
collateralAmount = _collateralizationAmount[bundleNftId][policyNftId];
|
195
125
|
delete _collateralizationAmount[bundleNftId][policyNftId];
|
196
126
|
_collateralizedPolicies[bundleNftId].remove(policyNftId);
|
197
127
|
}
|
198
128
|
|
199
|
-
// function addPremium(NftId bundleNftId, uint256 amount)
|
200
|
-
// external
|
201
|
-
// onlyBundleProductService
|
202
|
-
// override
|
203
|
-
// {
|
204
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
205
|
-
// info.capitalAmount += amount;
|
206
|
-
// info.balanceAmount += amount;
|
207
|
-
// info.updatedIn = blockNumber();
|
208
|
-
// }
|
209
|
-
|
210
|
-
// function subtractPayout(NftId bundleNftId, NftId policyNftId, uint256 amount)
|
211
|
-
// external
|
212
|
-
// onlyBundleProductService
|
213
|
-
// override
|
214
|
-
// {
|
215
|
-
// BundleInfo storage info = _bundleInfo[bundleNftId];
|
216
|
-
// info.capitalAmount -= amount;
|
217
|
-
// info.lockedAmount -= amount;
|
218
|
-
// info.balanceAmount -= amount;
|
219
|
-
// info.updatedIn = blockNumber();
|
220
|
-
|
221
|
-
// // deduct amount from sum insured for this policy
|
222
|
-
// _collateralizationAmount[bundleNftId][policyNftId] -= amount;
|
223
|
-
// }
|
224
|
-
|
225
129
|
function getBundleInfo(NftId bundleNftId) external view override returns(BundleInfo memory bundleInfo) {
|
226
|
-
return
|
130
|
+
return abi.decode(_getData(bundleNftId), (BundleInfo));
|
227
131
|
}
|
132
|
+
|
133
|
+
function toBundleKey32(NftId bundleNftId) external view override returns (Key32 key32) {
|
134
|
+
return _toKey32(bundleNftId);
|
135
|
+
}
|
228
136
|
}
|
@@ -3,11 +3,13 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IRegistry} from "../../../registry/IRegistry.sol";
|
5
5
|
import {IInstance} from "../../IInstance.sol";
|
6
|
+
import {Key32} from "../../../types/Key32.sol";
|
6
7
|
import {NftId} from "../../../types/NftId.sol";
|
7
8
|
import {StateId} from "../../../types/StateId.sol";
|
8
9
|
import {Timestamp} from "../../../types/Timestamp.sol";
|
9
10
|
import {Blocknumber} from "../../../types/Blocknumber.sol";
|
10
11
|
|
12
|
+
import {IKeyValueStore} from "../../base/IKeyValueStore.sol";
|
11
13
|
import {IProductService} from "../../service/IProductService.sol";
|
12
14
|
import {IPoolService} from "../../service/IPoolService.sol";
|
13
15
|
|
@@ -16,15 +18,12 @@ interface IBundle {
|
|
16
18
|
struct BundleInfo {
|
17
19
|
NftId nftId;
|
18
20
|
NftId poolNftId;
|
19
|
-
StateId state; // active, paused, closed (expriy only implicit)
|
20
21
|
bytes filter; // required conditions for applications to be considered for collateralization by this bundle
|
21
22
|
uint256 capitalAmount; // net investment capital amount (<= balance)
|
22
23
|
uint256 lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= balance)
|
23
24
|
uint256 balanceAmount; // total amount of funds: net investment capital + net premiums - payouts
|
24
|
-
Timestamp createdAt;
|
25
25
|
Timestamp expiredAt; // no new policies
|
26
26
|
Timestamp closedAt;
|
27
|
-
Blocknumber updatedIn;
|
28
27
|
}
|
29
28
|
}
|
30
29
|
|
@@ -39,14 +38,20 @@ interface IBundleModule is IBundle {
|
|
39
38
|
) external;
|
40
39
|
|
41
40
|
function setBundleInfo(BundleInfo memory bundleInfo) external;
|
41
|
+
function updateBundleState(NftId bundleNftId, StateId state) external;
|
42
|
+
|
42
43
|
function collateralizePolicy(NftId bundleNftId, NftId policyNftId, uint256 amount) external;
|
43
44
|
function releasePolicy(NftId bundleNftId, NftId policyNftId) external returns(uint256 collateralAmount);
|
44
45
|
|
45
46
|
function getBundleInfo(NftId bundleNftId) external view returns(BundleInfo memory bundleInfo);
|
47
|
+
function toBundleKey32(NftId bundleNftId) external view returns (Key32 key32);
|
46
48
|
|
47
49
|
// repeat registry linked signature
|
48
50
|
function getRegistry() external view returns (IRegistry registry);
|
49
51
|
|
52
|
+
// repeat instance base signature
|
53
|
+
function getKeyValueStore() external view returns (IKeyValueStore keyValueStore);
|
54
|
+
|
50
55
|
// repeat service linked signatures to avoid linearization issues
|
51
56
|
function getProductService() external returns(IProductService);
|
52
57
|
function getPoolService() external returns(IPoolService);
|
@@ -6,7 +6,6 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
|
|
6
6
|
import {IRegistry} from "../../../registry/IRegistry.sol";
|
7
7
|
import {IInstance} from "../../IInstance.sol";
|
8
8
|
|
9
|
-
import {LifecycleModule} from "../lifecycle/LifecycleModule.sol";
|
10
9
|
import {IComponent, IComponentModule} from "./IComponent.sol";
|
11
10
|
import {IComponentOwnerService} from "../../service/IComponentOwnerService.sol";
|
12
11
|
import {ObjectType, PRODUCT, ORACLE, POOL} from "../../../types/ObjectType.sol";
|
@@ -24,9 +23,6 @@ abstract contract ComponentModule is
|
|
24
23
|
|
25
24
|
mapping(ObjectType cType => bytes32 role) private _componentOwnerRole;
|
26
25
|
|
27
|
-
// TODO maybe move this to Instance contract as internal variable?
|
28
|
-
LifecycleModule private _lifecycleModule;
|
29
|
-
|
30
26
|
modifier onlyComponentOwnerService() {
|
31
27
|
require(
|
32
28
|
msg.sender == address(this.getComponentOwnerService()),
|
@@ -35,11 +31,6 @@ abstract contract ComponentModule is
|
|
35
31
|
_;
|
36
32
|
}
|
37
33
|
|
38
|
-
constructor() {
|
39
|
-
address componentAddress = address(this);
|
40
|
-
_lifecycleModule = LifecycleModule(componentAddress);
|
41
|
-
}
|
42
|
-
|
43
34
|
function registerComponent(
|
44
35
|
NftId nftId,
|
45
36
|
ObjectType objectType,
|
@@ -49,7 +40,8 @@ abstract contract ComponentModule is
|
|
49
40
|
// create component info
|
50
41
|
_componentInfo[nftId] = ComponentInfo(
|
51
42
|
nftId,
|
52
|
-
_lifecycleModule.getInitialState(objectType),
|
43
|
+
// _lifecycleModule.getInitialState(objectType),
|
44
|
+
ACTIVE(),
|
53
45
|
token
|
54
46
|
);
|
55
47
|
|
@@ -70,13 +62,13 @@ abstract contract ComponentModule is
|
|
70
62
|
// TODO decide if state changes should have explicit functions and not
|
71
63
|
// just a generic setXYZInfo and implicit state transitions
|
72
64
|
// when in doubt go for the explicit approach ...
|
73
|
-
ObjectType objectType = this.getRegistry().getObjectInfo(nftId).objectType;
|
74
|
-
_lifecycleModule.checkAndLogTransition(
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
);
|
65
|
+
// ObjectType objectType = this.getRegistry().getObjectInfo(nftId).objectType;
|
66
|
+
// _lifecycleModule.checkAndLogTransition(
|
67
|
+
// nftId,
|
68
|
+
// objectType,
|
69
|
+
// _componentInfo[nftId].state,
|
70
|
+
// info.state
|
71
|
+
// );
|
80
72
|
_componentInfo[nftId] = info;
|
81
73
|
}
|
82
74
|
|