@etherisc/gif-next 0.0.2-e769e2e-077 → 0.0.2-e802d97-477
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +19 -13
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +79 -73
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +114 -56
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +11 -5
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +7 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleManager.sol/BundleManager.json +2 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +25 -6
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +12 -22
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +47 -20
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +4 -0
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +708 -0
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationsLib.sol/InstanceAuthorizationsLib.json +126 -30
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +195 -64
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +77 -63
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +104 -34
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +246 -104
- 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 +4 -0
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +10 -0
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectManager.sol/ObjectManager.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.json +8 -116
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +4 -0
- package/artifacts/contracts/mock/Dip.sol/Dip.json +376 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracle.sol/IOracle.json +10 -0
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracleComponent.sol/IOracleComponent.json +759 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +4 -0
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +662 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +4 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +1146 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +997 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +4 -0
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +718 -0
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +55 -41
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +102 -40
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +7 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +11 -5
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +22 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +18 -12
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +56 -35
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +95 -37
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +39 -25
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +96 -34
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +81 -67
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +115 -53
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +7 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +7 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +7 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +7 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +11 -5
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +1 -1
- package/artifacts/contracts/product/IProductService.sol/IProductService.json +7 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +59 -45
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +104 -42
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +69 -55
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +109 -47
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +18 -12
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +1 -1
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +25 -19
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +87 -29
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +2 -2
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +150 -53
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +187 -67
- 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 +328 -103
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +4 -0
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +407 -0
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +197 -72
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +87 -39
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseManager.sol/ReleaseManager.json +752 -148
- package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationsLib.sol/ServiceAuthorizationsLib.json +2 -2
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +185 -135
- package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerCustom.sol/AccessManagerCustom.json +1193 -0
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtended.sol/AccessManagerExtended.json +1715 -0
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtendedInitializeable.sol/AccessManagerExtendedInitializeable.json +1728 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisable.sol/AccessManagerExtendedWithDisable.json +1806 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.dbg.json +4 -0
- package/artifacts/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol/AccessManagerExtendedWithDisableInitializeable.json +1824 -0
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +18 -12
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +92 -63
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +102 -46
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +7 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +2 -2
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.dbg.json +4 -0
- package/artifacts/contracts/shared/IAccessManagerExtended.sol/IAccessManagerExtended.json +1562 -0
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.dbg.json +4 -0
- package/artifacts/contracts/shared/IAccessManagerExtendedWithDisable.sol/IAccessManagerExtendedWithDisable.json +1600 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +11 -5
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +14 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +11 -5
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +0 -10
- 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/INftOwnable.sol/INftOwnable.json +7 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +21 -3
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +7 -1
- package/artifacts/contracts/shared/IRegistryLinked.sol/IRegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.dbg.json +1 -1
- package/artifacts/contracts/shared/IService.sol/IService.json +7 -1
- package/artifacts/contracts/shared/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +4 -0
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +39 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +18 -12
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +10 -20
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +6 -6
- package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.dbg.json +4 -0
- package/artifacts/contracts/shared/NftIdSetManager.sol/NftIdSetManager.json +306 -0
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +13 -7
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +31 -13
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ProxyManager.sol/ProxyManager.json +64 -16
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +15 -9
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -2
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +7 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +2 -2
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/shared/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.json +2 -2
- package/artifacts/contracts/shared/Versionable.sol/Versionable.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +424 -593
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +497 -49
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +444 -0
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +598 -627
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +149 -48
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +592 -0
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +593 -74
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +119 -29
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +4 -0
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +2189 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +4 -0
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +571 -0
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.json +2 -2
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +68 -4
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +40 -2
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.json +2 -2
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/DistributorType.sol/DistributorTypeLib.json +2 -2
- package/artifacts/contracts/type/Fee.sol/FeeLib.dbg.json +1 -1
- package/artifacts/contracts/type/Fee.sol/FeeLib.json +2 -2
- package/artifacts/contracts/type/Key32.sol/Key32Lib.dbg.json +1 -1
- package/artifacts/contracts/type/Key32.sol/Key32Lib.json +2 -2
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +28 -4
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +15 -2
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +2 -2
- package/artifacts/contracts/type/Referral.sol/ReferralLib.dbg.json +1 -1
- package/artifacts/contracts/type/Referral.sol/ReferralLib.json +2 -2
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.dbg.json +4 -0
- package/artifacts/contracts/type/RequestId.sol/RequestIdLib.json +204 -0
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RiskId.sol/RiskIdLib.json +2 -2
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +76 -2
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -2
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.dbg.json +1 -1
- package/artifacts/contracts/type/Timestamp.sol/TimestampLib.json +17 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionLib.json +2 -2
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.json +2 -2
- package/contracts/distribution/Distribution.sol +2 -4
- package/contracts/distribution/DistributionService.sol +3 -2
- package/contracts/distribution/DistributionServiceManager.sol +9 -18
- package/contracts/distribution/IDistributionComponent.sol +1 -1
- package/contracts/distribution/IDistributionService.sol +1 -1
- package/contracts/instance/IInstance.sol +11 -6
- package/contracts/instance/IInstanceService.sol +3 -5
- package/contracts/instance/Instance.sol +29 -21
- package/contracts/instance/InstanceAdmin.sol +331 -0
- package/contracts/instance/InstanceAuthorizationsLib.sol +192 -151
- package/contracts/instance/InstanceReader.sol +30 -6
- package/contracts/instance/InstanceService.sol +69 -55
- package/contracts/instance/InstanceServiceManager.sol +10 -20
- package/contracts/instance/InstanceStore.sol +64 -42
- package/contracts/instance/base/BalanceStore.sol +1 -1
- package/contracts/instance/base/ObjectCounter.sol +21 -0
- package/contracts/instance/module/IAccess.sol +2 -10
- package/contracts/mock/Dip.sol +26 -0
- package/contracts/oracle/IOracle.sol +20 -0
- package/contracts/oracle/IOracleComponent.sol +32 -0
- package/contracts/oracle/IOracleService.sol +65 -0
- package/contracts/oracle/Oracle.sol +145 -0
- package/contracts/oracle/OracleService.sol +277 -0
- package/contracts/oracle/OracleServiceManager.sol +42 -0
- package/contracts/pool/BundleService.sol +6 -23
- package/contracts/pool/BundleServiceManager.sol +9 -18
- package/contracts/pool/IBundleService.sol +1 -1
- package/contracts/pool/IPoolService.sol +4 -1
- package/contracts/pool/PoolService.sol +45 -13
- package/contracts/pool/PoolServiceManager.sol +9 -18
- package/contracts/product/ApplicationService.sol +6 -5
- package/contracts/product/ApplicationServiceManager.sol +9 -6
- package/contracts/product/ClaimService.sol +13 -7
- package/contracts/product/ClaimServiceManager.sol +9 -6
- package/contracts/product/IApplicationService.sol +1 -1
- package/contracts/product/IClaimService.sol +7 -1
- package/contracts/product/IPolicyService.sol +1 -1
- package/contracts/product/IPricingService.sol +1 -1
- package/contracts/product/IProductService.sol +1 -1
- package/contracts/product/PolicyService.sol +10 -6
- package/contracts/product/PolicyServiceManager.sol +9 -21
- package/contracts/product/PricingService.sol +10 -9
- package/contracts/product/PricingServiceManager.sol +9 -18
- package/contracts/product/Product.sol +1 -1
- package/contracts/product/ProductService.sol +7 -5
- package/contracts/product/ProductServiceManager.sol +9 -21
- package/contracts/registry/ChainNft.sol +1 -0
- package/contracts/registry/IRegistry.sol +37 -24
- package/contracts/registry/IRegistryService.sol +26 -36
- package/contracts/registry/Registry.sol +164 -117
- package/contracts/registry/RegistryAdmin.sol +237 -0
- package/contracts/registry/RegistryService.sol +22 -83
- package/contracts/registry/RegistryServiceManager.sol +21 -23
- package/contracts/registry/ReleaseManager.sol +448 -223
- package/contracts/registry/TokenRegistry.sol +187 -59
- package/contracts/shared/AccessManagerCustom.sol +736 -0
- package/contracts/shared/AccessManagerExtended.sol +470 -0
- package/contracts/shared/AccessManagerExtendedInitializeable.sol +13 -0
- package/contracts/shared/AccessManagerExtendedWithDisable.sol +137 -0
- package/contracts/shared/AccessManagerExtendedWithDisableInitializeable.sol +14 -0
- package/contracts/shared/Component.sol +8 -13
- package/contracts/shared/ComponentService.sol +35 -13
- package/contracts/shared/ComponentVerifyingService.sol +13 -7
- package/contracts/shared/ERC165.sol +1 -1
- package/contracts/shared/IAccessManagerExtended.sol +74 -0
- package/contracts/shared/IAccessManagerExtendedWithDisable.sol +18 -0
- package/contracts/shared/IComponent.sol +3 -7
- package/contracts/shared/IComponentService.sol +11 -0
- package/contracts/shared/IKeyValueStore.sol +1 -1
- package/contracts/shared/INftOwnable.sol +1 -1
- package/contracts/shared/IPolicyHolder.sol +6 -1
- package/contracts/shared/IService.sol +1 -1
- package/contracts/shared/InitializableCustom.sol +177 -0
- package/contracts/shared/InstanceLinkedComponent.sol +1 -2
- package/contracts/shared/KeyValueStore.sol +24 -66
- package/contracts/shared/Lifecycle.sol +11 -2
- package/contracts/shared/NftIdSetManager.sol +65 -0
- package/contracts/shared/NftOwnable.sol +2 -13
- package/contracts/shared/PolicyHolder.sol +21 -13
- package/contracts/shared/ProxyManager.sol +31 -1
- package/contracts/shared/Service.sol +1 -1
- package/contracts/staking/IStaking.sol +127 -36
- package/contracts/staking/IStakingService.sol +83 -39
- package/contracts/staking/StakeManagerLib.sol +179 -0
- package/contracts/staking/Staking.sol +432 -93
- package/contracts/staking/StakingManager.sol +22 -14
- package/contracts/staking/StakingReader.sol +187 -0
- package/contracts/staking/StakingService.sol +245 -39
- package/contracts/staking/StakingServiceManager.sol +8 -4
- package/contracts/staking/StakingStore.sol +572 -0
- package/contracts/staking/TargetManagerLib.sol +207 -0
- package/contracts/type/AddressSet.sol +1 -1
- package/contracts/type/Amount.sol +15 -1
- package/contracts/type/Blocknumber.sol +14 -2
- package/contracts/type/Fee.sol +1 -1
- package/contracts/type/NftId.sol +9 -4
- package/contracts/type/NftIdSet.sol +1 -1
- package/contracts/type/ObjectType.sol +12 -9
- package/contracts/type/Referral.sol +1 -1
- package/contracts/type/RequestId.sol +75 -0
- package/contracts/type/RiskId.sol +1 -1
- package/contracts/type/RoleId.sol +16 -8
- package/contracts/type/Seconds.sol +27 -0
- package/contracts/type/StateId.sol +27 -2
- package/contracts/type/Timestamp.sol +6 -2
- package/contracts/type/Version.sol +1 -1
- package/package.json +3 -3
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.dbg.json +0 -4
- package/artifacts/contracts/instance/InstanceAccessManager.sol/InstanceAccessManager.json +0 -1348
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.dbg.json +0 -4
- package/artifacts/contracts/registry/RegistryAccessManager.sol/RegistryAccessManager.json +0 -308
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.dbg.json +0 -4
- package/artifacts/contracts/shared/AccessManagerUpgradeableInitializeable.sol/AccessManagerUpgradeableInitializeable.json +0 -1206
- package/contracts/instance/InstanceAccessManager.sol +0 -543
- package/contracts/registry/RegistryAccessManager.sol +0 -213
- package/contracts/shared/AccessManagerUpgradeableInitializeable.sol +0 -13
@@ -18,7 +18,7 @@ contract KeyValueStore is
|
|
18
18
|
|
19
19
|
mapping(Key32 key32 => Value value) private _value;
|
20
20
|
|
21
|
-
function
|
21
|
+
function _create(
|
22
22
|
Key32 key32,
|
23
23
|
bytes memory data
|
24
24
|
)
|
@@ -34,14 +34,12 @@ contract KeyValueStore is
|
|
34
34
|
revert ErrorKeyValueStoreAlreadyCreated(key32, objectType);
|
35
35
|
}
|
36
36
|
|
37
|
-
address createdBy = msg.sender;
|
38
37
|
Blocknumber blocknumber = blockBlocknumber();
|
39
38
|
StateId initialState = hasLifecycle(objectType) ? getInitialState(objectType) : ACTIVE();
|
40
39
|
|
41
40
|
// set metadata
|
42
41
|
metadata.objectType = objectType;
|
43
42
|
metadata.state = initialState;
|
44
|
-
metadata.updatedBy = createdBy;
|
45
43
|
metadata.updatedIn = blocknumber;
|
46
44
|
metadata.createdIn = blocknumber;
|
47
45
|
|
@@ -49,74 +47,34 @@ contract KeyValueStore is
|
|
49
47
|
_value[key32].data = data;
|
50
48
|
|
51
49
|
// solhint-disable-next-line avoid-tx-origin
|
52
|
-
emit LogInfoCreated(key32.toObjectType(), key32.toKeyId(), initialState,
|
50
|
+
emit LogInfoCreated(key32.toObjectType(), key32.toKeyId(), initialState, msg.sender, tx.origin);
|
53
51
|
}
|
54
52
|
|
55
|
-
|
53
|
+
|
54
|
+
function _update(
|
56
55
|
Key32 key32,
|
57
56
|
bytes memory data,
|
58
57
|
StateId state
|
59
58
|
)
|
60
59
|
internal
|
61
60
|
{
|
62
|
-
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
Metadata storage metadata = _value[key32].metadata;
|
67
|
-
StateId stateOld = metadata.state;
|
68
|
-
if (stateOld.eqz()) {
|
69
|
-
revert ErrorKeyValueStoreNotExisting(key32);
|
70
|
-
}
|
71
|
-
|
72
|
-
// update data
|
73
|
-
_value[key32].data = data;
|
74
|
-
|
75
|
-
// update state
|
76
|
-
if(state != KEEP_STATE()) {
|
77
|
-
checkTransition(metadata.objectType, stateOld, state);
|
78
|
-
metadata.state = state;
|
79
|
-
}
|
80
|
-
|
81
|
-
// update reest of metadata
|
82
|
-
address updatedBy = msg.sender;
|
83
|
-
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
84
|
-
|
85
|
-
metadata.updatedBy = updatedBy;
|
86
|
-
metadata.updatedIn = blockBlocknumber();
|
87
|
-
|
88
|
-
// create log entries
|
89
|
-
// solhint-disable avoid-tx-origin
|
90
|
-
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(), stateOld, state, updatedBy, tx.origin, lastUpdatedIn);
|
91
|
-
emit LogInfoUpdated(key32.toObjectType(), key32.toKeyId(), state, updatedBy, tx.origin, lastUpdatedIn);
|
92
|
-
// solhing-enable
|
93
|
-
}
|
94
|
-
|
95
|
-
function updateData(Key32 key32, bytes memory data)
|
96
|
-
internal
|
97
|
-
{
|
98
|
-
Metadata storage metadata = _value[key32].metadata;
|
99
|
-
StateId state = metadata.state;
|
100
|
-
if (state.eqz()) {
|
101
|
-
revert ErrorKeyValueStoreNotExisting(key32);
|
102
|
-
}
|
61
|
+
// update state
|
62
|
+
Blocknumber lastUpdatedIn = _updateState(key32, state);
|
103
63
|
|
104
64
|
// update data
|
105
65
|
_value[key32].data = data;
|
106
66
|
|
107
|
-
// update metadata
|
108
|
-
address updatedBy = msg.sender;
|
109
|
-
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
110
|
-
metadata.updatedBy = updatedBy;
|
111
|
-
metadata.updatedIn = blockBlocknumber();
|
112
|
-
|
113
|
-
// create log entry
|
114
67
|
// solhint-disable-next-line avoid-tx-origin
|
115
|
-
emit LogInfoUpdated(key32.toObjectType(), key32.toKeyId(), state,
|
68
|
+
emit LogInfoUpdated(key32.toObjectType(), key32.toKeyId(), state, msg.sender, tx.origin, lastUpdatedIn);
|
116
69
|
}
|
117
70
|
|
118
|
-
|
71
|
+
|
72
|
+
function _updateState(
|
73
|
+
Key32 key32,
|
74
|
+
StateId state
|
75
|
+
)
|
119
76
|
internal
|
77
|
+
returns (Blocknumber lastUpdatedIn)
|
120
78
|
{
|
121
79
|
if (state.eqz()) {
|
122
80
|
revert ErrorKeyValueStoreStateZero(key32);
|
@@ -124,23 +82,23 @@ contract KeyValueStore is
|
|
124
82
|
|
125
83
|
Metadata storage metadata = _value[key32].metadata;
|
126
84
|
StateId stateOld = metadata.state;
|
85
|
+
lastUpdatedIn = metadata.updatedIn;
|
86
|
+
|
127
87
|
if (stateOld.eqz()) {
|
128
88
|
revert ErrorKeyValueStoreNotExisting(key32);
|
129
89
|
}
|
130
90
|
|
131
|
-
//
|
132
|
-
|
91
|
+
// update state
|
92
|
+
if(state != KEEP_STATE()) {
|
93
|
+
checkTransition(metadata.objectType, stateOld, state);
|
94
|
+
metadata.state = state;
|
95
|
+
|
96
|
+
// solhint-disable-next-line avoid-tx-origin
|
97
|
+
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(), stateOld, state, msg.sender, tx.origin, lastUpdatedIn);
|
98
|
+
}
|
133
99
|
|
134
|
-
// update metadata
|
135
|
-
address updatedBy = msg.sender;
|
136
|
-
Blocknumber lastUpdatedIn = metadata.updatedIn;
|
137
|
-
metadata.state = state;
|
138
|
-
metadata.updatedBy = updatedBy;
|
100
|
+
// update metadata
|
139
101
|
metadata.updatedIn = blockBlocknumber();
|
140
|
-
|
141
|
-
// create log entry
|
142
|
-
// solhint-disable-next-line avoid-tx-origin
|
143
|
-
emit LogStateUpdated(key32.toObjectType(), key32.toKeyId(), stateOld, state, updatedBy, tx.origin, lastUpdatedIn);
|
144
102
|
}
|
145
103
|
|
146
104
|
function exists(Key32 key32) public view returns (bool) {
|
@@ -4,8 +4,8 @@ pragma solidity ^0.8.20;
|
|
4
4
|
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
5
5
|
|
6
6
|
import {NftId} from "../type/NftId.sol";
|
7
|
-
import {ObjectType, COMPONENT, BUNDLE, POLICY, RISK, CLAIM, PAYOUT} from "../type/ObjectType.sol";
|
8
|
-
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, COLLATERALIZED, REVOKED, SUBMITTED, CONFIRMED, DECLINED, EXPECTED, PAID} from "../type/StateId.sol";
|
7
|
+
import {ObjectType, COMPONENT, BUNDLE, POLICY, REQUEST, RISK, CLAIM, PAYOUT} from "../type/ObjectType.sol";
|
8
|
+
import {StateId, ACTIVE, PAUSED, ARCHIVED, CLOSED, APPLIED, COLLATERALIZED, REVOKED, SUBMITTED, CONFIRMED, DECLINED, EXPECTED, PAID, FULFILLED, FAILED, CANCELLED} from "../type/StateId.sol";
|
9
9
|
import {ILifecycle} from "./ILifecycle.sol";
|
10
10
|
|
11
11
|
contract Lifecycle is
|
@@ -27,6 +27,7 @@ contract Lifecycle is
|
|
27
27
|
_setupPolicyLifecycle();
|
28
28
|
_setupClaimAndPayoutLifecycle();
|
29
29
|
_setupRiskLifecycle();
|
30
|
+
_setupRequestLifecycle();
|
30
31
|
}
|
31
32
|
|
32
33
|
function hasLifecycle(
|
@@ -118,4 +119,12 @@ contract Lifecycle is
|
|
118
119
|
_isValidTransition[RISK()][PAUSED()][ACTIVE()] = true;
|
119
120
|
_isValidTransition[RISK()][PAUSED()][ARCHIVED()] = true;
|
120
121
|
}
|
122
|
+
|
123
|
+
function _setupRequestLifecycle() internal {
|
124
|
+
_initialState[REQUEST()] = ACTIVE();
|
125
|
+
_isValidTransition[REQUEST()][ACTIVE()][FULFILLED()] = true;
|
126
|
+
_isValidTransition[REQUEST()][ACTIVE()][FAILED()] = true;
|
127
|
+
_isValidTransition[REQUEST()][FAILED()][FULFILLED()] = true;
|
128
|
+
_isValidTransition[REQUEST()][ACTIVE()][CANCELLED()] = true;
|
129
|
+
}
|
121
130
|
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {LibNftIdSet} from "../type/NftIdSet.sol";
|
5
|
+
import {NftId} from "../type/NftId.sol";
|
6
|
+
|
7
|
+
contract NftIdSetManager {
|
8
|
+
|
9
|
+
error ErrorNftIdSetManagerNotOwner(address owner, address sender);
|
10
|
+
error ErrorNftIdSetManagerOwnerAlreadySet(address owner);
|
11
|
+
error ErrorNftIdSetManagerNftIdInvalid(NftId objectNftId);
|
12
|
+
error ErrorNftIdSetManagerAlreadyAdded(NftId objectNftId);
|
13
|
+
|
14
|
+
LibNftIdSet.Set private _allObjects;
|
15
|
+
LibNftIdSet.Set private _activeObjects;
|
16
|
+
address private _owner;
|
17
|
+
|
18
|
+
modifier onlyOwner() {
|
19
|
+
if(msg.sender != _owner) {
|
20
|
+
revert ErrorNftIdSetManagerNotOwner(_owner, msg.sender);
|
21
|
+
}
|
22
|
+
_;
|
23
|
+
}
|
24
|
+
|
25
|
+
constructor() {
|
26
|
+
_owner = msg.sender;
|
27
|
+
}
|
28
|
+
|
29
|
+
function add(NftId objectNftId) external onlyOwner {
|
30
|
+
LibNftIdSet.add(_allObjects, objectNftId);
|
31
|
+
LibNftIdSet.add(_activeObjects, objectNftId);
|
32
|
+
}
|
33
|
+
|
34
|
+
function activate(NftId componentNftId, NftId objectNftId) external onlyOwner {
|
35
|
+
LibNftIdSet.add(_activeObjects, objectNftId);
|
36
|
+
}
|
37
|
+
|
38
|
+
function deactivate(NftId componentNftId, NftId objectNftId) external onlyOwner {
|
39
|
+
LibNftIdSet.remove(_activeObjects, objectNftId);
|
40
|
+
}
|
41
|
+
|
42
|
+
function nftIds() external view returns (uint256 ids) {
|
43
|
+
return LibNftIdSet.size(_allObjects);
|
44
|
+
}
|
45
|
+
|
46
|
+
function getNftId(uint256 idx) external view returns (NftId) {
|
47
|
+
return LibNftIdSet.getElementAt(_allObjects, idx);
|
48
|
+
}
|
49
|
+
|
50
|
+
function exists(NftId objectNftId) external view returns (bool) {
|
51
|
+
return LibNftIdSet.contains(_allObjects, objectNftId);
|
52
|
+
}
|
53
|
+
|
54
|
+
function activeNftIds() external view returns (uint256 ids) {
|
55
|
+
return LibNftIdSet.size(_activeObjects);
|
56
|
+
}
|
57
|
+
|
58
|
+
function getActiveNftId(uint256 idx) external view returns (NftId) {
|
59
|
+
return LibNftIdSet.getElementAt(_activeObjects, idx);
|
60
|
+
}
|
61
|
+
|
62
|
+
function isActive(NftId objectNftId) external view returns (bool) {
|
63
|
+
return LibNftIdSet.contains(_activeObjects, objectNftId);
|
64
|
+
}
|
65
|
+
}
|
@@ -56,20 +56,9 @@ contract NftOwnable is
|
|
56
56
|
function linkToRegisteredNftId()
|
57
57
|
public
|
58
58
|
virtual
|
59
|
+
returns (NftId nftId)
|
59
60
|
{
|
60
|
-
|
61
|
-
|
62
|
-
if ($._nftId.gtz()) {
|
63
|
-
revert ErrorNftOwnableAlreadyLinked($._nftId);
|
64
|
-
}
|
65
|
-
|
66
|
-
address contractAddress = address(this);
|
67
|
-
|
68
|
-
if (!getRegistry().isRegistered(contractAddress)) {
|
69
|
-
revert ErrorNftOwnableContractNotRegistered(contractAddress);
|
70
|
-
}
|
71
|
-
|
72
|
-
$._nftId = getRegistry().getNftId(contractAddress);
|
61
|
+
return _linkToNftOwnable(address(this));
|
73
62
|
}
|
74
63
|
|
75
64
|
function getNftId() public view virtual override returns (NftId) {
|
@@ -6,17 +6,18 @@ import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Recei
|
|
6
6
|
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
7
7
|
|
8
8
|
import {Amount} from "../type/Amount.sol";
|
9
|
-
import {ClaimId
|
9
|
+
import {ClaimId} from "../type/ClaimId.sol";
|
10
10
|
import {ERC165} from "./ERC165.sol";
|
11
11
|
import {IPolicyHolder} from "./IPolicyHolder.sol";
|
12
12
|
import {NftId} from "../type/NftId.sol";
|
13
|
-
import {PayoutId} from "../type/PayoutId.sol";
|
13
|
+
import {PayoutId, PayoutIdLib} from "../type/PayoutId.sol";
|
14
14
|
import {RegistryLinked} from "./RegistryLinked.sol";
|
15
|
+
import {IRegistry} from "../registry/IRegistry.sol";
|
15
16
|
|
16
17
|
/// @dev template implementation for IPolicyHolder
|
17
18
|
contract PolicyHolder is
|
18
19
|
ERC165,
|
19
|
-
RegistryLinked,
|
20
|
+
RegistryLinked, // TODO need upgradeable version
|
20
21
|
IPolicyHolder
|
21
22
|
{
|
22
23
|
// keccak256(abi.encode(uint256(keccak256("etherisc.storage.PolicyHolder")) - 1)) & ~bytes32(uint256(0xff));
|
@@ -24,7 +25,8 @@ contract PolicyHolder is
|
|
24
25
|
bytes32 public constant POLICY_HOLDER_STORAGE_LOCATION_V1 = 0x07ebcf49758b6ed3af50fa146bec0abe157c0218fe65dc0874c286e9d5da4f00;
|
25
26
|
|
26
27
|
struct PolicyHolderStorage {
|
27
|
-
mapping(NftId policyId => mapping(
|
28
|
+
mapping(NftId policyId => mapping(PayoutId payoutId => address beneficiary)) _beneficiary;
|
29
|
+
address _beneficiaryDefault;
|
28
30
|
}
|
29
31
|
|
30
32
|
function initializePolicyHolder(
|
@@ -36,9 +38,15 @@ contract PolicyHolder is
|
|
36
38
|
onlyInitializing()
|
37
39
|
{
|
38
40
|
initializeRegistryLinked(registryAddress);
|
41
|
+
|
42
|
+
_getPolicyHolderStorage()._beneficiaryDefault = beneficiaryDefault;
|
43
|
+
|
39
44
|
registerInterface(type(IPolicyHolder).interfaceId);
|
40
45
|
}
|
41
46
|
|
47
|
+
/// @dev empty default implementation
|
48
|
+
function requestPayout(NftId requestingPolicyNftId, Amount requestedPayoutAmount) external { }
|
49
|
+
|
42
50
|
/// @dev empty default implementation
|
43
51
|
function policyActivated(NftId policyNftId) external {}
|
44
52
|
|
@@ -51,14 +59,14 @@ contract PolicyHolder is
|
|
51
59
|
/// @dev empty default implementation
|
52
60
|
function payoutExecuted(NftId policyNftId, PayoutId payoutId, address beneficiary, Amount amount) external {}
|
53
61
|
|
54
|
-
/// @dev returns
|
62
|
+
/// @dev returns payout specific beneficiary
|
55
63
|
/// when no such beneficiary is defined the policy specific beneficiary is returned
|
56
|
-
function getBeneficiary(NftId policyNftId,
|
57
|
-
beneficiary = _getPolicyHolderStorage()._beneficiary[policyNftId][
|
64
|
+
function getBeneficiary(NftId policyNftId, PayoutId payoutId) external virtual view returns (address beneficiary) {
|
65
|
+
beneficiary = _getPolicyHolderStorage()._beneficiary[policyNftId][payoutId];
|
58
66
|
|
59
67
|
// fallback to claim independent beneficiary
|
60
|
-
if(beneficiary == address(0) &&
|
61
|
-
beneficiary = _getPolicyHolderStorage()._beneficiary[policyNftId][
|
68
|
+
if(beneficiary == address(0) && payoutId.gtz()) {
|
69
|
+
beneficiary = _getPolicyHolderStorage()._beneficiary[policyNftId][PayoutIdLib.zero()];
|
62
70
|
}
|
63
71
|
}
|
64
72
|
|
@@ -76,14 +84,14 @@ contract PolicyHolder is
|
|
76
84
|
return IERC721Receiver.onERC721Received.selector;
|
77
85
|
}
|
78
86
|
|
79
|
-
/// @dev sets policy specific beneficiary (used when no
|
87
|
+
/// @dev sets policy specific beneficiary (used when no payout specific beneficiary is defined)
|
80
88
|
function _setBeneficiary(NftId policyNftId, address beneficiary) internal {
|
81
|
-
_setBeneficiary(policyNftId,
|
89
|
+
_setBeneficiary(policyNftId, PayoutIdLib.zero(), beneficiary);
|
82
90
|
}
|
83
91
|
|
84
92
|
/// @dev sets policy and claim specific beneficiary
|
85
|
-
function _setBeneficiary(NftId policyNftId,
|
86
|
-
_getPolicyHolderStorage()._beneficiary[policyNftId][
|
93
|
+
function _setBeneficiary(NftId policyNftId, PayoutId payoutId, address beneficiary) internal {
|
94
|
+
_getPolicyHolderStorage()._beneficiary[policyNftId][payoutId] = beneficiary;
|
87
95
|
}
|
88
96
|
|
89
97
|
function _getPolicyHolderStorage() private pure returns (PolicyHolderStorage storage $) {
|
@@ -11,6 +11,7 @@ import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.s
|
|
11
11
|
import {Timestamp, TimestampLib} from "../type/Timestamp.sol";
|
12
12
|
import {UpgradableProxyWithAdmin} from "./UpgradableProxyWithAdmin.sol";
|
13
13
|
import {Version, VersionLib} from "../type/Version.sol";
|
14
|
+
import {NftId} from "../type/NftId.sol";
|
14
15
|
|
15
16
|
/// @dev manages proxy deployments for upgradable contracs of type IVersionable
|
16
17
|
contract ProxyManager is
|
@@ -79,6 +80,31 @@ contract ProxyManager is
|
|
79
80
|
emit LogProxyManagerVersionableDeployed(address(_proxy), initialImplementation);
|
80
81
|
}
|
81
82
|
|
83
|
+
function deployDetermenistic(address initialImplementation, bytes memory initializationData, bytes32 salt)
|
84
|
+
public
|
85
|
+
virtual
|
86
|
+
onlyOwner()
|
87
|
+
returns (IVersionable versionable)
|
88
|
+
{
|
89
|
+
if (_versions.length > 0) {
|
90
|
+
revert ErrorProxyManagerAlreadyDeployed();
|
91
|
+
}
|
92
|
+
|
93
|
+
address currentProxyOwner = getOwner();
|
94
|
+
address initialProxyAdminOwner = address(this);
|
95
|
+
|
96
|
+
_proxy = new UpgradableProxyWithAdmin{salt: salt}(
|
97
|
+
initialImplementation,
|
98
|
+
initialProxyAdminOwner,
|
99
|
+
getDeployData(currentProxyOwner, initializationData)
|
100
|
+
);
|
101
|
+
|
102
|
+
versionable = IVersionable(address(_proxy));
|
103
|
+
_updateVersionHistory(versionable.getVersion(), initialImplementation, currentProxyOwner);
|
104
|
+
|
105
|
+
emit LogProxyManagerVersionableDeployed(address(_proxy), initialImplementation);
|
106
|
+
}
|
107
|
+
|
82
108
|
/// @dev upgrade existing contract
|
83
109
|
function upgrade(address newImplementation, bytes memory upgradeData)
|
84
110
|
public
|
@@ -106,6 +132,10 @@ contract ProxyManager is
|
|
106
132
|
|
107
133
|
}
|
108
134
|
|
135
|
+
function linkToProxy() public returns (NftId) {
|
136
|
+
return _linkToNftOwnable(address(_proxy));
|
137
|
+
}
|
138
|
+
|
109
139
|
function getDeployData(address proxyOwner, bytes memory deployData) public pure returns (bytes memory data) {
|
110
140
|
return abi.encodeWithSelector(
|
111
141
|
IVersionable.initializeVersionable.selector,
|
@@ -119,7 +149,7 @@ contract ProxyManager is
|
|
119
149
|
upgradeData);
|
120
150
|
}
|
121
151
|
|
122
|
-
function getProxy() public returns (UpgradableProxyWithAdmin) {
|
152
|
+
function getProxy() public view returns (UpgradableProxyWithAdmin) {
|
123
153
|
return _proxy;
|
124
154
|
}
|
125
155
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
2
|
-
pragma solidity ^0.8.
|
2
|
+
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/access/manager/AccessManagedUpgradeable.sol";
|
5
5
|
import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessManaged.sol";
|
@@ -2,76 +2,167 @@
|
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {Amount} from "../type/Amount.sol";
|
5
|
-
import {IKeyValueStore} from "../shared/IKeyValueStore.sol";
|
6
5
|
import {IComponent} from "../shared/IComponent.sol";
|
7
6
|
import {IVersionable} from "../shared/IVersionable.sol";
|
8
7
|
import {NftId} from "../type/NftId.sol";
|
8
|
+
import {NftIdSetManager} from "../shared/NftIdSetManager.sol";
|
9
9
|
import {ObjectType} from "../type/ObjectType.sol";
|
10
|
+
import {Seconds} from "../type/Seconds.sol";
|
11
|
+
import {StakingReader} from "./StakingReader.sol";
|
12
|
+
import {StakingStore} from "./StakingStore.sol";
|
10
13
|
import {Timestamp} from "../type/Timestamp.sol";
|
11
14
|
import {UFixed} from "../type/UFixed.sol";
|
12
15
|
|
13
16
|
interface IStaking is
|
14
|
-
IKeyValueStore,
|
15
17
|
IComponent,
|
16
18
|
IVersionable
|
17
19
|
{
|
20
|
+
// staking rate
|
21
|
+
event LogStakingStakingRateSet(uint256 chainId, address token, UFixed oldStakingRate, UFixed newStakingRate);
|
22
|
+
|
23
|
+
// target parameters
|
24
|
+
event LogStakingLockingPeriodSet(NftId targetNftId, Seconds oldLockingPeriod, Seconds lockingPeriod);
|
25
|
+
event LogStakingRewardRateSet(NftId targetNftId, UFixed oldRewardRate, UFixed rewardRate);
|
26
|
+
|
27
|
+
// modifiers
|
28
|
+
error ErrorStakingNotStake(NftId stakeNftId);
|
29
|
+
error ErrorStakingNotTarget(NftId targetNftId);
|
30
|
+
|
31
|
+
error ErrorStakingNotStakingOwner();
|
32
|
+
error ErrorStakingNotNftOwner(NftId nftId);
|
33
|
+
|
34
|
+
// staking rate
|
35
|
+
error ErrorStakingTokenNotRegistered(uint256 chainId, address token);
|
36
|
+
|
37
|
+
// check dip balance and allowance
|
38
|
+
error ErrorStakingDipBalanceInsufficient(address owner, uint256 amount, uint256 dipBalance);
|
39
|
+
error ErrorStakingDipAllowanceInsufficient(address owner, address tokenHandler, uint256 amount, uint256 dipAllowance);
|
40
|
+
|
41
|
+
error ErrorStakingStakingReaderStakingMismatch(address stakingByStakingReader);
|
42
|
+
error ErrorStakingTargetAlreadyRegistered(NftId targetNftId);
|
43
|
+
error ErrorStakingTargetNftIdZero();
|
44
|
+
error ErrorStakingTargetTypeNotSupported(NftId targetNftId, ObjectType objectType);
|
45
|
+
error ErrorStakingTargetUnexpectedObjectType(NftId targetNftId, ObjectType expectedObjectType, ObjectType actualObjectType);
|
46
|
+
error ErrorStakingLockingPeriodZero(NftId targetNftId);
|
47
|
+
error ErrorStakingLockingPeriodTooLong(NftId targetNftId, Seconds maxLockingPeriod, Seconds lockingPeriod);
|
48
|
+
error ErrorStakingRewardRateTooHigh(NftId targetNftId, UFixed maxRewardRate, UFixed rewardRate);
|
49
|
+
error ErrorStakingTargetNotFound(NftId targetNftId);
|
50
|
+
error ErrorStakingTargetTokenNotFound(NftId targetNftId, uint256 chainId, address token);
|
51
|
+
|
52
|
+
error ErrorStakingTargetNotActive(NftId targetNftId);
|
53
|
+
error ErrorStakingStakeAmountZero(NftId targetNftId);
|
18
54
|
|
19
55
|
// info for individual stake
|
20
56
|
struct StakeInfo {
|
21
|
-
NftId targetNftId;
|
22
|
-
Amount stakeAmount;
|
23
|
-
Amount rewardAmount;
|
24
57
|
Timestamp lockedUntil;
|
25
|
-
Timestamp rewardsUpdatedAt;
|
26
58
|
}
|
27
59
|
|
28
60
|
struct TargetInfo {
|
29
|
-
NftId targetNftid;
|
30
61
|
ObjectType objectType;
|
31
62
|
uint256 chainId;
|
32
|
-
|
63
|
+
Seconds lockingPeriod;
|
64
|
+
UFixed rewardRate;
|
33
65
|
}
|
34
66
|
|
35
|
-
// rate management
|
67
|
+
// staking rate management
|
68
|
+
|
69
|
+
/// @dev sets the rate that converts 1 token of total value locked into the
|
70
|
+
/// the required staked dip amount to back up the locked token value
|
36
71
|
function setStakingRate(uint256 chainId, address token, UFixed stakingRate) external;
|
37
72
|
|
38
|
-
// reward management
|
39
|
-
function setRewardRate(NftId targetNftId, UFixed rewardRate) external;
|
40
|
-
function refillRewardReserves(NftId targetNftId, Amount dipAmount) external;
|
41
|
-
function withdrawRewardReserves(NftId targetNftId, Amount dipAmount) external;
|
42
73
|
|
43
74
|
// target management
|
44
|
-
function registerTarget(NftId targetNftId) external;
|
45
|
-
function increaseTvl(NftId targetNftId, address token, Amount amount) external;
|
46
|
-
function decreaseTvl(NftId targetNftId, address token, Amount amount) external;
|
47
75
|
|
48
|
-
function
|
76
|
+
function registerTarget(
|
77
|
+
NftId targetNftId,
|
78
|
+
ObjectType expectedObjectType,
|
79
|
+
uint256 chainId,
|
80
|
+
Seconds initialLockingPeriod,
|
81
|
+
UFixed initialRewardRate
|
82
|
+
) external;
|
83
|
+
|
84
|
+
|
85
|
+
/// @dev set the stake locking period to the specified duration.
|
86
|
+
/// permissioned: only the staking service may call this function
|
87
|
+
function setLockingPeriod(NftId targetNftId, Seconds lockingPeriod) external;
|
88
|
+
|
89
|
+
/// @dev update the target specific reward rate.
|
90
|
+
/// permissioned: only the staking service may call this function
|
91
|
+
function setRewardRate(NftId targetNftId, UFixed rewardRate) external;
|
92
|
+
|
93
|
+
/// @dev (re)fills the staking reward reserves for the specified target
|
94
|
+
/// unpermissioned: anybody may fill up staking reward reserves
|
95
|
+
function refillRewardReserves(NftId targetNftId, Amount dipAmount) external returns (Amount newBalance);
|
96
|
+
|
97
|
+
/// @dev defunds the staking reward reserves for the specified target
|
98
|
+
/// permissioned: only the staking service may call this function
|
99
|
+
function withdrawRewardReserves(NftId targetNftId, Amount dipAmount) external returns (Amount newBalance);
|
100
|
+
|
101
|
+
|
102
|
+
/// @dev increases the total value locked amount for the specified target by the provided token amount.
|
103
|
+
/// function is called when a new policy is collateralized.
|
104
|
+
/// function restricted to the pool service.
|
105
|
+
function increaseTotalValueLocked(NftId targetNftId, address token, Amount amount) external returns (Amount newBalance);
|
106
|
+
|
107
|
+
|
108
|
+
/// @dev decreases the total value locked amount for the specified target by the provided token amount.
|
109
|
+
/// function is called when a new policy is closed or payouts are executed.
|
110
|
+
/// function restricted to the pool service.
|
111
|
+
function decreaseTotalValueLocked(NftId targetNftId, address token, Amount amount) external returns (Amount newBalance);
|
112
|
+
|
113
|
+
|
49
114
|
function updateRemoteTvl(NftId targetNftId, address token, Amount amount) external;
|
50
115
|
|
51
116
|
// staking functions
|
52
|
-
function createStake(NftId targetNftId, Amount dipAmount) external returns(NftId stakeNftId);
|
53
|
-
function stake(NftId stakeNftId, Amount dipAmount) external;
|
54
|
-
function restakeRewards(NftId stakeNftId) external;
|
55
|
-
function restakeToNewTarget(NftId stakeNftId, NftId newTarget) external;
|
56
|
-
function unstake(NftId stakeNftId) external;
|
57
|
-
function unstake(NftId stakeNftId, Amount dipAmount) external;
|
58
|
-
function claimRewards(NftId stakeNftId) external;
|
59
117
|
|
60
|
-
|
61
|
-
|
118
|
+
/// @dev creat a new stake info object
|
119
|
+
/// permissioned: only staking service may call this function.
|
120
|
+
function createStake(NftId stakeNftId, NftId targetNftId, Amount dipAmount) external;
|
62
121
|
|
63
|
-
|
64
|
-
|
122
|
+
/// @dev increase the staked dip by dipAmount for the specified stake.
|
123
|
+
/// staking rewards are updated and added to the staked dips as well.
|
124
|
+
/// the function returns the new total amount of staked dips.
|
125
|
+
function stake(NftId stakeNftId, Amount dipAmount) external returns (Amount stakeBalance);
|
65
126
|
|
66
|
-
|
67
|
-
|
127
|
+
/// @dev restakes the dips to a new target.
|
128
|
+
/// the sum of the staked dips and the accumulated rewards will be restaked.
|
129
|
+
/// permissioned: only staking service may call this function.
|
130
|
+
function restake(NftId stakeNftId, NftId newTargetNftId) external returns (NftId newStakeNftId);
|
68
131
|
|
69
|
-
|
70
|
-
|
132
|
+
/// @dev retuns the specified amount of dips to the holder of the specified stake nft.
|
133
|
+
/// if dipAmount is set to Amount.max() all staked dips and all rewards are transferred to
|
134
|
+
/// permissioned: only staking service may call this function.
|
135
|
+
function unstake(NftId stakeNftId)
|
136
|
+
external
|
137
|
+
returns (
|
138
|
+
Amount unstakedAmount,
|
139
|
+
Amount rewardsClaimedAmount
|
140
|
+
);
|
71
141
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
142
|
+
/// @dev update stake rewards for current time.
|
143
|
+
/// may be called before an announement of a decrease of a reward rate reduction.
|
144
|
+
/// calling this functions ensures that reward balance is updated using the current (higher) reward rate.
|
145
|
+
/// unpermissioned.
|
146
|
+
function updateRewards(NftId stakeNftId) external;
|
147
|
+
|
148
|
+
/// @dev transfers all rewards accumulated so far to the holder of the specified stake nft.
|
149
|
+
/// permissioned: only staking service may call this function.
|
150
|
+
function claimRewards(NftId stakeNftId)
|
151
|
+
external
|
152
|
+
returns (
|
153
|
+
Amount rewardsClaimedAmount
|
154
|
+
);
|
155
|
+
|
156
|
+
//--- helper functions --------------------------------------------------//
|
157
|
+
|
158
|
+
/// @dev transfers the specified amount of dips from the from address to the staking wallet.
|
159
|
+
function collectDipAmount(address from, Amount dipAmount) external;
|
160
|
+
|
161
|
+
/// @dev transfers the specified amount of dips from the staking wallet to the to addess.
|
162
|
+
function transferDipAmount(address to, Amount dipAmount) external;
|
163
|
+
|
164
|
+
//--- view and pure functions -------------------------------------------//
|
76
165
|
|
166
|
+
function getStakingStore() external view returns (StakingStore stakingStore);
|
167
|
+
function getStakingReader() external view returns (StakingReader reader);
|
77
168
|
}
|