@etherisc/gif-next 0.0.2-f74fcad-685 → 0.0.2-f7b8c9f-436
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +160 -6
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +4 -0
- package/artifacts/contracts/{instance/component/ComponentModule.sol/ComponentModule.json → components/BaseComponent.sol/BaseComponent.json} +152 -150
- 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 +4 -0
- package/artifacts/contracts/components/{IPool.sol/IPoolComponent.json → IBaseComponent.sol/IBaseComponent.json} +115 -116
- 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 +4 -0
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +308 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +4 -0
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +207 -0
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +471 -83
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +345 -77
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1430 -660
- package/artifacts/contracts/instance/IInstanceLinked.sol/IInstanceLinked.dbg.json +4 -0
- package/artifacts/contracts/instance/{component/IComponent.sol → IInstanceLinked.sol}/IInstanceLinked.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +1759 -801
- 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 +560 -0
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/{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/base/IService.sol/IService.json +421 -0
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.json +544 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +710 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +169 -0
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.json +10 -0
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.json +468 -0
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{access → module/access}/Access.sol/AccessModule.json +85 -152
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/instance/{access → module/access}/IAccess.sol/IAccess.json +1 -1
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{access → module/access}/IAccess.sol/IAccessModule.json +96 -99
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +297 -0
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.dbg.json +4 -0
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundle.json +10 -0
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/bundle/IBundle.sol/IBundleModule.json +297 -0
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{pool/IPoolModule.sol/IPoolModule.json → module/component/ComponentModule.sol/ComponentModule.json} +49 -61
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/instance/{component → module/component}/IComponent.sol/IComponent.json +1 -1
- package/artifacts/contracts/instance/module/component/IComponent.sol/IComponentModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{product/IProductService.sol/IProductService.json → module/component/IComponent.sol/IComponentModule.json} +51 -61
- 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/distribution/IDistribution.sol/IDistribution.json +10 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.json +10 -0
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicy.dbg.json +4 -0
- package/artifacts/contracts/instance/{policy → module/policy}/IPolicy.sol/IPolicy.json +1 -1
- package/artifacts/contracts/instance/module/policy/IPolicy.sol/IPolicyModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{policy → module/policy}/IPolicy.sol/IPolicyModule.json +136 -119
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{policy → module/policy}/PolicyModule.sol/PolicyModule.json +137 -120
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +4 -0
- package/artifacts/contracts/instance/{pool → module/pool}/IPoolModule.sol/IPool.json +1 -1
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +164 -0
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +4 -0
- package/artifacts/contracts/instance/{pool → module/pool}/PoolModule.sol/PoolModule.json +66 -57
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +4 -0
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.json +10 -0
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +113 -0
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +131 -0
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasury.dbg.json +4 -0
- package/artifacts/contracts/instance/{treasury → module/treasury}/ITreasury.sol/ITreasury.json +1 -1
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/treasury/ITreasury.sol/ITreasuryModule.json +638 -0
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/instance/module/treasury/TokenHandler.sol/TokenHandler.json +76 -0
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +4 -0
- package/artifacts/contracts/instance/module/treasury/TreasuryModule.sol/TreasuryModule.json +638 -0
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +794 -0
- 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 +4 -0
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +466 -0
- 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 +4 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +561 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +751 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +753 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +1068 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +194 -2
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +5 -0
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +408 -32
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +745 -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 +637 -52
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +997 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +468 -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 +4 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +35 -0
- 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 +4 -0
- package/artifacts/contracts/{components/Component.sol/Component.json → shared/IRegisterable.sol/IRegisterable.json} +98 -102
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +4 -0
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +205 -0
- 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 +4 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +274 -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 +4 -0
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +228 -0
- 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 +4 -0
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +119 -0
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +4 -0
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +716 -0
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +4 -0
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +744 -0
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +4 -0
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +305 -0
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +4 -0
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +116 -0
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +4 -0
- package/artifacts/contracts/test/TestService.sol/TestService.json +584 -0
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +4 -0
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +338 -0
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +4 -0
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +218 -0
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +4 -0
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +270 -0
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +4 -0
- package/artifacts/contracts/{mock → test}/Usdc.sol/USDC.json +3 -3
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +4 -0
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.json +10 -0
- 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 +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 +111 -0
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +65 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +4 -0
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +10 -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/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 +4 -0
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +30 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +64 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.json +58 -58
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +4 -0
- package/artifacts/contracts/types/Version.sol/VersionLib.json +177 -0
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +4 -0
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +30 -0
- package/contracts/components/BaseComponent.sol +79 -0
- package/contracts/components/Distribution.sol +155 -0
- package/contracts/components/IBaseComponent.sol +19 -0
- package/contracts/components/IDistributionComponent.sol +46 -0
- package/contracts/components/IPoolComponent.sol +64 -0
- package/contracts/components/IProductComponent.sol +37 -0
- package/contracts/components/Pool.sol +218 -24
- package/contracts/components/Product.sol +248 -38
- package/contracts/instance/IInstance.sol +40 -11
- package/contracts/instance/IInstanceLinked.sol +8 -0
- package/contracts/instance/Instance.sol +60 -45
- package/contracts/instance/base/ComponentServiceBase.sol +49 -0
- package/contracts/instance/base/IInstanceBase.sol +23 -0
- package/contracts/instance/base/IKeyValueStore.sol +50 -0
- package/contracts/instance/{lifecycle → base}/ILifecycle.sol +4 -21
- package/contracts/instance/base/IService.sol +15 -0
- package/contracts/instance/base/InstanceBase.sol +89 -0
- package/contracts/instance/base/KeyValueStore.sol +161 -0
- package/contracts/instance/base/Lifecycle.sol +100 -0
- package/contracts/instance/base/ModuleBase.sol +57 -0
- package/contracts/instance/base/ServiceBase.sol +44 -0
- package/contracts/instance/module/access/Access.sol +149 -0
- package/contracts/instance/module/access/IAccess.sol +53 -0
- package/contracts/instance/module/bundle/BundleModule.sol +134 -0
- package/contracts/instance/module/bundle/IBundle.sol +53 -0
- package/contracts/instance/module/component/ComponentModule.sol +71 -0
- package/contracts/instance/module/component/IComponent.sol +28 -0
- 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 +63 -0
- package/contracts/instance/module/policy/PolicyModule.sol +91 -0
- package/contracts/instance/module/pool/IPoolModule.sol +41 -0
- package/contracts/instance/module/pool/PoolModule.sol +95 -0
- package/contracts/instance/module/risk/IRisk.sol +26 -0
- package/contracts/instance/module/risk/RiskModule.sol +62 -0
- package/contracts/instance/module/treasury/ITreasury.sol +84 -0
- package/contracts/instance/module/treasury/TokenHandler.sol +48 -0
- package/contracts/instance/module/treasury/TreasuryModule.sol +131 -0
- package/contracts/instance/service/ComponentOwnerService.sol +275 -0
- package/contracts/instance/service/DistributionService.sol +54 -0
- package/contracts/instance/service/IComponentOwnerService.sol +20 -0
- package/contracts/instance/service/IDistributionService.sol +12 -0
- package/contracts/instance/service/IPoolService.sol +37 -0
- package/contracts/instance/service/IProductService.sol +107 -0
- package/contracts/instance/service/PoolService.sol +149 -0
- package/contracts/instance/service/ProductService.sol +510 -0
- package/contracts/registry/ChainNft.sol +94 -42
- package/contracts/registry/IChainNft.sol +3 -2
- package/contracts/registry/IRegistry.sol +50 -44
- package/contracts/registry/IRegistryService.sol +29 -0
- package/contracts/registry/ITransferInterceptor.sol +6 -0
- package/contracts/registry/Registry.sol +435 -126
- package/contracts/registry/RegistryService.sol +368 -0
- package/contracts/registry/RegistryServiceManager.sol +43 -0
- package/contracts/shared/ContractDeployerLib.sol +72 -0
- package/contracts/shared/ERC165.sol +21 -0
- package/contracts/shared/INftOwnable.sol +22 -0
- package/contracts/shared/IRegisterable.sol +17 -0
- package/contracts/shared/IVersionable.sol +96 -0
- package/contracts/shared/NftOwnable.sol +136 -0
- package/contracts/shared/ProxyManager.sol +94 -0
- package/contracts/shared/Registerable.sol +89 -0
- package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +147 -0
- package/contracts/test/TestDistribution.sol +22 -0
- package/contracts/test/TestFee.sol +25 -0
- package/contracts/test/TestPool.sol +27 -0
- package/contracts/test/TestProduct.sol +74 -0
- package/contracts/test/TestRegisterable.sol +18 -0
- package/contracts/test/TestRoleId.sol +14 -0
- package/contracts/test/TestService.sol +26 -0
- package/contracts/{mock/Dip.sol → test/TestToken.sol} +5 -5
- package/contracts/test/TestVersion.sol +44 -0
- package/contracts/test/TestVersionable.sol +17 -0
- package/contracts/{mock → test}/Usdc.sol +1 -1
- package/contracts/types/AddressSet.sol +58 -0
- package/contracts/types/Fee.sol +44 -20
- package/contracts/types/Key32.sol +45 -0
- package/contracts/types/NftId.sol +22 -1
- package/contracts/types/NftIdSet.sol +60 -0
- package/contracts/types/ObjectType.sol +37 -13
- package/contracts/types/ReferralId.sol +48 -0
- package/contracts/types/RiskId.sol +43 -0
- package/contracts/types/RoleId.sol +38 -0
- package/contracts/types/StateId.sol +13 -3
- package/contracts/types/Timestamp.sol +22 -1
- package/contracts/types/UFixed.sol +12 -13
- package/contracts/types/Version.sol +104 -0
- package/package.json +8 -3
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +0 -4
- package/artifacts/contracts/components/Component.sol/InstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/components/Component.sol/InstanceLinked.json +0 -35
- package/artifacts/contracts/components/IPool.sol/IPoolComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IProduct.sol/IProductComponent.json +0 -74
- package/artifacts/contracts/instance/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessCheckRole.json +0 -35
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.dbg.json +0 -4
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessComponentTypeRoles.json +0 -50
- package/artifacts/contracts/instance/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/ComponentModule.sol/ComponentOwnerService.json +0 -202
- package/artifacts/contracts/instance/component/IComponent.sol/IComponent.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentContract.json +0 -205
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentModule.json +0 -217
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/component/IComponent.sol/IComponentOwnerService.json +0 -141
- package/artifacts/contracts/instance/component/IComponent.sol/IInstanceLinked.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycle.json +0 -134
- package/artifacts/contracts/instance/lifecycle/ILifecycle.sol/ILifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/lifecycle/LifecycleModule.sol/LifecycleModule.json +0 -221
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicy.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/IPolicy.sol/IPolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/IProductService.sol/IProductModule.json +0 -75
- package/artifacts/contracts/instance/product/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductModule.json +0 -75
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/instance/product/ProductService.sol/ProductService.json +0 -196
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/ITreasury.sol/ITreasuryModule.json +0 -490
- package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/TokenHandler.sol/TokenHandler.json +0 -45
- package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.dbg.json +0 -4
- package/artifacts/contracts/instance/treasury/TreasuryModule.sol/TreasuryModule.json +0 -490
- package/artifacts/contracts/mock/Dip.sol/DIP.dbg.json +0 -4
- package/artifacts/contracts/mock/Dip.sol/DIP.json +0 -338
- package/artifacts/contracts/mock/TestPool.sol/TestPool.dbg.json +0 -4
- package/artifacts/contracts/mock/TestPool.sol/TestPool.json +0 -294
- package/artifacts/contracts/mock/TestProduct.sol/TestProduct.dbg.json +0 -4
- package/artifacts/contracts/mock/TestProduct.sol/TestProduct.json +0 -384
- package/artifacts/contracts/mock/Usdc.sol/USDC.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IOwnable.json +0 -24
- package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IRegisterable.json +0 -166
- package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistry.sol/IRegistryLinked.json +0 -49
- package/artifacts/contracts/registry/Registry.sol/Registerable.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/Registerable.json +0 -166
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/Registry.sol/RegistryLinked.json +0 -60
- package/contracts/components/Component.sol +0 -77
- package/contracts/components/IPool.sol +0 -15
- package/contracts/components/IProduct.sol +0 -16
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/instance/access/Access.sol +0 -165
- package/contracts/instance/access/IAccess.sol +0 -63
- package/contracts/instance/component/ComponentModule.sol +0 -274
- package/contracts/instance/component/IComponent.sol +0 -74
- package/contracts/instance/lifecycle/LifecycleModule.sol +0 -88
- package/contracts/instance/policy/IPolicy.sol +0 -50
- package/contracts/instance/policy/PolicyModule.sol +0 -114
- package/contracts/instance/pool/IPoolModule.sol +0 -23
- package/contracts/instance/pool/PoolModule.sol +0 -81
- package/contracts/instance/product/IProductService.sol +0 -36
- package/contracts/instance/product/ProductService.sol +0 -136
- package/contracts/instance/treasury/ITreasury.sol +0 -91
- package/contracts/instance/treasury/TokenHandler.sol +0 -24
- package/contracts/instance/treasury/TreasuryModule.sol +0 -168
- package/contracts/mock/TestPool.sol +0 -16
- package/contracts/mock/TestProduct.sol +0 -39
@@ -1,52 +1,246 @@
|
|
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
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
6
|
+
import {IPoolService} from "../instance/service/IPoolService.sol";
|
7
|
+
import {NftId} from "../types/NftId.sol";
|
5
8
|
import {Fee} from "../types/Fee.sol";
|
6
|
-
import {
|
7
|
-
import {
|
9
|
+
import {UFixed} from "../types/UFixed.sol";
|
10
|
+
import {IPoolComponent} from "./IPoolComponent.sol";
|
11
|
+
import {BaseComponent} from "./BaseComponent.sol";
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
13
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
14
|
+
import {IPool} from "../instance/module/pool/IPoolModule.sol";
|
15
|
+
import {ITreasury} from "../instance/module/treasury/ITreasury.sol";
|
16
|
+
|
17
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
18
|
+
import {Registerable} from "../shared/Registerable.sol";
|
19
|
+
|
20
|
+
contract Pool is BaseComponent, IPoolComponent {
|
21
|
+
|
22
|
+
bool internal _isVerifying;
|
23
|
+
UFixed internal _collateralizationLevel;
|
24
|
+
|
25
|
+
Fee internal _initialPoolFee;
|
26
|
+
Fee internal _initialStakingFee;
|
27
|
+
Fee internal _initialPerformanceFee;
|
28
|
+
|
29
|
+
// may be used to interact with instance by derived contracts
|
30
|
+
IPoolService internal _poolService;
|
31
|
+
|
32
|
+
// only relevant to protect callback functions for "active" pools
|
33
|
+
IProductService private _productService;
|
34
|
+
|
35
|
+
modifier onlyPoolService() {
|
36
|
+
require(
|
37
|
+
msg.sender == address(_poolService),
|
38
|
+
"ERROR:POL-001:NOT_POOL_SERVICE");
|
39
|
+
_;
|
40
|
+
}
|
41
|
+
|
42
|
+
modifier onlyProductService() {
|
43
|
+
require(
|
44
|
+
msg.sender == address(_productService),
|
45
|
+
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
46
|
+
_;
|
47
|
+
}
|
12
48
|
|
13
49
|
constructor(
|
14
50
|
address registry,
|
15
|
-
|
51
|
+
NftId instanceNftId,
|
52
|
+
// TODO refactor into tokenNftId
|
16
53
|
address token,
|
54
|
+
bool isInterceptor,
|
55
|
+
bool verifying,
|
56
|
+
UFixed collateralizationLevel,
|
57
|
+
Fee memory poolFee,
|
17
58
|
Fee memory stakingFee,
|
18
|
-
Fee memory performanceFee
|
19
|
-
|
20
|
-
|
21
|
-
|
59
|
+
Fee memory performanceFee,
|
60
|
+
address initialOwner
|
61
|
+
)
|
62
|
+
BaseComponent(registry, instanceNftId, token, POOL(), isInterceptor, initialOwner)
|
63
|
+
{
|
64
|
+
_isVerifying = verifying;
|
65
|
+
// TODO add validation
|
66
|
+
_collateralizationLevel = collateralizationLevel;
|
67
|
+
_initialPoolFee = poolFee;
|
68
|
+
_initialStakingFee = stakingFee;
|
69
|
+
_initialPerformanceFee = performanceFee;
|
70
|
+
|
71
|
+
_poolService = _instance.getPoolService();
|
72
|
+
_productService = _instance.getProductService();
|
73
|
+
|
74
|
+
_registerInterface(type(IPoolComponent).interfaceId);
|
75
|
+
}
|
76
|
+
|
77
|
+
function createBundle(
|
78
|
+
Fee memory fee,
|
79
|
+
uint256 initialAmount,
|
80
|
+
uint256 lifetime,
|
81
|
+
bytes memory filter
|
82
|
+
)
|
83
|
+
external
|
84
|
+
virtual override
|
85
|
+
returns(NftId bundleNftId)
|
86
|
+
{
|
87
|
+
address owner = msg.sender;
|
88
|
+
bundleNftId = _poolService.createBundle(
|
89
|
+
owner,
|
90
|
+
fee,
|
91
|
+
initialAmount,
|
92
|
+
lifetime,
|
93
|
+
filter
|
94
|
+
);
|
95
|
+
|
96
|
+
// TODO add logging
|
22
97
|
}
|
23
98
|
|
24
|
-
|
25
|
-
|
99
|
+
/**
|
100
|
+
* @dev see {IPool.underwrite}.
|
101
|
+
* Default implementation that only writes a {LogUnderwrittenByPool} entry.
|
102
|
+
*/
|
103
|
+
function underwrite(
|
104
|
+
NftId policyNftId,
|
105
|
+
bytes memory policyData,
|
106
|
+
bytes memory bundleFilter,
|
107
|
+
uint256 collateralizationAmount
|
108
|
+
)
|
26
109
|
external
|
110
|
+
onlyProductService
|
111
|
+
virtual override
|
112
|
+
{
|
113
|
+
_underwrite(policyNftId, policyData, bundleFilter, collateralizationAmount);
|
114
|
+
}
|
115
|
+
|
116
|
+
/**
|
117
|
+
* @dev see {IPoolComponent.policyMatchesBundle}.
|
118
|
+
* Default implementation always returns true
|
119
|
+
*/
|
120
|
+
function policyMatchesBundle(
|
121
|
+
bytes memory, // policyData
|
122
|
+
bytes memory // bundleFilter
|
123
|
+
)
|
124
|
+
public
|
27
125
|
view
|
126
|
+
virtual override
|
127
|
+
returns (bool isMatching)
|
128
|
+
{
|
129
|
+
return true;
|
130
|
+
}
|
131
|
+
|
132
|
+
|
133
|
+
function isVerifying() external view override returns (bool verifying) {
|
134
|
+
return _isVerifying;
|
135
|
+
}
|
136
|
+
|
137
|
+
function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
|
138
|
+
return _collateralizationLevel;
|
139
|
+
}
|
140
|
+
|
141
|
+
function setFees(
|
142
|
+
Fee memory poolFee,
|
143
|
+
Fee memory stakingFee,
|
144
|
+
Fee memory performanceFee
|
145
|
+
)
|
146
|
+
external
|
147
|
+
onlyOwner
|
28
148
|
override
|
29
|
-
returns (Fee memory stakingFee)
|
30
149
|
{
|
31
|
-
|
150
|
+
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
32
151
|
}
|
33
152
|
|
34
|
-
function
|
153
|
+
function setBundleFee(
|
154
|
+
NftId bundleNftId,
|
155
|
+
Fee memory fee
|
156
|
+
)
|
157
|
+
external
|
158
|
+
override
|
159
|
+
// TODO add onlyBundleOwner
|
160
|
+
{
|
161
|
+
_poolService.setBundleFee(bundleNftId, fee);
|
162
|
+
}
|
163
|
+
// TODO delete, call instance instead
|
164
|
+
function getFees()
|
35
165
|
external
|
36
166
|
view
|
37
167
|
override
|
38
|
-
returns (Fee memory
|
168
|
+
returns (Fee memory, Fee memory, Fee memory)
|
39
169
|
{
|
40
|
-
|
170
|
+
NftId productNftId = _instance.getProductNftId(getNftId());
|
171
|
+
//if (_instance.hasTreasuryInfo(productNftId)) {
|
172
|
+
ITreasury.TreasuryInfo memory info = _instance.getTreasuryInfo(productNftId);
|
173
|
+
return (info.poolFee, info.stakingFee, info.performanceFee);
|
174
|
+
//} else {
|
175
|
+
// return (_initialPoolFee, _initialStakingFee, _initialPerformanceFee);
|
176
|
+
//}
|
41
177
|
}
|
42
178
|
|
43
|
-
// from
|
44
|
-
|
45
|
-
|
179
|
+
// from IRegisterable
|
180
|
+
|
181
|
+
// TODO used only once, occupies space
|
182
|
+
// TODO do not use super
|
183
|
+
function getInitialInfo()
|
184
|
+
public
|
185
|
+
view
|
186
|
+
override (IRegisterable, Registerable)
|
187
|
+
returns (IRegistry.ObjectInfo memory, bytes memory)
|
188
|
+
{
|
189
|
+
(
|
190
|
+
IRegistry.ObjectInfo memory info,
|
191
|
+
bytes memory data
|
192
|
+
) = super.getInitialInfo();
|
193
|
+
|
194
|
+
return (
|
195
|
+
info,
|
196
|
+
abi.encode(
|
197
|
+
IPool.PoolInfo(
|
198
|
+
_isVerifying,
|
199
|
+
_collateralizationLevel
|
200
|
+
),
|
201
|
+
_wallet,
|
202
|
+
_token,
|
203
|
+
_initialPoolFee,
|
204
|
+
_initialStakingFee,
|
205
|
+
_initialPerformanceFee
|
206
|
+
)
|
207
|
+
);
|
46
208
|
}
|
47
209
|
|
48
|
-
//
|
49
|
-
|
50
|
-
|
210
|
+
// Internals
|
211
|
+
|
212
|
+
function _underwrite(
|
213
|
+
NftId policyNftId,
|
214
|
+
bytes memory policyData,
|
215
|
+
bytes memory bundleFilter,
|
216
|
+
uint256 collateralizationAmount
|
217
|
+
)
|
218
|
+
internal
|
219
|
+
{
|
220
|
+
require(
|
221
|
+
policyMatchesBundle(policyData, bundleFilter),
|
222
|
+
"ERROR:POL-020:POLICY_BUNDLE_MISMATCH"
|
223
|
+
);
|
224
|
+
|
225
|
+
emit LogUnderwrittenByPool(policyNftId, collateralizationAmount, address(this));
|
226
|
+
}
|
227
|
+
|
228
|
+
function _createBundle(
|
229
|
+
address bundleOwner,
|
230
|
+
Fee memory fee,
|
231
|
+
uint256 amount,
|
232
|
+
uint256 lifetime,
|
233
|
+
bytes calldata filter
|
234
|
+
)
|
235
|
+
internal
|
236
|
+
returns(NftId bundleNftId)
|
237
|
+
{
|
238
|
+
bundleNftId = _poolService.createBundle(
|
239
|
+
bundleOwner,
|
240
|
+
fee,
|
241
|
+
amount,
|
242
|
+
lifetime,
|
243
|
+
filter
|
244
|
+
);
|
51
245
|
}
|
52
246
|
}
|
@@ -1,71 +1,228 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
5
|
-
|
6
|
-
import {
|
7
|
-
import {
|
4
|
+
import {IERC20Metadata} from "@openzeppelin5/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
6
|
+
import {IRisk} from "../instance/module/risk/IRisk.sol";
|
7
|
+
import {ITreasury} from "../instance/module/treasury/ITreasury.sol";
|
8
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
9
|
+
import {IProductComponent} from "./IProductComponent.sol";
|
10
|
+
import {NftId, zeroNftId} from "../types/NftId.sol";
|
8
11
|
import {ObjectType, PRODUCT} from "../types/ObjectType.sol";
|
9
|
-
import {
|
10
|
-
import {
|
12
|
+
import {ReferralId} from "../types/ReferralId.sol";
|
13
|
+
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
14
|
+
import {StateId} from "../types/StateId.sol";
|
15
|
+
import {Timestamp} from "../types/Timestamp.sol";
|
16
|
+
import {Fee, FeeLib} from "../types/Fee.sol";
|
17
|
+
import {BaseComponent} from "./BaseComponent.sol";
|
18
|
+
|
19
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
20
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
21
|
+
import {Registerable} from "../shared/Registerable.sol";
|
22
|
+
|
23
|
+
import {IPool} from "../instance/module/pool/IPoolModule.sol";
|
24
|
+
import {Pool} from "../components/Pool.sol";
|
25
|
+
|
26
|
+
contract Product is BaseComponent, IProductComponent {
|
27
|
+
IProductService internal _productService;
|
28
|
+
Pool internal _pool;
|
29
|
+
address internal _distribution;
|
30
|
+
Fee internal _initialProductFee;
|
31
|
+
Fee internal _initialProcessingFee;
|
11
32
|
|
12
|
-
|
13
|
-
|
14
|
-
address private _pool;
|
15
|
-
Fee private _policyFee;
|
16
|
-
Fee private _processingFee;
|
33
|
+
NftId internal _poolNftId;
|
34
|
+
NftId internal _distributionNftId;
|
17
35
|
|
18
36
|
constructor(
|
19
37
|
address registry,
|
20
|
-
|
38
|
+
NftId instanceNftid,
|
21
39
|
address token,
|
40
|
+
bool isInterceptor,
|
22
41
|
address pool,
|
23
|
-
|
24
|
-
Fee memory
|
25
|
-
|
42
|
+
address distribution,
|
43
|
+
Fee memory productFee,
|
44
|
+
Fee memory processingFee,
|
45
|
+
address initialOwner
|
46
|
+
) BaseComponent(registry, instanceNftid, token, PRODUCT(), isInterceptor, initialOwner) {
|
26
47
|
// TODO add validation
|
27
48
|
_productService = _instance.getProductService();
|
28
|
-
_pool = pool;
|
29
|
-
|
30
|
-
|
49
|
+
_pool = Pool(pool);
|
50
|
+
_distribution = distribution;
|
51
|
+
_initialProductFee = productFee;
|
52
|
+
_initialProcessingFee = processingFee;
|
53
|
+
|
54
|
+
_poolNftId = getRegistry().getNftId(address(_pool));
|
55
|
+
_distributionNftId = getRegistry().getNftId(_distribution);
|
56
|
+
|
57
|
+
_registerInterface(type(IProductComponent).interfaceId);
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
function calculatePremium(
|
62
|
+
uint256 sumInsuredAmount,
|
63
|
+
RiskId riskId,
|
64
|
+
uint256 lifetime,
|
65
|
+
bytes memory applicationData,
|
66
|
+
ReferralId referralId,
|
67
|
+
NftId bundleNftId
|
68
|
+
)
|
69
|
+
external
|
70
|
+
view
|
71
|
+
override
|
72
|
+
returns (uint256 premiumAmount)
|
73
|
+
{
|
74
|
+
(premiumAmount,,,,) = _productService.calculatePremium(
|
75
|
+
riskId,
|
76
|
+
sumInsuredAmount,
|
77
|
+
lifetime,
|
78
|
+
applicationData,
|
79
|
+
bundleNftId,
|
80
|
+
referralId
|
81
|
+
);
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
function calculateNetPremium(
|
86
|
+
uint256 sumInsuredAmount,
|
87
|
+
RiskId riskId,
|
88
|
+
uint256 lifetime,
|
89
|
+
bytes memory applicationData
|
90
|
+
)
|
91
|
+
external
|
92
|
+
view
|
93
|
+
virtual override
|
94
|
+
returns (uint256 netPremiumAmount)
|
95
|
+
{
|
96
|
+
// default 10% of sum insured
|
97
|
+
return sumInsuredAmount / 10;
|
98
|
+
}
|
99
|
+
|
100
|
+
function _toRiskId(string memory riskName) internal pure returns (RiskId riskId) {
|
101
|
+
return RiskIdLib.toRiskId(riskName);
|
102
|
+
}
|
103
|
+
|
104
|
+
function _createRisk(
|
105
|
+
RiskId id,
|
106
|
+
bytes memory data
|
107
|
+
) internal {
|
108
|
+
_productService.createRisk(
|
109
|
+
id,
|
110
|
+
data
|
111
|
+
);
|
112
|
+
}
|
113
|
+
|
114
|
+
function _setRiskInfo(
|
115
|
+
RiskId id,
|
116
|
+
IRisk.RiskInfo memory info
|
117
|
+
) internal {
|
118
|
+
_productService.setRiskInfo(
|
119
|
+
id,
|
120
|
+
info
|
121
|
+
);
|
122
|
+
}
|
123
|
+
|
124
|
+
function _updateRiskState(
|
125
|
+
RiskId id,
|
126
|
+
StateId state
|
127
|
+
) internal {
|
128
|
+
_productService.updateRiskState(
|
129
|
+
id,
|
130
|
+
state
|
131
|
+
);
|
132
|
+
}
|
133
|
+
|
134
|
+
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
135
|
+
return _instance.getRiskInfo(id);
|
31
136
|
}
|
32
137
|
|
33
138
|
function _createApplication(
|
34
139
|
address applicationOwner,
|
140
|
+
RiskId riskId,
|
35
141
|
uint256 sumInsuredAmount,
|
36
|
-
uint256 premiumAmount,
|
37
142
|
uint256 lifetime,
|
38
|
-
|
143
|
+
bytes memory applicationData,
|
144
|
+
NftId bundleNftId,
|
145
|
+
ReferralId referralId
|
39
146
|
) internal returns (NftId nftId) {
|
40
147
|
nftId = _productService.createApplication(
|
41
148
|
applicationOwner,
|
149
|
+
riskId,
|
42
150
|
sumInsuredAmount,
|
43
|
-
premiumAmount,
|
44
151
|
lifetime,
|
45
|
-
|
152
|
+
applicationData,
|
153
|
+
bundleNftId,
|
154
|
+
referralId
|
46
155
|
);
|
47
156
|
}
|
48
157
|
|
49
|
-
function _underwrite(
|
50
|
-
|
158
|
+
function _underwrite(
|
159
|
+
NftId policyNftId,
|
160
|
+
bool requirePremiumPayment,
|
161
|
+
Timestamp activateAt
|
162
|
+
)
|
163
|
+
internal
|
164
|
+
{
|
165
|
+
_productService.underwrite(
|
166
|
+
policyNftId,
|
167
|
+
requirePremiumPayment,
|
168
|
+
activateAt);
|
51
169
|
}
|
52
170
|
|
53
|
-
function _collectPremium(
|
54
|
-
|
171
|
+
function _collectPremium(
|
172
|
+
NftId policyNftId,
|
173
|
+
Timestamp activateAt
|
174
|
+
)
|
175
|
+
internal
|
176
|
+
{
|
177
|
+
_productService.collectPremium(
|
178
|
+
policyNftId,
|
179
|
+
activateAt);
|
180
|
+
}
|
181
|
+
|
182
|
+
function _activate(
|
183
|
+
NftId policyNftId,
|
184
|
+
Timestamp activateAt
|
185
|
+
)
|
186
|
+
internal
|
187
|
+
{
|
188
|
+
_productService.activate(
|
189
|
+
policyNftId,
|
190
|
+
activateAt);
|
55
191
|
}
|
56
192
|
|
57
193
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
58
|
-
return
|
194
|
+
return getRegistry().getNftId(address(_pool));
|
195
|
+
}
|
196
|
+
|
197
|
+
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
198
|
+
return getRegistry().getNftId(_distribution);
|
59
199
|
}
|
60
200
|
|
61
201
|
// from product component
|
62
|
-
function
|
202
|
+
function setFees(
|
203
|
+
Fee memory productFee,
|
204
|
+
Fee memory processingFee
|
205
|
+
)
|
206
|
+
external
|
207
|
+
onlyOwner
|
208
|
+
override
|
209
|
+
{
|
210
|
+
_productService.setFees(productFee, processingFee);
|
211
|
+
}
|
212
|
+
|
213
|
+
// TODO delete, call instance intead
|
214
|
+
function getProductFee()
|
63
215
|
external
|
64
216
|
view
|
65
217
|
override
|
66
|
-
returns (Fee memory
|
218
|
+
returns (Fee memory productFee)
|
67
219
|
{
|
68
|
-
|
220
|
+
NftId productNftId = getNftId();
|
221
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
222
|
+
return _instance.getTreasuryInfo(productNftId).productFee;
|
223
|
+
} else {
|
224
|
+
return _initialProductFee;
|
225
|
+
}
|
69
226
|
}
|
70
227
|
|
71
228
|
function getProcessingFee()
|
@@ -74,16 +231,69 @@ contract Product is Component, IProductComponent {
|
|
74
231
|
override
|
75
232
|
returns (Fee memory processingFee)
|
76
233
|
{
|
77
|
-
|
234
|
+
NftId productNftId = getNftId();
|
235
|
+
if (_instance.hasTreasuryInfo(productNftId)) {
|
236
|
+
return _instance.getTreasuryInfo(productNftId).processingFee;
|
237
|
+
} else {
|
238
|
+
return _initialProcessingFee;
|
239
|
+
}
|
78
240
|
}
|
79
241
|
|
80
|
-
// from
|
81
|
-
|
82
|
-
|
83
|
-
|
242
|
+
// from IRegisterable
|
243
|
+
|
244
|
+
// TODO used only once, occupies space
|
245
|
+
function getInitialInfo()
|
246
|
+
public
|
247
|
+
view
|
248
|
+
override (IRegisterable, Registerable)
|
249
|
+
returns (IRegistry.ObjectInfo memory, bytes memory)
|
250
|
+
{
|
251
|
+
// from Registerable
|
252
|
+
(
|
253
|
+
IRegistry.ObjectInfo memory productInfo,
|
254
|
+
bytes memory data
|
255
|
+
) = super.getInitialInfo();
|
256
|
+
|
257
|
+
// TODO read pool & distribution fees
|
258
|
+
// 1) from pool -> the only option -> pool must be registered first?
|
259
|
+
// 2) from instance -> all fees are set into instance at product registration which is ongoing here
|
260
|
+
// checks are done in registryProduct() where THIS function is called
|
261
|
+
//require(getRegistry().getObjectInfo(_poolNftId).objectType == POOL(), "POOL_NOT_REGISTERED");
|
262
|
+
//require(getRegistry().getObjectInfo(_distributionNftId).objectType == DISTRIBUTION(), "DISTRIBUTION_NOT_REGISTERED");
|
263
|
+
|
264
|
+
// from PoolComponent
|
265
|
+
(
|
266
|
+
IRegistry.ObjectInfo memory poolInfo,
|
267
|
+
bytes memory poolData
|
268
|
+
) = _pool.getInitialInfo();
|
84
269
|
|
85
|
-
|
86
|
-
|
87
|
-
|
270
|
+
(
|
271
|
+
/*IPool.PoolInfo memory info*/,
|
272
|
+
/*address wallet*/,
|
273
|
+
/*IERC20Metadata token*/,
|
274
|
+
Fee memory initialPoolFee,
|
275
|
+
Fee memory initialStakingFee,
|
276
|
+
Fee memory initialPerformanceFee
|
277
|
+
) = abi.decode(poolData, (IPool.PoolInfo, address, IERC20Metadata, Fee, Fee, Fee));
|
278
|
+
|
279
|
+
// TODO from DistributionComponent
|
280
|
+
|
281
|
+
return (
|
282
|
+
productInfo,
|
283
|
+
abi.encode(
|
284
|
+
ITreasury.TreasuryInfo(
|
285
|
+
_poolNftId,
|
286
|
+
_distributionNftId,
|
287
|
+
_token,
|
288
|
+
_initialProductFee,
|
289
|
+
_initialProcessingFee,
|
290
|
+
initialPoolFee,
|
291
|
+
initialStakingFee,
|
292
|
+
initialPerformanceFee,
|
293
|
+
FeeLib.zeroFee()//_instance.getDistributionFee(_distributionNftId)
|
294
|
+
),
|
295
|
+
_wallet
|
296
|
+
)
|
297
|
+
);
|
88
298
|
}
|
89
299
|
}
|
@@ -1,25 +1,54 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
5
|
-
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
|
11
|
-
import {
|
4
|
+
import {IERC165} from "@openzeppelin5/contracts/utils/introspection/IERC165.sol";
|
5
|
+
|
6
|
+
import {INftOwnable} from "../shared/INftOwnable.sol";
|
7
|
+
import {IVersionable} from "../shared/IVersionable.sol";
|
8
|
+
import {IRegisterable} from "../shared/IRegisterable.sol";
|
9
|
+
import {RoleId} from "../types/RoleId.sol";
|
10
|
+
|
11
|
+
import {IAccessModule} from "./module/access/IAccess.sol";
|
12
|
+
import {IBundleModule} from "./module/bundle/IBundle.sol";
|
13
|
+
import {IDistributionModule} from "./module/distribution/IDistribution.sol";
|
14
|
+
import {IComponentModule} from "./module/component/IComponent.sol";
|
15
|
+
import {IPolicyModule} from "./module/policy/IPolicy.sol";
|
16
|
+
import {IPoolModule} from "./module/pool/IPoolModule.sol";
|
17
|
+
import {IRiskModule} from "./module/risk/IRisk.sol";
|
18
|
+
import {ITreasuryModule} from "./module/treasury/ITreasury.sol";
|
19
|
+
|
20
|
+
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
21
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
22
|
+
|
23
|
+
import {IComponentOwnerService} from "./service/IComponentOwnerService.sol";
|
24
|
+
import {IDistributionService} from "./service/IDistributionService.sol";
|
25
|
+
import {IProductService} from "./service/IProductService.sol";
|
26
|
+
import {IPoolService} from "./service/IPoolService.sol";
|
27
|
+
import {IInstanceBase} from "./base/IInstanceBase.sol";
|
12
28
|
|
13
29
|
// solhint-disable-next-line no-empty-blocks
|
14
30
|
interface IInstance is
|
31
|
+
IERC165,
|
32
|
+
IVersionable,
|
15
33
|
IRegisterable,
|
16
34
|
IAccessModule,
|
17
|
-
ILifecycleModule,
|
18
35
|
IPolicyModule,
|
19
36
|
IPoolModule,
|
37
|
+
IRiskModule,
|
38
|
+
IBundleModule,
|
20
39
|
IComponentModule,
|
21
|
-
|
22
|
-
|
40
|
+
ITreasuryModule,
|
41
|
+
IDistributionModule,
|
42
|
+
IInstanceBase
|
23
43
|
{
|
44
|
+
function getRegistry() external view override (INftOwnable) returns (IRegistry registry);
|
45
|
+
function getOwner() external view override (IAccessModule, INftOwnable) returns(address owner);
|
46
|
+
|
47
|
+
function getKeyValueStore() external view override (IInstanceBase) returns (IKeyValueStore keyValueStore);
|
48
|
+
|
49
|
+
function getComponentOwnerService() external view override (IInstanceBase, IComponentModule, IPoolModule, ITreasuryModule) returns(IComponentOwnerService);
|
50
|
+
function getDistributionService() external view override returns(IDistributionService);
|
51
|
+
function getProductService() external view override (IInstanceBase, IBundleModule, IPolicyModule) returns(IProductService);
|
52
|
+
function getPoolService() external view override (IInstanceBase, IBundleModule, IPoolModule) returns(IPoolService);
|
24
53
|
|
25
54
|
}
|