@etherisc/gif-next 0.0.2-f752d2a-551 → 0.0.2-f79a517-071
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 +175 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +166 -39
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +557 -0
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +119 -39
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +177 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +108 -156
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +67 -139
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +417 -88
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +360 -51
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +66 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +24 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +42 -0
- 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 +768 -694
- 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 +954 -816
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +224 -43
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +51 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +49 -0
- 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/IService.sol/IService.json +174 -53
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +1 -1
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +263 -45
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +41 -23
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +4 -4
- 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/base/ServiceBase.sol/ServiceBase.json +220 -52
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +55 -54
- 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 +56 -55
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +22 -93
- 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 +22 -93
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +10 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{compensation/ICompensation.sol/ICompensation.json → distribution/IDistribution.sol/IDistribution.json} +2 -2
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{compensation/ICompensation.sol/ICompensationModule.json → distribution/IDistribution.sol/IDistributionModule.json} +2 -2
- 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 +61 -51
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +61 -51
- 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/IPoolModule.sol/IPoolModule.json +29 -14
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +28 -13
- 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/IRisk.sol/IRiskModule.json +104 -1
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +1 -1
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +126 -5
- 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/ITreasury.sol/ITreasuryModule.json +326 -221
- 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/module/treasury/TreasuryModule.sol/TreasuryModule.json +326 -221
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +374 -70
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +630 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +176 -74
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +446 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +235 -50
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +325 -51
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +335 -53
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +468 -73
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +186 -12
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +190 -51
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +872 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +34 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +380 -139
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1245 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +496 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +107 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +127 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +117 -37
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +55 -14
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +158 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +349 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +190 -37
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +129 -0
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +78 -14
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +4 -0
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +557 -0
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +1 -1
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +417 -88
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +1 -1
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +407 -56
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +204 -36
- 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 +267 -62
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +89 -25
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
- 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/Fee.sol/FeeLib.json +52 -13
- 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/ReferralId.sol/ReferralIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +99 -0
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +86 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/{UFixedMathLib.json → UFixedLib.json} +3 -3
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +40 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/components/BaseComponent.sol +11 -20
- package/contracts/components/Distribution.sol +155 -0
- package/contracts/components/IBaseComponent.sol +1 -1
- package/contracts/components/IDistributionComponent.sol +46 -0
- package/contracts/components/IPoolComponent.sol +15 -8
- package/contracts/components/IProductComponent.sol +26 -8
- package/contracts/components/Pool.sol +99 -27
- package/contracts/components/Product.sol +204 -22
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/IInstance.sol +11 -11
- package/contracts/instance/Instance.sol +28 -13
- package/contracts/instance/base/ComponentServiceBase.sol +13 -6
- package/contracts/instance/base/IInstanceBase.sol +11 -2
- package/contracts/instance/base/IKeyValueStore.sol +4 -3
- package/contracts/instance/base/InstanceBase.sol +19 -10
- package/contracts/instance/base/KeyValueStore.sol +12 -7
- package/contracts/instance/base/Lifecycle.sol +15 -10
- package/contracts/instance/base/ModuleBase.sol +22 -17
- package/contracts/instance/base/ServiceBase.sol +20 -13
- package/contracts/instance/module/bundle/BundleModule.sol +10 -12
- package/contracts/instance/module/bundle/IBundle.sol +6 -11
- package/contracts/instance/module/component/ComponentModule.sol +33 -57
- package/contracts/instance/module/component/IComponent.sol +6 -31
- package/contracts/instance/module/distribution/DistributionModule.sol +17 -0
- package/contracts/instance/module/distribution/IDistribution.sol +10 -0
- package/contracts/instance/module/policy/IPolicy.sol +13 -10
- package/contracts/instance/module/policy/PolicyModule.sol +35 -20
- package/contracts/instance/module/pool/IPoolModule.sol +4 -4
- package/contracts/instance/module/pool/PoolModule.sol +23 -15
- package/contracts/instance/module/risk/IRisk.sol +18 -2
- package/contracts/instance/module/risk/RiskModule.sol +56 -2
- package/contracts/instance/module/treasury/ITreasury.sol +31 -50
- package/contracts/instance/module/treasury/TokenHandler.sol +1 -1
- package/contracts/instance/module/treasury/TreasuryModule.sol +70 -91
- package/contracts/instance/service/ComponentOwnerService.sol +238 -93
- package/contracts/instance/service/DistributionService.sol +54 -0
- package/contracts/instance/service/IComponentOwnerService.sol +0 -2
- package/contracts/instance/service/IDistributionService.sol +12 -0
- package/contracts/instance/service/IPoolService.sol +7 -0
- package/contracts/instance/service/IProductService.sol +56 -7
- package/contracts/instance/service/PoolService.sol +49 -23
- package/contracts/instance/service/ProductService.sol +250 -94
- package/contracts/registry/ChainNft.sol +80 -37
- package/contracts/registry/IRegistry.sol +28 -28
- package/contracts/registry/IRegistryService.sol +35 -0
- package/contracts/registry/ITransferInterceptor.sol +6 -0
- package/contracts/registry/Registry.sol +314 -272
- package/contracts/registry/RegistryService.sol +441 -0
- package/contracts/registry/RegistryServiceManager.sol +64 -0
- package/contracts/shared/ContractDeployerLib.sol +72 -0
- package/contracts/shared/INftOwnable.sol +22 -0
- package/contracts/shared/IRegisterable.sol +8 -15
- package/contracts/shared/IVersionable.sol +55 -11
- package/contracts/shared/NftOwnable.sol +136 -0
- package/contracts/shared/ProxyManager.sol +94 -0
- package/contracts/shared/Registerable.sol +62 -59
- package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +112 -54
- package/contracts/test/TestDistribution.sol +22 -0
- package/contracts/test/TestFee.sol +2 -2
- package/contracts/test/TestPool.sol +7 -2
- package/contracts/test/TestProduct.sol +37 -7
- package/contracts/test/TestRegisterable.sol +5 -6
- package/contracts/test/TestService.sol +5 -11
- package/contracts/types/Fee.sol +10 -5
- package/contracts/types/ObjectType.sol +24 -8
- package/contracts/types/ReferralId.sol +48 -0
- package/contracts/types/RiskId.sol +43 -0
- package/contracts/types/RoleId.sol +9 -2
- package/contracts/types/UFixed.sol +128 -12
- package/contracts/types/Version.sol +9 -0
- package/package.json +4 -3
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.json +0 -333
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.json +0 -10
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/CompensationModule.sol/CompensationModule.json +0 -10
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensation.dbg.json +0 -4
- package/artifacts/contracts/instance/module/compensation/ICompensation.sol/ICompensationModule.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -452
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.json +0 -24
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.json +0 -24
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/instance/module/access/Access.sol +0 -149
- package/contracts/instance/module/access/IAccess.sol +0 -53
- package/contracts/instance/module/compensation/CompensationModule.sol +0 -8
- package/contracts/instance/module/compensation/ICompensation.sol +0 -10
- package/contracts/registry/IChainNft.sol +0 -21
- package/contracts/registry/IRegistryLinked.sol +0 -8
- package/contracts/shared/IOwnable.sol +0 -6
@@ -2,12 +2,13 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {NftId} from "../types/NftId.sol";
|
5
|
+
import {INftOwnable} from "../shared/INftOwnable.sol";
|
6
|
+
import {NftOwnable} from "../shared/NftOwnable.sol";
|
5
7
|
import {RoleId} from "../types/RoleId.sol";
|
6
8
|
|
7
9
|
import {InstanceBase} from "./base/InstanceBase.sol";
|
8
|
-
import {AccessModule} from "./module/access/Access.sol";
|
9
|
-
import {CompensationModule} from "./module/compensation/CompensationModule.sol";
|
10
10
|
import {ComponentModule} from "./module/component/ComponentModule.sol";
|
11
|
+
import {DistributionModule} from "./module/distribution/DistributionModule.sol";
|
11
12
|
import {PolicyModule} from "./module/policy/PolicyModule.sol";
|
12
13
|
import {PoolModule} from "./module/pool/PoolModule.sol";
|
13
14
|
import {RiskModule} from "./module/risk/RiskModule.sol";
|
@@ -16,14 +17,15 @@ import {TreasuryModule} from "./module/treasury/TreasuryModule.sol";
|
|
16
17
|
|
17
18
|
import {IRegistry} from "../registry/IRegistry.sol";
|
18
19
|
import {Registerable} from "../shared/Registerable.sol";
|
19
|
-
import {IAccessModule} from "./module/access/IAccess.sol";
|
20
20
|
import {IBundleModule} from "./module/bundle/IBundle.sol";
|
21
21
|
import {IComponentModule} from "./module/component/IComponent.sol";
|
22
22
|
import {IPoolModule} from "./module/pool/IPoolModule.sol";
|
23
23
|
import {IPolicyModule} from "./module/policy/IPolicy.sol";
|
24
24
|
import {IInstanceBase} from "./base/IInstanceBase.sol";
|
25
|
+
import {ITreasuryModule} from "./module/treasury/ITreasury.sol";
|
25
26
|
|
26
27
|
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
28
|
+
import {IDistributionService} from "./service/IDistributionService.sol";
|
27
29
|
import {IProductService} from "./service/IProductService.sol";
|
28
30
|
import {IPoolService} from "./service/IPoolService.sol";
|
29
31
|
|
@@ -31,10 +33,9 @@ import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
|
31
33
|
|
32
34
|
contract Instance is
|
33
35
|
InstanceBase,
|
34
|
-
AccessModule,
|
35
36
|
BundleModule,
|
36
37
|
ComponentModule,
|
37
|
-
|
38
|
+
DistributionModule,
|
38
39
|
PolicyModule,
|
39
40
|
PoolModule,
|
40
41
|
RiskModule,
|
@@ -42,27 +43,41 @@ contract Instance is
|
|
42
43
|
{
|
43
44
|
constructor(
|
44
45
|
address registry,
|
45
|
-
NftId registryNftId
|
46
|
+
NftId registryNftId,
|
47
|
+
address initialOwner
|
46
48
|
)
|
47
|
-
InstanceBase(registry, registryNftId)
|
48
|
-
AccessModule()
|
49
|
+
InstanceBase(registry, registryNftId, initialOwner)
|
49
50
|
BundleModule()
|
51
|
+
DistributionModule()
|
50
52
|
ComponentModule()
|
51
53
|
PolicyModule()
|
52
54
|
PoolModule()
|
53
55
|
TreasuryModule()
|
54
56
|
{
|
55
57
|
initializeBundleModule(_keyValueStore);
|
58
|
+
initializeComponentModule(_keyValueStore);
|
59
|
+
initializeDistributionModule(_keyValueStore);
|
60
|
+
initializePolicyModule(_keyValueStore);
|
61
|
+
initializePoolModule(_keyValueStore);
|
62
|
+
initializeRiskModule(_keyValueStore);
|
56
63
|
}
|
57
64
|
|
58
|
-
|
59
|
-
|
65
|
+
modifier onlyComponentOwnerService() override (ComponentModule, PoolModule, TreasuryModule) {
|
66
|
+
require(
|
67
|
+
msg.sender == address(this.getComponentOwnerService()),
|
68
|
+
"ERROR:CMP-001:NOT_REGISTRY_SERVICE"
|
69
|
+
);
|
70
|
+
_;
|
71
|
+
}
|
72
|
+
|
73
|
+
function getRegistry() public view override (INftOwnable, NftOwnable) returns (IRegistry registry) { return super.getRegistry(); }
|
60
74
|
|
61
|
-
function
|
75
|
+
function getKeyValueStore() public view override (InstanceBase) returns (IKeyValueStore keyValueStore) { return super.getKeyValueStore(); }
|
62
76
|
|
63
|
-
function getComponentOwnerService() external view override (IComponentModule,
|
77
|
+
function getComponentOwnerService() external view override (IInstanceBase, IComponentModule, ITreasuryModule, IPoolModule) returns(IComponentOwnerService service) { return _componentOwnerService; }
|
78
|
+
function getDistributionService() external view override (IInstanceBase) returns(IDistributionService service) { return _distributionService; }
|
64
79
|
function getProductService() external view override (IBundleModule, IPolicyModule, IInstanceBase) returns(IProductService service) { return _productService; }
|
65
80
|
function getPoolService() external view override (IBundleModule, IPoolModule, IInstanceBase) returns(IPoolService service) { return _poolService; }
|
66
81
|
|
67
|
-
function getOwner() public view override (
|
82
|
+
function getOwner() public view override (INftOwnable, NftOwnable) returns(address owner) { return super.getOwner(); }
|
68
83
|
}
|
@@ -2,21 +2,23 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {IRegistry} from "../../registry/IRegistry.sol";
|
5
|
+
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
5
6
|
import {IInstance} from "../../instance/IInstance.sol";
|
6
7
|
import {ObjectType, INSTANCE, PRODUCT, POOL} from "../../types/ObjectType.sol";
|
7
8
|
import {NftId, NftIdLib} from "../../types/NftId.sol";
|
8
9
|
|
9
10
|
import {ServiceBase} from "./ServiceBase.sol";
|
11
|
+
import {Version, VersionPart, VersionLib} from "../../types/Version.sol";
|
10
12
|
|
11
13
|
abstract contract ComponentServiceBase is ServiceBase {
|
12
14
|
|
13
15
|
constructor(
|
14
16
|
address registry,
|
15
|
-
NftId registryNftId
|
17
|
+
NftId registryNftId,
|
18
|
+
address initialOwner
|
16
19
|
)
|
17
|
-
ServiceBase(registry, registryNftId)
|
18
|
-
// solhint-disable-next-line no-empty-blocks
|
19
20
|
{
|
21
|
+
_initializeServiceBase(registry, registryNftId, initialOwner);
|
20
22
|
}
|
21
23
|
|
22
24
|
|
@@ -30,13 +32,18 @@ abstract contract ComponentServiceBase is ServiceBase {
|
|
30
32
|
IInstance instance
|
31
33
|
)
|
32
34
|
{
|
33
|
-
NftId componentNftId =
|
35
|
+
NftId componentNftId = getRegistry().getNftId(msg.sender);
|
34
36
|
require(componentNftId.gtz(), "ERROR_COMPONENT_UNKNOWN");
|
35
37
|
|
36
|
-
info =
|
38
|
+
info = getRegistry().getObjectInfo(componentNftId);
|
37
39
|
require(info.objectType == objectType, "OBJECT_TYPE_INVALID");
|
38
40
|
|
39
|
-
address instanceAddress =
|
41
|
+
address instanceAddress = getRegistry().getObjectInfo(info.parentNftId).objectAddress;
|
40
42
|
instance = IInstance(instanceAddress);
|
41
43
|
}
|
44
|
+
|
45
|
+
function getRegistryService() public view virtual returns (IRegistryService) {
|
46
|
+
address service = getRegistry().getServiceAddress("RegistryService", getMajorVersion());
|
47
|
+
return IRegistryService(service);
|
48
|
+
}
|
42
49
|
}
|
@@ -1,14 +1,23 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Key32} from "../../types/Key32.sol";
|
5
|
+
import {StateId} from "../../types/StateId.sol";
|
3
6
|
|
4
7
|
import {IKeyValueStore} from "./IKeyValueStore.sol";
|
8
|
+
|
5
9
|
import {IComponentOwnerService} from "../service/IComponentOwnerService.sol";
|
10
|
+
import {IDistributionService} from "../service/IDistributionService.sol";
|
6
11
|
import {IProductService} from "../service/IProductService.sol";
|
7
12
|
import {IPoolService} from "../service/IPoolService.sol";
|
8
13
|
|
9
14
|
interface IInstanceBase {
|
10
15
|
function getKeyValueStore() external view returns (IKeyValueStore keyValueStore);
|
11
|
-
function
|
16
|
+
function updateState(Key32 key, StateId state) external;
|
17
|
+
function getState(Key32 key) external view returns (StateId state);
|
18
|
+
|
19
|
+
function getComponentOwnerService() external view returns(IComponentOwnerService);
|
20
|
+
function getDistributionService() external view returns(IDistributionService);
|
12
21
|
function getProductService() external view returns(IProductService service);
|
13
22
|
function getPoolService() external view returns(IPoolService service);
|
14
23
|
}
|
@@ -29,9 +29,9 @@ interface IKeyValueStore is ILifecycle {
|
|
29
29
|
Blocknumber createdIn;
|
30
30
|
}
|
31
31
|
|
32
|
-
event LogInfoCreated(Key key, StateId state, address createdBy);
|
33
|
-
event LogInfoUpdated(Key key, StateId state, address updatedBy, Blocknumber lastUpdatedIn);
|
34
|
-
event LogStateUpdated(Key key, StateId stateOld, StateId stateNew, address updatedBy, Blocknumber lastUpdatedIn);
|
32
|
+
event LogInfoCreated(Key key, StateId state, address createdBy, address txOrigin);
|
33
|
+
event LogInfoUpdated(Key key, StateId state, address updatedBy, address txOrigin, Blocknumber lastUpdatedIn);
|
34
|
+
event LogStateUpdated(Key key, StateId stateOld, StateId stateNew, address updatedBy, address txOrigin, Blocknumber lastUpdatedIn);
|
35
35
|
|
36
36
|
// generic state changing functions
|
37
37
|
function create(Key32 key, ObjectType objectType, bytes memory data) external;
|
@@ -46,4 +46,5 @@ interface IKeyValueStore is ILifecycle {
|
|
46
46
|
function getState(Key32 key) external view returns (StateId state);
|
47
47
|
|
48
48
|
function toKey32(ObjectType objectType, KeyId id) external pure returns(Key32);
|
49
|
+
function toKey(Key32 key32) external pure returns(Key memory key);
|
49
50
|
}
|
@@ -1,16 +1,17 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {Versionable} from "../../shared/Versionable.sol";
|
5
5
|
import {Registerable} from "../../shared/Registerable.sol";
|
6
|
-
// import {IRegistry} from "../registry/IRegistry.sol";
|
7
6
|
|
8
|
-
// import {IInstance} from "./IInstance.sol";
|
9
7
|
import {ObjectType, INSTANCE} from "../../types/ObjectType.sol";
|
8
|
+
import {Key32} from "../../types/Key32.sol";
|
10
9
|
import {NftId} from "../../types/NftId.sol";
|
10
|
+
import {StateId} from "../../types/StateId.sol";
|
11
11
|
import {Version, VersionPart, VersionLib} from "../../types/Version.sol";
|
12
12
|
|
13
13
|
import {IComponentOwnerService} from "../service/IComponentOwnerService.sol";
|
14
|
+
import {IDistributionService} from "../service/IDistributionService.sol";
|
14
15
|
import {IProductService} from "../service/IProductService.sol";
|
15
16
|
import {IPoolService} from "../service/IPoolService.sol";
|
16
17
|
|
@@ -28,16 +29,19 @@ abstract contract InstanceBase is
|
|
28
29
|
IKeyValueStore internal _keyValueStore;
|
29
30
|
|
30
31
|
IComponentOwnerService internal _componentOwnerService;
|
32
|
+
IDistributionService internal _distributionService;
|
31
33
|
IProductService internal _productService;
|
32
34
|
IPoolService internal _poolService;
|
33
35
|
|
34
36
|
constructor(
|
35
37
|
address registry,
|
36
|
-
NftId registryNftId
|
38
|
+
NftId registryNftId,
|
39
|
+
address initialOwner
|
37
40
|
)
|
38
|
-
Registerable(registry, registryNftId)
|
39
41
|
Versionable()
|
40
42
|
{
|
43
|
+
bytes memory data = "";
|
44
|
+
_initializeRegisterable(registry, registryNftId, INSTANCE(), true, initialOwner, data);
|
41
45
|
_keyValueStore = new KeyValueStore();
|
42
46
|
|
43
47
|
_registerInterface(type(IInstance).interfaceId);
|
@@ -46,6 +50,14 @@ abstract contract InstanceBase is
|
|
46
50
|
|
47
51
|
function getKeyValueStore() public view virtual override returns (IKeyValueStore keyValueStore) { return _keyValueStore; }
|
48
52
|
|
53
|
+
function updateState(Key32 key, StateId state) external override {
|
54
|
+
_keyValueStore.updateState(key, state);
|
55
|
+
}
|
56
|
+
|
57
|
+
function getState(Key32 key) external view override returns (StateId state) {
|
58
|
+
return _keyValueStore.getState(key);
|
59
|
+
}
|
60
|
+
|
49
61
|
// from versionable
|
50
62
|
function getVersion()
|
51
63
|
public
|
@@ -57,21 +69,18 @@ abstract contract InstanceBase is
|
|
57
69
|
}
|
58
70
|
|
59
71
|
// from registerable
|
60
|
-
function getType() external pure override returns (ObjectType objectType) {
|
61
|
-
return INSTANCE();
|
62
|
-
}
|
63
|
-
|
64
72
|
|
65
73
|
// internal / private functions
|
66
74
|
function _linkToServicesInRegistry() internal {
|
67
75
|
VersionPart majorVersion = getVersion().toMajorPart();
|
68
76
|
_componentOwnerService = IComponentOwnerService(_getAndCheck("ComponentOwnerService", majorVersion));
|
77
|
+
_distributionService = IDistributionService(_getAndCheck("DistributionService", majorVersion));
|
69
78
|
_productService = IProductService(_getAndCheck("ProductService", majorVersion));
|
70
79
|
_poolService = IPoolService(_getAndCheck("PoolService", majorVersion));
|
71
80
|
}
|
72
81
|
|
73
82
|
function _getAndCheck(string memory serviceName, VersionPart majorVersion) internal view returns (address serviceAddress) {
|
74
|
-
serviceAddress =
|
83
|
+
serviceAddress = getRegistry().getServiceAddress(serviceName, majorVersion);
|
75
84
|
require(
|
76
85
|
serviceAddress != address(0),
|
77
86
|
"ERROR:INS-001:NOT_REGISTERED"
|
@@ -54,7 +54,8 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
54
54
|
// set data
|
55
55
|
_value[key32].data = data;
|
56
56
|
|
57
|
-
|
57
|
+
// solhint-disable-next-line avoid-tx-origin
|
58
|
+
emit LogInfoCreated(toKey(key32), initialState, createdBy, tx.origin);
|
58
59
|
}
|
59
60
|
|
60
61
|
function update(Key32 key32, StateId state, bytes memory data)
|
@@ -78,8 +79,10 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
78
79
|
|
79
80
|
// create log entries
|
80
81
|
Key memory key = toKey(key32);
|
81
|
-
|
82
|
-
emit
|
82
|
+
// solhint-disable-next-line avoid-tx-origin
|
83
|
+
emit LogStateUpdated(key, state, stateOld, updatedBy, tx.origin, lastUpdatedIn);
|
84
|
+
// solhint-disable-next-line avoid-tx-origin
|
85
|
+
emit LogInfoUpdated(key, state, updatedBy, tx.origin, lastUpdatedIn);
|
83
86
|
}
|
84
87
|
|
85
88
|
function updateData(Key32 key32, bytes memory data)
|
@@ -101,7 +104,8 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
101
104
|
|
102
105
|
// create log entry
|
103
106
|
Key memory key = toKey(key32);
|
104
|
-
|
107
|
+
// solhint-disable-next-line avoid-tx-origin
|
108
|
+
emit LogInfoUpdated(key, state, updatedBy, tx.origin, lastUpdatedIn);
|
105
109
|
}
|
106
110
|
|
107
111
|
function updateState(Key32 key32, StateId state)
|
@@ -122,7 +126,8 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
122
126
|
|
123
127
|
// create log entry
|
124
128
|
Key memory key = toKey(key32);
|
125
|
-
|
129
|
+
// solhint-disable-next-line avoid-tx-origin
|
130
|
+
emit LogStateUpdated(key, state, stateOld, updatedBy, tx.origin, lastUpdatedIn);
|
126
131
|
}
|
127
132
|
|
128
133
|
function exists(Key32 key32) public view returns (bool) {
|
@@ -145,11 +150,11 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
145
150
|
return _value[key32].metadata.state;
|
146
151
|
}
|
147
152
|
|
148
|
-
function toKey32(ObjectType objectType, KeyId id) external pure returns(Key32) {
|
153
|
+
function toKey32(ObjectType objectType, KeyId id) external pure override returns(Key32) {
|
149
154
|
return Key32Lib.toKey32(objectType, id);
|
150
155
|
}
|
151
156
|
|
152
|
-
function toKey(Key32 key32) public pure returns (Key memory key) {
|
157
|
+
function toKey(Key32 key32) public pure override returns (Key memory key) {
|
153
158
|
(ObjectType objectType, KeyId id) = key32.toKey();
|
154
159
|
return Key(objectType, id);
|
155
160
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
4
|
import {NftId} from "../../types/NftId.sol";
|
5
|
-
import {ObjectType,
|
5
|
+
import {ObjectType, COMPONENT, BUNDLE, POLICY, RISK} from "../../types/ObjectType.sol";
|
6
6
|
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, UNDERWRITTEN, REVOKED, DECLINED} from "../../types/StateId.sol";
|
7
7
|
import {ILifecycle} from "./ILifecycle.sol";
|
8
8
|
|
@@ -14,12 +14,10 @@ contract Lifecycle is ILifecycle {
|
|
14
14
|
private _isValidTransition;
|
15
15
|
|
16
16
|
constructor() {
|
17
|
-
_setupComponentLifecycle(PRODUCT());
|
18
|
-
_setupComponentLifecycle(ORACLE());
|
19
|
-
_setupComponentLifecycle(POOL());
|
20
|
-
|
21
17
|
_setupBundleLifecycle();
|
18
|
+
_setupComponentLifecycle();
|
22
19
|
_setupPolicyLifecycle();
|
20
|
+
_setupRiskLifecycle();
|
23
21
|
}
|
24
22
|
|
25
23
|
function hasLifecycle(
|
@@ -70,11 +68,11 @@ contract Lifecycle is ILifecycle {
|
|
70
68
|
return _isValidTransition[objectType][fromId][toId];
|
71
69
|
}
|
72
70
|
|
73
|
-
function _setupComponentLifecycle(
|
74
|
-
_initialState[
|
75
|
-
_isValidTransition[
|
76
|
-
_isValidTransition[
|
77
|
-
_isValidTransition[
|
71
|
+
function _setupComponentLifecycle() internal {
|
72
|
+
_initialState[COMPONENT()] = ACTIVE();
|
73
|
+
_isValidTransition[COMPONENT()][ACTIVE()][PAUSED()] = true;
|
74
|
+
_isValidTransition[COMPONENT()][PAUSED()][ACTIVE()] = true;
|
75
|
+
_isValidTransition[COMPONENT()][PAUSED()][ARCHIVED()] = true;
|
78
76
|
}
|
79
77
|
|
80
78
|
function _setupBundleLifecycle() internal {
|
@@ -92,4 +90,11 @@ contract Lifecycle is ILifecycle {
|
|
92
90
|
_isValidTransition[POLICY()][UNDERWRITTEN()][ACTIVE()] = true;
|
93
91
|
_isValidTransition[POLICY()][ACTIVE()][CLOSED()] = true;
|
94
92
|
}
|
93
|
+
|
94
|
+
function _setupRiskLifecycle() internal {
|
95
|
+
_initialState[RISK()] = ACTIVE();
|
96
|
+
_isValidTransition[RISK()][ACTIVE()][PAUSED()] = true;
|
97
|
+
_isValidTransition[RISK()][PAUSED()][ACTIVE()] = true;
|
98
|
+
_isValidTransition[RISK()][PAUSED()][ARCHIVED()] = true;
|
99
|
+
}
|
95
100
|
}
|
@@ -16,37 +16,42 @@ import {IKeyValueStore} from "./IKeyValueStore.sol";
|
|
16
16
|
abstract contract ModuleBase {
|
17
17
|
|
18
18
|
IKeyValueStore private _store;
|
19
|
-
ObjectType private _type;
|
20
19
|
|
21
|
-
function _initialize(IKeyValueStore keyValueStore
|
20
|
+
function _initialize(IKeyValueStore keyValueStore) internal {
|
22
21
|
_store = keyValueStore;
|
23
|
-
_type = objectType;
|
24
22
|
}
|
25
23
|
|
26
|
-
function _create(
|
24
|
+
function _create(ObjectType objectType, Key32 key, bytes memory data) internal {
|
27
25
|
_store.create(
|
28
|
-
|
29
|
-
|
26
|
+
key,
|
27
|
+
objectType,
|
30
28
|
data);
|
31
29
|
}
|
32
30
|
|
33
|
-
function
|
34
|
-
_store.
|
31
|
+
function _create(ObjectType objectType, NftId nftId, bytes memory data) internal {
|
32
|
+
_store.create(
|
33
|
+
nftId.toKey32(objectType),
|
34
|
+
objectType,
|
35
|
+
data);
|
35
36
|
}
|
36
37
|
|
37
|
-
function
|
38
|
-
_store.
|
38
|
+
function _updateData(ObjectType objectType, NftId nftId, bytes memory data) internal {
|
39
|
+
_store.updateData(nftId.toKey32(objectType), data);
|
39
40
|
}
|
40
41
|
|
41
|
-
function
|
42
|
-
|
42
|
+
function _updateState(ObjectType objectType, NftId nftId, StateId state) internal {
|
43
|
+
_store.updateState(nftId.toKey32(objectType), state);
|
43
44
|
}
|
44
45
|
|
45
|
-
function
|
46
|
-
return _store.
|
46
|
+
function _exists(ObjectType objectType, NftId nftId) internal view returns (bool hasData) {
|
47
|
+
return _store.exists(nftId.toKey32(objectType));
|
47
48
|
}
|
48
49
|
|
49
|
-
function
|
50
|
-
return nftId.toKey32(
|
51
|
-
}
|
50
|
+
function _getData(ObjectType objectType, NftId nftId) internal view returns(bytes memory data) {
|
51
|
+
return _store.getData(nftId.toKey32(objectType));
|
52
|
+
}
|
53
|
+
|
54
|
+
function _getState(ObjectType objectType, NftId nftId) internal view returns(StateId) {
|
55
|
+
return _store.getState(nftId.toKey32(objectType));
|
56
|
+
}
|
52
57
|
}
|
@@ -3,9 +3,10 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {NftId, zeroNftId} from "../../types/NftId.sol";
|
5
5
|
import {ObjectType, SERVICE} from "../../types/ObjectType.sol";
|
6
|
-
import {Version, VersionPart} from "../../types/Version.sol";
|
6
|
+
import {Version, VersionPart, VersionLib} from "../../types/Version.sol";
|
7
7
|
|
8
8
|
import {Registerable} from "../../shared/Registerable.sol";
|
9
|
+
import {IRegistry} from "../../registry/IRegistry.sol";
|
9
10
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
10
11
|
import {Versionable} from "../../shared/Versionable.sol";
|
11
12
|
|
@@ -16,22 +17,28 @@ abstract contract ServiceBase is
|
|
16
17
|
Versionable,
|
17
18
|
IService
|
18
19
|
{
|
20
|
+
function getName() public pure virtual override returns(string memory name);
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
NftId registryNftId
|
23
|
-
)
|
24
|
-
Registerable(registry, registryNftId)
|
25
|
-
Versionable()
|
26
|
-
{
|
27
|
-
_registerInterface(type(IService).interfaceId);
|
22
|
+
function getMajorVersion() public view virtual override returns(VersionPart majorVersion) {
|
23
|
+
return getVersion().toMajorPart();
|
28
24
|
}
|
29
25
|
|
30
|
-
|
31
|
-
|
26
|
+
// from Versionable
|
27
|
+
function getVersion()
|
28
|
+
public
|
29
|
+
pure
|
30
|
+
virtual override (IVersionable, Versionable)
|
31
|
+
returns(Version)
|
32
|
+
{
|
33
|
+
return VersionLib.toVersion(3,0,0);
|
32
34
|
}
|
33
35
|
|
34
|
-
function
|
35
|
-
|
36
|
+
function _initializeServiceBase(address registry, NftId registryNftId, address initialOwner)
|
37
|
+
internal
|
38
|
+
//onlyInitializing //TODO uncomment when "fully" upgradeable
|
39
|
+
{// service must provide its name and version upon registration
|
40
|
+
bytes memory data = abi.encode(getName(), getMajorVersion());
|
41
|
+
_initializeRegisterable(registry, registryNftId, SERVICE(), false, initialOwner, data);
|
42
|
+
_registerInterface(type(IService).interfaceId);
|
36
43
|
}
|
37
44
|
}
|
@@ -6,6 +6,7 @@ import {IRegistry} from "../../../registry/IRegistry.sol";
|
|
6
6
|
import {IProductService} from "../../service/IProductService.sol";
|
7
7
|
import {IPoolService} from "../../service/IPoolService.sol";
|
8
8
|
|
9
|
+
import {Fee} from "../../../types/Fee.sol";
|
9
10
|
import {NftId} from "../../../types/NftId.sol";
|
10
11
|
import {Key32, KeyId} from "../../../types/Key32.sol";
|
11
12
|
import {LibNftIdSet} from "../../../types/NftIdSet.sol";
|
@@ -55,12 +56,13 @@ abstract contract BundleModule is
|
|
55
56
|
}
|
56
57
|
|
57
58
|
function initializeBundleModule(IKeyValueStore keyValueStore) internal {
|
58
|
-
_initialize(keyValueStore
|
59
|
+
_initialize(keyValueStore);
|
59
60
|
}
|
60
61
|
|
61
62
|
function createBundleInfo(
|
62
63
|
NftId bundleNftId,
|
63
64
|
NftId poolNftId,
|
65
|
+
Fee memory fee,
|
64
66
|
uint256 amount,
|
65
67
|
uint256 lifetime,
|
66
68
|
bytes calldata filter
|
@@ -69,9 +71,9 @@ abstract contract BundleModule is
|
|
69
71
|
onlyBundlePoolService
|
70
72
|
override
|
71
73
|
{
|
72
|
-
BundleInfo memory
|
73
|
-
bundleNftId,
|
74
|
+
BundleInfo memory info = BundleInfo(
|
74
75
|
poolNftId,
|
76
|
+
fee,
|
75
77
|
filter,
|
76
78
|
amount, // capital
|
77
79
|
0, // locked capital
|
@@ -80,15 +82,15 @@ abstract contract BundleModule is
|
|
80
82
|
zeroTimestamp() // closedAt
|
81
83
|
);
|
82
84
|
|
83
|
-
_create(bundleNftId, abi.encode(
|
85
|
+
_create(BUNDLE(), bundleNftId, abi.encode(info));
|
84
86
|
}
|
85
87
|
|
86
|
-
function setBundleInfo(BundleInfo memory
|
88
|
+
function setBundleInfo(NftId bundleNftId, BundleInfo memory info)
|
87
89
|
external
|
88
90
|
override
|
89
91
|
onlyPoolOrProductService
|
90
92
|
{
|
91
|
-
_updateData(
|
93
|
+
_updateData(BUNDLE(), bundleNftId, abi.encode(info));
|
92
94
|
}
|
93
95
|
|
94
96
|
function updateBundleState(NftId bundleNftId, StateId state)
|
@@ -96,7 +98,7 @@ abstract contract BundleModule is
|
|
96
98
|
override
|
97
99
|
onlyBundlePoolService
|
98
100
|
{
|
99
|
-
_updateState(bundleNftId, state);
|
101
|
+
_updateState(BUNDLE(), bundleNftId, state);
|
100
102
|
}
|
101
103
|
|
102
104
|
function collateralizePolicy(
|
@@ -127,10 +129,6 @@ abstract contract BundleModule is
|
|
127
129
|
}
|
128
130
|
|
129
131
|
function getBundleInfo(NftId bundleNftId) external view override returns(BundleInfo memory bundleInfo) {
|
130
|
-
return abi.decode(_getData(bundleNftId), (BundleInfo));
|
132
|
+
return abi.decode(_getData(BUNDLE(), bundleNftId), (BundleInfo));
|
131
133
|
}
|
132
|
-
|
133
|
-
function toBundleKey32(NftId bundleNftId) external view override returns (Key32 key32) {
|
134
|
-
return _toKey32(bundleNftId);
|
135
|
-
}
|
136
134
|
}
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IRegistry} from "../../../registry/IRegistry.sol";
|
5
5
|
import {IInstance} from "../../IInstance.sol";
|
6
|
+
import {Fee} from "../../../types/Fee.sol";
|
6
7
|
import {Key32} from "../../../types/Key32.sol";
|
7
8
|
import {NftId} from "../../../types/NftId.sol";
|
8
9
|
import {StateId} from "../../../types/StateId.sol";
|
@@ -16,8 +17,8 @@ import {IPoolService} from "../../service/IPoolService.sol";
|
|
16
17
|
interface IBundle {
|
17
18
|
|
18
19
|
struct BundleInfo {
|
19
|
-
NftId nftId;
|
20
20
|
NftId poolNftId;
|
21
|
+
Fee fee; // bundle fee on net premium amounts
|
21
22
|
bytes filter; // required conditions for applications to be considered for collateralization by this bundle
|
22
23
|
uint256 capitalAmount; // net investment capital amount (<= balance)
|
23
24
|
uint256 lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= balance)
|
@@ -32,25 +33,19 @@ interface IBundleModule is IBundle {
|
|
32
33
|
function createBundleInfo(
|
33
34
|
NftId bundleNftId,
|
34
35
|
NftId poolNftId,
|
36
|
+
Fee memory fee,
|
35
37
|
uint256 amount,
|
36
38
|
uint256 lifetime,
|
37
39
|
bytes calldata filter
|
38
40
|
) external;
|
39
41
|
|
40
|
-
function setBundleInfo(BundleInfo memory bundleInfo) external;
|
41
|
-
function updateBundleState(NftId
|
42
|
+
function setBundleInfo(NftId nftId, BundleInfo memory bundleInfo) external;
|
43
|
+
function updateBundleState(NftId nftId, StateId state) external;
|
42
44
|
|
43
45
|
function collateralizePolicy(NftId bundleNftId, NftId policyNftId, uint256 amount) external;
|
44
46
|
function releasePolicy(NftId bundleNftId, NftId policyNftId) external returns(uint256 collateralAmount);
|
45
47
|
|
46
|
-
function getBundleInfo(NftId
|
47
|
-
function toBundleKey32(NftId bundleNftId) external view returns (Key32 key32);
|
48
|
-
|
49
|
-
// repeat registry linked signature
|
50
|
-
function getRegistry() external view returns (IRegistry registry);
|
51
|
-
|
52
|
-
// repeat instance base signature
|
53
|
-
function getKeyValueStore() external view returns (IKeyValueStore keyValueStore);
|
48
|
+
function getBundleInfo(NftId nftId) external view returns(BundleInfo memory bundleInfo);
|
54
49
|
|
55
50
|
// repeat service linked signatures to avoid linearization issues
|
56
51
|
function getProductService() external returns(IProductService);
|