@etherisc/gif-next 0.0.2-df73b56-462 → 0.0.2-e016345-525
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -6
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.dbg.json +4 -0
- package/artifacts/contracts/accounting/AccountingService.sol/AccountingService.json +944 -0
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.dbg.json +4 -0
- package/artifacts/contracts/accounting/AccountingServiceManager.sol/AccountingServiceManager.json +746 -0
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.dbg.json +4 -0
- package/artifacts/contracts/accounting/IAccountingService.sol/IAccountingService.json +711 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +96 -37
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.dbg.json +4 -0
- package/artifacts/contracts/authorization/AccessAdmin.sol/IAccessManagedChecker.json +24 -0
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +67 -11
- 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 +60 -13
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.json +40 -3
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.json +19 -0
- package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.dbg.json +4 -0
- package/artifacts/contracts/authorization/ReleaseAccessManager.sol/ReleaseAccessManager.json +1196 -0
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +68 -5
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +159 -209
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +82 -22
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +99 -125
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +175 -86
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +104 -60
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +87 -108
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +52 -0
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/DamageLevel.sol/DamageLevelLib.json +22 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePool.sol/FirePool.json +1441 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +502 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +1991 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +470 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireUSD.sol/FireUSD.json +376 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +187 -169
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol/SimpleDistributionAuthorization.json +470 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +131 -157
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +262 -202
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePoolAuthorization.sol/SimplePoolAuthorization.json +502 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +1 -1
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +562 -252
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProductAuthorization.sol/SimpleProductAuthorization.json +470 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +147 -42
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +116 -48
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +53 -101
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +149 -60
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +186 -125
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +58 -85
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +514 -88
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +113 -148
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +72 -40
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +185 -124
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.dbg.json +4 -0
- package/artifacts/contracts/instance/RiskSet.sol/RiskSet.json +810 -0
- 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 +46 -5
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +119 -169
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +84 -24
- 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 +82 -103
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +43 -9
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +95 -121
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +142 -79
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +92 -36
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +95 -149
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +114 -22
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +143 -150
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +86 -66
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +48 -33
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +82 -142
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +272 -185
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +95 -160
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +408 -263
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +109 -41
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +114 -45
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +68 -36
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +156 -141
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +82 -22
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +183 -90
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +102 -58
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +63 -7
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +64 -8
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +96 -19
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +80 -51
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +139 -119
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +1 -1
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.json +29 -0
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +215 -125
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +102 -54
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +165 -107
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +85 -45
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +152 -137
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +1 -1
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +76 -26
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +66 -30
- 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 +91 -15
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +114 -35
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.json +5 -18
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +135 -51
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +203 -162
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +89 -172
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +65 -29
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +47 -6
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +123 -225
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +66 -8
- 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 +72 -80
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +478 -477
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +96 -72
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +42 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +1 -1
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +402 -6
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/IInstanceAdminHelper.json +24 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ITargetHelper.json +30 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +61 -64
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +425 -261
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +82 -103
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.json +36 -0
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.json +36 -0
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.json +16 -0
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/IPolicyHolder.sol/IPolicyHolder.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +29 -0
- 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 +29 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +94 -120
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.json +42 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.json +42 -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 +18 -2
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +3 -3
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +66 -8
- 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 +42 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +388 -35
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandlerBase.json +395 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +88 -24
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +79 -100
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +29 -21
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +2 -2
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +158 -170
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +46 -5
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +81 -51
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +7 -12
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +82 -53
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +69 -33
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +144 -103
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +2 -2
- package/artifacts/contracts/type/AddressSet.sol/LibAddressSet.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.dbg.json +1 -1
- package/artifacts/contracts/type/Amount.sol/AmountLib.json +32 -8
- 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 +28 -4
- 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/Key32Set.sol/LibKey32Set.dbg.json +4 -0
- package/artifacts/contracts/type/Key32Set.sol/LibKey32Set.json +33 -0
- package/artifacts/contracts/type/NftId.sol/NftIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/NftId.sol/NftIdLib.json +23 -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 +2 -2
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/PayoutId.sol/PayoutIdLib.json +19 -19
- 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 +99 -5
- 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/StateId.sol/StateIdLib.json +15 -2
- 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/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +2 -2
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +15 -2
- package/artifacts/contracts/type/Version.sol/VersionLib.dbg.json +1 -1
- package/artifacts/contracts/type/Version.sol/VersionPartLib.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/IVersionable.sol/IVersionable.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/ProxyManager.sol/ProxyManager.json +44 -12
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/accounting/AccountingService.sol +244 -0
- package/contracts/accounting/AccountingServiceManager.sol +38 -0
- package/contracts/accounting/IAccountingService.sol +42 -0
- package/contracts/authorization/AccessAdmin.sol +86 -62
- package/contracts/authorization/Authorization.sol +111 -39
- package/contracts/authorization/IAccess.sol +1 -0
- package/contracts/authorization/IAccessAdmin.sol +4 -2
- package/contracts/authorization/IAuthorization.sol +13 -7
- package/contracts/authorization/IServiceAuthorization.sol +3 -1
- package/contracts/authorization/ReleaseAccessManager.sol +38 -0
- package/contracts/authorization/ServiceAuthorization.sol +26 -10
- package/contracts/distribution/BasicDistribution.sol +8 -7
- package/contracts/distribution/BasicDistributionAuthorization.sol +1 -1
- package/contracts/distribution/Distribution.sol +32 -40
- package/contracts/distribution/DistributionService.sol +80 -59
- package/contracts/distribution/IDistributionComponent.sol +1 -1
- package/contracts/distribution/IDistributionService.sol +5 -6
- package/contracts/examples/fire/DamageLevel.sol +59 -0
- package/contracts/examples/fire/FirePool.sol +90 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +35 -0
- package/contracts/examples/fire/FireProduct.sol +436 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +11 -4
- package/contracts/examples/unpermissioned/SimpleDistributionAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +4 -4
- package/contracts/examples/unpermissioned/SimplePool.sol +37 -6
- package/contracts/examples/unpermissioned/SimplePoolAuthorization.sol +28 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +24 -23
- package/contracts/examples/unpermissioned/SimpleProductAuthorization.sol +28 -0
- package/contracts/instance/BundleSet.sol +38 -34
- package/contracts/instance/IInstance.sol +11 -3
- package/contracts/instance/IInstanceService.sol +7 -29
- package/contracts/instance/Instance.sol +36 -26
- package/contracts/instance/InstanceAdmin.sol +38 -38
- package/contracts/instance/InstanceAuthorizationV3.sol +50 -32
- package/contracts/instance/InstanceReader.sol +168 -19
- package/contracts/instance/InstanceService.sol +51 -126
- package/contracts/instance/RiskSet.sol +119 -0
- package/contracts/instance/base/ObjectSet.sol +24 -25
- package/contracts/instance/module/IComponents.sol +7 -5
- package/contracts/instance/module/IPolicy.sol +4 -3
- package/contracts/instance/module/IRisk.sol +1 -0
- package/contracts/oracle/BasicOracle.sol +0 -1
- package/contracts/oracle/IOracleService.sol +2 -1
- package/contracts/oracle/Oracle.sol +4 -15
- package/contracts/oracle/OracleService.sol +104 -76
- package/contracts/pool/BasicPool.sol +33 -24
- package/contracts/pool/BasicPoolAuthorization.sol +12 -2
- package/contracts/pool/BundleService.sol +68 -81
- package/contracts/pool/IBundleService.sol +2 -14
- package/contracts/pool/IPoolComponent.sol +1 -7
- package/contracts/pool/IPoolService.sol +30 -37
- package/contracts/pool/Pool.sol +123 -120
- package/contracts/pool/PoolService.sol +261 -154
- package/contracts/product/ApplicationService.sol +28 -16
- package/contracts/product/BasicProduct.sol +8 -12
- package/contracts/product/BasicProductAuthorization.sol +1 -3
- package/contracts/product/ClaimService.sol +110 -69
- package/contracts/product/IApplicationService.sol +5 -2
- package/contracts/product/IClaimService.sol +3 -2
- package/contracts/product/IPolicyService.sol +18 -5
- package/contracts/product/IPricingService.sol +9 -9
- package/contracts/product/IProductComponent.sol +23 -3
- package/contracts/product/PolicyService.sol +277 -187
- package/contracts/product/PricingService.sol +8 -8
- package/contracts/product/Product.sol +76 -75
- package/contracts/product/RiskService.sol +14 -3
- package/contracts/registry/ChainNft.sol +6 -9
- package/contracts/registry/IRegistry.sol +8 -3
- package/contracts/registry/IRegistryService.sol +5 -12
- package/contracts/registry/ITransferInterceptor.sol +1 -2
- package/contracts/registry/Registry.sol +29 -6
- package/contracts/registry/RegistryAdmin.sol +28 -35
- package/contracts/registry/RegistryService.sol +33 -44
- package/contracts/registry/ReleaseLifecycle.sol +6 -3
- package/contracts/registry/ReleaseRegistry.sol +202 -208
- package/contracts/registry/ServiceAuthorizationV3.sol +28 -52
- package/contracts/shared/Component.sol +56 -105
- package/contracts/shared/ComponentService.sol +376 -324
- package/contracts/shared/ComponentVerifyingService.sol +27 -16
- package/contracts/shared/ContractLib.sol +196 -10
- package/contracts/shared/IComponent.sol +6 -14
- package/contracts/shared/IComponentService.sol +45 -37
- package/contracts/shared/IInstanceLinkedComponent.sol +3 -22
- package/contracts/shared/ILifecycle.sol +3 -1
- package/contracts/shared/INftOwnable.sol +2 -0
- package/contracts/shared/IRegisterable.sol +11 -0
- package/contracts/shared/InstanceLinkedComponent.sol +68 -43
- package/contracts/shared/KeyValueStore.sol +1 -1
- package/contracts/shared/Lifecycle.sol +15 -4
- package/contracts/shared/NftOwnable.sol +23 -3
- package/contracts/shared/PolicyHolder.sol +4 -0
- package/contracts/shared/Registerable.sol +15 -7
- package/contracts/shared/RegistryLinked.sol +6 -12
- package/contracts/shared/Service.sol +4 -7
- package/contracts/shared/TokenHandler.sol +316 -66
- package/contracts/shared/TokenHandlerDeployerLib.sol +10 -2
- package/contracts/staking/IStaking.sol +9 -4
- package/contracts/staking/IStakingService.sol +0 -3
- package/contracts/staking/Staking.sol +41 -24
- package/contracts/staking/StakingReader.sol +12 -5
- package/contracts/staking/StakingService.sol +56 -23
- package/contracts/type/Amount.sol +15 -0
- package/contracts/type/ClaimId.sol +6 -1
- package/contracts/type/Key32.sol +2 -2
- package/contracts/type/Key32Set.sol +62 -0
- package/contracts/type/NftId.sol +7 -0
- package/contracts/type/ObjectType.sol +11 -0
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/RiskId.sol +30 -4
- package/contracts/type/RoleId.sol +0 -12
- package/contracts/type/StateId.sol +14 -1
- package/contracts/type/UFixed.sol +4 -0
- package/contracts/upgradeability/ProxyManager.sol +2 -1
- package/package.json +4 -3
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +0 -4
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.json +0 -290
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +0 -4
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +0 -390
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
- package/contracts/authorization/IModuleAuthorization.sol +0 -21
- package/contracts/authorization/ModuleAuthorization.sol +0 -78
- package/contracts/shared/InitializableCustom.sol +0 -177
@@ -0,0 +1,244 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {Amount, AmountLib} from "../type/Amount.sol";
|
5
|
+
import {Fee} from "../type/Fee.sol";
|
6
|
+
import {IAccountingService} from "./IAccountingService.sol";
|
7
|
+
import {InstanceStore} from "../instance/InstanceStore.sol";
|
8
|
+
|
9
|
+
import {Amount, AmountLib} from "../type/Amount.sol";
|
10
|
+
import {Fee} from "../type/Fee.sol";
|
11
|
+
import {NftId} from "../type/NftId.sol";
|
12
|
+
import {ObjectType, ACCOUNTING, BUNDLE, DISTRIBUTION, DISTRIBUTOR, POOL, PRODUCT} from "../type/ObjectType.sol";
|
13
|
+
import {Service} from "../shared/Service.sol";
|
14
|
+
|
15
|
+
|
16
|
+
contract AccountingService is
|
17
|
+
Service,
|
18
|
+
IAccountingService
|
19
|
+
{
|
20
|
+
bool private constant INCREASE = true;
|
21
|
+
bool private constant DECREASE = false;
|
22
|
+
|
23
|
+
function _initialize(
|
24
|
+
address owner,
|
25
|
+
bytes memory data
|
26
|
+
)
|
27
|
+
internal
|
28
|
+
virtual override
|
29
|
+
initializer()
|
30
|
+
{
|
31
|
+
(
|
32
|
+
address registryAddress,
|
33
|
+
address authority
|
34
|
+
) = abi.decode(data, (address, address));
|
35
|
+
|
36
|
+
_initializeService(registryAddress, authority, owner);
|
37
|
+
|
38
|
+
_registerInterface(type(IAccountingService).interfaceId);
|
39
|
+
}
|
40
|
+
|
41
|
+
function decreaseComponentFees(
|
42
|
+
InstanceStore instanceStore,
|
43
|
+
NftId componentNftId,
|
44
|
+
Amount feeAmount
|
45
|
+
)
|
46
|
+
external
|
47
|
+
virtual
|
48
|
+
{
|
49
|
+
// TODO: validate that the nft belongs to a component
|
50
|
+
_changeTargetBalance(DECREASE, instanceStore, componentNftId, AmountLib.zero(), feeAmount);
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
function increaseProductFees(
|
55
|
+
InstanceStore instanceStore,
|
56
|
+
NftId productNftId,
|
57
|
+
Amount feeAmount
|
58
|
+
)
|
59
|
+
external
|
60
|
+
virtual
|
61
|
+
// TODO re-enable once role granting is stable and fixed
|
62
|
+
// restricted()
|
63
|
+
{
|
64
|
+
_checkNftType(productNftId, PRODUCT());
|
65
|
+
_changeTargetBalance(INCREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
function decreaseProductFees(InstanceStore instanceStore, NftId productNftId, Amount feeAmount)
|
70
|
+
external
|
71
|
+
virtual
|
72
|
+
// TODO re-enable once role granting is stable and fixed
|
73
|
+
// restricted()
|
74
|
+
{
|
75
|
+
_checkNftType(productNftId, PRODUCT());
|
76
|
+
_changeTargetBalance(DECREASE, instanceStore, productNftId, AmountLib.zero(), feeAmount);
|
77
|
+
}
|
78
|
+
|
79
|
+
function increaseDistributionBalance(
|
80
|
+
InstanceStore instanceStore,
|
81
|
+
NftId distributionNftId,
|
82
|
+
Amount amount,
|
83
|
+
Amount feeAmount
|
84
|
+
)
|
85
|
+
external
|
86
|
+
virtual
|
87
|
+
// TODO re-enable once role granting is stable and fixed
|
88
|
+
// restricted()
|
89
|
+
{
|
90
|
+
_checkNftType(distributionNftId, DISTRIBUTION());
|
91
|
+
_changeTargetBalance(INCREASE, instanceStore, distributionNftId, amount, feeAmount);
|
92
|
+
}
|
93
|
+
|
94
|
+
|
95
|
+
function decreaseDistributionBalance(
|
96
|
+
InstanceStore instanceStore,
|
97
|
+
NftId distributionNftId,
|
98
|
+
Amount amount,
|
99
|
+
Amount feeAmount
|
100
|
+
)
|
101
|
+
external
|
102
|
+
virtual
|
103
|
+
// TODO re-enable once role granting is stable and fixed
|
104
|
+
// restricted()
|
105
|
+
{
|
106
|
+
_checkNftType(distributionNftId, DISTRIBUTION());
|
107
|
+
_changeTargetBalance(DECREASE, instanceStore, distributionNftId, amount, feeAmount);
|
108
|
+
}
|
109
|
+
|
110
|
+
function increaseDistributorBalance(
|
111
|
+
InstanceStore instanceStore,
|
112
|
+
NftId distributorNftId,
|
113
|
+
Amount amount,
|
114
|
+
Amount feeAmount
|
115
|
+
)
|
116
|
+
external
|
117
|
+
virtual
|
118
|
+
// TODO re-enable once role granting is stable and fixed
|
119
|
+
// restricted()
|
120
|
+
{
|
121
|
+
_checkNftType(distributorNftId, DISTRIBUTOR());
|
122
|
+
_changeTargetBalance(INCREASE, instanceStore, distributorNftId, amount, feeAmount);
|
123
|
+
}
|
124
|
+
|
125
|
+
function decreaseDistributorBalance(
|
126
|
+
InstanceStore instanceStore,
|
127
|
+
NftId distributorNftId,
|
128
|
+
Amount amount,
|
129
|
+
Amount feeAmount
|
130
|
+
)
|
131
|
+
external
|
132
|
+
virtual
|
133
|
+
// TODO re-enable once role granting is stable and fixed
|
134
|
+
// restricted()
|
135
|
+
{
|
136
|
+
_checkNftType(distributorNftId, DISTRIBUTOR());
|
137
|
+
_changeTargetBalance(DECREASE, instanceStore, distributorNftId, amount, feeAmount);
|
138
|
+
}
|
139
|
+
|
140
|
+
function increasePoolBalance(
|
141
|
+
InstanceStore instanceStore,
|
142
|
+
NftId poolNftId,
|
143
|
+
Amount amount,
|
144
|
+
Amount feeAmount
|
145
|
+
)
|
146
|
+
public
|
147
|
+
virtual
|
148
|
+
// TODO re-enable once role granting is stable and fixed
|
149
|
+
// restricted()
|
150
|
+
{
|
151
|
+
_checkNftType(poolNftId, POOL());
|
152
|
+
_changeTargetBalance(INCREASE, instanceStore, poolNftId, amount, feeAmount);
|
153
|
+
}
|
154
|
+
|
155
|
+
function decreasePoolBalance(
|
156
|
+
InstanceStore instanceStore,
|
157
|
+
NftId poolNftId,
|
158
|
+
Amount amount,
|
159
|
+
Amount feeAmount
|
160
|
+
)
|
161
|
+
public
|
162
|
+
virtual
|
163
|
+
// TODO re-enable once role granting is stable and fixed
|
164
|
+
// restricted()
|
165
|
+
{
|
166
|
+
_checkNftType(poolNftId, POOL());
|
167
|
+
_changeTargetBalance(DECREASE, instanceStore, poolNftId, amount, feeAmount);
|
168
|
+
}
|
169
|
+
|
170
|
+
function increaseBundleBalance(
|
171
|
+
InstanceStore instanceStore,
|
172
|
+
NftId bundleNftId,
|
173
|
+
Amount amount,
|
174
|
+
Amount feeAmount
|
175
|
+
)
|
176
|
+
external
|
177
|
+
virtual
|
178
|
+
// TODO re-enable once role granting is stable and fixed
|
179
|
+
// restricted()
|
180
|
+
{
|
181
|
+
_checkNftType(bundleNftId, BUNDLE());
|
182
|
+
_changeTargetBalance(INCREASE, instanceStore, bundleNftId, amount, feeAmount);
|
183
|
+
}
|
184
|
+
|
185
|
+
function decreaseBundleBalance(
|
186
|
+
InstanceStore instanceStore,
|
187
|
+
NftId bundleNftId,
|
188
|
+
Amount amount,
|
189
|
+
Amount feeAmount
|
190
|
+
)
|
191
|
+
external
|
192
|
+
virtual
|
193
|
+
// TODO re-enable once role granting is stable and fixed
|
194
|
+
// restricted()
|
195
|
+
{
|
196
|
+
_checkNftType(bundleNftId, BUNDLE());
|
197
|
+
_changeTargetBalance(DECREASE, instanceStore, bundleNftId, amount, feeAmount);
|
198
|
+
}
|
199
|
+
|
200
|
+
|
201
|
+
//-------- internal functions ------------------------------------------//
|
202
|
+
|
203
|
+
function _changeTargetBalance(
|
204
|
+
bool increase,
|
205
|
+
InstanceStore instanceStore,
|
206
|
+
NftId targetNftId,
|
207
|
+
Amount amount,
|
208
|
+
Amount feeAmount
|
209
|
+
)
|
210
|
+
internal
|
211
|
+
virtual
|
212
|
+
{
|
213
|
+
Amount totalAmount = amount + feeAmount;
|
214
|
+
|
215
|
+
if(increase) {
|
216
|
+
if(totalAmount.gtz()) { instanceStore.increaseBalance(targetNftId, totalAmount); }
|
217
|
+
if(feeAmount.gtz()) { instanceStore.increaseFees(targetNftId, feeAmount); }
|
218
|
+
} else {
|
219
|
+
if(totalAmount.gtz()) { instanceStore.decreaseBalance(targetNftId, totalAmount); }
|
220
|
+
if(feeAmount.gtz()) { instanceStore.decreaseFees(targetNftId, feeAmount); }
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
|
225
|
+
function _logUpdateFee(NftId productNftId, string memory name, Fee memory feeBefore, Fee memory feeAfter)
|
226
|
+
internal
|
227
|
+
virtual
|
228
|
+
{
|
229
|
+
emit LogComponentServiceUpdateFee(
|
230
|
+
productNftId,
|
231
|
+
name,
|
232
|
+
feeBefore.fractionalFee,
|
233
|
+
feeBefore.fixedFee,
|
234
|
+
feeAfter.fractionalFee,
|
235
|
+
feeAfter.fixedFee
|
236
|
+
);
|
237
|
+
}
|
238
|
+
|
239
|
+
function _getDomain() internal pure virtual override returns(ObjectType) {
|
240
|
+
return ACCOUNTING();
|
241
|
+
}
|
242
|
+
|
243
|
+
|
244
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
import {AccountingService} from "./AccountingService.sol";
|
5
|
+
import {IVersionable} from "../upgradeability/IVersionable.sol";
|
6
|
+
import {ProxyManager} from "../upgradeability/ProxyManager.sol";
|
7
|
+
|
8
|
+
contract AccountingServiceManager is ProxyManager {
|
9
|
+
|
10
|
+
AccountingService private _accountingService;
|
11
|
+
|
12
|
+
/// @dev initializes proxy manager with service implementation
|
13
|
+
constructor(
|
14
|
+
address authority,
|
15
|
+
address registry,
|
16
|
+
bytes32 salt
|
17
|
+
)
|
18
|
+
{
|
19
|
+
AccountingService svc = new AccountingService();
|
20
|
+
bytes memory data = abi.encode(registry, authority);
|
21
|
+
IVersionable versionable = initialize(
|
22
|
+
registry,
|
23
|
+
address(svc),
|
24
|
+
data,
|
25
|
+
salt);
|
26
|
+
|
27
|
+
_accountingService = AccountingService(address(versionable));
|
28
|
+
}
|
29
|
+
|
30
|
+
//--- view functions ----------------------------------------------------//
|
31
|
+
function getAccountingService()
|
32
|
+
external
|
33
|
+
view
|
34
|
+
returns (AccountingService)
|
35
|
+
{
|
36
|
+
return _accountingService;
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
2
|
+
pragma solidity ^0.8.20;
|
3
|
+
|
4
|
+
|
5
|
+
import {Amount} from "../type/Amount.sol";
|
6
|
+
import {InstanceStore} from "../instance/InstanceStore.sol";
|
7
|
+
import {IService} from "../shared/IService.sol";
|
8
|
+
import {NftId} from "../type/NftId.sol";
|
9
|
+
import {UFixed} from "../type/UFixed.sol";
|
10
|
+
|
11
|
+
/// @dev component base class
|
12
|
+
/// component examples are staking, product, distribution, pool and oracle
|
13
|
+
interface IAccountingService is
|
14
|
+
IService
|
15
|
+
{
|
16
|
+
event LogComponentServiceUpdateFee(
|
17
|
+
NftId nftId,
|
18
|
+
string feeName,
|
19
|
+
UFixed previousFractionalFee,
|
20
|
+
uint256 previousFixedFee,
|
21
|
+
UFixed newFractionalFee,
|
22
|
+
uint256 newFixedFee
|
23
|
+
);
|
24
|
+
|
25
|
+
function decreaseComponentFees(InstanceStore instanceStore, NftId componentNftId, Amount feeAmount) external;
|
26
|
+
|
27
|
+
function increaseProductFees(InstanceStore instanceStore, NftId productNftId, Amount feeAmount) external;
|
28
|
+
function decreaseProductFees(InstanceStore instanceStore, NftId productNftId, Amount feeAmount) external;
|
29
|
+
|
30
|
+
function increaseDistributionBalance(InstanceStore instanceStore, NftId distributionNftId, Amount amount, Amount feeAmount) external;
|
31
|
+
function decreaseDistributionBalance(InstanceStore instanceStore, NftId distributionNftId, Amount amount, Amount feeAmount) external;
|
32
|
+
|
33
|
+
function increaseDistributorBalance(InstanceStore instanceStore, NftId distributorNftId, Amount amount, Amount feeAmount) external;
|
34
|
+
function decreaseDistributorBalance(InstanceStore instanceStore, NftId distributorNftId, Amount amount, Amount feeAmount) external;
|
35
|
+
|
36
|
+
function increasePoolBalance(InstanceStore instanceStore, NftId poolNftId, Amount amount, Amount feeAmount) external;
|
37
|
+
function decreasePoolBalance(InstanceStore instanceStore, NftId poolNftId, Amount amount, Amount feeAmount) external;
|
38
|
+
|
39
|
+
function increaseBundleBalance(InstanceStore instanceStore, NftId bundleNftId, Amount amount, Amount feeAmount) external;
|
40
|
+
function decreaseBundleBalance(InstanceStore instanceStore, NftId bundleNftId, Amount amount, Amount feeAmount) external;
|
41
|
+
|
42
|
+
}
|
@@ -13,6 +13,9 @@ import {Selector, SelectorLib, SelectorSetLib} from "../type/Selector.sol";
|
|
13
13
|
import {Str, StrLib} from "../type/String.sol";
|
14
14
|
import {TimestampLib} from "../type/Timestamp.sol";
|
15
15
|
|
16
|
+
interface IAccessManagedChecker {
|
17
|
+
function authority() external view returns (address);
|
18
|
+
}
|
16
19
|
|
17
20
|
/**
|
18
21
|
* @dev A generic access amin contract that implements role based access control based on OpenZeppelin's AccessManager contract.
|
@@ -80,9 +83,7 @@ contract AccessAdmin is
|
|
80
83
|
}
|
81
84
|
|
82
85
|
modifier onlyRoleAdmin(RoleId roleId) {
|
83
|
-
|
84
|
-
revert ErrorRoleUnknown(roleId);
|
85
|
-
}
|
86
|
+
_checkRoleExists(roleId, false);
|
86
87
|
|
87
88
|
if (!hasAdminRole(msg.sender, roleId)) {
|
88
89
|
revert ErrorNotAdminOfRole(_roleInfo[roleId].adminRoleId);
|
@@ -97,8 +98,8 @@ contract AccessAdmin is
|
|
97
98
|
_;
|
98
99
|
}
|
99
100
|
|
100
|
-
modifier onlyExistingRole(RoleId roleId) {
|
101
|
-
|
101
|
+
modifier onlyExistingRole(RoleId roleId, bool onlyActiveRole) {
|
102
|
+
_checkRoleExists(roleId, onlyActiveRole);
|
102
103
|
_;
|
103
104
|
}
|
104
105
|
|
@@ -219,19 +220,6 @@ contract AccessAdmin is
|
|
219
220
|
selector.toBytes4()));
|
220
221
|
}
|
221
222
|
|
222
|
-
// TODO cleanup
|
223
|
-
// function isAccessManaged(address target) public view returns (bool) {
|
224
|
-
// if (!_isContract(target)) {
|
225
|
-
// return false;
|
226
|
-
// }
|
227
|
-
|
228
|
-
// (bool success, ) = target.staticcall(
|
229
|
-
// abi.encodeWithSelector(
|
230
|
-
// AccessManagedUpgradeable.authority.selector));
|
231
|
-
|
232
|
-
// return success;
|
233
|
-
// }
|
234
|
-
|
235
223
|
function canCall(address caller, address target, Selector selector) external virtual view returns (bool can) {
|
236
224
|
(can, ) = _authority.canCall(caller, target, selector.toBytes4());
|
237
225
|
}
|
@@ -242,7 +230,8 @@ contract AccessAdmin is
|
|
242
230
|
adminRoleId: adminRoleId,
|
243
231
|
roleType: roleType,
|
244
232
|
maxMemberCount: maxMemberCount,
|
245
|
-
createdAt: TimestampLib.blockTimestamp()
|
233
|
+
createdAt: TimestampLib.blockTimestamp(),
|
234
|
+
pausedAt: TimestampLib.max()
|
246
235
|
});
|
247
236
|
}
|
248
237
|
|
@@ -373,14 +362,6 @@ contract AccessAdmin is
|
|
373
362
|
name: PUBLIC_ROLE_NAME}));
|
374
363
|
}
|
375
364
|
|
376
|
-
/// @dev check if target exists and reverts if it doesn't
|
377
|
-
function _checkTarget(address target)
|
378
|
-
internal
|
379
|
-
{
|
380
|
-
if (_targetInfo[target].createdAt.eqz()) {
|
381
|
-
revert ErrorTargetUnknown(target);
|
382
|
-
}
|
383
|
-
}
|
384
365
|
|
385
366
|
/// @dev grant the specified role access to all functions in the provided selector list
|
386
367
|
function _grantRoleAccessToFunctions(
|
@@ -398,22 +379,26 @@ contract AccessAdmin is
|
|
398
379
|
// implizit logging: rely on OpenZeppelin log TargetFunctionRoleUpdated
|
399
380
|
}
|
400
381
|
|
382
|
+
|
401
383
|
/// @dev grant the specified role to the provided account
|
402
384
|
function _grantRoleToAccount(RoleId roleId, address account)
|
403
385
|
internal
|
386
|
+
onlyExistingRole(roleId, true)
|
404
387
|
{
|
405
|
-
_checkRoleId(roleId);
|
406
|
-
|
407
388
|
// check max role members will not be exceeded
|
408
389
|
if (_roleMembers[roleId].length() >= _roleInfo[roleId].maxMemberCount) {
|
409
390
|
revert ErrorRoleMembersLimitReached(roleId, _roleInfo[roleId].maxMemberCount);
|
410
391
|
}
|
411
392
|
|
412
393
|
// check account is contract for contract role
|
413
|
-
|
414
|
-
|
394
|
+
if (
|
395
|
+
_roleInfo[roleId].roleType == RoleType.Contract &&
|
396
|
+
!ContractLib.isContract(account) // will fail in account's constructor
|
397
|
+
) {
|
398
|
+
revert ErrorRoleMemberNotContract(roleId, account);
|
415
399
|
}
|
416
400
|
|
401
|
+
// TODO check account already have roleId
|
417
402
|
_roleMembers[roleId].add(account);
|
418
403
|
_authority.grantRole(
|
419
404
|
RoleId.unwrap(roleId),
|
@@ -426,14 +411,15 @@ contract AccessAdmin is
|
|
426
411
|
/// @dev revoke the specified role from the provided account
|
427
412
|
function _revokeRoleFromAccount(RoleId roleId, address account)
|
428
413
|
internal
|
414
|
+
onlyExistingRole(roleId, false)
|
429
415
|
{
|
430
|
-
_checkRoleId(roleId);
|
431
416
|
|
432
417
|
// check role removal is permitted
|
433
418
|
if (_roleInfo[roleId].roleType == RoleType.Contract) {
|
434
|
-
revert
|
419
|
+
revert ErrorRoleMemberRemovalDisabled(roleId, account);
|
435
420
|
}
|
436
421
|
|
422
|
+
// TODO check account have roleId?
|
437
423
|
_roleMembers[roleId].remove(account);
|
438
424
|
_authority.revokeRole(
|
439
425
|
RoleId.unwrap(roleId),
|
@@ -443,21 +429,6 @@ contract AccessAdmin is
|
|
443
429
|
}
|
444
430
|
|
445
431
|
|
446
|
-
function _checkRoleId(RoleId roleId)
|
447
|
-
internal
|
448
|
-
{
|
449
|
-
if (_roleInfo[roleId].createdAt.eqz()) {
|
450
|
-
revert ErrorRoleUnknown(roleId);
|
451
|
-
}
|
452
|
-
|
453
|
-
uint64 roleIdInt = RoleId.unwrap(roleId);
|
454
|
-
if (roleIdInt == _authority.ADMIN_ROLE()
|
455
|
-
|| roleIdInt == _authority.PUBLIC_ROLE())
|
456
|
-
{
|
457
|
-
revert ErrorRoleIsLocked(roleId);
|
458
|
-
}
|
459
|
-
}
|
460
|
-
|
461
432
|
/// @dev Creates a role based on the provided parameters.
|
462
433
|
/// Checks that the provided role and role id and role name not already used.
|
463
434
|
function _createRole(
|
@@ -548,7 +519,7 @@ contract AccessAdmin is
|
|
548
519
|
}
|
549
520
|
|
550
521
|
// check target is an access managed contract
|
551
|
-
if (!
|
522
|
+
if (!_isAccessManaged(target)) {
|
552
523
|
revert ErrorTargetNotAccessManaged(target);
|
553
524
|
}
|
554
525
|
|
@@ -576,17 +547,70 @@ contract AccessAdmin is
|
|
576
547
|
emit LogTargetCreated(target, targetName);
|
577
548
|
}
|
578
549
|
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
550
|
+
|
551
|
+
function _isAccessManaged(address target)
|
552
|
+
internal
|
553
|
+
view
|
554
|
+
returns (bool)
|
555
|
+
{
|
556
|
+
if (!ContractLib.isContract(target)) {
|
557
|
+
return false;
|
558
|
+
}
|
559
|
+
|
560
|
+
(bool success, ) = target.staticcall(
|
561
|
+
abi.encodeWithSelector(
|
562
|
+
IAccessManagedChecker.authority.selector));
|
563
|
+
|
564
|
+
return success;
|
565
|
+
}
|
566
|
+
|
567
|
+
|
568
|
+
function _setTargetClosed(address target, bool locked)
|
569
|
+
internal
|
570
|
+
{
|
571
|
+
_checkTarget(target);
|
572
|
+
|
573
|
+
// target locked/unlocked already
|
574
|
+
if(_authority.isTargetClosed(target) == locked) {
|
575
|
+
revert ErrorTargetAlreadyLocked(target, locked);
|
576
|
+
}
|
577
|
+
|
578
|
+
_authority.setTargetClosed(target, locked);
|
579
|
+
}
|
580
|
+
|
581
|
+
|
582
|
+
function _checkRoleExists(
|
583
|
+
RoleId roleId,
|
584
|
+
bool onlyActiveRole
|
585
|
+
)
|
586
|
+
internal
|
587
|
+
view
|
588
|
+
{
|
589
|
+
if (!roleExists(roleId)) {
|
590
|
+
revert ErrorRoleUnknown(roleId);
|
591
|
+
}
|
592
|
+
|
593
|
+
uint64 roleIdInt = RoleId.unwrap(roleId);
|
594
|
+
if (roleIdInt == _authority.ADMIN_ROLE()
|
595
|
+
|| roleIdInt == _authority.PUBLIC_ROLE())
|
596
|
+
{
|
597
|
+
revert ErrorRoleIsLocked(roleId);
|
598
|
+
}
|
599
|
+
|
600
|
+
// check if role is disabled
|
601
|
+
if (onlyActiveRole && _roleInfo[roleId].pausedAt <= TimestampLib.blockTimestamp()) {
|
602
|
+
revert ErrorRoleIsPaused(roleId);
|
603
|
+
}
|
604
|
+
}
|
605
|
+
|
606
|
+
|
607
|
+
/// @dev check if target exists and reverts if it doesn't
|
608
|
+
function _checkTarget(address target)
|
609
|
+
internal
|
610
|
+
view
|
611
|
+
{
|
612
|
+
if (!targetExists(target)) {
|
613
|
+
revert ErrorTargetUnknown(target);
|
614
|
+
}
|
615
|
+
}
|
592
616
|
}
|