@etherisc/gif-next 0.0.2-4e6a781-730 → 0.0.2-4e99ed1-062
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 +8 -13
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +280 -94
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +632 -152
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +208 -58
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +407 -86
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +446 -151
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +212 -130
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +591 -185
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +384 -166
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +1206 -0
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +64 -50
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.json +5 -0
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +845 -458
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +240 -193
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +1013 -783
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +463 -167
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +136 -228
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +455 -300
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +370 -102
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +8 -13
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +181 -177
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- 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 +40 -10
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +36 -11
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +58 -75
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1039 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +673 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +474 -345
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +363 -91
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +817 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +641 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +1224 -198
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +453 -85
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +622 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +223 -279
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +475 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +796 -147
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +91 -251
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +476 -126
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +73 -154
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +250 -385
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +317 -125
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +634 -203
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +317 -93
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +217 -233
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +309 -93
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +15 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +34 -2
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +75 -190
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +18 -0
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +47 -15
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +2 -2
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +191 -233
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +300 -94
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +23 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +141 -37
- 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 +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +40 -29
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +21 -29
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{experiment/inheritance/IB.sol/IB.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +18 -20
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +73 -154
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -152
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +113 -33
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +248 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +294 -74
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +125 -55
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +84 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +178 -158
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- 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/shared/Versionable.sol/Versionable.json +2 -152
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +125 -55
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +195 -207
- 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 +8 -190
- 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/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +161 -0
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +100 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +40 -9
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- 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/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +100 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
- 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 +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +25 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- 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 +2 -2
- package/contracts/components/Component.sol +115 -78
- package/contracts/components/Distribution.sol +187 -57
- package/contracts/components/IComponent.sol +50 -17
- package/contracts/components/IDistributionComponent.sol +39 -15
- package/contracts/components/IPoolComponent.sol +84 -31
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +224 -148
- package/contracts/components/Product.sol +97 -69
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +7 -5
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +36 -10
- package/contracts/instance/IInstanceService.sol +35 -4
- package/contracts/instance/Instance.sol +101 -43
- package/contracts/instance/InstanceAccessManager.sol +389 -160
- package/contracts/instance/InstanceReader.sol +8 -10
- package/contracts/instance/InstanceService.sol +243 -190
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +17 -30
- package/contracts/instance/base/KeyValueStore.sol +13 -5
- package/contracts/instance/base/Lifecycle.sol +11 -2
- package/contracts/instance/module/IAccess.sol +22 -16
- package/contracts/instance/module/IBundle.sol +8 -5
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IDistribution.sol +2 -0
- package/contracts/instance/module/IPolicy.sol +30 -3
- package/contracts/instance/module/ISetup.sol +7 -20
- package/contracts/instance/service/ApplicationService.sol +350 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +215 -77
- package/contracts/instance/service/BundleServiceManager.sol +1 -1
- package/contracts/instance/service/ClaimService.sol +151 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +348 -19
- package/contracts/instance/service/DistributionServiceManager.sol +1 -1
- package/contracts/instance/service/IApplicationService.sol +82 -0
- package/contracts/instance/service/IBundleService.sol +70 -21
- package/contracts/instance/service/IClaimService.sol +61 -0
- package/contracts/instance/service/IDistributionService.sol +87 -0
- package/contracts/instance/service/IPolicyService.sol +27 -49
- package/contracts/instance/service/IPoolService.sol +82 -3
- package/contracts/instance/service/PolicyService.sol +145 -321
- package/contracts/instance/service/PolicyServiceManager.sol +2 -2
- package/contracts/instance/service/PoolService.sol +214 -21
- package/contracts/instance/service/PoolServiceManager.sol +1 -1
- package/contracts/instance/service/ProductService.sol +34 -58
- package/contracts/instance/service/ProductServiceManager.sol +2 -2
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +5 -2
- package/contracts/registry/IRegistryService.sol +14 -11
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +43 -28
- package/contracts/registry/RegistryService.sol +70 -50
- package/contracts/registry/RegistryServiceManager.sol +13 -13
- package/contracts/registry/ReleaseManager.sol +32 -40
- package/contracts/registry/TokenRegistry.sol +16 -12
- package/contracts/shared/ERC165.sol +14 -12
- package/contracts/shared/INftOwnable.sol +11 -10
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +3 -3
- package/contracts/shared/IRegistryLinked.sol +12 -0
- package/contracts/shared/IService.sol +4 -4
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/NftOwnable.sol +66 -85
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +100 -25
- package/contracts/shared/Registerable.sol +7 -19
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +32 -20
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/shared/Versionable.sol +4 -92
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +60 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +52 -0
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/Fee.sol +13 -5
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +10 -5
- package/contracts/types/PayoutId.sol +54 -0
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +16 -9
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +1 -0
- package/contracts/types/Timestamp.sol +13 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +3 -3
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Cloner.json +0 -66
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock1.json +0 -24
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.dbg.json +0 -4
- package/artifacts/contracts/experiment/cloning/Cloner.sol/Mock2.json +0 -42
- package/artifacts/contracts/experiment/errors/Require.sol/Require.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Require.sol/Require.json +0 -105
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.dbg.json +0 -4
- package/artifacts/contracts/experiment/errors/Revert.sol/Revert.json +0 -105
- package/artifacts/contracts/experiment/inheritance/A.sol/A.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/A.json +0 -128
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/A.sol/AShared.json +0 -42
- package/artifacts/contracts/experiment/inheritance/B.sol/B.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/B.sol/B.json +0 -76
- package/artifacts/contracts/experiment/inheritance/C.sol/C.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/C.sol/C.json +0 -89
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/IA.json +0 -128
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IA.sol/ISharedA.json +0 -37
- package/artifacts/contracts/experiment/inheritance/IB.sol/IB.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.dbg.json +0 -4
- package/artifacts/contracts/experiment/inheritance/IC.sol/IC.json +0 -63
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/Dummy.sol/LifeCycleModule.json +0 -59
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/ISM.sol/ISMEE.json +0 -74
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SM.sol/SM.json +0 -124
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.dbg.json +0 -4
- package/artifacts/contracts/experiment/statemachine/SimpleStateMachine.sol/SimpleStateMachine.json +0 -207
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeA.sol/TypeALib.json +0 -10
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.dbg.json +0 -4
- package/artifacts/contracts/experiment/types/TypeB.sol/TypeBLib.json +0 -10
- package/contracts/experiment/cloning/Cloner.sol +0 -47
- package/contracts/experiment/errors/Require.sol +0 -38
- package/contracts/experiment/errors/Revert.sol +0 -44
- package/contracts/experiment/inheritance/A.sol +0 -53
- package/contracts/experiment/inheritance/B.sol +0 -28
- package/contracts/experiment/inheritance/C.sol +0 -34
- package/contracts/experiment/inheritance/IA.sol +0 -13
- package/contracts/experiment/inheritance/IB.sol +0 -10
- package/contracts/experiment/inheritance/IC.sol +0 -12
- package/contracts/experiment/statemachine/Dummy.sol +0 -27
- package/contracts/experiment/statemachine/ISM.sol +0 -25
- package/contracts/experiment/statemachine/SM.sol +0 -57
- package/contracts/experiment/statemachine/SimpleStateMachine.sol +0 -31
- package/contracts/experiment/types/TypeA.sol +0 -47
- package/contracts/experiment/types/TypeB.sol +0 -29
|
@@ -6,25 +6,30 @@ import {IRegistry} from "../../registry/IRegistry.sol";
|
|
|
6
6
|
import {IInstance} from "../../instance/IInstance.sol";
|
|
7
7
|
import {IBundle} from "../../instance/module/IBundle.sol";
|
|
8
8
|
import {TokenHandler} from "../../instance/module/ITreasury.sol";
|
|
9
|
-
import {
|
|
9
|
+
import {IComponents} from "../module/IComponents.sol";
|
|
10
10
|
import {IPolicy} from "../module/IPolicy.sol";
|
|
11
11
|
|
|
12
12
|
import {IVersionable} from "../../shared/IVersionable.sol";
|
|
13
13
|
import {Versionable} from "../../shared/Versionable.sol";
|
|
14
14
|
import {INftOwnable} from "../../shared/INftOwnable.sol";
|
|
15
15
|
|
|
16
|
+
import {Amount} from "../../types/Amount.sol";
|
|
17
|
+
import {Fee, FeeLib} from "../../types/Fee.sol";
|
|
16
18
|
import {NftId, NftIdLib, zeroNftId} from "../../types/NftId.sol";
|
|
17
19
|
import {ObjectType, POOL, BUNDLE} from "../../types/ObjectType.sol";
|
|
18
|
-
import {POOL_OWNER_ROLE, RoleId} from "../../types/RoleId.sol";
|
|
20
|
+
import {PUBLIC_ROLE, POOL_OWNER_ROLE, POLICY_SERVICE_ROLE, RoleId} from "../../types/RoleId.sol";
|
|
19
21
|
import {Fee, FeeLib} from "../../types/Fee.sol";
|
|
20
22
|
import {Version, VersionLib} from "../../types/Version.sol";
|
|
21
23
|
import {KEEP_STATE, StateId} from "../../types/StateId.sol";
|
|
24
|
+
import {Seconds} from "../../types/Seconds.sol";
|
|
22
25
|
import {TimestampLib, zeroTimestamp} from "../../types/Timestamp.sol";
|
|
26
|
+
import {Version, VersionLib} from "../../types/Version.sol";
|
|
23
27
|
|
|
24
28
|
import {IService} from "../../shared/IService.sol";
|
|
25
29
|
import {Service} from "../../shared/Service.sol";
|
|
26
30
|
import {BundleManager} from "../BundleManager.sol";
|
|
27
31
|
import {ComponentService} from "../base/ComponentService.sol";
|
|
32
|
+
import {IBundleService} from "./IBundleService.sol";
|
|
28
33
|
import {IPoolService} from "./IPoolService.sol";
|
|
29
34
|
import {IRegistryService} from "../../registry/IRegistryService.sol";
|
|
30
35
|
import {InstanceService} from "../InstanceService.sol";
|
|
@@ -40,7 +45,7 @@ contract PoolService is
|
|
|
40
45
|
{
|
|
41
46
|
using NftIdLib for NftId;
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
IBundleService internal _bundleService;
|
|
44
49
|
|
|
45
50
|
function _initialize(
|
|
46
51
|
address owner,
|
|
@@ -55,12 +60,14 @@ contract PoolService is
|
|
|
55
60
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
|
56
61
|
// TODO while PoolService is not deployed in PoolServiceManager constructor
|
|
57
62
|
// owner is PoolServiceManager deployer
|
|
58
|
-
|
|
63
|
+
initializeService(registryAddress, address(0), owner);
|
|
64
|
+
|
|
65
|
+
_bundleService = IBundleService(getRegistry().getServiceAddress(BUNDLE(), getVersion().toMajorPart()));
|
|
59
66
|
|
|
60
|
-
|
|
67
|
+
registerInterface(type(IPoolService).interfaceId);
|
|
61
68
|
}
|
|
62
69
|
|
|
63
|
-
function getDomain() public pure override
|
|
70
|
+
function getDomain() public pure override returns(ObjectType) {
|
|
64
71
|
return POOL();
|
|
65
72
|
}
|
|
66
73
|
|
|
@@ -79,32 +86,218 @@ contract PoolService is
|
|
|
79
86
|
POOL_OWNER_ROLE());
|
|
80
87
|
|
|
81
88
|
IPoolComponent pool = IPoolComponent(poolAddress);
|
|
82
|
-
IRegistry.ObjectInfo memory
|
|
89
|
+
IRegistry.ObjectInfo memory registryInfo = getRegistryService().registerPool(pool, owner);
|
|
83
90
|
pool.linkToRegisteredNftId();
|
|
84
|
-
poolNftId =
|
|
91
|
+
poolNftId = registryInfo.nftId;
|
|
92
|
+
|
|
93
|
+
// amend component info with pool specific token handler
|
|
94
|
+
IComponents.ComponentInfo memory componentInfo = pool.getComponentInfo();
|
|
95
|
+
componentInfo.tokenHandler = new TokenHandler(address(componentInfo.token));
|
|
96
|
+
|
|
97
|
+
// save amended component info with instance
|
|
98
|
+
instance.createPoolSetup(poolNftId, componentInfo);
|
|
99
|
+
|
|
100
|
+
bytes4[][] memory selectors = new bytes4[][](2);
|
|
101
|
+
selectors[0] = new bytes4[](1);
|
|
102
|
+
selectors[1] = new bytes4[](1);
|
|
103
|
+
|
|
104
|
+
selectors[0][0] = IPoolComponent.setFees.selector;
|
|
105
|
+
selectors[1][0] = IPoolComponent.verifyApplication.selector;
|
|
106
|
+
|
|
107
|
+
RoleId[] memory roles = new RoleId[](2);
|
|
108
|
+
roles[0] = POOL_OWNER_ROLE();
|
|
109
|
+
roles[1] = POLICY_SERVICE_ROLE();
|
|
110
|
+
|
|
111
|
+
getInstanceService().createGifTarget(
|
|
112
|
+
instanceNftId,
|
|
113
|
+
poolAddress,
|
|
114
|
+
pool.getName(),
|
|
115
|
+
selectors,
|
|
116
|
+
roles);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
function setMaxCapitalAmount(uint256 maxCapitalAmount)
|
|
121
|
+
external
|
|
122
|
+
virtual
|
|
123
|
+
{
|
|
124
|
+
(NftId poolNftId, IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
|
125
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
|
126
|
+
|
|
127
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
|
128
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
|
129
|
+
uint256 previousMaxCapitalAmount = poolInfo.maxCapitalAmount;
|
|
130
|
+
|
|
131
|
+
poolInfo.maxCapitalAmount = maxCapitalAmount;
|
|
132
|
+
componentInfo.data = abi.encode(poolInfo);
|
|
133
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
|
85
134
|
|
|
86
|
-
|
|
87
|
-
getInstanceService().createGifTarget(instanceNftId, poolAddress, pool.getName());
|
|
88
|
-
getInstanceService().grantPoolDefaultPermissions(instanceNftId, pool);
|
|
135
|
+
emit LogPoolServiceMaxCapitalAmountUpdated(poolNftId, previousMaxCapitalAmount, maxCapitalAmount);
|
|
89
136
|
}
|
|
90
137
|
|
|
138
|
+
function setBundleOwnerRole(RoleId bundleOwnerRole)
|
|
139
|
+
external
|
|
140
|
+
virtual
|
|
141
|
+
{
|
|
142
|
+
(NftId poolNftId, IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
|
143
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
|
144
|
+
|
|
145
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
|
146
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
|
147
|
+
|
|
148
|
+
// bundle owner role may only be set once per pool
|
|
149
|
+
if(poolInfo.bundleOwnerRole != PUBLIC_ROLE()) {
|
|
150
|
+
revert ErrorPoolServiceBundleOwnerRoleAlreadySet(poolNftId);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
poolInfo.bundleOwnerRole = bundleOwnerRole;
|
|
154
|
+
componentInfo.data = abi.encode(poolInfo);
|
|
155
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
|
156
|
+
|
|
157
|
+
emit LogPoolServiceBundleOwnerRoleSet(poolNftId, bundleOwnerRole);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
91
161
|
function setFees(
|
|
92
162
|
Fee memory poolFee,
|
|
93
163
|
Fee memory stakingFee,
|
|
94
164
|
Fee memory performanceFee
|
|
95
165
|
)
|
|
96
166
|
external
|
|
97
|
-
|
|
167
|
+
virtual
|
|
168
|
+
{
|
|
169
|
+
(NftId poolNftId, IRegistry.ObjectInfo memory registryInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
|
170
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
|
171
|
+
|
|
172
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
|
173
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
|
174
|
+
|
|
175
|
+
poolInfo.poolFee = poolFee;
|
|
176
|
+
poolInfo.stakingFee = stakingFee;
|
|
177
|
+
poolInfo.performanceFee = performanceFee;
|
|
178
|
+
componentInfo.data = abi.encode(poolInfo);
|
|
179
|
+
instance.updatePoolSetup(poolNftId, componentInfo, KEEP_STATE());
|
|
180
|
+
|
|
181
|
+
// TODO add logging
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
function createBundle(
|
|
186
|
+
address owner, // initial bundle owner
|
|
187
|
+
Fee memory fee, // fees deducted from premium that go to bundle owner
|
|
188
|
+
Amount stakingAmount, // staking amount - staking fees result in initial bundle capital
|
|
189
|
+
Seconds lifetime, // initial duration for which new policies are covered
|
|
190
|
+
bytes calldata filter // optional use case specific criteria that define if a policy may be covered by this bundle
|
|
191
|
+
)
|
|
192
|
+
external
|
|
193
|
+
virtual
|
|
194
|
+
returns(NftId bundleNftId)
|
|
195
|
+
{
|
|
196
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
|
197
|
+
InstanceReader instanceReader = instance.getInstanceReader();
|
|
198
|
+
|
|
199
|
+
// TODO add implementation that takes care of staking fees
|
|
200
|
+
Amount stakingAfterFeesAmount = stakingAmount;
|
|
201
|
+
|
|
202
|
+
bundleNftId = _bundleService.create(
|
|
203
|
+
instance,
|
|
204
|
+
poolNftId,
|
|
205
|
+
owner,
|
|
206
|
+
fee,
|
|
207
|
+
stakingAfterFeesAmount,
|
|
208
|
+
lifetime,
|
|
209
|
+
filter);
|
|
210
|
+
|
|
211
|
+
emit LogPoolServiceBundleCreated(instance.getNftId(), poolNftId, bundleNftId);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
function closeBundle(NftId bundleNftId)
|
|
216
|
+
external
|
|
217
|
+
virtual
|
|
218
|
+
{
|
|
219
|
+
(NftId poolNftId,, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
|
220
|
+
|
|
221
|
+
// TODO book keeping for pool collateral released outside of retention level
|
|
222
|
+
|
|
223
|
+
// releasing collateral in bundle
|
|
224
|
+
_bundleService.close(instance, bundleNftId);
|
|
225
|
+
|
|
226
|
+
// TODO get performance fee for pool, transfer of remaining funds + bundle fees to bundle owner
|
|
227
|
+
|
|
228
|
+
emit LogPoolServiceBundleClosed(instance.getNftId(), poolNftId, bundleNftId);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
function lockCollateral(
|
|
233
|
+
IInstance instance,
|
|
234
|
+
NftId productNftId,
|
|
235
|
+
NftId applicationNftId,
|
|
236
|
+
IPolicy.PolicyInfo memory applicationInfo,
|
|
237
|
+
uint256 premiumAmount // premium amount after product and distribution fees
|
|
238
|
+
)
|
|
239
|
+
external
|
|
240
|
+
virtual
|
|
241
|
+
// TODO add restricted and granting for policy service
|
|
98
242
|
{
|
|
99
|
-
(IRegistry.ObjectInfo memory poolInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(POOL());
|
|
100
243
|
InstanceReader instanceReader = instance.getInstanceReader();
|
|
101
|
-
NftId poolNftId =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
244
|
+
NftId poolNftId = instanceReader.getProductSetupInfo(productNftId).poolNftId;
|
|
245
|
+
NftId bundleNftId = applicationInfo.bundleNftId;
|
|
246
|
+
|
|
247
|
+
// TODO move this check to application creation and don't repeat this here
|
|
248
|
+
// ensure that pool for bundle from application matches with pool for product of application
|
|
249
|
+
IBundle.BundleInfo memory bundleInfo = instanceReader.getBundleInfo(bundleNftId);
|
|
250
|
+
if(bundleInfo.poolNftId != poolNftId) {
|
|
251
|
+
revert ErrorPoolServiceBundlePoolMismatch(bundleInfo.poolNftId, poolNftId);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
IComponents.ComponentInfo memory componentInfo = instanceReader.getComponentInfo(poolNftId);
|
|
255
|
+
IComponents.PoolInfo memory poolInfo = abi.decode(componentInfo.data, (IComponents.PoolInfo));
|
|
256
|
+
|
|
257
|
+
// TODO add correct required collateral calculation (collateralization level mibht be != 1, retention level might be < 1)
|
|
258
|
+
uint256 collateralAmount = applicationInfo.sumInsuredAmount;
|
|
259
|
+
|
|
260
|
+
// TODO add correct net premium calculation (pool fee might be > 0)
|
|
261
|
+
uint256 premiumAfterPoolFeeAmount = premiumAmount;
|
|
262
|
+
|
|
263
|
+
// lock collateral amount from involvedd bundle
|
|
264
|
+
_bundleService.lockCollateral(
|
|
265
|
+
instance,
|
|
266
|
+
applicationNftId,
|
|
267
|
+
bundleNftId,
|
|
268
|
+
collateralAmount,
|
|
269
|
+
premiumAfterPoolFeeAmount);
|
|
270
|
+
|
|
271
|
+
// also verify/confirm application by pool if necessary
|
|
272
|
+
if(poolInfo.isVerifyingApplications) {
|
|
273
|
+
address poolAddress = getRegistry().getObjectInfo(poolNftId).objectAddress;
|
|
274
|
+
IPoolComponent(poolAddress).verifyApplication(
|
|
275
|
+
applicationNftId,
|
|
276
|
+
applicationInfo.applicationData,
|
|
277
|
+
bundleNftId,
|
|
278
|
+
bundleInfo.filter,
|
|
279
|
+
collateralAmount);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
/// @dev releases the remaining collateral linked to the specified policy
|
|
285
|
+
/// may only be called by the policy service for unlocked pool components
|
|
286
|
+
function releaseCollateral(
|
|
287
|
+
IInstance instance,
|
|
288
|
+
NftId policyNftId,
|
|
289
|
+
IPolicy.PolicyInfo memory policyInfo
|
|
290
|
+
)
|
|
291
|
+
external
|
|
292
|
+
virtual
|
|
293
|
+
// TODO add restricted and granting for policy service
|
|
294
|
+
{
|
|
295
|
+
// release collateral from involved bundle
|
|
296
|
+
_bundleService.releaseCollateral(
|
|
297
|
+
instance,
|
|
298
|
+
policyNftId,
|
|
299
|
+
policyInfo.bundleNftId,
|
|
300
|
+
policyInfo.sumInsuredAmount);
|
|
109
301
|
}
|
|
302
|
+
|
|
110
303
|
}
|
|
@@ -16,7 +16,7 @@ contract PoolServiceManager is ProxyManager {
|
|
|
16
16
|
constructor(
|
|
17
17
|
address registryAddress
|
|
18
18
|
)
|
|
19
|
-
ProxyManager()
|
|
19
|
+
ProxyManager(registryAddress)
|
|
20
20
|
{
|
|
21
21
|
PoolService poolSrv = new PoolService();
|
|
22
22
|
bytes memory data = abi.encode(registryAddress, address(this));
|
|
@@ -60,11 +60,11 @@ contract ProductService is ComponentService, IProductService {
|
|
|
60
60
|
address initialOwner;
|
|
61
61
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
initializeService(registryAddress, address(0), owner);
|
|
64
64
|
|
|
65
|
-
_poolService = IPoolService(
|
|
65
|
+
_poolService = IPoolService(getRegistry().getServiceAddress(POOL(), getVersion().toMajorPart()));
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
registerInterface(type(IProductService).interfaceId);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
|
|
@@ -102,8 +102,8 @@ contract ProductService is ComponentService, IProductService {
|
|
|
102
102
|
{
|
|
103
103
|
// wire distribution and pool components to product component
|
|
104
104
|
ISetup.ProductSetupInfo memory setup = product.getSetupInfo();
|
|
105
|
-
IComponent distribution = IComponent(
|
|
106
|
-
IComponent pool = IComponent(
|
|
105
|
+
IComponent distribution = IComponent(getRegistry().getObjectInfo(setup.distributionNftId).objectAddress);
|
|
106
|
+
IComponent pool = IComponent(getRegistry().getObjectInfo(setup.poolNftId).objectAddress);
|
|
107
107
|
|
|
108
108
|
distribution.setProductNftId(productNftId);
|
|
109
109
|
pool.setProductNftId(productNftId);
|
|
@@ -113,16 +113,23 @@ contract ProductService is ComponentService, IProductService {
|
|
|
113
113
|
// create product setup in instance
|
|
114
114
|
instance.createProductSetup(productNftId, product.getSetupInfo());
|
|
115
115
|
|
|
116
|
+
bytes4[][] memory selectors = new bytes4[][](1);
|
|
117
|
+
selectors[0] = new bytes4[](1);
|
|
118
|
+
selectors[0][0] = IProductComponent.setFees.selector;
|
|
119
|
+
|
|
120
|
+
RoleId[] memory roles = new RoleId[](1);
|
|
121
|
+
roles[0] = PRODUCT_OWNER_ROLE();
|
|
122
|
+
|
|
116
123
|
// create target for instane access manager
|
|
117
124
|
getInstanceService().createGifTarget(
|
|
118
|
-
|
|
125
|
+
getRegistry().getNftId(address(instance)),
|
|
119
126
|
address(product),
|
|
120
|
-
product.getName()
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
product.getName(),
|
|
128
|
+
selectors,
|
|
129
|
+
roles);
|
|
123
130
|
}
|
|
124
131
|
|
|
125
|
-
function getDomain() public pure override
|
|
132
|
+
function getDomain() public pure override returns(ObjectType) {
|
|
126
133
|
return PRODUCT();
|
|
127
134
|
}
|
|
128
135
|
|
|
@@ -140,38 +147,6 @@ contract ProductService is ComponentService, IProductService {
|
|
|
140
147
|
// if(wallet == address(0)) {
|
|
141
148
|
// revert WalletIsZero();
|
|
142
149
|
// }
|
|
143
|
-
|
|
144
|
-
// IRegistry.ObjectInfo memory tokenInfo = _registry.getObjectInfo(address(info.token));
|
|
145
|
-
|
|
146
|
-
// if(tokenInfo.objectType != TOKEN()) {
|
|
147
|
-
// revert InvalidToken();
|
|
148
|
-
// }
|
|
149
|
-
|
|
150
|
-
// IRegistry.ObjectInfo memory poolInfo = _registry.getObjectInfo(info.poolNftId);
|
|
151
|
-
|
|
152
|
-
// if(poolInfo.objectType != POOL()) {
|
|
153
|
-
// revert InvalidPool();
|
|
154
|
-
// }
|
|
155
|
-
|
|
156
|
-
// if(poolInfo.parentNftId != instanceNftId) {
|
|
157
|
-
// revert InvalidPoolsInstance();
|
|
158
|
-
// }
|
|
159
|
-
// // TODO pool have the same token
|
|
160
|
-
// //ITreasury.PoolSetup memory poolSetup = instance.getPoolSetup(info.poolNftId);
|
|
161
|
-
// //require(tokenInfo.objectAddress == address(poolSetup.token), "ERROR:COS-018:PRODUCT_POOL_TOKEN_MISMATCH");
|
|
162
|
-
// // TODO pool is not linked
|
|
163
|
-
|
|
164
|
-
// IRegistry.ObjectInfo memory distributionInfo = _registry.getObjectInfo(info.distributionNftId);
|
|
165
|
-
|
|
166
|
-
// if(distributionInfo.objectType != DISTRIBUTION()) {
|
|
167
|
-
// revert InvalidDistribution();
|
|
168
|
-
// }
|
|
169
|
-
|
|
170
|
-
// if(distributionInfo.parentNftId != instanceNftId) {
|
|
171
|
-
// revert InvalidDistributionsInstance();
|
|
172
|
-
// }
|
|
173
|
-
// // TODO distribution have the same token
|
|
174
|
-
// // TODO distribution is not linked
|
|
175
150
|
}
|
|
176
151
|
|
|
177
152
|
function setFees(
|
|
@@ -182,13 +157,9 @@ contract ProductService is ComponentService, IProductService {
|
|
|
182
157
|
{
|
|
183
158
|
// TODO check args
|
|
184
159
|
|
|
185
|
-
(
|
|
186
|
-
IRegistry.ObjectInfo memory productInfo,
|
|
187
|
-
IInstance instance
|
|
188
|
-
) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
|
189
|
-
|
|
160
|
+
(NftId productNftId, IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
|
190
161
|
InstanceReader instanceReader = instance.getInstanceReader();
|
|
191
|
-
|
|
162
|
+
|
|
192
163
|
ISetup.ProductSetupInfo memory productSetupInfo = instanceReader.getProductSetupInfo(productNftId);
|
|
193
164
|
|
|
194
165
|
productSetupInfo.productFee = productFee;
|
|
@@ -200,13 +171,13 @@ contract ProductService is ComponentService, IProductService {
|
|
|
200
171
|
function createRisk(
|
|
201
172
|
RiskId riskId,
|
|
202
173
|
bytes memory data
|
|
203
|
-
)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
|
208
|
-
NftId productNftId = productInfo.nftId;
|
|
174
|
+
)
|
|
175
|
+
external
|
|
176
|
+
override
|
|
177
|
+
{
|
|
178
|
+
(NftId productNftId, IRegistry.ObjectInfo memory productInfo, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
|
209
179
|
IRisk.RiskInfo memory riskInfo = IRisk.RiskInfo(productNftId, data);
|
|
180
|
+
|
|
210
181
|
instance.createRisk(
|
|
211
182
|
riskId,
|
|
212
183
|
riskInfo
|
|
@@ -216,9 +187,12 @@ contract ProductService is ComponentService, IProductService {
|
|
|
216
187
|
function updateRisk(
|
|
217
188
|
RiskId riskId,
|
|
218
189
|
bytes memory data
|
|
219
|
-
)
|
|
220
|
-
|
|
190
|
+
)
|
|
191
|
+
external
|
|
192
|
+
{
|
|
193
|
+
(,, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
|
221
194
|
InstanceReader instanceReader = instance.getInstanceReader();
|
|
195
|
+
|
|
222
196
|
IRisk.RiskInfo memory riskInfo = instanceReader.getRiskInfo(riskId);
|
|
223
197
|
riskInfo.data = data;
|
|
224
198
|
instance.updateRisk(riskId, riskInfo, KEEP_STATE());
|
|
@@ -227,8 +201,10 @@ contract ProductService is ComponentService, IProductService {
|
|
|
227
201
|
function updateRiskState(
|
|
228
202
|
RiskId riskId,
|
|
229
203
|
StateId state
|
|
230
|
-
)
|
|
231
|
-
|
|
204
|
+
)
|
|
205
|
+
external
|
|
206
|
+
{
|
|
207
|
+
(,, IInstance instance) = _getAndVerifyComponentInfoAndInstance(PRODUCT());
|
|
232
208
|
instance.updateRiskState(riskId, state);
|
|
233
209
|
}
|
|
234
210
|
}
|
|
@@ -16,7 +16,7 @@ contract ProductServiceManager is ProxyManager {
|
|
|
16
16
|
constructor(
|
|
17
17
|
address registryAddress
|
|
18
18
|
)
|
|
19
|
-
ProxyManager()
|
|
19
|
+
ProxyManager(registryAddress)
|
|
20
20
|
{
|
|
21
21
|
ProductService svc = new ProductService();
|
|
22
22
|
bytes memory data = abi.encode(registryAddress, address(this));
|
|
@@ -39,7 +39,7 @@ contract ProductServiceManager is ProxyManager {
|
|
|
39
39
|
// address(_productService));
|
|
40
40
|
|
|
41
41
|
// implies that after this constructor call only upgrade functionality is available
|
|
42
|
-
_isDeployed = true;
|
|
42
|
+
// _isDeployed = true;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
//--- view functions ----------------------------------------------------//
|
|
@@ -95,6 +95,10 @@ contract ChainNft is ERC721Enumerable {
|
|
|
95
95
|
|
|
96
96
|
_totalMinted++;
|
|
97
97
|
_safeMint(to, tokenId);
|
|
98
|
+
|
|
99
|
+
if(interceptor != address(0)) {
|
|
100
|
+
ITransferInterceptor(interceptor).nftMint(to, tokenId);
|
|
101
|
+
}
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
|
|
@@ -195,6 +199,10 @@ contract ChainNft is ERC721Enumerable {
|
|
|
195
199
|
_chainIdDigits;
|
|
196
200
|
}
|
|
197
201
|
|
|
202
|
+
function getNextTokenId() external view returns (uint256) {
|
|
203
|
+
return calculateTokenId(_idNext);
|
|
204
|
+
}
|
|
205
|
+
|
|
198
206
|
function _getNextTokenId() private returns (uint256 id) {
|
|
199
207
|
id = calculateTokenId(_idNext);
|
|
200
208
|
_idNext++;
|
|
@@ -3,7 +3,6 @@ pragma solidity ^0.8.20;
|
|
|
3
3
|
|
|
4
4
|
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
5
5
|
|
|
6
|
-
import {ChainNft} from "./ChainNft.sol";
|
|
7
6
|
import {NftId} from "../types/NftId.sol";
|
|
8
7
|
import {ObjectType} from "../types/ObjectType.sol";
|
|
9
8
|
import {VersionPart} from "../types/Version.sol";
|
|
@@ -85,6 +84,8 @@ interface IRegistry is IERC165 {
|
|
|
85
84
|
|
|
86
85
|
function isRegisteredService(address contractAddress) external view returns (bool);
|
|
87
86
|
|
|
87
|
+
function isRegisteredComponent(address object) external view returns (bool);
|
|
88
|
+
|
|
88
89
|
function isValidRelease(VersionPart version) external view returns (bool);
|
|
89
90
|
|
|
90
91
|
function getServiceAddress(
|
|
@@ -92,7 +93,9 @@ interface IRegistry is IERC165 {
|
|
|
92
93
|
VersionPart releaseVersion
|
|
93
94
|
) external view returns (address serviceAddress);
|
|
94
95
|
|
|
95
|
-
function
|
|
96
|
+
function getReleaseManagerAddress() external view returns (address);
|
|
97
|
+
|
|
98
|
+
function getChainNftAddress() external view returns (address);
|
|
96
99
|
|
|
97
100
|
function getOwner() external view returns (address);
|
|
98
101
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.20;
|
|
3
3
|
|
|
4
|
-
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
|
4
|
+
// import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
|
5
5
|
|
|
6
6
|
import {NftId} from "../types/NftId.sol";
|
|
7
7
|
import {ObjectType} from "../types/ObjectType.sol";
|
|
@@ -13,8 +13,9 @@ import {IRegisterable} from "../shared/IRegisterable.sol";
|
|
|
13
13
|
import {IComponent} from "../components/IComponent.sol";
|
|
14
14
|
|
|
15
15
|
interface IRegistryService is
|
|
16
|
-
IService
|
|
17
|
-
|
|
16
|
+
IService
|
|
17
|
+
// TODO cleanup
|
|
18
|
+
// IAccessManaged
|
|
18
19
|
{
|
|
19
20
|
error SelfRegistration();
|
|
20
21
|
error NotRegistryOwner();
|
|
@@ -35,18 +36,18 @@ interface IRegistryService is
|
|
|
35
36
|
struct FunctionConfig
|
|
36
37
|
{
|
|
37
38
|
ObjectType serviceDomain;
|
|
38
|
-
bytes4
|
|
39
|
+
bytes4[] selectors;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
function getFunctionConfigs()
|
|
43
|
+
external
|
|
44
|
+
pure
|
|
45
|
+
returns(
|
|
46
|
+
FunctionConfig[] memory config
|
|
47
|
+
);
|
|
47
48
|
|
|
48
49
|
// TODO used by service -> add owner arg
|
|
49
|
-
|
|
50
|
+
function registerInstance(IRegisterable instance, address owner)
|
|
50
51
|
external returns(IRegistry.ObjectInfo memory info);
|
|
51
52
|
|
|
52
53
|
function registerProduct(IComponent product, address owner)
|
|
@@ -58,6 +59,8 @@ interface IRegistryService is
|
|
|
58
59
|
function registerDistribution(IComponent distribution, address owner)
|
|
59
60
|
external returns(IRegistry.ObjectInfo memory info);
|
|
60
61
|
|
|
62
|
+
function registerDistributor(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
|
|
63
|
+
|
|
61
64
|
function registerPolicy(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
|
|
62
65
|
|
|
63
66
|
function registerBundle(IRegistry.ObjectInfo memory info) external returns(NftId nftId);
|