@etherisc/gif-next 0.0.2-eb98db7-932 → 0.0.2-ebf1a6b-485
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +10 -89
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +67 -134
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +7 -73
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +46 -117
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +238 -96
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +11 -145
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +241 -112
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +15 -162
- 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 +84 -146
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +11 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +149 -211
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +2 -2
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +79 -110
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +44 -33
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +17 -17
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +12 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +2 -2
- 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/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +172 -62
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +33 -25
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +34 -23
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +9 -9
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +14 -3
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +2 -2
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +535 -69
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +96 -32
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +121 -27
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +17 -6
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +11 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +344 -6
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +11 -64
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +11 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +11 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +48 -157
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +19 -47
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +22 -11
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +6 -6
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +14 -3
- 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/IRegistryService.sol/IRegistryService.json +11 -0
- 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 +24 -13
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +7 -7
- 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/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +11 -0
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +3 -3
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +12 -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/TestRegisterable.sol/TestRegisterable.json +3 -3
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +2 -2
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +14 -3
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/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/ClaimId.sol/ClaimIdLib.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/PayoutId.sol/PayoutIdLib.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/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +25 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +68 -88
- package/contracts/components/Distribution.sol +12 -6
- package/contracts/components/IComponent.sol +31 -17
- package/contracts/components/IDistributionComponent.sol +1 -14
- package/contracts/components/IPoolComponent.sol +89 -25
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +216 -92
- package/contracts/components/Product.sol +24 -20
- package/contracts/instance/BundleManager.sol +1 -1
- package/contracts/instance/InstanceService.sol +15 -1
- package/contracts/instance/module/IBundle.sol +2 -1
- package/contracts/instance/module/IDistribution.sol +2 -1
- package/contracts/instance/module/IPolicy.sol +26 -1
- package/contracts/instance/module/ISetup.sol +5 -7
- package/contracts/instance/service/ApplicationService.sol +121 -40
- package/contracts/instance/service/BundleService.sol +4 -3
- package/contracts/instance/service/DistributionService.sol +91 -43
- package/contracts/instance/service/IApplicationService.sol +7 -7
- package/contracts/instance/service/IBundleService.sol +3 -2
- package/contracts/instance/service/IDistributionService.sol +15 -2
- package/contracts/instance/service/IPolicyService.sol +1 -20
- package/contracts/instance/service/PolicyService.sol +31 -105
- package/contracts/registry/RegistryService.sol +5 -5
- package/contracts/shared/IService.sol +2 -0
- package/contracts/shared/Registerable.sol +2 -2
- package/contracts/types/RoleId.sol +7 -2
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/Timestamp.sol +12 -13
- package/package.json +1 -1
@@ -11,9 +11,9 @@
|
|
11
11
|
"type": "uint40"
|
12
12
|
},
|
13
13
|
{
|
14
|
-
"internalType": "
|
15
|
-
"name": "
|
16
|
-
"type": "
|
14
|
+
"internalType": "Seconds",
|
15
|
+
"name": "duration",
|
16
|
+
"type": "uint40"
|
17
17
|
}
|
18
18
|
],
|
19
19
|
"name": "addSeconds",
|
@@ -242,8 +242,26 @@
|
|
242
242
|
"type": "function"
|
243
243
|
}
|
244
244
|
],
|
245
|
-
"bytecode": "
|
246
|
-
"deployedBytecode": "
|
247
|
-
"linkReferences": {
|
248
|
-
|
245
|
+
"bytecode": "0x6103bf61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100b35760003560e01c8063a5798b4e1161007b578063a5798b4e14610139578063adb6183214610162578063add9ce9914610168578063c24922ce1461017b578063da09d4841461018e578063ddf3d631146101b457600080fd5b8063790a38ad146100b857806383ffcdef146100e65780638d38cd4b146100f957806394335b1a146101135780639df8763914610126575b600080fd5b6100d16100c63660046102f2565b64ffffffffff161590565b60405190151581526020015b60405180910390f35b6100d16100f4366004610316565b6101c7565b6100d16101073660046102f2565b64ffffffffff16151590565b6100d1610121366004610316565b6101e0565b6100d1610134366004610316565b6101f5565b61014c610147366004610316565b610209565b60405164ffffffffff90911681526020016100dd565b4261014c565b6100d1610176366004610316565b61029e565b6100d1610189366004610316565b6102b2565b6101a661019c3660046102f2565b64ffffffffff1690565b6040519081526020016100dd565b6100d16101c2366004610316565b6102c7565b600064ffffffffff808316908416115b90505b92915050565b600064ffffffffff80831690841611156101d7565b600064ffffffffff808416908316146101d7565b604051633682752160e21b815264ffffffffff821660048201526000906101d79073__$a3c3b8d16d3b00e17e1b34e034b17e7fd4$__9063da09d48490602401602060405180830381865af4158015610266573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028a919061034f565b61029b9064ffffffffff8616610368565b90565b600064ffffffffff808316908416106101d7565b600064ffffffffff80831690841610156101d7565b600064ffffffffff80841690831614156101d7565b64ffffffffff811681146102ef57600080fd5b50565b60006020828403121561030457600080fd5b813561030f816102dc565b9392505050565b6000806040838503121561032957600080fd5b8235610334816102dc565b91506020830135610344816102dc565b809150509250929050565b60006020828403121561036157600080fd5b5051919050565b808201808211156101da57634e487b7160e01b600052601160045260246000fdfea26469706673582212209d275f5b6b2c0e4f549c3e731b1e4ec56eb4b1ed245f433dab8ae6d5e7013a1564736f6c63430008140033",
|
246
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100b35760003560e01c8063a5798b4e1161007b578063a5798b4e14610139578063adb6183214610162578063add9ce9914610168578063c24922ce1461017b578063da09d4841461018e578063ddf3d631146101b457600080fd5b8063790a38ad146100b857806383ffcdef146100e65780638d38cd4b146100f957806394335b1a146101135780639df8763914610126575b600080fd5b6100d16100c63660046102f2565b64ffffffffff161590565b60405190151581526020015b60405180910390f35b6100d16100f4366004610316565b6101c7565b6100d16101073660046102f2565b64ffffffffff16151590565b6100d1610121366004610316565b6101e0565b6100d1610134366004610316565b6101f5565b61014c610147366004610316565b610209565b60405164ffffffffff90911681526020016100dd565b4261014c565b6100d1610176366004610316565b61029e565b6100d1610189366004610316565b6102b2565b6101a661019c3660046102f2565b64ffffffffff1690565b6040519081526020016100dd565b6100d16101c2366004610316565b6102c7565b600064ffffffffff808316908416115b90505b92915050565b600064ffffffffff80831690841611156101d7565b600064ffffffffff808416908316146101d7565b604051633682752160e21b815264ffffffffff821660048201526000906101d79073__$a3c3b8d16d3b00e17e1b34e034b17e7fd4$__9063da09d48490602401602060405180830381865af4158015610266573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028a919061034f565b61029b9064ffffffffff8616610368565b90565b600064ffffffffff808316908416106101d7565b600064ffffffffff80831690841610156101d7565b600064ffffffffff80841690831614156101d7565b64ffffffffff811681146102ef57600080fd5b50565b60006020828403121561030457600080fd5b813561030f816102dc565b9392505050565b6000806040838503121561032957600080fd5b8235610334816102dc565b91506020830135610344816102dc565b809150509250929050565b60006020828403121561036157600080fd5b5051919050565b808201808211156101da57634e487b7160e01b600052601160045260246000fdfea26469706673582212209d275f5b6b2c0e4f549c3e731b1e4ec56eb4b1ed245f433dab8ae6d5e7013a1564736f6c63430008140033",
|
247
|
+
"linkReferences": {
|
248
|
+
"contracts/types/Seconds.sol": {
|
249
|
+
"SecondsLib": [
|
250
|
+
{
|
251
|
+
"length": 20,
|
252
|
+
"start": 614
|
253
|
+
}
|
254
|
+
]
|
255
|
+
}
|
256
|
+
},
|
257
|
+
"deployedLinkReferences": {
|
258
|
+
"contracts/types/Seconds.sol": {
|
259
|
+
"SecondsLib": [
|
260
|
+
{
|
261
|
+
"length": 20,
|
262
|
+
"start": 556
|
263
|
+
}
|
264
|
+
]
|
265
|
+
}
|
266
|
+
}
|
249
267
|
}
|
@@ -29,40 +29,21 @@ abstract contract Component is
|
|
29
29
|
AccessManagedUpgradeable
|
30
30
|
{
|
31
31
|
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Component.sol")) - 1)) & ~bytes32(uint256(0xff));
|
32
|
-
bytes32 public constant
|
32
|
+
bytes32 public constant COMPONENT_LOCATION_V1 = 0xffe8d4462baed26a47154f4b8f6db497d2f772496965791d25bd456e342b7f00;
|
33
33
|
|
34
34
|
struct ComponentStorage {
|
35
|
-
IInstance _instance; // instance for this component
|
36
|
-
InstanceReader _instanceReader; // instance reader for this component
|
37
35
|
string _name; // unique (per instance) component name
|
38
36
|
IERC20Metadata _token; // token for this component
|
37
|
+
IInstance _instance; // instance for this component
|
39
38
|
address _wallet; // wallet for this component (default = component contract itself)
|
39
|
+
InstanceReader _instanceReader; // instance reader for this component
|
40
40
|
bool _isNftInterceptor; // declares if component is involved in nft transfers
|
41
|
-
IInstanceService _instanceService; // instance service for this component
|
42
|
-
|
43
41
|
NftId _productNftId; // only relevant for components that are linked to a aproduct
|
44
|
-
IProductService _productService; // product service for component, might not be relevant for some component types (eg oracles)
|
45
|
-
}
|
46
|
-
|
47
|
-
|
48
|
-
modifier onlyChainNft() {
|
49
|
-
if(msg.sender != getRegistry().getChainNftAddress()) {
|
50
|
-
revert ErrorComponentNotChainNft(msg.sender);
|
51
|
-
}
|
52
|
-
_;
|
53
|
-
}
|
54
|
-
|
55
|
-
|
56
|
-
modifier onlyProductService() {
|
57
|
-
if(msg.sender != address(_getComponentStorage()._productService)) {
|
58
|
-
revert ErrorComponentNotProductService(msg.sender);
|
59
|
-
}
|
60
|
-
_;
|
61
42
|
}
|
62
43
|
|
63
44
|
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
64
45
|
assembly {
|
65
|
-
$.slot :=
|
46
|
+
$.slot := COMPONENT_LOCATION_V1
|
66
47
|
}
|
67
48
|
}
|
68
49
|
|
@@ -74,77 +55,44 @@ abstract contract Component is
|
|
74
55
|
ObjectType componentType,
|
75
56
|
bool isInterceptor,
|
76
57
|
address initialOwner,
|
77
|
-
bytes memory data
|
58
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
78
59
|
)
|
79
60
|
public
|
80
61
|
virtual
|
81
62
|
onlyInitializing()
|
82
63
|
{
|
83
|
-
|
84
|
-
initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
|
85
|
-
|
86
|
-
// set unique name of component
|
87
|
-
$._name = name;
|
88
|
-
$._isNftInterceptor = isInterceptor;
|
64
|
+
initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, registryData);
|
89
65
|
|
90
66
|
// set and check linked instance
|
91
|
-
|
92
|
-
$._instance = IInstance(
|
67
|
+
ComponentStorage storage $ = _getComponentStorage();
|
68
|
+
$._instance = IInstance(
|
69
|
+
getRegistry().getObjectInfo(instanceNftId).objectAddress);
|
70
|
+
|
93
71
|
if(!$._instance.supportsInterface(type(IInstance).interfaceId)) {
|
94
|
-
revert ErrorComponentNotInstance(instanceNftId
|
72
|
+
revert ErrorComponentNotInstance(instanceNftId);
|
95
73
|
}
|
96
74
|
|
97
75
|
// initialize AccessManagedUpgradeable
|
98
76
|
__AccessManaged_init($._instance.authority());
|
99
77
|
|
100
|
-
// set
|
101
|
-
|
102
|
-
$.
|
78
|
+
// set component state
|
79
|
+
$._name = name;
|
80
|
+
$._isNftInterceptor = isInterceptor;
|
103
81
|
$._instanceReader = $._instance.getInstanceReader();
|
104
|
-
$._productService = IProductService(getRegistry().getServiceAddress(PRODUCT(), gifVersion));
|
105
|
-
|
106
|
-
// set wallet and token
|
107
82
|
$._wallet = address(this);
|
108
83
|
$._token = IERC20Metadata(token);
|
109
84
|
|
110
85
|
registerInterface(type(IComponent).interfaceId);
|
111
86
|
}
|
112
87
|
|
113
|
-
/// @dev callback function for nft transfers. may only be called by chain nft contract.
|
114
|
-
/// default implementation is empty. overriding functions MUST add onlyChainNft modifier
|
115
|
-
function nftTransferFrom(address from, address to, uint256 tokenId)
|
116
|
-
external
|
117
|
-
virtual override
|
118
|
-
onlyChainNft()
|
119
|
-
{ }
|
120
|
-
|
121
88
|
function lock() external onlyOwner override {
|
122
|
-
|
89
|
+
IInstanceService(_getServiceAddress(INSTANCE())).setTargetLocked(getName(), true);
|
123
90
|
}
|
124
91
|
|
125
92
|
function unlock() external onlyOwner override {
|
126
|
-
|
127
|
-
}
|
128
|
-
|
129
|
-
// only product service may set product nft id during registration of product setup
|
130
|
-
function setProductNftId(NftId productNftId)
|
131
|
-
external
|
132
|
-
override
|
133
|
-
onlyProductService()
|
134
|
-
{
|
135
|
-
ComponentStorage storage $ = _getComponentStorage();
|
136
|
-
|
137
|
-
if($._productNftId.gtz()) {
|
138
|
-
revert ErrorComponentProductNftAlreadySet();
|
139
|
-
}
|
140
|
-
|
141
|
-
$._productNftId = productNftId;
|
93
|
+
IInstanceService(_getServiceAddress(INSTANCE())).setTargetLocked(getName(), false);
|
142
94
|
}
|
143
95
|
|
144
|
-
/// @dev Sets the wallet address for the component.
|
145
|
-
/// if the current wallet has tokens, these will be transferred.
|
146
|
-
/// if the new wallet address is externally owned, an approval from the
|
147
|
-
/// owner of the external wallet for the component to move all tokens must exist.
|
148
96
|
function setWallet(address newWallet)
|
149
97
|
external
|
150
98
|
override
|
@@ -159,8 +107,9 @@ abstract contract Component is
|
|
159
107
|
if (newWallet == address(0)) {
|
160
108
|
revert ErrorComponentWalletAddressZero();
|
161
109
|
}
|
110
|
+
|
162
111
|
if (newWallet == currentWallet) {
|
163
|
-
revert ErrorComponentWalletAddressIsSameAsCurrent(
|
112
|
+
revert ErrorComponentWalletAddressIsSameAsCurrent();
|
164
113
|
}
|
165
114
|
|
166
115
|
if (currentBalance > 0) {
|
@@ -177,7 +126,7 @@ abstract contract Component is
|
|
177
126
|
|
178
127
|
// effects
|
179
128
|
$._wallet = newWallet;
|
180
|
-
emit LogComponentWalletAddressChanged(newWallet);
|
129
|
+
emit LogComponentWalletAddressChanged(currentWallet, newWallet);
|
181
130
|
|
182
131
|
// interactions
|
183
132
|
if (currentBalance > 0) {
|
@@ -192,11 +141,41 @@ abstract contract Component is
|
|
192
141
|
}
|
193
142
|
}
|
194
143
|
|
195
|
-
function
|
196
|
-
|
197
|
-
view
|
144
|
+
function setProductNftId(NftId productNftId)
|
145
|
+
external
|
198
146
|
override
|
199
|
-
|
147
|
+
{
|
148
|
+
ComponentStorage storage $ = _getComponentStorage();
|
149
|
+
|
150
|
+
// verify caller is product service
|
151
|
+
if(msg.sender != _getServiceAddress(PRODUCT())) {
|
152
|
+
revert ErrorComponentNotProductService(msg.sender);
|
153
|
+
}
|
154
|
+
|
155
|
+
// verify component is not yet linked to a product
|
156
|
+
if($._productNftId.gtz()) {
|
157
|
+
revert ErrorComponentProductNftAlreadySet();
|
158
|
+
}
|
159
|
+
|
160
|
+
$._productNftId = productNftId;
|
161
|
+
}
|
162
|
+
|
163
|
+
/// @dev callback function for nft transfers
|
164
|
+
/// may only be called by chain nft contract.
|
165
|
+
/// do not override this function to implement business logic for handling transfers
|
166
|
+
/// override internal function _nftTransferFrom instead
|
167
|
+
function nftTransferFrom(address from, address to, uint256 tokenId)
|
168
|
+
external
|
169
|
+
virtual override
|
170
|
+
{
|
171
|
+
if(msg.sender != getRegistry().getChainNftAddress()) {
|
172
|
+
revert ErrorComponentNotChainNft(msg.sender);
|
173
|
+
}
|
174
|
+
|
175
|
+
_nftTransferFrom(from, to, tokenId);
|
176
|
+
}
|
177
|
+
|
178
|
+
function getWallet() public view override returns (address walletAddress)
|
200
179
|
{
|
201
180
|
return _getComponentStorage()._wallet;
|
202
181
|
}
|
@@ -213,15 +192,6 @@ abstract contract Component is
|
|
213
192
|
return _getComponentStorage()._instance;
|
214
193
|
}
|
215
194
|
|
216
|
-
function getInstanceReader() public view returns (InstanceReader reader) {
|
217
|
-
return _getComponentStorage()._instanceReader;
|
218
|
-
}
|
219
|
-
|
220
|
-
function getServiceAddress(ObjectType domain) public view returns (address service) {
|
221
|
-
VersionPart majorVersion = getInstance().getMajorVersion();
|
222
|
-
return getRegistry().getServiceAddress(domain, majorVersion);
|
223
|
-
}
|
224
|
-
|
225
195
|
function getName() public view override returns(string memory name) {
|
226
196
|
return _getComponentStorage()._name;
|
227
197
|
}
|
@@ -230,12 +200,22 @@ abstract contract Component is
|
|
230
200
|
return _getComponentStorage()._productNftId;
|
231
201
|
}
|
232
202
|
|
233
|
-
|
234
|
-
|
235
|
-
|
203
|
+
/// @dev internal function for nft transfers.
|
204
|
+
/// handling logic that deals with nft transfers need to overwrite this function
|
205
|
+
function _nftTransferFrom(address from, address to, uint256 tokenId)
|
206
|
+
internal
|
207
|
+
virtual
|
208
|
+
{ }
|
236
209
|
|
237
|
-
|
238
|
-
|
210
|
+
/// @dev returns reader for linked instance
|
211
|
+
function _getInstanceReader() internal view returns (InstanceReader reader) {
|
212
|
+
return _getComponentStorage()._instanceReader;
|
239
213
|
}
|
240
214
|
|
215
|
+
/// @dev returns the service address for the specified domain
|
216
|
+
/// gets address via lookup from registry using the major version form the linked instance
|
217
|
+
function _getServiceAddress(ObjectType domain) internal view returns (address service) {
|
218
|
+
VersionPart majorVersion = _getComponentStorage()._instance.getMajorVersion();
|
219
|
+
return getRegistry().getServiceAddress(domain, majorVersion);
|
220
|
+
}
|
241
221
|
}
|
@@ -30,6 +30,7 @@ abstract contract Distribution is
|
|
30
30
|
bytes32 public constant DISTRIBUTION_STORAGE_LOCATION_V1 = 0xaab7c5ea03d290056d6c060e0833d3ebcbe647f7694616a2ec52738a64b2f900;
|
31
31
|
|
32
32
|
struct DistributionStorage {
|
33
|
+
Fee _minDistributionOwnerFee;
|
33
34
|
Fee _distributionFee;
|
34
35
|
TokenHandler _tokenHandler;
|
35
36
|
IDistributionService _distributionService;
|
@@ -41,18 +42,20 @@ abstract contract Distribution is
|
|
41
42
|
NftId instanceNftId,
|
42
43
|
string memory name,
|
43
44
|
address token,
|
45
|
+
Fee memory minDistributionOwnerFee,
|
44
46
|
Fee memory distributionFee,
|
45
47
|
address initialOwner,
|
46
|
-
bytes memory data
|
48
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
47
49
|
)
|
48
50
|
public
|
49
51
|
virtual
|
50
52
|
onlyInitializing()
|
51
53
|
{
|
52
|
-
initializeComponent(registry, instanceNftId, name, token, DISTRIBUTION(), true, initialOwner,
|
54
|
+
initializeComponent(registry, instanceNftId, name, token, DISTRIBUTION(), true, initialOwner, registryData);
|
53
55
|
|
54
56
|
DistributionStorage storage $ = _getDistributionStorage();
|
55
57
|
// TODO add validation
|
58
|
+
$._minDistributionOwnerFee = minDistributionOwnerFee;
|
56
59
|
$._distributionFee = distributionFee;
|
57
60
|
$._tokenHandler = new TokenHandler(token);
|
58
61
|
$._distributionService = getInstance().getDistributionService();
|
@@ -61,6 +64,7 @@ abstract contract Distribution is
|
|
61
64
|
}
|
62
65
|
|
63
66
|
function setFees(
|
67
|
+
Fee memory minDistributionOwnerFee,
|
64
68
|
Fee memory distributionFee
|
65
69
|
)
|
66
70
|
external
|
@@ -68,7 +72,7 @@ abstract contract Distribution is
|
|
68
72
|
onlyOwner
|
69
73
|
restricted()
|
70
74
|
{
|
71
|
-
_getDistributionStorage()._distributionService.setFees(distributionFee);
|
75
|
+
_getDistributionStorage()._distributionService.setFees(minDistributionOwnerFee, distributionFee);
|
72
76
|
}
|
73
77
|
|
74
78
|
function getDistributionFee() external view returns (Fee memory distributionFee) {
|
@@ -190,7 +194,7 @@ abstract contract Distribution is
|
|
190
194
|
)
|
191
195
|
{
|
192
196
|
ReferralId referralId = getReferralId(referralCode);
|
193
|
-
return
|
197
|
+
return _getInstanceReader().getDiscountPercentage(referralId);
|
194
198
|
}
|
195
199
|
|
196
200
|
|
@@ -259,13 +263,15 @@ abstract contract Distribution is
|
|
259
263
|
return ISetup.DistributionSetupInfo(
|
260
264
|
zeroNftId(),
|
261
265
|
$._tokenHandler,
|
266
|
+
$._minDistributionOwnerFee,
|
262
267
|
$._distributionFee,
|
263
|
-
address(this)
|
268
|
+
address(this),
|
269
|
+
0
|
264
270
|
);
|
265
271
|
}
|
266
272
|
|
267
273
|
|
268
|
-
function
|
274
|
+
function _nftTransferFrom(address from, address to, uint256 tokenId) internal virtual override {
|
269
275
|
// keep track of distributor nft owner
|
270
276
|
emit LogDistributorUpdated(to, msg.sender);
|
271
277
|
DistributionStorage storage $ = _getDistributionStorage();
|
@@ -11,44 +11,58 @@ import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
|
|
11
11
|
import {NftId} from "../types/NftId.sol";
|
12
12
|
import {ObjectType} from "../types/ObjectType.sol";
|
13
13
|
|
14
|
+
/// @dev component base class
|
15
|
+
/// component examples are product, distribution, pool and oracle
|
14
16
|
interface IComponent is
|
15
17
|
IRegisterable,
|
16
18
|
ITransferInterceptor
|
17
19
|
{
|
18
|
-
|
19
20
|
error ErrorComponentNotChainNft(address caller);
|
20
21
|
error ErrorComponentNotProductService(address caller);
|
21
|
-
error ErrorComponentNotInstance(NftId instanceNftId
|
22
|
+
error ErrorComponentNotInstance(NftId instanceNftId);
|
22
23
|
error ErrorComponentProductNftAlreadySet();
|
24
|
+
|
23
25
|
error ErrorComponentWalletAddressZero();
|
24
|
-
error ErrorComponentWalletAddressIsSameAsCurrent(
|
26
|
+
error ErrorComponentWalletAddressIsSameAsCurrent();
|
25
27
|
error ErrorComponentWalletAllowanceTooSmall(address oldWallet, address newWallet, uint256 allowance, uint256 balance);
|
26
|
-
error ErrorComponentUnauthorized(address caller, uint64 requiredRoleIdNum);
|
27
28
|
|
28
|
-
event LogComponentWalletAddressChanged(address newWallet);
|
29
|
+
event LogComponentWalletAddressChanged(address oldWallet, address newWallet);
|
29
30
|
event LogComponentWalletTokensTransferred(address from, address to, uint256 amount);
|
30
31
|
|
31
|
-
|
32
|
-
|
32
|
+
/// @dev locks component to disable functions that may change state related to this component, the only exception is function "unlock"
|
33
|
+
/// only component owner (nft holder) is authorizes to call this function
|
33
34
|
function lock() external;
|
34
|
-
function unlock() external;
|
35
35
|
|
36
|
-
|
36
|
+
/// @dev unlocks component to (re-)enable functions that may change state related to this component
|
37
|
+
/// only component owner (nft holder) is authorizes to call this function
|
38
|
+
function unlock() external;
|
37
39
|
|
40
|
+
/// @dev sets the wallet address for the component
|
41
|
+
/// if the current wallet has tokens, these will be transferred
|
42
|
+
/// if the new wallet address is externally owned, an approval from the
|
43
|
+
/// owner of the external wallet for the component to move all tokens must exist
|
38
44
|
function setWallet(address walletAddress) external;
|
39
|
-
function getWallet() external view returns (address walletAddress);
|
40
45
|
|
41
|
-
|
46
|
+
/// @dev only product service may set product nft id during registration of product setup
|
47
|
+
function setProductNftId(NftId productNftId) external;
|
48
|
+
|
49
|
+
/// @dev returns the name of this component
|
50
|
+
/// to successfully register the component with an instance the name MUST be unique in the linked instance
|
51
|
+
function getName() external view returns (string memory name);
|
52
|
+
|
53
|
+
/// @dev defines which ERC20 token is used by this component
|
54
|
+
function getToken() external view returns (IERC20Metadata token);
|
42
55
|
|
56
|
+
/// @dev defines the instance to which this component is linked to
|
43
57
|
function getInstance() external view returns (IInstance instance);
|
44
58
|
|
45
|
-
/// @dev
|
46
|
-
///
|
47
|
-
function
|
59
|
+
/// @dev defines the wallet address used to hold the ERC20 tokens related to this component
|
60
|
+
/// the default address is the component token address
|
61
|
+
function getWallet() external view returns (address walletAddress);
|
48
62
|
|
49
|
-
|
63
|
+
/// @dev defines the product to which this component is linked to
|
64
|
+
/// this is only relevant for pool and distribution components
|
50
65
|
function getProductNftId() external view returns (NftId productNftId);
|
51
66
|
|
52
|
-
function
|
53
|
-
function getProductService() external view returns (IProductService);
|
67
|
+
function isNftInterceptor() external view returns(bool isInterceptor);
|
54
68
|
}
|
@@ -17,6 +17,7 @@ interface IDistributionComponent is IComponent {
|
|
17
17
|
function getSetupInfo() external view returns (ISetup.DistributionSetupInfo memory setupInfo);
|
18
18
|
|
19
19
|
function setFees(
|
20
|
+
Fee memory minDistributionOwnerFee,
|
20
21
|
Fee memory distributionFee
|
21
22
|
) external;
|
22
23
|
|
@@ -44,20 +45,6 @@ interface IDistributionComponent is IComponent {
|
|
44
45
|
bytes memory data
|
45
46
|
) external;
|
46
47
|
|
47
|
-
/**
|
48
|
-
* @dev lets distributors create referral codes.
|
49
|
-
* referral codes need to be unique
|
50
|
-
* distributor is identified via msg.sender.
|
51
|
-
*/
|
52
|
-
function createReferral(
|
53
|
-
NftId distributorNftId,
|
54
|
-
string memory code,
|
55
|
-
UFixed discountPercentage,
|
56
|
-
uint32 maxReferrals,
|
57
|
-
Timestamp expiryAt,
|
58
|
-
bytes memory data
|
59
|
-
) external returns (ReferralId referralId);
|
60
|
-
|
61
48
|
function calculateRenewalFeeAmount(
|
62
49
|
ReferralId referralId,
|
63
50
|
uint256 netPremiumAmount
|