@etherisc/gif-next 0.0.2-96b5b72-170 → 0.0.2-97aac30-275
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 +2 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +193 -164
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +114 -321
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +120 -82
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +72 -108
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +22 -48
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +25 -6
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +56 -22
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +53 -18
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +708 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +132 -28
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +458 -331
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +133 -59
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +110 -32
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +1103 -308
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +4 -0
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +318 -0
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +4 -0
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +10 -0
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +8 -116
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +4 -0
- package/artifacts/contracts/mock/Dip.sol/Dip.json +376 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +4 -0
- package/artifacts/contracts/{instance/module/ISetup.sol/ISetup.json → oracle/IOracle.sol/IOracle.json} +2 -2
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +759 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +662 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +1146 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +997 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +718 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +69 -252
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +105 -55
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +8 -53
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +134 -86
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +121 -133
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +239 -92
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +170 -368
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +98 -72
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +69 -153
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +105 -31
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +95 -203
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +118 -56
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +7 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +7 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +81 -25
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +27 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +230 -107
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/product/IProductService.sol/IProductService.json +0 -55
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +164 -299
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +106 -92
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +139 -160
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +130 -40
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +334 -146
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +29 -214
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +88 -34
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +163 -61
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +256 -65
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +378 -67
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +407 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +272 -68
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +87 -35
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +799 -127
- package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.dbg.json +4 -0
- package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.json +137 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +314 -138
- package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.json +1193 -0
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +1715 -0
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +1728 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +1806 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +1824 -0
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +184 -11
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +908 -49
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +792 -0
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +526 -0
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +4 -0
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.json +1562 -0
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +4 -0
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.json +1600 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +172 -4
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +867 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +80 -22
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/IKeyValueStore.sol/IKeyValueStore.json +1 -11
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +4 -0
- package/artifacts/contracts/{instance/base → shared}/ILifecycle.sol/ILifecycle.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +7 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +21 -3
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +7 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +7 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +4 -0
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +39 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +176 -24
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +4 -0
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +571 -0
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +4 -0
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +194 -0
- package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +4 -0
- package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.json +306 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +13 -7
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +31 -13
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +64 -16
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +21 -7
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +7 -1
- 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/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1103 -172
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +497 -49
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +444 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +1247 -56
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +167 -30
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +592 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +605 -78
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +122 -28
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2189 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +571 -0
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +2 -2
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +68 -4
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +53 -2
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +34 -34
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +47 -4
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +15 -2
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +204 -0
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +76 -2
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +17 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.json +2 -2
- package/contracts/distribution/Distribution.sol +27 -51
- package/contracts/distribution/DistributionService.sol +55 -106
- package/contracts/distribution/DistributionServiceManager.sol +9 -18
- package/contracts/distribution/IDistributionComponent.sol +3 -8
- package/contracts/distribution/IDistributionService.sol +2 -8
- package/contracts/instance/IInstance.sol +12 -7
- package/contracts/instance/IInstanceService.sol +13 -5
- package/contracts/instance/Instance.sol +30 -23
- package/contracts/instance/InstanceAdmin.sol +331 -0
- package/contracts/instance/InstanceAuthorizationsLib.sol +210 -141
- package/contracts/instance/InstanceReader.sol +64 -42
- package/contracts/instance/InstanceService.sol +141 -87
- package/contracts/instance/InstanceServiceManager.sol +10 -20
- package/contracts/instance/InstanceStore.sol +125 -55
- package/contracts/instance/base/BalanceStore.sol +118 -0
- package/contracts/instance/base/ObjectCounter.sol +21 -0
- package/contracts/instance/module/IAccess.sol +2 -10
- package/contracts/instance/module/IBundle.sol +1 -4
- package/contracts/instance/module/IComponents.sol +15 -4
- package/contracts/instance/module/IPolicy.sol +8 -2
- package/contracts/mock/Dip.sol +26 -0
- package/contracts/oracle/IOracle.sol +20 -0
- package/contracts/oracle/IOracleComponent.sol +32 -0
- package/contracts/oracle/IOracleService.sol +65 -0
- package/contracts/oracle/Oracle.sol +145 -0
- package/contracts/oracle/OracleService.sol +277 -0
- package/contracts/oracle/OracleServiceManager.sol +42 -0
- package/contracts/pool/BundleService.sol +63 -149
- package/contracts/pool/BundleServiceManager.sol +9 -18
- package/contracts/pool/IBundleService.sol +4 -16
- package/contracts/pool/IPoolComponent.sol +2 -4
- package/contracts/pool/IPoolService.sol +45 -9
- package/contracts/pool/Pool.sol +37 -40
- package/contracts/pool/PoolService.sol +195 -145
- package/contracts/pool/PoolServiceManager.sol +9 -18
- package/contracts/product/ApplicationService.sol +111 -43
- package/contracts/product/ApplicationServiceManager.sol +9 -6
- package/contracts/product/ClaimService.sol +21 -21
- package/contracts/product/ClaimServiceManager.sol +9 -6
- package/contracts/product/IApplicationService.sol +1 -1
- package/contracts/product/IClaimService.sol +7 -1
- package/contracts/product/IPolicyService.sol +6 -8
- package/contracts/product/IPricingService.sol +3 -1
- package/contracts/product/IProductComponent.sol +5 -4
- package/contracts/product/IProductService.sol +1 -8
- package/contracts/product/PolicyService.sol +226 -127
- package/contracts/product/PolicyServiceManager.sol +9 -21
- package/contracts/product/PricingService.sol +74 -48
- package/contracts/product/PricingServiceManager.sol +9 -18
- package/contracts/product/Product.sol +45 -47
- package/contracts/product/ProductService.sol +26 -112
- package/contracts/product/ProductServiceManager.sol +9 -21
- package/contracts/registry/ChainNft.sol +1 -0
- package/contracts/registry/IRegistry.sol +38 -24
- package/contracts/registry/IRegistryService.sol +31 -31
- package/contracts/registry/Registry.sol +176 -105
- package/contracts/registry/RegistryAdmin.sol +237 -0
- package/contracts/registry/RegistryService.sol +44 -82
- package/contracts/registry/RegistryServiceManager.sol +21 -23
- package/contracts/registry/ReleaseManager.sol +450 -210
- package/contracts/registry/ServiceAuthorizationsLib.sol +173 -0
- package/contracts/registry/TokenRegistry.sol +261 -62
- package/contracts/shared/AccessManagerCustom.sol +736 -0
- package/contracts/shared/AccessManagerExtended.sol +470 -0
- package/contracts/shared/AccessManagerExtendedInitializeable.sol +13 -0
- package/contracts/shared/AccessManagerExtendedWithDisable.sol +137 -0
- package/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol +14 -0
- package/contracts/shared/Component.sol +153 -49
- package/contracts/shared/ComponentService.sol +561 -93
- package/contracts/shared/ComponentServiceManager.sol +35 -0
- package/contracts/shared/ComponentVerifyingService.sol +117 -0
- package/contracts/shared/ERC165.sol +1 -1
- package/contracts/shared/IAccessManagerExtended.sol +74 -0
- package/contracts/shared/IAccessManagerExtendedWithDisable.sol +18 -0
- package/contracts/shared/IComponent.sol +20 -8
- package/contracts/shared/IComponentService.sol +102 -0
- package/contracts/shared/IInstanceLinkedComponent.sol +5 -11
- package/contracts/{instance/base → shared}/IKeyValueStore.sol +6 -6
- package/contracts/{instance/base → shared}/ILifecycle.sol +3 -3
- package/contracts/shared/INftOwnable.sol +1 -1
- package/contracts/shared/IPolicyHolder.sol +6 -1
- package/contracts/shared/IService.sol +1 -1
- package/contracts/shared/InitializableCustom.sol +177 -0
- package/contracts/shared/InstanceLinkedComponent.sol +51 -178
- package/contracts/{instance/base → shared}/KeyValueStore.sol +30 -72
- package/contracts/{instance/base → shared}/Lifecycle.sol +12 -3
- package/contracts/shared/NftIdSetManager.sol +65 -0
- package/contracts/shared/NftOwnable.sol +2 -13
- package/contracts/shared/PolicyHolder.sol +21 -13
- package/contracts/shared/ProxyManager.sol +31 -1
- package/contracts/shared/Registerable.sol +2 -2
- package/contracts/shared/Service.sol +7 -2
- package/contracts/staking/IStaking.sol +146 -8
- package/contracts/staking/IStakingService.sol +83 -39
- package/contracts/staking/StakeManagerLib.sol +179 -0
- package/contracts/staking/Staking.sol +503 -17
- package/contracts/staking/StakingManager.sol +22 -14
- package/contracts/staking/StakingReader.sol +187 -0
- package/contracts/staking/StakingService.sol +246 -44
- package/contracts/staking/StakingServiceManager.sol +8 -4
- package/contracts/staking/StakingStore.sol +572 -0
- package/contracts/staking/TargetManagerLib.sol +207 -0
- package/contracts/type/AddressSet.sol +1 -1
- package/contracts/type/Amount.sol +20 -1
- package/contracts/type/Blocknumber.sol +20 -3
- package/contracts/type/Fee.sol +17 -16
- package/contracts/type/NftId.sol +14 -16
- package/contracts/type/NftIdSet.sol +1 -1
- package/contracts/type/ObjectType.sol +12 -10
- package/contracts/type/Referral.sol +1 -1
- package/contracts/type/RequestId.sol +75 -0
- package/contracts/type/RiskId.sol +1 -1
- package/contracts/type/RoleId.sol +18 -4
- package/contracts/type/Seconds.sol +27 -0
- package/contracts/type/StateId.sol +27 -2
- package/contracts/type/Timestamp.sol +6 -2
- package/contracts/type/Version.sol +1 -1
- package/package.json +4 -3
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +0 -1348
- package/artifacts/contracts/instance/base/IKeyValueStore.sol/IKeyValueStore.dbg.json +0 -4
- package/artifacts/contracts/instance/base/ILifecycle.sol/ILifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.dbg.json +0 -4
- package/artifacts/contracts/instance/base/KeyValueStore.sol/KeyValueStore.json +0 -581
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.dbg.json +0 -4
- package/artifacts/contracts/instance/base/Lifecycle.sol/Lifecycle.json +0 -194
- package/artifacts/contracts/instance/module/ISetup.sol/ISetup.dbg.json +0 -4
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.dbg.json +0 -4
- package/artifacts/contracts/instance/module/ITreasury.sol/ITreasury.json +0 -10
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +0 -4
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +0 -285
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
- package/contracts/instance/InstanceAccessManager.sol +0 -543
- package/contracts/instance/module/ISetup.sol +0 -33
- package/contracts/instance/module/ITreasury.sol +0 -23
- package/contracts/registry/RegistryAccessManager.sol +0 -207
- package/contracts/shared/AccessManagerUpgradeableInitializeable.sol +0 -13
@@ -0,0 +1,177 @@
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
2
|
+
|
3
|
+
pragma solidity ^0.8.20;
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @dev This is copy of OpenZeppelin's Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
|
7
|
+
* Changes:
|
8
|
+
* 1. name is InitializableCustom
|
9
|
+
* 2. no longer abstract
|
10
|
+
* 3. have $._initializeOwner
|
11
|
+
* 4. have constructor where sets _initializeOwner
|
12
|
+
* 5. initializer() in addition checks for _initializeOwner
|
13
|
+
* 6. reinitializer() is deleted
|
14
|
+
*/
|
15
|
+
abstract contract InitializableCustom {
|
16
|
+
/**
|
17
|
+
* @dev Storage of the initializable contract.
|
18
|
+
*
|
19
|
+
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
|
20
|
+
* when using with upgradeable contracts.
|
21
|
+
*
|
22
|
+
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
|
23
|
+
*/
|
24
|
+
struct InitializableCustomStorage {
|
25
|
+
/**
|
26
|
+
* @dev Indicates that the contract has been initialized.
|
27
|
+
*/
|
28
|
+
uint64 _initialized;
|
29
|
+
/**
|
30
|
+
* @dev Indicates that the contract is in the process of being initialized.
|
31
|
+
*/
|
32
|
+
bool _initializing;
|
33
|
+
/**
|
34
|
+
* @dev Indicates address that can call function with initializer() modifier.
|
35
|
+
*/
|
36
|
+
address _initializeOwner;
|
37
|
+
}
|
38
|
+
|
39
|
+
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.InitializableCustom")) - 1)) & ~bytes32(uint256(0xff))
|
40
|
+
bytes32 private constant INITIALIZABLE_CUSTOM_STORAGE = 0x46cd1d813423aaf613c34c7f348d15b2b5e71215e9145b09467e257ea2805a00;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* @dev The contract is already initialized.
|
44
|
+
*/
|
45
|
+
error InvalidInitialization();
|
46
|
+
|
47
|
+
/**
|
48
|
+
* @dev The contract initialization function caller is not authorized.
|
49
|
+
*/
|
50
|
+
error InvalidInitializationCaller();
|
51
|
+
|
52
|
+
/**
|
53
|
+
* @dev The contract is not initializing.
|
54
|
+
*/
|
55
|
+
error NotInitializing();
|
56
|
+
|
57
|
+
/**
|
58
|
+
* @dev Triggered when the contract has been initialized or reinitialized.
|
59
|
+
*/
|
60
|
+
event Initialized(uint64 version);
|
61
|
+
|
62
|
+
/**
|
63
|
+
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
|
64
|
+
* `onlyInitializing` functions can be used to initialize parent contracts.
|
65
|
+
*
|
66
|
+
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
|
67
|
+
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
|
68
|
+
* production.
|
69
|
+
*
|
70
|
+
* Emits an {Initialized} event.
|
71
|
+
*/
|
72
|
+
modifier initializer() virtual {
|
73
|
+
// solhint-disable-next-line var-name-mixedcase
|
74
|
+
InitializableCustomStorage storage $ = _getInitializableCustomStorage();
|
75
|
+
|
76
|
+
if($._initializeOwner != msg.sender) {
|
77
|
+
revert InvalidInitializationCaller();
|
78
|
+
}
|
79
|
+
|
80
|
+
// Cache values to avoid duplicated sloads
|
81
|
+
bool isTopLevelCall = !$._initializing;
|
82
|
+
uint64 initialized = $._initialized;
|
83
|
+
|
84
|
+
// Allowed calls:
|
85
|
+
// - initialSetup: the contract is not in the initializing state and no previous version was
|
86
|
+
// initialized
|
87
|
+
// - construction: the contract is initialized at version 1 (no reininitialization) and the
|
88
|
+
// current contract is just being deployed
|
89
|
+
bool initialSetup = initialized == 0 && isTopLevelCall;
|
90
|
+
bool construction = initialized == 1 && address(this).code.length == 0;
|
91
|
+
|
92
|
+
if (!initialSetup && !construction) {
|
93
|
+
revert InvalidInitialization();
|
94
|
+
}
|
95
|
+
$._initialized = 1;
|
96
|
+
if (isTopLevelCall) {
|
97
|
+
$._initializing = true;
|
98
|
+
}
|
99
|
+
_;
|
100
|
+
if (isTopLevelCall) {
|
101
|
+
$._initializing = false;
|
102
|
+
emit Initialized(1);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
/**
|
107
|
+
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
|
108
|
+
* {initializer} and {reinitializer} modifiers, directly or indirectly.
|
109
|
+
*/
|
110
|
+
modifier onlyInitializing() {
|
111
|
+
_checkInitializing();
|
112
|
+
_;
|
113
|
+
}
|
114
|
+
|
115
|
+
/**
|
116
|
+
* @dev Constructor sets the caller of protected initializer function.
|
117
|
+
*/
|
118
|
+
constructor() {
|
119
|
+
// solhint-disable-previous-line var-name-mixedcase
|
120
|
+
InitializableCustomStorage storage $ = _getInitializableCustomStorage();
|
121
|
+
$._initializeOwner = msg.sender;
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
|
126
|
+
*/
|
127
|
+
function _checkInitializing() internal view virtual {
|
128
|
+
if (!_isInitializing()) {
|
129
|
+
revert NotInitializing();
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
/**
|
134
|
+
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
|
135
|
+
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
|
136
|
+
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
|
137
|
+
* through proxies.
|
138
|
+
*
|
139
|
+
* Emits an {Initialized} event the first time it is successfully executed.
|
140
|
+
*/
|
141
|
+
function _disableInitializers() internal virtual {
|
142
|
+
// solhint-disable-next-line var-name-mixedcase
|
143
|
+
InitializableCustomStorage storage $ = _getInitializableCustomStorage();
|
144
|
+
|
145
|
+
if ($._initializing) {
|
146
|
+
revert InvalidInitialization();
|
147
|
+
}
|
148
|
+
if ($._initialized != type(uint64).max) {
|
149
|
+
$._initialized = type(uint64).max;
|
150
|
+
emit Initialized(type(uint64).max);
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
/**
|
155
|
+
* @dev Returns the highest version that has been initialized. See {reinitializer}.
|
156
|
+
*/
|
157
|
+
function _getInitializedVersion() internal view returns (uint64) {
|
158
|
+
return _getInitializableCustomStorage()._initialized;
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
|
163
|
+
*/
|
164
|
+
function _isInitializing() internal view returns (bool) {
|
165
|
+
return _getInitializableCustomStorage()._initializing;
|
166
|
+
}
|
167
|
+
|
168
|
+
/**
|
169
|
+
* @dev Returns a pointer to the storage namespace.
|
170
|
+
*/
|
171
|
+
// solhint-disable-next-line var-name-mixedcase
|
172
|
+
function _getInitializableCustomStorage() private pure returns (InitializableCustomStorage storage $) {
|
173
|
+
assembly {
|
174
|
+
$.slot := INITIALIZABLE_CUSTOM_STORAGE
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
@@ -6,57 +6,44 @@ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessMana
|
|
6
6
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
7
7
|
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
8
8
|
|
9
|
+
import {Component} from "./Component.sol";
|
10
|
+
import {IComponentService} from "./IComponentService.sol";
|
9
11
|
import {IInstanceLinkedComponent} from "./IInstanceLinkedComponent.sol";
|
10
12
|
import {IComponents} from "../instance/module/IComponents.sol";
|
11
13
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
12
14
|
import {IInstance} from "../instance/IInstance.sol";
|
13
|
-
import {
|
15
|
+
import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
|
14
16
|
import {InstanceReader} from "../instance/InstanceReader.sol";
|
15
17
|
import {IRegistry} from "../registry/IRegistry.sol";
|
16
18
|
import {NftId} from "../type/NftId.sol";
|
17
|
-
import {ObjectType,
|
19
|
+
import {ObjectType, COMPONENT, INSTANCE} from "../type/ObjectType.sol";
|
18
20
|
import {VersionPart} from "../type/Version.sol";
|
19
|
-
import {Registerable} from "../shared/Registerable.sol";
|
20
21
|
import {RoleId, RoleIdLib} from "../type/RoleId.sol";
|
21
22
|
import {IAccess} from "../instance/module/IAccess.sol";
|
22
23
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
23
24
|
import {VersionPart} from "../type/Version.sol";
|
24
25
|
|
25
|
-
// TODO discuss to inherit from oz accessmanaged
|
26
26
|
// then add (Distribution|Pool|Product)Upradeable that also intherit from Versionable
|
27
27
|
// same pattern as for Service which is also upgradeable
|
28
28
|
abstract contract InstanceLinkedComponent is
|
29
|
-
|
30
|
-
AccessManagedUpgradeable,
|
29
|
+
Component,
|
31
30
|
IInstanceLinkedComponent
|
32
31
|
{
|
33
32
|
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Component.sol")) - 1)) & ~bytes32(uint256(0xff));
|
34
|
-
bytes32 public constant
|
33
|
+
bytes32 public constant INSTANCE_LINKED_COMPONENT_LOCATION_V1 = 0xffe3d4462bded26a47154f4b8f6db494d2f772496965791d25bd456e342b7f00;
|
35
34
|
|
36
|
-
struct
|
37
|
-
string _name; // unique (per instance) component name
|
38
|
-
IERC20Metadata _token; // token for this component
|
35
|
+
struct InstanceLinkedComponentStorage {
|
39
36
|
IInstance _instance; // instance for this component
|
40
|
-
address _wallet; // wallet for this component (default = component contract itself)
|
41
37
|
InstanceReader _instanceReader; // instance reader for this component
|
42
|
-
bool _isNftInterceptor; // declares if component is involved in nft transfers
|
43
|
-
NftId _productNftId; // only relevant for components that are linked to a aproduct
|
44
38
|
}
|
45
39
|
|
46
|
-
function
|
40
|
+
function _getInstanceLinkedComponentStorage() private pure returns (InstanceLinkedComponentStorage storage $) {
|
47
41
|
assembly {
|
48
|
-
$.slot :=
|
42
|
+
$.slot := INSTANCE_LINKED_COMPONENT_LOCATION_V1
|
49
43
|
}
|
50
44
|
}
|
51
45
|
|
52
|
-
|
53
|
-
if(msg.sender != getRegistry().getChainNftAddress()) {
|
54
|
-
revert ErrorComponentNotChainNft(msg.sender);
|
55
|
-
}
|
56
|
-
_;
|
57
|
-
}
|
58
|
-
|
59
|
-
function initializeComponent(
|
46
|
+
function initializeInstanceLinkedComponent(
|
60
47
|
address registry,
|
61
48
|
NftId instanceNftId,
|
62
49
|
string memory name,
|
@@ -64,37 +51,48 @@ abstract contract InstanceLinkedComponent is
|
|
64
51
|
ObjectType componentType,
|
65
52
|
bool isInterceptor,
|
66
53
|
address initialOwner,
|
67
|
-
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
54
|
+
bytes memory registryData, // writeonly data that will saved in the object info record of the registry
|
55
|
+
bytes memory componentData // data that will saved with the component info in the instance store
|
68
56
|
)
|
69
57
|
public
|
70
58
|
virtual
|
71
59
|
onlyInitializing()
|
72
60
|
{
|
73
|
-
initializeRegisterable(registry, instanceNftId, componentType, isInterceptor, initialOwner, registryData);
|
74
|
-
|
75
61
|
// set and check linked instance
|
76
|
-
|
62
|
+
InstanceLinkedComponentStorage storage $ = _getInstanceLinkedComponentStorage();
|
77
63
|
$._instance = IInstance(
|
78
|
-
|
64
|
+
IRegistry(registry).getObjectInfo(
|
65
|
+
instanceNftId).objectAddress);
|
79
66
|
|
80
67
|
if(!$._instance.supportsInterface(type(IInstance).interfaceId)) {
|
81
68
|
revert ErrorComponentNotInstance(instanceNftId);
|
82
69
|
}
|
83
70
|
|
84
|
-
|
85
|
-
|
71
|
+
initializeComponent(
|
72
|
+
$._instance.authority(),
|
73
|
+
registry,
|
74
|
+
instanceNftId,
|
75
|
+
name,
|
76
|
+
token,
|
77
|
+
componentType,
|
78
|
+
isInterceptor,
|
79
|
+
initialOwner,
|
80
|
+
registryData,
|
81
|
+
componentData);
|
86
82
|
|
87
83
|
// set component state
|
88
|
-
$._name = name;
|
89
|
-
$._isNftInterceptor = isInterceptor;
|
90
84
|
$._instanceReader = $._instance.getInstanceReader();
|
91
|
-
$._wallet = address(this);
|
92
|
-
$._token = IERC20Metadata(token);
|
93
85
|
|
94
86
|
registerInterface(type(IAccessManaged).interfaceId);
|
95
87
|
registerInterface(type(IInstanceLinkedComponent).interfaceId);
|
96
88
|
}
|
97
89
|
|
90
|
+
/// @dev for instance linked components the wallet address stored in the instance store.
|
91
|
+
/// updating needs to go throug component service
|
92
|
+
function _setWallet(address newWallet) internal virtual override onlyOwner {
|
93
|
+
IComponentService(_getServiceAddress(COMPONENT())).setWallet(newWallet);
|
94
|
+
}
|
95
|
+
|
98
96
|
function lock() external onlyOwner {
|
99
97
|
IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(true);
|
100
98
|
}
|
@@ -103,169 +101,44 @@ abstract contract InstanceLinkedComponent is
|
|
103
101
|
IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(false);
|
104
102
|
}
|
105
103
|
|
106
|
-
function
|
107
|
-
|
108
|
-
|
109
|
-
if(info.wallet != address(this)) {
|
110
|
-
revert ErrorComponentWalletNotComponent();
|
111
|
-
}
|
112
|
-
|
113
|
-
info.token.approve(
|
114
|
-
address(info.tokenHandler),
|
115
|
-
spendingLimitAmount);
|
116
|
-
|
117
|
-
emit LogComponentTokenHandlerApproved(address(info.token), spendingLimitAmount);
|
104
|
+
function getInstance() public view override returns (IInstance instance) {
|
105
|
+
return _getInstanceLinkedComponentStorage()._instance;
|
118
106
|
}
|
119
107
|
|
120
|
-
function
|
121
|
-
|
122
|
-
|
123
|
-
onlyOwner
|
124
|
-
{
|
125
|
-
ComponentStorage storage $ = _getComponentStorage();
|
126
|
-
|
127
|
-
address currentWallet = $._wallet;
|
128
|
-
uint256 currentBalance = $._token.balanceOf(currentWallet);
|
129
|
-
|
130
|
-
// checks
|
131
|
-
if (newWallet == address(0)) {
|
132
|
-
revert ErrorComponentWalletAddressZero();
|
133
|
-
}
|
108
|
+
function getProductNftId() public view override returns (NftId productNftId) {
|
109
|
+
return getComponentInfo().productNftId;
|
110
|
+
}
|
134
111
|
|
135
|
-
if (newWallet == currentWallet) {
|
136
|
-
revert ErrorComponentWalletAddressIsSameAsCurrent();
|
137
|
-
}
|
138
112
|
|
139
|
-
|
140
|
-
|
141
|
-
// move tokens from component smart contract to external wallet
|
142
|
-
} else {
|
143
|
-
// move tokens from external wallet to component smart contract or another external wallet
|
144
|
-
uint256 allowance = $._token.allowance(currentWallet, address(this));
|
145
|
-
if (allowance < currentBalance) {
|
146
|
-
revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
|
147
|
-
}
|
148
|
-
}
|
149
|
-
}
|
113
|
+
function _getComponentInfo() internal virtual override view returns (IComponents.ComponentInfo memory info) {
|
114
|
+
NftId componentNftId = getRegistry().getNftId(address(this));
|
150
115
|
|
151
|
-
//
|
152
|
-
|
153
|
-
|
116
|
+
// if registered, attempt to return component info via instance reader
|
117
|
+
if (componentNftId.gtz()) {
|
118
|
+
// component registerd with registry
|
119
|
+
info = _getInstanceReader().getComponentInfo(getNftId());
|
154
120
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
if (currentWallet == address(this)) {
|
159
|
-
// transferFrom requires self allowance too
|
160
|
-
$._token.approve(address(this), currentBalance);
|
121
|
+
// check if also registered with instance
|
122
|
+
if (info.wallet != address(0)) {
|
123
|
+
return info;
|
161
124
|
}
|
162
|
-
|
163
|
-
SafeERC20.safeTransferFrom($._token, currentWallet, newWallet, currentBalance);
|
164
|
-
emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
|
165
125
|
}
|
166
|
-
}
|
167
|
-
|
168
|
-
function setProductNftId(NftId productNftId)
|
169
|
-
external
|
170
|
-
override
|
171
|
-
{
|
172
|
-
ComponentStorage storage $ = _getComponentStorage();
|
173
126
|
|
174
|
-
//
|
175
|
-
|
176
|
-
revert ErrorComponentNotProductService(msg.sender);
|
177
|
-
}
|
178
|
-
|
179
|
-
// verify component is not yet linked to a product
|
180
|
-
if($._productNftId.gtz()) {
|
181
|
-
revert ErrorComponentProductNftAlreadySet();
|
182
|
-
}
|
183
|
-
|
184
|
-
$._productNftId = productNftId;
|
127
|
+
// return data from component contract if not yet registered
|
128
|
+
return super._getComponentInfo();
|
185
129
|
}
|
186
130
|
|
187
|
-
function nftMint(address to, uint256 tokenId)
|
188
|
-
external
|
189
|
-
virtual
|
190
|
-
onlyChainNft
|
191
|
-
{}
|
192
|
-
|
193
|
-
/// @dev callback function for nft transfers
|
194
|
-
/// may only be called by chain nft contract.
|
195
|
-
/// do not override this function to implement business logic for handling transfers
|
196
|
-
/// override internal function _nftTransferFrom instead
|
197
|
-
function nftTransferFrom(address from, address to, uint256 tokenId)
|
198
|
-
external
|
199
|
-
virtual
|
200
|
-
onlyChainNft
|
201
|
-
{
|
202
|
-
_nftTransferFrom(from, to, tokenId);
|
203
|
-
}
|
204
|
-
|
205
|
-
function getWallet() public view override returns (address walletAddress)
|
206
|
-
{
|
207
|
-
return _getComponentStorage()._wallet;
|
208
|
-
}
|
209
|
-
|
210
|
-
function getToken() public view override returns (IERC20Metadata token) {
|
211
|
-
return _getComponentStorage()._token;
|
212
|
-
}
|
213
|
-
|
214
|
-
function getTokenHandler() public view returns (TokenHandler tokenHandler) {
|
215
|
-
return getComponentInfo().tokenHandler;
|
216
|
-
}
|
217
|
-
|
218
|
-
function isNftInterceptor() public view override returns(bool isInterceptor) {
|
219
|
-
return _getComponentStorage()._isNftInterceptor;
|
220
|
-
}
|
221
|
-
|
222
|
-
function getInstance() public view override returns (IInstance instance) {
|
223
|
-
return _getComponentStorage()._instance;
|
224
|
-
}
|
225
|
-
|
226
|
-
function getName() public view override returns(string memory name) {
|
227
|
-
return _getComponentStorage()._name;
|
228
|
-
}
|
229
|
-
|
230
|
-
function getProductNftId() public view override returns (NftId productNftId) {
|
231
|
-
return _getComponentStorage()._productNftId;
|
232
|
-
}
|
233
|
-
|
234
|
-
function getComponentInfo() public view returns (IComponents.ComponentInfo memory info) {
|
235
|
-
info = _getInstanceReader().getComponentInfo(getNftId());
|
236
|
-
|
237
|
-
// fallback to initial info (wallet is always != address(0))
|
238
|
-
if(info.wallet == address(0)) {
|
239
|
-
info = _getInitialInfo();
|
240
|
-
}
|
241
|
-
}
|
242
|
-
|
243
|
-
/// @dev defines initial component specification
|
244
|
-
/// overwrite this function according to your use case
|
245
|
-
function _getInitialInfo()
|
246
|
-
internal
|
247
|
-
view
|
248
|
-
virtual
|
249
|
-
returns (IComponents.ComponentInfo memory info)
|
250
|
-
{ }
|
251
|
-
|
252
|
-
|
253
|
-
/// @dev internal function for nft transfers.
|
254
|
-
/// handling logic that deals with nft transfers need to overwrite this function
|
255
|
-
function _nftTransferFrom(address from, address to, uint256 tokenId)
|
256
|
-
internal
|
257
|
-
virtual
|
258
|
-
{ }
|
259
131
|
|
260
132
|
/// @dev returns reader for linked instance
|
261
133
|
function _getInstanceReader() internal view returns (InstanceReader reader) {
|
262
|
-
return
|
134
|
+
return _getInstanceLinkedComponentStorage()._instanceReader;
|
263
135
|
}
|
264
136
|
|
137
|
+
|
265
138
|
/// @dev returns the service address for the specified domain
|
266
139
|
/// gets address via lookup from registry using the major version form the linked instance
|
267
140
|
function _getServiceAddress(ObjectType domain) internal view returns (address service) {
|
268
|
-
VersionPart majorVersion =
|
141
|
+
VersionPart majorVersion = _getInstanceLinkedComponentStorage()._instance.getMajorVersion();
|
269
142
|
return getRegistry().getServiceAddress(domain, majorVersion);
|
270
143
|
}
|
271
144
|
}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {Blocknumber, blockBlocknumber, zeroBlocknumber} from "
|
5
|
-
import {Key32, KeyId, Key32Lib} from "
|
6
|
-
import {NftId} from "
|
7
|
-
import {ObjectType} from "
|
8
|
-
import {StateId, ACTIVE, KEEP_STATE} from "
|
9
|
-
import {Timestamp, TimestampLib} from "
|
4
|
+
import {Blocknumber, blockBlocknumber, zeroBlocknumber} from "../type/Blocknumber.sol";
|
5
|
+
import {Key32, KeyId, Key32Lib} from "../type/Key32.sol";
|
6
|
+
import {NftId} from "../type/NftId.sol";
|
7
|
+
import {ObjectType} from "../type/ObjectType.sol";
|
8
|
+
import {StateId, ACTIVE, KEEP_STATE} from "../type/StateId.sol";
|
9
|
+
import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
|
10
10
|
|
11
11
|
import {Lifecycle} from "./Lifecycle.sol";
|
12
12
|
import {IKeyValueStore} from "./IKeyValueStore.sol";
|
@@ -18,7 +18,7 @@ contract KeyValueStore is
|
|
18
18
|
|
19
19
|
mapping(Key32 key32 => Value value) private _value;
|
20
20
|
|
21
|
-
function
|
21
|
+
function _create(
|
22
22
|
Key32 key32,
|
23
23
|
bytes memory data
|
24
24
|
)
|
@@ -34,14 +34,12 @@ contract KeyValueStore is
|
|
34
34
|
revert ErrorKeyValueStoreAlreadyCreated(key32, objectType);
|
35
35
|
}
|
36
36
|
|
37
|
-
address createdBy = msg.sender;
|
38
37
|
Blocknumber blocknumber = blockBlocknumber();
|
39
38
|
StateId initialState = hasLifecycle(objectType) ? getInitialState(objectType) : ACTIVE();
|
40
39
|
|
41
40
|
// set metadata
|
42
41
|
metadata.objectType = objectType;
|
43
42
|
metadata.state = initialState;
|
44
|
-
metadata.updatedBy = createdBy;
|
45
43
|
metadata.updatedIn = blocknumber;
|
46
44
|
metadata.createdIn = blocknumber;
|
47
45
|
|
@@ -49,74 +47,34 @@ contract KeyValueStore is
|
|
49
47
|
_value[key32].data = data;
|
50
48
|
|
51
49
|
// solhint-disable-next-line avoid-tx-origin
|
52
|
-
emit LogInfoCreated(key32.toObjectType(), key32.toKeyId(), initialState,
|
50
|
+
emit LogInfoCreated(key32.toObjectType(), key32.toKeyId(), initialState, msg.sender, tx.origin);
|
53
51
|
}
|
54
52
|
|
55
|
-
|
53
|
+
|
54
|
+
function _update(
|
56
55
|
Key32 key32,
|
57
56
|
bytes memory data,
|
58
57
|
StateId state
|
59
58
|
)
|
60
59
|
internal
|
61
60
|
{
|
62
|
-
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
Metadata storage metadata = _value[key32].metadata;
|
67
|
-
StateId stateOld = metadata.state;
|
68
|
-
if (stateOld.eqz()) {
|
69
|
-
revert ErrorKeyValueStoreNotExisting(key32);
|
70
|
-
}
|
71
|
-
|
72
|
-
// update data
|
73
|
-
_value[key32].data = data;
|
74
|
-
|
75
|
-
// update state
|
76
|
-
if(state != KEEP_STATE()) {
|
77
|
-
checkTransition(metadata.objectType, stateOld, state);
|
78
|
-
metadata.state = state;
|
79
|
-
}
|
80
|
-
|
81
|
-
// update reest of metadata
|
82
|
-
address updatedBy = msg.sender;
|
83
|
-
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
84
|
-
|
85
|
-
metadata.updatedBy = updatedBy;
|
86
|
-
metadata.updatedIn = blockBlocknumber();
|
87
|
-
|
88
|
-
// create log entries
|
89
|
-
// solhint-disable avoid-tx-origin
|
90
|
-
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(), stateOld, state, updatedBy, tx.origin, lastUpdatedIn);
|
91
|
-
emit LogInfoUpdated(key32.toObjectType(), key32.toKeyId(), state, updatedBy, tx.origin, lastUpdatedIn);
|
92
|
-
// solhing-enable
|
93
|
-
}
|
94
|
-
|
95
|
-
function updateData(Key32 key32, bytes memory data)
|
96
|
-
internal
|
97
|
-
{
|
98
|
-
Metadata storage metadata = _value[key32].metadata;
|
99
|
-
StateId state = metadata.state;
|
100
|
-
if (state.eqz()) {
|
101
|
-
revert ErrorKeyValueStoreNotExisting(key32);
|
102
|
-
}
|
61
|
+
// update state
|
62
|
+
Blocknumber lastUpdatedIn = _updateState(key32, state);
|
103
63
|
|
104
64
|
// update data
|
105
65
|
_value[key32].data = data;
|
106
66
|
|
107
|
-
// update metadata
|
108
|
-
address updatedBy = msg.sender;
|
109
|
-
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
110
|
-
metadata.updatedBy = updatedBy;
|
111
|
-
metadata.updatedIn = blockBlocknumber();
|
112
|
-
|
113
|
-
// create log entry
|
114
67
|
// solhint-disable-next-line avoid-tx-origin
|
115
|
-
emit LogInfoUpdated(key32.toObjectType(), key32.toKeyId(), state,
|
68
|
+
emit LogInfoUpdated(key32.toObjectType(), key32.toKeyId(), state, msg.sender, tx.origin, lastUpdatedIn);
|
116
69
|
}
|
117
70
|
|
118
|
-
|
71
|
+
|
72
|
+
function _updateState(
|
73
|
+
Key32 key32,
|
74
|
+
StateId state
|
75
|
+
)
|
119
76
|
internal
|
77
|
+
returns (Blocknumber lastUpdatedIn)
|
120
78
|
{
|
121
79
|
if (state.eqz()) {
|
122
80
|
revert ErrorKeyValueStoreStateZero(key32);
|
@@ -124,23 +82,23 @@ contract KeyValueStore is
|
|
124
82
|
|
125
83
|
Metadata storage metadata = _value[key32].metadata;
|
126
84
|
StateId stateOld = metadata.state;
|
85
|
+
lastUpdatedIn = metadata.updatedIn;
|
86
|
+
|
127
87
|
if (stateOld.eqz()) {
|
128
88
|
revert ErrorKeyValueStoreNotExisting(key32);
|
129
89
|
}
|
130
90
|
|
131
|
-
//
|
132
|
-
|
91
|
+
// update state
|
92
|
+
if(state != KEEP_STATE()) {
|
93
|
+
checkTransition(metadata.objectType, stateOld, state);
|
94
|
+
metadata.state = state;
|
95
|
+
|
96
|
+
// solhint-disable-next-line avoid-tx-origin
|
97
|
+
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(), stateOld, state, msg.sender, tx.origin, lastUpdatedIn);
|
98
|
+
}
|
133
99
|
|
134
|
-
// update metadata
|
135
|
-
address updatedBy = msg.sender;
|
136
|
-
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
137
|
-
metadata.state = state;
|
138
|
-
metadata.updatedBy = updatedBy;
|
100
|
+
// update metadata
|
139
101
|
metadata.updatedIn = blockBlocknumber();
|
140
|
-
|
141
|
-
// create log entry
|
142
|
-
// solhint-disable-next-line avoid-tx-origin
|
143
|
-
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(), stateOld, state, updatedBy, tx.origin, lastUpdatedIn);
|
144
102
|
}
|
145
103
|
|
146
104
|
function exists(Key32 key32) public view returns (bool) {
|