@etherisc/gif-next 0.0.2-b3a8633-027 → 0.0.2-b3a9c97-695
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 +16 -2
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +21 -21
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +2 -2
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +2 -2
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +77 -64
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +16 -16
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +43 -38
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +237 -74
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +66 -38
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +43 -0
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +71 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +2 -2
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +44 -44
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +14 -14
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +80 -122
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +16 -16
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +9 -9
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +72 -194
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
- 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 +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.json +2 -2
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +51 -51
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +2 -2
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +30 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +27 -35
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +2 -2
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +2 -2
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +54 -99
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +16 -16
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +438 -51
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +102 -26
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +205 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +44 -57
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +158 -54
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +44 -95
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +281 -90
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +47 -19
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +21 -32
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +9 -17
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +19 -38
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +16 -16
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +129 -58
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +42 -30
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +5 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +16 -0
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +188 -108
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +19 -0
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +339 -167
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +66 -26
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +7 -2
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +2 -2
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +19 -38
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +2 -2
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +2 -2
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +16 -40
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +12 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- 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 +50 -165
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +114 -239
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +2 -2
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +2 -2
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +35 -16
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +2 -2
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +0 -38
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +326 -62
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +72 -32
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +153 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +19 -0
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -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/InitializableCustom.sol/InitializableCustom.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/{ERC165.sol/ERC165.json → InitializableERC165.sol/InitializableERC165.json} +4 -4
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +19 -38
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +2 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +2 -2
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +2 -2
- 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/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +53 -6
- package/artifacts/contracts/shared/TokenTransferLib.sol/TokenTransferLib.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenTransferLib.sol/TokenTransferLib.json +42 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +12 -2
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +60 -74
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +31 -19
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +2 -2
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +22 -22
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +12 -12
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +17 -12
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +7 -2
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +37 -8
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +7 -2
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- 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 +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +26 -2
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/String.sol/StrLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +23 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +9 -3
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +39 -2
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +2 -2
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/authorization/AccessAdmin.sol +1 -0
- package/contracts/distribution/BasicDistribution.sol +4 -15
- package/contracts/distribution/BasicDistributionAuthorization.sol +5 -1
- package/contracts/distribution/Distribution.sol +22 -10
- package/contracts/distribution/DistributionService.sol +46 -11
- package/contracts/distribution/IDistributionComponent.sol +8 -4
- package/contracts/distribution/IDistributionService.sol +10 -0
- package/contracts/instance/InstanceAuthorizationV3.sol +2 -0
- package/contracts/instance/InstanceReader.sol +10 -7
- package/contracts/instance/InstanceService.sol +51 -27
- package/contracts/instance/InstanceStore.sol +2 -1
- package/contracts/instance/base/ObjectLifecycle.sol +2 -3
- package/contracts/instance/module/IBundle.sol +1 -1
- package/contracts/instance/module/IComponents.sol +1 -7
- package/contracts/instance/module/IDistribution.sol +0 -1
- package/contracts/instance/module/IPolicy.sol +1 -1
- package/contracts/mock/Dip.sol +1 -1
- package/contracts/oracle/IOracleComponent.sol +2 -1
- package/contracts/oracle/Oracle.sol +15 -6
- package/contracts/pool/BasicPool.sol +7 -5
- package/contracts/pool/BasicPoolAuthorization.sol +11 -2
- package/contracts/pool/BundleService.sol +169 -16
- package/contracts/pool/IBundleService.sol +32 -5
- package/contracts/pool/IPoolComponent.sol +6 -0
- package/contracts/pool/IPoolService.sol +14 -17
- package/contracts/pool/Pool.sol +32 -15
- package/contracts/pool/PoolService.sol +146 -58
- package/contracts/product/ApplicationService.sol +37 -17
- package/contracts/product/BasicProduct.sol +3 -33
- package/contracts/product/BasicProductAuthorization.sol +3 -0
- package/contracts/product/ClaimService.sol +9 -8
- package/contracts/product/IApplicationService.sol +1 -0
- package/contracts/product/IClaimService.sol +1 -0
- package/contracts/product/IPolicyService.sol +23 -17
- package/contracts/product/IProductComponent.sol +1 -0
- package/contracts/product/PolicyService.sol +251 -131
- package/contracts/product/PricingService.sol +5 -1
- package/contracts/product/Product.sol +27 -6
- package/contracts/registry/ChainNft.sol +27 -28
- package/contracts/registry/IRegistry.sol +3 -2
- package/contracts/registry/Registry.sol +69 -60
- package/contracts/registry/RegistryAdmin.sol +49 -131
- package/contracts/registry/ReleaseRegistry.sol +24 -72
- package/contracts/shared/Component.sol +21 -21
- package/contracts/shared/ComponentService.sol +73 -14
- package/contracts/shared/IComponent.sol +4 -3
- package/contracts/shared/IComponentService.sol +15 -9
- package/contracts/shared/IInstanceLinkedComponent.sol +9 -3
- package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +1 -1
- package/contracts/shared/InstanceLinkedComponent.sol +21 -0
- package/contracts/shared/NftOwnable.sol +2 -2
- package/contracts/shared/PolicyHolder.sol +2 -5
- package/contracts/shared/TokenHandler.sol +4 -0
- package/contracts/shared/TokenTransferLib.sol +60 -0
- package/contracts/staking/Staking.sol +9 -3
- package/contracts/staking/StakingService.sol +8 -12
- package/contracts/type/Amount.sol +12 -5
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/Referral.sol +1 -0
- package/contracts/type/Seconds.sol +13 -1
- package/contracts/type/Timestamp.sol +11 -1
- package/contracts/type/UFixed.sol +29 -10
- package/package.json +1 -1
- package/artifacts/contracts/registry/GlobalRegistry.sol/GlobalRegistry.dbg.json +0 -4
- package/artifacts/contracts/registry/GlobalRegistry.sol/GlobalRegistry.json +0 -1503
- package/artifacts/contracts/registry/GlobalRegistryAdmin.sol/GlobalRegistryAdmin.dbg.json +0 -4
- package/artifacts/contracts/registry/GlobalRegistryAdmin.sol/GlobalRegistryAdmin.json +0 -1881
- package/artifacts/contracts/registry/IGlobalRegistry.sol/IGlobalRegistry.dbg.json +0 -4
- package/artifacts/contracts/registry/IGlobalRegistry.sol/IGlobalRegistry.json +0 -974
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/contracts/shared/MainnetId.sol/MainnetContract.dbg.json +0 -4
- package/artifacts/contracts/shared/MainnetId.sol/MainnetContract.json +0 -34
- package/artifacts/contracts/shared/MainnetId.sol/MainnetId.dbg.json +0 -4
- package/artifacts/contracts/shared/MainnetId.sol/MainnetId.json +0 -24
- package/artifacts/contracts/shared/MainnetId.sol/SidenetContract.dbg.json +0 -4
- package/artifacts/contracts/shared/MainnetId.sol/SidenetContract.json +0 -34
- package/contracts/registry/GlobalRegistry.sol +0 -95
- package/contracts/registry/GlobalRegistryAdmin.sol +0 -38
- package/contracts/registry/IGlobalRegistry.sol +0 -17
- package/contracts/shared/MainnetId.sol +0 -29
@@ -4,30 +4,28 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
5
5
|
import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
|
6
6
|
import {Fee, FeeLib} from "../type/Fee.sol";
|
7
|
+
import {IComponents} from "../instance/module/IComponents.sol";
|
8
|
+
import {IComponentService} from "./IComponentService.sol";
|
9
|
+
import {IInstance} from "../instance/IInstance.sol";
|
7
10
|
import {IInstanceLinkedComponent} from "./IInstanceLinkedComponent.sol";
|
11
|
+
import {InstanceReader} from "../instance/InstanceReader.sol";
|
12
|
+
import {InstanceStore} from "../instance/InstanceStore.sol";
|
13
|
+
import {IInstanceService} from "../instance/IInstanceService.sol";
|
14
|
+
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
15
|
+
import {IProductComponent} from "../product/IProductComponent.sol";
|
8
16
|
import {IRegistry} from "../registry/IRegistry.sol";
|
9
17
|
import {IRegistryService} from "../registry/IRegistryService.sol";
|
10
|
-
import {
|
11
|
-
import {IAccess} from "../instance/module/IAccess.sol";
|
18
|
+
import {KEEP_STATE} from "../type/StateId.sol";
|
12
19
|
import {NftId} from "../type/NftId.sol";
|
13
20
|
import {ObjectType, REGISTRY, COMPONENT, DISTRIBUTION, INSTANCE, ORACLE, POOL, PRODUCT} from "../type/ObjectType.sol";
|
14
21
|
import {RoleId, DISTRIBUTION_OWNER_ROLE, ORACLE_OWNER_ROLE, POOL_OWNER_ROLE, PRODUCT_OWNER_ROLE} from "../type/RoleId.sol";
|
15
|
-
import {KEEP_STATE} from "../type/StateId.sol";
|
16
|
-
import {IComponents} from "../instance/module/IComponents.sol";
|
17
|
-
import {IComponentService} from "./IComponentService.sol";
|
18
|
-
import {IDistributionComponent} from "../distribution/IDistributionComponent.sol";
|
19
|
-
import {IInstanceService} from "../instance/IInstanceService.sol";
|
20
|
-
import {IPoolComponent} from "../pool/IPoolComponent.sol";
|
21
|
-
import {IProductComponent} from "../product/IProductComponent.sol";
|
22
|
-
import {InstanceReader} from "../instance/InstanceReader.sol";
|
23
|
-
import {InstanceStore} from "../instance/InstanceStore.sol";
|
24
22
|
import {TokenHandler} from "./TokenHandler.sol";
|
23
|
+
import {TokenTransferLib} from "../shared/TokenTransferLib.sol";
|
25
24
|
|
26
25
|
contract ComponentService is
|
27
26
|
ComponentVerifyingService,
|
28
27
|
IComponentService
|
29
28
|
{
|
30
|
-
|
31
29
|
error ErrorComponentServiceAlreadyRegistered(address component);
|
32
30
|
error ErrorComponentServiceNotComponent(address component);
|
33
31
|
error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
|
@@ -94,6 +92,37 @@ contract ComponentService is
|
|
94
92
|
// TODO implement
|
95
93
|
function unlock() external virtual {}
|
96
94
|
|
95
|
+
function withdrawFees(Amount amount)
|
96
|
+
external
|
97
|
+
virtual
|
98
|
+
returns (Amount withdrawnAmount)
|
99
|
+
{
|
100
|
+
(NftId componentNftId,, IInstance instance) = _getAndVerifyActiveComponent(COMPONENT());
|
101
|
+
IComponents.ComponentInfo memory info = instance.getInstanceReader().getComponentInfo(componentNftId);
|
102
|
+
address componentWallet = info.wallet;
|
103
|
+
|
104
|
+
// determine withdrawn amount
|
105
|
+
withdrawnAmount = amount;
|
106
|
+
if (withdrawnAmount.gte(AmountLib.max())) {
|
107
|
+
withdrawnAmount = instance.getInstanceReader().getFeeAmount(componentNftId);
|
108
|
+
} else if (withdrawnAmount.eqz()) {
|
109
|
+
revert ErrorComponentServiceWithdrawAmountIsZero();
|
110
|
+
} else {
|
111
|
+
Amount withdrawLimit = instance.getInstanceReader().getFeeAmount(componentNftId);
|
112
|
+
if (withdrawnAmount.gt(withdrawLimit)) {
|
113
|
+
revert ErrorComponentServiceWithdrawAmountExceedsLimit(withdrawnAmount, withdrawLimit);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
// decrease fee counters by withdrawnAmount
|
118
|
+
_changeTargetBalance(DECREASE, instance.getInstanceStore(), componentNftId, AmountLib.zero(), withdrawnAmount);
|
119
|
+
|
120
|
+
// transfer amount to component owner
|
121
|
+
address componentOwner = getRegistry().ownerOf(componentNftId);
|
122
|
+
emit LogComponentServiceComponentFeesWithdrawn(componentNftId, componentOwner, address(info.token), withdrawnAmount);
|
123
|
+
TokenTransferLib.distributeTokens(componentWallet, componentOwner, withdrawnAmount, info.tokenHandler);
|
124
|
+
}
|
125
|
+
|
97
126
|
|
98
127
|
//-------- product ------------------------------------------------------//
|
99
128
|
|
@@ -112,7 +141,7 @@ contract ComponentService is
|
|
112
141
|
contractAddress,
|
113
142
|
PRODUCT(),
|
114
143
|
PRODUCT_OWNER_ROLE());
|
115
|
-
|
144
|
+
|
116
145
|
// create product info
|
117
146
|
IComponents.ProductInfo memory productInfo = IProductComponent(contractAddress).getInitialProductInfo();
|
118
147
|
instanceStore.createProduct(productNftId, productInfo);
|
@@ -255,6 +284,36 @@ contract ComponentService is
|
|
255
284
|
_changeTargetBalance(DECREASE, instanceStore, distributionNftId, amount, feeAmount);
|
256
285
|
}
|
257
286
|
|
287
|
+
//-------- distributor -------------------------------------------------------//
|
288
|
+
|
289
|
+
function increaseDistributorBalance(
|
290
|
+
InstanceStore instanceStore,
|
291
|
+
NftId distributorNftId,
|
292
|
+
Amount amount,
|
293
|
+
Amount feeAmount
|
294
|
+
)
|
295
|
+
external
|
296
|
+
virtual
|
297
|
+
// TODO re-enable once role granting is stable and fixed
|
298
|
+
// restricted()
|
299
|
+
{
|
300
|
+
_changeTargetBalance(INCREASE, instanceStore, distributorNftId, amount, feeAmount);
|
301
|
+
}
|
302
|
+
|
303
|
+
function decreaseDistributorBalance(
|
304
|
+
InstanceStore instanceStore,
|
305
|
+
NftId distributorNftId,
|
306
|
+
Amount amount,
|
307
|
+
Amount feeAmount
|
308
|
+
)
|
309
|
+
external
|
310
|
+
virtual
|
311
|
+
// TODO re-enable once role granting is stable and fixed
|
312
|
+
// restricted()
|
313
|
+
{
|
314
|
+
_changeTargetBalance(DECREASE, instanceStore, distributorNftId, amount, feeAmount);
|
315
|
+
}
|
316
|
+
|
258
317
|
//-------- oracle -------------------------------------------------------//
|
259
318
|
|
260
319
|
function registerOracle()
|
@@ -462,7 +521,7 @@ contract ComponentService is
|
|
462
521
|
instanceReader = instance.getInstanceReader();
|
463
522
|
instanceStore = instance.getInstanceStore();
|
464
523
|
|
465
|
-
IComponents.ComponentInfo memory componentInfo = component.
|
524
|
+
IComponents.ComponentInfo memory componentInfo = component.getInitialComponentInfo();
|
466
525
|
componentInfo.tokenHandler = new TokenHandler(address(componentInfo.token));
|
467
526
|
|
468
527
|
instanceStore.createComponent(
|
@@ -35,10 +35,11 @@ interface IComponent is
|
|
35
35
|
/// only component owner (nft holder) is authorizes to call this function
|
36
36
|
function approveTokenHandler(Amount spendingLimitAmount) external;
|
37
37
|
|
38
|
-
/// @dev sets the wallet address for the component
|
39
|
-
/// if the current wallet has tokens, these will be transferred
|
38
|
+
/// @dev sets the wallet address for the component.
|
39
|
+
/// if the current wallet has tokens, these will be transferred.
|
40
40
|
/// if the new wallet address is externally owned, an approval from the
|
41
|
-
/// owner of the external wallet
|
41
|
+
/// owner of the external wallet to the tokenhandler of the component that
|
42
|
+
/// covers the current component balance must exist
|
42
43
|
function setWallet(address walletAddress) external;
|
43
44
|
|
44
45
|
/// @dev returns the name of this component
|
@@ -1,21 +1,12 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
5
|
-
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
6
4
|
|
7
5
|
import {Amount} from "../type/Amount.sol";
|
8
6
|
import {Fee} from "../type/Fee.sol";
|
9
|
-
import {IComponents} from "../instance/module/IComponents.sol";
|
10
|
-
import {IInstance} from "../instance/IInstance.sol";
|
11
|
-
import {IInstanceService} from "../instance/IInstanceService.sol";
|
12
7
|
import {InstanceStore} from "../instance/InstanceStore.sol";
|
13
|
-
import {IProductService} from "../product/IProductService.sol";
|
14
|
-
import {IRegisterable} from "../shared/IRegisterable.sol";
|
15
8
|
import {IService} from "../shared/IService.sol";
|
16
9
|
import {NftId} from "../type/NftId.sol";
|
17
|
-
import {ObjectType} from "../type/ObjectType.sol";
|
18
|
-
import {TokenHandler} from "../shared/TokenHandler.sol";
|
19
10
|
import {UFixed} from "../type/UFixed.sol";
|
20
11
|
|
21
12
|
/// @dev component base class
|
@@ -27,7 +18,12 @@ interface IComponentService is
|
|
27
18
|
error ErrorComponentServiceWalletAddressZero();
|
28
19
|
error ErrorComponentServiceWalletAddressIsSameAsCurrent();
|
29
20
|
|
21
|
+
error ErrorComponentServiceWithdrawAmountIsZero();
|
22
|
+
error ErrorComponentServiceWithdrawAmountExceedsLimit(Amount withdrawnAmount, Amount withdrawLimit);
|
23
|
+
error ErrorComponentServiceWalletAllowanceTooSmall(address wallet, address spender, uint256 allowance, uint256 amount);
|
24
|
+
|
30
25
|
event LogComponentServiceWalletAddressChanged(NftId componentNftId, address currentWallet, address newWallet);
|
26
|
+
event LogComponentServiceComponentFeesWithdrawn(NftId componentNftId, address recipient, address token, Amount withdrawnAmount);
|
31
27
|
event LogComponentServiceProductFeesUpdated(NftId productNftId);
|
32
28
|
event LogComponentServiceDistributionFeesUpdated(NftId distributionNftId);
|
33
29
|
event LogComponentServicePoolFeesUpdated(NftId poolNftId);
|
@@ -51,6 +47,11 @@ interface IComponentService is
|
|
51
47
|
/// @dev unlocks the component associated with the caller
|
52
48
|
function unlock() external;
|
53
49
|
|
50
|
+
/// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
|
51
|
+
/// @param withdrawAmount the amount to withdraw
|
52
|
+
/// @return withdrawnAmount the amount that was actually withdrawn
|
53
|
+
function withdrawFees(Amount withdrawAmount) external returns (Amount withdrawnAmount);
|
54
|
+
|
54
55
|
//-------- product ------------------------------------------------------//
|
55
56
|
|
56
57
|
/// @dev registers the sending component as a product component
|
@@ -77,6 +78,10 @@ interface IComponentService is
|
|
77
78
|
function increaseDistributionBalance(InstanceStore instanceStore, NftId distributionNftId, Amount amount, Amount feeAmount) external;
|
78
79
|
function decreaseDistributionBalance(InstanceStore instanceStore, NftId distributionNftId, Amount amount, Amount feeAmount) external;
|
79
80
|
|
81
|
+
//-------- distributor --------------------------------------------------//
|
82
|
+
function increaseDistributorBalance(InstanceStore instanceStore, NftId distributorNftId, Amount amount, Amount feeAmount) external;
|
83
|
+
function decreaseDistributorBalance(InstanceStore instanceStore, NftId distributorNftId, Amount amount, Amount feeAmount) external;
|
84
|
+
|
80
85
|
//-------- oracle -------------------------------------------------------//
|
81
86
|
|
82
87
|
/// @dev registers the sending component as an oracle component
|
@@ -99,4 +104,5 @@ interface IComponentService is
|
|
99
104
|
//-------- bundle -------------------------------------------------------//
|
100
105
|
function increaseBundleBalance(InstanceStore instanceStore, NftId bundleNftId, Amount amount, Amount feeAmount) external;
|
101
106
|
function decreaseBundleBalance(InstanceStore instanceStore, NftId bundleNftId, Amount amount, Amount feeAmount) external;
|
107
|
+
|
102
108
|
}
|
@@ -4,6 +4,7 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
5
5
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
6
6
|
|
7
|
+
import {Amount} from "../type/Amount.sol";
|
7
8
|
import {IComponent} from "../shared/IComponent.sol";
|
8
9
|
import {IAuthorization} from "../authorization/IAuthorization.sol";
|
9
10
|
import {IComponents} from "../instance/module/IComponents.sol";
|
@@ -37,14 +38,19 @@ interface IInstanceLinkedComponent is
|
|
37
38
|
/// only component owner (nft holder) is authorizes to call this function
|
38
39
|
function unlock() external;
|
39
40
|
|
41
|
+
/// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
|
42
|
+
/// @param amount the amount to withdraw
|
43
|
+
/// @return withdrawnAmount the amount that was actually withdrawn
|
44
|
+
function withdrawFees(Amount amount) external returns (Amount withdrawnAmount);
|
45
|
+
|
40
46
|
/// @dev defines the instance to which this component is linked to
|
41
47
|
function getInstance() external view returns (IInstance instance);
|
42
48
|
|
49
|
+
/// @dev returns the initial component authorization specification.
|
50
|
+
function getAuthorization() external view returns (IAuthorization authorization);
|
51
|
+
|
43
52
|
/// @dev defines the product to which this component is linked to
|
44
53
|
/// this is only relevant for pool and distribution components
|
45
54
|
function getProductNftId() external view returns (NftId productNftId);
|
46
55
|
|
47
|
-
/// @dev returns the initial component authorization specification.
|
48
|
-
function getAuthorization() external view returns (IAuthorization authorization);
|
49
|
-
|
50
56
|
}
|
@@ -4,7 +4,7 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
5
|
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
6
6
|
|
7
|
-
contract
|
7
|
+
contract InitializableERC165 is
|
8
8
|
Initializable,
|
9
9
|
IERC165
|
10
10
|
{
|
@@ -6,6 +6,7 @@ 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 {Component} from "./Component.sol";
|
10
11
|
import {IComponentService} from "./IComponentService.sol";
|
11
12
|
import {IInstanceLinkedComponent} from "./IInstanceLinkedComponent.sol";
|
@@ -36,6 +37,7 @@ abstract contract InstanceLinkedComponent is
|
|
36
37
|
IInstance _instance; // instance for this component
|
37
38
|
InstanceReader _instanceReader; // instance reader for this component
|
38
39
|
IAuthorization _initialAuthorization;
|
40
|
+
IComponentService _componentService;
|
39
41
|
}
|
40
42
|
|
41
43
|
function lock() external onlyOwner {
|
@@ -58,6 +60,17 @@ abstract contract InstanceLinkedComponent is
|
|
58
60
|
return _getInstanceLinkedComponentStorage()._initialAuthorization;
|
59
61
|
}
|
60
62
|
|
63
|
+
/// @inheritdoc IInstanceLinkedComponent
|
64
|
+
function withdrawFees(Amount amount)
|
65
|
+
external
|
66
|
+
virtual
|
67
|
+
onlyOwner()
|
68
|
+
restricted()
|
69
|
+
returns (Amount withdrawnAmount)
|
70
|
+
{
|
71
|
+
return _withdrawFees(amount);
|
72
|
+
}
|
73
|
+
|
61
74
|
function _getInstanceLinkedComponentStorage() private pure returns (InstanceLinkedComponentStorage storage $) {
|
62
75
|
assembly {
|
63
76
|
$.slot := INSTANCE_LINKED_COMPONENT_LOCATION_V1
|
@@ -105,6 +118,7 @@ abstract contract InstanceLinkedComponent is
|
|
105
118
|
// set component state
|
106
119
|
$._instanceReader = $._instance.getInstanceReader();
|
107
120
|
$._initialAuthorization = authorization;
|
121
|
+
$._componentService = IComponentService(_getServiceAddress(COMPONENT()));
|
108
122
|
|
109
123
|
registerInterface(type(IAccessManaged).interfaceId);
|
110
124
|
registerInterface(type(IInstanceLinkedComponent).interfaceId);
|
@@ -141,6 +155,13 @@ abstract contract InstanceLinkedComponent is
|
|
141
155
|
return _getInstanceLinkedComponentStorage()._instanceReader;
|
142
156
|
}
|
143
157
|
|
158
|
+
function _withdrawFees(Amount amount)
|
159
|
+
internal
|
160
|
+
returns (Amount withdrawnAmount)
|
161
|
+
{
|
162
|
+
return _getInstanceLinkedComponentStorage()._componentService.withdrawFees(amount);
|
163
|
+
}
|
164
|
+
|
144
165
|
|
145
166
|
/// @dev returns the service address for the specified domain
|
146
167
|
/// gets address via lookup from registry using the major version form the linked instance
|
@@ -1,13 +1,13 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {
|
4
|
+
import {InitializableERC165} from "./InitializableERC165.sol";
|
5
5
|
import {INftOwnable} from "./INftOwnable.sol";
|
6
6
|
import {NftId} from "../type/NftId.sol";
|
7
7
|
import {RegistryLinked} from "./RegistryLinked.sol";
|
8
8
|
|
9
9
|
contract NftOwnable is
|
10
|
-
|
10
|
+
InitializableERC165,
|
11
11
|
RegistryLinked,
|
12
12
|
INftOwnable
|
13
13
|
{
|
@@ -1,22 +1,19 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
5
4
|
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
|
6
|
-
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
7
5
|
|
8
6
|
import {Amount} from "../type/Amount.sol";
|
9
7
|
import {ClaimId} from "../type/ClaimId.sol";
|
10
|
-
import {
|
8
|
+
import {InitializableERC165} from "./InitializableERC165.sol";
|
11
9
|
import {IPolicyHolder} from "./IPolicyHolder.sol";
|
12
10
|
import {NftId} from "../type/NftId.sol";
|
13
11
|
import {PayoutId, PayoutIdLib} from "../type/PayoutId.sol";
|
14
12
|
import {RegistryLinked} from "./RegistryLinked.sol";
|
15
|
-
import {IRegistry} from "../registry/IRegistry.sol";
|
16
13
|
|
17
14
|
/// @dev template implementation for IPolicyHolder
|
18
15
|
contract PolicyHolder is
|
19
|
-
|
16
|
+
InitializableERC165,
|
20
17
|
RegistryLinked, // TODO need upgradeable version
|
21
18
|
IPolicyHolder
|
22
19
|
{
|
@@ -10,6 +10,8 @@ import {Amount} from "../type/Amount.sol";
|
|
10
10
|
/// a default token contract is provided via contract constructor
|
11
11
|
/// relies internally on oz SafeERC20.safeTransferFrom
|
12
12
|
contract TokenHandler {
|
13
|
+
event LogTokenHandlerTokenTransfer(address token, address from, address to, uint256 amount);
|
14
|
+
|
13
15
|
IERC20Metadata private _token;
|
14
16
|
|
15
17
|
constructor(address token) {
|
@@ -24,6 +26,7 @@ contract TokenHandler {
|
|
24
26
|
)
|
25
27
|
external
|
26
28
|
{
|
29
|
+
emit LogTokenHandlerTokenTransfer(address(_token), from, to, amount.toInt());
|
27
30
|
SafeERC20.safeTransferFrom(
|
28
31
|
_token,
|
29
32
|
from,
|
@@ -40,6 +43,7 @@ contract TokenHandler {
|
|
40
43
|
)
|
41
44
|
external
|
42
45
|
{
|
46
|
+
emit LogTokenHandlerTokenTransfer(token, from, to, amount.toInt());
|
43
47
|
SafeERC20.safeTransferFrom(
|
44
48
|
IERC20Metadata(token),
|
45
49
|
from,
|
@@ -0,0 +1,60 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Amount} from "../type/Amount.sol";
|
5
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
6
|
+
|
7
|
+
// library
|
8
|
+
library TokenTransferLib {
|
9
|
+
|
10
|
+
error ErrorTokenTransferLibAmountIsZero();
|
11
|
+
error ErrorTokenTransferLibAllowanceTooSmall(address from, address spender, uint256 allowance, uint256 amount);
|
12
|
+
|
13
|
+
/// @dev collect tokens from outside of the gif and transfer them to a wallet within the scope of gif
|
14
|
+
function collectTokens(
|
15
|
+
address from,
|
16
|
+
address to,
|
17
|
+
Amount amount,
|
18
|
+
TokenHandler tokenHandler
|
19
|
+
)
|
20
|
+
internal
|
21
|
+
{
|
22
|
+
_transfer(from, to, amount, tokenHandler);
|
23
|
+
}
|
24
|
+
|
25
|
+
/// @dev distribute tokens from a wallet within the scope of gif to an external address
|
26
|
+
function distributeTokens(
|
27
|
+
address from,
|
28
|
+
address to,
|
29
|
+
Amount amount,
|
30
|
+
TokenHandler tokenHandler
|
31
|
+
)
|
32
|
+
internal
|
33
|
+
{
|
34
|
+
_transfer(from, to, amount, tokenHandler);
|
35
|
+
}
|
36
|
+
|
37
|
+
function _transfer(
|
38
|
+
address from,
|
39
|
+
address to,
|
40
|
+
Amount amount,
|
41
|
+
TokenHandler tokenHandler
|
42
|
+
)
|
43
|
+
internal
|
44
|
+
{
|
45
|
+
if (amount.eqz()) {
|
46
|
+
revert ErrorTokenTransferLibAmountIsZero();
|
47
|
+
}
|
48
|
+
|
49
|
+
uint256 allowance = tokenHandler.getToken().allowance(from, address(tokenHandler));
|
50
|
+
if (allowance < amount.toInt()) {
|
51
|
+
revert ErrorTokenTransferLibAllowanceTooSmall(from, address(tokenHandler), allowance, amount.toInt());
|
52
|
+
}
|
53
|
+
|
54
|
+
tokenHandler.transfer(
|
55
|
+
from,
|
56
|
+
to,
|
57
|
+
amount);
|
58
|
+
}
|
59
|
+
|
60
|
+
}
|
@@ -8,6 +8,7 @@ import {IVersionable} from "../upgradeability/IVersionable.sol";
|
|
8
8
|
|
9
9
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
10
10
|
import {Component} from "../shared/Component.sol";
|
11
|
+
import {IComponent} from "../shared/IComponent.sol";
|
11
12
|
import {NftId} from "../type/NftId.sol";
|
12
13
|
import {ObjectType, STAKING} from "../type/ObjectType.sol";
|
13
14
|
import {Seconds} from "../type/Seconds.sol";
|
@@ -36,6 +37,7 @@ contract Staking is
|
|
36
37
|
struct StakingStorage {
|
37
38
|
IRegistryService _registryService;
|
38
39
|
TokenRegistry _tokenRegistry;
|
40
|
+
TokenHandler _tokenHandler;
|
39
41
|
StakingStore _store;
|
40
42
|
StakingReader _reader;
|
41
43
|
NftId _protocolNftId;
|
@@ -384,6 +386,7 @@ contract Staking is
|
|
384
386
|
address(tokenHandler),
|
385
387
|
dipAmount);
|
386
388
|
|
389
|
+
// TODO: centralize token handling (issue #471)
|
387
390
|
tokenHandler.transfer(from, stakingWallet, dipAmount);
|
388
391
|
}
|
389
392
|
|
@@ -400,7 +403,8 @@ contract Staking is
|
|
400
403
|
stakingWallet,
|
401
404
|
address(tokenHandler),
|
402
405
|
dipAmount);
|
403
|
-
|
406
|
+
|
407
|
+
// TODO: centralize token handling (issue #471)
|
404
408
|
tokenHandler.transfer(stakingWallet, to, dipAmount);
|
405
409
|
}
|
406
410
|
|
@@ -419,6 +423,9 @@ contract Staking is
|
|
419
423
|
return address(_getStakingStorage()._tokenRegistry);
|
420
424
|
}
|
421
425
|
|
426
|
+
function getTokenHandler() public virtual override(Component, IComponent) view returns (TokenHandler tokenHandler) {
|
427
|
+
return _getStakingStorage()._tokenHandler;
|
428
|
+
}
|
422
429
|
|
423
430
|
// from Versionable
|
424
431
|
function getVersion()
|
@@ -489,14 +496,13 @@ contract Staking is
|
|
489
496
|
"", // registry data
|
490
497
|
""); // component data
|
491
498
|
|
492
|
-
_createAndSetTokenHandler();
|
493
|
-
|
494
499
|
// wiring to external contracts
|
495
500
|
StakingStorage storage $ = _getStakingStorage();
|
496
501
|
$._protocolNftId = getRegistry().getProtocolNftId();
|
497
502
|
$._store = StakingStore(stakingStoreAddress);
|
498
503
|
$._reader = StakingStore(stakingStoreAddress).getStakingReader();
|
499
504
|
$._tokenRegistry = TokenRegistry(tokenRegistryAddress);
|
505
|
+
$._tokenHandler = new TokenHandler(address(getToken()));
|
500
506
|
|
501
507
|
registerInterface(type(IStaking).interfaceId);
|
502
508
|
}
|
@@ -122,11 +122,10 @@ contract StakingService is
|
|
122
122
|
|
123
123
|
// transfer withdrawal amount to target owner
|
124
124
|
address instanceOwner = getRegistry().ownerOf(instanceNftId);
|
125
|
+
emit LogStakingServiceRewardReservesDecreased(instanceNftId, instanceOwner, dipAmount, newBalance);
|
125
126
|
$._staking.transferDipAmount(
|
126
127
|
instanceOwner,
|
127
128
|
dipAmount);
|
128
|
-
|
129
|
-
emit LogStakingServiceRewardReservesDecreased(instanceNftId, instanceOwner, dipAmount, newBalance);
|
130
129
|
}
|
131
130
|
|
132
131
|
|
@@ -169,12 +168,12 @@ contract StakingService is
|
|
169
168
|
targetNftId,
|
170
169
|
dipAmount);
|
171
170
|
|
171
|
+
emit LogStakingServiceStakeCreated(stakeNftId, targetNftId, stakeOwner, dipAmount);
|
172
|
+
|
172
173
|
// collect staked dip by staking
|
173
174
|
$._staking.collectDipAmount(
|
174
175
|
stakeOwner,
|
175
176
|
dipAmount);
|
176
|
-
|
177
|
-
emit LogStakingServiceStakeCreated(stakeNftId, targetNftId, stakeOwner, dipAmount);
|
178
177
|
}
|
179
178
|
|
180
179
|
|
@@ -197,12 +196,11 @@ contract StakingService is
|
|
197
196
|
|
198
197
|
// collect staked dip by staking
|
199
198
|
if (dipAmount.gtz()) {
|
199
|
+
emit LogStakingServiceStakeIncreased(stakeNftId, stakeOwner, dipAmount, stakeBalance);
|
200
200
|
$._staking.collectDipAmount(
|
201
201
|
stakeOwner,
|
202
202
|
dipAmount);
|
203
203
|
}
|
204
|
-
|
205
|
-
emit LogStakingServiceStakeIncreased(stakeNftId, stakeOwner, dipAmount, stakeBalance);
|
206
204
|
}
|
207
205
|
|
208
206
|
|
@@ -247,11 +245,10 @@ contract StakingService is
|
|
247
245
|
address stakeOwner = msg.sender;
|
248
246
|
|
249
247
|
Amount rewardsClaimedAmount = $._staking.claimRewards(stakeNftId);
|
248
|
+
emit LogStakingServiceRewardsClaimed(stakeNftId, stakeOwner, rewardsClaimedAmount);
|
250
249
|
$._staking.transferDipAmount(
|
251
250
|
stakeOwner,
|
252
251
|
rewardsClaimedAmount);
|
253
|
-
|
254
|
-
emit LogStakingServiceRewardsClaimed(stakeNftId, stakeOwner, rewardsClaimedAmount);
|
255
252
|
}
|
256
253
|
|
257
254
|
|
@@ -270,11 +267,10 @@ contract StakingService is
|
|
270
267
|
) = $._staking.unstake(stakeNftId);
|
271
268
|
|
272
269
|
Amount totalAmount = unstakedAmount + rewardsClaimedAmount;
|
270
|
+
emit LogStakingServiceUnstaked(stakeNftId, stakeOwner, totalAmount);
|
273
271
|
$._staking.transferDipAmount(
|
274
272
|
stakeOwner,
|
275
273
|
totalAmount);
|
276
|
-
|
277
|
-
emit LogStakingServiceUnstaked(stakeNftId, stakeOwner, totalAmount);
|
278
274
|
}
|
279
275
|
|
280
276
|
|
@@ -389,12 +385,12 @@ contract StakingService is
|
|
389
385
|
StakingServiceStorage storage $ = _getStakingServiceStorage();
|
390
386
|
newBalance = $._staking.refillRewardReserves(targetNftId, dipAmount);
|
391
387
|
|
388
|
+
emit LogStakingServiceRewardReservesIncreased(targetNftId, rewardProvider, dipAmount, newBalance);
|
389
|
+
|
392
390
|
// collect reward dip from provider
|
393
391
|
$._staking.collectDipAmount(
|
394
392
|
rewardProvider,
|
395
393
|
dipAmount);
|
396
|
-
|
397
|
-
emit LogStakingServiceRewardReservesIncreased(targetNftId, rewardProvider, dipAmount, newBalance);
|
398
394
|
}
|
399
395
|
|
400
396
|
|
@@ -12,13 +12,15 @@ using {
|
|
12
12
|
nqAmount as !=,
|
13
13
|
ltAmount as <,
|
14
14
|
gtAmount as >,
|
15
|
+
AmountLib.add,
|
15
16
|
AmountLib.eq,
|
16
17
|
AmountLib.eqz,
|
17
18
|
AmountLib.gtz,
|
19
|
+
AmountLib.gt,
|
20
|
+
AmountLib.gte,
|
21
|
+
AmountLib.multiplyWith,
|
18
22
|
AmountLib.toInt,
|
19
|
-
AmountLib.
|
20
|
-
AmountLib.toUFixed,
|
21
|
-
AmountLib.multiplyWith
|
23
|
+
AmountLib.toUFixed
|
22
24
|
} for Amount global;
|
23
25
|
|
24
26
|
function addAmount(Amount a, Amount b) pure returns (Amount) {
|
@@ -77,16 +79,21 @@ library AmountLib {
|
|
77
79
|
return Amount.unwrap(amount1) == Amount.unwrap(amount2);
|
78
80
|
}
|
79
81
|
|
80
|
-
/// @dev return true if amount a1 is
|
82
|
+
/// @dev return true if amount a1 is less than a2
|
81
83
|
function lt(Amount a1, Amount a2) public pure returns (bool) {
|
82
84
|
return Amount.unwrap(a1) < Amount.unwrap(a2);
|
83
85
|
}
|
84
86
|
|
85
|
-
/// @dev return true if amount a1 is
|
87
|
+
/// @dev return true if amount a1 is greater than a2
|
86
88
|
function gt(Amount a1, Amount a2) public pure returns (bool) {
|
87
89
|
return Amount.unwrap(a1) > Amount.unwrap(a2);
|
88
90
|
}
|
89
91
|
|
92
|
+
/// @dev return true if amount a1 is greater or equal than a2
|
93
|
+
function gte(Amount a1, Amount a2) public pure returns (bool) {
|
94
|
+
return Amount.unwrap(a1) >= Amount.unwrap(a2);
|
95
|
+
}
|
96
|
+
|
90
97
|
/// @dev return minimum of a1 and a2.
|
91
98
|
function min(Amount a1, Amount a2) public pure returns (Amount) {
|
92
99
|
if (Amount.unwrap(a1) < Amount.unwrap(a2)) {
|
@@ -11,8 +11,14 @@ using {
|
|
11
11
|
eqBlocknumber as ==,
|
12
12
|
neBlocknumber as !=,
|
13
13
|
BlocknumberLib.toInt,
|
14
|
+
BlocknumberLib.eq,
|
15
|
+
BlocknumberLib.ne,
|
14
16
|
BlocknumberLib.eqz,
|
15
|
-
BlocknumberLib.gtz
|
17
|
+
BlocknumberLib.gtz,
|
18
|
+
BlocknumberLib.gt,
|
19
|
+
BlocknumberLib.gte,
|
20
|
+
BlocknumberLib.lt,
|
21
|
+
BlocknumberLib.lte
|
16
22
|
} for Blocknumber global;
|
17
23
|
|
18
24
|
/// @dev return true if Blocknumber a is greater than Blocknumber b
|