@etherisc/gif-next 0.0.2-da06f3b-803 → 0.0.2-da0f894-204
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +73 -1
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/components/Component.sol/Component.json +212 -94
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +552 -122
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IComponent.sol/IComponent.json +64 -72
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +279 -98
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +406 -90
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +68 -144
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +654 -117
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +316 -166
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- package/artifacts/contracts/instance/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +765 -323
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +97 -180
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +841 -574
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +134 -231
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +98 -124
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +265 -269
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +319 -99
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.json +118 -169
- 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 +2 -2
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +62 -36
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +947 -0
- 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 +261 -267
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +305 -93
- 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 +1031 -250
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +441 -85
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +535 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +130 -212
- 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 +552 -135
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +40 -287
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +22 -169
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +22 -169
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +164 -391
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +311 -127
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +142 -221
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +302 -90
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +142 -221
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +302 -90
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +15 -21
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +83 -174
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +28 -34
- 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 +193 -216
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +300 -94
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +11 -11
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +141 -37
- package/artifacts/contracts/shared/ContractDeployerLib.sol/ContractDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +41 -3
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +40 -29
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +129 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +21 -29
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{experiment/inheritance/IB.sol/IB.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +18 -20
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +22 -169
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.json +2 -152
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +113 -33
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +248 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +294 -74
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +125 -55
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +84 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +113 -164
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -152
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +125 -55
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.dbg.json +1 -1
- package/artifacts/contracts/test/TestRoleId.sol/TestRoleId.json +6 -6
- package/artifacts/contracts/test/TestService.sol/TestService.dbg.json +1 -1
- package/artifacts/contracts/test/TestService.sol/TestService.json +134 -221
- 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/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -190
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- 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/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 +2 -2
- 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 +2 -2
- 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/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/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/contracts/components/Component.sol +82 -77
- package/contracts/components/Distribution.sol +188 -48
- package/contracts/components/IComponent.sol +42 -17
- package/contracts/components/IDistributionComponent.sol +39 -7
- package/contracts/components/IPoolComponent.sol +121 -21
- package/contracts/components/IProductComponent.sol +3 -2
- package/contracts/components/Pool.sol +290 -120
- package/contracts/components/Product.sol +92 -69
- package/contracts/instance/BundleManager.sol +1 -1
- package/contracts/instance/IInstance.sol +21 -1
- package/contracts/instance/IInstanceService.sol +19 -2
- package/contracts/instance/Instance.sol +58 -36
- package/contracts/instance/InstanceAccessManager.sol +136 -253
- package/contracts/instance/InstanceService.sol +154 -137
- package/contracts/instance/InstanceServiceManager.sol +1 -1
- package/contracts/instance/base/ComponentService.sol +1 -1
- package/contracts/instance/module/IAccess.sol +10 -11
- package/contracts/instance/module/IBundle.sol +2 -1
- package/contracts/instance/module/IDistribution.sol +2 -0
- package/contracts/instance/module/IPolicy.sol +30 -3
- package/contracts/instance/module/ISetup.sol +10 -10
- package/contracts/instance/service/ApplicationService.sol +346 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +15 -9
- 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 +303 -15
- package/contracts/instance/service/DistributionServiceManager.sol +1 -1
- package/contracts/instance/service/IApplicationService.sol +81 -0
- package/contracts/instance/service/IBundleService.sol +14 -3
- package/contracts/instance/service/IClaimService.sol +61 -0
- package/contracts/instance/service/IDistributionService.sol +74 -0
- package/contracts/instance/service/IPolicyService.sol +26 -50
- package/contracts/instance/service/PolicyService.sol +126 -260
- package/contracts/instance/service/PolicyServiceManager.sol +2 -2
- package/contracts/instance/service/PoolService.sol +2 -3
- package/contracts/instance/service/PoolServiceManager.sol +1 -1
- package/contracts/instance/service/ProductService.sol +9 -9
- package/contracts/instance/service/ProductServiceManager.sol +2 -2
- package/contracts/registry/IRegistry.sol +3 -4
- package/contracts/registry/IRegistryService.sol +10 -8
- package/contracts/registry/Registry.sol +28 -21
- package/contracts/registry/RegistryService.sol +69 -48
- package/contracts/registry/RegistryServiceManager.sol +13 -13
- package/contracts/registry/ReleaseManager.sol +18 -28
- package/contracts/registry/TokenRegistry.sol +16 -12
- package/contracts/shared/ERC165.sol +14 -12
- package/contracts/shared/INftOwnable.sol +11 -10
- package/contracts/shared/IPolicyHolder.sol +26 -0
- package/contracts/shared/IRegisterable.sol +3 -3
- package/contracts/shared/IRegistryLinked.sol +12 -0
- package/contracts/shared/IService.sol +2 -0
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/NftOwnable.sol +66 -85
- package/contracts/shared/PolicyHolder.sol +81 -0
- package/contracts/shared/ProxyManager.sol +100 -25
- package/contracts/shared/Registerable.sol +7 -19
- package/contracts/shared/RegistryLinked.sol +48 -0
- package/contracts/shared/Service.sol +15 -17
- package/contracts/shared/Versionable.sol +4 -92
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +1 -1
- package/contracts/types/ClaimId.sol +52 -0
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/ObjectType.sol +9 -5
- package/contracts/types/PayoutId.sol +54 -0
- package/contracts/types/RoleId.sol +14 -12
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/Timestamp.sol +12 -13
- 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/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
@@ -2,7 +2,6 @@
|
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
|
5
|
-
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
5
|
|
7
6
|
import {Instance} from "./Instance.sol";
|
8
7
|
import {IInstance} from "./IInstance.sol";
|
@@ -17,24 +16,16 @@ import {Service} from "../../contracts/shared/Service.sol";
|
|
17
16
|
import {IService} from "../shared/IService.sol";
|
18
17
|
import {NftId} from "../../contracts/types/NftId.sol";
|
19
18
|
import {RoleId} from "../types/RoleId.sol";
|
20
|
-
import {
|
21
|
-
|
22
|
-
INSTANCE_OWNER_ROLE,
|
23
|
-
DISTRIBUTION_OWNER_ROLE,
|
24
|
-
POOL_OWNER_ROLE,
|
25
|
-
PRODUCT_OWNER_ROLE,
|
26
|
-
INSTANCE_SERVICE_ROLE,
|
27
|
-
DISTRIBUTION_SERVICE_ROLE,
|
28
|
-
POOL_SERVICE_ROLE,
|
29
|
-
PRODUCT_SERVICE_ROLE,
|
30
|
-
POLICY_SERVICE_ROLE,
|
31
|
-
BUNDLE_SERVICE_ROLE} from "../types/RoleId.sol";
|
32
|
-
import {ObjectType, INSTANCE, BUNDLE, POLICY, PRODUCT, DISTRIBUTION, REGISTRY, POOL} from "../types/ObjectType.sol";
|
19
|
+
import {ADMIN_ROLE, DISTRIBUTION_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE, PUBLIC_ROLE, INSTANCE_SERVICE_ROLE, DISTRIBUTION_SERVICE_ROLE, POOL_SERVICE_ROLE, PRODUCT_SERVICE_ROLE, APPLICATION_SERVICE_ROLE, POLICY_SERVICE_ROLE, CLAIM_SERVICE_ROLE, BUNDLE_SERVICE_ROLE} from "../types/RoleId.sol";
|
20
|
+
import {ObjectType, INSTANCE, BUNDLE, APPLICATION, POLICY, CLAIM, PRODUCT, DISTRIBUTION, REGISTRY, POOL} from "../types/ObjectType.sol";
|
33
21
|
import {IDistributionComponent} from "../components/IDistributionComponent.sol";
|
34
22
|
import {IPoolComponent} from "../components/IPoolComponent.sol";
|
35
23
|
import {IProductComponent} from "../components/IProductComponent.sol";
|
36
24
|
|
37
|
-
contract InstanceService is
|
25
|
+
contract InstanceService is
|
26
|
+
Service,
|
27
|
+
IInstanceService
|
28
|
+
{
|
38
29
|
|
39
30
|
address internal _masterInstanceAccessManager;
|
40
31
|
address internal _masterInstance;
|
@@ -44,23 +35,20 @@ contract InstanceService is Service, IInstanceService {
|
|
44
35
|
// TODO update to real hash when instance is stable
|
45
36
|
bytes32 public constant INSTANCE_CREATION_CODE_HASH = bytes32(0);
|
46
37
|
|
47
|
-
modifier onlyInstanceOwner(NftId instanceNftId) {
|
48
|
-
|
49
|
-
|
38
|
+
modifier onlyInstanceOwner(NftId instanceNftId) {
|
39
|
+
IRegistry registry = getRegistry();
|
40
|
+
ChainNft chainNft = ChainNft(registry.getChainNftAddress());
|
41
|
+
|
42
|
+
if( msg.sender != chainNft.ownerOf(instanceNftId.toInt())) {
|
43
|
+
revert ErrorInstanceServiceNotInstanceOwner(msg.sender, instanceNftId);
|
50
44
|
}
|
51
45
|
_;
|
52
46
|
}
|
53
47
|
|
54
48
|
modifier onlyRegisteredService() {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
_;
|
59
|
-
}
|
60
|
-
|
61
|
-
modifier onlyComponent() {
|
62
|
-
if (! getRegistry().isRegisteredComponent(msg.sender)) {
|
63
|
-
revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
|
49
|
+
address caller = msg.sender;
|
50
|
+
if (! getRegistry().isRegisteredService(caller)) {
|
51
|
+
revert ErrorInstanceServiceRequestUnauhorized(caller);
|
64
52
|
}
|
65
53
|
_;
|
66
54
|
}
|
@@ -82,14 +70,14 @@ contract InstanceService is Service, IInstanceService {
|
|
82
70
|
address registryServiceAddress = registry.getServiceAddress(REGISTRY(), getMajorVersion());
|
83
71
|
IRegistryService registryService = IRegistryService(registryServiceAddress);
|
84
72
|
|
85
|
-
// initially
|
86
|
-
// This will allow the instance service to bootstrap the authorizations of the instance
|
87
|
-
//
|
73
|
+
// initially set the authority of the access managar to this (being the instance service).
|
74
|
+
// This will allow the instance service to bootstrap the authorizations of the instance
|
75
|
+
// and then transfer the ownership of the access manager to the instance owner once everything is setup
|
88
76
|
clonedAccessManager = InstanceAccessManager(Clones.clone(_masterInstanceAccessManager));
|
89
|
-
clonedAccessManager.initialize(address(this)
|
77
|
+
clonedAccessManager.initialize(address(this));
|
90
78
|
|
91
79
|
clonedInstance = Instance(Clones.clone(_masterInstance));
|
92
|
-
clonedInstance.initialize(address(clonedAccessManager), registryAddress, registryNftId,
|
80
|
+
clonedInstance.initialize(address(clonedAccessManager), registryAddress, registryNftId, msg.sender);
|
93
81
|
|
94
82
|
clonedInstanceReader = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
95
83
|
clonedInstanceReader.initialize(registryAddress, address(clonedInstance));
|
@@ -101,9 +89,12 @@ contract InstanceService is Service, IInstanceService {
|
|
101
89
|
|
102
90
|
// TODO amend setters with instance specific , policy manager ...
|
103
91
|
|
104
|
-
_grantInitialAuthorizations(clonedAccessManager, clonedInstance, clonedBundleManager
|
92
|
+
_grantInitialAuthorizations(clonedAccessManager, clonedInstance, clonedBundleManager);
|
105
93
|
|
106
|
-
|
94
|
+
// to complete setup switch instance ownership to the instance owner
|
95
|
+
// TODO: use a role less powerful than admin, maybe INSTANCE_ADMIN (does not exist yet)
|
96
|
+
clonedAccessManager.grantRole(ADMIN_ROLE(), instanceOwner);
|
97
|
+
clonedAccessManager.revokeRole(ADMIN_ROLE(), address(this));
|
107
98
|
|
108
99
|
IRegistry.ObjectInfo memory info = registryService.registerInstance(clonedInstance, instanceOwner);
|
109
100
|
clonedInstanceNftId = info.nftId;
|
@@ -112,44 +103,38 @@ contract InstanceService is Service, IInstanceService {
|
|
112
103
|
emit LogInstanceCloned(address(clonedAccessManager), address(clonedInstance), address(clonedInstanceReader), clonedInstanceNftId);
|
113
104
|
}
|
114
105
|
|
115
|
-
function _grantInitialAuthorizations(
|
116
|
-
|
117
|
-
|
118
|
-
BundleManager clonedBundleManager,
|
119
|
-
address instanceOwner)
|
120
|
-
internal
|
121
|
-
{
|
122
|
-
_createCoreAndGifRoles(clonedAccessManager);
|
123
|
-
_createCoreTargets(clonedAccessManager, clonedInstance, clonedBundleManager);
|
106
|
+
function _grantInitialAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance, BundleManager clonedBundleManager) internal {
|
107
|
+
_createGifRoles(clonedAccessManager);
|
108
|
+
_createGifTargets(clonedAccessManager, clonedInstance, clonedBundleManager);
|
124
109
|
_grantDistributionServiceAuthorizations(clonedAccessManager, clonedInstance);
|
125
110
|
_grantPoolServiceAuthorizations(clonedAccessManager, clonedInstance);
|
126
111
|
_grantProductServiceAuthorizations(clonedAccessManager, clonedInstance);
|
112
|
+
_grantApplicationServiceAuthorizations(clonedAccessManager, clonedInstance);
|
127
113
|
_grantPolicyServiceAuthorizations(clonedAccessManager, clonedInstance);
|
114
|
+
_grantClaimServiceAuthorizations(clonedAccessManager, clonedInstance);
|
128
115
|
_grantBundleServiceAuthorizations(clonedAccessManager, clonedInstance, clonedBundleManager);
|
129
116
|
_grantInstanceServiceAuthorizations(clonedAccessManager, clonedInstance);
|
130
|
-
_grantInstanceOwnerAuthorizations(clonedAccessManager, instanceOwner);
|
131
117
|
}
|
132
118
|
|
133
|
-
function
|
134
|
-
|
135
|
-
clonedAccessManager.
|
136
|
-
clonedAccessManager.
|
137
|
-
|
138
|
-
clonedAccessManager.
|
139
|
-
|
140
|
-
clonedAccessManager.
|
141
|
-
clonedAccessManager.
|
142
|
-
clonedAccessManager.
|
143
|
-
clonedAccessManager.
|
144
|
-
clonedAccessManager.
|
145
|
-
clonedAccessManager.
|
146
|
-
// custom roles -> controled by component owner
|
119
|
+
function _createGifRoles(InstanceAccessManager clonedAccessManager) internal {
|
120
|
+
clonedAccessManager.createGifRole(DISTRIBUTION_OWNER_ROLE(), "DistributionOwnerRole");
|
121
|
+
clonedAccessManager.createGifRole(POOL_OWNER_ROLE(), "PoolOwnerRole");
|
122
|
+
clonedAccessManager.createGifRole(PRODUCT_OWNER_ROLE(), "ProductOwnerRole");
|
123
|
+
|
124
|
+
clonedAccessManager.createGifRole(DISTRIBUTION_SERVICE_ROLE(), "DistributionServiceRole");
|
125
|
+
clonedAccessManager.createGifRole(POOL_SERVICE_ROLE(), "PoolServiceRole");
|
126
|
+
clonedAccessManager.createGifRole(PRODUCT_SERVICE_ROLE(), "ProductServiceRole");
|
127
|
+
clonedAccessManager.createGifRole(APPLICATION_SERVICE_ROLE(), "ApplicationServiceRole");
|
128
|
+
clonedAccessManager.createGifRole(POLICY_SERVICE_ROLE(), "PolicyServiceRole");
|
129
|
+
clonedAccessManager.createGifRole(CLAIM_SERVICE_ROLE(), "ClaimServiceRole");
|
130
|
+
clonedAccessManager.createGifRole(BUNDLE_SERVICE_ROLE(), "BundleServiceRole");
|
131
|
+
clonedAccessManager.createGifRole(INSTANCE_SERVICE_ROLE(), "InstanceServiceRole");
|
147
132
|
}
|
148
133
|
|
149
|
-
function
|
150
|
-
clonedAccessManager.
|
151
|
-
clonedAccessManager.
|
152
|
-
clonedAccessManager.
|
134
|
+
function _createGifTargets(InstanceAccessManager clonedAccessManager, Instance clonedInstance, BundleManager clonedBundleManager) internal {
|
135
|
+
clonedAccessManager.createGifTarget(address(clonedAccessManager), "InstanceAccessManager");
|
136
|
+
clonedAccessManager.createGifTarget(address(clonedInstance), "Instance");
|
137
|
+
clonedAccessManager.createGifTarget(address(clonedBundleManager), "BundleManager");
|
153
138
|
}
|
154
139
|
|
155
140
|
function _grantDistributionServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
@@ -157,9 +142,18 @@ contract InstanceService is Service, IInstanceService {
|
|
157
142
|
IRegistry registry = getRegistry();
|
158
143
|
address distributionServiceAddress = registry.getServiceAddress(DISTRIBUTION(), getMajorVersion());
|
159
144
|
clonedAccessManager.grantRole(DISTRIBUTION_SERVICE_ROLE(), distributionServiceAddress);
|
160
|
-
bytes4[] memory instanceDistributionServiceSelectors = new bytes4[](
|
161
|
-
instanceDistributionServiceSelectors[0] = clonedInstance.createDistributionSetup.selector
|
145
|
+
bytes4[] memory instanceDistributionServiceSelectors = new bytes4[](11);
|
146
|
+
instanceDistributionServiceSelectors[0] = clonedInstance.createDistributionSetup.selector;
|
162
147
|
instanceDistributionServiceSelectors[1] = clonedInstance.updateDistributionSetup.selector;
|
148
|
+
instanceDistributionServiceSelectors[2] = clonedInstance.createDistributorType.selector;
|
149
|
+
instanceDistributionServiceSelectors[3] = clonedInstance.updateDistributorType.selector;
|
150
|
+
instanceDistributionServiceSelectors[4] = clonedInstance.updateDistributorTypeState.selector;
|
151
|
+
instanceDistributionServiceSelectors[5] = clonedInstance.createDistributor.selector;
|
152
|
+
instanceDistributionServiceSelectors[6] = clonedInstance.updateDistributor.selector;
|
153
|
+
instanceDistributionServiceSelectors[7] = clonedInstance.updateDistributorState.selector;
|
154
|
+
instanceDistributionServiceSelectors[8] = clonedInstance.createReferral.selector;
|
155
|
+
instanceDistributionServiceSelectors[9] = clonedInstance.updateReferral.selector;
|
156
|
+
instanceDistributionServiceSelectors[10] = clonedInstance.updateReferralState.selector;
|
163
157
|
clonedAccessManager.setTargetFunctionRole(
|
164
158
|
"Instance",
|
165
159
|
instanceDistributionServiceSelectors,
|
@@ -168,7 +162,7 @@ contract InstanceService is Service, IInstanceService {
|
|
168
162
|
|
169
163
|
function _grantPoolServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
170
164
|
// configure authorization for pool service on instance
|
171
|
-
address poolServiceAddress =
|
165
|
+
address poolServiceAddress = getRegistry().getServiceAddress(POOL(), getMajorVersion());
|
172
166
|
clonedAccessManager.grantRole(POOL_SERVICE_ROLE(), address(poolServiceAddress));
|
173
167
|
bytes4[] memory instancePoolServiceSelectors = new bytes4[](4);
|
174
168
|
instancePoolServiceSelectors[0] = clonedInstance.createPoolSetup.selector;
|
@@ -181,7 +175,7 @@ contract InstanceService is Service, IInstanceService {
|
|
181
175
|
|
182
176
|
function _grantProductServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
183
177
|
// configure authorization for product service on instance
|
184
|
-
address productServiceAddress =
|
178
|
+
address productServiceAddress = getRegistry().getServiceAddress(PRODUCT(), getMajorVersion());
|
185
179
|
clonedAccessManager.grantRole(PRODUCT_SERVICE_ROLE(), address(productServiceAddress));
|
186
180
|
bytes4[] memory instanceProductServiceSelectors = new bytes4[](5);
|
187
181
|
instanceProductServiceSelectors[0] = clonedInstance.createProductSetup.selector;
|
@@ -195,23 +189,50 @@ contract InstanceService is Service, IInstanceService {
|
|
195
189
|
PRODUCT_SERVICE_ROLE());
|
196
190
|
}
|
197
191
|
|
192
|
+
function _grantApplicationServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
193
|
+
// configure authorization for application services on instance
|
194
|
+
address applicationServiceAddress = getRegistry().getServiceAddress(APPLICATION(), getMajorVersion());
|
195
|
+
clonedAccessManager.grantRole(APPLICATION_SERVICE_ROLE(), applicationServiceAddress);
|
196
|
+
bytes4[] memory instanceApplicationServiceSelectors = new bytes4[](3);
|
197
|
+
instanceApplicationServiceSelectors[0] = clonedInstance.createApplication.selector;
|
198
|
+
instanceApplicationServiceSelectors[1] = clonedInstance.updateApplication.selector;
|
199
|
+
instanceApplicationServiceSelectors[2] = clonedInstance.updateApplicationState.selector;
|
200
|
+
clonedAccessManager.setTargetFunctionRole(
|
201
|
+
"Instance",
|
202
|
+
instanceApplicationServiceSelectors,
|
203
|
+
APPLICATION_SERVICE_ROLE());
|
204
|
+
}
|
205
|
+
|
198
206
|
function _grantPolicyServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
199
|
-
// configure authorization for policy
|
200
|
-
address policyServiceAddress =
|
201
|
-
clonedAccessManager.grantRole(POLICY_SERVICE_ROLE(),
|
202
|
-
bytes4[] memory instancePolicyServiceSelectors = new bytes4[](
|
203
|
-
instancePolicyServiceSelectors[0] = clonedInstance.
|
204
|
-
instancePolicyServiceSelectors[1] = clonedInstance.
|
205
|
-
instancePolicyServiceSelectors[2] = clonedInstance.updatePolicyState.selector;
|
207
|
+
// configure authorization for policy services on instance
|
208
|
+
address policyServiceAddress = getRegistry().getServiceAddress(POLICY(), getMajorVersion());
|
209
|
+
clonedAccessManager.grantRole(POLICY_SERVICE_ROLE(), policyServiceAddress);
|
210
|
+
bytes4[] memory instancePolicyServiceSelectors = new bytes4[](2);
|
211
|
+
instancePolicyServiceSelectors[0] = clonedInstance.updatePolicy.selector;
|
212
|
+
instancePolicyServiceSelectors[1] = clonedInstance.updatePolicyState.selector;
|
206
213
|
clonedAccessManager.setTargetFunctionRole(
|
207
214
|
"Instance",
|
208
215
|
instancePolicyServiceSelectors,
|
209
216
|
POLICY_SERVICE_ROLE());
|
210
217
|
}
|
211
218
|
|
219
|
+
function _grantClaimServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
220
|
+
// configure authorization for claim/payout services on instance
|
221
|
+
address claimServiceAddress = getRegistry().getServiceAddress(CLAIM(), getMajorVersion());
|
222
|
+
clonedAccessManager.grantRole(POLICY_SERVICE_ROLE(), claimServiceAddress);
|
223
|
+
// TODO add claims function authz
|
224
|
+
bytes4[] memory instanceClaimServiceSelectors = new bytes4[](0);
|
225
|
+
// instanceClaimServiceSelectors[0] = clonedInstance.updatePolicy.selector;
|
226
|
+
// instanceClaimServiceSelectors[1] = clonedInstance.updatePolicyState.selector;
|
227
|
+
clonedAccessManager.setTargetFunctionRole(
|
228
|
+
"Instance",
|
229
|
+
instanceClaimServiceSelectors,
|
230
|
+
CLAIM_SERVICE_ROLE());
|
231
|
+
}
|
232
|
+
|
212
233
|
function _grantBundleServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance, BundleManager clonedBundleManager) internal {
|
213
234
|
// configure authorization for bundle service on instance
|
214
|
-
address bundleServiceAddress =
|
235
|
+
address bundleServiceAddress = getRegistry().getServiceAddress(BUNDLE(), getMajorVersion());
|
215
236
|
clonedAccessManager.grantRole(BUNDLE_SERVICE_ROLE(), address(bundleServiceAddress));
|
216
237
|
bytes4[] memory instanceBundleServiceSelectors = new bytes4[](2);
|
217
238
|
instanceBundleServiceSelectors[0] = clonedInstance.createBundle.selector;
|
@@ -235,8 +256,8 @@ contract InstanceService is Service, IInstanceService {
|
|
235
256
|
}
|
236
257
|
|
237
258
|
function _grantInstanceServiceAuthorizations(InstanceAccessManager clonedAccessManager, Instance clonedInstance) internal {
|
238
|
-
|
239
|
-
address instanceServiceAddress =
|
259
|
+
// configure authorization for instance service on instance
|
260
|
+
address instanceServiceAddress = getRegistry().getServiceAddress(INSTANCE(), getMajorVersion());
|
240
261
|
clonedAccessManager.grantRole(INSTANCE_SERVICE_ROLE(), instanceServiceAddress);
|
241
262
|
bytes4[] memory instanceInstanceServiceSelectors = new bytes4[](1);
|
242
263
|
instanceInstanceServiceSelectors[0] = clonedInstance.setInstanceReader.selector;
|
@@ -245,41 +266,24 @@ contract InstanceService is Service, IInstanceService {
|
|
245
266
|
instanceInstanceServiceSelectors,
|
246
267
|
INSTANCE_SERVICE_ROLE());
|
247
268
|
|
248
|
-
|
249
|
-
|
250
|
-
accessManagerInstanceServiceSelectors[0] = clonedAccessManager.createTarget.selector;
|
251
|
-
accessManagerInstanceServiceSelectors[1] = clonedAccessManager.setTargetLocked.selector;
|
252
|
-
accessManagerInstanceServiceSelectors[2] = clonedAccessManager.setTargetFunctionRole.selector;
|
269
|
+
bytes4[] memory instanceAccessManagerInstanceServiceSelectors = new bytes4[](1);
|
270
|
+
instanceAccessManagerInstanceServiceSelectors[0] = clonedAccessManager.createGifTarget.selector;
|
253
271
|
clonedAccessManager.setTargetFunctionRole(
|
254
272
|
"InstanceAccessManager",
|
255
|
-
|
273
|
+
instanceAccessManagerInstanceServiceSelectors,
|
256
274
|
INSTANCE_SERVICE_ROLE());
|
257
275
|
}
|
258
276
|
|
259
|
-
function _grantInstanceOwnerAuthorizations(InstanceAccessManager clonedAccessManager, address instanceOwner) internal {
|
260
|
-
// configure authorization for instance owner on instance access manager
|
261
|
-
clonedAccessManager.grantRole(INSTANCE_OWNER_ROLE(), instanceOwner);
|
262
|
-
// TODO instance owner can grant/revoke/renounce INSTANCE_OWNER_ROLE -> through instance service?
|
263
|
-
//clonedAccessManager.setRoleAdmin(INSTANCE_OWNER_ROLE(), INSTANCE_OWNER_ROLE()); -> invalid
|
264
|
-
bytes4[] memory accessManagerInstanceOwnerSelectors = new bytes4[](2);
|
265
|
-
accessManagerInstanceOwnerSelectors[0] = clonedAccessManager.createCustomTarget.selector;
|
266
|
-
accessManagerInstanceOwnerSelectors[1] = clonedAccessManager.setTargetFunctionCustomRole.selector;
|
267
|
-
clonedAccessManager.setTargetFunctionRole(
|
268
|
-
"InstanceAccessManager",
|
269
|
-
accessManagerInstanceOwnerSelectors,
|
270
|
-
INSTANCE_OWNER_ROLE());
|
271
|
-
}
|
272
|
-
|
273
277
|
function setAndRegisterMasterInstance(address instanceAddress)
|
274
278
|
external
|
275
279
|
onlyOwner
|
276
280
|
returns(NftId masterInstanceNftId)
|
277
281
|
{
|
278
|
-
|
279
|
-
|
280
|
-
|
282
|
+
if(_masterInstance != address(0)) { revert ErrorInstanceServiceMasterInstanceAlreadySet(); }
|
283
|
+
if(_masterInstanceAccessManager != address(0)) { revert ErrorInstanceServiceMasterInstanceAccessManagerAlreadySet(); }
|
284
|
+
if(_masterInstanceBundleManager != address(0)) { revert ErrorInstanceServiceMasterBundleManagerAlreadySet(); }
|
281
285
|
|
282
|
-
|
286
|
+
if(instanceAddress == address(0)) { revert ErrorInstanceServiceInstanceAddressZero(); }
|
283
287
|
|
284
288
|
IInstance instance = IInstance(instanceAddress);
|
285
289
|
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
@@ -289,13 +293,13 @@ contract InstanceService is Service, IInstanceService {
|
|
289
293
|
BundleManager bundleManager = instance.getBundleManager();
|
290
294
|
address bundleManagerAddress = address(bundleManager);
|
291
295
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
296
|
+
if(accessManagerAddress == address(0)) { revert ErrorInstanceServiceAccessManagerZero(); }
|
297
|
+
if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderZero(); }
|
298
|
+
if(bundleManagerAddress == address(0)) { revert ErrorInstanceServiceBundleManagerZero(); }
|
299
|
+
|
300
|
+
if(instance.authority() != accessManagerAddress) { revert ErrorInstanceServiceInstanceAuthorityMismatch(); }
|
301
|
+
if(instanceReader.getInstance() != instance) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch2(); }
|
302
|
+
if(bundleManager.getInstance() != instance) { revert ErrorInstanceServiceBundleMangerInstanceMismatch(); }
|
299
303
|
|
300
304
|
_masterInstanceAccessManager = accessManagerAddress;
|
301
305
|
_masterInstance = instanceAddress;
|
@@ -310,27 +314,27 @@ contract InstanceService is Service, IInstanceService {
|
|
310
314
|
// masterInstance.linkToRegisteredNftId();
|
311
315
|
}
|
312
316
|
|
313
|
-
function setMasterInstanceReader(address instanceReaderAddress)
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
require(_masterInstanceReader != address(0), "ERROR:CRD-003:INSTANCE_READER_MASTER_NOT_SET");
|
318
|
-
require (instanceReaderAddress != address(0), "ERROR:CRD-012:INSTANCE_READER_ZERO");
|
319
|
-
require(instanceReaderAddress != _masterInstanceReader, "ERROR:CRD-014:INSTANCE_READER_MASTER_SAME_AS_NEW");
|
317
|
+
function setMasterInstanceReader(address instanceReaderAddress) external onlyOwner {
|
318
|
+
if(_masterInstanceReader == address(0)) { revert ErrorInstanceServiceMasterInstanceReaderNotSet(); }
|
319
|
+
if(instanceReaderAddress == address(0)) { revert ErrorInstanceServiceInstanceReaderAddressZero(); }
|
320
|
+
if(instanceReaderAddress == _masterInstanceReader) { revert ErrorInstanceServiceInstanceReaderSameAsMasterInstanceReader(); }
|
320
321
|
|
321
322
|
InstanceReader instanceReader = InstanceReader(instanceReaderAddress);
|
322
|
-
|
323
|
+
if(instanceReader.getInstance() != IInstance(_masterInstance)) { revert ErrorInstanceServiceInstanceReaderInstanceMismatch(); }
|
323
324
|
|
324
325
|
_masterInstanceReader = instanceReaderAddress;
|
325
326
|
}
|
326
327
|
|
327
|
-
|
328
|
-
|
329
|
-
onlyInstanceOwner(instanceNftId)
|
330
|
-
{
|
328
|
+
// TODO access restriction
|
329
|
+
function upgradeInstanceReader(NftId instanceNftId) external {
|
331
330
|
IRegistry registry = getRegistry();
|
332
331
|
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
333
332
|
Instance instance = Instance(instanceInfo.objectAddress);
|
333
|
+
address owner = instance.getOwner();
|
334
|
+
|
335
|
+
if (msg.sender != owner) {
|
336
|
+
revert ErrorInstanceServiceRequestUnauhorized(msg.sender);
|
337
|
+
}
|
334
338
|
|
335
339
|
InstanceReader upgradedInstanceReaderClone = InstanceReader(Clones.clone(address(_masterInstanceReader)));
|
336
340
|
upgradedInstanceReaderClone.initialize(address(registry), address(instance));
|
@@ -372,29 +376,22 @@ contract InstanceService is Service, IInstanceService {
|
|
372
376
|
(registryAddress, initialOwner) = abi.decode(data, (address, address));
|
373
377
|
// TODO while InstanceService is not deployed in InstanceServiceManager constructor
|
374
378
|
// owner is InstanceServiceManager deployer
|
375
|
-
|
376
|
-
|
377
|
-
_registerInterface(type(IInstanceService).interfaceId);
|
379
|
+
initializeService(registryAddress, owner);
|
380
|
+
registerInterface(type(IInstanceService).interfaceId);
|
378
381
|
}
|
379
382
|
|
380
|
-
// TODO call instance access manager directlly and delete this function?
|
381
383
|
function hasRole(address account, RoleId role, address instanceAddress) public view returns (bool) {
|
382
384
|
Instance instance = Instance(instanceAddress);
|
383
385
|
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
384
386
|
return accessManager.hasRole(role, account);
|
385
387
|
}
|
386
|
-
|
388
|
+
|
387
389
|
function createGifTarget(NftId instanceNftId, address targetAddress, string memory targetName) external onlyRegisteredService {
|
388
390
|
IRegistry registry = getRegistry();
|
389
391
|
IRegistry.ObjectInfo memory instanceInfo = registry.getObjectInfo(instanceNftId);
|
390
|
-
|
391
|
-
if(instanceInfo.objectType != INSTANCE()) {
|
392
|
-
revert ErrorInstanceServiceNotInstance(instanceNftId);
|
393
|
-
}
|
394
|
-
|
395
392
|
Instance instance = Instance(instanceInfo.objectAddress);
|
396
393
|
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
397
|
-
accessManager.
|
394
|
+
accessManager.createGifTarget(targetAddress, targetName);
|
398
395
|
}
|
399
396
|
|
400
397
|
function grantDistributionDefaultPermissions(NftId instanceNftId, address distributionAddress, string memory distributionName) external onlyRegisteredService {
|
@@ -436,8 +433,22 @@ contract InstanceService is Service, IInstanceService {
|
|
436
433
|
instanceAccessManager.setTargetFunctionRole(poolName, fctSelectors, POOL_OWNER_ROLE());
|
437
434
|
|
438
435
|
bytes4[] memory fctSelectors2 = new bytes4[](1);
|
439
|
-
fctSelectors2[0] = IPoolComponent.
|
436
|
+
fctSelectors2[0] = IPoolComponent.verifyApplication.selector;
|
440
437
|
instanceAccessManager.setTargetFunctionRole(poolName, fctSelectors2, POLICY_SERVICE_ROLE());
|
438
|
+
|
439
|
+
// bundle owner specific functions
|
440
|
+
bytes4[] memory fctSelectors3 = new bytes4[](7);
|
441
|
+
fctSelectors3[0] = IPoolComponent.stake.selector;
|
442
|
+
fctSelectors3[1] = IPoolComponent.unstake.selector;
|
443
|
+
fctSelectors3[2] = IPoolComponent.extend.selector;
|
444
|
+
fctSelectors3[3] = IPoolComponent.lockBundle.selector;
|
445
|
+
fctSelectors3[4] = IPoolComponent.unlockBundle.selector;
|
446
|
+
fctSelectors3[5] = IPoolComponent.close.selector;
|
447
|
+
fctSelectors3[6] = IPoolComponent.setBundleFee.selector;
|
448
|
+
instanceAccessManager.setTargetFunctionRole(
|
449
|
+
poolName,
|
450
|
+
fctSelectors3,
|
451
|
+
IPoolComponent(poolAddress).getBundleOwnerRole());
|
441
452
|
}
|
442
453
|
|
443
454
|
function grantProductDefaultPermissions(NftId instanceNftId, address productAddress, string memory productName) external onlyRegisteredService {
|
@@ -457,17 +468,23 @@ contract InstanceService is Service, IInstanceService {
|
|
457
468
|
instanceAccessManager.setTargetFunctionRole(productName, fctSelectors, PRODUCT_OWNER_ROLE());
|
458
469
|
}
|
459
470
|
|
460
|
-
function
|
471
|
+
function setTargetLocked(string memory targetName, bool locked) external {
|
461
472
|
address componentAddress = msg.sender;
|
462
473
|
IRegistry registry = getRegistry();
|
463
|
-
|
464
|
-
|
474
|
+
IRegistry.ObjectInfo memory componentInfo = registry.getObjectInfo(componentAddress);
|
475
|
+
if (componentInfo.nftId.eqz()) {
|
476
|
+
revert ErrorInstanceServiceComponentNotRegistered(componentAddress);
|
477
|
+
}
|
478
|
+
|
479
|
+
// TODO validate component type
|
480
|
+
|
481
|
+
|
482
|
+
address instanceAddress = registry.getObjectInfo(componentInfo.parentNftId).objectAddress;
|
465
483
|
IInstance instance = IInstance(instanceAddress);
|
466
484
|
|
467
485
|
InstanceAccessManager accessManager = InstanceAccessManager(instance.authority());
|
468
|
-
|
469
|
-
string memory componentName = ShortStrings.toString(accessManager.getTargetInfo(componentAddress).name);
|
470
|
-
accessManager.setTargetLocked(componentName, locked);
|
486
|
+
accessManager.setTargetClosed(targetName, locked);
|
471
487
|
}
|
488
|
+
|
472
489
|
}
|
473
490
|
|
@@ -17,7 +17,7 @@ contract InstanceServiceManager is ProxyManager {
|
|
17
17
|
constructor(
|
18
18
|
address registryAddress
|
19
19
|
)
|
20
|
-
ProxyManager()
|
20
|
+
ProxyManager(registryAddress)
|
21
21
|
{
|
22
22
|
InstanceService instSrv = new InstanceService();
|
23
23
|
// bytes memory initCode = type(InstanceService).creationCode;
|
@@ -61,7 +61,7 @@ abstract contract ComponentService is Service {
|
|
61
61
|
owner = msg.sender;
|
62
62
|
|
63
63
|
// check component has not already been registerd
|
64
|
-
NftId compoentNftId =
|
64
|
+
NftId compoentNftId = getRegistry().getNftId(componentAddress);
|
65
65
|
if(compoentNftId.gtz()) {
|
66
66
|
revert ErrorComponentServiceAlreadyRegistered(componentAddress, compoentNftId);
|
67
67
|
}
|
@@ -11,8 +11,7 @@ interface IAccess {
|
|
11
11
|
struct RoleInfo {
|
12
12
|
ShortString name;
|
13
13
|
bool isCustom;
|
14
|
-
|
15
|
-
RoleId admin;
|
14
|
+
bool isLocked;
|
16
15
|
Timestamp createdAt;
|
17
16
|
Timestamp updatedAt;
|
18
17
|
}
|
@@ -25,24 +24,24 @@ interface IAccess {
|
|
25
24
|
Timestamp updatedAt;
|
26
25
|
}
|
27
26
|
|
28
|
-
error ErrorIAccessCallerIsNotRoleAdmin(address caller, RoleId roleId);
|
29
|
-
|
30
27
|
error ErrorIAccessRoleIdInvalid(RoleId roleId);
|
31
28
|
error ErrorIAccessRoleIdTooBig(RoleId roleId);
|
32
29
|
error ErrorIAccessRoleIdTooSmall(RoleId roleId);
|
33
|
-
error ErrorIAccessRoleIdAlreadyExists(RoleId roleId);
|
30
|
+
error ErrorIAccessRoleIdAlreadyExists(RoleId roleId, ShortString name);
|
31
|
+
error ErrorIAccessRoleIdNotActive(RoleId roleId);
|
34
32
|
error ErrorIAccessRoleNameEmpty(RoleId roleId);
|
35
33
|
error ErrorIAccessRoleNameNotUnique(RoleId roleId, ShortString name);
|
36
|
-
error
|
37
|
-
error
|
34
|
+
error ErrorIAccessRoleInvalidUpdate(RoleId roleId, bool isCustom);
|
35
|
+
error ErrorIAccessRoleIsCustomIsImmutable(RoleId roleId, bool isCustom, bool isCustomExisting);
|
36
|
+
error ErrorIAccessGrantNonexstentRole(RoleId roleId);
|
37
|
+
error ErrorIAccessRevokeNonexstentRole(RoleId roleId);
|
38
|
+
error ErrorIAccessRenounceNonexstentRole(RoleId roleId);
|
38
39
|
|
39
40
|
error ErrorIAccessTargetAddressZero();
|
40
41
|
error ErrorIAccessTargetDoesNotExist(ShortString name);
|
41
|
-
error
|
42
|
+
error ErrorIAccessTargetAddressDoesNotExist(address target);
|
43
|
+
error ErrorIAccessTargetExists(address target, ShortString name);
|
42
44
|
error ErrorIAccessTargetNameEmpty(address target);
|
43
45
|
error ErrorIAccessTargetNameExists(address target, address existingTarget, ShortString name);
|
44
46
|
error ErrorIAccessTargetLocked(address target);
|
45
|
-
error ErrorIAccessTargetIsRegistered(address target);
|
46
|
-
error ErrorIAccessSetLockedForNoncustomTarget(address target);
|
47
|
-
error ErrorIAccessSetForNoncustomTarget(address target);
|
48
47
|
}
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {NftId} from "../../types/NftId.sol";
|
5
5
|
import {Fee} from "../../types/Fee.sol";
|
6
|
+
import {Seconds} from "../../types/Seconds.sol";
|
6
7
|
import {Timestamp} from "../../types/Timestamp.sol";
|
7
8
|
|
8
9
|
interface IBundle {
|
@@ -13,7 +14,7 @@ interface IBundle {
|
|
13
14
|
uint256 capitalAmount; // net investment capital + net premiums - payouts
|
14
15
|
uint256 lockedAmount; // capital amount linked to collateralizaion of non-closed policies (<= balance)
|
15
16
|
uint256 balanceAmount; // total amount of funds: capitalAmount + fees (balance >= captial)
|
16
|
-
|
17
|
+
Seconds lifetime;
|
17
18
|
Timestamp expiredAt; // no new policies
|
18
19
|
Timestamp closedAt; // no open policies, locked amount = 0
|
19
20
|
}
|
@@ -2,12 +2,39 @@
|
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {NftId} from "../../types/NftId.sol";
|
5
|
-
import {
|
5
|
+
import {ClaimId} from "../../types/ClaimId.sol";
|
6
6
|
import {ReferralId} from "../../types/Referral.sol";
|
7
7
|
import {RiskId} from "../../types/RiskId.sol";
|
8
|
+
import {Seconds} from "../../types/Seconds.sol";
|
8
9
|
import {Timestamp} from "../../types/Timestamp.sol";
|
9
10
|
|
10
11
|
interface IPolicy {
|
12
|
+
|
13
|
+
struct Premium {
|
14
|
+
// this is the net premium calculated by the product
|
15
|
+
uint256 netPremiumAmount;
|
16
|
+
// fullPremium = netPremium + all fixed amounts + all variable amounts (excl commission and minDistribtuionOwnerFee variable part)
|
17
|
+
uint256 fullPremiumAmount;
|
18
|
+
// premium = fullPremium - discount
|
19
|
+
uint256 premiumAmount;
|
20
|
+
uint256 productFeeFixAmount;
|
21
|
+
uint256 poolFeeFixAmount;
|
22
|
+
uint256 bundleFeeFixAmount;
|
23
|
+
uint256 distributionFeeFixAmount;
|
24
|
+
uint256 productFeeVarAmount;
|
25
|
+
uint256 poolFeeVarAmount;
|
26
|
+
uint256 bundleFeeVarAmount;
|
27
|
+
uint256 distributionFeeVarAmount;
|
28
|
+
uint256 distributionOwnerFeeFixAmount;
|
29
|
+
// this is the remaining amount when the commission and discount are subtracted from the distribution fee variable part (must be at least the minDistributionOwnerFee)
|
30
|
+
uint256 distributionOwnerFeeVarAmount;
|
31
|
+
// this value is based on distributor type referenced in the referral
|
32
|
+
uint256 commissionAmount;
|
33
|
+
// this is based on referral used
|
34
|
+
uint256 discountAmount;
|
35
|
+
}
|
36
|
+
|
37
|
+
/// @dev policy data for the full policy lifecycle
|
11
38
|
struct PolicyInfo {
|
12
39
|
NftId productNftId;
|
13
40
|
NftId bundleNftId;
|
@@ -16,7 +43,7 @@ interface IPolicy {
|
|
16
43
|
uint256 sumInsuredAmount;
|
17
44
|
uint256 premiumAmount;
|
18
45
|
uint256 premiumPaidAmount;
|
19
|
-
|
46
|
+
Seconds lifetime;
|
20
47
|
bytes applicationData;
|
21
48
|
bytes policyData;
|
22
49
|
uint16 claimsCount;
|
@@ -37,7 +64,7 @@ interface IPolicy {
|
|
37
64
|
|
38
65
|
// claimId neeeds to be encoded policyNftId:claimId combination
|
39
66
|
struct PayoutInfo {
|
40
|
-
|
67
|
+
ClaimId claimId;
|
41
68
|
uint256 amount;
|
42
69
|
bytes data;
|
43
70
|
Timestamp paidAt; // payoment of confirmed claim amount (or declinedAt)
|