@etherisc/gif-next 0.0.2-efdb520-159 → 0.0.2-f02157b-803
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 +176 -11
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +168 -28
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +4 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +610 -0
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +121 -28
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +152 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +74 -181
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +55 -177
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +447 -60
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +519 -70
- 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/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/AccessManagedSimple.sol/AccessManagedSimple.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagedSimple.sol/AccessManagedSimple.json +101 -0
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerSimple.sol/AccessManagerSimple.json +1119 -0
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +4 -0
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +1082 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +240 -1911
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/{service/ServiceBase.sol/ServiceBase.json → IInstanceService.sol/IInstanceService.json} +187 -66
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +2329 -1158
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +917 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1257 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +703 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +424 -0
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.json +481 -0
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +113 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +429 -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 +180 -59
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +502 -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/ServiceBase.sol/ServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/{InstanceBase.sol/InstanceBase.json → base/ServiceBase.sol/ServiceBase.json} +225 -70
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +211 -0
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{bundle/IBundle.sol → IBundle.sol}/IBundle.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.json +10 -0
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{policy/IPolicy.sol → IPolicy.sol}/IPolicy.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{access/IAccess.sol/IAccess.json → IRisk.sol/IRisk.json} +2 -2
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{pool/IPoolModule.sol/IPool.json → ISetup.sol/ISetup.json} +2 -2
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +4 -0
- package/artifacts/contracts/instance/module/{treasury/ITreasury.sol → ITreasury.sol}/ITreasury.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +393 -85
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +182 -80
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/{ComponentServiceBase.sol/ComponentServiceBase.json → IDistributionService.sol/IDistributionService.json} +209 -63
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +240 -55
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +330 -56
- 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 +1261 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +504 -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 +60 -19
- 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/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +96 -0
- 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 +83 -19
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +30 -6
- 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 +44 -10
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +277 -84
- 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 +14 -18
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +106 -50
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +4 -0
- package/artifacts/contracts/test/Usdc.sol/USDC.json +376 -0
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +4 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +104 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +4 -0
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +257 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +4 -0
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +125 -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/NumberId.sol/NumberIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.json +100 -0
- 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/Referral.sol/ReferralLib.dbg.json +4 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +123 -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 +4 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +156 -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/Timestamp.sol/TimestampLib.json +15 -2
- 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/UFixedLib.json +479 -0
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +101 -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 +20 -23
- package/contracts/components/Distribution.sol +166 -0
- package/contracts/components/IBaseComponent.sol +8 -3
- package/contracts/components/IDistributionComponent.sol +43 -0
- package/contracts/components/IPoolComponent.sol +14 -9
- package/contracts/components/IProductComponent.sol +25 -9
- package/contracts/components/Pool.sol +115 -30
- package/contracts/components/Product.sol +212 -32
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- package/contracts/instance/AccessManagedSimple.sol +114 -0
- package/contracts/instance/AccessManagerSimple.sol +682 -0
- package/contracts/instance/IAccessManagerSimple.sol +391 -0
- package/contracts/instance/IInstance.sol +17 -39
- package/contracts/instance/IInstanceService.sol +17 -0
- package/contracts/instance/Instance.sol +420 -46
- package/contracts/instance/InstanceAccessManager.sol +288 -0
- package/contracts/instance/InstanceReader.sol +280 -0
- package/contracts/instance/InstanceService.sol +102 -0
- package/contracts/instance/InstanceServiceManager.sol +56 -0
- package/contracts/instance/{service → base}/ComponentServiceBase.sol +13 -5
- package/contracts/instance/base/IInstanceBase.sol +23 -0
- package/contracts/instance/base/IKeyValueStore.sol +49 -0
- package/contracts/instance/base/ILifecycle.sol +30 -0
- package/contracts/instance/base/KeyValueStore.sol +172 -0
- package/contracts/instance/{module/lifecycle/LifecycleModule.sol → base/Lifecycle.sol} +51 -40
- package/contracts/instance/base/ServiceBase.sol +44 -0
- package/contracts/instance/module/IAccess.sol +38 -0
- package/contracts/instance/module/IBundle.sol +19 -0
- package/contracts/instance/module/IDistribution.sol +39 -0
- package/contracts/instance/module/IPolicy.sol +45 -0
- package/contracts/instance/module/IRisk.sol +11 -0
- package/contracts/instance/module/ISetup.sol +43 -0
- package/contracts/instance/module/ITreasury.sol +23 -0
- package/contracts/instance/service/ComponentOwnerService.sol +245 -102
- package/contracts/instance/service/IComponentOwnerService.sol +1 -3
- package/contracts/instance/service/IDistributionService.sol +12 -0
- package/contracts/instance/service/IPoolService.sol +8 -1
- package/contracts/instance/service/IProductService.sol +56 -7
- 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 +315 -273
- package/contracts/registry/RegistryService.sol +439 -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 +56 -12
- package/contracts/shared/NftOwnable.sol +136 -0
- package/contracts/shared/ProxyManager.sol +94 -0
- package/contracts/shared/Registerable.sol +62 -59
- package/contracts/shared/TokenHandler.sol +27 -0
- package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +112 -57
- package/contracts/test/TestFee.sol +4 -4
- package/contracts/test/TestRegisterable.sol +5 -6
- package/contracts/test/TestRoleId.sol +2 -2
- package/contracts/test/TestService.sol +7 -16
- package/contracts/test/TestVersion.sol +4 -7
- package/contracts/test/TestVersionable.sol +2 -5
- package/contracts/test/Usdc.sol +26 -0
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +44 -20
- package/contracts/types/Key32.sol +50 -0
- package/contracts/types/NftId.sol +16 -1
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +51 -14
- package/contracts/types/Referral.sol +85 -0
- package/contracts/types/RiskId.sol +43 -0
- package/contracts/types/RoleId.sol +57 -11
- package/contracts/types/StateId.sol +8 -2
- package/contracts/types/Timestamp.sol +7 -3
- package/contracts/types/UFixed.sol +144 -25
- package/contracts/types/Version.sol +38 -25
- package/package.json +4 -3
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.json +0 -24
- package/artifacts/contracts/instance/IServiceLinked.sol/IServiceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/IServiceLinked.sol/IServiceLinked.json +0 -50
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- 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/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +0 -276
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +0 -276
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +0 -188
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.json +0 -10
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.json +0 -188
- 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/module/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.json +0 -261
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -261
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -149
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -149
- package/artifacts/contracts/instance/module/product/IProductModule.sol/IProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/product/IProductModule.sol/IProductModule.json +0 -10
- package/artifacts/contracts/instance/module/product/ProductModule.sol/ProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/product/ProductModule.sol/ProductModule.json +0 -10
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +0 -538
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +0 -76
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +0 -538
- 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/PoolService.sol/PoolService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +0 -499
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +0 -685
- package/artifacts/contracts/instance/service/ServiceBase.sol/ServiceBase.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/test/TestPool.sol/TestPool.dbg.json +0 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +0 -387
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +0 -4
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +0 -393
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +0 -453
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/instance/IInstanceLinked.sol +0 -8
- package/contracts/instance/IServiceLinked.sol +0 -12
- package/contracts/instance/InstanceBase.sol +0 -74
- package/contracts/instance/module/access/Access.sol +0 -149
- package/contracts/instance/module/access/IAccess.sol +0 -53
- package/contracts/instance/module/bundle/BundleModule.sol +0 -228
- package/contracts/instance/module/bundle/IBundle.sol +0 -53
- package/contracts/instance/module/component/ComponentModule.sol +0 -104
- package/contracts/instance/module/component/IComponent.sol +0 -53
- package/contracts/instance/module/lifecycle/ILifecycle.sol +0 -47
- package/contracts/instance/module/policy/IPolicy.sol +0 -60
- package/contracts/instance/module/policy/PolicyModule.sol +0 -84
- package/contracts/instance/module/pool/IPoolModule.sol +0 -41
- package/contracts/instance/module/pool/PoolModule.sol +0 -87
- package/contracts/instance/module/product/IProductModule.sol +0 -6
- package/contracts/instance/module/product/ProductModule.sol +0 -8
- package/contracts/instance/module/treasury/ITreasury.sol +0 -104
- package/contracts/instance/module/treasury/TokenHandler.sol +0 -48
- package/contracts/instance/module/treasury/TreasuryModule.sol +0 -148
- package/contracts/instance/service/PoolService.sol +0 -98
- package/contracts/instance/service/ProductService.sol +0 -358
- package/contracts/instance/service/ServiceBase.sol +0 -39
- package/contracts/registry/IChainNft.sol +0 -21
- package/contracts/registry/IRegistryLinked.sol +0 -8
- package/contracts/shared/IOwnable.sol +0 -6
- package/contracts/test/TestPool.sol +0 -22
- package/contracts/test/TestProduct.sol +0 -44
- /package/contracts/instance/{service → base}/IService.sol +0 -0
@@ -1,20 +1,18 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
7
6
|
import {Registerable} from "../shared/Registerable.sol";
|
8
7
|
|
9
8
|
import {IRegistry} from "../registry/IRegistry.sol";
|
10
9
|
import {IInstance} from "../instance/IInstance.sol";
|
11
|
-
import {IServiceLinked} from "../instance/IServiceLinked.sol";
|
12
10
|
|
13
11
|
import {IInstance} from "../instance/IInstance.sol";
|
14
|
-
import {IComponent, IComponentModule} from "../instance/module/component/IComponent.sol";
|
15
12
|
import {IComponentOwnerService} from "../instance/service/IComponentOwnerService.sol";
|
16
13
|
import {IBaseComponent} from "./IBaseComponent.sol";
|
17
14
|
import {NftId} from "../types/NftId.sol";
|
15
|
+
import {ObjectType} from "../types/ObjectType.sol";
|
18
16
|
|
19
17
|
abstract contract BaseComponent is
|
20
18
|
Registerable,
|
@@ -26,15 +24,22 @@ abstract contract BaseComponent is
|
|
26
24
|
address internal _wallet;
|
27
25
|
IERC20Metadata internal _token;
|
28
26
|
IInstance internal _instance;
|
27
|
+
NftId internal _productNftId;
|
29
28
|
|
30
29
|
constructor(
|
31
30
|
address registry,
|
32
31
|
NftId instanceNftId,
|
33
|
-
|
32
|
+
NftId productNftId,
|
33
|
+
address token,
|
34
|
+
ObjectType componentType,
|
35
|
+
bool isInterceptor,
|
36
|
+
address initialOwner
|
34
37
|
)
|
35
|
-
Registerable(registry, instanceNftId)
|
36
38
|
{
|
37
|
-
|
39
|
+
bytes memory data = "";
|
40
|
+
_initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, data);
|
41
|
+
|
42
|
+
IRegistry.ObjectInfo memory instanceInfo = getRegistry().getObjectInfo(instanceNftId);
|
38
43
|
_instance = IInstance(instanceInfo.objectAddress);
|
39
44
|
require(
|
40
45
|
_instance.supportsInterface(type(IInstance).interfaceId),
|
@@ -44,21 +49,9 @@ abstract contract BaseComponent is
|
|
44
49
|
_componentOwnerService = _instance.getComponentOwnerService();
|
45
50
|
_wallet = address(this);
|
46
51
|
_token = IERC20Metadata(token);
|
47
|
-
|
52
|
+
_productNftId = productNftId;
|
48
53
|
|
49
|
-
|
50
|
-
function register() public override(IRegisterable, Registerable) returns (NftId componentId) {
|
51
|
-
require(msg.sender == getOwner(), "");
|
52
|
-
require(
|
53
|
-
address(_registry) != address(0),
|
54
|
-
"ERROR:COB-001:REGISTRY_ZERO"
|
55
|
-
);
|
56
|
-
require(
|
57
|
-
_registry.isRegistered(address(_instance)),
|
58
|
-
"ERROR:COB:INSTANCE_NOT_REGISTERED"
|
59
|
-
);
|
60
|
-
|
61
|
-
componentId = _componentOwnerService.register(this);
|
54
|
+
_registerInterface(type(IBaseComponent).interfaceId);
|
62
55
|
}
|
63
56
|
|
64
57
|
// from component contract
|
@@ -79,11 +72,15 @@ abstract contract BaseComponent is
|
|
79
72
|
return _wallet;
|
80
73
|
}
|
81
74
|
|
82
|
-
function getToken()
|
75
|
+
function getToken() public view override returns (IERC20Metadata token) {
|
83
76
|
return _token;
|
84
77
|
}
|
85
78
|
|
86
|
-
function getInstance()
|
79
|
+
function getInstance() public view override returns (IInstance instance) {
|
87
80
|
return _instance;
|
88
81
|
}
|
82
|
+
|
83
|
+
function getProductNftId() public view override returns (NftId productNftId) {
|
84
|
+
return _productNftId;
|
85
|
+
}
|
89
86
|
}
|
@@ -0,0 +1,166 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {DISTRIBUTION} from "../types/ObjectType.sol";
|
5
|
+
import {IDistributionService} from "../instance/service/IDistributionService.sol";
|
6
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
7
|
+
import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
8
|
+
import {ReferralId} from "../types/Referral.sol";
|
9
|
+
import {Fee, FeeLib} from "../types/Fee.sol";
|
10
|
+
import {BaseComponent} from "./BaseComponent.sol";
|
11
|
+
import {IDistributionComponent} from "./IDistributionComponent.sol";
|
12
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
13
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
14
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
15
|
+
import {Registerable} from "../shared/Registerable.sol";
|
16
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
17
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
18
|
+
|
19
|
+
contract Distribution is
|
20
|
+
BaseComponent,
|
21
|
+
IDistributionComponent
|
22
|
+
{
|
23
|
+
using NftIdLib for NftId;
|
24
|
+
|
25
|
+
Fee internal _initialDistributionFee;
|
26
|
+
bool internal _isVerifying;
|
27
|
+
|
28
|
+
IDistributionService private _distributionService;
|
29
|
+
IProductService private _productService;
|
30
|
+
|
31
|
+
modifier onlyProductService() {
|
32
|
+
require(
|
33
|
+
msg.sender == address(_productService),
|
34
|
+
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
35
|
+
_;
|
36
|
+
}
|
37
|
+
|
38
|
+
constructor(
|
39
|
+
address registry,
|
40
|
+
NftId instanceNftId,
|
41
|
+
NftId productNftId,
|
42
|
+
// TODO refactor into tokenNftId
|
43
|
+
address token,
|
44
|
+
bool verifying,
|
45
|
+
Fee memory distributionFee,
|
46
|
+
address initialOwner
|
47
|
+
)
|
48
|
+
BaseComponent(registry, instanceNftId, productNftId, token, DISTRIBUTION(), true, initialOwner)
|
49
|
+
{
|
50
|
+
_isVerifying = verifying;
|
51
|
+
_initialDistributionFee = distributionFee;
|
52
|
+
|
53
|
+
// TODO: reactivate when services are available again
|
54
|
+
// _distributionService = _instance.getDistributionService();
|
55
|
+
// _productService = _instance.getProductService();
|
56
|
+
|
57
|
+
_registerInterface(type(IDistributionComponent).interfaceId);
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
function setFees(
|
62
|
+
Fee memory distributionFee
|
63
|
+
)
|
64
|
+
external
|
65
|
+
override
|
66
|
+
{
|
67
|
+
_distributionService.setFees(distributionFee);
|
68
|
+
}
|
69
|
+
|
70
|
+
function calculateFeeAmount(
|
71
|
+
ReferralId referralId,
|
72
|
+
uint256 netPremiumAmount
|
73
|
+
)
|
74
|
+
external
|
75
|
+
view
|
76
|
+
virtual override
|
77
|
+
returns (uint256 feeAmount)
|
78
|
+
{
|
79
|
+
ISetup.DistributionSetupInfo memory setupInfo = getSetupInfo();
|
80
|
+
Fee memory fee = setupInfo.distributionFee;
|
81
|
+
(feeAmount,) = FeeLib.calculateFee(fee, netPremiumAmount);
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
function calculateRenewalFeeAmount(
|
86
|
+
ReferralId referralId,
|
87
|
+
uint256 netPremiumAmount
|
88
|
+
)
|
89
|
+
external
|
90
|
+
view
|
91
|
+
virtual override
|
92
|
+
returns (uint256 feeAmount)
|
93
|
+
{
|
94
|
+
// default is no fees
|
95
|
+
return 0 * netPremiumAmount;
|
96
|
+
}
|
97
|
+
|
98
|
+
function processSale(
|
99
|
+
ReferralId referralId,
|
100
|
+
uint256 feeAmount
|
101
|
+
)
|
102
|
+
external
|
103
|
+
onlyProductService
|
104
|
+
virtual override
|
105
|
+
{
|
106
|
+
// default is no action
|
107
|
+
}
|
108
|
+
|
109
|
+
function processRenewal(
|
110
|
+
ReferralId referralId,
|
111
|
+
uint256 feeAmount
|
112
|
+
)
|
113
|
+
external
|
114
|
+
onlyProductService
|
115
|
+
virtual override
|
116
|
+
{
|
117
|
+
// default is no action
|
118
|
+
}
|
119
|
+
|
120
|
+
function referralIsValid(ReferralId referralId) external view returns (bool isValid) {
|
121
|
+
// default is invalid
|
122
|
+
return false;
|
123
|
+
}
|
124
|
+
|
125
|
+
function getSetupInfo() public view returns (ISetup.DistributionSetupInfo memory setupInfo) {
|
126
|
+
if (getNftId().eq(zeroNftId())) {
|
127
|
+
return ISetup.DistributionSetupInfo(
|
128
|
+
_productNftId,
|
129
|
+
TokenHandler(address(0)),
|
130
|
+
_initialDistributionFee,
|
131
|
+
_isVerifying,
|
132
|
+
address(0)
|
133
|
+
);
|
134
|
+
}
|
135
|
+
|
136
|
+
InstanceReader reader = _instance.getInstanceReader();
|
137
|
+
return reader.getDistributionSetupInfo(getNftId());
|
138
|
+
}
|
139
|
+
|
140
|
+
/// @dev returns true iff the component needs to be called when selling/renewing policis
|
141
|
+
function isVerifying() external view returns (bool verifying) {
|
142
|
+
return _isVerifying;
|
143
|
+
}
|
144
|
+
|
145
|
+
// from IRegisterable
|
146
|
+
|
147
|
+
function getInitialInfo()
|
148
|
+
public
|
149
|
+
view
|
150
|
+
override (IRegisterable, Registerable)
|
151
|
+
returns(IRegistry.ObjectInfo memory, bytes memory)
|
152
|
+
{
|
153
|
+
(
|
154
|
+
IRegistry.ObjectInfo memory info,
|
155
|
+
bytes memory data
|
156
|
+
) = super.getInitialInfo();
|
157
|
+
|
158
|
+
return (
|
159
|
+
info,
|
160
|
+
abi.encode(
|
161
|
+
_initialDistributionFee,
|
162
|
+
_isVerifying
|
163
|
+
)
|
164
|
+
);
|
165
|
+
}
|
166
|
+
}
|
@@ -1,12 +1,13 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
6
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
7
|
-
import {
|
7
|
+
import {IInstance} from "../instance/IInstance.sol";
|
8
|
+
import {NftId} from "../types/NftId.sol";
|
8
9
|
|
9
|
-
interface IBaseComponent is IRegisterable
|
10
|
+
interface IBaseComponent is IRegisterable {
|
10
11
|
|
11
12
|
function lock() external;
|
12
13
|
|
@@ -16,4 +17,8 @@ interface IBaseComponent is IRegisterable, IInstanceLinked {
|
|
16
17
|
|
17
18
|
function getWallet() external view returns (address walletAddress);
|
18
19
|
|
20
|
+
function getInstance() external view returns (IInstance instance);
|
21
|
+
|
22
|
+
function getProductNftId() external view returns (NftId productNftId);
|
23
|
+
|
19
24
|
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.19;
|
3
|
+
|
4
|
+
import {Fee} from "../types/Fee.sol";
|
5
|
+
import {ReferralId} from "../types/Referral.sol";
|
6
|
+
import {NftId} from "../types/NftId.sol";
|
7
|
+
|
8
|
+
interface IDistributionComponent {
|
9
|
+
|
10
|
+
function setFees(
|
11
|
+
Fee memory distributionFee
|
12
|
+
) external;
|
13
|
+
|
14
|
+
function calculateFeeAmount(
|
15
|
+
ReferralId referralId,
|
16
|
+
uint256 netPremiumAmount
|
17
|
+
) external view returns (uint256 feeAmount);
|
18
|
+
|
19
|
+
function calculateRenewalFeeAmount(
|
20
|
+
ReferralId referralId,
|
21
|
+
uint256 netPremiumAmount
|
22
|
+
) external view returns (uint256 feeAmount);
|
23
|
+
|
24
|
+
/// @dev callback from product service when selling a policy for a specific referralId
|
25
|
+
/// the used referral id and the collected fee are provided as parameters
|
26
|
+
/// the component implementation can then process this information accordingly
|
27
|
+
function processSale(
|
28
|
+
ReferralId referralId,
|
29
|
+
uint256 feeAmount
|
30
|
+
) external;
|
31
|
+
|
32
|
+
/// @dev callback from product service when a policy is renews for a specific referralId
|
33
|
+
function processRenewal(
|
34
|
+
ReferralId referralId,
|
35
|
+
uint256 feeAmount
|
36
|
+
) external;
|
37
|
+
|
38
|
+
/// @dev returns true iff the referral id is valid
|
39
|
+
function referralIsValid(ReferralId referralId) external view returns (bool isValid);
|
40
|
+
|
41
|
+
/// @dev returns true iff the component needs to be called when selling/renewing policis
|
42
|
+
function isVerifying() external view returns (bool verifying);
|
43
|
+
}
|
@@ -1,24 +1,35 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {NftId} from "../types/NftId.sol";
|
5
5
|
import {Fee} from "../types/Fee.sol";
|
6
6
|
import {UFixed} from "../types/UFixed.sol";
|
7
|
-
import {IBaseComponent} from "./IBaseComponent.sol";
|
8
7
|
|
9
|
-
interface IPoolComponent
|
8
|
+
interface IPoolComponent {
|
10
9
|
|
11
10
|
event LogUnderwrittenByPool(NftId policyNftId, uint256 collateralizationAmount, address pool);
|
12
11
|
|
12
|
+
function setFees(
|
13
|
+
Fee memory poolFee,
|
14
|
+
Fee memory stakingFee,
|
15
|
+
Fee memory performanceFee
|
16
|
+
) external;
|
17
|
+
|
13
18
|
/**
|
14
19
|
* @dev creates a new bundle for this pool.
|
15
20
|
*/
|
16
21
|
function createBundle(
|
22
|
+
Fee memory fee,
|
17
23
|
uint256 initialAmount,
|
18
24
|
uint256 lifetime,
|
19
25
|
bytes memory filter
|
20
26
|
) external returns(NftId bundleNftId);
|
21
27
|
|
28
|
+
function setBundleFee(
|
29
|
+
NftId policyNftId,
|
30
|
+
Fee memory fee
|
31
|
+
) external;
|
32
|
+
|
22
33
|
/**
|
23
34
|
* @dev this is a callback function that is called by the product service when underwriting a policy.
|
24
35
|
* the pool has the option to check the details and object to underwriting by reverting.
|
@@ -48,10 +59,4 @@ interface IPoolComponent is IBaseComponent {
|
|
48
59
|
|
49
60
|
function getCollateralizationLevel() external view returns (UFixed collateralizationLevel);
|
50
61
|
|
51
|
-
function getStakingFee() external view returns (Fee memory stakingFee);
|
52
|
-
|
53
|
-
function getPerformanceFee()
|
54
|
-
external
|
55
|
-
view
|
56
|
-
returns (Fee memory performanceFee);
|
57
62
|
}
|
@@ -1,19 +1,35 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {NftId} from "../types/NftId.sol";
|
5
4
|
import {Fee} from "../types/Fee.sol";
|
6
|
-
import {
|
5
|
+
import {NftId} from "../types/NftId.sol";
|
6
|
+
import {ReferralId} from "../types/Referral.sol";
|
7
|
+
import {RiskId} from "../types/RiskId.sol";
|
8
|
+
|
9
|
+
interface IProductComponent {
|
7
10
|
|
8
|
-
interface IProductComponent is IBaseComponent {
|
9
11
|
function setFees(
|
10
|
-
Fee memory
|
12
|
+
Fee memory productFee,
|
11
13
|
Fee memory processingFee
|
12
14
|
) external;
|
13
15
|
|
14
|
-
function
|
15
|
-
|
16
|
-
|
16
|
+
function calculatePremium(
|
17
|
+
uint256 sumInsuredAmount,
|
18
|
+
RiskId riskId,
|
19
|
+
uint256 lifetime,
|
20
|
+
bytes memory applicationData,
|
21
|
+
ReferralId referralId,
|
22
|
+
NftId bundleNftId
|
23
|
+
) external view returns (uint256 premiumAmount);
|
24
|
+
|
25
|
+
function calculateNetPremium(
|
26
|
+
uint256 sumInsuredAmount,
|
27
|
+
RiskId riskId,
|
28
|
+
uint256 lifetime,
|
29
|
+
bytes memory applicationData
|
30
|
+
) external view returns (uint256 netPremiumAmount);
|
17
31
|
|
18
|
-
|
32
|
+
|
33
|
+
function getPoolNftId() external view returns (NftId poolNftId);
|
34
|
+
function getDistributionNftId() external view returns (NftId distributionNftId);
|
19
35
|
}
|
@@ -1,20 +1,37 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {ObjectType, POOL} from "../types/ObjectType.sol";
|
5
5
|
import {IProductService} from "../instance/service/IProductService.sol";
|
6
6
|
import {IPoolService} from "../instance/service/IPoolService.sol";
|
7
|
-
import {NftId} from "../types/NftId.sol";
|
7
|
+
import {NftId, zeroNftId, NftIdLib} from "../types/NftId.sol";
|
8
8
|
import {Fee} from "../types/Fee.sol";
|
9
9
|
import {UFixed} from "../types/UFixed.sol";
|
10
10
|
import {IPoolComponent} from "./IPoolComponent.sol";
|
11
11
|
import {BaseComponent} from "./BaseComponent.sol";
|
12
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
13
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
14
|
+
|
15
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
16
|
+
|
17
|
+
// import {IPool} from "../instance/module/pool/IPoolModule.sol";
|
18
|
+
import {ITreasury} from "../instance/module/ITreasury.sol";
|
19
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
20
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
21
|
+
|
22
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
23
|
+
import {Registerable} from "../shared/Registerable.sol";
|
12
24
|
|
13
25
|
contract Pool is BaseComponent, IPoolComponent {
|
26
|
+
using NftIdLib for NftId;
|
14
27
|
|
15
28
|
bool internal _isVerifying;
|
16
29
|
UFixed internal _collateralizationLevel;
|
17
30
|
|
31
|
+
Fee internal _initialPoolFee;
|
32
|
+
Fee internal _initialStakingFee;
|
33
|
+
Fee internal _initialPerformanceFee;
|
34
|
+
|
18
35
|
// may be used to interact with instance by derived contracts
|
19
36
|
IPoolService internal _poolService;
|
20
37
|
|
@@ -38,22 +55,35 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
38
55
|
constructor(
|
39
56
|
address registry,
|
40
57
|
NftId instanceNftId,
|
58
|
+
NftId productNftId,
|
41
59
|
// TODO refactor into tokenNftId
|
42
60
|
address token,
|
61
|
+
bool isInterceptor,
|
43
62
|
bool verifying,
|
44
|
-
UFixed collateralizationLevel
|
63
|
+
UFixed collateralizationLevel,
|
64
|
+
Fee memory poolFee,
|
65
|
+
Fee memory stakingFee,
|
66
|
+
Fee memory performanceFee,
|
67
|
+
address initialOwner
|
45
68
|
)
|
46
|
-
BaseComponent(registry, instanceNftId, token)
|
69
|
+
BaseComponent(registry, instanceNftId, productNftId, token, POOL(), isInterceptor, initialOwner)
|
47
70
|
{
|
48
71
|
_isVerifying = verifying;
|
49
72
|
// TODO add validation
|
50
73
|
_collateralizationLevel = collateralizationLevel;
|
74
|
+
_initialPoolFee = poolFee;
|
75
|
+
_initialStakingFee = stakingFee;
|
76
|
+
_initialPerformanceFee = performanceFee;
|
77
|
+
|
78
|
+
// TODO: reactivate when services are available again
|
79
|
+
// _poolService = _instance.getPoolService();
|
80
|
+
// _productService = _instance.getProductService();
|
51
81
|
|
52
|
-
|
53
|
-
_productService = _instance.getProductService();
|
82
|
+
_registerInterface(type(IPoolComponent).interfaceId);
|
54
83
|
}
|
55
84
|
|
56
85
|
function createBundle(
|
86
|
+
Fee memory fee,
|
57
87
|
uint256 initialAmount,
|
58
88
|
uint256 lifetime,
|
59
89
|
bytes memory filter
|
@@ -65,6 +95,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
65
95
|
address owner = msg.sender;
|
66
96
|
bundleNftId = _poolService.createBundle(
|
67
97
|
owner,
|
98
|
+
fee,
|
68
99
|
initialAmount,
|
69
100
|
lifetime,
|
70
101
|
filter
|
@@ -115,6 +146,82 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
115
146
|
return _collateralizationLevel;
|
116
147
|
}
|
117
148
|
|
149
|
+
function setFees(
|
150
|
+
Fee memory poolFee,
|
151
|
+
Fee memory stakingFee,
|
152
|
+
Fee memory performanceFee
|
153
|
+
)
|
154
|
+
external
|
155
|
+
onlyOwner
|
156
|
+
override
|
157
|
+
{
|
158
|
+
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
159
|
+
}
|
160
|
+
|
161
|
+
function setBundleFee(
|
162
|
+
NftId bundleNftId,
|
163
|
+
Fee memory fee
|
164
|
+
)
|
165
|
+
external
|
166
|
+
override
|
167
|
+
// TODO add onlyBundleOwner
|
168
|
+
{
|
169
|
+
_poolService.setBundleFee(bundleNftId, fee);
|
170
|
+
}
|
171
|
+
|
172
|
+
function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
|
173
|
+
// TODO fix this
|
174
|
+
if (getNftId().eq(zeroNftId())) {
|
175
|
+
return ISetup.PoolSetupInfo(
|
176
|
+
_productNftId,
|
177
|
+
TokenHandler(address(0)),
|
178
|
+
_collateralizationLevel,
|
179
|
+
_initialPoolFee,
|
180
|
+
_initialStakingFee,
|
181
|
+
_initialPerformanceFee,
|
182
|
+
_isVerifying,
|
183
|
+
_wallet
|
184
|
+
);
|
185
|
+
}
|
186
|
+
|
187
|
+
InstanceReader reader = _instance.getInstanceReader();
|
188
|
+
return reader.getPoolSetupInfo(getNftId());
|
189
|
+
}
|
190
|
+
|
191
|
+
// from IRegisterable
|
192
|
+
|
193
|
+
// TODO used only once, occupies space
|
194
|
+
// TODO do not use super
|
195
|
+
function getInitialInfo()
|
196
|
+
public
|
197
|
+
view
|
198
|
+
override (IRegisterable, Registerable)
|
199
|
+
returns (IRegistry.ObjectInfo memory, bytes memory)
|
200
|
+
{
|
201
|
+
(
|
202
|
+
IRegistry.ObjectInfo memory info,
|
203
|
+
bytes memory data
|
204
|
+
) = super.getInitialInfo();
|
205
|
+
|
206
|
+
return (
|
207
|
+
info,
|
208
|
+
abi.encode(
|
209
|
+
ISetup.PoolSetupInfo(
|
210
|
+
getProductNftId(),
|
211
|
+
TokenHandler(address(0)),
|
212
|
+
_collateralizationLevel,
|
213
|
+
_initialPoolFee,
|
214
|
+
_initialStakingFee,
|
215
|
+
_initialPerformanceFee,
|
216
|
+
_isVerifying,
|
217
|
+
_wallet
|
218
|
+
)
|
219
|
+
)
|
220
|
+
);
|
221
|
+
}
|
222
|
+
|
223
|
+
// Internals
|
224
|
+
|
118
225
|
function _underwrite(
|
119
226
|
NftId policyNftId,
|
120
227
|
bytes memory policyData,
|
@@ -133,6 +240,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
133
240
|
|
134
241
|
function _createBundle(
|
135
242
|
address bundleOwner,
|
243
|
+
Fee memory fee,
|
136
244
|
uint256 amount,
|
137
245
|
uint256 lifetime,
|
138
246
|
bytes calldata filter
|
@@ -142,33 +250,10 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
142
250
|
{
|
143
251
|
bundleNftId = _poolService.createBundle(
|
144
252
|
bundleOwner,
|
253
|
+
fee,
|
145
254
|
amount,
|
146
255
|
lifetime,
|
147
256
|
filter
|
148
257
|
);
|
149
258
|
}
|
150
|
-
|
151
|
-
// from pool component
|
152
|
-
function getStakingFee()
|
153
|
-
external
|
154
|
-
view
|
155
|
-
override
|
156
|
-
returns (Fee memory stakingFee)
|
157
|
-
{
|
158
|
-
return _instance.getPoolSetup(getNftId()).stakingFee;
|
159
|
-
}
|
160
|
-
|
161
|
-
function getPerformanceFee()
|
162
|
-
external
|
163
|
-
view
|
164
|
-
override
|
165
|
-
returns (Fee memory performanceFee)
|
166
|
-
{
|
167
|
-
return _instance.getPoolSetup(getNftId()).performanceFee;
|
168
|
-
}
|
169
|
-
|
170
|
-
// from registerable
|
171
|
-
function getType() public pure override returns (ObjectType) {
|
172
|
-
return POOL();
|
173
|
-
}
|
174
259
|
}
|