@etherisc/gif-next 0.0.2-a307d03-692 → 0.0.2-a33f6f4-689
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/accounting/AccountingService.sol/AccountingService.dbg.json +1 -1
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +32 -32
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +26 -26
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +361 -246
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdminLib.sol/AccessAdminLib.json +673 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.json +8 -39
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +96 -23
- 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/IAccessAdmin.sol/IAccessAdmin.json +278 -184
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +32 -0
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- 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 +21 -134
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +96 -41
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +0 -86
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +156 -85
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +56 -52
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +0 -86
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +64 -1
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +19 -49
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +96 -41
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +67 -105
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +96 -41
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +71 -162
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +96 -41
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +20 -63
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +24 -67
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +96 -41
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +35 -72
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +96 -41
- 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/IInstance.sol/IInstance.json +93 -15
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +61 -12
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +113 -38
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +509 -413
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +96 -41
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +104 -75
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +93 -64
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +26 -36
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +54 -44
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +1 -1
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +2 -2
- 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/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSetHelperLib.sol/ObjectSetHelperLib.json +2 -2
- 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/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +14 -35
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +93 -30
- 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 +0 -21
- 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 +0 -21
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +42 -42
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +31 -31
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +0 -21
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +96 -41
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +58 -58
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +39 -39
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +0 -21
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +0 -21
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolLib.sol/PoolLib.json +2 -2
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +62 -62
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +41 -41
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +90 -24
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +34 -22
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +0 -21
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +96 -41
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +80 -80
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +50 -50
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +42 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +21 -0
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +0 -21
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +31 -4
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +62 -62
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceLib.sol/PolicyServiceLib.json +2 -2
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +41 -41
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +73 -52
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +36 -36
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +0 -21
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +79 -28
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +34 -22
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRelease.sol/IRelease.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 +2 -2
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +440 -350
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAuthorization.sol/RegistryAuthorization.json +878 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +18 -18
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +19 -19
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseAdmin.sol/ReleaseAdmin.json +474 -369
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +128 -124
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
- 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 -21
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +242 -96
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +48 -40
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +60 -4
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ITokenRegistryHelper.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +0 -21
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +165 -35
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +0 -21
- 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/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +2 -2
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +0 -21
- 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/NftIdSet.sol/NftIdSet.json +2 -2
- 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/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 +2 -2
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +2 -2
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +2 -2
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +74 -30
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +71 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +123 -84
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingLib.sol/StakingLib.json +469 -0
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +41 -37
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +30 -57
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +105 -26
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +27 -23
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +142 -128
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +24 -14
- 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/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- 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/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.dbg.json +1 -1
- package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +2 -2
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +2 -2
- 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 +33 -31
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +2 -2
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +9 -4
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/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/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 +56 -2
- 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 +4 -4
- 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 +201 -186
- package/contracts/authorization/AccessAdminLib.sol +183 -0
- package/contracts/authorization/AccessManagerCloneable.sol +40 -31
- package/contracts/authorization/Authorization.sol +61 -33
- package/contracts/authorization/IAccessAdmin.sol +63 -36
- package/contracts/authorization/IAuthorization.sol +6 -0
- package/contracts/distribution/BasicDistribution.sol +6 -6
- package/contracts/distribution/BasicDistributionAuthorization.sol +1 -1
- package/contracts/distribution/Distribution.sol +3 -48
- package/contracts/distribution/DistributionService.sol +32 -5
- package/contracts/distribution/IDistributionComponent.sol +0 -9
- package/contracts/distribution/IDistributionService.sol +4 -2
- package/contracts/examples/fire/FirePool.sol +0 -4
- package/contracts/examples/fire/FireProduct.sol +1 -6
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +32 -8
- package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -8
- package/contracts/examples/unpermissioned/SimplePool.sol +0 -4
- package/contracts/examples/unpermissioned/SimpleProduct.sol +4 -8
- package/contracts/instance/IInstance.sol +45 -10
- package/contracts/instance/IInstanceService.sol +19 -3
- package/contracts/instance/Instance.sol +74 -26
- package/contracts/instance/InstanceAdmin.sol +119 -118
- package/contracts/instance/InstanceAuthorizationV3.sol +43 -24
- package/contracts/instance/InstanceReader.sol +13 -0
- package/contracts/instance/InstanceService.sol +128 -73
- package/contracts/instance/module/IComponents.sol +0 -1
- package/contracts/instance/module/IDistribution.sol +3 -1
- package/contracts/oracle/BasicOracle.sol +1 -3
- package/contracts/oracle/BasicOracleAuthorization.sol +1 -1
- package/contracts/oracle/Oracle.sol +0 -2
- package/contracts/pool/BasicPool.sol +0 -2
- package/contracts/pool/BasicPoolAuthorization.sol +1 -1
- package/contracts/pool/Pool.sol +0 -2
- package/contracts/pool/PoolService.sol +1 -3
- package/contracts/product/ApplicationService.sol +21 -6
- package/contracts/product/BasicProduct.sol +0 -2
- package/contracts/product/BasicProductAuthorization.sol +1 -1
- package/contracts/product/IApplicationService.sol +3 -0
- package/contracts/product/IPricingService.sol +1 -0
- package/contracts/product/IRiskService.sol +7 -7
- package/contracts/product/PolicyService.sol +0 -18
- package/contracts/product/PricingService.sol +5 -0
- package/contracts/product/Product.sol +6 -17
- package/contracts/product/RiskService.sol +16 -7
- package/contracts/registry/RegistryAdmin.sol +133 -229
- package/contracts/registry/RegistryAuthorization.sol +267 -0
- package/contracts/registry/ReleaseAdmin.sol +30 -22
- package/contracts/registry/ReleaseRegistry.sol +39 -33
- package/contracts/registry/ServiceAuthorizationV3.sol +6 -1
- package/contracts/shared/Component.sol +11 -27
- package/contracts/shared/ComponentService.sol +219 -135
- package/contracts/shared/ContractLib.sol +28 -0
- package/contracts/shared/IComponent.sol +0 -3
- package/contracts/shared/IComponentService.sol +21 -9
- package/contracts/shared/InitializableERC165.sol +9 -1
- package/contracts/shared/InstanceLinkedComponent.sol +0 -2
- package/contracts/shared/NftOwnable.sol +1 -1
- package/contracts/shared/Registerable.sol +1 -4
- package/contracts/shared/TokenHandler.sol +5 -4
- package/contracts/staking/IStaking.sol +12 -2
- package/contracts/staking/IStakingService.sol +8 -1
- package/contracts/staking/Staking.sol +35 -15
- package/contracts/staking/{StakeManagerLib.sol → StakingLib.sol} +79 -22
- package/contracts/staking/StakingReader.sol +5 -15
- package/contracts/staking/StakingService.sol +36 -2
- package/contracts/staking/StakingStore.sol +2 -1
- package/contracts/type/ObjectType.sol +5 -14
- package/contracts/type/RiskId.sol +4 -3
- package/contracts/type/Version.sol +39 -0
- package/package.json +2 -2
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +0 -4
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +0 -440
@@ -3,6 +3,7 @@ pragma solidity ^0.8.20;
|
|
3
3
|
|
4
4
|
import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
|
5
5
|
import {IAccessManager} from "@openzeppelin/contracts/access/manager/IAccessManager.sol";
|
6
|
+
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
6
7
|
|
7
8
|
// import {InstanceAdmin} from "../instance/InstanceAdmin.sol";
|
8
9
|
import {IRegistry} from "../registry/IRegistry.sol";
|
@@ -170,6 +171,33 @@ library ContractLib {
|
|
170
171
|
}
|
171
172
|
|
172
173
|
|
174
|
+
function isAccessManaged(address target)
|
175
|
+
public
|
176
|
+
view
|
177
|
+
returns (bool)
|
178
|
+
{
|
179
|
+
if (!isContract(target)) {
|
180
|
+
return false;
|
181
|
+
}
|
182
|
+
|
183
|
+
(bool success, ) = target.staticcall(
|
184
|
+
abi.encodeWithSelector(
|
185
|
+
IAccessManaged.authority.selector));
|
186
|
+
|
187
|
+
return success;
|
188
|
+
}
|
189
|
+
|
190
|
+
|
191
|
+
function isRegistered(address registry, address caller, ObjectType expectedType) public view returns (bool) {
|
192
|
+
NftId nftId = IRegistry(registry).getNftIdForAddress(caller);
|
193
|
+
if (nftId.eqz()) {
|
194
|
+
return false;
|
195
|
+
}
|
196
|
+
|
197
|
+
return IRegistry(registry).getObjectInfo(nftId).objectType == expectedType;
|
198
|
+
}
|
199
|
+
|
200
|
+
|
173
201
|
function isRegistry(address registry) public view returns (bool) {
|
174
202
|
if (!isContract(registry)) {
|
175
203
|
return false;
|
@@ -15,9 +15,6 @@ interface IComponent is
|
|
15
15
|
IRegisterable,
|
16
16
|
ITransferInterceptor
|
17
17
|
{
|
18
|
-
|
19
|
-
error ErrorComponentTokenInvalid(address token);
|
20
|
-
|
21
18
|
error ErrorComponentProductNftIdZero();
|
22
19
|
error ErrorComponentProductNftIdNonzero();
|
23
20
|
error ErrorComponentNameLengthZero();
|
@@ -16,11 +16,22 @@ import {VersionPart} from "../type/Version.sol";
|
|
16
16
|
interface IComponentService is
|
17
17
|
IService
|
18
18
|
{
|
19
|
+
error ErrorComponentServiceTokenInvalid(address token);
|
20
|
+
|
19
21
|
error ErrorComponentServiceNotInstanceLinkedComponent(address component);
|
20
|
-
error
|
21
|
-
error
|
22
|
-
error
|
23
|
-
error
|
22
|
+
error ErrorComponentServiceSenderNotRegistered(address sender);
|
23
|
+
error ErrorComponentServiceNotComponent(address component);
|
24
|
+
error ErrorComponentServiceTypeNotSupported(address component, ObjectType invalidType);
|
25
|
+
error ErrorComponentServiceInvalidType(address component, ObjectType requiredType, ObjectType componentType);
|
26
|
+
error ErrorComponentServiceAlreadyRegistered(address component);
|
27
|
+
error ErrorComponentServiceReleaseMismatch(address component, VersionPart componentRelease, VersionPart parentRelease);
|
28
|
+
error ErrorComponentServiceSenderNotComponentParent(NftId senderNftId, NftId compnentParentNftId);
|
29
|
+
error ErrorComponentServiceParentNotInstance(NftId nftId, ObjectType objectType);
|
30
|
+
error ErrorComponentServiceParentNotProduct(NftId nftId, ObjectType objectType);
|
31
|
+
|
32
|
+
error ErrorComponentServiceNotRegistered(address instanceAddress);
|
33
|
+
error ErrorComponentServiceNotInstance(address instanceAddress, ObjectType objectType);
|
34
|
+
error ErrorComponentServiceInstanceVersionMismatch(address instanceAddress, VersionPart instanceVersion);
|
24
35
|
|
25
36
|
error ErrorProductServiceNoDistributionExpected(NftId productNftId);
|
26
37
|
error ErrorProductServiceDistributionAlreadyRegistered(NftId productNftId, NftId distributionNftId);
|
@@ -36,7 +47,7 @@ interface IComponentService is
|
|
36
47
|
error ErrorComponentServiceWithdrawAmountExceedsLimit(Amount withdrawnAmount, Amount withdrawLimit);
|
37
48
|
error ErrorComponentServiceWalletAllowanceTooSmall(address wallet, address spender, uint256 allowance, uint256 amount);
|
38
49
|
|
39
|
-
event LogComponentServiceRegistered(NftId componentNftId, ObjectType componentType, address component, address token, address initialOwner);
|
50
|
+
event LogComponentServiceRegistered(NftId instanceNftId, NftId componentNftId, ObjectType componentType, address component, address token, address initialOwner);
|
40
51
|
event LogComponentServiceWalletAddressChanged(NftId componentNftId, address currentWallet, address newWallet);
|
41
52
|
event LogComponentServiceWalletTokensTransferred(NftId componentNftId, address currentWallet, address newWallet, uint256 currentBalance);
|
42
53
|
event LogComponentServiceComponentFeesWithdrawn(NftId componentNftId, address recipient, address token, Amount withdrawnAmount);
|
@@ -58,11 +69,12 @@ interface IComponentService is
|
|
58
69
|
/// Reverts if the component's token handler wallet is not the token handler itself.
|
59
70
|
function approveTokenHandler(IERC20Metadata token, Amount amount) external;
|
60
71
|
|
61
|
-
/// @dev Sets the components associated wallet address
|
72
|
+
/// @dev Sets the components associated wallet address.
|
73
|
+
/// To set the wallet to the token handler contract, use address(0) as the new wallet adress.
|
62
74
|
function setWallet(address newWallet) external;
|
63
75
|
|
64
|
-
/// @dev Locks/Unlocks the
|
65
|
-
function
|
76
|
+
/// @dev Locks/Unlocks the calling component.
|
77
|
+
function setLocked(bool locked) external;
|
66
78
|
|
67
79
|
/// @dev Withdraw fees from the distribution component. Only component owner is allowed to withdraw fees.
|
68
80
|
/// @param withdrawAmount the amount to withdraw
|
@@ -75,7 +87,7 @@ interface IComponentService is
|
|
75
87
|
//-------- product ------------------------------------------------------//
|
76
88
|
|
77
89
|
/// @dev Registers the specified product component for the instance (sender)
|
78
|
-
function registerProduct(address product) external returns (NftId productNftId);
|
90
|
+
function registerProduct(address product, address token) external returns (NftId productNftId);
|
79
91
|
|
80
92
|
function setProductFees(
|
81
93
|
Fee memory productFee, // product fee on net premium
|
@@ -11,13 +11,21 @@ contract InitializableERC165 is
|
|
11
11
|
mapping(bytes4 => bool) private _isSupported;
|
12
12
|
|
13
13
|
// @dev initializes with support for ERC165
|
14
|
-
function
|
14
|
+
function __ERC165_init() internal onlyInitializing() {
|
15
|
+
_initializeERC165();
|
16
|
+
}
|
17
|
+
|
18
|
+
function _initializeERC165() internal {
|
15
19
|
_isSupported[type(IERC165).interfaceId] = true;
|
16
20
|
}
|
17
21
|
|
18
22
|
// @dev register support for provided interfaceId
|
19
23
|
// includes initialization for ERC165_ID if not yet done
|
20
24
|
function _registerInterface(bytes4 interfaceId) internal onlyInitializing() {
|
25
|
+
_registerInterfaceNotInitializing(interfaceId);
|
26
|
+
}
|
27
|
+
|
28
|
+
function _registerInterfaceNotInitializing(bytes4 interfaceId) internal{
|
21
29
|
_isSupported[interfaceId] = true;
|
22
30
|
}
|
23
31
|
|
@@ -71,7 +71,6 @@ abstract contract InstanceLinkedComponent is
|
|
71
71
|
address registry,
|
72
72
|
NftId parentNftId,
|
73
73
|
string memory name,
|
74
|
-
address token,
|
75
74
|
ObjectType componentType,
|
76
75
|
IAuthorization authorization,
|
77
76
|
bool isInterceptor,
|
@@ -99,7 +98,6 @@ abstract contract InstanceLinkedComponent is
|
|
99
98
|
registry,
|
100
99
|
parentNftId,
|
101
100
|
name,
|
102
|
-
token,
|
103
101
|
componentType,
|
104
102
|
isInterceptor,
|
105
103
|
initialOwner,
|
@@ -26,7 +26,6 @@ abstract contract Registerable is
|
|
26
26
|
struct RegisterableStorage {
|
27
27
|
NftId _parentNftId;
|
28
28
|
ObjectType _objectType;
|
29
|
-
VersionPart _release;
|
30
29
|
bool _isInterceptor;
|
31
30
|
bytes _data;
|
32
31
|
}
|
@@ -61,7 +60,6 @@ abstract contract Registerable is
|
|
61
60
|
RegisterableStorage storage $ = _getRegisterableStorage();
|
62
61
|
$._parentNftId = parentNftId;
|
63
62
|
$._objectType = objectType;
|
64
|
-
$._release = AccessManagerCloneable(authority).getRelease();
|
65
63
|
$._isInterceptor = isInterceptor;
|
66
64
|
$._data = data;
|
67
65
|
|
@@ -77,8 +75,7 @@ abstract contract Registerable is
|
|
77
75
|
|
78
76
|
/// @inheritdoc IRelease
|
79
77
|
function getRelease() public virtual view returns (VersionPart release) {
|
80
|
-
|
81
|
-
return $._release;
|
78
|
+
return AccessManagerCloneable(authority()).getRelease();
|
82
79
|
}
|
83
80
|
|
84
81
|
|
@@ -270,11 +270,12 @@ contract TokenHandler is
|
|
270
270
|
AccessManaged(authority)
|
271
271
|
{ }
|
272
272
|
|
273
|
-
/// @dev
|
274
|
-
///
|
275
|
-
///
|
273
|
+
/// @dev Sets the wallet address for the component.
|
274
|
+
/// Seeting the new wallet address to address(0) will set the wallet to the tokenHandler contract itself.
|
275
|
+
/// If the current wallet has tokens, these will be transferred.
|
276
|
+
/// If the new wallet address is externally owned, an approval from the
|
276
277
|
/// owner of the external wallet to the tokenhandler of the component that
|
277
|
-
/// covers the current component balance must exist
|
278
|
+
/// covers the current component balance must exist.
|
278
279
|
function setWallet(address newWallet)
|
279
280
|
external
|
280
281
|
restricted()
|
@@ -1,6 +1,8 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
+
|
4
6
|
import {Amount} from "../type/Amount.sol";
|
5
7
|
import {IComponent} from "../shared/IComponent.sol";
|
6
8
|
import {IVersionable} from "../upgradeability/IVersionable.sol";
|
@@ -22,6 +24,7 @@ interface IStaking is
|
|
22
24
|
// target parameters
|
23
25
|
event LogStakingLockingPeriodSet(NftId targetNftId, Seconds oldLockingPeriod, Seconds lockingPeriod);
|
24
26
|
event LogStakingRewardRateSet(NftId targetNftId, UFixed oldRewardRate, UFixed rewardRate);
|
27
|
+
event LogStakingMaxStakedAmountSet(NftId targetNftId, Amount maxStakedAmount);
|
25
28
|
|
26
29
|
// modifiers
|
27
30
|
error ErrorStakingNotStake(NftId stakeNftId);
|
@@ -51,8 +54,8 @@ interface IStaking is
|
|
51
54
|
error ErrorStakingRewardRateTooHigh(NftId targetNftId, UFixed maxRewardRate, UFixed rewardRate);
|
52
55
|
error ErrorStakingTargetNotFound(NftId targetNftId);
|
53
56
|
error ErrorStakingTargetTokenNotFound(NftId targetNftId, uint256 chainId, address token);
|
57
|
+
error ErrorStakingTargetMaxStakedAmountExceeded(NftId targetNftId, Amount maxStakedAmount, Amount stakedAmount);
|
54
58
|
|
55
|
-
error ErrorStakingTargetNotActive(NftId targetNftId);
|
56
59
|
error ErrorStakingStakeAmountZero(NftId targetNftId);
|
57
60
|
|
58
61
|
// info for individual stake
|
@@ -65,10 +68,13 @@ interface IStaking is
|
|
65
68
|
uint256 chainId;
|
66
69
|
Seconds lockingPeriod;
|
67
70
|
UFixed rewardRate;
|
71
|
+
Amount maxStakedAmount;
|
68
72
|
}
|
69
73
|
|
70
74
|
function initializeTokenHandler() external;
|
71
75
|
|
76
|
+
function approveTokenHandler(IERC20Metadata token, Amount amount) external;
|
77
|
+
|
72
78
|
// staking rate management
|
73
79
|
|
74
80
|
/// @dev sets the rate that converts 1 token of total value locked into the
|
@@ -95,6 +101,10 @@ interface IStaking is
|
|
95
101
|
/// permissioned: only the staking service may call this function
|
96
102
|
function setRewardRate(NftId targetNftId, UFixed rewardRate) external;
|
97
103
|
|
104
|
+
/// @dev set the maximum staked amount for the specified target.
|
105
|
+
/// permissioned: only the staking service may call this function
|
106
|
+
function setMaxStakedAmount(NftId targetNftId, Amount maxStakedAmount) external;
|
107
|
+
|
98
108
|
/// @dev (re)fills the staking reward reserves for the specified target
|
99
109
|
/// unpermissioned: anybody may fill up staking reward reserves
|
100
110
|
function refillRewardReserves(NftId targetNftId, Amount dipAmount) external returns (Amount newBalance);
|
@@ -132,7 +142,7 @@ interface IStaking is
|
|
132
142
|
/// @dev restakes the dips to a new target.
|
133
143
|
/// the sum of the staked dips and the accumulated rewards will be restaked.
|
134
144
|
/// permissioned: only staking service may call this function.
|
135
|
-
function restake(NftId stakeNftId, NftId
|
145
|
+
function restake(NftId stakeNftId, NftId newStakeNftId) external returns (Amount newStakeBalance);
|
136
146
|
|
137
147
|
/// @dev retuns the specified amount of dips to the holder of the specified stake nft.
|
138
148
|
/// if dipAmount is set to Amount.max() all staked dips and all rewards are transferred to
|
@@ -26,6 +26,7 @@ interface IStakingService is IService
|
|
26
26
|
event LogStakingServiceStakeCreated(NftId stakeNftId, NftId targetNftId, address owner, Amount stakedAmount);
|
27
27
|
event LogStakingServiceStakeIncreased(NftId stakeNftId, address owner, Amount stakedAmount, Amount stakeBalance);
|
28
28
|
event LogStakingServiceUnstaked(NftId stakeNftId, address stakeOwner, Amount totalAmount);
|
29
|
+
event LogStakingServiceStakeRestaked(address stakeOwner, NftId indexed stakeNftId, NftId newStakeNftId, NftId indexed newTargetNftId, Amount indexed newStakeBalance);
|
29
30
|
|
30
31
|
event LogStakingServiceRewardsUpdated(NftId stakeNftId);
|
31
32
|
event LogStakingServiceRewardsClaimed(NftId stakeNftId, address stakeOwner, Amount rewardsClaimedAmount);
|
@@ -36,6 +37,7 @@ interface IStakingService is IService
|
|
36
37
|
error ErrorStakingServiceNotSupportingIStaking(address stakingAddress);
|
37
38
|
|
38
39
|
// create
|
40
|
+
error ErrorStakingServiceTargetUnknown(NftId targetNftId);
|
39
41
|
error ErrorStakingServiceZeroTargetNftId();
|
40
42
|
error ErrorStakingServiceNotTargetNftId(NftId targetNftId);
|
41
43
|
error ErrorStakingServiceNotActiveTargetNftId(NftId targetNftId);
|
@@ -72,6 +74,10 @@ interface IStakingService is IService
|
|
72
74
|
/// Permissioned: Only owner of the specified target.
|
73
75
|
function setInstanceRewardRate(NftId instanceNftId, UFixed rewardRate) external;
|
74
76
|
|
77
|
+
/// @dev Set the instance max staked amount to the specified value.
|
78
|
+
/// Permissioned: Only owner of the specified target.
|
79
|
+
function setInstanceMaxStakedAmount(NftId instanceNftId, Amount maxStakingAmount) external;
|
80
|
+
|
75
81
|
/// @dev (Re)fills the staking reward reserves for the specified target using the dips provided by the reward provider.
|
76
82
|
/// unpermissioned: anybody may fill up staking reward reserves
|
77
83
|
function refillInstanceRewardReserves(NftId instanceNftId, address rewardProvider, Amount dipAmount) external returns (Amount newBalance);
|
@@ -116,7 +122,8 @@ interface IStakingService is IService
|
|
116
122
|
)
|
117
123
|
external
|
118
124
|
returns (
|
119
|
-
NftId newStakeNftId
|
125
|
+
NftId newStakeNftId,
|
126
|
+
Amount newStakeBalance
|
120
127
|
);
|
121
128
|
|
122
129
|
|
@@ -4,7 +4,6 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
5
|
|
6
6
|
import {IRegistry} from "../registry/IRegistry.sol";
|
7
|
-
import {IRegistryService} from "../registry/IRegistryService.sol";
|
8
7
|
import {IRelease} from "../registry/IRelease.sol";
|
9
8
|
import {IStaking} from "./IStaking.sol";
|
10
9
|
import {IVersionable} from "../upgradeability/IVersionable.sol";
|
@@ -14,10 +13,10 @@ import {Component} from "../shared/Component.sol";
|
|
14
13
|
import {IComponent} from "../shared/IComponent.sol";
|
15
14
|
import {IComponentService} from "../shared/IComponentService.sol";
|
16
15
|
import {NftId} from "../type/NftId.sol";
|
17
|
-
import {ObjectType,
|
16
|
+
import {ObjectType, STAKE, STAKING} from "../type/ObjectType.sol";
|
18
17
|
import {Seconds} from "../type/Seconds.sol";
|
19
18
|
import {Registerable} from "../shared/Registerable.sol";
|
20
|
-
import {
|
19
|
+
import {StakingLib} from "./StakingLib.sol";
|
21
20
|
import {StakingReader} from "./StakingReader.sol";
|
22
21
|
import {StakingStore} from "./StakingStore.sol";
|
23
22
|
import {TargetManagerLib} from "./TargetManagerLib.sol";
|
@@ -71,10 +70,11 @@ contract Staking is
|
|
71
70
|
}
|
72
71
|
|
73
72
|
StakingStorage storage $ = _getStakingStorage();
|
73
|
+
address dipToken = _getStakingStorage()._tokenRegistry.getDipTokenAddress();
|
74
74
|
$._tokenHandler = TokenHandlerDeployerLib.deployTokenHandler(
|
75
75
|
address(getRegistry()),
|
76
76
|
address(this),
|
77
|
-
|
77
|
+
dipToken,
|
78
78
|
getRegistry().getAuthority());
|
79
79
|
}
|
80
80
|
|
@@ -147,7 +147,8 @@ contract Staking is
|
|
147
147
|
objectType: expectedObjectType,
|
148
148
|
chainId: chainId,
|
149
149
|
lockingPeriod: initialLockingPeriod,
|
150
|
-
rewardRate: initialRewardRate
|
150
|
+
rewardRate: initialRewardRate,
|
151
|
+
maxStakedAmount: AmountLib.max()}));
|
151
152
|
}
|
152
153
|
|
153
154
|
|
@@ -195,6 +196,21 @@ contract Staking is
|
|
195
196
|
emit LogStakingRewardRateSet(targetNftId, oldRewardRate, rewardRate);
|
196
197
|
}
|
197
198
|
|
199
|
+
function setMaxStakedAmount(NftId targetNftId, Amount maxStakedAmount)
|
200
|
+
external
|
201
|
+
virtual
|
202
|
+
restricted()
|
203
|
+
onlyTarget(targetNftId)
|
204
|
+
{
|
205
|
+
IStaking.TargetInfo memory targetInfo = getStakingReader().getTargetInfo(targetNftId);
|
206
|
+
|
207
|
+
targetInfo.maxStakedAmount = maxStakedAmount;
|
208
|
+
|
209
|
+
_getStakingStorage()._store.updateTarget(targetNftId, targetInfo);
|
210
|
+
|
211
|
+
emit LogStakingMaxStakedAmountSet(targetNftId, maxStakedAmount);
|
212
|
+
}
|
213
|
+
|
198
214
|
|
199
215
|
function refillRewardReserves(NftId targetNftId, Amount dipAmount)
|
200
216
|
external
|
@@ -276,7 +292,7 @@ contract Staking is
|
|
276
292
|
restricted() // only staking service
|
277
293
|
{
|
278
294
|
StakingStorage storage $ = _getStakingStorage();
|
279
|
-
Timestamp lockedUntil =
|
295
|
+
Timestamp lockedUntil = StakingLib.checkCreateParameters(
|
280
296
|
$._reader,
|
281
297
|
targetNftId,
|
282
298
|
stakeAmount);
|
@@ -306,7 +322,7 @@ contract Staking is
|
|
306
322
|
returns (Amount stakeBalance)
|
307
323
|
{
|
308
324
|
StakingStorage storage $ = _getStakingStorage();
|
309
|
-
stakeBalance =
|
325
|
+
stakeBalance = StakingLib.stake(
|
310
326
|
getRegistry(),
|
311
327
|
$._reader,
|
312
328
|
$._store,
|
@@ -317,21 +333,26 @@ contract Staking is
|
|
317
333
|
|
318
334
|
function restake(
|
319
335
|
NftId stakeNftId,
|
320
|
-
NftId
|
336
|
+
NftId newStakeNftId
|
321
337
|
)
|
322
338
|
external
|
323
339
|
virtual
|
324
340
|
restricted() // only staking service
|
325
341
|
onlyStake(stakeNftId)
|
326
|
-
returns (
|
342
|
+
returns (Amount newStakeBalance)
|
327
343
|
{
|
344
|
+
_checkNftType(stakeNftId, STAKE());
|
345
|
+
_checkNftType(newStakeNftId, STAKE());
|
346
|
+
|
328
347
|
// TODO add check that allows additional staking amount
|
329
348
|
StakingStorage storage $ = _getStakingStorage();
|
330
|
-
|
331
|
-
|
349
|
+
newStakeBalance = StakingLib.restake(
|
350
|
+
$._reader,
|
351
|
+
$._store,
|
352
|
+
stakeNftId,
|
353
|
+
newStakeNftId);
|
332
354
|
}
|
333
355
|
|
334
|
-
|
335
356
|
function updateRewards(NftId stakeNftId)
|
336
357
|
external
|
337
358
|
virtual
|
@@ -380,7 +401,7 @@ contract Staking is
|
|
380
401
|
{
|
381
402
|
StakingStorage storage $ = _getStakingStorage();
|
382
403
|
|
383
|
-
|
404
|
+
StakingLib.checkUnstakeParameters($._reader, stakeNftId);
|
384
405
|
|
385
406
|
// update rewards since last update
|
386
407
|
NftId targetNftId = _updateRewards($._reader, $._store, stakeNftId);
|
@@ -452,7 +473,7 @@ contract Staking is
|
|
452
473
|
UFixed rewardRate;
|
453
474
|
|
454
475
|
(targetNftId, rewardRate) = reader.getTargetRewardRate(stakeNftId);
|
455
|
-
(Amount rewardIncrement, ) =
|
476
|
+
(Amount rewardIncrement, ) = StakingLib.calculateRewardIncrease(
|
456
477
|
reader,
|
457
478
|
stakeNftId,
|
458
479
|
rewardRate);
|
@@ -507,7 +528,6 @@ contract Staking is
|
|
507
528
|
registryAddress,
|
508
529
|
registry.getNftId(), // parent nft id
|
509
530
|
CONTRACT_NAME,
|
510
|
-
dipTokenAddress,
|
511
531
|
STAKING(),
|
512
532
|
false, // is interceptor
|
513
533
|
stakingOwner,
|
@@ -1,16 +1,10 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
|
-
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
5
|
-
|
6
4
|
import {Amount, AmountLib} from "../type/Amount.sol";
|
7
|
-
import {Component} from "../shared/Component.sol";
|
8
5
|
import {IRegistry} from "../registry/IRegistry.sol";
|
9
|
-
import {IRegistryService} from "../registry/IRegistryService.sol";
|
10
6
|
import {IStaking} from "./IStaking.sol";
|
11
|
-
import {Key32} from "../type/Key32.sol";
|
12
7
|
import {NftId} from "../type/NftId.sol";
|
13
|
-
import {ObjectType, INSTANCE, PROTOCOL, TARGET} from "../type/ObjectType.sol";
|
14
8
|
import {Seconds, SecondsLib} from "../type/Seconds.sol";
|
15
9
|
import {StakingReader} from "./StakingReader.sol";
|
16
10
|
import {StakingStore} from "./StakingStore.sol";
|
@@ -18,7 +12,7 @@ import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
|
|
18
12
|
import {UFixed, UFixedLib} from "../type/UFixed.sol";
|
19
13
|
|
20
14
|
|
21
|
-
library
|
15
|
+
library StakingLib {
|
22
16
|
|
23
17
|
function stake(
|
24
18
|
IRegistry registry,
|
@@ -52,6 +46,11 @@ library StakeManagerLib {
|
|
52
46
|
// TODO check that additional dip, rewards and rewards increment
|
53
47
|
// are still ok with max target staking amount
|
54
48
|
NftId targetNftId = registry.getParentNftId(stakeNftId);
|
49
|
+
Amount maxStakedAmount = stakingReader.getTargetMaxStakedAmount(targetNftId);
|
50
|
+
|
51
|
+
if (stakeBalance > maxStakedAmount) {
|
52
|
+
revert IStaking.ErrorStakingTargetMaxStakedAmountExceeded(targetNftId, maxStakedAmount, stakeBalance);
|
53
|
+
}
|
55
54
|
|
56
55
|
stakingStore.restakeRewards(
|
57
56
|
stakeNftId,
|
@@ -72,6 +71,55 @@ library StakeManagerLib {
|
|
72
71
|
|
73
72
|
}
|
74
73
|
|
74
|
+
function restake(
|
75
|
+
StakingReader stakingReader,
|
76
|
+
StakingStore stakingStore,
|
77
|
+
NftId oldStakeNftId,
|
78
|
+
NftId newStakeNftId
|
79
|
+
)
|
80
|
+
external
|
81
|
+
returns (Amount newStakeBalance)
|
82
|
+
{
|
83
|
+
checkUnstakeParameters(stakingReader, oldStakeNftId);
|
84
|
+
(NftId oldTargetNftId, UFixed oldRewardRate) = stakingReader.getTargetRewardRate(oldStakeNftId);
|
85
|
+
|
86
|
+
// calculate new rewards update and unstake full amount
|
87
|
+
(
|
88
|
+
Amount rewardIncrementAmount,
|
89
|
+
) = calculateRewardIncrease(
|
90
|
+
stakingReader,
|
91
|
+
oldStakeNftId,
|
92
|
+
oldRewardRate);
|
93
|
+
stakingStore.updateRewards(
|
94
|
+
oldStakeNftId,
|
95
|
+
oldTargetNftId,
|
96
|
+
rewardIncrementAmount);
|
97
|
+
(
|
98
|
+
Amount unstakedAmount,
|
99
|
+
Amount rewardsAmount
|
100
|
+
) = stakingStore.unstakeUpTo(
|
101
|
+
oldStakeNftId,
|
102
|
+
oldTargetNftId,
|
103
|
+
AmountLib.max(), // unstake all stakes
|
104
|
+
AmountLib.max()); // claim all rewards
|
105
|
+
|
106
|
+
// calculate full restake amount
|
107
|
+
newStakeBalance = unstakedAmount + rewardsAmount;
|
108
|
+
NftId newTargetNftId = stakingReader.getTargetNftId(newStakeNftId);
|
109
|
+
|
110
|
+
// create new staking target and increase stake
|
111
|
+
Timestamp newLockedUntil = _checkCreateParameters(stakingReader, newTargetNftId, newStakeBalance);
|
112
|
+
stakingStore.create(
|
113
|
+
newStakeNftId,
|
114
|
+
IStaking.StakeInfo({
|
115
|
+
lockedUntil: newLockedUntil
|
116
|
+
}));
|
117
|
+
stakingStore.increaseStake(
|
118
|
+
newStakeNftId,
|
119
|
+
newTargetNftId,
|
120
|
+
newStakeBalance);
|
121
|
+
}
|
122
|
+
|
75
123
|
function checkCreateParameters(
|
76
124
|
StakingReader stakingReader,
|
77
125
|
NftId targetNftId,
|
@@ -82,6 +130,19 @@ library StakeManagerLib {
|
|
82
130
|
returns (
|
83
131
|
Timestamp lockedUntil
|
84
132
|
)
|
133
|
+
{
|
134
|
+
return _checkCreateParameters(stakingReader, targetNftId, dipAmount);
|
135
|
+
}
|
136
|
+
|
137
|
+
function _checkCreateParameters(
|
138
|
+
StakingReader stakingReader,
|
139
|
+
NftId targetNftId,
|
140
|
+
Amount dipAmount
|
141
|
+
)
|
142
|
+
internal view
|
143
|
+
returns (
|
144
|
+
Timestamp lockedUntil
|
145
|
+
)
|
85
146
|
{
|
86
147
|
Seconds lockingPeriod = checkTarget(stakingReader, targetNftId);
|
87
148
|
checkDipAmount(stakingReader, targetNftId, dipAmount);
|
@@ -104,11 +165,11 @@ library StakeManagerLib {
|
|
104
165
|
{
|
105
166
|
NftId targetNftId = stakingReader.getTargetNftId(stakeNftId);
|
106
167
|
|
107
|
-
//
|
108
|
-
if (!stakingReader.
|
109
|
-
revert IStaking.
|
168
|
+
// target nft id must be registered
|
169
|
+
if (!stakingReader.isTarget(targetNftId)) {
|
170
|
+
revert IStaking.ErrorStakingNotTarget(targetNftId);
|
110
171
|
}
|
111
|
-
|
172
|
+
|
112
173
|
IStaking.TargetInfo memory info = stakingReader.getTargetInfo(targetNftId);
|
113
174
|
rewardRate = info.rewardRate;
|
114
175
|
lockingPeriod = info.lockingPeriod;
|
@@ -121,12 +182,11 @@ library StakeManagerLib {
|
|
121
182
|
public
|
122
183
|
view
|
123
184
|
returns (
|
124
|
-
UFixed rewardRate,
|
125
185
|
Seconds lockingPeriod
|
126
186
|
)
|
127
187
|
{
|
128
188
|
IStaking.StakeInfo memory stakeInfo = stakingReader.getStakeInfo(stakeNftId);
|
129
|
-
|
189
|
+
|
130
190
|
if (stakeInfo.lockedUntil > TimestampLib.blockTimestamp()) {
|
131
191
|
revert IStaking.ErrorStakingStakeLocked(stakeNftId, stakeInfo.lockedUntil);
|
132
192
|
}
|
@@ -146,11 +206,6 @@ library StakeManagerLib {
|
|
146
206
|
revert IStaking.ErrorStakingNotTarget(targetNftId);
|
147
207
|
}
|
148
208
|
|
149
|
-
// only accept stakes for active targets
|
150
|
-
if (!stakingReader.isActive(targetNftId)) {
|
151
|
-
revert IStaking.ErrorStakingTargetNotActive(targetNftId);
|
152
|
-
}
|
153
|
-
|
154
209
|
lockingPeriod = stakingReader.getTargetInfo(targetNftId).lockingPeriod;
|
155
210
|
}
|
156
211
|
|
@@ -161,14 +216,17 @@ library StakeManagerLib {
|
|
161
216
|
Amount dipAmount
|
162
217
|
)
|
163
218
|
public
|
164
|
-
|
219
|
+
view
|
165
220
|
{
|
166
221
|
// check stake amount > 0
|
167
222
|
if (dipAmount.eqz()) {
|
168
223
|
revert IStaking.ErrorStakingStakeAmountZero(targetNftId);
|
169
224
|
}
|
170
225
|
|
171
|
-
|
226
|
+
Amount maxStakedAmount = stakingReader.getTargetMaxStakedAmount(targetNftId);
|
227
|
+
if (dipAmount > maxStakedAmount) {
|
228
|
+
revert IStaking.ErrorStakingTargetMaxStakedAmountExceeded(targetNftId, maxStakedAmount, dipAmount);
|
229
|
+
}
|
172
230
|
}
|
173
231
|
|
174
232
|
function calculateRewardIncrease(
|
@@ -196,11 +254,10 @@ library StakeManagerLib {
|
|
196
254
|
rewardRate,
|
197
255
|
duration,
|
198
256
|
stakeAmount);
|
199
|
-
|
257
|
+
|
200
258
|
totalDipAmount = stakeAmount + rewardAmount + rewardIncreaseAmount;
|
201
259
|
}
|
202
260
|
|
203
|
-
|
204
261
|
function calculateRewardAmount(
|
205
262
|
UFixed rewardRate,
|
206
263
|
Seconds duration,
|
@@ -77,21 +77,6 @@ contract StakingReader is
|
|
77
77
|
}
|
78
78
|
|
79
79
|
|
80
|
-
function isActive(NftId targetNftId) external view returns (bool) {
|
81
|
-
return _store.getTargetNftIdSet().isActive(targetNftId);
|
82
|
-
}
|
83
|
-
|
84
|
-
|
85
|
-
function activeTargets() external view returns (uint256) {
|
86
|
-
return _store.getTargetNftIdSet().activeNftIds();
|
87
|
-
}
|
88
|
-
|
89
|
-
|
90
|
-
function getActiveTargetNftId(uint256 idx) external view returns (NftId) {
|
91
|
-
return _store.getTargetNftIdSet().getActiveNftId(idx);
|
92
|
-
}
|
93
|
-
|
94
|
-
|
95
80
|
function getTargetNftId(NftId stakeNftId) public view returns (NftId targetNftId) {
|
96
81
|
return _registry.getParentNftId(stakeNftId);
|
97
82
|
}
|
@@ -119,6 +104,11 @@ contract StakingReader is
|
|
119
104
|
rewardRate = getTargetInfo(targetNftId).rewardRate;
|
120
105
|
}
|
121
106
|
|
107
|
+
/// @dev get the max staked amount allowed for the specified target nft id.
|
108
|
+
function getTargetMaxStakedAmount(NftId targetNftId) external view returns (Amount maxStakedAmount) {
|
109
|
+
return getTargetInfo(targetNftId).maxStakedAmount;
|
110
|
+
}
|
111
|
+
|
122
112
|
|
123
113
|
/// @dev get the reward rate for the specified target nft id.
|
124
114
|
function getRewardRate(NftId targetNftId) external view returns (UFixed rewardRate) {
|