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