@etherisc/gif-next 0.0.2-7b53731-256 → 0.0.2-7b86057-523
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +211 -27
- 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 +530 -86
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/{registry/IChainNft.sol/IChainNft.json → components/IComponent.sol/IComponent.json} +244 -241
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +357 -49
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +400 -118
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +452 -74
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +564 -172
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +622 -117
- 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 +995 -1022
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +4 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +586 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +1835 -1161
- 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 +1039 -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/ComponentService.sol/ComponentService.json +603 -0
- 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 +415 -63
- 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 +178 -62
- 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 +178 -124
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +175 -274
- 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 +395 -132
- 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 +348 -350
- 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 +186 -12
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +455 -36
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +4 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +981 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +4 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +34 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +465 -111
- 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 +4 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +1200 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +464 -0
- 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 +4 -0
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.json +107 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +4 -0
- package/artifacts/contracts/{instance/module/component/IComponent.sol/IComponentModule.json → shared/INftOwnable.sol/INftOwnable.json} +67 -57
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +112 -37
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +4 -0
- package/artifacts/contracts/{instance/service/IComponentOwnerService.sol/IComponentOwnerService.json → shared/IService.sol/IService.json} +169 -117
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +55 -14
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +4 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +171 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +362 -0
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +193 -32
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +4 -0
- package/artifacts/contracts/{instance/base/InstanceBase.sol/InstanceBase.json → shared/Service.sol/Service.json} +202 -102
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +96 -0
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +4 -0
- package/artifacts/contracts/shared/{Proxy.sol/ProxyWithProxyAdminGetter.json → UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json} +4 -4
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +78 -14
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +4 -4
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +207 -31
- 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 +292 -63
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.json +91 -53
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +103 -23
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/test/Usdc.sol/USDC.json +91 -53
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/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/Fee.sol/FeeLib.json +4 -4
- 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 +4 -0
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +10 -0
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +4 -0
- package/artifacts/contracts/types/UFixed.sol/{UFixedMathLib.json → UFixedLib.json} +3 -3
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +40 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +22 -3
- package/contracts/components/Component.sol +216 -0
- package/contracts/components/Distribution.sol +57 -38
- package/contracts/components/IComponent.sol +43 -0
- package/contracts/components/IDistributionComponent.sol +6 -6
- package/contracts/components/IPoolComponent.sol +12 -23
- package/contracts/components/IProductComponent.sol +10 -9
- package/contracts/components/Pool.sol +112 -120
- package/contracts/components/Product.sol +99 -61
- 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 -45
- package/contracts/instance/IInstanceService.sol +41 -0
- package/contracts/instance/Instance.sol +254 -59
- package/contracts/instance/InstanceAccessManager.sol +298 -0
- package/contracts/instance/InstanceReader.sol +293 -0
- package/contracts/instance/InstanceService.sol +435 -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 +70 -23
- 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 -115
- package/contracts/instance/service/PoolServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +158 -434
- package/contracts/instance/service/ProductServiceManager.sol +54 -0
- package/contracts/registry/ChainNft.sol +79 -36
- package/contracts/registry/IRegistry.sol +65 -24
- package/contracts/registry/IRegistryService.sol +65 -0
- package/contracts/registry/ITransferInterceptor.sol +6 -0
- package/contracts/registry/Registry.sol +358 -287
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +262 -0
- package/contracts/registry/RegistryServiceManager.sol +62 -0
- package/contracts/registry/ReleaseManager.sol +332 -0
- package/contracts/registry/TokenRegistry.sol +112 -0
- package/contracts/shared/ContractDeployerLib.sol +72 -0
- package/contracts/shared/ERC165.sol +6 -2
- package/contracts/shared/INftOwnable.sol +22 -0
- package/contracts/shared/IRegisterable.sol +8 -17
- package/contracts/shared/IService.sol +16 -0
- package/contracts/shared/IVersionable.sol +55 -11
- package/contracts/shared/NftOwnable.sol +139 -0
- package/contracts/shared/ProxyManager.sol +94 -0
- package/contracts/shared/Registerable.sol +59 -59
- package/contracts/shared/Service.sol +60 -0
- package/contracts/shared/TokenHandler.sol +27 -0
- package/contracts/shared/UpgradableProxyWithAdmin.sol +16 -0
- package/contracts/shared/Versionable.sol +113 -55
- package/contracts/test/TestFee.sol +2 -2
- package/contracts/test/TestRegisterable.sol +5 -6
- package/contracts/test/TestRoleId.sol +1 -1
- package/contracts/test/TestService.sol +7 -14
- package/contracts/types/DistributorType.sol +55 -0
- package/contracts/types/Fee.sol +3 -3
- 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 +61 -9
- package/contracts/types/StateId.sol +5 -1
- package/contracts/types/Timestamp.sol +7 -3
- package/contracts/types/UFixed.sol +128 -12
- package/contracts/types/Version.sol +13 -1
- package/package.json +4 -3
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.json +0 -174
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -174
- 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/ComponentServiceBase.sol/ComponentServiceBase.json +0 -300
- 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/IService.sol/IService.json +0 -300
- 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/base/ServiceBase.sol/ServiceBase.json +0 -300
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/Access.sol/AccessModule.json +0 -333
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccess.json +0 -10
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/access/IAccess.sol/IAccessModule.json +0 -333
- package/artifacts/contracts/instance/module/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/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 -284
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/policy/PolicyModule.sol/PolicyModule.json +0 -284
- 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 -144
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.dbg.json +0 -4
- package/artifacts/contracts/instance/module/pool/PoolModule.sol/PoolModule.json +0 -144
- 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 -511
- 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 -511
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -531
- 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/IRegistryLinked.sol/IRegistryLinked.dbg.json +0 -4
- package/artifacts/contracts/registry/IRegistryLinked.sol/IRegistryLinked.json +0 -24
- package/artifacts/contracts/registry/RegistryUpgradeable.sol/RegistryUpgradeable.dbg.json +0 -4
- package/artifacts/contracts/registry/RegistryUpgradeable.sol/RegistryUpgradeable.json +0 -495
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.dbg.json +0 -4
- package/artifacts/contracts/shared/IOwnable.sol/IOwnable.json +0 -24
- package/artifacts/contracts/shared/Proxy.sol/Proxy.dbg.json +0 -4
- package/artifacts/contracts/shared/Proxy.sol/Proxy.json +0 -178
- package/artifacts/contracts/shared/Proxy.sol/ProxyWithProxyAdminGetter.dbg.json +0 -4
- package/artifacts/contracts/shared/VersionableUpgradeable.sol/VersionableUpgradeable.dbg.json +0 -4
- package/artifacts/contracts/shared/VersionableUpgradeable.sol/VersionableUpgradeable.json +0 -187
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.dbg.json +0 -4
- package/artifacts/contracts/test/TestDistribution.sol/TestDistribution.json +0 -405
- package/artifacts/contracts/test/TestPool.sol/TestPool.dbg.json +0 -4
- package/artifacts/contracts/test/TestPool.sol/TestPool.json +0 -578
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.dbg.json +0 -4
- package/artifacts/contracts/test/TestProduct.sol/TestProduct.json +0 -575
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.dbg.json +0 -4
- package/artifacts/contracts/types/ReferralId.sol/ReferralIdLib.json +0 -99
- package/artifacts/contracts/types/UFixed.sol/UFixedMathLib.dbg.json +0 -4
- package/contracts/components/BaseComponent.sol +0 -94
- package/contracts/components/IBaseComponent.sol +0 -19
- package/contracts/experiment/statemachine/README.md +0 -112
- package/contracts/instance/IInstanceLinked.sol +0 -8
- package/contracts/instance/base/ComponentServiceBase.sol +0 -42
- package/contracts/instance/base/IInstanceBase.sol +0 -22
- package/contracts/instance/base/IService.sol +0 -15
- package/contracts/instance/base/InstanceBase.sol +0 -91
- package/contracts/instance/base/ModuleBase.sol +0 -57
- package/contracts/instance/base/ServiceBase.sol +0 -37
- package/contracts/instance/module/access/Access.sol +0 -149
- package/contracts/instance/module/access/IAccess.sol +0 -53
- package/contracts/instance/module/bundle/BundleModule.sol +0 -134
- package/contracts/instance/module/bundle/IBundle.sol +0 -53
- package/contracts/instance/module/component/ComponentModule.sol +0 -70
- 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 -40
- package/contracts/instance/module/pool/PoolModule.sol +0 -90
- 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 -82
- package/contracts/instance/module/treasury/TokenHandler.sol +0 -48
- package/contracts/instance/module/treasury/TreasuryModule.sol +0 -138
- package/contracts/instance/service/ComponentOwnerService.sol +0 -157
- package/contracts/instance/service/IComponentOwnerService.sol +0 -22
- package/contracts/registry/IChainNft.sol +0 -21
- package/contracts/registry/IRegistryLinked.sol +0 -8
- package/contracts/registry/RegistryUpgradeable.sol +0 -416
- package/contracts/shared/IOwnable.sol +0 -6
- package/contracts/shared/Proxy.sol +0 -83
- package/contracts/shared/VersionableUpgradeable.sol +0 -108
- package/contracts/test/TestDistribution.sol +0 -21
- package/contracts/test/TestPool.sol +0 -25
- package/contracts/test/TestProduct.sol +0 -72
- package/contracts/types/ReferralId.sol +0 -48
@@ -1,14 +1,17 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {Fee} from "../types/Fee.sol";
|
5
|
+
import {IComponent} from "./IComponent.sol";
|
6
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
5
7
|
import {NftId} from "../types/NftId.sol";
|
6
|
-
import {ReferralId} from "../types/
|
8
|
+
import {ReferralId} from "../types/Referral.sol";
|
7
9
|
import {RiskId} from "../types/RiskId.sol";
|
8
10
|
|
9
|
-
|
11
|
+
interface IProductComponent is IComponent {
|
12
|
+
|
13
|
+
function getSetupInfo() external view returns (ISetup.ProductSetupInfo memory setupInfo);
|
10
14
|
|
11
|
-
interface IProductComponent is IBaseComponent {
|
12
15
|
function setFees(
|
13
16
|
Fee memory productFee,
|
14
17
|
Fee memory processingFee
|
@@ -19,8 +22,8 @@ interface IProductComponent is IBaseComponent {
|
|
19
22
|
RiskId riskId,
|
20
23
|
uint256 lifetime,
|
21
24
|
bytes memory applicationData,
|
22
|
-
|
23
|
-
|
25
|
+
NftId bundleNftId,
|
26
|
+
ReferralId referralId
|
24
27
|
) external view returns (uint256 premiumAmount);
|
25
28
|
|
26
29
|
function calculateNetPremium(
|
@@ -30,9 +33,7 @@ interface IProductComponent is IBaseComponent {
|
|
30
33
|
bytes memory applicationData
|
31
34
|
) external view returns (uint256 netPremiumAmount);
|
32
35
|
|
33
|
-
|
34
|
-
function getProcessingFee() external view returns (Fee memory processingFee);
|
35
|
-
|
36
|
+
|
36
37
|
function getPoolNftId() external view returns (NftId poolNftId);
|
37
38
|
function getDistributionNftId() external view returns (NftId distributionNftId);
|
38
39
|
}
|
@@ -1,29 +1,36 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
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 {ISetup} from "../instance/module/ISetup.sol";
|
16
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
14
17
|
|
15
|
-
|
18
|
+
|
19
|
+
abstract contract Pool is Component, IPoolComponent {
|
20
|
+
using NftIdLib for NftId;
|
21
|
+
|
22
|
+
bool internal _isConfirmingApplication;
|
16
23
|
UFixed internal _collateralizationLevel;
|
17
24
|
|
18
25
|
Fee internal _initialPoolFee;
|
19
26
|
Fee internal _initialStakingFee;
|
20
27
|
Fee internal _initialPerformanceFee;
|
21
28
|
|
29
|
+
TokenHandler internal _tokenHandler;
|
30
|
+
|
22
31
|
// may be used to interact with instance by derived contracts
|
23
32
|
IPoolService internal _poolService;
|
24
|
-
|
25
|
-
// only relevant to protect callback functions for "active" pools
|
26
|
-
IProductService private _productService;
|
33
|
+
IBundleService private _bundleService;
|
27
34
|
|
28
35
|
modifier onlyPoolService() {
|
29
36
|
require(
|
@@ -32,86 +39,50 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
32
39
|
_;
|
33
40
|
}
|
34
41
|
|
35
|
-
modifier onlyProductService() {
|
36
|
-
require(
|
37
|
-
msg.sender == address(_productService),
|
38
|
-
"ERROR:POL-002:NOT_PRODUCT_SERVICE");
|
39
|
-
_;
|
40
|
-
}
|
41
|
-
|
42
42
|
constructor(
|
43
43
|
address registry,
|
44
44
|
NftId instanceNftId,
|
45
|
+
string memory name,
|
45
46
|
// TODO refactor into tokenNftId
|
46
47
|
address token,
|
47
|
-
bool
|
48
|
+
bool isInterceptor,
|
49
|
+
bool isConfirmingApplication,
|
48
50
|
UFixed collateralizationLevel,
|
49
51
|
Fee memory poolFee,
|
50
52
|
Fee memory stakingFee,
|
51
|
-
Fee memory performanceFee
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
Fee memory performanceFee,
|
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;
|
56
67
|
// TODO add validation
|
57
68
|
_collateralizationLevel = collateralizationLevel;
|
58
69
|
_initialPoolFee = poolFee;
|
59
70
|
_initialStakingFee = stakingFee;
|
60
71
|
_initialPerformanceFee = performanceFee;
|
61
72
|
|
62
|
-
|
63
|
-
_productService = _instance.getProductService();
|
64
|
-
}
|
73
|
+
_tokenHandler = new TokenHandler(token);
|
65
74
|
|
66
|
-
|
67
|
-
|
68
|
-
Fee memory stakingFee,
|
69
|
-
Fee memory performanceFee
|
70
|
-
)
|
71
|
-
external
|
72
|
-
onlyOwner
|
73
|
-
override
|
74
|
-
{
|
75
|
-
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
76
|
-
}
|
75
|
+
_poolService = getInstance().getPoolService();
|
76
|
+
_bundleService = getInstance().getBundleService();
|
77
77
|
|
78
|
-
|
79
|
-
Fee memory fee,
|
80
|
-
uint256 initialAmount,
|
81
|
-
uint256 lifetime,
|
82
|
-
bytes memory filter
|
83
|
-
)
|
84
|
-
external
|
85
|
-
virtual override
|
86
|
-
returns(NftId bundleNftId)
|
87
|
-
{
|
88
|
-
address owner = msg.sender;
|
89
|
-
bundleNftId = _poolService.createBundle(
|
90
|
-
owner,
|
91
|
-
fee,
|
92
|
-
initialAmount,
|
93
|
-
lifetime,
|
94
|
-
filter
|
95
|
-
);
|
96
|
-
|
97
|
-
// TODO add logging
|
98
|
-
}
|
99
|
-
|
100
|
-
function setBundleFee(
|
101
|
-
NftId bundleNftId,
|
102
|
-
Fee memory fee
|
103
|
-
)
|
104
|
-
external
|
105
|
-
override
|
106
|
-
// TODO add onlyBundleOwner
|
107
|
-
{
|
108
|
-
_poolService.setBundleFee(bundleNftId, fee);
|
78
|
+
_registerInterface(type(IPoolComponent).interfaceId);
|
109
79
|
}
|
110
80
|
|
111
81
|
/**
|
112
82
|
* @dev see {IPool.underwrite}.
|
113
83
|
* Default implementation that only writes a {LogUnderwrittenByPool} entry.
|
114
84
|
*/
|
85
|
+
// FIXME: remove this function .. only _internal
|
115
86
|
function underwrite(
|
116
87
|
NftId policyNftId,
|
117
88
|
bytes memory policyData,
|
@@ -119,7 +90,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
119
90
|
uint256 collateralizationAmount
|
120
91
|
)
|
121
92
|
external
|
122
|
-
|
93
|
+
restricted()
|
123
94
|
virtual override
|
124
95
|
{
|
125
96
|
_underwrite(policyNftId, policyData, bundleFilter, collateralizationAmount);
|
@@ -142,14 +113,83 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
142
113
|
}
|
143
114
|
|
144
115
|
|
145
|
-
function
|
146
|
-
return
|
116
|
+
function isConfirmingApplication() external view override returns (bool isConfirmingApplication) {
|
117
|
+
return _isConfirmingApplication;
|
147
118
|
}
|
148
119
|
|
149
120
|
function getCollateralizationLevel() external view override returns (UFixed collateralizationLevel) {
|
150
121
|
return _collateralizationLevel;
|
151
122
|
}
|
152
123
|
|
124
|
+
function setFees(
|
125
|
+
Fee memory poolFee,
|
126
|
+
Fee memory stakingFee,
|
127
|
+
Fee memory performanceFee
|
128
|
+
)
|
129
|
+
external
|
130
|
+
restricted()
|
131
|
+
override
|
132
|
+
{
|
133
|
+
_poolService.setFees(poolFee, stakingFee, performanceFee);
|
134
|
+
}
|
135
|
+
|
136
|
+
function setBundleFee(
|
137
|
+
NftId bundleNftId,
|
138
|
+
Fee memory fee
|
139
|
+
)
|
140
|
+
external
|
141
|
+
override
|
142
|
+
// TODO: add onlyBundleOwner
|
143
|
+
{
|
144
|
+
_bundleService.setBundleFee(bundleNftId, fee);
|
145
|
+
}
|
146
|
+
|
147
|
+
function lockBundle(
|
148
|
+
NftId bundleNftId
|
149
|
+
)
|
150
|
+
external
|
151
|
+
override
|
152
|
+
// TODO: add onlyBundleOwner
|
153
|
+
{
|
154
|
+
_bundleService.lockBundle(bundleNftId);
|
155
|
+
}
|
156
|
+
|
157
|
+
function unlockBundle(
|
158
|
+
NftId bundleNftId
|
159
|
+
)
|
160
|
+
external
|
161
|
+
override
|
162
|
+
// TODO: add onlyBundleOwner
|
163
|
+
{
|
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()
|
188
|
+
);
|
189
|
+
}
|
190
|
+
|
191
|
+
// Internals
|
192
|
+
|
153
193
|
function _underwrite(
|
154
194
|
NftId policyNftId,
|
155
195
|
bytes memory policyData,
|
@@ -176,7 +216,7 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
176
216
|
internal
|
177
217
|
returns(NftId bundleNftId)
|
178
218
|
{
|
179
|
-
bundleNftId =
|
219
|
+
bundleNftId = _bundleService.createBundle(
|
180
220
|
bundleOwner,
|
181
221
|
fee,
|
182
222
|
amount,
|
@@ -184,52 +224,4 @@ contract Pool is BaseComponent, IPoolComponent {
|
|
184
224
|
filter
|
185
225
|
);
|
186
226
|
}
|
187
|
-
|
188
|
-
// from pool component
|
189
|
-
function getPoolFee()
|
190
|
-
external
|
191
|
-
view
|
192
|
-
override
|
193
|
-
returns (Fee memory poolFee)
|
194
|
-
{
|
195
|
-
NftId productNftId = _instance.getProductNftId(getNftId());
|
196
|
-
if (_instance.hasTreasuryInfo(productNftId)) {
|
197
|
-
return _instance.getTreasuryInfo(productNftId).poolFee;
|
198
|
-
} else {
|
199
|
-
return _initialPoolFee;
|
200
|
-
}
|
201
|
-
}
|
202
|
-
|
203
|
-
function getStakingFee()
|
204
|
-
external
|
205
|
-
view
|
206
|
-
override
|
207
|
-
returns (Fee memory stakingFee)
|
208
|
-
{
|
209
|
-
NftId productNftId = _instance.getProductNftId(getNftId());
|
210
|
-
if (_instance.hasTreasuryInfo(productNftId)) {
|
211
|
-
return _instance.getTreasuryInfo(productNftId).stakingFee;
|
212
|
-
} else {
|
213
|
-
return _initialStakingFee;
|
214
|
-
}
|
215
|
-
}
|
216
|
-
|
217
|
-
function getPerformanceFee()
|
218
|
-
external
|
219
|
-
view
|
220
|
-
override
|
221
|
-
returns (Fee memory performanceFee)
|
222
|
-
{
|
223
|
-
NftId productNftId = _instance.getProductNftId(getNftId());
|
224
|
-
if (_instance.hasTreasuryInfo(productNftId)) {
|
225
|
-
return _instance.getTreasuryInfo(productNftId).performanceFee;
|
226
|
-
} else {
|
227
|
-
return _initialPerformanceFee;
|
228
|
-
}
|
229
|
-
}
|
230
|
-
|
231
|
-
// from registerable
|
232
|
-
function getType() public pure override returns (ObjectType) {
|
233
|
-
return POOL();
|
234
|
-
}
|
235
227
|
}
|
@@ -1,41 +1,75 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.19;
|
3
3
|
|
4
|
-
import {
|
5
|
-
|
6
|
-
import {
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
6
|
+
import {IRisk} from "../instance/module/IRisk.sol";
|
7
|
+
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
7
8
|
import {IProductComponent} from "./IProductComponent.sol";
|
8
|
-
import {NftId} from "../types/NftId.sol";
|
9
|
-
import {
|
10
|
-
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";
|
11
12
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
12
13
|
import {StateId} from "../types/StateId.sol";
|
13
14
|
import {Timestamp} from "../types/Timestamp.sol";
|
14
15
|
import {Fee} from "../types/Fee.sol";
|
15
|
-
import {
|
16
|
+
import {Component} from "./Component.sol";
|
17
|
+
|
18
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
19
|
+
|
20
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
21
|
+
import {ISetup} from "../instance/module/ISetup.sol";
|
22
|
+
import {Pool} from "../components/Pool.sol";
|
23
|
+
import {Distribution} from "../components/Distribution.sol";
|
24
|
+
|
25
|
+
abstract contract Product is Component, IProductComponent {
|
26
|
+
using NftIdLib for NftId;
|
16
27
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
address internal _distribution;
|
28
|
+
IPolicyService internal _policyService;
|
29
|
+
Pool internal _pool;
|
30
|
+
Distribution internal _distribution;
|
21
31
|
Fee internal _initialProductFee;
|
22
32
|
Fee internal _initialProcessingFee;
|
33
|
+
TokenHandler internal _tokenHandler;
|
34
|
+
|
35
|
+
NftId internal _poolNftId;
|
36
|
+
NftId internal _distributionNftId;
|
23
37
|
|
24
38
|
constructor(
|
25
39
|
address registry,
|
26
40
|
NftId instanceNftid,
|
41
|
+
string memory name,
|
27
42
|
address token,
|
43
|
+
bool isInterceptor,
|
28
44
|
address pool,
|
29
45
|
address distribution,
|
30
46
|
Fee memory productFee,
|
31
|
-
Fee memory processingFee
|
32
|
-
|
47
|
+
Fee memory processingFee,
|
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
|
+
) {
|
33
60
|
// TODO add validation
|
34
|
-
|
35
|
-
_pool = pool;
|
36
|
-
_distribution = distribution;
|
61
|
+
_policyService = getInstance().getPolicyService();
|
62
|
+
_pool = Pool(pool);
|
63
|
+
_distribution = Distribution(distribution);
|
37
64
|
_initialProductFee = productFee;
|
38
|
-
_initialProcessingFee = processingFee;
|
65
|
+
_initialProcessingFee = processingFee;
|
66
|
+
|
67
|
+
_tokenHandler = new TokenHandler(token);
|
68
|
+
|
69
|
+
_poolNftId = getRegistry().getNftId(address(_pool));
|
70
|
+
_distributionNftId = getRegistry().getNftId(address(_distribution));
|
71
|
+
|
72
|
+
_registerInterface(type(IProductComponent).interfaceId);
|
39
73
|
}
|
40
74
|
|
41
75
|
|
@@ -44,15 +78,15 @@ contract Product is BaseComponent, IProductComponent {
|
|
44
78
|
RiskId riskId,
|
45
79
|
uint256 lifetime,
|
46
80
|
bytes memory applicationData,
|
47
|
-
|
48
|
-
|
81
|
+
NftId bundleNftId,
|
82
|
+
ReferralId referralId
|
49
83
|
)
|
50
84
|
external
|
51
85
|
view
|
52
86
|
override
|
53
87
|
returns (uint256 premiumAmount)
|
54
88
|
{
|
55
|
-
(premiumAmount,,,,) =
|
89
|
+
(premiumAmount,,,,) = _policyService.calculatePremium(
|
56
90
|
riskId,
|
57
91
|
sumInsuredAmount,
|
58
92
|
lifetime,
|
@@ -86,19 +120,19 @@ contract Product is BaseComponent, IProductComponent {
|
|
86
120
|
RiskId id,
|
87
121
|
bytes memory data
|
88
122
|
) internal {
|
89
|
-
|
123
|
+
getProductService().createRisk(
|
90
124
|
id,
|
91
125
|
data
|
92
126
|
);
|
93
127
|
}
|
94
128
|
|
95
|
-
function
|
129
|
+
function _updateRisk(
|
96
130
|
RiskId id,
|
97
|
-
|
131
|
+
bytes memory data
|
98
132
|
) internal {
|
99
|
-
|
133
|
+
getProductService().updateRisk(
|
100
134
|
id,
|
101
|
-
|
135
|
+
data
|
102
136
|
);
|
103
137
|
}
|
104
138
|
|
@@ -106,14 +140,14 @@ contract Product is BaseComponent, IProductComponent {
|
|
106
140
|
RiskId id,
|
107
141
|
StateId state
|
108
142
|
) internal {
|
109
|
-
|
143
|
+
getProductService().updateRiskState(
|
110
144
|
id,
|
111
145
|
state
|
112
146
|
);
|
113
147
|
}
|
114
148
|
|
115
149
|
function _getRiskInfo(RiskId id) internal view returns (IRisk.RiskInfo memory info) {
|
116
|
-
return
|
150
|
+
return getInstance().getInstanceReader().getRiskInfo(id);
|
117
151
|
}
|
118
152
|
|
119
153
|
function _createApplication(
|
@@ -125,7 +159,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
125
159
|
NftId bundleNftId,
|
126
160
|
ReferralId referralId
|
127
161
|
) internal returns (NftId nftId) {
|
128
|
-
nftId =
|
162
|
+
nftId = _policyService.createApplication(
|
129
163
|
applicationOwner,
|
130
164
|
riskId,
|
131
165
|
sumInsuredAmount,
|
@@ -143,7 +177,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
143
177
|
)
|
144
178
|
internal
|
145
179
|
{
|
146
|
-
|
180
|
+
_policyService.underwrite(
|
147
181
|
policyNftId,
|
148
182
|
requirePremiumPayment,
|
149
183
|
activateAt);
|
@@ -155,7 +189,7 @@ contract Product is BaseComponent, IProductComponent {
|
|
155
189
|
)
|
156
190
|
internal
|
157
191
|
{
|
158
|
-
|
192
|
+
_policyService.collectPremium(
|
159
193
|
policyNftId,
|
160
194
|
activateAt);
|
161
195
|
}
|
@@ -166,17 +200,25 @@ contract Product is BaseComponent, IProductComponent {
|
|
166
200
|
)
|
167
201
|
internal
|
168
202
|
{
|
169
|
-
|
203
|
+
_policyService.activate(
|
170
204
|
policyNftId,
|
171
205
|
activateAt);
|
172
206
|
}
|
173
207
|
|
208
|
+
function _close(
|
209
|
+
NftId policyNftId
|
210
|
+
)
|
211
|
+
internal
|
212
|
+
{
|
213
|
+
_policyService.close(policyNftId);
|
214
|
+
}
|
215
|
+
|
174
216
|
function getPoolNftId() external view override returns (NftId poolNftId) {
|
175
|
-
return
|
217
|
+
return getRegistry().getNftId(address(_pool));
|
176
218
|
}
|
177
219
|
|
178
220
|
function getDistributionNftId() external view override returns (NftId distributionNftId) {
|
179
|
-
return
|
221
|
+
return getRegistry().getNftId(address(_distribution));
|
180
222
|
}
|
181
223
|
|
182
224
|
// from product component
|
@@ -188,40 +230,36 @@ contract Product is BaseComponent, IProductComponent {
|
|
188
230
|
onlyOwner
|
189
231
|
override
|
190
232
|
{
|
191
|
-
|
233
|
+
getProductService().setFees(productFee, processingFee);
|
192
234
|
}
|
193
235
|
|
236
|
+
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
237
|
+
InstanceReader reader = getInstance().getInstanceReader();
|
238
|
+
setupInfo = reader.getProductSetupInfo(getNftId());
|
194
239
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
override
|
199
|
-
returns (Fee memory productFee)
|
200
|
-
{
|
201
|
-
NftId productNftId = getNftId();
|
202
|
-
if (_instance.hasTreasuryInfo(productNftId)) {
|
203
|
-
return _instance.getTreasuryInfo(productNftId).productFee;
|
204
|
-
} else {
|
205
|
-
return _initialProductFee;
|
240
|
+
// fallback to initial setup info (wallet is always != address(0))
|
241
|
+
if(setupInfo.wallet == address(0)) {
|
242
|
+
setupInfo = _getInitialSetupInfo();
|
206
243
|
}
|
207
244
|
}
|
208
245
|
|
209
|
-
function
|
210
|
-
|
211
|
-
|
212
|
-
override
|
213
|
-
returns (Fee memory processingFee)
|
214
|
-
{
|
215
|
-
NftId productNftId = getNftId();
|
216
|
-
if (_instance.hasTreasuryInfo(productNftId)) {
|
217
|
-
return _instance.getTreasuryInfo(productNftId).processingFee;
|
218
|
-
} else {
|
219
|
-
return _initialProcessingFee;
|
220
|
-
}
|
221
|
-
}
|
246
|
+
function _getInitialSetupInfo() internal view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
247
|
+
ISetup.DistributionSetupInfo memory distributionSetupInfo = _distribution.getSetupInfo();
|
248
|
+
ISetup.PoolSetupInfo memory poolSetupInfo = _pool.getSetupInfo();
|
222
249
|
|
223
|
-
|
224
|
-
|
225
|
-
|
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()
|
263
|
+
);
|
226
264
|
}
|
227
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
|
+
|