@etherisc/gif-next 0.0.2-9a02a95-445 → 0.0.2-9addcc0-107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -13
- package/artifacts/contracts/components/Component.sol/Component.dbg.json +4 -0
- package/artifacts/contracts/components/Component.sol/Component.json +873 -0
- package/artifacts/contracts/components/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/components/Distribution.sol/Distribution.json +896 -264
- package/artifacts/contracts/components/IComponent.sol/IComponent.dbg.json +4 -0
- package/artifacts/contracts/components/{BaseComponent.sol/BaseComponent.json → IComponent.sol/IComponent.json} +257 -74
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IDistributionComponent.sol/IDistributionComponent.json +879 -31
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IPoolComponent.sol/IPoolComponent.json +879 -59
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/components/IProductComponent.sol/IProductComponent.json +720 -16
- package/artifacts/contracts/components/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/components/Pool.sol/Pool.json +757 -289
- package/artifacts/contracts/components/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/components/Product.sol/Product.json +587 -244
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +1 -1
- package/artifacts/contracts/instance/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +15 -15
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +69 -79
- 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 +1450 -446
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +289 -185
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +1125 -1290
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +424 -236
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +414 -267
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +477 -385
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +308 -108
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/ObjectManager.sol/ObjectManager.json +11 -40
- package/artifacts/contracts/instance/base/ComponentService.sol/ComponentService.dbg.json +4 -0
- package/artifacts/contracts/instance/base/{ComponentServiceBase.sol/ComponentServiceBase.json → ComponentService.sol/ComponentService.json} +282 -172
- 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 +71 -45
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +4 -0
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.json +10 -0
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +1 -1
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationService.sol/ApplicationService.json +1124 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ApplicationServiceManager.sol/ApplicationServiceManager.json +688 -0
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleService.sol/BundleService.json +670 -310
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/BundleServiceManager.sol/BundleServiceManager.json +337 -81
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimService.sol/ClaimService.json +1384 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +4 -0
- package/artifacts/contracts/instance/service/ClaimServiceManager.sol/ClaimServiceManager.json +752 -0
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionService.sol/DistributionService.json +1467 -304
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/DistributionServiceManager.sol/DistributionServiceManager.json +463 -75
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IApplicationService.sol/IApplicationService.json +619 -0
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IBundleService.sol/IBundleService.json +323 -262
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.dbg.json +4 -0
- package/artifacts/contracts/instance/service/IClaimService.sol/IClaimService.json +743 -0
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IDistributionService.sol/IDistributionService.json +781 -168
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPolicyService.sol/IPolicyService.json +275 -288
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IPoolService.sol/IPoolService.json +714 -136
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/IProductService.sol/IProductService.json +84 -178
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyService.sol/PolicyService.json +656 -359
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PolicyServiceManager.sol/PolicyServiceManager.json +367 -91
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolService.sol/PoolService.json +1129 -225
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/PoolServiceManager.sol/PoolServiceManager.json +355 -75
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductService.sol/ProductService.json +318 -222
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/service/ProductServiceManager.sol/ProductServiceManager.json +298 -78
- 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 +244 -133
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +147 -236
- 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 +257 -235
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +285 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +191 -334
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +285 -145
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +4 -0
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +559 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +128 -53
- 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 +27 -29
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +189 -0
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +8 -34
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/{experiment/inheritance/IA.sol/ISharedA.json → shared/IRegistryLinked.sol/IRegistryLinked.json} +15 -17
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +84 -178
- 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 +107 -27
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +4 -0
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +302 -0
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +283 -63
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +116 -51
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +4 -0
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +71 -0
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +185 -165
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +24 -6
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/shared/Versionable.sol/Versionable.json +2 -152
- package/artifacts/contracts/test/TestFee.sol/TestFee.dbg.json +1 -1
- package/artifacts/contracts/test/TestFee.sol/TestFee.json +2 -2
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.dbg.json +1 -1
- package/artifacts/contracts/test/TestRegisterable.sol/TestRegisterable.json +116 -51
- 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 +204 -216
- package/artifacts/contracts/test/TestToken.sol/TestUsdc.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersion.sol/TestVersion.json +2 -2
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.dbg.json +1 -1
- package/artifacts/contracts/test/TestVersionable.sol/TestVersionable.json +8 -190
- package/artifacts/contracts/test/Usdc.sol/USDC.dbg.json +1 -1
- package/artifacts/contracts/types/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/types/Amount.sol/AmountLib.dbg.json +4 -0
- package/artifacts/contracts/types/Amount.sol/AmountLib.json +281 -0
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/types/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/types/ChainId.sol/ChainIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/ClaimId.sol/ClaimIdLib.json +179 -0
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/types/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/types/Fee.sol/FeeLib.json +74 -19
- package/artifacts/contracts/types/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/types/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/types/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/NftId.sol/NftIdLib.json +17 -4
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/types/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/types/NumberId.sol/NumberIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/types/ObjectType.sol/ObjectTypeLib.json +2 -2
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.dbg.json +4 -0
- package/artifacts/contracts/types/PayoutId.sol/PayoutIdLib.json +209 -0
- package/artifacts/contracts/types/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/types/Referral.sol/ReferralLib.json +23 -4
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.dbg.json +4 -0
- package/artifacts/contracts/types/Seconds.sol/SecondsLib.json +124 -0
- package/artifacts/contracts/types/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/types/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/types/Timestamp.sol/TimestampLib.json +38 -7
- package/artifacts/contracts/types/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/types/UFixed.sol/UFixedLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/types/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/types/Version.sol/VersionPartLib.json +2 -2
- package/contracts/components/Component.sol +272 -0
- package/contracts/components/Distribution.sol +205 -83
- package/contracts/components/IComponent.sol +90 -0
- package/contracts/components/IDistributionComponent.sol +44 -17
- package/contracts/components/IPoolComponent.sol +90 -42
- package/contracts/components/IProductComponent.sol +15 -9
- package/contracts/components/Pool.sol +217 -186
- package/contracts/components/Product.sol +246 -166
- package/contracts/instance/AccessManagerUpgradeableInitializeable.sol +2 -12
- package/contracts/instance/BundleManager.sol +17 -20
- package/contracts/instance/Cloneable.sol +7 -2
- package/contracts/instance/IInstance.sol +67 -23
- package/contracts/instance/IInstanceService.sol +39 -10
- package/contracts/instance/Instance.sol +151 -301
- package/contracts/instance/InstanceAccessManager.sol +393 -205
- package/contracts/instance/InstanceReader.sol +87 -36
- package/contracts/instance/InstanceService.sol +332 -132
- package/contracts/instance/InstanceServiceManager.sol +6 -9
- package/contracts/instance/ObjectManager.sol +10 -29
- package/contracts/instance/base/ComponentService.sol +130 -0
- package/contracts/instance/base/KeyValueStore.sol +13 -36
- package/contracts/instance/base/Lifecycle.sol +26 -6
- package/contracts/instance/module/IAccess.sol +36 -20
- package/contracts/instance/module/IBundle.sol +8 -5
- package/contracts/instance/module/IComponents.sol +41 -0
- package/contracts/instance/module/IDistribution.sol +3 -0
- package/contracts/instance/module/IPolicy.sol +43 -11
- package/contracts/instance/module/ISetup.sol +7 -20
- package/contracts/instance/service/ApplicationService.sol +356 -0
- package/contracts/instance/service/ApplicationServiceManager.sol +35 -0
- package/contracts/instance/service/BundleService.sol +245 -120
- package/contracts/instance/service/BundleServiceManager.sol +6 -9
- package/contracts/instance/service/ClaimService.sol +443 -0
- package/contracts/instance/service/ClaimServiceManager.sol +35 -0
- package/contracts/instance/service/DistributionService.sol +364 -50
- package/contracts/instance/service/DistributionServiceManager.sol +7 -10
- package/contracts/instance/service/IApplicationService.sol +79 -0
- package/contracts/instance/service/IBundleService.sol +93 -20
- package/contracts/instance/service/IClaimService.sol +90 -0
- package/contracts/instance/service/IDistributionService.sol +89 -0
- package/contracts/instance/service/IPolicyService.sol +44 -51
- package/contracts/instance/service/IPoolService.sol +97 -3
- package/contracts/instance/service/PolicyService.sol +234 -370
- package/contracts/instance/service/PolicyServiceManager.sol +2 -2
- package/contracts/instance/service/PoolService.sol +322 -43
- package/contracts/instance/service/PoolServiceManager.sol +6 -9
- package/contracts/instance/service/ProductService.sol +94 -57
- package/contracts/instance/service/ProductServiceManager.sol +2 -2
- package/contracts/registry/ChainNft.sol +9 -1
- package/contracts/registry/IRegistry.sol +39 -19
- package/contracts/registry/IRegistryService.sol +29 -13
- package/contracts/registry/ITransferInterceptor.sol +1 -0
- package/contracts/registry/Registry.sol +243 -224
- package/contracts/registry/RegistryAccessManager.sol +216 -0
- package/contracts/registry/RegistryService.sol +97 -173
- package/contracts/registry/RegistryServiceManager.sol +21 -39
- package/contracts/registry/ReleaseManager.sol +324 -0
- package/contracts/registry/TokenRegistry.sol +22 -17
- package/contracts/shared/ERC165.sol +14 -12
- package/contracts/shared/INftOwnable.sol +11 -10
- package/contracts/shared/IPolicyHolder.sol +40 -0
- package/contracts/shared/IRegisterable.sol +4 -6
- package/contracts/shared/IRegistryLinked.sol +11 -0
- package/contracts/shared/IService.sol +7 -4
- package/contracts/shared/IVersionable.sol +4 -47
- package/contracts/shared/NftOwnable.sol +64 -80
- package/contracts/shared/PolicyHolder.sol +94 -0
- package/contracts/shared/ProxyManager.sol +100 -25
- package/contracts/shared/Registerable.sol +24 -39
- package/contracts/shared/RegistryLinked.sol +43 -0
- package/contracts/shared/Service.sol +41 -24
- package/contracts/shared/TokenHandler.sol +14 -6
- package/contracts/shared/Versionable.sol +4 -92
- package/contracts/test/TestRegisterable.sol +1 -1
- package/contracts/test/TestService.sol +4 -3
- package/contracts/types/Amount.sol +109 -0
- package/contracts/types/Blocknumber.sol +1 -0
- package/contracts/types/ClaimId.sol +75 -0
- package/contracts/types/DistributorType.sol +2 -2
- package/contracts/types/Fee.sol +17 -8
- package/contracts/types/NftId.sol +8 -0
- package/contracts/types/ObjectType.sol +11 -6
- package/contracts/types/PayoutId.sol +82 -0
- package/contracts/types/Referral.sol +4 -0
- package/contracts/types/RoleId.sol +19 -14
- package/contracts/types/Seconds.sol +54 -0
- package/contracts/types/StateId.sol +7 -2
- package/contracts/types/Timestamp.sol +18 -13
- package/contracts/types/UFixed.sol +1 -0
- package/contracts/types/Version.sol +1 -0
- package/package.json +3 -3
- package/artifacts/contracts/components/BaseComponent.sol/BaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.dbg.json +0 -4
- package/artifacts/contracts/components/IBaseComponent.sol/IBaseComponent.json +0 -368
- 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/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/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.dbg.json +0 -4
- package/artifacts/contracts/instance/IAccessManagerSimple.sol/IAccessManagerSimple.json +0 -1082
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/IInstanceBase.sol/IInstanceBase.json +0 -448
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceBase.sol/InstanceBase.json +0 -763
- package/artifacts/contracts/instance/base/ComponentServiceBase.sol/ComponentServiceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.dbg.json +0 -4
- package/artifacts/contracts/instance/base/IInstanceBase.sol/IInstanceBase.json +0 -113
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/ComponentOwnerService.sol/ComponentOwnerService.json +0 -827
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.dbg.json +0 -4
- package/artifacts/contracts/instance/service/IComponentOwnerService.sol/IComponentOwnerService.json +0 -466
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.dbg.json +0 -4
- package/artifacts/contracts/shared/RegisterableUpgradable.sol/RegisterableUpgradable.json +0 -442
- package/contracts/components/BaseComponent.sol +0 -132
- package/contracts/components/IBaseComponent.sol +0 -31
- 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
- package/contracts/instance/IAccessManagerSimple.sol +0 -391
- package/contracts/instance/IInstanceBase.sol +0 -26
- package/contracts/instance/InstanceBase.sol +0 -41
- package/contracts/instance/base/ComponentServiceBase.sol +0 -72
- package/contracts/instance/base/IInstanceBase.sol +0 -23
- package/contracts/instance/service/ComponentOwnerService.sol +0 -317
- package/contracts/instance/service/IComponentOwnerService.sol +0 -20
- package/contracts/shared/RegisterableUpgradable.sol +0 -16
@@ -1,47 +1,49 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
5
|
-
import {ShortString, ShortStrings} from "@openzeppelin/contracts/utils/ShortStrings.sol";
|
6
|
-
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
7
4
|
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
8
5
|
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import {
|
6
|
+
import {Key32} from "../types/Key32.sol";
|
7
|
+
import {NftId} from "../types/NftId.sol";
|
8
|
+
import {ClaimId} from "../types/ClaimId.sol";
|
9
|
+
import {DistributorType} from "../types/DistributorType.sol";
|
10
|
+
import {PayoutId} from "../types/PayoutId.sol";
|
11
|
+
import {ObjectType, BUNDLE, DISTRIBUTION, INSTANCE, POLICY, POOL, PRODUCT, DISTRIBUTOR} from "../types/ObjectType.sol";
|
12
|
+
import {ReferralId} from "../types/Referral.sol";
|
13
|
+
import {RiskId} from "../types/RiskId.sol";
|
14
|
+
import {INSTANCE_OWNER_ROLE} from "../types/RoleId.sol";
|
15
|
+
import {StateId} from "../types/StateId.sol";
|
16
|
+
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
17
|
+
|
18
|
+
import {Registerable} from "../shared/Registerable.sol";
|
19
|
+
|
20
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
21
|
+
|
16
22
|
import {IInstance} from "./IInstance.sol";
|
17
23
|
import {InstanceReader} from "./InstanceReader.sol";
|
18
24
|
import {InstanceAccessManager} from "./InstanceAccessManager.sol";
|
19
25
|
import {BundleManager} from "./BundleManager.sol";
|
20
|
-
|
21
|
-
import {
|
22
|
-
|
23
|
-
import {
|
24
|
-
import {
|
25
|
-
import {
|
26
|
-
import {
|
27
|
-
import {
|
28
|
-
import {
|
29
|
-
|
30
|
-
import {
|
31
|
-
import {IPoolService} from "./service/IPoolService.sol";
|
32
|
-
import {IProductService} from "./service/IProductService.sol";
|
33
|
-
import {IPolicyService} from "./service/IPolicyService.sol";
|
34
|
-
import {IBundleService} from "./service/IBundleService.sol";
|
35
|
-
import {VersionPart} from "../types/Version.sol";
|
36
|
-
import {InstanceBase} from "./InstanceBase.sol";
|
26
|
+
|
27
|
+
import {KeyValueStore} from "./base/KeyValueStore.sol";
|
28
|
+
|
29
|
+
import {IBundle} from "./module/IBundle.sol";
|
30
|
+
import {IComponents} from "./module/IComponents.sol";
|
31
|
+
import {IDistribution} from "./module/IDistribution.sol";
|
32
|
+
import {IPolicy} from "./module/IPolicy.sol";
|
33
|
+
import {IRisk} from "./module/IRisk.sol";
|
34
|
+
import {ISetup} from "./module/ISetup.sol";
|
35
|
+
|
36
|
+
import {VersionPart, VersionPartLib} from "../types/Version.sol";
|
37
37
|
|
38
38
|
contract Instance is
|
39
|
-
AccessManagedUpgradeable,
|
40
39
|
IInstance,
|
41
|
-
|
42
|
-
|
40
|
+
AccessManagedUpgradeable,
|
41
|
+
Registerable,
|
42
|
+
KeyValueStore
|
43
43
|
{
|
44
44
|
|
45
|
+
uint256 public constant GIF_MAJOR_VERSION = 3;
|
46
|
+
|
45
47
|
uint64 public constant ADMIN_ROLE = type(uint64).min;
|
46
48
|
uint64 public constant PUBLIC_ROLE = type(uint64).max;
|
47
49
|
uint64 public constant CUSTOM_ROLE_ID_MIN = 10000;
|
@@ -50,152 +52,32 @@ contract Instance is
|
|
50
52
|
|
51
53
|
bool private _initialized;
|
52
54
|
|
53
|
-
mapping(ShortString name => RoleId roleId) internal _role;
|
54
|
-
mapping(RoleId roleId => EnumerableSet.AddressSet roleMembers) internal _roleMembers;
|
55
|
-
RoleId [] internal _roles;
|
56
|
-
|
57
|
-
mapping(ShortString name => address target) internal _target;
|
58
|
-
|
59
55
|
InstanceAccessManager internal _accessManager;
|
60
56
|
InstanceReader internal _instanceReader;
|
61
57
|
BundleManager internal _bundleManager;
|
62
58
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
{
|
67
|
-
require(!_initialized, "Contract instance has already been initialized");
|
68
|
-
|
69
|
-
__AccessManaged_init(accessManagerAddress);
|
70
|
-
|
71
|
-
_accessManager = InstanceAccessManager(accessManagerAddress);
|
72
|
-
_createRole(RoleIdLib.toRoleId(ADMIN_ROLE), "AdminRole", false, false);
|
73
|
-
_createRole(RoleIdLib.toRoleId(PUBLIC_ROLE), "PublicRole", false, false);
|
74
|
-
|
75
|
-
_initializeRegisterable(registryAddress, registryNftId, INSTANCE(), false, initialOwner, "");
|
76
|
-
|
77
|
-
_registerInterface(type(IInstance).interfaceId);
|
78
|
-
_initialized = true;
|
79
|
-
}
|
80
|
-
|
81
|
-
//--- Role ------------------------------------------------------//
|
82
|
-
function createStandardRole(RoleId roleId, string memory name) external restricted() {
|
83
|
-
_createRole(roleId, name, false, true);
|
84
|
-
}
|
85
|
-
|
86
|
-
function createCustomRole(RoleId roleId, string memory name) external restricted() {
|
87
|
-
_createRole(roleId, name, true, true);
|
88
|
-
}
|
89
|
-
|
90
|
-
function updateRole(RoleId roleId, string memory name, StateId newState) external restricted() {
|
91
|
-
(bool isCustom,) = _validateRoleParameters(roleId, name, false);
|
92
|
-
IAccess.RoleInfo memory role = _toRole(roleId, name, isCustom);
|
93
|
-
update(toRoleKey32(roleId), abi.encode(role), newState);
|
94
|
-
}
|
95
|
-
|
96
|
-
function updateRoleState(RoleId roleId, StateId newState) external restricted() {
|
97
|
-
updateState(toRoleKey32(roleId), newState);
|
98
|
-
}
|
99
|
-
|
100
|
-
function grantRole(RoleId roleId, address member) external restricted() returns (bool granted) {
|
101
|
-
Key32 roleKey = toRoleKey32(roleId);
|
102
|
-
|
103
|
-
if (!exists(roleKey)) {
|
104
|
-
revert IAccess.ErrorGrantNonexstentRole(roleId);
|
105
|
-
}
|
106
|
-
|
107
|
-
if (getState(roleKey) != ACTIVE()) {
|
108
|
-
revert IAccess.ErrorRoleIdNotActive(roleId);
|
109
|
-
}
|
110
|
-
|
111
|
-
if (!EnumerableSet.contains(_roleMembers[roleId], member)) {
|
112
|
-
_accessManager.grantRole(roleId, member);
|
113
|
-
EnumerableSet.add(_roleMembers[roleId], member);
|
114
|
-
return true;
|
115
|
-
}
|
116
|
-
|
117
|
-
return false;
|
118
|
-
}
|
119
|
-
|
120
|
-
function revokeRole(RoleId roleId, address member) external restricted() returns (bool revoked) {
|
121
|
-
Key32 roleKey = toRoleKey32(roleId);
|
122
|
-
|
123
|
-
if (!exists(roleKey)) {
|
124
|
-
revert IAccess.ErrorRevokeNonexstentRole(roleId);
|
125
|
-
}
|
126
|
-
|
127
|
-
if (EnumerableSet.contains(_roleMembers[roleId], member)) {
|
128
|
-
_accessManager.revokeRole(roleId, member);
|
129
|
-
EnumerableSet.remove(_roleMembers[roleId], member);
|
130
|
-
return true;
|
131
|
-
}
|
132
|
-
|
133
|
-
return false;
|
134
|
-
}
|
135
|
-
|
136
|
-
/// @dev not restricted function by intention
|
137
|
-
/// the restriction to role members is already enforced by the call to the access manger
|
138
|
-
function renounceRole(RoleId roleId) external returns (bool revoked) {
|
139
|
-
address member = msg.sender;
|
140
|
-
Key32 roleKey = toRoleKey32(roleId);
|
141
|
-
|
142
|
-
if (!exists(roleKey)) {
|
143
|
-
revert IAccess.ErrorRenounceNonexstentRole(roleId);
|
59
|
+
modifier onlyChainNft() {
|
60
|
+
if(msg.sender != getRegistry().getChainNftAddress()) {
|
61
|
+
revert();
|
144
62
|
}
|
145
|
-
|
146
|
-
if (EnumerableSet.contains(_roleMembers[roleId], member)) {
|
147
|
-
_accessManager.revokeRole(roleId, member);
|
148
|
-
EnumerableSet.remove(_roleMembers[roleId], member);
|
149
|
-
return true;
|
150
|
-
}
|
151
|
-
|
152
|
-
return false;
|
153
|
-
}
|
154
|
-
|
155
|
-
function roles() external view returns (uint256 numberOfRoles) {
|
156
|
-
return _roles.length;
|
157
|
-
}
|
158
|
-
|
159
|
-
function getRoleId(uint256 idx) external view returns (RoleId roleId) {
|
160
|
-
return _roles[idx];
|
63
|
+
_;
|
161
64
|
}
|
162
65
|
|
163
|
-
function
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
}
|
170
|
-
|
171
|
-
function getRoleMember(RoleId roleId, uint256 idx) external view returns (address roleMember) {
|
172
|
-
return EnumerableSet.at(_roleMembers[roleId], idx);
|
173
|
-
}
|
174
|
-
|
175
|
-
function _createRole(RoleId roleId, string memory name, bool isCustom, bool validateParameters) internal {
|
176
|
-
if (validateParameters) {
|
177
|
-
_validateRoleParameters(roleId, name, isCustom);
|
66
|
+
function initialize(address authority, address registryAddress, address initialOwner)
|
67
|
+
public
|
68
|
+
initializer()
|
69
|
+
{
|
70
|
+
if(authority == address(0)) {
|
71
|
+
revert ErrorInstanceInstanceAccessManagerZero();
|
178
72
|
}
|
179
73
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
}
|
186
|
-
|
187
|
-
//--- Target ------------------------------------------------------//
|
188
|
-
function createTarget(address target, IAccess.TargetInfo memory targetInfo) external restricted() {
|
189
|
-
_validateTargetParameters(target, targetInfo);
|
190
|
-
create(toTargetKey32(target), abi.encode(targetInfo));
|
191
|
-
}
|
192
|
-
|
193
|
-
function setTargetClosed(address target, bool closed) external restricted() {
|
194
|
-
if (!exists(toTargetKey32(target))) {
|
195
|
-
revert IAccess.ErrorTargetDoesNotExist(target);
|
196
|
-
}
|
74
|
+
__AccessManaged_init(authority);
|
75
|
+
|
76
|
+
IRegistry registry = IRegistry(registryAddress);
|
77
|
+
initializeRegisterable(registryAddress, registry.getNftId(), INSTANCE(), true, initialOwner, "");
|
78
|
+
initializeLifecycle();
|
197
79
|
|
198
|
-
|
80
|
+
registerInterface(type(IInstance).interfaceId);
|
199
81
|
}
|
200
82
|
|
201
83
|
//--- ProductSetup ------------------------------------------------------//
|
@@ -225,68 +107,68 @@ contract Instance is
|
|
225
107
|
}
|
226
108
|
|
227
109
|
//--- PoolSetup ------------------------------------------------------//
|
228
|
-
function createPoolSetup(NftId poolNftId,
|
229
|
-
create(_toNftKey32(poolNftId, POOL()), abi.encode(
|
110
|
+
function createPoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info) external restricted() {
|
111
|
+
create(_toNftKey32(poolNftId, POOL()), abi.encode(info));
|
230
112
|
}
|
231
113
|
|
232
|
-
function updatePoolSetup(NftId poolNftId,
|
233
|
-
update(_toNftKey32(poolNftId, POOL()), abi.encode(
|
114
|
+
function updatePoolSetup(NftId poolNftId, IComponents.ComponentInfo memory info, StateId newState) external restricted() {
|
115
|
+
update(_toNftKey32(poolNftId, POOL()), abi.encode(info), newState);
|
234
116
|
}
|
235
117
|
|
236
118
|
function updatePoolSetupState(NftId poolNftId, StateId newState) external restricted() {
|
237
119
|
updateState(_toNftKey32(poolNftId, POOL()), newState);
|
238
120
|
}
|
239
121
|
|
240
|
-
//--- DistributorType
|
241
|
-
function createDistributorType(
|
242
|
-
create(
|
122
|
+
//--- DistributorType -------------------------------------------------------//
|
123
|
+
function createDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info) external restricted() {
|
124
|
+
create(distributorType.toKey32(), abi.encode(info));
|
243
125
|
}
|
244
126
|
|
245
|
-
function updateDistributorType(
|
246
|
-
update(
|
127
|
+
function updateDistributorType(DistributorType distributorType, IDistribution.DistributorTypeInfo memory info, StateId newState) external restricted() {
|
128
|
+
update(distributorType.toKey32(), abi.encode(info), newState);
|
247
129
|
}
|
248
130
|
|
249
|
-
function updateDistributorTypeState(
|
250
|
-
updateState(
|
131
|
+
function updateDistributorTypeState(DistributorType distributorType, StateId newState) external restricted() {
|
132
|
+
updateState(distributorType.toKey32(), newState);
|
251
133
|
}
|
252
134
|
|
253
135
|
//--- Distributor -------------------------------------------------------//
|
254
|
-
function createDistributor(NftId
|
255
|
-
create(
|
136
|
+
function createDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info) external restricted() {
|
137
|
+
create(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info));
|
256
138
|
}
|
257
139
|
|
258
|
-
function updateDistributor(NftId
|
259
|
-
update(
|
140
|
+
function updateDistributor(NftId distributorNftId, IDistribution.DistributorInfo memory info, StateId newState) external restricted() {
|
141
|
+
update(_toNftKey32(distributorNftId, DISTRIBUTOR()), abi.encode(info), newState);
|
260
142
|
}
|
261
143
|
|
262
|
-
function updateDistributorState(NftId
|
263
|
-
updateState(
|
144
|
+
function updateDistributorState(NftId distributorNftId, StateId newState) external restricted() {
|
145
|
+
updateState(_toNftKey32(distributorNftId, DISTRIBUTOR()), newState);
|
264
146
|
}
|
265
147
|
|
266
148
|
//--- Referral ----------------------------------------------------------//
|
267
|
-
function createReferral(
|
268
|
-
create(
|
149
|
+
function createReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo) external restricted() {
|
150
|
+
create(referralId.toKey32(), abi.encode(referralInfo));
|
269
151
|
}
|
270
152
|
|
271
|
-
function updateReferral(
|
272
|
-
update(
|
153
|
+
function updateReferral(ReferralId referralId, IDistribution.ReferralInfo memory referralInfo, StateId newState) external restricted() {
|
154
|
+
update(referralId.toKey32(), abi.encode(referralInfo), newState);
|
273
155
|
}
|
274
156
|
|
275
|
-
function updateReferralState(
|
276
|
-
updateState(
|
157
|
+
function updateReferralState(ReferralId referralId, StateId newState) external restricted() {
|
158
|
+
updateState(referralId.toKey32(), newState);
|
277
159
|
}
|
278
160
|
|
279
161
|
//--- Bundle ------------------------------------------------------------//
|
280
162
|
function createBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle) external restricted() {
|
281
|
-
create(
|
163
|
+
create(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle));
|
282
164
|
}
|
283
165
|
|
284
166
|
function updateBundle(NftId bundleNftId, IBundle.BundleInfo memory bundle, StateId newState) external restricted() {
|
285
|
-
update(
|
167
|
+
update(_toNftKey32(bundleNftId, BUNDLE()), abi.encode(bundle), newState);
|
286
168
|
}
|
287
169
|
|
288
170
|
function updateBundleState(NftId bundleNftId, StateId newState) external restricted() {
|
289
|
-
updateState(
|
171
|
+
updateState(_toNftKey32(bundleNftId, BUNDLE()), newState);
|
290
172
|
}
|
291
173
|
|
292
174
|
//--- Risk --------------------------------------------------------------//
|
@@ -302,167 +184,135 @@ contract Instance is
|
|
302
184
|
updateState(riskId.toKey32(), newState);
|
303
185
|
}
|
304
186
|
|
305
|
-
//--- Policy
|
306
|
-
function
|
307
|
-
create(
|
187
|
+
//--- Application (Policy) ----------------------------------------------//
|
188
|
+
function createApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy) external restricted() {
|
189
|
+
create(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy));
|
190
|
+
}
|
191
|
+
|
192
|
+
function updateApplication(NftId applicationNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
193
|
+
update(_toNftKey32(applicationNftId, POLICY()), abi.encode(policy), newState);
|
308
194
|
}
|
309
195
|
|
196
|
+
function updateApplicationState(NftId applicationNftId, StateId newState) external restricted() {
|
197
|
+
updateState(_toNftKey32(applicationNftId, POLICY()), newState);
|
198
|
+
}
|
199
|
+
|
200
|
+
//--- Policy ------------------------------------------------------------//
|
310
201
|
function updatePolicy(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
311
|
-
update(
|
202
|
+
update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
|
203
|
+
}
|
204
|
+
|
205
|
+
function updatePolicyClaims(NftId policyNftId, IPolicy.PolicyInfo memory policy, StateId newState) external restricted() {
|
206
|
+
update(_toNftKey32(policyNftId, POLICY()), abi.encode(policy), newState);
|
312
207
|
}
|
313
208
|
|
314
209
|
function updatePolicyState(NftId policyNftId, StateId newState) external restricted() {
|
315
|
-
updateState(
|
210
|
+
updateState(_toNftKey32(policyNftId, POLICY()), newState);
|
316
211
|
}
|
317
212
|
|
318
213
|
//--- Claim -------------------------------------------------------------//
|
319
|
-
function createClaim(NftId policyNftId,
|
320
|
-
create(
|
214
|
+
function createClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim) external restricted() {
|
215
|
+
create(_toClaimKey32(policyNftId, claimId), abi.encode(claim));
|
321
216
|
}
|
322
217
|
|
323
|
-
function updateClaim(NftId policyNftId,
|
324
|
-
update(
|
218
|
+
function updateClaim(NftId policyNftId, ClaimId claimId, IPolicy.ClaimInfo memory claim, StateId newState) external restricted() {
|
219
|
+
update(_toClaimKey32(policyNftId, claimId), abi.encode(claim), newState);
|
325
220
|
}
|
326
221
|
|
327
|
-
function updateClaimState(NftId policyNftId, StateId newState) external restricted() {
|
328
|
-
updateState(
|
222
|
+
function updateClaimState(NftId policyNftId, ClaimId claimId, StateId newState) external restricted() {
|
223
|
+
updateState(_toClaimKey32(policyNftId, claimId), newState);
|
329
224
|
}
|
330
225
|
|
331
226
|
//--- Payout ------------------------------------------------------------//
|
332
|
-
function createPayout(NftId policyNftId,
|
333
|
-
create(
|
227
|
+
function createPayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout) external restricted() {
|
228
|
+
create(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout));
|
334
229
|
}
|
335
230
|
|
336
|
-
function
|
337
|
-
update(
|
231
|
+
function updatePayout(NftId policyNftId, PayoutId payoutId, IPolicy.PayoutInfo memory payout, StateId newState) external restricted() {
|
232
|
+
update(_toPayoutKey32(policyNftId, payoutId), abi.encode(payout), newState);
|
338
233
|
}
|
339
234
|
|
340
|
-
function updatePayoutState(NftId policyNftId, StateId newState) external restricted() {
|
341
|
-
updateState(
|
235
|
+
function updatePayoutState(NftId policyNftId, PayoutId payoutId, StateId newState) external restricted() {
|
236
|
+
updateState(_toPayoutKey32(policyNftId, payoutId), newState);
|
342
237
|
}
|
343
238
|
|
344
|
-
//---
|
345
|
-
function
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
{
|
350
|
-
return IAccess.RoleInfo(
|
351
|
-
ShortStrings.toShortString(name),
|
352
|
-
isCustom);
|
353
|
-
}
|
354
|
-
|
355
|
-
function _validateRoleParameters(
|
356
|
-
RoleId roleId,
|
357
|
-
string memory name,
|
358
|
-
bool isCustom
|
359
|
-
)
|
360
|
-
internal
|
361
|
-
view
|
362
|
-
returns (
|
363
|
-
bool roleExists,
|
364
|
-
bool roleIsCustom
|
365
|
-
)
|
366
|
-
{
|
367
|
-
Key32 roleKey = toRoleKey32(roleId);
|
368
|
-
roleExists = exists(roleKey);
|
369
|
-
if (roleExists) {
|
370
|
-
roleIsCustom = abi.decode(getData(roleKey), (IAccess.RoleInfo)).isCustom;
|
371
|
-
} else {
|
372
|
-
roleIsCustom = isCustom;
|
373
|
-
}
|
239
|
+
//--- ITransferInterceptor ------------------------------------------------------------//
|
240
|
+
function nftMint(address to, uint256 tokenId) external onlyChainNft {
|
241
|
+
assert(_accessManager.roleMembers(INSTANCE_OWNER_ROLE()) == 0);// temp
|
242
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
243
|
+
}
|
374
244
|
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
}
|
245
|
+
function nftTransferFrom(address from, address to, uint256 tokenId) external onlyChainNft {
|
246
|
+
assert(_accessManager.revokeRole(INSTANCE_OWNER_ROLE(), from) == true);
|
247
|
+
assert(_accessManager.grantRole(INSTANCE_OWNER_ROLE(), to) == true);
|
248
|
+
}
|
380
249
|
|
381
|
-
|
382
|
-
revert IAccess.ErrorRoleIdTooSmall(roleId);
|
383
|
-
} else if (roleIsCustom && roleIdInt >= CUSTOM_ROLE_ID_MIN) {
|
384
|
-
revert IAccess.ErrorRoleIdTooBig(roleId);
|
385
|
-
}
|
250
|
+
//--- initial setup functions -------------------------------------------//
|
386
251
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
revert IAccess.ErrorRoleNameEmpty(roleId);
|
252
|
+
function setInstanceAccessManager(InstanceAccessManager accessManager) external restricted {
|
253
|
+
if(address(_accessManager) != address(0)) {
|
254
|
+
revert ErrorInstanceInstanceAccessManagerAlreadySet(address(_accessManager));
|
391
255
|
}
|
392
256
|
|
393
|
-
if
|
394
|
-
revert
|
257
|
+
if(accessManager.authority() != authority()) {
|
258
|
+
revert ErrorInstanceInstanceAccessManagerAuthorityMismatch(authority());
|
395
259
|
}
|
396
|
-
}
|
397
|
-
|
398
|
-
function _validateTargetParameters(address target, IAccess.TargetInfo memory targetInfo) internal view {
|
399
|
-
|
400
|
-
}
|
401
|
-
|
402
|
-
function toRoleKey32(RoleId roleId) public pure returns (Key32) {
|
403
|
-
return roleId.toKey32();
|
404
|
-
}
|
405
260
|
|
406
|
-
|
407
|
-
return Key32Lib.toKey32(TARGET(), KeyId.wrap(bytes20(target)));
|
261
|
+
_accessManager = accessManager;
|
408
262
|
}
|
409
263
|
|
410
|
-
function
|
411
|
-
|
412
|
-
|
264
|
+
function setBundleManager(BundleManager bundleManager) external restricted() {
|
265
|
+
if(address(_bundleManager) != address(0)) {
|
266
|
+
revert ErrorInstanceBundleManagerAlreadySet(address(_bundleManager));
|
267
|
+
}
|
413
268
|
|
414
|
-
|
415
|
-
|
416
|
-
|
269
|
+
if(bundleManager.getInstance() != Instance(this)) {
|
270
|
+
revert ErrorInstanceBundleManagerInstanceMismatch(address(this));
|
271
|
+
}
|
417
272
|
|
418
|
-
|
419
|
-
|
420
|
-
|
273
|
+
if(bundleManager.authority() != authority()) {
|
274
|
+
revert ErrorInstanceBundleManagerAuthorityMismatch(authority());
|
275
|
+
}
|
421
276
|
|
422
|
-
|
423
|
-
return ComponentOwnerService(_registry.getServiceAddress("ComponentOwnerService", VersionPart.wrap(3)));
|
277
|
+
_bundleManager = bundleManager;
|
424
278
|
}
|
425
279
|
|
426
|
-
function
|
427
|
-
|
428
|
-
|
280
|
+
function setInstanceReader(InstanceReader instanceReader) external restricted() {
|
281
|
+
if(instanceReader.getInstance() != Instance(this)) {
|
282
|
+
revert ErrorInstanceInstanceReaderInstanceMismatch(address(this));
|
283
|
+
}
|
429
284
|
|
430
|
-
|
431
|
-
return IProductService(_registry.getServiceAddress("ProductService", VersionPart.wrap(3)));
|
285
|
+
_instanceReader = instanceReader;
|
432
286
|
}
|
433
287
|
|
434
|
-
|
435
|
-
return IPoolService(_registry.getServiceAddress("PoolService", VersionPart.wrap(3)));
|
436
|
-
}
|
288
|
+
//--- external view functions -------------------------------------------//
|
437
289
|
|
438
|
-
function
|
439
|
-
return
|
290
|
+
function getInstanceReader() external view returns (InstanceReader) {
|
291
|
+
return _instanceReader;
|
440
292
|
}
|
441
293
|
|
442
|
-
function
|
443
|
-
return
|
294
|
+
function getBundleManager() external view returns (BundleManager) {
|
295
|
+
return _bundleManager;
|
444
296
|
}
|
445
297
|
|
446
298
|
function getInstanceAccessManager() external view returns (InstanceAccessManager) {
|
447
299
|
return _accessManager;
|
448
300
|
}
|
449
301
|
|
450
|
-
function
|
451
|
-
|
452
|
-
_instanceReader = instanceReader;
|
302
|
+
function getMajorVersion() external pure returns (VersionPart majorVersion) {
|
303
|
+
return VersionPartLib.toVersionPart(GIF_MAJOR_VERSION);
|
453
304
|
}
|
454
305
|
|
455
|
-
|
456
|
-
|
306
|
+
//--- internal view/pure functions --------------------------------------//
|
307
|
+
function _toNftKey32(NftId nftId, ObjectType objectType) private pure returns (Key32) {
|
308
|
+
return nftId.toKey32(objectType);
|
457
309
|
}
|
458
|
-
|
459
|
-
function
|
460
|
-
|
461
|
-
require(bundleManager.getInstanceNftId() == getNftId(), "NFT ID of BundleManager does not match");
|
462
|
-
_bundleManager = bundleManager;
|
310
|
+
|
311
|
+
function _toClaimKey32(NftId policyNftId, ClaimId claimId) private pure returns (Key32) {
|
312
|
+
return claimId.toKey32(policyNftId);
|
463
313
|
}
|
464
314
|
|
465
|
-
function
|
466
|
-
return
|
315
|
+
function _toPayoutKey32(NftId policyNftId, PayoutId payoutId) private pure returns (Key32) {
|
316
|
+
return payoutId.toKey32(policyNftId);
|
467
317
|
}
|
468
318
|
}
|