@etherisc/gif-next 0.0.2-f79a517-071 → 0.0.2-f7a5beb-202
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +67 -1
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +613 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +353 -104
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/ServiceBase.sol/ServiceBase.json → components/IComponent.sol/IComponent.json} +185 -151
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +527 -9
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +611 -66
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +618 -30
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +492 -212
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +429 -137
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +1 -1
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +1 -1
- 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/BundleManager.sol/BundleManager.dbg.json +4 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +764 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +4 -0
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +185 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +1035 -995
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/{service/IComponentOwnerService.sol/IComponentOwnerService.json → IInstanceService.sol/IInstanceService.json} +155 -56
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +1821 -1096
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +1034 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +1381 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +964 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +473 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +4 -0
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +261 -0
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{InstanceBase.sol/InstanceBase.json → ComponentService.sol/ComponentService.json} +134 -75
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.json +27 -158
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +37 -245
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +254 -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/{distribution/IDistribution.sol → IDistribution.sol}/IDistribution.json +1 -1
- 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/{risk/IRisk.sol → IRisk.sol}/IRisk.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +4 -0
- package/artifacts/contracts/instance/{base/ModuleBase.sol/ModuleBase.json → module/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/BundleService.sol/BundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +1102 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +449 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +194 -52
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +437 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +715 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +13 -18
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +766 -0
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +15 -82
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +25 -245
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +1227 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +505 -0
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +181 -128
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +437 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +174 -386
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +437 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +339 -59
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +220 -111
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +301 -188
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +83 -128
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +53 -85
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +547 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +4 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +394 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +0 -5
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/IService.sol/IService.json +14 -19
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +19 -6
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +19 -6
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +19 -11
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/ComponentServiceBase.sol/ComponentServiceBase.json → shared/Service.sol/Service.json} +28 -33
- 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 +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +19 -11
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +14 -14
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +58 -34
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +18 -2
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/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 +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +31 -17
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +2 -2
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +26 -3
- 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 +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +134 -8
- 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 +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
- package/contracts/components/Component.sol +247 -0
- package/contracts/components/Distribution.sol +37 -49
- package/contracts/components/IComponent.sol +50 -0
- package/contracts/components/IDistributionComponent.sol +6 -5
- package/contracts/components/IPoolComponent.sol +42 -29
- package/contracts/components/IProductComponent.sol +9 -7
- package/contracts/components/Pool.sol +137 -116
- package/contracts/components/Product.sol +78 -114
- package/contracts/instance/BundleManager.sol +125 -0
- package/contracts/instance/Cloneable.sol +46 -0
- package/contracts/instance/IInstance.sol +64 -44
- package/contracts/instance/IInstanceService.sol +40 -0
- package/contracts/instance/Instance.sol +251 -65
- package/contracts/instance/InstanceAccessManager.sol +298 -0
- package/contracts/instance/InstanceReader.sol +293 -0
- package/contracts/instance/InstanceService.sol +362 -0
- package/contracts/instance/InstanceServiceManager.sol +54 -0
- package/contracts/instance/ObjectManager.sol +84 -0
- package/contracts/instance/base/ComponentService.sol +134 -0
- package/contracts/instance/base/IKeyValueStore.sol +13 -14
- package/contracts/instance/base/ILifecycle.sol +3 -3
- package/contracts/instance/base/KeyValueStore.sol +49 -38
- package/contracts/instance/base/Lifecycle.sol +1 -1
- package/contracts/instance/module/IAccess.sol +48 -0
- package/contracts/instance/module/IBundle.sol +20 -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 +46 -0
- package/contracts/instance/module/ITreasury.sol +23 -0
- package/contracts/instance/service/BundleService.sol +293 -0
- package/contracts/instance/service/BundleServiceManager.sol +51 -0
- package/contracts/instance/service/DistributionService.sol +72 -20
- package/contracts/instance/service/DistributionServiceManager.sol +51 -0
- package/contracts/instance/service/IBundleService.sol +44 -0
- package/contracts/instance/service/IDistributionService.sol +1 -1
- package/contracts/instance/service/IPolicyService.sol +94 -0
- package/contracts/instance/service/IPoolService.sol +7 -24
- package/contracts/instance/service/IProductService.sol +9 -76
- package/contracts/instance/service/PolicyService.sol +538 -0
- package/contracts/instance/service/PolicyServiceManager.sol +54 -0
- package/contracts/instance/service/PoolService.sol +76 -116
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +154 -432
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +1 -1
- package/contracts/registry/IRegistry.sol +47 -6
- package/contracts/registry/IRegistryService.sol +50 -20
- package/contracts/registry/Registry.sol +243 -214
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +84 -263
- package/contracts/registry/RegistryServiceManager.sol +20 -22
- package/contracts/registry/ReleaseManager.sol +332 -0
- package/contracts/registry/TokenRegistry.sol +112 -0
- package/contracts/shared/ERC165.sol +6 -2
- package/contracts/shared/IRegisterable.sol +1 -3
- package/contracts/shared/IService.sol +16 -0
- package/contracts/shared/NftOwnable.sol +7 -4
- package/contracts/shared/ProxyManager.sol +1 -1
- package/contracts/shared/Registerable.sol +11 -14
- package/contracts/shared/Service.sol +60 -0
- package/contracts/shared/TokenHandler.sol +27 -0
- package/contracts/shared/Versionable.sol +2 -2
- package/contracts/test/TestRoleId.sol +1 -1
- package/contracts/test/TestService.sol +6 -7
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Key32.sol +8 -3
- package/contracts/types/NftIdSet.sol +26 -24
- package/contracts/types/NumberId.sol +52 -0
- package/contracts/types/ObjectType.sol +35 -14
- package/contracts/types/Referral.sol +85 -0
- package/contracts/types/RoleId.sol +60 -15
- package/contracts/types/StateId.sol +5 -1
- package/contracts/types/Timestamp.sol +7 -3
- package/contracts/types/Version.sol +4 -1
- package/package.json +1 -1
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -301
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -254
- 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/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/base/IService.sol/IService.dbg.json +0 -4
- package/artifacts/contracts/instance/base/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ModuleBase.sol/ModuleBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ServiceBase.sol/ServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/bundle/BundleModule.sol/BundleModule.json +0 -297
- 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 -297
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/component/ComponentModule.sol/ComponentModule.json +0 -117
- 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 -117
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/distribution/DistributionModule.sol/DistributionModule.json +0 -10
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistribution.dbg.json +0 -4
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/distribution/IDistribution.sol/IDistributionModule.json +0 -10
- 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 -271
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -271
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPool.json +0 -10
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/IPoolModule.sol/IPoolModule.json +0 -164
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -164
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRisk.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/IRisk.sol/IRiskModule.json +0 -113
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/risk/RiskModule.sol/RiskModule.json +0 -131
- 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 -638
- 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 -638
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +0 -4
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +0 -557
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +0 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +0 -716
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +0 -4
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +0 -744
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +0 -99
- package/contracts/components/BaseComponent.sol +0 -79
- package/contracts/components/IBaseComponent.sol +0 -19
- package/contracts/instance/IInstanceLinked.sol +0 -8
- package/contracts/instance/base/ComponentServiceBase.sol +0 -49
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/base/IService.sol +0 -15
- package/contracts/instance/base/InstanceBase.sol +0 -89
- package/contracts/instance/base/ModuleBase.sol +0 -57
- package/contracts/instance/base/ServiceBase.sol +0 -44
- package/contracts/instance/module/bundle/BundleModule.sol +0 -134
- package/contracts/instance/module/bundle/IBundle.sol +0 -53
- package/contracts/instance/module/component/ComponentModule.sol +0 -71
- package/contracts/instance/module/component/IComponent.sol +0 -28
- package/contracts/instance/module/distribution/DistributionModule.sol +0 -17
- package/contracts/instance/module/distribution/IDistribution.sol +0 -10
- package/contracts/instance/module/policy/IPolicy.sol +0 -63
- package/contracts/instance/module/policy/PolicyModule.sol +0 -91
- package/contracts/instance/module/pool/IPoolModule.sol +0 -41
- package/contracts/instance/module/pool/PoolModule.sol +0 -95
- package/contracts/instance/module/risk/IRisk.sol +0 -26
- package/contracts/instance/module/risk/RiskModule.sol +0 -62
- package/contracts/instance/module/treasury/ITreasury.sol +0 -84
- package/contracts/instance/module/treasury/TokenHandler.sol +0 -48
- package/contracts/instance/module/treasury/TreasuryModule.sol +0 -131
- package/contracts/instance/service/ComponentOwnerService.sol +0 -315
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/test/TestDistribution.sol +0 -22
- package/contracts/test/TestPool.sol +0 -27
- package/contracts/test/TestProduct.sol +0 -74
- package/contracts/types/ReferralId.sol +0 -48
@@ -1,100 +1,99 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {IProductService} from "../instance/service/IProductService.sol";
|
4
|
+
import {POOL} from "../types/ObjectType.sol";
|
6
5
|
import {IPoolService} from "../instance/service/IPoolService.sol";
|
7
|
-
import {
|
6
|
+
import {IBundleService} from "../instance/service/IBundleService.sol";
|
7
|
+
import {NftId, 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
|
-
import {
|
11
|
+
import {Component} from "./Component.sol";
|
12
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
13
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
12
14
|
|
13
15
|
import {IRegistry} from "../registry/IRegistry.sol";
|
14
|
-
|
15
|
-
import {
|
16
|
+
|
17
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
18
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
16
19
|
|
17
20
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
18
21
|
import {Registerable} from "../shared/Registerable.sol";
|
19
22
|
|
20
|
-
contract Pool is
|
23
|
+
abstract contract Pool is
|
24
|
+
Component,
|
25
|
+
IPoolComponent
|
26
|
+
{
|
27
|
+
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Pool.sol")) - 1)) & ~bytes32(uint256(0xff));
|
28
|
+
bytes32 public constant POOL_STORAGE_LOCATION_V1 = 0xecf35607b7e822969ee3625cd815bfc27031f3a93d0be2676e5bde943e2e2300;
|
21
29
|
|
22
|
-
|
23
|
-
|
30
|
+
struct PoolStorage {
|
31
|
+
UFixed _collateralizationLevel;
|
24
32
|
|
25
|
-
|
26
|
-
|
27
|
-
|
33
|
+
bool _isExternallyManaged;
|
34
|
+
bool _isInterceptingBundleTransfers;
|
35
|
+
bool _isVerifyingApplications;
|
28
36
|
|
29
|
-
|
30
|
-
|
37
|
+
Fee _initialPoolFee;
|
38
|
+
Fee _initialStakingFee;
|
39
|
+
Fee _initialPerformanceFee;
|
31
40
|
|
32
|
-
|
33
|
-
IProductService private _productService;
|
41
|
+
TokenHandler _tokenHandler;
|
34
42
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
"ERROR:POL-001:NOT_POOL_SERVICE");
|
39
|
-
_;
|
43
|
+
// may be used to interact with instance by derived contracts
|
44
|
+
IPoolService _poolService;
|
45
|
+
IBundleService _bundleService;
|
40
46
|
}
|
41
47
|
|
42
|
-
modifier
|
43
|
-
|
44
|
-
msg.sender
|
45
|
-
|
48
|
+
modifier onlyPoolService() {
|
49
|
+
if(msg.sender != address(_getStorage()._poolService)) {
|
50
|
+
revert ErrorPoolNotPoolService(msg.sender);
|
51
|
+
}
|
46
52
|
_;
|
47
53
|
}
|
48
54
|
|
49
|
-
|
55
|
+
|
56
|
+
function _initializePool(
|
50
57
|
address registry,
|
51
58
|
NftId instanceNftId,
|
59
|
+
string memory name,
|
52
60
|
// TODO refactor into tokenNftId
|
53
61
|
address token,
|
54
|
-
bool isInterceptor,
|
55
|
-
bool verifying,
|
56
62
|
UFixed collateralizationLevel,
|
63
|
+
bool isInterceptingNftTransfers,
|
64
|
+
bool isExternallyManaging,
|
65
|
+
bool isVerifying,
|
57
66
|
Fee memory poolFee,
|
58
67
|
Fee memory stakingFee,
|
59
68
|
Fee memory performanceFee,
|
60
|
-
address initialOwner
|
69
|
+
address initialOwner,
|
70
|
+
bytes memory data
|
61
71
|
)
|
62
|
-
|
72
|
+
internal
|
73
|
+
//onlyInitializing//TODO uncomment when "fully" upgradeable
|
74
|
+
virtual
|
63
75
|
{
|
64
|
-
|
76
|
+
_initializeComponent(registry, instanceNftId, name, token, POOL(), isInterceptingNftTransfers, initialOwner, data);
|
77
|
+
|
78
|
+
PoolStorage storage $ = _getStorage();
|
79
|
+
|
80
|
+
$._isExternallyManaged = isExternallyManaging;
|
81
|
+
$._isVerifyingApplications = isVerifying;
|
82
|
+
|
65
83
|
// TODO add validation
|
66
|
-
_collateralizationLevel = collateralizationLevel;
|
67
|
-
_initialPoolFee = poolFee;
|
68
|
-
_initialStakingFee = stakingFee;
|
69
|
-
_initialPerformanceFee = performanceFee;
|
84
|
+
$._collateralizationLevel = collateralizationLevel;
|
85
|
+
$._initialPoolFee = poolFee;
|
86
|
+
$._initialStakingFee = stakingFee;
|
87
|
+
$._initialPerformanceFee = performanceFee;
|
88
|
+
|
89
|
+
$._tokenHandler = new TokenHandler(token);
|
70
90
|
|
71
|
-
_poolService =
|
72
|
-
|
91
|
+
$._poolService = getInstance().getPoolService();
|
92
|
+
$._bundleService = getInstance().getBundleService();
|
73
93
|
|
74
94
|
_registerInterface(type(IPoolComponent).interfaceId);
|
75
95
|
}
|
76
96
|
|
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
|
97
|
-
}
|
98
97
|
|
99
98
|
/**
|
100
99
|
* @dev see {IPool.underwrite}.
|
@@ -113,31 +112,41 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
113
112
|
_underwrite(policyNftId, policyData, bundleFilter, collateralizationAmount);
|
114
113
|
}
|
115
114
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
115
|
+
|
116
|
+
function isInterceptingBundleTransfers() external view override returns (bool) {
|
117
|
+
return isNftInterceptor();
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
function isExternallyManaged() external view override returns (bool) {
|
122
|
+
return _getStorage()._isExternallyManaged;
|
123
|
+
}
|
124
|
+
|
125
|
+
|
126
|
+
function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
|
127
|
+
return _getStorage()._collateralizationLevel;
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
function isVerifyingApplications() external view override returns (bool isConfirmingApplication) {
|
132
|
+
return _getStorage()._isVerifyingApplications;
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
/// @dev see {IPoolComponent.policyMatchesBundle}.
|
137
|
+
/// Default implementation always returns true
|
120
138
|
function policyMatchesBundle(
|
121
139
|
bytes memory, // policyData
|
122
140
|
bytes memory // bundleFilter
|
123
141
|
)
|
124
142
|
public
|
125
|
-
|
143
|
+
pure
|
126
144
|
virtual override
|
127
145
|
returns (bool isMatching)
|
128
146
|
{
|
129
147
|
return true;
|
130
148
|
}
|
131
149
|
|
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
150
|
function setFees(
|
142
151
|
Fee memory poolFee,
|
143
152
|
Fee memory stakingFee,
|
@@ -147,7 +156,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
147
156
|
onlyOwner
|
148
157
|
override
|
149
158
|
{
|
150
|
-
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
159
|
+
_getStorage()._poolService.setFees(poolFee, stakingFee, performanceFee);
|
151
160
|
}
|
152
161
|
|
153
162
|
function setBundleFee(
|
@@ -158,52 +167,51 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
158
167
|
override
|
159
168
|
// TODO add onlyBundleOwner
|
160
169
|
{
|
161
|
-
|
170
|
+
_getStorage()._bundleService.setBundleFee(bundleNftId, fee);
|
162
171
|
}
|
163
|
-
|
164
|
-
function
|
172
|
+
|
173
|
+
function lockBundle(
|
174
|
+
NftId bundleNftId
|
175
|
+
)
|
165
176
|
external
|
166
|
-
view
|
167
177
|
override
|
168
|
-
|
178
|
+
// TODO add onlyBundleOwner
|
169
179
|
{
|
170
|
-
|
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
|
-
//}
|
180
|
+
_getStorage()._bundleService.lockBundle(bundleNftId);
|
177
181
|
}
|
178
182
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
view
|
186
|
-
override (IRegisterable, Registerable)
|
187
|
-
returns (IRegistry.ObjectInfo memory, bytes memory)
|
183
|
+
function unlockBundle(
|
184
|
+
NftId bundleNftId
|
185
|
+
)
|
186
|
+
external
|
187
|
+
override
|
188
|
+
// TODO add onlyBundleOwner
|
188
189
|
{
|
189
|
-
(
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
190
|
+
_getStorage()._bundleService.unlockBundle(bundleNftId);
|
191
|
+
}
|
192
|
+
|
193
|
+
function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
|
194
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
195
|
+
setupInfo = reader.getPoolSetupInfo(getNftId());
|
196
|
+
|
197
|
+
// fallback to initial setup info (wallet is always != address(0))
|
198
|
+
if(setupInfo.wallet == address(0)) {
|
199
|
+
setupInfo = _getInitialSetupInfo();
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
function _getInitialSetupInfo() internal view returns (ISetup.PoolSetupInfo memory) {
|
204
|
+
PoolStorage storage $ = _getStorage();
|
205
|
+
return ISetup.PoolSetupInfo(
|
206
|
+
getProductNftId(),
|
207
|
+
$._tokenHandler,
|
208
|
+
$._collateralizationLevel,
|
209
|
+
$._initialPoolFee,
|
210
|
+
$._initialStakingFee,
|
211
|
+
$._initialPerformanceFee,
|
212
|
+
isNftInterceptor(),
|
213
|
+
$._isVerifyingApplications,
|
214
|
+
getWallet()
|
207
215
|
);
|
208
216
|
}
|
209
217
|
|
@@ -230,17 +238,30 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
230
238
|
Fee memory fee,
|
231
239
|
uint256 amount,
|
232
240
|
uint256 lifetime,
|
233
|
-
bytes
|
241
|
+
bytes memory filter
|
234
242
|
)
|
235
243
|
internal
|
236
244
|
returns(NftId bundleNftId)
|
237
245
|
{
|
238
|
-
bundleNftId =
|
246
|
+
bundleNftId = _getStorage()._bundleService.createBundle(
|
239
247
|
bundleOwner,
|
240
248
|
fee,
|
241
249
|
amount,
|
242
250
|
lifetime,
|
243
|
-
filter
|
244
|
-
|
251
|
+
filter);
|
252
|
+
|
253
|
+
// TODO add logging
|
254
|
+
}
|
255
|
+
|
256
|
+
function getContractLocation(bytes memory name) external pure returns (bytes32 hash) {
|
257
|
+
return keccak256(abi.encode(uint256(keccak256(name)) - 1)) & ~bytes32(uint256(0xff));
|
245
258
|
}
|
259
|
+
|
260
|
+
|
261
|
+
function _getStorage() private pure returns (PoolStorage storage $) {
|
262
|
+
assembly {
|
263
|
+
$.slot := POOL_STORAGE_LOCATION_V1
|
264
|
+
}
|
265
|
+
}
|
266
|
+
|
246
267
|
}
|
@@ -3,56 +3,69 @@ pragma solidity ^0.8.19;
|
|
3
3
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
|
-
import {IRisk} from "../instance/module/
|
7
|
-
import {
|
8
|
-
import {IProductService} from "../instance/service/IProductService.sol";
|
6
|
+
import {IRisk} from "../instance/module/IRisk.sol";
|
7
|
+
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
9
8
|
import {IProductComponent} from "./IProductComponent.sol";
|
10
|
-
import {NftId,
|
11
|
-
import {
|
12
|
-
import {ReferralId} from "../types/
|
9
|
+
import {NftId, NftIdLib} from "../types/NftId.sol";
|
10
|
+
import {PRODUCT} from "../types/ObjectType.sol";
|
11
|
+
import {ReferralId} from "../types/Referral.sol";
|
13
12
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
14
13
|
import {StateId} from "../types/StateId.sol";
|
15
14
|
import {Timestamp} from "../types/Timestamp.sol";
|
16
|
-
import {Fee
|
17
|
-
import {
|
15
|
+
import {Fee} from "../types/Fee.sol";
|
16
|
+
import {Component} from "./Component.sol";
|
18
17
|
|
19
18
|
import {IRegistry} from "../registry/IRegistry.sol";
|
20
19
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
21
20
|
import {Registerable} from "../shared/Registerable.sol";
|
21
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
22
22
|
|
23
|
-
import {
|
23
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
24
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
24
25
|
import {Pool} from "../components/Pool.sol";
|
26
|
+
import {Distribution} from "../components/Distribution.sol";
|
25
27
|
|
26
|
-
contract Product is
|
27
|
-
|
28
|
+
abstract contract Product is
|
29
|
+
Component,
|
30
|
+
IProductComponent
|
31
|
+
{
|
32
|
+
IPolicyService internal _policyService;
|
28
33
|
Pool internal _pool;
|
29
|
-
|
34
|
+
Distribution internal _distribution;
|
30
35
|
Fee internal _initialProductFee;
|
31
36
|
Fee internal _initialProcessingFee;
|
37
|
+
TokenHandler internal _tokenHandler;
|
32
38
|
|
33
39
|
NftId internal _poolNftId;
|
34
40
|
NftId internal _distributionNftId;
|
35
41
|
|
36
42
|
constructor(
|
37
43
|
address registry,
|
38
|
-
NftId
|
44
|
+
NftId instanceNftId,
|
45
|
+
string memory name,
|
39
46
|
address token,
|
40
47
|
bool isInterceptor,
|
41
48
|
address pool,
|
42
49
|
address distribution,
|
43
50
|
Fee memory productFee,
|
44
51
|
Fee memory processingFee,
|
45
|
-
address initialOwner
|
46
|
-
|
52
|
+
address initialOwner,
|
53
|
+
bytes memory data
|
54
|
+
)
|
55
|
+
{
|
56
|
+
_initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, data);
|
57
|
+
|
47
58
|
// TODO add validation
|
48
|
-
|
59
|
+
_policyService = getInstance().getPolicyService();
|
49
60
|
_pool = Pool(pool);
|
50
|
-
_distribution = distribution;
|
61
|
+
_distribution = Distribution(distribution);
|
51
62
|
_initialProductFee = productFee;
|
52
63
|
_initialProcessingFee = processingFee;
|
53
64
|
|
65
|
+
_tokenHandler = new TokenHandler(token);
|
66
|
+
|
54
67
|
_poolNftId = getRegistry().getNftId(address(_pool));
|
55
|
-
_distributionNftId = getRegistry().getNftId(_distribution);
|
68
|
+
_distributionNftId = getRegistry().getNftId(address(_distribution));
|
56
69
|
|
57
70
|
_registerInterface(type(IProductComponent).interfaceId);
|
58
71
|
}
|
@@ -63,15 +76,15 @@ contract Product is BaseComponent, IProductComponent {
|
|
63
76
|
RiskId riskId,
|
64
77
|
uint256 lifetime,
|
65
78
|
bytes memory applicationData,
|
66
|
-
|
67
|
-
|
79
|
+
NftId bundleNftId,
|
80
|
+
ReferralId referralId
|
68
81
|
)
|
69
82
|
external
|
70
83
|
view
|
71
84
|
override
|
72
85
|
returns (uint256 premiumAmount)
|
73
86
|
{
|
74
|
-
(premiumAmount,,,,) =
|
87
|
+
(premiumAmount,,,,) = _policyService.calculatePremium(
|
75
88
|
riskId,
|
76
89
|
sumInsuredAmount,
|
77
90
|
lifetime,
|
@@ -105,19 +118,19 @@ contract Product is BaseComponent, IProductComponent {
|
|
105
118
|
RiskId id,
|
106
119
|
bytes memory data
|
107
120
|
) internal {
|
108
|
-
|
121
|
+
getProductService().createRisk(
|
109
122
|
id,
|
110
123
|
data
|
111
124
|
);
|
112
125
|
}
|
113
126
|
|
114
|
-
function
|
127
|
+
function _updateRisk(
|
115
128
|
RiskId id,
|
116
|
-
|
129
|
+
bytes memory data
|
117
130
|
) internal {
|
118
|
-
|
131
|
+
getProductService().updateRisk(
|
119
132
|
id,
|
120
|
-
|
133
|
+
data
|
121
134
|
);
|
122
135
|
}
|
123
136
|
|
@@ -125,14 +138,14 @@ contract Product is BaseComponent, IProductComponent {
|
|
125
138
|
RiskId id,
|
126
139
|
StateId state
|
127
140
|
) internal {
|
128
|
-
|
141
|
+
getProductService().updateRiskState(
|
129
142
|
id,
|
130
143
|
state
|
131
144
|
);
|
132
145
|
}
|
133
146
|
|
134
147
|
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
135
|
-
return
|
148
|
+
return getInstance().getInstanceReader().getRiskInfo(id);
|
136
149
|
}
|
137
150
|
|
138
151
|
function _createApplication(
|
@@ -144,7 +157,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
144
157
|
NftId bundleNftId,
|
145
158
|
ReferralId referralId
|
146
159
|
) internal returns (NftId nftId) {
|
147
|
-
nftId =
|
160
|
+
nftId = _policyService.createApplication(
|
148
161
|
applicationOwner,
|
149
162
|
riskId,
|
150
163
|
sumInsuredAmount,
|
@@ -162,7 +175,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
162
175
|
)
|
163
176
|
internal
|
164
177
|
{
|
165
|
-
|
178
|
+
_policyService.underwrite(
|
166
179
|
policyNftId,
|
167
180
|
requirePremiumPayment,
|
168
181
|
activateAt);
|
@@ -174,7 +187,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
174
187
|
)
|
175
188
|
internal
|
176
189
|
{
|
177
|
-
|
190
|
+
_policyService.collectPremium(
|
178
191
|
policyNftId,
|
179
192
|
activateAt);
|
180
193
|
}
|
@@ -185,17 +198,25 @@ contract Product is BaseComponent, IProductComponent {
|
|
185
198
|
)
|
186
199
|
internal
|
187
200
|
{
|
188
|
-
|
201
|
+
_policyService.activate(
|
189
202
|
policyNftId,
|
190
203
|
activateAt);
|
191
204
|
}
|
192
205
|
|
206
|
+
function _close(
|
207
|
+
NftId policyNftId
|
208
|
+
)
|
209
|
+
internal
|
210
|
+
{
|
211
|
+
_policyService.close(policyNftId);
|
212
|
+
}
|
213
|
+
|
193
214
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
194
215
|
return getRegistry().getNftId(address(_pool));
|
195
216
|
}
|
196
217
|
|
197
218
|
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
198
|
-
return getRegistry().getNftId(_distribution);
|
219
|
+
return getRegistry().getNftId(address(_distribution));
|
199
220
|
}
|
200
221
|
|
201
222
|
// from product component
|
@@ -207,93 +228,36 @@ contract Product is BaseComponent, IProductComponent {
|
|
207
228
|
onlyOwner
|
208
229
|
override
|
209
230
|
{
|
210
|
-
|
231
|
+
getProductService().setFees(productFee, processingFee);
|
211
232
|
}
|
212
233
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
view
|
217
|
-
override
|
218
|
-
returns (Fee memory productFee)
|
219
|
-
{
|
220
|
-
NftId productNftId = getNftId();
|
221
|
-
if (_instance.hasTreasuryInfo(productNftId)) {
|
222
|
-
return _instance.getTreasuryInfo(productNftId).productFee;
|
223
|
-
} else {
|
224
|
-
return _initialProductFee;
|
225
|
-
}
|
226
|
-
}
|
234
|
+
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
235
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
236
|
+
setupInfo = reader.getProductSetupInfo(getNftId());
|
227
237
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
override
|
232
|
-
returns (Fee memory processingFee)
|
233
|
-
{
|
234
|
-
NftId productNftId = getNftId();
|
235
|
-
if (_instance.hasTreasuryInfo(productNftId)) {
|
236
|
-
return _instance.getTreasuryInfo(productNftId).processingFee;
|
237
|
-
} else {
|
238
|
-
return _initialProcessingFee;
|
238
|
+
// fallback to initial setup info (wallet is always != address(0))
|
239
|
+
if(setupInfo.wallet == address(0)) {
|
240
|
+
setupInfo = _getInitialSetupInfo();
|
239
241
|
}
|
240
242
|
}
|
241
243
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
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();
|
269
|
-
|
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
|
-
)
|
244
|
+
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
245
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = _distribution.getSetupInfo();
|
246
|
+
ISetup.PoolSetupInfo memory poolSetupInfo = _pool.getSetupInfo();
|
247
|
+
|
248
|
+
return ISetup.ProductSetupInfo(
|
249
|
+
getToken(),
|
250
|
+
_tokenHandler,
|
251
|
+
_distributionNftId,
|
252
|
+
_poolNftId,
|
253
|
+
distributionSetupInfo.distributionFee,
|
254
|
+
_initialProductFee,
|
255
|
+
_initialProcessingFee,
|
256
|
+
poolSetupInfo.poolFee,
|
257
|
+
poolSetupInfo.stakingFee,
|
258
|
+
poolSetupInfo.performanceFee,
|
259
|
+
false,
|
260
|
+
getWallet()
|
297
261
|
);
|
298
262
|
}
|
299
263
|
}
|