@etherisc/gif-next 0.0.2-bfb44e0-483 → 0.0.2-c0b400a-177
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 -8
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +80 -145
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +125 -239
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +77 -92
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +102 -183
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +261 -201
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +81 -164
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +278 -288
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +85 -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 +496 -536
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +105 -212
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +567 -621
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +448 -121
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +120 -227
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +170 -397
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +207 -116
- 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 +18 -220
- 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 +54 -71
- 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 +182 -331
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +665 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +141 -366
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +182 -107
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +754 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +637 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +824 -268
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +312 -109
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +124 -206
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +89 -257
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +409 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +514 -157
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +45 -289
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +69 -153
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +12 -177
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +85 -442
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +188 -141
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +116 -249
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +187 -104
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +42 -272
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +179 -104
- 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 +71 -180
- 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 +90 -264
- 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 +11 -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 +12 -177
- 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 +13 -215
- 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 +31 -269
- 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/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 +2 -2
- 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 +96 -81
- package/contracts/components/Distribution.sol +29 -47
- package/contracts/components/IComponent.sol +40 -16
- 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 +171 -126
- package/contracts/components/Product.sol +38 -23
- 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 +23 -11
- package/contracts/instance/IInstanceService.sol +18 -5
- package/contracts/instance/Instance.sol +62 -16
- package/contracts/instance/InstanceAccessManager.sol +382 -157
- package/contracts/instance/InstanceReader.sol +7 -10
- package/contracts/instance/InstanceService.sol +222 -160
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/ObjectManager.sol +6 -8
- package/contracts/instance/base/ComponentService.sol +5 -5
- package/contracts/instance/base/KeyValueStore.sol +5 -2
- package/contracts/instance/base/Lifecycle.sol +11 -2
- package/contracts/instance/module/IAccess.sol +20 -13
- package/contracts/instance/module/IBundle.sol +2 -1
- package/contracts/instance/module/IComponents.sol +35 -0
- package/contracts/instance/module/IDistribution.sol +2 -0
- package/contracts/instance/module/IPolicy.sol +30 -3
- package/contracts/instance/module/ISetup.sol +7 -21
- package/contracts/instance/service/ApplicationService.sol +139 -57
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +76 -38
- 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 +224 -31
- package/contracts/instance/service/DistributionServiceManager.sol +1 -1
- package/contracts/instance/service/IApplicationService.sol +9 -9
- package/contracts/instance/service/IBundleService.sol +19 -11
- package/contracts/instance/service/IClaimService.sol +61 -0
- package/contracts/instance/service/IDistributionService.sol +36 -3
- package/contracts/instance/service/IPolicyService.sol +18 -34
- package/contracts/instance/service/IPoolService.sol +17 -2
- package/contracts/instance/service/PolicyService.sol +74 -195
- package/contracts/instance/service/PolicyServiceManager.sol +2 -2
- package/contracts/instance/service/PoolService.sol +128 -17
- package/contracts/instance/service/PoolServiceManager.sol +1 -1
- package/contracts/instance/service/ProductService.sol +10 -2
- 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 +10 -8
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +26 -21
- package/contracts/registry/RegistryService.sol +62 -40
- package/contracts/registry/RegistryServiceManager.sol +13 -13
- package/contracts/registry/ReleaseManager.sol +18 -28
- 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 +2 -0
- 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 +10 -12
- package/contracts/shared/TokenHandler.sol +11 -5
- package/contracts/shared/Versionable.sol +1 -90
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +52 -0
- package/contracts/types/Fee.sol +1 -0
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +5 -4
- 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 +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
@@ -4,12 +4,16 @@ pragma solidity ^0.8.19;
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
6
|
import {IRisk} from "../instance/module/IRisk.sol";
|
7
|
+
import {IApplicationService} from "../instance/service/IApplicationService.sol";
|
7
8
|
import {IPolicyService} from "../instance/service/IPolicyService.sol";
|
9
|
+
import {IProductService} from "../instance/service/IProductService.sol";
|
10
|
+
import {IClaimService} from "../instance/service/IClaimService.sol";
|
8
11
|
import {IProductComponent} from "./IProductComponent.sol";
|
9
12
|
import {NftId, NftIdLib} from "../types/NftId.sol";
|
10
|
-
import {PRODUCT} from "../types/ObjectType.sol";
|
13
|
+
import {PRODUCT, APPLICATION, POLICY, CLAIM } from "../types/ObjectType.sol";
|
11
14
|
import {ReferralId} from "../types/Referral.sol";
|
12
15
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
16
|
+
import {Seconds} from "../types/Seconds.sol";
|
13
17
|
import {StateId} from "../types/StateId.sol";
|
14
18
|
import {Timestamp} from "../types/Timestamp.sol";
|
15
19
|
import {Fee} from "../types/Fee.sol";
|
@@ -18,7 +22,9 @@ import {Component} from "./Component.sol";
|
|
18
22
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
19
23
|
|
20
24
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
25
|
+
import {IPolicy} from "../instance/module/IPolicy.sol";
|
21
26
|
import {ISetup} from "../instance/module/ISetup.sol";
|
27
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
22
28
|
import {Pool} from "../components/Pool.sol";
|
23
29
|
import {Distribution} from "../components/Distribution.sol";
|
24
30
|
|
@@ -30,7 +36,10 @@ abstract contract Product is
|
|
30
36
|
bytes32 public constant PRODUCT_STORAGE_LOCATION_V1 = 0x0bb7aafdb8e380f81267337bc5b5dfdf76e6d3a380ecadb51ec665246d9d6800;
|
31
37
|
|
32
38
|
struct ProductStorage {
|
39
|
+
IProductService _productService;
|
40
|
+
IApplicationService _applicationService;
|
33
41
|
IPolicyService _policyService;
|
42
|
+
IClaimService _claimService;
|
34
43
|
Pool _pool;
|
35
44
|
Distribution _distribution;
|
36
45
|
Fee _initialProductFee;
|
@@ -51,17 +60,21 @@ abstract contract Product is
|
|
51
60
|
Fee memory productFee,
|
52
61
|
Fee memory processingFee,
|
53
62
|
address initialOwner,
|
54
|
-
bytes memory data
|
63
|
+
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
55
64
|
)
|
56
65
|
public
|
57
66
|
virtual
|
58
67
|
onlyInitializing()
|
59
68
|
{
|
60
|
-
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner,
|
69
|
+
initializeComponent(registry, instanceNftId, name, token, PRODUCT(), isInterceptor, initialOwner, registryData);
|
61
70
|
|
62
71
|
ProductStorage storage $ = _getProductStorage();
|
63
72
|
// TODO add validation
|
64
|
-
|
73
|
+
// TODO refactor to go via registry
|
74
|
+
$._productService = IProductService(_getServiceAddress(PRODUCT()));
|
75
|
+
$._applicationService = IApplicationService(_getServiceAddress(APPLICATION()));
|
76
|
+
$._policyService = IPolicyService(_getServiceAddress(POLICY()));
|
77
|
+
$._claimService = IClaimService(_getServiceAddress(CLAIM()));
|
65
78
|
$._pool = Pool(pool);
|
66
79
|
$._distribution = Distribution(distribution);
|
67
80
|
$._initialProductFee = productFee;
|
@@ -77,7 +90,7 @@ abstract contract Product is
|
|
77
90
|
function calculatePremium(
|
78
91
|
uint256 sumInsuredAmount,
|
79
92
|
RiskId riskId,
|
80
|
-
|
93
|
+
Seconds lifetime,
|
81
94
|
bytes memory applicationData,
|
82
95
|
NftId bundleNftId,
|
83
96
|
ReferralId referralId
|
@@ -87,7 +100,8 @@ abstract contract Product is
|
|
87
100
|
override
|
88
101
|
returns (uint256 premiumAmount)
|
89
102
|
{
|
90
|
-
|
103
|
+
IPolicy.Premium memory premium = _getProductStorage()._applicationService.calculatePremium(
|
104
|
+
getNftId(),
|
91
105
|
riskId,
|
92
106
|
sumInsuredAmount,
|
93
107
|
lifetime,
|
@@ -95,13 +109,14 @@ abstract contract Product is
|
|
95
109
|
bundleNftId,
|
96
110
|
referralId
|
97
111
|
);
|
112
|
+
premiumAmount = premium.premiumAmount;
|
98
113
|
}
|
99
114
|
|
100
115
|
|
101
116
|
function calculateNetPremium(
|
102
117
|
uint256 sumInsuredAmount,
|
103
118
|
RiskId riskId,
|
104
|
-
|
119
|
+
Seconds lifetime,
|
105
120
|
bytes memory applicationData
|
106
121
|
)
|
107
122
|
external
|
@@ -121,7 +136,7 @@ abstract contract Product is
|
|
121
136
|
RiskId id,
|
122
137
|
bytes memory data
|
123
138
|
) internal {
|
124
|
-
|
139
|
+
_getProductService().createRisk(
|
125
140
|
id,
|
126
141
|
data
|
127
142
|
);
|
@@ -131,7 +146,7 @@ abstract contract Product is
|
|
131
146
|
RiskId id,
|
132
147
|
bytes memory data
|
133
148
|
) internal {
|
134
|
-
|
149
|
+
_getProductService().updateRisk(
|
135
150
|
id,
|
136
151
|
data
|
137
152
|
);
|
@@ -141,7 +156,7 @@ abstract contract Product is
|
|
141
156
|
RiskId id,
|
142
157
|
StateId state
|
143
158
|
) internal {
|
144
|
-
|
159
|
+
_getProductService().updateRiskState(
|
145
160
|
id,
|
146
161
|
state
|
147
162
|
);
|
@@ -155,22 +170,22 @@ abstract contract Product is
|
|
155
170
|
address applicationOwner,
|
156
171
|
RiskId riskId,
|
157
172
|
uint256 sumInsuredAmount,
|
158
|
-
|
159
|
-
bytes memory applicationData,
|
173
|
+
Seconds lifetime,
|
160
174
|
NftId bundleNftId,
|
161
|
-
ReferralId referralId
|
175
|
+
ReferralId referralId,
|
176
|
+
bytes memory applicationData
|
162
177
|
)
|
163
178
|
internal
|
164
|
-
returns (NftId
|
179
|
+
returns (NftId applicationNftId)
|
165
180
|
{
|
166
|
-
return _getProductStorage().
|
181
|
+
return _getProductStorage()._applicationService.create(
|
167
182
|
applicationOwner,
|
168
183
|
riskId,
|
169
184
|
sumInsuredAmount,
|
170
185
|
lifetime,
|
171
|
-
applicationData,
|
172
186
|
bundleNftId,
|
173
|
-
referralId
|
187
|
+
referralId,
|
188
|
+
applicationData
|
174
189
|
);
|
175
190
|
}
|
176
191
|
|
@@ -235,7 +250,7 @@ abstract contract Product is
|
|
235
250
|
restricted()
|
236
251
|
override
|
237
252
|
{
|
238
|
-
|
253
|
+
_getProductService().setFees(productFee, processingFee);
|
239
254
|
}
|
240
255
|
|
241
256
|
function getSetupInfo() public view returns (ISetup.ProductSetupInfo memory setupInfo) {
|
@@ -252,19 +267,15 @@ abstract contract Product is
|
|
252
267
|
ProductStorage storage $ = _getProductStorage();
|
253
268
|
|
254
269
|
ISetup.DistributionSetupInfo memory distributionSetupInfo = $._distribution.getSetupInfo();
|
255
|
-
|
270
|
+
IComponents.PoolInfo memory poolInfo = $._pool.getPoolInfo();
|
256
271
|
|
257
272
|
return ISetup.ProductSetupInfo(
|
258
273
|
getToken(),
|
259
274
|
$._tokenHandler,
|
260
275
|
$._distributionNftId,
|
261
276
|
$._poolNftId,
|
262
|
-
distributionSetupInfo.distributionFee,
|
263
277
|
$._initialProductFee,
|
264
278
|
$._initialProcessingFee,
|
265
|
-
poolSetupInfo.poolFee,
|
266
|
-
poolSetupInfo.stakingFee,
|
267
|
-
poolSetupInfo.performanceFee,
|
268
279
|
false,
|
269
280
|
getWallet()
|
270
281
|
);
|
@@ -275,4 +286,8 @@ abstract contract Product is
|
|
275
286
|
$.slot := PRODUCT_STORAGE_LOCATION_V1
|
276
287
|
}
|
277
288
|
}
|
289
|
+
|
290
|
+
function _getProductService() internal view returns (IProductService) {
|
291
|
+
return _getProductStorage()._productService;
|
292
|
+
}
|
278
293
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccessManagerUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagerUpgradeable.sol";
|
5
|
+
|
6
|
+
|
7
|
+
contract AccessManagerUpgradeableInitializeable is AccessManagerUpgradeable {
|
8
|
+
|
9
|
+
function initialize(address initialAdmin) initializer public {
|
10
|
+
__AccessManager_init(initialAdmin);
|
11
|
+
}
|
12
|
+
|
13
|
+
}
|
@@ -22,9 +22,10 @@ contract BundleManager is
|
|
22
22
|
event LogBundleManagerBundleAdded(NftId poolNftId, NftId bundleNftId);
|
23
23
|
event LogBundleManagerBundleUnlocked(NftId poolNftId, NftId bundleNftId);
|
24
24
|
event LogBundleManagerBundleLocked(NftId poolNftId, NftId bundleNftId);
|
25
|
+
event LogBundleManagerBundleClosed(NftId poolNftId, NftId bundleNftId);
|
25
26
|
|
26
|
-
error
|
27
|
-
error
|
27
|
+
error ErrorBundleManagerPolicyAlreadyActivated(NftId policyNftId);
|
28
|
+
error ErrorBundleManagerBundleLocked(NftId bundleNftId, NftId policyNftId);
|
28
29
|
error ErrorBundleManagerPolicyWithOpenClaims(NftId policyNftId, uint256 openClaimsCount);
|
29
30
|
error ErrorBundleManagerPolicyNotCloseable(NftId policyNftId);
|
30
31
|
error ErrorBundleManagerBundleUnknown(NftId bundleNftId);
|
@@ -32,7 +33,7 @@ contract BundleManager is
|
|
32
33
|
|
33
34
|
mapping(NftId bundleNftId => LibNftIdSet.Set policies) internal _activePolicies;
|
34
35
|
|
35
|
-
/// @dev links a policy
|
36
|
+
/// @dev links a policy to its bundle
|
36
37
|
// to link a policy it MUST NOT yet have been activated
|
37
38
|
// the bundle MUST be unlocked (active) for linking (underwriting) and registered with this instance
|
38
39
|
function linkPolicy(NftId policyNftId) external restricted() {
|
@@ -42,7 +43,7 @@ contract BundleManager is
|
|
42
43
|
|
43
44
|
// ensure bundle is unlocked (in active set) and registered with this instance
|
44
45
|
if (!_isActive(poolNftId, bundleNftId)) {
|
45
|
-
revert
|
46
|
+
revert ErrorBundleManagerBundleLocked(bundleNftId, policyNftId);
|
46
47
|
}
|
47
48
|
|
48
49
|
LibNftIdSet.add(_activePolicies[bundleNftId], policyNftId);
|
@@ -71,7 +72,7 @@ contract BundleManager is
|
|
71
72
|
}
|
72
73
|
|
73
74
|
|
74
|
-
/// @dev add a new bundle to a
|
75
|
+
/// @dev add a new bundle to a pool registerd with this instance
|
75
76
|
// the corresponding pool is fetched via instance reader
|
76
77
|
function add(NftId bundleNftId) external restricted() {
|
77
78
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
@@ -85,6 +86,7 @@ contract BundleManager is
|
|
85
86
|
emit LogBundleManagerBundleAdded(poolNftId, bundleNftId);
|
86
87
|
}
|
87
88
|
|
89
|
+
|
88
90
|
/// @dev unlocked (active) bundles are available to underwrite new policies
|
89
91
|
function unlock(NftId bundleNftId) external restricted() {
|
90
92
|
NftId poolNftId = _instance.getInstanceReader().getBundleInfo(bundleNftId).poolNftId;
|
@@ -10,7 +10,8 @@ abstract contract Cloneable is
|
|
10
10
|
AccessManagedUpgradeable
|
11
11
|
{
|
12
12
|
event CloneableInitialized(address authority, address registry);
|
13
|
-
|
13
|
+
|
14
|
+
error CloneableAuthorityZero();
|
14
15
|
error CloneableRegistryInvalid(address registry);
|
15
16
|
|
16
17
|
IRegistry internal _registry;
|
@@ -25,9 +26,13 @@ abstract contract Cloneable is
|
|
25
26
|
address registry
|
26
27
|
)
|
27
28
|
public
|
28
|
-
|
29
|
+
onlyInitializing
|
29
30
|
{
|
30
31
|
// check/handle access managed
|
32
|
+
if(authority == address(0)) {
|
33
|
+
revert CloneableAuthorityZero();
|
34
|
+
}
|
35
|
+
|
31
36
|
__AccessManaged_init(authority);
|
32
37
|
|
33
38
|
// check/handle registry
|
@@ -6,15 +6,20 @@ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessMana
|
|
6
6
|
import {NftId} from "../types/NftId.sol";
|
7
7
|
import {StateId} from "../types/StateId.sol";
|
8
8
|
import {RiskId} from "../types/RiskId.sol";
|
9
|
+
import {VersionPart} from "../types/Version.sol";
|
10
|
+
import {Key32} from "../types/Key32.sol";
|
9
11
|
|
10
12
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
13
|
|
14
|
+
import {ITransferInterceptor} from "../registry/ITransferInterceptor.sol";
|
15
|
+
|
12
16
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
13
17
|
import {BundleManager} from "./BundleManager.sol";
|
14
18
|
import {InstanceReader} from "./InstanceReader.sol";
|
15
19
|
|
16
20
|
import {IBundle} from "./module/IBundle.sol";
|
17
21
|
import {IBundleService} from "./service/IBundleService.sol";
|
22
|
+
import {IComponents} from "./module/IComponents.sol";
|
18
23
|
import {IDistributionService} from "./service/IDistributionService.sol";
|
19
24
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
20
25
|
import {IKeyValueStore} from "./base/IKeyValueStore.sol";
|
@@ -27,17 +32,15 @@ import {IPolicyService} from "./service/IPolicyService.sol";
|
|
27
32
|
import {IBundleService} from "./service/IBundleService.sol";
|
28
33
|
import {IRisk} from "./module/IRisk.sol";
|
29
34
|
import {ISetup} from "./module/ISetup.sol";
|
30
|
-
import {NftId} from "../types/NftId.sol";
|
31
|
-
import {RiskId} from "../types/RiskId.sol";
|
32
|
-
import {StateId} from "../types/StateId.sol";
|
33
|
-
import {VersionPart} from "../types/Version.sol";
|
34
|
-
import {Key32} from "../types/Key32.sol";
|
35
|
-
|
36
|
-
|
37
35
|
|
38
36
|
|
39
|
-
interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
|
40
37
|
|
38
|
+
interface IInstance is
|
39
|
+
IRegisterable,
|
40
|
+
ITransferInterceptor,
|
41
|
+
IAccessManaged,
|
42
|
+
IKeyValueStore
|
43
|
+
{
|
41
44
|
function getDistributionService() external view returns (IDistributionService);
|
42
45
|
function getProductService() external view returns (IProductService);
|
43
46
|
function getPoolService() external view returns (IPoolService);
|
@@ -48,8 +51,8 @@ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
|
|
48
51
|
function updateDistributionSetup(NftId distributionNftId, ISetup.DistributionSetupInfo memory setup, StateId newState) external;
|
49
52
|
function updateDistributionSetupState(NftId distributionNftId, StateId newState) external;
|
50
53
|
|
51
|
-
function createPoolSetup(NftId poolNftId,
|
52
|
-
function updatePoolSetup(NftId poolNftId,
|
54
|
+
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external;
|
55
|
+
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external;
|
53
56
|
function updatePoolSetupState(NftId poolNftId, StateId newState) external;
|
54
57
|
|
55
58
|
function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external;
|
@@ -76,11 +79,20 @@ interface IInstance is IRegisterable, IKeyValueStore, IAccessManaged {
|
|
76
79
|
function updateRisk(RiskId riskId, IRisk.RiskInfo memory risk, StateId newState) external;
|
77
80
|
function updateRiskState(RiskId riskId, StateId newState) external;
|
78
81
|
|
79
|
-
function
|
82
|
+
function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external;
|
83
|
+
function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
84
|
+
function updateApplicationState(NftId applicationNftId, StateId newState) external;
|
85
|
+
|
80
86
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
81
87
|
function updatePolicyState(NftId policyNftId, StateId newState) external;
|
82
88
|
|
89
|
+
// TODO add claims/payouts function to instance
|
90
|
+
// function updateClaims(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external;
|
91
|
+
|
83
92
|
function getMajorVersion() external pure returns (VersionPart majorVersion);
|
84
93
|
function getInstanceReader() external view returns (InstanceReader);
|
85
94
|
function getBundleManager() external view returns (BundleManager);
|
95
|
+
|
96
|
+
function setInstanceAccessManager(InstanceAccessManager accessManager) external;
|
97
|
+
function getInstanceAccessManager() external view returns (InstanceAccessManager);
|
86
98
|
}
|
@@ -10,6 +10,7 @@ import {IRegistry} from "../registry/IRegistry.sol";
|
|
10
10
|
import {IRegisterable} from "../shared/IRegisterable.sol";
|
11
11
|
import {IComponent} from "../components/IComponent.sol";
|
12
12
|
|
13
|
+
import {AccessManagerUpgradeableInitializeable} from "./AccessManagerUpgradeableInitializeable.sol";
|
13
14
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
14
15
|
import {Instance} from "./Instance.sol";
|
15
16
|
import {InstanceReader} from "./InstanceReader.sol";
|
@@ -18,6 +19,7 @@ import {BundleManager} from "./BundleManager.sol";
|
|
18
19
|
interface IInstanceService is IService {
|
19
20
|
|
20
21
|
error ErrorInstanceServiceMasterInstanceAlreadySet();
|
22
|
+
error ErrorInstanceServiceMasterOzAccessManagerAlreadySet();
|
21
23
|
error ErrorInstanceServiceMasterInstanceAccessManagerAlreadySet();
|
22
24
|
error ErrorInstanceServiceMasterBundleManagerAlreadySet();
|
23
25
|
error ErrorInstanceServiceInstanceAddressZero();
|
@@ -27,33 +29,44 @@ interface IInstanceService is IService {
|
|
27
29
|
error ErrorInstanceServiceInstanceReaderSameAsMasterInstanceReader();
|
28
30
|
error ErrorInstanceServiceInstanceReaderInstanceMismatch();
|
29
31
|
|
30
|
-
error
|
32
|
+
error ErrorInstanceServiceOzAccessManagerZero();
|
33
|
+
error ErrorInstanceServiceInstanceAccessManagerZero();
|
31
34
|
error ErrorInstanceServiceInstanceReaderZero();
|
32
35
|
error ErrorInstanceServiceBundleManagerZero();
|
33
36
|
|
34
37
|
error ErrorInstanceServiceInstanceAuthorityMismatch();
|
38
|
+
error ErrorInstanceServiceBundleManagerAuthorityMismatch();
|
35
39
|
error ErrorInstanceServiceInstanceReaderInstanceMismatch2();
|
36
40
|
error ErrorInstanceServiceBundleMangerInstanceMismatch();
|
37
41
|
|
38
42
|
error ErrorInstanceServiceRequestUnauhorized(address caller);
|
39
43
|
error ErrorInstanceServiceNotInstanceOwner(address caller, NftId instanceNftId);
|
44
|
+
error ErrorInstanceServiceNotInstance(NftId nftId);
|
40
45
|
error ErrorInstanceServiceComponentNotRegistered(address componentAddress);
|
46
|
+
error ErrorInstanceServiceInstanceComponentMismatch(NftId instanceNftId, NftId componentNftId);
|
41
47
|
error ErrorInstanceServiceInvalidComponentType(address componentAddress, ObjectType expectedType, ObjectType componentType);
|
42
48
|
|
43
|
-
event LogInstanceCloned(address
|
49
|
+
event LogInstanceCloned(address clonedOzAccessManager, address clonedInstanceAccessManager, address clonedInstance, address clonedBundleManager, address clonedInstanceReader, NftId clonedInstanceNftId);
|
44
50
|
|
45
51
|
function createInstanceClone()
|
46
52
|
external
|
47
53
|
returns (
|
48
|
-
|
54
|
+
AccessManagerUpgradeableInitializeable clonedOzAccessManager,
|
55
|
+
InstanceAccessManager clonedInstanceAccessManager,
|
49
56
|
Instance clonedInstance,
|
50
57
|
NftId instanceNftId,
|
51
58
|
InstanceReader clonedInstanceReader,
|
52
59
|
BundleManager clonedBundleManager
|
53
60
|
);
|
54
61
|
|
55
|
-
function
|
56
|
-
|
62
|
+
function createGifTarget(
|
63
|
+
NftId instanceNftId,
|
64
|
+
address targetAddress,
|
65
|
+
string memory targetName,
|
66
|
+
bytes4[][] memory selectors,
|
67
|
+
RoleId[] memory roles
|
68
|
+
) external;
|
57
69
|
|
70
|
+
function setComponentLocked(bool locked) external;
|
58
71
|
}
|
59
72
|
|
@@ -5,17 +5,20 @@ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
|
|
5
5
|
|
6
6
|
import {Key32, KeyId, Key32Lib} from "../types/Key32.sol";
|
7
7
|
import {NftId} from "../types/NftId.sol";
|
8
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
8
9
|
import {NumberId} from "../types/NumberId.sol";
|
9
10
|
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, ROLE, PRODUCT, TARGET, COMPONENT, DISTRIBUTOR, DISTRIBUTOR_TYPE} from "../types/ObjectType.sol";
|
10
11
|
import {RiskId, RiskIdLib} from "../types/RiskId.sol";
|
11
|
-
import {RoleId, RoleIdLib} from "../types/RoleId.sol";
|
12
|
+
import {RoleId, RoleIdLib, INSTANCE_ROLE, INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
|
12
13
|
import {StateId, ACTIVE} from "../types/StateId.sol";
|
13
14
|
import {TimestampLib} from "../types/Timestamp.sol";
|
14
|
-
import {VersionPart} from "../types/Version.sol";
|
15
|
+
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
15
16
|
|
16
17
|
import {ERC165} from "../shared/ERC165.sol";
|
17
18
|
import {Registerable} from "../shared/Registerable.sol";
|
18
19
|
|
20
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
21
|
+
|
19
22
|
import {IInstance} from "./IInstance.sol";
|
20
23
|
import {InstanceReader} from "./InstanceReader.sol";
|
21
24
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
@@ -25,6 +28,7 @@ import {KeyValueStore} from "./base/KeyValueStore.sol";
|
|
25
28
|
|
26
29
|
import {IAccess} from "./module/IAccess.sol";
|
27
30
|
import {IBundle} from "./module/IBundle.sol";
|
31
|
+
import {IComponents} from "./module/IComponents.sol";
|
28
32
|
import {IDistribution} from "./module/IDistribution.sol";
|
29
33
|
import {IPolicy} from "./module/IPolicy.sol";
|
30
34
|
import {IRisk} from "./module/IRisk.sol";
|
@@ -35,6 +39,7 @@ import {IPoolService} from "./service/IPoolService.sol";
|
|
35
39
|
import {IProductService} from "./service/IProductService.sol";
|
36
40
|
import {IPolicyService} from "./service/IPolicyService.sol";
|
37
41
|
import {IBundleService} from "./service/IBundleService.sol";
|
42
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
38
43
|
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
39
44
|
|
40
45
|
contract Instance is
|
@@ -58,13 +63,23 @@ contract Instance is
|
|
58
63
|
InstanceReader internal _instanceReader;
|
59
64
|
BundleManager internal _bundleManager;
|
60
65
|
|
61
|
-
|
66
|
+
modifier onlyChainNft() {
|
67
|
+
if(msg.sender != getRegistry().getChainNftAddress()) {
|
68
|
+
revert();
|
69
|
+
}
|
70
|
+
_;
|
71
|
+
}
|
72
|
+
|
73
|
+
function initialize(address authority, address registryAddress, address initialOwner)
|
62
74
|
public
|
63
75
|
initializer()
|
64
76
|
{
|
65
|
-
__AccessManaged_init(
|
77
|
+
__AccessManaged_init(authority);
|
66
78
|
|
67
|
-
|
79
|
+
IRegistry registry = IRegistry(registryAddress);
|
80
|
+
initializeRegisterable(registryAddress, registry.getNftId(), INSTANCE(), true, initialOwner, "");
|
81
|
+
initializeLifecycle();
|
82
|
+
|
68
83
|
registerInterface(type(IInstance).interfaceId);
|
69
84
|
}
|
70
85
|
|
@@ -95,12 +110,12 @@ contract Instance is
|
|
95
110
|
}
|
96
111
|
|
97
112
|
//--- PoolSetup ------------------------------------------------------//
|
98
|
-
function createPoolSetup(NftId poolNftId,
|
99
|
-
create(_toNftKey32(poolNftId, POOL()), abi.encode(
|
113
|
+
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
|
114
|
+
create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
|
100
115
|
}
|
101
116
|
|
102
|
-
function updatePoolSetup(NftId poolNftId,
|
103
|
-
update(_toNftKey32(poolNftId, POOL()), abi.encode(
|
117
|
+
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
|
118
|
+
update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
|
104
119
|
}
|
105
120
|
|
106
121
|
function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
|
@@ -172,11 +187,20 @@ contract Instance is
|
|
172
187
|
updateState(riskId.toKey32(), newState);
|
173
188
|
}
|
174
189
|
|
175
|
-
//--- Policy
|
176
|
-
function
|
177
|
-
create(toPolicyKey32(
|
190
|
+
//--- Application (Policy) ----------------------------------------------//
|
191
|
+
function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external restricted() {
|
192
|
+
create(toPolicyKey32(applicationNftId), abi.encode(policy));
|
193
|
+
}
|
194
|
+
|
195
|
+
function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
196
|
+
update(toPolicyKey32(applicationNftId), abi.encode(policy), newState);
|
197
|
+
}
|
198
|
+
|
199
|
+
function updateApplicationState(NftId applicationNftId, StateId newState) external restricted() {
|
200
|
+
updateState(toPolicyKey32(applicationNftId), newState);
|
178
201
|
}
|
179
202
|
|
203
|
+
//--- Policy ------------------------------------------------------------//
|
180
204
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
181
205
|
update(toPolicyKey32(policyNftId), abi.encode(policy), newState);
|
182
206
|
}
|
@@ -186,15 +210,15 @@ contract Instance is
|
|
186
210
|
}
|
187
211
|
|
188
212
|
//--- Claim -------------------------------------------------------------//
|
189
|
-
function createClaim(NftId policyNftId,
|
213
|
+
function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external restricted() {
|
190
214
|
create(toPolicyKey32(policyNftId), abi.encode(claim));
|
191
215
|
}
|
192
216
|
|
193
|
-
function updateClaim(NftId policyNftId,
|
217
|
+
function updateClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim, StateId newState) external restricted() {
|
194
218
|
update(toPolicyKey32(policyNftId), abi.encode(claim), newState);
|
195
219
|
}
|
196
220
|
|
197
|
-
function updateClaimState(NftId policyNftId, StateId newState) external restricted() {
|
221
|
+
function updateClaimState(NftId policyNftId, ClaimId claimId, StateId newState) external restricted() {
|
198
222
|
updateState(toPolicyKey32(policyNftId), newState);
|
199
223
|
}
|
200
224
|
|
@@ -203,7 +227,7 @@ contract Instance is
|
|
203
227
|
create(toPolicyKey32(policyNftId), abi.encode(payout));
|
204
228
|
}
|
205
229
|
|
206
|
-
function
|
230
|
+
function updatePayout(NftId policyNftId, NumberId payoutId, IPolicy.PayoutInfo memory payout, StateId newState) external restricted() {
|
207
231
|
update(toPolicyKey32(policyNftId), abi.encode(payout), newState);
|
208
232
|
}
|
209
233
|
|
@@ -211,6 +235,17 @@ contract Instance is
|
|
211
235
|
updateState(toPolicyKey32(policyNftId), newState);
|
212
236
|
}
|
213
237
|
|
238
|
+
//--- ITransferInterceptor ------------------------------------------------------------//
|
239
|
+
function nftMint(address to, uint256 tokenId) external onlyChainNft {
|
240
|
+
assert(_accessManager.roleMembers(INSTANCE_OWNER_ROLE()) == 0);// temp
|
241
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
242
|
+
}
|
243
|
+
|
244
|
+
function nftTransferFrom(address from, address to, uint256 tokenId) external onlyChainNft {
|
245
|
+
assert(_accessManager.revokeRole(INSTANCE_OWNER_ROLE(), from) == true);
|
246
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
247
|
+
}
|
248
|
+
|
214
249
|
//--- internal view/pure functions --------------------------------------//
|
215
250
|
function _toNftKey32(NftId nftId, ObjectType objectType) internal pure returns (Key32) {
|
216
251
|
return nftId.toKey32(objectType);
|
@@ -272,10 +307,21 @@ contract Instance is
|
|
272
307
|
function setBundleManager(BundleManager bundleManager) external restricted() {
|
273
308
|
require(address(_bundleManager) == address(0), "BundleManager is set");
|
274
309
|
require(bundleManager.getInstance() == Instance(this), "BundleManager instance mismatch");
|
310
|
+
require(bundleManager.authority() == authority(), "BundleManager authority mismatch");
|
275
311
|
_bundleManager = bundleManager;
|
276
312
|
}
|
277
313
|
|
278
314
|
function getBundleManager() external view returns (BundleManager) {
|
279
315
|
return _bundleManager;
|
280
316
|
}
|
317
|
+
|
318
|
+
function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
|
319
|
+
require(address(_accessManager) == address(0), "InstanceAccessManager is set");
|
320
|
+
require(accessManager.authority() == authority(), "InstanceAccessManager authority mismatch");
|
321
|
+
_accessManager = accessManager;
|
322
|
+
}
|
323
|
+
|
324
|
+
function getInstanceAccessManager() external view returns (InstanceAccessManager) {
|
325
|
+
return _accessManager;
|
326
|
+
}
|
281
327
|
}
|