@etherisc/gif-next 0.0.2-e1e92ab-754 → 0.0.2-e2a57af-971
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +160 -2
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +656 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +396 -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} +152 -165
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +480 -9
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +526 -65
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +571 -30
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +455 -201
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +474 -139
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +66 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +24 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +4 -0
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +42 -0
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +1 -1
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +1 -1
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +2 -2
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +2 -2
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +1 -1
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +2 -2
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +1 -1
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +1 -1
- package/artifacts/contracts/instance/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} +176 -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 +1024 -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 +47 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +340 -60
- 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 +59 -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 +216 -0
- package/contracts/components/Distribution.sol +49 -53
- package/contracts/components/IComponent.sol +43 -0
- package/contracts/components/IDistributionComponent.sol +6 -5
- package/contracts/components/IPoolComponent.sol +11 -15
- package/contracts/components/IProductComponent.sol +9 -7
- package/contracts/components/Pool.sol +77 -96
- package/contracts/components/Product.sol +82 -116
- package/contracts/experiment/cloning/Cloner.sol +47 -0
- 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 +41 -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 +442 -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 +77 -116
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +156 -432
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +39 -24
- package/contracts/registry/IRegistry.sol +49 -8
- package/contracts/registry/IRegistryService.sol +50 -20
- package/contracts/registry/Registry.sol +251 -225
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +84 -263
- package/contracts/registry/RegistryServiceManager.sol +20 -21
- 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/registry/IChainNft.sol/IChainNft.dbg.json +0 -4
- package/artifacts/contracts/registry/IChainNft.sol/IChainNft.json +0 -457
- 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/registry/IChainNft.sol +0 -22
- 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,36 +1,36 @@
|
|
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
|
-
import {
|
14
|
-
import {
|
15
|
-
import {ITreasury} from "../instance/module/treasury/ITreasury.sol";
|
15
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
16
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
16
17
|
|
17
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
18
|
-
import {Registerable} from "../shared/Registerable.sol";
|
19
18
|
|
20
|
-
contract Pool is
|
19
|
+
abstract contract Pool is Component, IPoolComponent {
|
20
|
+
using NftIdLib for NftId;
|
21
21
|
|
22
|
-
bool internal
|
22
|
+
bool internal _isConfirmingApplication;
|
23
23
|
UFixed internal _collateralizationLevel;
|
24
24
|
|
25
25
|
Fee internal _initialPoolFee;
|
26
26
|
Fee internal _initialStakingFee;
|
27
27
|
Fee internal _initialPerformanceFee;
|
28
28
|
|
29
|
+
TokenHandler internal _tokenHandler;
|
30
|
+
|
29
31
|
// may be used to interact with instance by derived contracts
|
30
32
|
IPoolService internal _poolService;
|
31
|
-
|
32
|
-
// only relevant to protect callback functions for "active" pools
|
33
|
-
IProductService private _productService;
|
33
|
+
IBundleService private _bundleService;
|
34
34
|
|
35
35
|
modifier onlyPoolService() {
|
36
36
|
require(
|
@@ -39,67 +39,50 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
39
39
|
_;
|
40
40
|
}
|
41
41
|
|
42
|
-
modifier onlyProductService() {
|
43
|
-
require(
|
44
|
-
msg.sender == address(_productService),
|
45
|
-
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
46
|
-
_;
|
47
|
-
}
|
48
|
-
|
49
42
|
constructor(
|
50
43
|
address registry,
|
51
44
|
NftId instanceNftId,
|
45
|
+
string memory name,
|
52
46
|
// TODO refactor into tokenNftId
|
53
47
|
address token,
|
54
48
|
bool isInterceptor,
|
55
|
-
bool
|
49
|
+
bool isConfirmingApplication,
|
56
50
|
UFixed collateralizationLevel,
|
57
51
|
Fee memory poolFee,
|
58
52
|
Fee memory stakingFee,
|
59
53
|
Fee memory performanceFee,
|
60
|
-
address initialOwner
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
54
|
+
address initialOwner,
|
55
|
+
bytes memory data
|
56
|
+
) Component(
|
57
|
+
registry,
|
58
|
+
instanceNftId,
|
59
|
+
name,
|
60
|
+
token,
|
61
|
+
POOL(),
|
62
|
+
isInterceptor,
|
63
|
+
initialOwner,
|
64
|
+
data
|
65
|
+
) {
|
66
|
+
_isConfirmingApplication = isConfirmingApplication;
|
65
67
|
// TODO add validation
|
66
68
|
_collateralizationLevel = collateralizationLevel;
|
67
69
|
_initialPoolFee = poolFee;
|
68
70
|
_initialStakingFee = stakingFee;
|
69
71
|
_initialPerformanceFee = performanceFee;
|
70
72
|
|
71
|
-
|
72
|
-
_productService = _instance.getProductService();
|
73
|
-
|
74
|
-
_registerInterface(type(IPoolComponent).interfaceId);
|
75
|
-
}
|
73
|
+
_tokenHandler = new TokenHandler(token);
|
76
74
|
|
77
|
-
|
78
|
-
|
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
|
-
);
|
75
|
+
_poolService = getInstance().getPoolService();
|
76
|
+
_bundleService = getInstance().getBundleService();
|
95
77
|
|
96
|
-
|
78
|
+
_registerInterface(type(IPoolComponent).interfaceId);
|
97
79
|
}
|
98
80
|
|
99
81
|
/**
|
100
82
|
* @dev see {IPool.underwrite}.
|
101
83
|
* Default implementation that only writes a {LogUnderwrittenByPool} entry.
|
102
84
|
*/
|
85
|
+
// FIXME: remove this function .. only _internal
|
103
86
|
function underwrite(
|
104
87
|
NftId policyNftId,
|
105
88
|
bytes memory policyData,
|
@@ -107,7 +90,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
107
90
|
uint256 collateralizationAmount
|
108
91
|
)
|
109
92
|
external
|
110
|
-
|
93
|
+
restricted()
|
111
94
|
virtual override
|
112
95
|
{
|
113
96
|
_underwrite(policyNftId, policyData, bundleFilter, collateralizationAmount);
|
@@ -130,8 +113,8 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
130
113
|
}
|
131
114
|
|
132
115
|
|
133
|
-
function
|
134
|
-
return
|
116
|
+
function isConfirmingApplication() external view override returns (bool isConfirmingApplication) {
|
117
|
+
return _isConfirmingApplication;
|
135
118
|
}
|
136
119
|
|
137
120
|
function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
|
@@ -144,7 +127,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
144
127
|
Fee memory performanceFee
|
145
128
|
)
|
146
129
|
external
|
147
|
-
|
130
|
+
restricted()
|
148
131
|
override
|
149
132
|
{
|
150
133
|
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
@@ -156,54 +139,52 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
156
139
|
)
|
157
140
|
external
|
158
141
|
override
|
159
|
-
// TODO add onlyBundleOwner
|
142
|
+
// TODO: add onlyBundleOwner
|
160
143
|
{
|
161
|
-
|
144
|
+
_bundleService.setBundleFee(bundleNftId, fee);
|
162
145
|
}
|
163
|
-
|
164
|
-
function
|
146
|
+
|
147
|
+
function lockBundle(
|
148
|
+
NftId bundleNftId
|
149
|
+
)
|
165
150
|
external
|
166
|
-
view
|
167
151
|
override
|
168
|
-
|
152
|
+
// TODO: add onlyBundleOwner
|
169
153
|
{
|
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
|
-
//}
|
154
|
+
_bundleService.lockBundle(bundleNftId);
|
177
155
|
}
|
178
156
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
view
|
186
|
-
override (IRegisterable, Registerable)
|
187
|
-
returns (IRegistry.ObjectInfo memory, bytes memory)
|
157
|
+
function unlockBundle(
|
158
|
+
NftId bundleNftId
|
159
|
+
)
|
160
|
+
external
|
161
|
+
override
|
162
|
+
// TODO: add onlyBundleOwner
|
188
163
|
{
|
189
|
-
(
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
164
|
+
_bundleService.unlockBundle(bundleNftId);
|
165
|
+
}
|
166
|
+
|
167
|
+
function getSetupInfo() public view returns (ISetup.PoolSetupInfo memory setupInfo) {
|
168
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
169
|
+
setupInfo = reader.getPoolSetupInfo(getNftId());
|
170
|
+
|
171
|
+
// fallback to initial setup info (wallet is always != address(0))
|
172
|
+
if(setupInfo.wallet == address(0)) {
|
173
|
+
setupInfo = _getInitialSetupInfo();
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
function _getInitialSetupInfo() internal view returns (ISetup.PoolSetupInfo memory) {
|
178
|
+
return ISetup.PoolSetupInfo(
|
179
|
+
getProductNftId(),
|
180
|
+
_tokenHandler,
|
181
|
+
_collateralizationLevel,
|
182
|
+
_initialPoolFee,
|
183
|
+
_initialStakingFee,
|
184
|
+
_initialPerformanceFee,
|
185
|
+
false,
|
186
|
+
_isConfirmingApplication,
|
187
|
+
getWallet()
|
207
188
|
);
|
208
189
|
}
|
209
190
|
|
@@ -235,7 +216,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
235
216
|
internal
|
236
217
|
returns(NftId bundleNftId)
|
237
218
|
{
|
238
|
-
bundleNftId =
|
219
|
+
bundleNftId = _bundleService.createBundle(
|
239
220
|
bundleOwner,
|
240
221
|
fee,
|
241
222
|
amount,
|
@@ -3,32 +3,34 @@ 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
|
-
import {
|
20
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
21
|
-
import {Registerable} from "../shared/Registerable.sol";
|
18
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
22
19
|
|
23
|
-
import {
|
20
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
21
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
24
22
|
import {Pool} from "../components/Pool.sol";
|
23
|
+
import {Distribution} from "../components/Distribution.sol";
|
25
24
|
|
26
|
-
contract Product is
|
27
|
-
|
25
|
+
abstract contract Product is Component, IProductComponent {
|
26
|
+
using NftIdLib for NftId;
|
27
|
+
|
28
|
+
IPolicyService internal _policyService;
|
28
29
|
Pool internal _pool;
|
29
|
-
|
30
|
+
Distribution internal _distribution;
|
30
31
|
Fee internal _initialProductFee;
|
31
32
|
Fee internal _initialProcessingFee;
|
33
|
+
TokenHandler internal _tokenHandler;
|
32
34
|
|
33
35
|
NftId internal _poolNftId;
|
34
36
|
NftId internal _distributionNftId;
|
@@ -36,23 +38,36 @@ contract Product is BaseComponent, IProductComponent {
|
|
36
38
|
constructor(
|
37
39
|
address registry,
|
38
40
|
NftId instanceNftid,
|
41
|
+
string memory name,
|
39
42
|
address token,
|
40
43
|
bool isInterceptor,
|
41
44
|
address pool,
|
42
45
|
address distribution,
|
43
46
|
Fee memory productFee,
|
44
47
|
Fee memory processingFee,
|
45
|
-
address initialOwner
|
46
|
-
|
48
|
+
address initialOwner,
|
49
|
+
bytes memory data
|
50
|
+
) Component (
|
51
|
+
registry,
|
52
|
+
instanceNftid,
|
53
|
+
name,
|
54
|
+
token,
|
55
|
+
PRODUCT(),
|
56
|
+
isInterceptor,
|
57
|
+
initialOwner,
|
58
|
+
data
|
59
|
+
) {
|
47
60
|
// TODO add validation
|
48
|
-
|
61
|
+
_policyService = getInstance().getPolicyService();
|
49
62
|
_pool = Pool(pool);
|
50
|
-
_distribution = distribution;
|
63
|
+
_distribution = Distribution(distribution);
|
51
64
|
_initialProductFee = productFee;
|
52
65
|
_initialProcessingFee = processingFee;
|
53
66
|
|
67
|
+
_tokenHandler = new TokenHandler(token);
|
68
|
+
|
54
69
|
_poolNftId = getRegistry().getNftId(address(_pool));
|
55
|
-
_distributionNftId = getRegistry().getNftId(_distribution);
|
70
|
+
_distributionNftId = getRegistry().getNftId(address(_distribution));
|
56
71
|
|
57
72
|
_registerInterface(type(IProductComponent).interfaceId);
|
58
73
|
}
|
@@ -63,15 +78,15 @@ contract Product is BaseComponent, IProductComponent {
|
|
63
78
|
RiskId riskId,
|
64
79
|
uint256 lifetime,
|
65
80
|
bytes memory applicationData,
|
66
|
-
|
67
|
-
|
81
|
+
NftId bundleNftId,
|
82
|
+
ReferralId referralId
|
68
83
|
)
|
69
84
|
external
|
70
85
|
view
|
71
86
|
override
|
72
87
|
returns (uint256 premiumAmount)
|
73
88
|
{
|
74
|
-
(premiumAmount,,,,) =
|
89
|
+
(premiumAmount,,,,) = _policyService.calculatePremium(
|
75
90
|
riskId,
|
76
91
|
sumInsuredAmount,
|
77
92
|
lifetime,
|
@@ -105,19 +120,19 @@ contract Product is BaseComponent, IProductComponent {
|
|
105
120
|
RiskId id,
|
106
121
|
bytes memory data
|
107
122
|
) internal {
|
108
|
-
|
123
|
+
getProductService().createRisk(
|
109
124
|
id,
|
110
125
|
data
|
111
126
|
);
|
112
127
|
}
|
113
128
|
|
114
|
-
function
|
129
|
+
function _updateRisk(
|
115
130
|
RiskId id,
|
116
|
-
|
131
|
+
bytes memory data
|
117
132
|
) internal {
|
118
|
-
|
133
|
+
getProductService().updateRisk(
|
119
134
|
id,
|
120
|
-
|
135
|
+
data
|
121
136
|
);
|
122
137
|
}
|
123
138
|
|
@@ -125,14 +140,14 @@ contract Product is BaseComponent, IProductComponent {
|
|
125
140
|
RiskId id,
|
126
141
|
StateId state
|
127
142
|
) internal {
|
128
|
-
|
143
|
+
getProductService().updateRiskState(
|
129
144
|
id,
|
130
145
|
state
|
131
146
|
);
|
132
147
|
}
|
133
148
|
|
134
149
|
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
135
|
-
return
|
150
|
+
return getInstance().getInstanceReader().getRiskInfo(id);
|
136
151
|
}
|
137
152
|
|
138
153
|
function _createApplication(
|
@@ -144,7 +159,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
144
159
|
NftId bundleNftId,
|
145
160
|
ReferralId referralId
|
146
161
|
) internal returns (NftId nftId) {
|
147
|
-
nftId =
|
162
|
+
nftId = _policyService.createApplication(
|
148
163
|
applicationOwner,
|
149
164
|
riskId,
|
150
165
|
sumInsuredAmount,
|
@@ -162,7 +177,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
162
177
|
)
|
163
178
|
internal
|
164
179
|
{
|
165
|
-
|
180
|
+
_policyService.underwrite(
|
166
181
|
policyNftId,
|
167
182
|
requirePremiumPayment,
|
168
183
|
activateAt);
|
@@ -174,7 +189,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
174
189
|
)
|
175
190
|
internal
|
176
191
|
{
|
177
|
-
|
192
|
+
_policyService.collectPremium(
|
178
193
|
policyNftId,
|
179
194
|
activateAt);
|
180
195
|
}
|
@@ -185,17 +200,25 @@ contract Product is BaseComponent, IProductComponent {
|
|
185
200
|
)
|
186
201
|
internal
|
187
202
|
{
|
188
|
-
|
203
|
+
_policyService.activate(
|
189
204
|
policyNftId,
|
190
205
|
activateAt);
|
191
206
|
}
|
192
207
|
|
208
|
+
function _close(
|
209
|
+
NftId policyNftId
|
210
|
+
)
|
211
|
+
internal
|
212
|
+
{
|
213
|
+
_policyService.close(policyNftId);
|
214
|
+
}
|
215
|
+
|
193
216
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
194
217
|
return getRegistry().getNftId(address(_pool));
|
195
218
|
}
|
196
219
|
|
197
220
|
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
198
|
-
return getRegistry().getNftId(_distribution);
|
221
|
+
return getRegistry().getNftId(address(_distribution));
|
199
222
|
}
|
200
223
|
|
201
224
|
// from product component
|
@@ -207,93 +230,36 @@ contract Product is BaseComponent, IProductComponent {
|
|
207
230
|
onlyOwner
|
208
231
|
override
|
209
232
|
{
|
210
|
-
|
233
|
+
getProductService().setFees(productFee, processingFee);
|
211
234
|
}
|
212
235
|
|
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
|
-
}
|
236
|
+
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
237
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
238
|
+
setupInfo = reader.getProductSetupInfo(getNftId());
|
227
239
|
|
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;
|
240
|
+
// fallback to initial setup info (wallet is always != address(0))
|
241
|
+
if(setupInfo.wallet == address(0)) {
|
242
|
+
setupInfo = _getInitialSetupInfo();
|
239
243
|
}
|
240
244
|
}
|
241
245
|
|
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
|
-
)
|
246
|
+
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
247
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = _distribution.getSetupInfo();
|
248
|
+
ISetup.PoolSetupInfo memory poolSetupInfo = _pool.getSetupInfo();
|
249
|
+
|
250
|
+
return ISetup.ProductSetupInfo(
|
251
|
+
getToken(),
|
252
|
+
_tokenHandler,
|
253
|
+
_distributionNftId,
|
254
|
+
_poolNftId,
|
255
|
+
distributionSetupInfo.distributionFee,
|
256
|
+
_initialProductFee,
|
257
|
+
_initialProcessingFee,
|
258
|
+
poolSetupInfo.poolFee,
|
259
|
+
poolSetupInfo.stakingFee,
|
260
|
+
poolSetupInfo.performanceFee,
|
261
|
+
false,
|
262
|
+
getWallet()
|
297
263
|
);
|
298
264
|
}
|
299
265
|
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
|
5
|
+
|
6
|
+
|
7
|
+
contract Cloner {
|
8
|
+
|
9
|
+
Mock1 public mock1;
|
10
|
+
Mock2 public mock2;
|
11
|
+
|
12
|
+
constructor() {
|
13
|
+
mock1 = new Mock1();
|
14
|
+
mock2 = new Mock2();
|
15
|
+
}
|
16
|
+
|
17
|
+
function createClone(address master)
|
18
|
+
external
|
19
|
+
returns (address cloned)
|
20
|
+
{
|
21
|
+
cloned = Clones.clone(master);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
contract Mock1 {
|
27
|
+
function getValue() external virtual view returns (uint256) {
|
28
|
+
return 42;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
contract Mock2 is Mock1 {
|
33
|
+
uint256 internal _value;
|
34
|
+
|
35
|
+
constructor() {
|
36
|
+
_value = 42;
|
37
|
+
}
|
38
|
+
|
39
|
+
function setValue(uint256 value) external virtual {
|
40
|
+
_value = value;
|
41
|
+
}
|
42
|
+
|
43
|
+
function getValue() external virtual override view returns (uint256) {
|
44
|
+
return _value;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|