@etherisc/gif-next 0.0.2-c00cf5d-513 → 0.0.2-c0457ac-280
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/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +198 -177
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +130 -335
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +67 -96
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +83 -108
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +35 -48
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +32 -101
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +65 -66
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +163 -10
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +81 -93
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +56 -40
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +84 -44
- 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 +268 -46
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +74 -43
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +1095 -344
- 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/Cloneable.sol/Cloneable.json +0 -53
- 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 -71
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- 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 +675 -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 +1034 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +730 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +91 -264
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +56 -69
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +19 -51
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +145 -86
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +134 -133
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +242 -103
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +180 -376
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +42 -83
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +93 -167
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +56 -45
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +121 -211
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +64 -61
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +20 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +20 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +94 -25
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +40 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +241 -107
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/product/IProductService.sol/IProductService.json +13 -55
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +180 -297
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +54 -99
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +163 -174
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +81 -54
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +337 -157
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +47 -230
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +34 -47
- 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 +65 -0
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +153 -1
- package/artifacts/contracts/registry/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/registry/IServiceAuthorization.sol/IServiceAuthorization.json +129 -0
- 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 +294 -15
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +1712 -103
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +198 -28
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +45 -42
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +321 -161
- package/artifacts/contracts/registry/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +4 -0
- package/artifacts/contracts/registry/ServiceAuthorization.sol/ServiceAuthorization.json +171 -0
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +4 -0
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +187 -0
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +314 -136
- package/artifacts/contracts/shared/AccessAdmin.sol/AccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessAdmin.sol/AccessAdmin.json +1559 -0
- package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +1 -1
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +1 -1
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +42 -10
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +1 -1
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +42 -10
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +1 -1
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +52 -20
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +1 -1
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +52 -20
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +100 -96
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +916 -55
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +796 -0
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +4 -0
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +539 -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/IAccessAdmin.sol/IAccessAdmin.dbg.json +4 -0
- package/artifacts/contracts/shared/IAccessAdmin.sol/IAccessAdmin.json +1189 -0
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +1 -1
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +76 -81
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +4 -0
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +880 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +4 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +705 -0
- 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 +20 -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 +4 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +1036 -0
- 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 +33 -20
- 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 +19 -32
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +17 -22
- 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 +16 -16
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +40 -4
- 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 +4 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +1438 -0
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +566 -54
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +460 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +4 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.json +2005 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +761 -0
- 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 +657 -100
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +65 -46
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2261 -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 +96 -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 +4 -4
- 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 +114 -4
- 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/Selector.sol/SelectorLib.dbg.json +4 -0
- package/artifacts/contracts/type/Selector.sol/SelectorLib.json +129 -0
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +4 -0
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.json +10 -0
- 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/String.sol/StrLib.dbg.json +4 -0
- package/artifacts/contracts/type/String.sol/StrLib.json +132 -0
- 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 +29 -53
- package/contracts/distribution/DistributionService.sol +61 -115
- package/contracts/distribution/IDistributionComponent.sol +5 -10
- package/contracts/distribution/IDistributionService.sol +2 -8
- package/contracts/instance/IInstance.sol +15 -7
- package/contracts/instance/IInstanceService.sol +35 -10
- package/contracts/instance/Instance.sol +63 -34
- package/contracts/instance/InstanceAdmin.sol +3 -2
- package/contracts/instance/InstanceAuthorizationsLib.sol +84 -27
- package/contracts/instance/InstanceReader.sol +64 -40
- package/contracts/instance/InstanceService.sol +185 -45
- package/contracts/instance/InstanceStore.sol +122 -64
- package/contracts/instance/base/BalanceStore.sol +123 -0
- package/contracts/instance/base/Cloneable.sol +2 -25
- package/contracts/instance/base/ObjectCounter.sol +21 -0
- package/contracts/instance/base/ObjectManager.sol +1 -3
- 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 +278 -0
- package/contracts/oracle/OracleServiceManager.sol +42 -0
- package/contracts/pool/BundleService.sol +79 -167
- package/contracts/pool/IBundleService.sol +4 -16
- package/contracts/pool/IPoolComponent.sol +4 -6
- package/contracts/pool/IPoolService.sol +45 -9
- package/contracts/pool/Pool.sol +39 -42
- package/contracts/pool/PoolService.sol +190 -142
- package/contracts/product/ApplicationService.sol +109 -42
- package/contracts/product/ClaimService.sol +18 -19
- 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 +7 -6
- package/contracts/product/IProductService.sol +1 -8
- package/contracts/product/PolicyService.sol +225 -128
- package/contracts/product/PricingService.sol +72 -48
- package/contracts/product/Product.sol +47 -49
- package/contracts/product/ProductService.sol +26 -114
- package/contracts/registry/ChainNft.sol +8 -1
- package/contracts/registry/IRegistry.sol +15 -4
- package/contracts/registry/IRegistryService.sol +10 -0
- package/contracts/registry/IServiceAuthorization.sol +35 -0
- package/contracts/registry/Registry.sol +164 -47
- package/contracts/registry/RegistryAdmin.sol +264 -72
- package/contracts/registry/RegistryService.sol +48 -14
- package/contracts/registry/RegistryServiceManager.sol +2 -9
- package/contracts/registry/ReleaseManager.sol +242 -177
- package/contracts/registry/ServiceAuthorization.sol +86 -0
- package/contracts/registry/ServiceAuthorizationV3.sol +200 -0
- package/contracts/registry/TokenRegistry.sol +261 -64
- package/contracts/shared/AccessAdmin.sol +759 -0
- package/contracts/shared/AccessManagerCustom.sol +6 -1
- package/contracts/shared/AccessManagerExtended.sol +19 -7
- package/contracts/shared/Component.sol +139 -129
- package/contracts/shared/ComponentService.sol +563 -88
- package/contracts/shared/ComponentServiceManager.sol +35 -0
- package/contracts/shared/ComponentVerifyingService.sol +117 -0
- package/contracts/shared/ERC165.sol +1 -1
- package/contracts/shared/IAccessAdmin.sol +168 -0
- package/contracts/shared/IComponent.sol +17 -37
- package/contracts/shared/IComponentService.sol +102 -0
- package/contracts/shared/IInstanceLinkedComponent.sol +46 -0
- 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 +8 -1
- package/contracts/shared/InitializableCustom.sol +177 -0
- package/contracts/shared/InstanceLinkedComponent.sol +144 -0
- 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 +3 -13
- package/contracts/shared/PolicyHolder.sol +21 -13
- package/contracts/shared/ProxyManager.sol +2 -3
- package/contracts/shared/Registerable.sol +2 -2
- package/contracts/shared/Service.sol +32 -21
- package/contracts/shared/TokenHandler.sol +24 -1
- package/contracts/staking/IStaking.sol +168 -0
- package/contracts/staking/IStakingService.sol +98 -47
- package/contracts/staking/StakeManagerLib.sol +231 -0
- package/contracts/staking/Staking.sol +513 -0
- package/contracts/staking/StakingManager.sol +54 -0
- package/contracts/staking/StakingReader.sol +187 -0
- package/contracts/staking/StakingService.sol +286 -44
- package/contracts/staking/StakingServiceManager.sol +7 -3
- package/contracts/staking/StakingStore.sol +613 -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 +142 -63
- 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 +82 -20
- package/contracts/type/Seconds.sol +27 -0
- package/contracts/type/Selector.sol +102 -0
- package/contracts/type/StateId.sol +27 -2
- package/contracts/type/String.sol +53 -0
- package/contracts/type/Timestamp.sol +6 -2
- package/contracts/type/Version.sol +1 -1
- package/package.json +3 -3
- 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/contracts/instance/module/ISetup.sol +0 -33
- package/contracts/instance/module/ITreasury.sol +0 -23
@@ -17,7 +17,12 @@ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Ini
|
|
17
17
|
2. _getAdminRestrictions() private view -> internal virtual view
|
18
18
|
3. _checkSelector() private pure -> internal pure
|
19
19
|
*/
|
20
|
-
abstract contract AccessManagerCustom is
|
20
|
+
abstract contract AccessManagerCustom is
|
21
|
+
Initializable,
|
22
|
+
ContextUpgradeable,
|
23
|
+
MulticallUpgradeable,
|
24
|
+
IAccessManager
|
25
|
+
{
|
21
26
|
using Time for *;
|
22
27
|
|
23
28
|
// Structure that stores the details for a target contract.
|
@@ -13,7 +13,10 @@ import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
|
|
13
13
|
|
14
14
|
|
15
15
|
// IMPORTANT: check role/target for existance before using return value of getter
|
16
|
-
contract AccessManagerExtended is
|
16
|
+
contract AccessManagerExtended is
|
17
|
+
AccessManagerCustom,
|
18
|
+
IAccessManagerExtended
|
19
|
+
{
|
17
20
|
using EnumerableSet for EnumerableSet.AddressSet;
|
18
21
|
|
19
22
|
string constant private ADMIN_ROLE_NAME = "Admin";
|
@@ -76,6 +79,14 @@ contract AccessManagerExtended is AccessManagerCustom, IAccessManagerExtended {
|
|
76
79
|
return $._targetAddressForName[name] != address(0);
|
77
80
|
}
|
78
81
|
|
82
|
+
function getTargets() public view returns (uint256 numberOfTargets) {
|
83
|
+
return _getAccessManagerExtendedStorage()._targetAddresses.length;
|
84
|
+
}
|
85
|
+
|
86
|
+
function getTarget(uint256 idx) public view returns (address target) {
|
87
|
+
return _getAccessManagerExtendedStorage()._targetAddresses[idx];
|
88
|
+
}
|
89
|
+
|
79
90
|
function getTargetAddress(string memory name) public view returns(address targetAddress) {
|
80
91
|
AccessManagerExtendedStorage storage $ = _getAccessManagerExtendedStorage();
|
81
92
|
return $._targetAddressForName[name];
|
@@ -279,6 +290,7 @@ contract AccessManagerExtended is AccessManagerCustom, IAccessManagerExtended {
|
|
279
290
|
}
|
280
291
|
|
281
292
|
/// inheritdoc IAccessManager
|
293
|
+
// TODO must not allow "target = this" -> access manager as target created at the begining
|
282
294
|
function _createTarget(address target, string memory name) private//, IAccess.Type ttype) private
|
283
295
|
{
|
284
296
|
AccessManagerExtendedStorage storage $ = _getAccessManagerExtendedStorage();
|
@@ -303,7 +315,7 @@ contract AccessManagerExtended is AccessManagerCustom, IAccessManagerExtended {
|
|
303
315
|
});
|
304
316
|
|
305
317
|
$._targetAddressForName[name] = target;
|
306
|
-
// must revert on duplicate address
|
318
|
+
// must revert / panic on duplicate address -> -1 check then
|
307
319
|
$._targetAddresses.push(target);
|
308
320
|
|
309
321
|
emit LogTargetCreation(target, name);//, ttype);
|
@@ -319,12 +331,12 @@ contract AccessManagerExtended is AccessManagerCustom, IAccessManagerExtended {
|
|
319
331
|
if(target == address(0)) {
|
320
332
|
revert AccessManagerTargetAddressZero();
|
321
333
|
}
|
334
|
+
// panic if not contract
|
335
|
+
//address authority = IAccessManaged(target).authority();
|
322
336
|
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
revert AccessManagerTargetAuthorityInvalid(target, authority);
|
327
|
-
}
|
337
|
+
//if(authority != address(this)) {
|
338
|
+
// revert AccessManagerTargetAuthorityInvalid(target, authority);
|
339
|
+
//}
|
328
340
|
|
329
341
|
if(bytes(name).length == 0) {
|
330
342
|
revert AccessManagerTargetNameEmpty(target);
|
@@ -6,29 +6,19 @@ 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 {Amount} from "../type/Amount.sol";
|
9
10
|
import {IComponent} from "./IComponent.sol";
|
10
11
|
import {IComponents} from "../instance/module/IComponents.sol";
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
|
14
|
-
import {InstanceReader} from "../instance/InstanceReader.sol";
|
15
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
16
|
-
import {NftId} from "../type/NftId.sol";
|
17
|
-
import {ObjectType, INSTANCE, PRODUCT} from "../type/ObjectType.sol";
|
18
|
-
import {VersionPart} from "../type/Version.sol";
|
12
|
+
import {NftId, NftIdLib} from "../type/NftId.sol";
|
13
|
+
import {ObjectType} from "../type/ObjectType.sol";
|
19
14
|
import {Registerable} from "../shared/Registerable.sol";
|
20
|
-
import {RoleId, RoleIdLib} from "../type/RoleId.sol";
|
21
|
-
import {IAccess} from "../instance/module/IAccess.sol";
|
22
15
|
import {TokenHandler} from "../shared/TokenHandler.sol";
|
23
|
-
import {
|
16
|
+
import {VersionPartLib} from "../type/Version.sol";
|
24
17
|
|
25
|
-
// TODO discuss to inherit from oz accessmanaged
|
26
|
-
// then add (Distribution|Pool|Product)Upradeable that also intherit from Versionable
|
27
|
-
// same pattern as for Service which is also upgradeable
|
28
18
|
abstract contract Component is
|
19
|
+
AccessManagedUpgradeable,
|
29
20
|
Registerable,
|
30
|
-
IComponent
|
31
|
-
AccessManagedUpgradeable
|
21
|
+
IComponent
|
32
22
|
{
|
33
23
|
// keccak256(abi.encode(uint256(keccak256("gif-next.contracts.component.Component.sol")) - 1)) & ~bytes32(uint256(0xff));
|
34
24
|
bytes32 public constant COMPONENT_LOCATION_V1 = 0xffe8d4462baed26a47154f4b8f6db497d2f772496965791d25bd456e342b7f00;
|
@@ -36,18 +26,12 @@ abstract contract Component is
|
|
36
26
|
struct ComponentStorage {
|
37
27
|
string _name; // unique (per instance) component name
|
38
28
|
IERC20Metadata _token; // token for this component
|
39
|
-
|
40
|
-
address _wallet;
|
41
|
-
|
42
|
-
|
43
|
-
NftId _productNftId; // only relevant for components that are linked to a aproduct
|
29
|
+
TokenHandler _tokenHandler;
|
30
|
+
address _wallet;
|
31
|
+
bool _isInterceptor;
|
32
|
+
bytes _data;
|
44
33
|
}
|
45
34
|
|
46
|
-
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
47
|
-
assembly {
|
48
|
-
$.slot := COMPONENT_LOCATION_V1
|
49
|
-
}
|
50
|
-
}
|
51
35
|
|
52
36
|
modifier onlyChainNft() {
|
53
37
|
if(msg.sender != getRegistry().getChainNftAddress()) {
|
@@ -56,92 +40,95 @@ abstract contract Component is
|
|
56
40
|
_;
|
57
41
|
}
|
58
42
|
|
43
|
+
|
44
|
+
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
45
|
+
assembly {
|
46
|
+
$.slot := COMPONENT_LOCATION_V1
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
59
50
|
function initializeComponent(
|
51
|
+
address authority,
|
60
52
|
address registry,
|
61
|
-
NftId
|
53
|
+
NftId parentNftId,
|
62
54
|
string memory name,
|
63
55
|
address token,
|
64
56
|
ObjectType componentType,
|
65
57
|
bool isInterceptor,
|
66
58
|
address initialOwner,
|
67
|
-
bytes memory registryData // writeonly data that will saved in the object info record of the registry
|
59
|
+
bytes memory registryData, // writeonly data that will saved in the object info record of the registry
|
60
|
+
bytes memory componentData // other component specific data
|
68
61
|
)
|
69
62
|
public
|
70
63
|
virtual
|
71
64
|
onlyInitializing()
|
72
65
|
{
|
73
|
-
initializeRegisterable(registry,
|
66
|
+
initializeRegisterable(registry, parentNftId, componentType, isInterceptor, initialOwner, registryData);
|
67
|
+
__AccessManaged_init(authority);
|
74
68
|
|
75
|
-
|
76
|
-
|
77
|
-
$._instance = IInstance(
|
78
|
-
getRegistry().getObjectInfo(instanceNftId).objectAddress);
|
79
|
-
|
80
|
-
if(!$._instance.supportsInterface(type(IInstance).interfaceId)) {
|
81
|
-
revert ErrorComponentNotInstance(instanceNftId);
|
69
|
+
if (token == address(0)) {
|
70
|
+
revert ErrorComponentTokenAddressZero();
|
82
71
|
}
|
83
72
|
|
84
|
-
|
85
|
-
|
73
|
+
if (bytes(name).length == 0) {
|
74
|
+
revert ErrorComponentNameLengthZero();
|
75
|
+
}
|
86
76
|
|
87
77
|
// set component state
|
78
|
+
ComponentStorage storage $ = _getComponentStorage();
|
88
79
|
$._name = name;
|
89
|
-
$._isNftInterceptor = isInterceptor;
|
90
|
-
$._instanceReader = $._instance.getInstanceReader();
|
91
|
-
$._wallet = address(this);
|
92
80
|
$._token = IERC20Metadata(token);
|
81
|
+
$._tokenHandler = TokenHandler(address(0));
|
82
|
+
$._wallet = address(this);
|
83
|
+
$._isInterceptor = isInterceptor;
|
84
|
+
$._data = componentData;
|
93
85
|
|
94
86
|
registerInterface(type(IAccessManaged).interfaceId);
|
95
87
|
registerInterface(type(IComponent).interfaceId);
|
96
88
|
}
|
97
89
|
|
98
|
-
function lock() external onlyOwner {
|
99
|
-
IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(true);
|
100
|
-
}
|
101
|
-
|
102
|
-
function unlock() external onlyOwner {
|
103
|
-
IInstanceService(_getServiceAddress(INSTANCE())).setComponentLocked(false);
|
104
|
-
}
|
105
90
|
|
106
|
-
function approveTokenHandler(
|
107
|
-
|
91
|
+
function approveTokenHandler(Amount spendingLimitAmount)
|
92
|
+
external
|
93
|
+
virtual
|
94
|
+
onlyOwner
|
95
|
+
{
|
96
|
+
approveTokenHandler(address(getToken()), spendingLimitAmount);
|
97
|
+
}
|
108
98
|
|
109
|
-
|
99
|
+
function approveTokenHandler(address token, Amount spendingLimitAmount)
|
100
|
+
public
|
101
|
+
virtual
|
102
|
+
onlyOwner
|
103
|
+
{
|
104
|
+
if(getWallet() != address(this)) {
|
110
105
|
revert ErrorComponentWalletNotComponent();
|
111
106
|
}
|
112
107
|
|
113
|
-
|
114
|
-
address(
|
115
|
-
spendingLimitAmount);
|
108
|
+
IERC20Metadata(token).approve(
|
109
|
+
address(getTokenHandler()),
|
110
|
+
spendingLimitAmount.toInt());
|
116
111
|
|
117
|
-
emit LogComponentTokenHandlerApproved(spendingLimitAmount);
|
112
|
+
emit LogComponentTokenHandlerApproved(address(getTokenHandler()), spendingLimitAmount);
|
118
113
|
}
|
119
114
|
|
120
115
|
function setWallet(address newWallet)
|
121
116
|
external
|
117
|
+
virtual
|
122
118
|
override
|
123
119
|
onlyOwner
|
124
120
|
{
|
125
|
-
ComponentStorage storage $ = _getComponentStorage();
|
126
|
-
|
127
|
-
address currentWallet = $._wallet;
|
128
|
-
uint256 currentBalance = $._token.balanceOf(currentWallet);
|
129
|
-
|
130
121
|
// checks
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
if (newWallet == currentWallet) {
|
136
|
-
revert ErrorComponentWalletAddressIsSameAsCurrent();
|
137
|
-
}
|
122
|
+
address currentWallet = getWallet();
|
123
|
+
IERC20Metadata token = getToken();
|
124
|
+
uint256 currentBalance = token.balanceOf(currentWallet);
|
138
125
|
|
139
126
|
if (currentBalance > 0) {
|
140
127
|
if (currentWallet == address(this)) {
|
141
128
|
// move tokens from component smart contract to external wallet
|
142
129
|
} else {
|
143
130
|
// move tokens from external wallet to component smart contract or another external wallet
|
144
|
-
uint256 allowance =
|
131
|
+
uint256 allowance = token.allowance(currentWallet, address(this));
|
145
132
|
if (allowance < currentBalance) {
|
146
133
|
revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
|
147
134
|
}
|
@@ -149,107 +136,95 @@ abstract contract Component is
|
|
149
136
|
}
|
150
137
|
|
151
138
|
// effects
|
152
|
-
|
153
|
-
emit LogComponentWalletAddressChanged(currentWallet, newWallet);
|
139
|
+
_setWallet(newWallet);
|
154
140
|
|
155
141
|
// interactions
|
156
142
|
if (currentBalance > 0) {
|
157
143
|
// transfer tokens from current wallet to new wallet
|
158
144
|
if (currentWallet == address(this)) {
|
159
145
|
// transferFrom requires self allowance too
|
160
|
-
|
146
|
+
token.approve(address(this), currentBalance);
|
161
147
|
}
|
162
148
|
|
163
|
-
SafeERC20.safeTransferFrom(
|
149
|
+
SafeERC20.safeTransferFrom(token, currentWallet, newWallet, currentBalance);
|
164
150
|
emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
|
165
151
|
}
|
166
152
|
}
|
167
153
|
|
168
|
-
function setProductNftId(NftId productNftId)
|
169
|
-
external
|
170
|
-
override
|
171
|
-
{
|
172
|
-
ComponentStorage storage $ = _getComponentStorage();
|
173
|
-
|
174
|
-
// verify caller is product service
|
175
|
-
if(msg.sender != _getServiceAddress(PRODUCT())) {
|
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;
|
185
|
-
}
|
186
154
|
|
155
|
+
/// @dev callback function for nft mints
|
156
|
+
/// may only be called by chain nft contract.
|
157
|
+
/// override internal function _nftMint to implement custom behaviour
|
187
158
|
function nftMint(address to, uint256 tokenId)
|
188
159
|
external
|
189
|
-
virtual
|
190
160
|
onlyChainNft
|
191
|
-
{
|
161
|
+
{
|
162
|
+
_nftMint(to, tokenId);
|
163
|
+
}
|
192
164
|
|
193
165
|
/// @dev callback function for nft transfers
|
194
166
|
/// may only be called by chain nft contract.
|
195
|
-
///
|
196
|
-
/// override internal function _nftTransferFrom instead
|
167
|
+
/// override internal function _nftTransferFrom to implement custom behaviour
|
197
168
|
function nftTransferFrom(address from, address to, uint256 tokenId)
|
198
169
|
external
|
199
|
-
virtual
|
200
170
|
onlyChainNft
|
201
171
|
{
|
202
172
|
_nftTransferFrom(from, to, tokenId);
|
203
173
|
}
|
204
174
|
|
205
|
-
function getWallet() public view override returns (address walletAddress)
|
206
|
-
{
|
207
|
-
return _getComponentStorage()._wallet;
|
208
|
-
}
|
209
175
|
|
210
|
-
function
|
211
|
-
return
|
176
|
+
function getWallet() public view virtual returns (address walletAddress) {
|
177
|
+
return getComponentInfo().wallet;
|
212
178
|
}
|
213
179
|
|
214
|
-
function getTokenHandler() public view returns (TokenHandler tokenHandler) {
|
180
|
+
function getTokenHandler() public virtual view returns (TokenHandler tokenHandler) {
|
215
181
|
return getComponentInfo().tokenHandler;
|
216
182
|
}
|
217
183
|
|
218
|
-
function
|
219
|
-
return
|
184
|
+
function getToken() public view virtual returns (IERC20Metadata token) {
|
185
|
+
return getComponentInfo().token;
|
220
186
|
}
|
221
187
|
|
222
|
-
function
|
223
|
-
return
|
188
|
+
function getName() public view override returns(string memory name) {
|
189
|
+
return getComponentInfo().name;
|
224
190
|
}
|
225
191
|
|
226
|
-
function
|
227
|
-
|
192
|
+
function getComponentInfo() public virtual view returns (IComponents.ComponentInfo memory info) {
|
193
|
+
if (isRegistered()) {
|
194
|
+
return _getComponentInfo();
|
195
|
+
} else {
|
196
|
+
return getInitialComponentInfo();
|
197
|
+
}
|
228
198
|
}
|
229
199
|
|
230
|
-
|
231
|
-
|
200
|
+
/// @dev defines initial component specification
|
201
|
+
/// overwrite this function according to your use case
|
202
|
+
function getInitialComponentInfo() public virtual view returns (IComponents.ComponentInfo memory info) {
|
203
|
+
return _getComponentInfo();
|
232
204
|
}
|
233
205
|
|
234
|
-
function getComponentInfo() public view returns (IComponents.ComponentInfo memory info) {
|
235
|
-
info = _getInstanceReader().getComponentInfo(getNftId());
|
236
206
|
|
237
|
-
|
238
|
-
if
|
239
|
-
|
207
|
+
function isNftInterceptor() public virtual view returns(bool isInterceptor) {
|
208
|
+
if (isRegistered()) {
|
209
|
+
return getRegistry().getObjectInfo(address(this)).isInterceptor;
|
210
|
+
} else {
|
211
|
+
return _getComponentStorage()._isInterceptor;
|
240
212
|
}
|
241
213
|
}
|
242
214
|
|
243
|
-
|
244
|
-
|
245
|
-
|
215
|
+
|
216
|
+
function isRegistered() public virtual view returns (bool) {
|
217
|
+
return getRegistry().getNftId(address(this)).gtz();
|
218
|
+
}
|
219
|
+
|
220
|
+
|
221
|
+
/// @dev internal function for nft transfers.
|
222
|
+
/// handling logic that deals with nft transfers need to overwrite this function
|
223
|
+
function _nftMint(address to, uint256 tokenId)
|
246
224
|
internal
|
247
|
-
view
|
248
225
|
virtual
|
249
|
-
returns (IComponents.ComponentInfo memory info)
|
250
226
|
{ }
|
251
227
|
|
252
|
-
|
253
228
|
/// @dev internal function for nft transfers.
|
254
229
|
/// handling logic that deals with nft transfers need to overwrite this function
|
255
230
|
function _nftTransferFrom(address from, address to, uint256 tokenId)
|
@@ -257,15 +232,50 @@ abstract contract Component is
|
|
257
232
|
virtual
|
258
233
|
{ }
|
259
234
|
|
260
|
-
|
261
|
-
|
262
|
-
|
235
|
+
|
236
|
+
/// @dev depending on the source of the component information this function needs to be overwritten.
|
237
|
+
/// eg for instance linked components that externally store this information with the instance store contract
|
238
|
+
function _setWallet(address newWallet) internal virtual {
|
239
|
+
ComponentStorage storage $ = _getComponentStorage();
|
240
|
+
address currentWallet = $._wallet;
|
241
|
+
|
242
|
+
if (newWallet == address(0)) {
|
243
|
+
revert ErrorComponentWalletAddressZero();
|
244
|
+
}
|
245
|
+
|
246
|
+
if (newWallet == currentWallet) {
|
247
|
+
revert ErrorComponentWalletAddressIsSameAsCurrent();
|
248
|
+
}
|
249
|
+
|
250
|
+
$._wallet = newWallet;
|
251
|
+
emit LogComponentWalletAddressChanged(currentWallet, newWallet);
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
/// @dev for component contracts that hold its own component information
|
257
|
+
/// this function creates and sets a token hanlder for the components tokens
|
258
|
+
function _createAndSetTokenHandler()
|
259
|
+
internal
|
260
|
+
{
|
261
|
+
ComponentStorage storage $ = _getComponentStorage();
|
262
|
+
$._tokenHandler = new TokenHandler(address($._token));
|
263
263
|
}
|
264
264
|
|
265
|
-
|
266
|
-
///
|
267
|
-
|
268
|
-
|
269
|
-
|
265
|
+
|
266
|
+
/// @dev depending on the source of the component information this function needs to be overwritten.
|
267
|
+
/// eg for instance linked components that externally store this information with the instance store contract
|
268
|
+
function _getComponentInfo() internal virtual view returns (IComponents.ComponentInfo memory info) {
|
269
|
+
ComponentStorage storage $ = _getComponentStorage();
|
270
|
+
|
271
|
+
return IComponents.ComponentInfo({
|
272
|
+
name: $._name,
|
273
|
+
productNftId: NftIdLib.zero(),
|
274
|
+
token: $._token,
|
275
|
+
tokenHandler: $._tokenHandler,
|
276
|
+
wallet: $._wallet, // initial wallet address
|
277
|
+
data: $._data // user specific component data
|
278
|
+
});
|
270
279
|
}
|
280
|
+
|
271
281
|
}
|