@etherisc/gif-next 0.0.2-2a59cd5-352 → 0.0.2-2aa1035-611
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 +6 -83
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +90 -145
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +145 -233
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +158 -73
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +169 -150
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +350 -180
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +162 -145
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +298 -288
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +95 -218
- 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 +274 -2000
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +183 -203
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +398 -2776
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +491 -127
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +124 -0
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +253 -236
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +216 -451
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +184 -121
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +2663 -0
- 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 +100 -215
- 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 +56 -73
- 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 +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +164 -379
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +649 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +433 -425
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +244 -105
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +1072 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +685 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +657 -318
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +270 -115
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +99 -236
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +235 -319
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +602 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +373 -158
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +417 -232
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +568 -120
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IPricingService.sol/IPricingService.json +518 -0
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +64 -163
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +563 -366
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +220 -121
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +771 -247
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +237 -102
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingService.sol/PricingService.json +988 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/PricingServiceManager.sol/PricingServiceManager.json +689 -0
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +136 -271
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +186 -107
- 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 +19 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +4 -193
- 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 +31 -12
- 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 +28 -277
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +182 -113
- 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 +34 -67
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +4 -30
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +4 -30
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.json +0 -21
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +64 -163
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +0 -150
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +10 -62
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -23
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +171 -88
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +11 -74
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -23
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +72 -203
- 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 +0 -150
- 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 +11 -74
- 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 +90 -253
- 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 +6 -188
- 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 +209 -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 +179 -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 +209 -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 +38 -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 +100 -83
- package/contracts/components/Distribution.sol +22 -46
- package/contracts/components/IComponent.sol +43 -17
- package/contracts/components/IDistributionComponent.sol +1 -30
- package/contracts/components/IPoolComponent.sol +73 -47
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +178 -130
- package/contracts/components/Product.sol +172 -76
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +13 -0
- package/contracts/instance/BundleManager.sol +10 -9
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +43 -49
- package/contracts/instance/IInstanceService.sol +32 -12
- package/contracts/instance/Instance.sol +129 -173
- package/contracts/instance/InstanceAccessManager.sol +404 -160
- package/contracts/instance/InstanceAuthorizationsLib.sol +300 -0
- package/contracts/instance/InstanceReader.sol +43 -16
- package/contracts/instance/InstanceService.sol +160 -293
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/InstanceStore.sol +208 -0
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +53 -39
- package/contracts/instance/base/KeyValueStore.sol +13 -5
- package/contracts/instance/base/Lifecycle.sol +23 -6
- package/contracts/instance/module/IAccess.sol +21 -14
- 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 +41 -9
- package/contracts/instance/module/ISetup.sol +7 -21
- package/contracts/instance/service/ApplicationService.sol +75 -158
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +230 -88
- package/contracts/instance/service/BundleServiceManager.sol +1 -1
- package/contracts/instance/service/ClaimService.sol +239 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +156 -96
- package/contracts/instance/service/DistributionServiceManager.sol +1 -1
- package/contracts/instance/service/IApplicationService.sol +9 -30
- package/contracts/instance/service/IBundleService.sol +74 -26
- package/contracts/instance/service/IClaimService.sol +92 -0
- package/contracts/instance/service/IDistributionService.sol +26 -6
- package/contracts/instance/service/IPolicyService.sol +89 -38
- package/contracts/instance/service/IPoolService.sol +85 -3
- package/contracts/instance/service/IPricingService.sol +36 -0
- package/contracts/instance/service/PolicyService.sol +358 -305
- package/contracts/instance/service/PolicyServiceManager.sol +2 -2
- package/contracts/instance/service/PoolService.sol +246 -19
- package/contracts/instance/service/PoolServiceManager.sol +1 -1
- package/contracts/instance/service/PricingService.sol +275 -0
- package/contracts/instance/service/PricingServiceManager.sol +51 -0
- package/contracts/instance/service/ProductService.sol +37 -60
- package/contracts/instance/service/ProductServiceManager.sol +2 -2
- package/contracts/registry/ChainNft.sol +8 -0
- package/contracts/registry/IRegistry.sol +2 -0
- package/contracts/registry/IRegistryService.sol +11 -10
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +23 -20
- package/contracts/registry/RegistryService.sol +56 -47
- package/contracts/registry/RegistryServiceManager.sol +13 -13
- package/contracts/registry/ReleaseManager.sol +26 -33
- package/contracts/registry/TokenRegistry.sol +13 -10
- package/contracts/shared/ERC165.sol +2 -1
- package/contracts/shared/INftOwnable.sol +4 -9
- package/contracts/shared/IRegistryLinked.sol +0 -3
- package/contracts/shared/IService.sol +4 -4
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/NftOwnable.sol +10 -80
- package/contracts/shared/ProxyManager.sol +98 -24
- package/contracts/shared/Registerable.sol +3 -10
- package/contracts/shared/RegistryLinked.sol +10 -26
- package/contracts/shared/Service.sol +29 -17
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/shared/Versionable.sol +1 -90
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/Amount.sol +70 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +75 -0
- package/contracts/types/Fee.sol +13 -5
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +12 -7
- package/contracts/types/PayoutId.sol +82 -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 +7 -2
- package/contracts/types/Timestamp.sol +18 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +1 -1
- 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/IB.sol/IB.json +0 -50
- 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
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
|
5
|
+
|
|
6
|
+
import {Key32, KeyId, Key32Lib} from "../types/Key32.sol";
|
|
7
|
+
import {NftId} from "../types/NftId.sol";
|
|
8
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
|
9
|
+
import {NumberId} from "../types/NumberId.sol";
|
|
10
|
+
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../types/ObjectType.sol";
|
|
11
|
+
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
|
12
|
+
import {RoleId, RoleIdLib, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
|
|
13
|
+
import {StateId, ACTIVE} from "../types/StateId.sol";
|
|
14
|
+
import {TimestampLib} from "../types/Timestamp.sol";
|
|
15
|
+
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
|
16
|
+
import {ReferralId} from "../types/Referral.sol";
|
|
17
|
+
import {DistributorType} from "../types/DistributorType.sol";
|
|
18
|
+
import {PayoutId} from "../types/PayoutId.sol";
|
|
19
|
+
|
|
20
|
+
import {IInstance} from "./IInstance.sol";
|
|
21
|
+
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
|
22
|
+
import {IKeyValueStore} from "./base/KeyValueStore.sol";
|
|
23
|
+
|
|
24
|
+
import {IBundle} from "./module/IBundle.sol";
|
|
25
|
+
import {IComponents} from "./module/IComponents.sol";
|
|
26
|
+
import {IDistribution} from "./module/IDistribution.sol";
|
|
27
|
+
import {IPolicy} from "./module/IPolicy.sol";
|
|
28
|
+
import {IRisk} from "./module/IRisk.sol";
|
|
29
|
+
import {ISetup} from "./module/ISetup.sol";
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// TODO combine with instance reader?
|
|
33
|
+
contract InstanceStore is AccessManagedUpgradeable, KeyValueStore
|
|
34
|
+
{
|
|
35
|
+
function initialize(address instance)
|
|
36
|
+
public
|
|
37
|
+
initializer()
|
|
38
|
+
{
|
|
39
|
+
address authority = IInstance(instance).authority();
|
|
40
|
+
__AccessManaged_init(authority);
|
|
41
|
+
initializeLifecycle();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//--- ProductSetup ------------------------------------------------------//
|
|
45
|
+
function createProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup) external restricted() {
|
|
46
|
+
create(_toNftKey32(productNftId, PRODUCT()), abi.encode(setup));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function updateProductSetup(NftId productNftId, ISetup.ProductSetupInfo memory setup, StateId newState) external restricted() {
|
|
50
|
+
update(_toNftKey32(productNftId, PRODUCT()), abi.encode(setup), newState);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function updateProductSetupState(NftId productNftId, StateId newState) external restricted() {
|
|
54
|
+
updateState(_toNftKey32(productNftId, PRODUCT()), newState);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//--- DistributionSetup ------------------------------------------------------//
|
|
58
|
+
function createDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup) external restricted() {
|
|
59
|
+
create(_toNftKey32(distributionNftId, DISTRIBUTION()), abi.encode(setup));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external restricted() {
|
|
63
|
+
update(_toNftKey32(distributionNftId, DISTRIBUTION()), abi.encode(setup), newState);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function updateDistributionSetupState(NftId distributionNftId, StateId newState) external restricted() {
|
|
67
|
+
updateState(_toNftKey32(distributionNftId, DISTRIBUTION()), newState);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//--- PoolSetup ------------------------------------------------------//
|
|
71
|
+
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
|
|
72
|
+
create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
|
|
76
|
+
update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
|
|
80
|
+
updateState(_toNftKey32(poolNftId, POOL()), newState);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//--- DistributorType -------------------------------------------------------//
|
|
84
|
+
function createDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info) external restricted() {
|
|
85
|
+
create(distributorType.toKey32(), abi.encode(info));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function updateDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info, StateId newState) external restricted() {
|
|
89
|
+
update(distributorType.toKey32(), abi.encode(info), newState);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function updateDistributorTypeState(DistributorType distributorType, StateId newState) external restricted() {
|
|
93
|
+
updateState(distributorType.toKey32(), newState);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//--- Distributor -------------------------------------------------------//
|
|
97
|
+
function createDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info) external restricted() {
|
|
98
|
+
create(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function updateDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info, StateId newState) external restricted() {
|
|
102
|
+
update(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info), newState);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function updateDistributorState(NftId distributorNftId, StateId newState) external restricted() {
|
|
106
|
+
updateState(_toNftKey32(distributorNftId, DISTRIBUTOR()), newState);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
//--- Referral ----------------------------------------------------------//
|
|
110
|
+
function createReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo) external restricted() {
|
|
111
|
+
create(referralId.toKey32(), abi.encode(referralInfo));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function updateReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo, StateId newState) external restricted() {
|
|
115
|
+
update(referralId.toKey32(), abi.encode(referralInfo), newState);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function updateReferralState(ReferralId referralId, StateId newState) external restricted() {
|
|
119
|
+
updateState(referralId.toKey32(), newState);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
//--- Bundle ------------------------------------------------------------//
|
|
123
|
+
function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external restricted() {
|
|
124
|
+
create(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external restricted() {
|
|
128
|
+
update(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle), newState);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function updateBundleState(NftId bundleNftId, StateId newState) external restricted() {
|
|
132
|
+
updateState(_toNftKey32(bundleNftId, BUNDLE()), newState);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//--- Risk --------------------------------------------------------------//
|
|
136
|
+
function createRisk(RiskId riskId, IRisk.RiskInfo memory risk) external restricted() {
|
|
137
|
+
create(riskId.toKey32(), abi.encode(risk));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external restricted() {
|
|
141
|
+
update(riskId.toKey32(), abi.encode(risk), newState);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function updateRiskState(RiskId riskId, StateId newState) external restricted() {
|
|
145
|
+
updateState(riskId.toKey32(), newState);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
//--- Application (Policy) ----------------------------------------------//
|
|
149
|
+
function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external restricted() {
|
|
150
|
+
create(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
|
154
|
+
update(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy), newState);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function updateApplicationState(NftId applicationNftId, StateId newState) external restricted() {
|
|
158
|
+
updateState(_toNftKey32(applicationNftId, POLICY()), newState);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
//--- Policy ------------------------------------------------------------//
|
|
162
|
+
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
|
163
|
+
update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function updatePolicyState(NftId policyNftId, StateId newState) external restricted() {
|
|
167
|
+
updateState(_toNftKey32(policyNftId, POLICY()), newState);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//--- Claim -------------------------------------------------------------//
|
|
171
|
+
function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external restricted() {
|
|
172
|
+
create(_toClaimKey32(policyNftId, claimId), abi.encode(claim));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function updateClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim, StateId newState) external restricted() {
|
|
176
|
+
update(_toClaimKey32(policyNftId, claimId), abi.encode(claim), newState);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function updateClaimState(NftId policyNftId, ClaimId claimId, StateId newState) external restricted() {
|
|
180
|
+
updateState(_toClaimKey32(policyNftId, claimId), newState);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
//--- Payout ------------------------------------------------------------//
|
|
184
|
+
function createPayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout) external restricted() {
|
|
185
|
+
create(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function updatePayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout, StateId newState) external restricted() {
|
|
189
|
+
update(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout), newState);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function updatePayoutState(NftId policyNftId, PayoutId payoutId, StateId newState) external restricted() {
|
|
193
|
+
updateState(_toPayoutKey32(policyNftId, payoutId), newState);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
//--- internal view/pure functions --------------------------------------//
|
|
197
|
+
function _toNftKey32(NftId nftId, ObjectType objectType) private pure returns (Key32) {
|
|
198
|
+
return nftId.toKey32(objectType);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function _toClaimKey32(NftId policyNftId, ClaimId claimId) private pure returns (Key32) {
|
|
202
|
+
return claimId.toKey32(policyNftId);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function _toPayoutKey32(NftId policyNftId, PayoutId payoutId) private pure returns (Key32) {
|
|
206
|
+
return payoutId.toKey32(policyNftId);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -24,18 +24,16 @@ contract ObjectManager is
|
|
|
24
24
|
IInstance internal _instance; // store instance address -> more flexible, instance may not be registered during ObjectManager initialization
|
|
25
25
|
|
|
26
26
|
/// @dev call to initialize MUST be made in the same transaction as cloning of the contract
|
|
27
|
-
function initialize(
|
|
28
|
-
|
|
29
|
-
address registry,
|
|
30
|
-
address instance
|
|
31
|
-
)
|
|
27
|
+
function initialize(address instanceAddress)
|
|
28
|
+
initializer
|
|
32
29
|
external
|
|
33
30
|
{
|
|
34
|
-
|
|
31
|
+
IInstance instance = IInstance(instanceAddress);
|
|
32
|
+
initialize(instance.authority(), instance.getRegistryAddress());
|
|
35
33
|
|
|
36
|
-
_instance =
|
|
34
|
+
_instance = instance;
|
|
37
35
|
|
|
38
|
-
emit LogObjectManagerInitialized(
|
|
36
|
+
emit LogObjectManagerInitialized(instanceAddress);
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
function getInstance() external view returns (IInstance) {
|
|
@@ -16,30 +16,31 @@ import {InstanceAccessManager} from "../InstanceAccessManager.sol";
|
|
|
16
16
|
|
|
17
17
|
abstract contract ComponentService is Service {
|
|
18
18
|
|
|
19
|
-
error ErrorComponentServiceAlreadyRegistered(address component, NftId nftId);
|
|
20
19
|
error ErrorComponentServiceNotComponent(address component);
|
|
21
20
|
error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
|
|
22
21
|
error ErrorComponentServiceSenderNotOwner(address component, address initialOwner, address sender);
|
|
23
22
|
error ErrorComponentServiceExpectedRoleMissing(NftId instanceNftId, RoleId requiredRole, address sender);
|
|
24
23
|
error ErrorComponentServiceComponentLocked(address component);
|
|
24
|
+
error ErrorComponentServiceSenderNotService(address sender);
|
|
25
|
+
error ErrorComponentServiceComponentTypeInvalid(address component, ObjectType expectedType, ObjectType foundType);
|
|
25
26
|
|
|
26
27
|
/// @dev modifier to check if caller is a registered service
|
|
27
28
|
modifier onlyService() {
|
|
28
29
|
address caller = msg.sender;
|
|
29
|
-
|
|
30
|
+
if(!getRegistry().isRegisteredService(caller)) {
|
|
31
|
+
revert ErrorComponentServiceSenderNotService(caller);
|
|
32
|
+
}
|
|
30
33
|
_;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
// view functions
|
|
34
37
|
|
|
35
38
|
function getRegistryService() public view virtual returns (IRegistryService) {
|
|
36
|
-
|
|
37
|
-
return IRegistryService(service);
|
|
39
|
+
return IRegistryService(_getServiceAddress(REGISTRY()));
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
function getInstanceService() public view returns (InstanceService) {
|
|
41
|
-
|
|
42
|
-
return InstanceService(service);
|
|
43
|
+
return InstanceService(_getServiceAddress(INSTANCE()));
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
// internal functions
|
|
@@ -60,12 +61,6 @@ abstract contract ComponentService is Service {
|
|
|
60
61
|
// component may only be registerd by initial owner of component
|
|
61
62
|
owner = msg.sender;
|
|
62
63
|
|
|
63
|
-
// check component has not already been registerd
|
|
64
|
-
NftId compoentNftId = getRegistry().getNftId(componentAddress);
|
|
65
|
-
if(compoentNftId.gtz()) {
|
|
66
|
-
revert ErrorComponentServiceAlreadyRegistered(componentAddress, compoentNftId);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
64
|
// check this is a component
|
|
70
65
|
component = IComponent(componentAddress);
|
|
71
66
|
if(!component.supportsInterface(type(IComponent).interfaceId)) {
|
|
@@ -87,48 +82,67 @@ abstract contract ComponentService is Service {
|
|
|
87
82
|
// check instance has assigned required role to owner
|
|
88
83
|
instanceNftId = componentInfo.parentNftId;
|
|
89
84
|
instance = _getInstance(instanceNftId);
|
|
90
|
-
|
|
91
|
-
owner,
|
|
92
|
-
requiredRole,
|
|
93
|
-
address(instance));
|
|
94
|
-
|
|
95
|
-
if(!hasRole) {
|
|
85
|
+
if(!instance.getInstanceAccessManager().hasRole(requiredRole, owner)) {
|
|
96
86
|
revert ErrorComponentServiceExpectedRoleMissing(instanceNftId, requiredRole, owner);
|
|
97
87
|
}
|
|
98
88
|
}
|
|
99
89
|
|
|
100
90
|
// internal view functions
|
|
91
|
+
function _getAndVerifyCallingComponentAndInstance(
|
|
92
|
+
ObjectType expectedType // assume always of `component` type
|
|
93
|
+
)
|
|
94
|
+
internal
|
|
95
|
+
view
|
|
96
|
+
returns(
|
|
97
|
+
NftId componentNftId,
|
|
98
|
+
IRegistry.ObjectInfo memory componentInfo,
|
|
99
|
+
IInstance instance
|
|
100
|
+
)
|
|
101
|
+
{
|
|
102
|
+
componentNftId = getRegistry().getNftId(msg.sender);
|
|
103
|
+
(componentInfo, instance) = _getAndVerifyComponentInfoAndInstance(componentNftId, expectedType);
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
// locked component can not call services
|
|
106
|
+
if (instance.getInstanceAccessManager().isTargetLocked(componentInfo.objectAddress)) {
|
|
107
|
+
revert IAccess.ErrorIAccessTargetLocked(componentInfo.objectAddress);
|
|
108
|
+
}
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
function _getAndVerifyComponentInfoAndInstance(
|
|
108
|
-
|
|
109
|
-
ObjectType expectedType
|
|
112
|
+
NftId componentNftId,
|
|
113
|
+
ObjectType expectedType // assume always of `component` type
|
|
110
114
|
)
|
|
111
115
|
internal
|
|
112
116
|
view
|
|
113
117
|
returns(
|
|
114
|
-
IRegistry.ObjectInfo memory
|
|
118
|
+
IRegistry.ObjectInfo memory componentInfo,
|
|
115
119
|
IInstance instance
|
|
116
120
|
)
|
|
117
121
|
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
require(info.objectType == expectedType, "OBJECT_TYPE_INVALID");
|
|
125
|
-
|
|
126
|
-
address instanceAddress = registry.getObjectInfo(info.parentNftId).objectAddress;
|
|
127
|
-
instance = IInstance(instanceAddress);
|
|
128
|
-
|
|
129
|
-
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
|
130
|
-
if (accessManager.isTargetLocked(info.objectAddress)) {
|
|
131
|
-
revert IAccess.ErrorIAccessTargetLocked(info.objectAddress);
|
|
122
|
+
componentInfo = getRegistry().getObjectInfo(componentNftId);
|
|
123
|
+
if(componentInfo.objectType != expectedType) {
|
|
124
|
+
revert ErrorComponentServiceComponentTypeInvalid(
|
|
125
|
+
componentInfo.objectAddress,
|
|
126
|
+
expectedType,
|
|
127
|
+
componentInfo.objectType);
|
|
132
128
|
}
|
|
129
|
+
|
|
130
|
+
instance = _getInstance(componentInfo.parentNftId);
|
|
131
|
+
}
|
|
132
|
+
// assume componentNftId is always of `instance` type
|
|
133
|
+
function _getInstance(NftId instanceNftId) internal view returns (IInstance) {
|
|
134
|
+
return IInstance(
|
|
135
|
+
getRegistry().getObjectInfo(
|
|
136
|
+
instanceNftId).objectAddress);
|
|
137
|
+
}
|
|
138
|
+
// assume componentNftId is always of `component` type
|
|
139
|
+
/*function _getInstanceForComponent(NftId componentNftId) internal view returns (IInstance) {
|
|
140
|
+
NftId instanceNftId = getRegistry().getObjectInfo(componentNftId).parentNftId;
|
|
141
|
+
address instanceAddress = getRegistry().getObjectInfo(instanceNftId).objectAddress;
|
|
142
|
+
return IInstance(instanceAddress);
|
|
143
|
+
}*/
|
|
144
|
+
|
|
145
|
+
function _getServiceAddress(ObjectType domain) internal view returns (address) {
|
|
146
|
+
return getRegistry().getServiceAddress(domain, getVersion().toMajorPart());
|
|
133
147
|
}
|
|
134
|
-
}
|
|
148
|
+
}
|
|
@@ -5,7 +5,7 @@ import {Blocknumber, blockBlocknumber, zeroBlocknumber} from "../../types/Blockn
|
|
|
5
5
|
import {Key32, KeyId, Key32Lib} from "../../types/Key32.sol";
|
|
6
6
|
import {NftId} from "../../types/NftId.sol";
|
|
7
7
|
import {ObjectType} from "../../types/ObjectType.sol";
|
|
8
|
-
import {StateId, ACTIVE} from "../../types/StateId.sol";
|
|
8
|
+
import {StateId, ACTIVE, KEEP_STATE} from "../../types/StateId.sol";
|
|
9
9
|
import {Timestamp, TimestampLib} from "../../types/Timestamp.sol";
|
|
10
10
|
|
|
11
11
|
import {Lifecycle} from "./Lifecycle.sol";
|
|
@@ -79,16 +79,21 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
|
79
79
|
// update data
|
|
80
80
|
_value[key32].data = data;
|
|
81
81
|
|
|
82
|
-
// update
|
|
82
|
+
// update state
|
|
83
|
+
if(state != KEEP_STATE()) {
|
|
84
|
+
metadata.state = state;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// update reest of metadata
|
|
83
88
|
address updatedBy = msg.sender;
|
|
84
89
|
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
|
85
|
-
|
|
90
|
+
|
|
86
91
|
metadata.updatedBy = updatedBy;
|
|
87
92
|
metadata.updatedIn = blockBlocknumber();
|
|
88
93
|
|
|
89
94
|
// create log entries
|
|
90
95
|
// solhint-disable avoid-tx-origin
|
|
91
|
-
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(),
|
|
96
|
+
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(), stateOld, state, updatedBy, tx.origin, lastUpdatedIn);
|
|
92
97
|
emit LogInfoUpdated(key32.toObjectType(), key32.toKeyId(), state, updatedBy, tx.origin, lastUpdatedIn);
|
|
93
98
|
// solhing-enable
|
|
94
99
|
}
|
|
@@ -134,6 +139,9 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
|
134
139
|
StateId stateOld = metadata.state;
|
|
135
140
|
require(stateOld.gtz(), "ERROR:KVS-041:NOT_EXISTING");
|
|
136
141
|
|
|
142
|
+
// ensure state transistion is valid
|
|
143
|
+
checkTransition(metadata.objectType, stateOld, state);
|
|
144
|
+
|
|
137
145
|
// update metadata (and state)
|
|
138
146
|
address updatedBy = msg.sender;
|
|
139
147
|
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
|
@@ -143,7 +151,7 @@ contract KeyValueStore is Lifecycle, IKeyValueStore {
|
|
|
143
151
|
|
|
144
152
|
// create log entry
|
|
145
153
|
// solhint-disable-next-line avoid-tx-origin
|
|
146
|
-
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(),
|
|
154
|
+
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(), stateOld, state, updatedBy, tx.origin, lastUpdatedIn);
|
|
147
155
|
}
|
|
148
156
|
|
|
149
157
|
function exists(Key32 key32) public view returns (bool) {
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.20;
|
|
3
3
|
|
|
4
|
+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
5
|
+
|
|
4
6
|
import {NftId} from "../../types/NftId.sol";
|
|
5
|
-
import {ObjectType, COMPONENT, BUNDLE, POLICY, RISK} from "../../types/ObjectType.sol";
|
|
6
|
-
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED,
|
|
7
|
+
import {ObjectType, COMPONENT, BUNDLE, POLICY, RISK, CLAIM} from "../../types/ObjectType.sol";
|
|
8
|
+
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, COLLATERALIZED, REVOKED, SUBMITTED, CONFIRMED, DECLINED} from "../../types/StateId.sol";
|
|
7
9
|
import {ILifecycle} from "./ILifecycle.sol";
|
|
8
10
|
|
|
9
|
-
contract Lifecycle is
|
|
11
|
+
contract Lifecycle is
|
|
12
|
+
Initializable,
|
|
13
|
+
ILifecycle
|
|
14
|
+
{
|
|
10
15
|
mapping(ObjectType objectType => StateId initialState)
|
|
11
16
|
private _initialState;
|
|
12
17
|
|
|
13
18
|
mapping(ObjectType objectType => mapping(StateId stateFrom => mapping(StateId stateTo => bool isValid)))
|
|
14
19
|
private _isValidTransition;
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
function initializeLifecycle()
|
|
22
|
+
public
|
|
23
|
+
onlyInitializing
|
|
24
|
+
{
|
|
17
25
|
_setupBundleLifecycle();
|
|
18
26
|
_setupComponentLifecycle();
|
|
19
27
|
_setupPolicyLifecycle();
|
|
28
|
+
_setupClaimLifecycle();
|
|
20
29
|
_setupRiskLifecycle();
|
|
21
30
|
}
|
|
22
31
|
|
|
@@ -78,6 +87,7 @@ contract Lifecycle is ILifecycle {
|
|
|
78
87
|
function _setupBundleLifecycle() internal {
|
|
79
88
|
_initialState[BUNDLE()] = ACTIVE();
|
|
80
89
|
_isValidTransition[BUNDLE()][ACTIVE()][PAUSED()] = true;
|
|
90
|
+
_isValidTransition[BUNDLE()][ACTIVE()][CLOSED()] = true;
|
|
81
91
|
_isValidTransition[BUNDLE()][PAUSED()][ACTIVE()] = true;
|
|
82
92
|
_isValidTransition[BUNDLE()][PAUSED()][CLOSED()] = true;
|
|
83
93
|
}
|
|
@@ -86,11 +96,18 @@ contract Lifecycle is ILifecycle {
|
|
|
86
96
|
_initialState[POLICY()] = APPLIED();
|
|
87
97
|
_isValidTransition[POLICY()][APPLIED()][REVOKED()] = true;
|
|
88
98
|
_isValidTransition[POLICY()][APPLIED()][DECLINED()] = true;
|
|
89
|
-
_isValidTransition[POLICY()][APPLIED()][
|
|
90
|
-
_isValidTransition[POLICY()][
|
|
99
|
+
_isValidTransition[POLICY()][APPLIED()][COLLATERALIZED()] = true;
|
|
100
|
+
_isValidTransition[POLICY()][COLLATERALIZED()][ACTIVE()] = true;
|
|
91
101
|
_isValidTransition[POLICY()][ACTIVE()][CLOSED()] = true;
|
|
92
102
|
}
|
|
93
103
|
|
|
104
|
+
function _setupClaimLifecycle() internal {
|
|
105
|
+
_initialState[CLAIM()] = SUBMITTED();
|
|
106
|
+
_isValidTransition[CLAIM()][SUBMITTED()][CONFIRMED()] = true;
|
|
107
|
+
_isValidTransition[CLAIM()][SUBMITTED()][DECLINED()] = true;
|
|
108
|
+
_isValidTransition[CLAIM()][CONFIRMED()][CLOSED()] = true;
|
|
109
|
+
}
|
|
110
|
+
|
|
94
111
|
function _setupRiskLifecycle() internal {
|
|
95
112
|
_initialState[RISK()] = ACTIVE();
|
|
96
113
|
_isValidTransition[RISK()][ACTIVE()][PAUSED()] = true;
|
|
@@ -8,40 +8,47 @@ import {Timestamp} from "../../types/Timestamp.sol";
|
|
|
8
8
|
|
|
9
9
|
interface IAccess {
|
|
10
10
|
|
|
11
|
+
enum Type {
|
|
12
|
+
NotInitialized,
|
|
13
|
+
Core,
|
|
14
|
+
Gif,
|
|
15
|
+
Custom
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
struct RoleInfo {
|
|
12
19
|
ShortString name;
|
|
13
|
-
|
|
14
|
-
bool isLocked;
|
|
20
|
+
Type rtype;
|
|
21
|
+
//bool isLocked;
|
|
22
|
+
RoleId admin;
|
|
15
23
|
Timestamp createdAt;
|
|
16
24
|
Timestamp updatedAt;
|
|
17
25
|
}
|
|
18
26
|
|
|
19
27
|
struct TargetInfo {
|
|
20
28
|
ShortString name;
|
|
21
|
-
|
|
29
|
+
Type ttype;
|
|
22
30
|
bool isLocked;
|
|
23
31
|
Timestamp createdAt;
|
|
24
32
|
Timestamp updatedAt;
|
|
25
33
|
}
|
|
26
34
|
|
|
27
|
-
error
|
|
35
|
+
error ErrorIAccessCallerIsNotRoleAdmin(address caller, RoleId roleId);
|
|
36
|
+
|
|
37
|
+
error ErrorIAccessRoleIdDoesNotExist(RoleId roleId);
|
|
28
38
|
error ErrorIAccessRoleIdTooBig(RoleId roleId);
|
|
29
39
|
error ErrorIAccessRoleIdTooSmall(RoleId roleId);
|
|
30
|
-
error
|
|
31
|
-
error ErrorIAccessRoleIdNotActive(RoleId roleId);
|
|
40
|
+
error ErrorIAccessRoleIdExists(RoleId roleId);
|
|
32
41
|
error ErrorIAccessRoleNameEmpty(RoleId roleId);
|
|
33
|
-
error
|
|
34
|
-
error
|
|
35
|
-
error ErrorIAccessRoleIsCustomIsImmutable(RoleId roleId, bool isCustom, bool isCustomExisting);
|
|
36
|
-
error ErrorIAccessGrantNonexstentRole(RoleId roleId);
|
|
37
|
-
error ErrorIAccessRevokeNonexstentRole(RoleId roleId);
|
|
38
|
-
error ErrorIAccessRenounceNonexstentRole(RoleId roleId);
|
|
42
|
+
error ErrorIAccessRoleNameExists(RoleId roleId, RoleId existingRoleId, ShortString name);
|
|
43
|
+
error ErrorIAccessRoleTypeInvalid(RoleId roleId, Type rtype);
|
|
39
44
|
|
|
40
45
|
error ErrorIAccessTargetAddressZero();
|
|
41
|
-
error ErrorIAccessTargetDoesNotExist(
|
|
42
|
-
error ErrorIAccessTargetAddressDoesNotExist(address target);
|
|
46
|
+
error ErrorIAccessTargetDoesNotExist(address target);
|
|
43
47
|
error ErrorIAccessTargetExists(address target, ShortString name);
|
|
48
|
+
error ErrorIAccessTargetTypeInvalid(address target, Type ttype);
|
|
44
49
|
error ErrorIAccessTargetNameEmpty(address target);
|
|
45
50
|
error ErrorIAccessTargetNameExists(address target, address existingTarget, ShortString name);
|
|
46
51
|
error ErrorIAccessTargetLocked(address target);
|
|
52
|
+
error ErrorIAccessTargetNotRegistered(address target);
|
|
53
|
+
error ErrorIAccessTargetAuthorityInvalid(address target, address targetAuthority);
|
|
47
54
|
}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.20;
|
|
3
3
|
|
|
4
|
+
import {Amount} from "../../types/Amount.sol";
|
|
4
5
|
import {NftId} from "../../types/NftId.sol";
|
|
5
6
|
import {Fee} from "../../types/Fee.sol";
|
|
7
|
+
import {Seconds} from "../../types/Seconds.sol";
|
|
6
8
|
import {Timestamp} from "../../types/Timestamp.sol";
|
|
7
9
|
|
|
8
10
|
interface IBundle {
|
|
11
|
+
|
|
9
12
|
struct BundleInfo {
|
|
10
13
|
NftId poolNftId;
|
|
11
14
|
Fee fee; // bundle fee on net premium amounts
|
|
12
15
|
bytes filter; // required conditions for applications to be considered for collateralization by this bundle
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Timestamp expiredAt; // no new policies
|
|
16
|
+
Amount capitalAmount; // net stakings + net premiums - payouts
|
|
17
|
+
Amount lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= capital amount)
|
|
18
|
+
Amount feeAmount; // accumulated fee amount
|
|
19
|
+
Seconds lifetime;
|
|
20
|
+
Timestamp expiredAt; // no new policies starting with this timestamp
|
|
18
21
|
Timestamp closedAt; // no open policies, locked amount = 0
|
|
19
22
|
}
|
|
20
23
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
5
|
+
|
|
6
|
+
import {Amount} from "../../types/Amount.sol";
|
|
7
|
+
import {Fee} from "../../types/Fee.sol";
|
|
8
|
+
import {NftId} from "../../types/NftId.sol";
|
|
9
|
+
import {RoleId} from "../../types/RoleId.sol";
|
|
10
|
+
import {TokenHandler} from "../../shared/TokenHandler.sol";
|
|
11
|
+
import {UFixed} from "../../types/UFixed.sol";
|
|
12
|
+
|
|
13
|
+
interface IComponents {
|
|
14
|
+
|
|
15
|
+
struct ComponentInfo {
|
|
16
|
+
string name; // component name (needs to be unique per instance)
|
|
17
|
+
IERC20Metadata token;
|
|
18
|
+
TokenHandler tokenHandler;
|
|
19
|
+
address wallet;
|
|
20
|
+
Amount balanceAmount; // calculated balance (may not necessarily match withg wallet balance)
|
|
21
|
+
Amount feeAmount; // accumulated fees belonging to component owner
|
|
22
|
+
bytes data; // will hold component type specific additional info (eg encoded pool info)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
struct PoolInfo {
|
|
26
|
+
NftId productNftId; // the nft of the product this pool is linked to
|
|
27
|
+
RoleId bundleOwnerRole; // the required role for bundle owners
|
|
28
|
+
// TODO maxCapitalAmount -> maxBalanceAmount
|
|
29
|
+
uint256 maxCapitalAmount; // max capital amount allowed for pool
|
|
30
|
+
uint256 balanceAmount; // current pool balance (accounting view)
|
|
31
|
+
uint256 feeAmount; // accumulated fee amount
|
|
32
|
+
bool isInterceptingBundleTransfers; // intercepts nft transfers for bundles
|
|
33
|
+
bool isExternallyManaged; // funding bundles is restricted to book keeping, actual funds may be provided as needed to support payouts
|
|
34
|
+
bool isVerifyingApplications; // underwriting requires the pool component checks/confirms the applications
|
|
35
|
+
UFixed collateralizationLevel; // factor to calculate collateral for sum insurance (default 100%)
|
|
36
|
+
UFixed retentionLevel; // amount of collateral held in pool (default 100%)
|
|
37
|
+
Fee poolFee; // pool fee on net premium
|
|
38
|
+
Fee stakingFee; // pool fee on staked capital from investor
|
|
39
|
+
Fee performanceFee; // pool fee on profits from capital investors
|
|
40
|
+
}
|
|
41
|
+
}
|