@etherisc/gif-next 0.0.2-b3a8633-027 → 0.0.2-b3e9a44-364
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 +19 -2
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/AccessAdmin.sol/AccessAdmin.json +32 -51
- package/artifacts/contracts/authorization/AccessManagerCloneable.sol/AccessManagerCloneable.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/Authorization.sol/Authorization.json +2 -2
- package/artifacts/contracts/authorization/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.dbg.json +1 -1
- package/artifacts/contracts/authorization/IAccessAdmin.sol/IAccessAdmin.json +0 -19
- package/artifacts/contracts/authorization/IAuthorization.sol/IAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IModuleAuthorization.sol/IModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/IServiceAuthorization.sol/IServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ModuleAuthorization.sol/ModuleAuthorization.json +2 -2
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.dbg.json +1 -1
- package/artifacts/contracts/authorization/ServiceAuthorization.sol/ServiceAuthorization.json +2 -2
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistribution.sol/BasicDistribution.json +101 -248
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.dbg.json +1 -1
- package/artifacts/contracts/distribution/BasicDistributionAuthorization.sol/BasicDistributionAuthorization.json +16 -16
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.dbg.json +1 -1
- package/artifacts/contracts/distribution/Distribution.sol/Distribution.json +59 -222
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionService.sol/DistributionService.json +244 -217
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.dbg.json +1 -1
- package/artifacts/contracts/distribution/DistributionServiceManager.sol/DistributionServiceManager.json +109 -101
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionComponent.sol/IDistributionComponent.json +59 -37
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.dbg.json +1 -1
- package/artifacts/contracts/distribution/IDistributionService.sol/IDistributionService.json +136 -31
- 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 +1507 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FirePoolAuthorization.sol/FirePoolAuthorization.json +410 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProduct.sol/FireProduct.json +1978 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.dbg.json +4 -0
- package/artifacts/contracts/examples/fire/FireProductAuthorization.sol/FireProductAuthorization.json +414 -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 +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleDistribution.sol/SimpleDistribution.json +1427 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleOracle.sol/SimpleOracle.json +1187 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimplePool.sol/SimplePool.json +1561 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.dbg.json +4 -0
- package/artifacts/contracts/examples/unpermissioned/SimpleProduct.sol/SimpleProduct.json +1996 -0
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.dbg.json +1 -1
- package/artifacts/contracts/instance/BundleSet.sol/BundleSet.json +2 -2
- package/artifacts/contracts/instance/IInstance.sol/IInstance.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstance.sol/IInstance.json +16 -0
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/IInstanceService.sol/IInstanceService.json +16 -0
- package/artifacts/contracts/instance/Instance.sol/Instance.dbg.json +1 -1
- package/artifacts/contracts/instance/Instance.sol/Instance.json +26 -99
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAdmin.sol/InstanceAdmin.json +96 -99
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceAuthorizationV3.sol/InstanceAuthorizationV3.json +14 -14
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceReader.sol/InstanceReader.json +437 -129
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceService.sol/InstanceService.json +55 -146
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceServiceManager.sol/InstanceServiceManager.json +77 -81
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/InstanceStore.sol/InstanceStore.json +244 -228
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.dbg.json +1 -1
- package/artifacts/contracts/instance/base/BalanceStore.sol/BalanceStore.json +2 -2
- package/artifacts/contracts/instance/base/Cloneable.sol/Cloneable.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectCounter.sol/ObjectCounter.json +2 -2
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectLifecycle.sol/ObjectLifecycle.json +2 -2
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.dbg.json +1 -1
- package/artifacts/contracts/instance/base/ObjectSet.sol/ObjectSet.json +2 -2
- package/artifacts/contracts/instance/module/IAccess.sol/IAccess.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IBundle.sol/IBundle.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IComponents.sol/IComponents.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IDistribution.sol/IDistribution.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IPolicy.sol/IPolicy.dbg.json +1 -1
- package/artifacts/contracts/instance/module/IRisk.sol/IRisk.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.dbg.json +1 -1
- package/artifacts/contracts/mock/Dip.sol/Dip.json +2 -2
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracle.sol/BasicOracle.json +75 -235
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.dbg.json +1 -1
- package/artifacts/contracts/oracle/BasicOracleAuthorization.sol/BasicOracleAuthorization.json +18 -18
- 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 +46 -37
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/IOracleService.sol/IOracleService.json +16 -0
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.dbg.json +1 -1
- package/artifacts/contracts/oracle/Oracle.sol/Oracle.json +43 -219
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleService.sol/OracleService.json +53 -144
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/oracle/OracleServiceManager.sol/OracleServiceManager.json +76 -80
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPool.sol/BasicPool.json +95 -280
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.dbg.json +1 -1
- package/artifacts/contracts/pool/BasicPoolAuthorization.sol/BasicPoolAuthorization.json +16 -16
- package/artifacts/contracts/pool/BundleService.sol/BundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleService.sol/BundleService.json +463 -150
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/BundleServiceManager.sol/BundleServiceManager.json +170 -86
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.dbg.json +1 -1
- package/artifacts/contracts/pool/IBundleService.sol/IBundleService.json +245 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolComponent.sol/IPoolComponent.json +88 -94
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/IPoolService.sol/IPoolService.json +376 -171
- package/artifacts/contracts/pool/Pool.sol/Pool.dbg.json +1 -1
- package/artifacts/contracts/pool/Pool.sol/Pool.json +85 -276
- package/artifacts/contracts/pool/PoolService.sol/PoolService.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolService.sol/PoolService.json +525 -350
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.dbg.json +1 -1
- package/artifacts/contracts/pool/PoolServiceManager.sol/PoolServiceManager.json +114 -82
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationService.sol/ApplicationService.json +52 -162
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ApplicationServiceManager.sol/ApplicationServiceManager.json +73 -89
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProduct.sol/BasicProduct.json +63 -248
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.dbg.json +1 -1
- package/artifacts/contracts/product/BasicProductAuthorization.sol/BasicProductAuthorization.json +16 -16
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimService.sol/ClaimService.json +279 -181
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/ClaimServiceManager.sol/ClaimServiceManager.json +120 -100
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.dbg.json +1 -1
- package/artifacts/contracts/product/IApplicationService.sol/IApplicationService.json +21 -0
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.dbg.json +1 -1
- package/artifacts/contracts/product/IClaimService.sol/IClaimService.json +163 -6
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/IPolicyService.sol/IPolicyService.json +310 -118
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.dbg.json +1 -1
- package/artifacts/contracts/product/IPricingService.sol/IPricingService.json +59 -43
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.dbg.json +1 -1
- package/artifacts/contracts/product/IProductComponent.sol/IProductComponent.json +63 -63
- package/artifacts/contracts/product/IRiskService.sol/IRiskService.dbg.json +4 -0
- package/artifacts/contracts/product/{IProductService.sol/IProductService.json → IRiskService.sol/IRiskService.json} +18 -2
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyService.sol/PolicyService.json +421 -320
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PolicyServiceManager.sol/PolicyServiceManager.json +120 -100
- package/artifacts/contracts/product/PricingService.sol/PricingService.dbg.json +1 -1
- package/artifacts/contracts/product/PricingService.sol/PricingService.json +136 -259
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/product/PricingServiceManager.sol/PricingServiceManager.json +97 -117
- package/artifacts/contracts/product/Product.sol/Product.dbg.json +1 -1
- package/artifacts/contracts/product/Product.sol/Product.json +63 -248
- package/artifacts/contracts/product/RiskService.sol/RiskService.dbg.json +4 -0
- package/artifacts/contracts/product/RiskService.sol/RiskService.json +604 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.dbg.json +4 -0
- package/artifacts/contracts/product/RiskServiceManager.sol/RiskServiceManager.json +698 -0
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.dbg.json +1 -1
- package/artifacts/contracts/registry/ChainNft.sol/ChainNft.json +22 -3
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistry.sol/IRegistry.json +297 -19
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/IRegistryService.sol/IRegistryService.json +16 -0
- package/artifacts/contracts/registry/ITransferInterceptor.sol/ITransferInterceptor.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.dbg.json +1 -1
- package/artifacts/contracts/registry/Registry.sol/Registry.json +401 -104
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryAdmin.sol/RegistryAdmin.json +121 -134
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryService.sol/RegistryService.json +39 -313
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.dbg.json +1 -1
- package/artifacts/contracts/registry/RegistryServiceManager.sol/RegistryServiceManager.json +68 -72
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseLifecycle.sol/ReleaseLifecycle.json +2 -2
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/ReleaseRegistry.sol/ReleaseRegistry.json +45 -16
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.dbg.json +1 -1
- package/artifacts/contracts/registry/ServiceAuthorizationV3.sol/ServiceAuthorizationV3.json +6 -6
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.dbg.json +1 -1
- package/artifacts/contracts/registry/TokenRegistry.sol/TokenRegistry.json +2 -2
- package/artifacts/contracts/shared/Component.sol/Component.dbg.json +1 -1
- package/artifacts/contracts/shared/Component.sol/Component.json +16 -211
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentService.sol/ComponentService.json +263 -161
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentServiceManager.sol/ComponentServiceManager.json +121 -95
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.dbg.json +1 -1
- package/artifacts/contracts/shared/ComponentVerifyingService.sol/ComponentVerifyingService.json +21 -112
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.dbg.json +4 -0
- package/artifacts/contracts/shared/ContractLib.sol/ContractLib.json +92 -0
- package/artifacts/contracts/shared/IComponent.sol/IComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponent.sol/IComponent.json +16 -26
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.dbg.json +1 -1
- package/artifacts/contracts/shared/IComponentService.sol/IComponentService.json +169 -0
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/IInstanceLinkedComponent.sol/IInstanceLinkedComponent.json +35 -37
- package/artifacts/contracts/shared/IKeyValueStore.sol/IKeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/ILifecycle.sol/ILifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/INftOwnable.sol/INftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/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 +15 -47
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.dbg.json +1 -1
- package/artifacts/contracts/shared/IRegisterable.sol/IRegisterable.json +16 -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 +16 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.dbg.json +4 -0
- package/artifacts/contracts/shared/InitializableERC165.sol/InitializableERC165.json +53 -0
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.dbg.json +1 -1
- package/artifacts/contracts/shared/InstanceLinkedComponent.sol/InstanceLinkedComponent.json +35 -222
- package/artifacts/contracts/shared/KeyValueStore.sol/KeyValueStore.dbg.json +1 -1
- package/artifacts/contracts/shared/Lifecycle.sol/Lifecycle.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.dbg.json +1 -1
- package/artifacts/contracts/shared/NftIdSet.sol/NftIdSet.json +2 -2
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.dbg.json +1 -1
- package/artifacts/contracts/shared/NftOwnable.sol/NftOwnable.json +22 -57
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.dbg.json +1 -1
- package/artifacts/contracts/shared/PolicyHolder.sol/PolicyHolder.json +19 -141
- package/artifacts/contracts/shared/Registerable.sol/Registerable.dbg.json +1 -1
- package/artifacts/contracts/shared/Registerable.sol/Registerable.json +24 -97
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.dbg.json +1 -1
- package/artifacts/contracts/shared/RegistryLinked.sol/RegistryLinked.json +2 -15
- package/artifacts/contracts/shared/Service.sol/Service.dbg.json +1 -1
- package/artifacts/contracts/shared/Service.sol/Service.json +21 -112
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.dbg.json +1 -1
- package/artifacts/contracts/shared/TokenHandler.sol/TokenHandler.json +330 -11
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.dbg.json +4 -0
- package/artifacts/contracts/shared/TokenHandlerDeployerLib.sol/TokenHandlerDeployerLib.json +108 -0
- package/artifacts/contracts/staking/IStaking.sol/IStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/IStaking.sol/IStaking.json +43 -27
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/IStakingService.sol/IStakingService.json +16 -21
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/StakeManagerLib.sol/StakeManagerLib.json +73 -93
- package/artifacts/contracts/staking/Staking.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/staking/Staking.sol/Staking.json +101 -262
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingLifecycle.sol/StakingLifecycle.json +2 -2
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingManager.sol/StakingManager.json +93 -88
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingReader.sol/StakingReader.json +6 -11
- package/artifacts/contracts/staking/StakingService.sol/StakingService.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingService.sol/StakingService.json +47 -159
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingServiceManager.sol/StakingServiceManager.json +72 -76
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.dbg.json +1 -1
- package/artifacts/contracts/staking/StakingStore.sol/StakingStore.json +89 -84
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.dbg.json +1 -1
- package/artifacts/contracts/staking/TargetManagerLib.sol/TargetManagerLib.json +59 -23
- 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 +61 -8
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.dbg.json +1 -1
- package/artifacts/contracts/type/Blocknumber.sol/BlocknumberLib.json +2 -2
- package/artifacts/contracts/type/ClaimId.sol/ClaimIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/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 +7 -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 +2 -2
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.dbg.json +1 -1
- package/artifacts/contracts/type/NftIdSet.sol/LibNftIdSet.json +2 -2
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.dbg.json +1 -1
- package/artifacts/contracts/type/ObjectType.sol/ObjectTypeLib.json +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 +60 -4
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/RoleId.sol/RoleIdLib.json +2 -2
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.dbg.json +1 -1
- package/artifacts/contracts/type/Seconds.sol/SecondsLib.json +50 -2
- package/artifacts/contracts/type/Selector.sol/SelectorLib.dbg.json +1 -1
- package/artifacts/contracts/type/Selector.sol/SelectorSetLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.dbg.json +1 -1
- package/artifacts/contracts/type/StateId.sol/StateIdLib.json +2 -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/Timestamp.sol/TimestampLib.json +23 -4
- package/artifacts/contracts/type/UFixed.sol/MathLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/MathLib.json +9 -3
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.dbg.json +1 -1
- package/artifacts/contracts/type/UFixed.sol/UFixedLib.json +52 -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 +55 -70
- package/artifacts/contracts/upgradeability/UpgradableProxyWithAdmin.sol/UpgradableProxyWithAdmin.dbg.json +1 -1
- package/artifacts/contracts/upgradeability/Versionable.sol/Versionable.dbg.json +1 -1
- package/contracts/authorization/AccessAdmin.sol +25 -23
- package/contracts/authorization/Authorization.sol +5 -2
- package/contracts/authorization/IAccessAdmin.sol +0 -1
- package/contracts/distribution/BasicDistribution.sol +6 -15
- package/contracts/distribution/BasicDistributionAuthorization.sol +5 -1
- package/contracts/distribution/Distribution.sol +25 -12
- package/contracts/distribution/DistributionService.sol +114 -54
- package/contracts/distribution/DistributionServiceManager.sol +6 -6
- package/contracts/distribution/IDistributionComponent.sol +8 -4
- package/contracts/distribution/IDistributionService.sol +18 -2
- package/contracts/examples/fire/DamageLevel.sol +59 -0
- package/contracts/examples/fire/FirePool.sol +75 -0
- package/contracts/examples/fire/FirePoolAuthorization.sol +34 -0
- package/contracts/examples/fire/FireProduct.sol +411 -0
- package/contracts/examples/fire/FireProductAuthorization.sol +45 -0
- package/contracts/examples/fire/FireUSD.sol +26 -0
- package/contracts/examples/unpermissioned/SimpleDistribution.sol +50 -0
- package/contracts/examples/unpermissioned/SimpleOracle.sol +137 -0
- package/contracts/examples/unpermissioned/SimplePool.sol +76 -0
- package/contracts/examples/unpermissioned/SimpleProduct.sol +351 -0
- package/contracts/instance/IInstance.sol +7 -30
- package/contracts/instance/Instance.sol +10 -35
- package/contracts/instance/InstanceAdmin.sol +29 -7
- package/contracts/instance/InstanceAuthorizationV3.sol +5 -3
- package/contracts/instance/InstanceReader.sol +115 -25
- package/contracts/instance/InstanceService.sol +63 -41
- package/contracts/instance/InstanceServiceManager.sol +6 -7
- package/contracts/instance/InstanceStore.sol +12 -1
- package/contracts/instance/base/ObjectLifecycle.sol +9 -4
- package/contracts/instance/module/IBundle.sol +1 -1
- package/contracts/instance/module/IComponents.sol +4 -8
- package/contracts/instance/module/IDistribution.sol +0 -1
- package/contracts/instance/module/IPolicy.sol +24 -24
- package/contracts/mock/Dip.sol +1 -1
- package/contracts/oracle/IOracleComponent.sol +2 -1
- package/contracts/oracle/Oracle.sol +17 -7
- package/contracts/oracle/OracleService.sol +41 -33
- package/contracts/oracle/OracleServiceManager.sol +6 -6
- package/contracts/pool/BasicPool.sol +19 -18
- package/contracts/pool/BasicPoolAuthorization.sol +11 -2
- package/contracts/pool/BundleService.sol +208 -31
- package/contracts/pool/BundleServiceManager.sol +6 -6
- package/contracts/pool/IBundleService.sol +42 -5
- package/contracts/pool/IPoolComponent.sol +24 -8
- package/contracts/pool/IPoolService.sol +57 -36
- package/contracts/pool/Pool.sol +81 -35
- package/contracts/pool/PoolService.sol +231 -104
- package/contracts/pool/PoolServiceManager.sol +4 -4
- package/contracts/product/ApplicationService.sol +50 -29
- package/contracts/product/ApplicationServiceManager.sol +4 -4
- package/contracts/product/BasicProduct.sol +3 -32
- package/contracts/product/BasicProductAuthorization.sol +3 -0
- package/contracts/product/ClaimService.sol +251 -86
- package/contracts/product/ClaimServiceManager.sol +4 -4
- package/contracts/product/IApplicationService.sol +1 -0
- package/contracts/product/IClaimService.sol +31 -7
- package/contracts/product/IPolicyService.sol +34 -32
- package/contracts/product/IPricingService.sol +7 -7
- package/contracts/product/IProductComponent.sol +18 -4
- package/contracts/product/{IProductService.sol → IRiskService.sol} +1 -1
- package/contracts/product/PolicyService.sol +404 -193
- package/contracts/product/PolicyServiceManager.sol +4 -4
- package/contracts/product/PricingService.sol +47 -47
- package/contracts/product/PricingServiceManager.sol +3 -3
- package/contracts/product/Product.sol +93 -51
- package/contracts/product/{ProductService.sol → RiskService.sol} +7 -10
- package/contracts/product/RiskServiceManager.sol +39 -0
- package/contracts/registry/ChainNft.sol +51 -19
- package/contracts/registry/IRegistry.sol +53 -12
- package/contracts/registry/IRegistryService.sol +0 -9
- package/contracts/registry/Registry.sol +320 -172
- package/contracts/registry/RegistryAdmin.sol +49 -32
- package/contracts/registry/RegistryService.sol +55 -48
- package/contracts/registry/RegistryServiceManager.sol +2 -2
- package/contracts/registry/ReleaseRegistry.sol +25 -67
- package/contracts/registry/ServiceAuthorizationV3.sol +6 -8
- package/contracts/shared/Component.sol +24 -44
- package/contracts/shared/ComponentService.sol +88 -28
- package/contracts/shared/ComponentServiceManager.sol +8 -5
- package/contracts/shared/ComponentVerifyingService.sol +2 -3
- package/contracts/shared/ContractLib.sol +38 -0
- package/contracts/shared/IComponent.sol +4 -4
- package/contracts/shared/IComponentService.sol +15 -9
- package/contracts/shared/IInstanceLinkedComponent.sol +9 -10
- package/contracts/shared/INftOwnable.sol +2 -0
- package/contracts/shared/IPolicyHolder.sol +12 -22
- package/contracts/shared/{ERC165.sol → InitializableERC165.sol} +3 -3
- package/contracts/shared/InstanceLinkedComponent.sol +26 -6
- package/contracts/shared/NftOwnable.sol +23 -7
- package/contracts/shared/PolicyHolder.sol +17 -57
- package/contracts/shared/Registerable.sol +4 -4
- package/contracts/shared/RegistryLinked.sol +3 -2
- package/contracts/shared/Service.sol +16 -11
- package/contracts/shared/TokenHandler.sol +100 -19
- package/contracts/shared/TokenHandlerDeployerLib.sol +12 -0
- package/contracts/staking/IStaking.sol +2 -1
- package/contracts/staking/IStakingService.sol +0 -3
- package/contracts/staking/StakeManagerLib.sol +18 -25
- package/contracts/staking/Staking.sol +16 -28
- package/contracts/staking/StakingManager.sol +8 -6
- package/contracts/staking/StakingReader.sol +12 -5
- package/contracts/staking/StakingService.sol +11 -29
- package/contracts/staking/StakingServiceManager.sol +2 -2
- package/contracts/staking/TargetManagerLib.sol +7 -3
- package/contracts/type/Amount.sol +27 -5
- package/contracts/type/Blocknumber.sol +7 -1
- package/contracts/type/ClaimId.sol +6 -1
- package/contracts/type/NftId.sol +1 -0
- package/contracts/type/ObjectType.sol +16 -11
- package/contracts/type/PayoutId.sol +10 -10
- package/contracts/type/Referral.sol +1 -0
- package/contracts/type/RiskId.sol +15 -1
- package/contracts/type/Seconds.sol +21 -1
- package/contracts/type/StateId.sol +1 -0
- package/contracts/type/Timestamp.sol +11 -1
- package/contracts/type/UFixed.sol +33 -10
- package/contracts/upgradeability/ProxyManager.sol +67 -34
- package/contracts/upgradeability/Versionable.sol +2 -2
- package/package.json +2 -1
- package/artifacts/contracts/product/IProductService.sol/IProductService.dbg.json +0 -4
- package/artifacts/contracts/product/ProductService.sol/ProductService.dbg.json +0 -4
- package/artifacts/contracts/product/ProductService.sol/ProductService.json +0 -708
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.dbg.json +0 -4
- package/artifacts/contracts/product/ProductServiceManager.sol/ProductServiceManager.json +0 -702
- package/artifacts/contracts/registry/GlobalRegistry.sol/GlobalRegistry.dbg.json +0 -4
- package/artifacts/contracts/registry/GlobalRegistry.sol/GlobalRegistry.json +0 -1503
- package/artifacts/contracts/registry/GlobalRegistryAdmin.sol/GlobalRegistryAdmin.dbg.json +0 -4
- package/artifacts/contracts/registry/GlobalRegistryAdmin.sol/GlobalRegistryAdmin.json +0 -1881
- package/artifacts/contracts/registry/IGlobalRegistry.sol/IGlobalRegistry.dbg.json +0 -4
- package/artifacts/contracts/registry/IGlobalRegistry.sol/IGlobalRegistry.json +0 -974
- package/artifacts/contracts/shared/ERC165.sol/ERC165.dbg.json +0 -4
- package/artifacts/contracts/shared/ERC165.sol/ERC165.json +0 -73
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.dbg.json +0 -4
- package/artifacts/contracts/shared/InitializableCustom.sol/InitializableCustom.json +0 -39
- package/artifacts/contracts/shared/MainnetId.sol/MainnetContract.dbg.json +0 -4
- package/artifacts/contracts/shared/MainnetId.sol/MainnetContract.json +0 -34
- package/artifacts/contracts/shared/MainnetId.sol/MainnetId.dbg.json +0 -4
- package/artifacts/contracts/shared/MainnetId.sol/MainnetId.json +0 -24
- package/artifacts/contracts/shared/MainnetId.sol/SidenetContract.dbg.json +0 -4
- package/artifacts/contracts/shared/MainnetId.sol/SidenetContract.json +0 -34
- package/contracts/product/ProductServiceManager.sol +0 -39
- package/contracts/registry/GlobalRegistry.sol +0 -95
- package/contracts/registry/GlobalRegistryAdmin.sol +0 -38
- package/contracts/registry/IGlobalRegistry.sol +0 -17
- package/contracts/shared/InitializableCustom.sol +0 -177
- package/contracts/shared/MainnetId.sol +0 -29
@@ -11,9 +11,9 @@ import {ObjectType, ObjectTypeLib, ALL, REGISTRY, STAKING, POOL, RELEASE} from "
|
|
11
11
|
import {ReleaseRegistry} from "./ReleaseRegistry.sol";
|
12
12
|
import {RoleId, RoleIdLib, ADMIN_ROLE, GIF_MANAGER_ROLE, GIF_ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
|
13
13
|
import {StakingStore} from "../staking/StakingStore.sol";
|
14
|
+
import {TokenHandler} from "../shared/TokenHandler.sol";
|
14
15
|
import {TokenRegistry} from "./TokenRegistry.sol";
|
15
16
|
import {VersionPart} from "../type/Version.sol";
|
16
|
-
import {SidenetContract} from "../shared/MainnetId.sol";
|
17
17
|
|
18
18
|
/*
|
19
19
|
1) GIF_MANAGER_ROLE
|
@@ -28,7 +28,6 @@ import {SidenetContract} from "../shared/MainnetId.sol";
|
|
28
28
|
- responsible for creation and activation of releases
|
29
29
|
*/
|
30
30
|
contract RegistryAdmin is
|
31
|
-
SidenetContract,
|
32
31
|
AccessAdmin
|
33
32
|
{
|
34
33
|
string public constant GIF_ADMIN_ROLE_NAME = "GifAdminRole";
|
@@ -79,8 +78,8 @@ contract RegistryAdmin is
|
|
79
78
|
_setupGifAdminRole(gifAdmin);
|
80
79
|
_setupGifManagerRole(gifManager);
|
81
80
|
|
82
|
-
_setupRegistry();
|
83
81
|
_setupReleaseRegistry();
|
82
|
+
_setupRegistry();
|
84
83
|
_setupStaking();
|
85
84
|
}
|
86
85
|
|
@@ -263,8 +262,13 @@ contract RegistryAdmin is
|
|
263
262
|
maxMemberCount: 2, // TODO decide on max member count
|
264
263
|
name: GIF_ADMIN_ROLE_NAME}));
|
265
264
|
|
266
|
-
// for
|
265
|
+
// for Registry
|
267
266
|
FunctionInfo[] memory functions;
|
267
|
+
functions = new FunctionInfo[](1);
|
268
|
+
functions[0] = toFunction(IRegistry.registerRegistry.selector, "registerRegistry");
|
269
|
+
_authorizeTargetFunctions(_registry, GIF_ADMIN_ROLE(), functions);
|
270
|
+
|
271
|
+
// for ReleaseRegistry
|
268
272
|
functions = new FunctionInfo[](4);
|
269
273
|
functions[0] = toFunction(ReleaseRegistry.createNextRelease.selector, "createNextRelease");
|
270
274
|
functions[1] = toFunction(ReleaseRegistry.activateNextRelease.selector, "activateNextRelease");
|
@@ -308,32 +312,6 @@ contract RegistryAdmin is
|
|
308
312
|
_grantRoleToAccount(GIF_MANAGER_ROLE(), gifManager);
|
309
313
|
}
|
310
314
|
|
311
|
-
function _setupRegistry()
|
312
|
-
internal
|
313
|
-
virtual
|
314
|
-
onlyInitializing()
|
315
|
-
{
|
316
|
-
_createTarget(_registry, REGISTRY_TARGET_NAME, true, false);
|
317
|
-
|
318
|
-
// registry function authorization for registry service
|
319
|
-
RoleId registryServiceRoleId = RoleIdLib.roleForTypeAndAllVersions(REGISTRY());
|
320
|
-
_createRole(
|
321
|
-
registryServiceRoleId,
|
322
|
-
toRole({
|
323
|
-
adminRoleId: ADMIN_ROLE(),
|
324
|
-
roleType: RoleType.Contract,
|
325
|
-
maxMemberCount: MAX_NUM_RELEASES,
|
326
|
-
name: REGISTRY_SERVICE_ROLE_NAME}));
|
327
|
-
|
328
|
-
FunctionInfo[] memory functions;
|
329
|
-
functions = new FunctionInfo[](2);
|
330
|
-
functions[0] = toFunction(IRegistry.register.selector, "register");
|
331
|
-
functions[1] = toFunction(IRegistry.registerWithCustomType.selector, "registerWithCustomType");
|
332
|
-
// TODO add registerChainRegistry()
|
333
|
-
|
334
|
-
_authorizeTargetFunctions(_registry, registryServiceRoleId, functions);
|
335
|
-
}
|
336
|
-
|
337
315
|
|
338
316
|
function _setupReleaseRegistry()
|
339
317
|
private
|
@@ -358,13 +336,44 @@ contract RegistryAdmin is
|
|
358
336
|
functions[2] = toFunction(RegistryAdmin.revokeServiceRoleForAllVersions.selector, "revokeServiceRoleForAllVersions");
|
359
337
|
functions[3] = toFunction(RegistryAdmin.grantServiceRole.selector, "grantServiceRole");
|
360
338
|
functions[4] = toFunction(RegistryAdmin.revokeServiceRole.selector, "revokeServiceRole");
|
361
|
-
|
362
339
|
_authorizeTargetFunctions(address(this), releaseRegistryRoleId, functions);
|
363
340
|
|
364
341
|
_grantRoleToAccount(releaseRegistryRoleId, _releaseRegistry);
|
365
342
|
}
|
366
343
|
|
367
344
|
|
345
|
+
function _setupRegistry()
|
346
|
+
internal
|
347
|
+
virtual
|
348
|
+
onlyInitializing()
|
349
|
+
{
|
350
|
+
_createTarget(_registry, REGISTRY_TARGET_NAME, true, false);
|
351
|
+
|
352
|
+
// registry function authorization for registry service
|
353
|
+
RoleId registryServiceRoleId = RoleIdLib.roleForTypeAndAllVersions(REGISTRY());
|
354
|
+
_createRole(
|
355
|
+
registryServiceRoleId,
|
356
|
+
toRole({
|
357
|
+
adminRoleId: ADMIN_ROLE(),
|
358
|
+
roleType: RoleType.Contract,
|
359
|
+
maxMemberCount: MAX_NUM_RELEASES,
|
360
|
+
name: REGISTRY_SERVICE_ROLE_NAME}));
|
361
|
+
|
362
|
+
// authorize registry service
|
363
|
+
FunctionInfo[] memory functions;
|
364
|
+
functions = new FunctionInfo[](2);
|
365
|
+
functions[0] = toFunction(IRegistry.register.selector, "register");
|
366
|
+
functions[1] = toFunction(IRegistry.registerWithCustomType.selector, "registerWithCustomType");
|
367
|
+
_authorizeTargetFunctions(_registry, registryServiceRoleId, functions);
|
368
|
+
|
369
|
+
// authorize release registry
|
370
|
+
RoleId releaseRegistryRoleId = RoleIdLib.roleForType(RELEASE());
|
371
|
+
functions = new FunctionInfo[](1);
|
372
|
+
functions[0] = toFunction(IRegistry.registerService.selector, "registerService");
|
373
|
+
_authorizeTargetFunctions(_registry, releaseRegistryRoleId, functions);
|
374
|
+
}
|
375
|
+
|
376
|
+
|
368
377
|
function _setupStaking()
|
369
378
|
private
|
370
379
|
onlyInitializing()
|
@@ -441,7 +450,15 @@ contract RegistryAdmin is
|
|
441
450
|
functions[12] = toFunction(StakingStore.claimUpTo.selector, "claimUpTo");
|
442
451
|
functions[13] = toFunction(StakingStore.unstakeUpTo.selector, "unstakeUpTo");
|
443
452
|
_authorizeTargetFunctions(_stakingStore, stakingRoleId, functions);
|
444
|
-
|
453
|
+
|
445
454
|
_grantRoleToAccount(stakingRoleId, _staking);
|
455
|
+
|
456
|
+
// grant token handler authorizations
|
457
|
+
IStaking staking = IStaking(_staking);
|
458
|
+
functions = new FunctionInfo[](2);
|
459
|
+
functions[0] = toFunction(TokenHandler.collectTokens.selector, "collectTokens");
|
460
|
+
functions[1] = toFunction(TokenHandler.distributeTokens.selector, "distributeTokens");
|
461
|
+
|
462
|
+
_authorizeTargetFunctions(address(staking.getTokenHandler()), stakingRoleId, functions);
|
446
463
|
}
|
447
464
|
}
|
@@ -39,8 +39,8 @@ contract RegistryService is
|
|
39
39
|
address initialAuthority
|
40
40
|
) = abi.decode(data, (address, address));
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
_initializeService(registryAddress, initialAuthority, owner);
|
43
|
+
_registerInterface(type(IRegistryService).interfaceId);
|
44
44
|
}
|
45
45
|
|
46
46
|
|
@@ -75,21 +75,21 @@ contract RegistryService is
|
|
75
75
|
instance.linkToRegisteredNftId(); // asume safe
|
76
76
|
}
|
77
77
|
|
78
|
-
function registerProduct(IComponent product, address owner)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
{
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
}
|
78
|
+
// function registerProduct(IComponent product, address owner)
|
79
|
+
// external
|
80
|
+
// restricted
|
81
|
+
// returns(
|
82
|
+
// IRegistry.ObjectInfo memory info
|
83
|
+
// )
|
84
|
+
// {
|
85
|
+
// // CAN revert if no ERC165 support -> will revert with empty message
|
86
|
+
// if(!product.supportsInterface(type(IProductComponent).interfaceId)) {
|
87
|
+
// revert ErrorRegistryServiceNotProduct(address(product));
|
88
|
+
// }
|
89
|
+
|
90
|
+
// info = _getAndVerifyContractInfo(product, PRODUCT(), owner);
|
91
|
+
// info.nftId = getRegistry().register(info);
|
92
|
+
// }
|
93
93
|
|
94
94
|
function registerComponent(
|
95
95
|
IComponent component,
|
@@ -111,35 +111,35 @@ contract RegistryService is
|
|
111
111
|
info.nftId = getRegistry().register(info);
|
112
112
|
}
|
113
113
|
|
114
|
-
function registerPool(IComponent pool, address owner)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
{
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
}
|
128
|
-
|
129
|
-
function registerDistribution(IComponent distribution, address owner)
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
{
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
}
|
114
|
+
// function registerPool(IComponent pool, address owner)
|
115
|
+
// external
|
116
|
+
// restricted
|
117
|
+
// returns(
|
118
|
+
// IRegistry.ObjectInfo memory info
|
119
|
+
// )
|
120
|
+
// {
|
121
|
+
// if(!pool.supportsInterface(type(IPoolComponent).interfaceId)) {
|
122
|
+
// revert ErrorRegistryServiceNotPool(address(pool));
|
123
|
+
// }
|
124
|
+
|
125
|
+
// info = _getAndVerifyContractInfo(pool, POOL(), owner);
|
126
|
+
// info.nftId = getRegistry().register(info);
|
127
|
+
// }
|
128
|
+
|
129
|
+
// function registerDistribution(IComponent distribution, address owner)
|
130
|
+
// external
|
131
|
+
// restricted
|
132
|
+
// returns(
|
133
|
+
// IRegistry.ObjectInfo memory info
|
134
|
+
// )
|
135
|
+
// {
|
136
|
+
// if(!distribution.supportsInterface(type(IDistributionComponent).interfaceId)) {
|
137
|
+
// revert ErrorRegistryServiceNotDistribution(address(distribution));
|
138
|
+
// }
|
139
|
+
|
140
|
+
// info = _getAndVerifyContractInfo(distribution, DISTRIBUTION(), owner);
|
141
|
+
// info.nftId = getRegistry().register(info);
|
142
|
+
// }
|
143
143
|
|
144
144
|
function registerDistributor(IRegistry.ObjectInfo memory info)
|
145
145
|
external
|
@@ -240,8 +240,15 @@ contract RegistryService is
|
|
240
240
|
revert ErrorRegistryServiceObjectOwnerZero(info.objectType);
|
241
241
|
}
|
242
242
|
|
243
|
-
if(
|
244
|
-
revert
|
243
|
+
if(owner == msg.sender) {
|
244
|
+
revert ErrorRegistryServiceInvalidInitialOwner(owner);
|
245
|
+
}
|
246
|
+
|
247
|
+
if(getRegistry().isRegistered(owner)) {
|
248
|
+
ObjectType ownerType = getRegistry().getObjectInfo(owner).objectType;
|
249
|
+
if(ownerType == REGISTRY() || ownerType == STAKING() || ownerType == SERVICE() || ownerType == INSTANCE()) {
|
250
|
+
revert ErrorRegistryServiceObjectOwnerRegistered(info.objectType, owner);
|
251
|
+
}
|
245
252
|
}
|
246
253
|
}
|
247
254
|
|
@@ -21,7 +21,6 @@ contract RegistryServiceManager is
|
|
21
21
|
address registry, // used by implementation
|
22
22
|
bytes32 salt
|
23
23
|
)
|
24
|
-
ProxyManager(registry)
|
25
24
|
{
|
26
25
|
if(authority == address(0)) {
|
27
26
|
revert ErrorRegistryAccessManagerAuthorityZero();
|
@@ -33,7 +32,8 @@ contract RegistryServiceManager is
|
|
33
32
|
|
34
33
|
RegistryService srv = new RegistryService{ salt: salt }();
|
35
34
|
bytes memory data = abi.encode(registry, authority);
|
36
|
-
IVersionable versionable =
|
35
|
+
IVersionable versionable = initialize(
|
36
|
+
registry,
|
37
37
|
address(srv),
|
38
38
|
data,
|
39
39
|
salt);
|
@@ -9,7 +9,7 @@ import {AccessManaged} from "@openzeppelin/contracts/access/manager/AccessManage
|
|
9
9
|
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
|
10
10
|
|
11
11
|
import {NftId} from "../type/NftId.sol";
|
12
|
-
import {RoleId,
|
12
|
+
import {RoleId, ADMIN_ROLE, PUBLIC_ROLE} from "../type/RoleId.sol";
|
13
13
|
import {ObjectType, ObjectTypeLib, POOL, RELEASE, REGISTRY, SERVICE, STAKING} from "../type/ObjectType.sol";
|
14
14
|
import {Version, VersionLib, VersionPart, VersionPartLib} from "../type/Version.sol";
|
15
15
|
import {Timestamp, TimestampLib, zeroTimestamp, ltTimestamp} from "../type/Timestamp.sol";
|
@@ -32,8 +32,6 @@ import {Registry} from "./Registry.sol";
|
|
32
32
|
import {TokenRegistry} from "./TokenRegistry.sol";
|
33
33
|
import {ReleaseLifecycle} from "./ReleaseLifecycle.sol";
|
34
34
|
|
35
|
-
// TODO rename to something that does not end with 'Manager'
|
36
|
-
// everywhere else *Manager points to an upgradeable contract
|
37
35
|
contract ReleaseRegistry is
|
38
36
|
AccessManaged,
|
39
37
|
ReleaseLifecycle,
|
@@ -99,6 +97,9 @@ contract ReleaseRegistry is
|
|
99
97
|
mapping(VersionPart version => IRegistry.ReleaseInfo info) internal _releaseInfo;
|
100
98
|
mapping(VersionPart version => IServiceAuthorization authz) internal _serviceAuthorization;
|
101
99
|
|
100
|
+
// TODO check where/why this is used
|
101
|
+
mapping(address registryService => VersionPart version) _releaseVersionByAddress;
|
102
|
+
|
102
103
|
VersionPart private _initial;// first active version
|
103
104
|
VersionPart internal _latest; // latest active version
|
104
105
|
VersionPart internal _next; // version to create and activate
|
@@ -193,7 +194,6 @@ contract ReleaseRegistry is
|
|
193
194
|
emit LogReleaseCreation(version, releaseSalt);
|
194
195
|
}
|
195
196
|
|
196
|
-
// TODO this function can have 0 args -> use stored addresses from prepareNextRelease()
|
197
197
|
function registerService(IService service)
|
198
198
|
external
|
199
199
|
restricted // GIF_MANAGER_ROLE
|
@@ -228,16 +228,22 @@ contract ReleaseRegistry is
|
|
228
228
|
revert ErrorReleaseRegistryServiceDomainMismatch(expectedDomain, serviceDomain);
|
229
229
|
}
|
230
230
|
|
231
|
-
//
|
231
|
+
// register service with registry
|
232
|
+
// !!! TODO MUST call registry at the end of this function
|
233
|
+
nftId = _registry.registerService(info, serviceVersion, serviceDomain);
|
234
|
+
service.linkToRegisteredNftId();
|
235
|
+
_registeredServices++;
|
232
236
|
|
233
237
|
// setup service authorization
|
238
|
+
// !!! TODO service A can call service B while release is not active
|
234
239
|
_admin.authorizeService(
|
235
240
|
_serviceAuthorization[releaseVersion],
|
236
241
|
service,
|
237
242
|
serviceDomain,
|
238
|
-
|
243
|
+
serviceVersion);
|
239
244
|
|
240
245
|
// special roles for registry/staking/pool service
|
246
|
+
// !!! TODO registry service allowed to call registry while release is not activated (same for staking/pool service and staking)
|
241
247
|
if (
|
242
248
|
serviceDomain == REGISTRY() ||
|
243
249
|
serviceDomain == STAKING() ||
|
@@ -245,12 +251,6 @@ contract ReleaseRegistry is
|
|
245
251
|
{
|
246
252
|
_admin.grantServiceRoleForAllVersions(service, serviceDomain);
|
247
253
|
}
|
248
|
-
|
249
|
-
_registeredServices++;
|
250
|
-
|
251
|
-
// register service with registry
|
252
|
-
nftId = _registry.registerService(info, serviceVersion, serviceDomain);
|
253
|
-
service.linkToRegisteredNftId();
|
254
254
|
}
|
255
255
|
|
256
256
|
|
@@ -281,6 +281,7 @@ contract ReleaseRegistry is
|
|
281
281
|
_latest = version;
|
282
282
|
_state[version] = newState;
|
283
283
|
|
284
|
+
_releaseVersionByAddress[service] = version;
|
284
285
|
_releaseInfo[version].activatedAt = TimestampLib.blockTimestamp();
|
285
286
|
|
286
287
|
emit LogReleaseActivation(version);
|
@@ -299,7 +300,8 @@ contract ReleaseRegistry is
|
|
299
300
|
revert ErrorReleaseRegistryReleaseActivationDisallowed(version, state);
|
300
301
|
}
|
301
302
|
|
302
|
-
|
303
|
+
// TODO come up with a substitute
|
304
|
+
//_releaseAccessManager[version].disable();
|
303
305
|
|
304
306
|
_state[version] = newState;
|
305
307
|
_releaseInfo[version].disabledAt = TimestampLib.blockTimestamp();
|
@@ -321,7 +323,8 @@ contract ReleaseRegistry is
|
|
321
323
|
revert ErrorReleaseRegistryReleaseActivationDisallowed(version, state);
|
322
324
|
}
|
323
325
|
|
324
|
-
|
326
|
+
// TODO come up with a substitute
|
327
|
+
// _releaseAccessManager[version].enable();
|
325
328
|
|
326
329
|
_state[version] = newState;
|
327
330
|
_releaseInfo[version].disabledAt = zeroTimestamp();
|
@@ -339,6 +342,11 @@ contract ReleaseRegistry is
|
|
339
342
|
return Clones.predictDeterministicAddress(implementation, salt, deployer);
|
340
343
|
}
|
341
344
|
|
345
|
+
function isActiveRegistryService(address service) external view returns(bool) {
|
346
|
+
VersionPart version = _releaseVersionByAddress[service];
|
347
|
+
return isActiveRelease(version);
|
348
|
+
}
|
349
|
+
|
342
350
|
function isActiveRelease(VersionPart version) public view returns(bool) {
|
343
351
|
return _state[version] == ACTIVE();
|
344
352
|
}
|
@@ -387,57 +395,6 @@ contract ReleaseRegistry is
|
|
387
395
|
|
388
396
|
//--- private functions ----------------------------------------------------//
|
389
397
|
|
390
|
-
function _revokeReleaseRoles(VersionPart version)
|
391
|
-
private
|
392
|
-
{
|
393
|
-
address service;
|
394
|
-
ObjectType domain;
|
395
|
-
|
396
|
-
ObjectType[] memory domains = _serviceAuthorization[version].getServiceDomains();
|
397
|
-
for(uint idx = 0; idx < domains.length; idx++)
|
398
|
-
{
|
399
|
-
domain = domains[idx];
|
400
|
-
service = _registry.getServiceAddress(domain, version);
|
401
|
-
_admin.revokeServiceRole(IService(service), domain, version);
|
402
|
-
|
403
|
-
// special roles for registry/staking/pool service
|
404
|
-
if(
|
405
|
-
domain == REGISTRY() ||
|
406
|
-
domain == STAKING() ||
|
407
|
-
domain == POOL()
|
408
|
-
)
|
409
|
-
{
|
410
|
-
_admin.revokeServiceRoleForAllVersions(IService(service), domain);
|
411
|
-
}
|
412
|
-
}
|
413
|
-
}
|
414
|
-
|
415
|
-
function _grantReleaseRoles(VersionPart version)
|
416
|
-
private
|
417
|
-
{
|
418
|
-
address service;
|
419
|
-
ObjectType domain;
|
420
|
-
|
421
|
-
// TODO consider getting domains from local store
|
422
|
-
ObjectType[] memory domains = _serviceAuthorization[version].getServiceDomains();
|
423
|
-
for(uint idx = 0; idx < domains.length; idx++)
|
424
|
-
{
|
425
|
-
domain = domains[idx];
|
426
|
-
service = _registry.getServiceAddress(domain, version);
|
427
|
-
_admin.grantServiceRole(IService(service), domain, version);
|
428
|
-
|
429
|
-
// special roles for registry/staking/pool service
|
430
|
-
if(
|
431
|
-
domain == REGISTRY() ||
|
432
|
-
domain == STAKING() ||
|
433
|
-
domain == POOL()
|
434
|
-
)
|
435
|
-
{
|
436
|
-
_admin.grantServiceRoleForAllVersions(IService(service), domain);
|
437
|
-
}
|
438
|
-
}
|
439
|
-
}
|
440
|
-
|
441
398
|
function _verifyService(IService service)
|
442
399
|
internal
|
443
400
|
view
|
@@ -521,9 +478,10 @@ contract ReleaseRegistry is
|
|
521
478
|
if (registryAddress == address(0)) {
|
522
479
|
return false;
|
523
480
|
}
|
524
|
-
// TODO try catch and return false in case of revert
|
481
|
+
// TODO try catch and return false in case of revert
|
482
|
+
// or just panic
|
525
483
|
// check if contract returns a zero nft id for its own address
|
526
|
-
if (IRegistry(registryAddress).
|
484
|
+
if (IRegistry(registryAddress).getNftIdForAddress(registryAddress).eqz()) {
|
527
485
|
return false;
|
528
486
|
}
|
529
487
|
|
@@ -2,14 +2,12 @@
|
|
2
2
|
pragma solidity ^0.8.20;
|
3
3
|
|
4
4
|
import {
|
5
|
-
ALL, REGISTRY,
|
5
|
+
ALL, REGISTRY, PRODUCT, ORACLE, POOL, INSTANCE, COMPONENT, DISTRIBUTION, DISTRIBUTOR, APPLICATION, POLICY, CLAIM, BUNDLE, STAKING, PRICE
|
6
6
|
} from "../../contracts/type/ObjectType.sol";
|
7
7
|
|
8
|
-
import {ComponentService} from "../shared/ComponentService.sol";
|
9
8
|
import {IAccess} from "../authorization/IAccess.sol";
|
10
9
|
import {IBundleService} from "../pool/IBundleService.sol";
|
11
10
|
import {IDistributionService} from "../distribution/IDistributionService.sol";
|
12
|
-
import {InstanceService} from "../instance/InstanceService.sol";
|
13
11
|
import {IInstanceService} from "../instance/IInstanceService.sol";
|
14
12
|
import {IPoolService} from "../pool/IPoolService.sol";
|
15
13
|
import {IStakingService} from "../staking/IStakingService.sol";
|
@@ -39,9 +37,9 @@ contract ServiceAuthorizationV3
|
|
39
37
|
_authorizeDomain(POOL(), address(8));
|
40
38
|
_authorizeDomain(ORACLE(), address(9));
|
41
39
|
_authorizeDomain(PRODUCT(), address(10));
|
42
|
-
_authorizeDomain(
|
43
|
-
_authorizeDomain(
|
44
|
-
_authorizeDomain(
|
40
|
+
_authorizeDomain(POLICY(), address(11));
|
41
|
+
_authorizeDomain(CLAIM(), address(12));
|
42
|
+
_authorizeDomain(APPLICATION(), address(13));
|
45
43
|
}
|
46
44
|
|
47
45
|
|
@@ -163,6 +161,7 @@ contract ServiceAuthorizationV3
|
|
163
161
|
|
164
162
|
functions = _authorizeForService(DISTRIBUTION(), POLICY());
|
165
163
|
_authorize(functions, IDistributionService.processSale.selector, "processSale");
|
164
|
+
_authorize(functions, IDistributionService.processReferral.selector, "processReferral");
|
166
165
|
}
|
167
166
|
|
168
167
|
|
@@ -175,11 +174,10 @@ contract ServiceAuthorizationV3
|
|
175
174
|
functions = _authorizeForService(POOL(), POLICY());
|
176
175
|
_authorize(functions, IPoolService.lockCollateral.selector, "lockCollateral");
|
177
176
|
_authorize(functions, IPoolService.releaseCollateral.selector, "releaseCollateral");
|
178
|
-
_authorize(functions, IPoolService.reduceCollateral.selector, "reduceCollateral");
|
179
177
|
_authorize(functions, IPoolService.processSale.selector, "processSale");
|
180
178
|
|
181
179
|
functions = _authorizeForService(POOL(), CLAIM());
|
182
|
-
_authorize(functions, IPoolService.
|
180
|
+
_authorize(functions, IPoolService.processPayout.selector, "processPayout");
|
183
181
|
}
|
184
182
|
|
185
183
|
|
@@ -6,7 +6,7 @@ import {IAccessManaged} from "@openzeppelin/contracts/access/manager/IAccessMana
|
|
6
6
|
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
7
7
|
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
8
8
|
|
9
|
-
import {Amount} from "../type/Amount.sol";
|
9
|
+
import {Amount, AmountLib} from "../type/Amount.sol";
|
10
10
|
import {IComponent} from "./IComponent.sol";
|
11
11
|
import {IComponents} from "../instance/module/IComponents.sol";
|
12
12
|
import {NftId, NftIdLib} from "../type/NftId.sol";
|
@@ -26,7 +26,6 @@ abstract contract Component is
|
|
26
26
|
struct ComponentStorage {
|
27
27
|
string _name; // unique (per instance) component name
|
28
28
|
IERC20Metadata _token; // token for this component
|
29
|
-
TokenHandler _tokenHandler;
|
30
29
|
address _wallet;
|
31
30
|
bool _isInterceptor;
|
32
31
|
bytes _data;
|
@@ -40,14 +39,13 @@ abstract contract Component is
|
|
40
39
|
_;
|
41
40
|
}
|
42
41
|
|
43
|
-
|
44
42
|
function _getComponentStorage() private pure returns (ComponentStorage storage $) {
|
45
43
|
assembly {
|
46
44
|
$.slot := COMPONENT_LOCATION_V1
|
47
45
|
}
|
48
46
|
}
|
49
47
|
|
50
|
-
function
|
48
|
+
function _initializeComponent(
|
51
49
|
address authority,
|
52
50
|
address registry,
|
53
51
|
NftId parentNftId,
|
@@ -59,11 +57,11 @@ abstract contract Component is
|
|
59
57
|
bytes memory registryData, // writeonly data that will saved in the object info record of the registry
|
60
58
|
bytes memory componentData // other component specific data
|
61
59
|
)
|
62
|
-
|
60
|
+
internal
|
63
61
|
virtual
|
64
62
|
onlyInitializing()
|
65
63
|
{
|
66
|
-
|
64
|
+
_initializeRegisterable(registry, parentNftId, componentType, isInterceptor, initialOwner, registryData);
|
67
65
|
__AccessManaged_init(authority);
|
68
66
|
|
69
67
|
if (token == address(0)) {
|
@@ -78,13 +76,12 @@ abstract contract Component is
|
|
78
76
|
ComponentStorage storage $ = _getComponentStorage();
|
79
77
|
$._name = name;
|
80
78
|
$._token = IERC20Metadata(token);
|
81
|
-
$._tokenHandler = TokenHandler(address(0));
|
82
79
|
$._wallet = address(this);
|
83
80
|
$._isInterceptor = isInterceptor;
|
84
81
|
$._data = componentData;
|
85
82
|
|
86
|
-
|
87
|
-
|
83
|
+
_registerInterface(type(IAccessManaged).interfaceId);
|
84
|
+
_registerInterface(type(IComponent).interfaceId);
|
88
85
|
}
|
89
86
|
|
90
87
|
|
@@ -105,11 +102,11 @@ abstract contract Component is
|
|
105
102
|
revert ErrorComponentWalletNotComponent();
|
106
103
|
}
|
107
104
|
|
105
|
+
emit LogComponentTokenHandlerApproved(address(getTokenHandler()), spendingLimitAmount);
|
106
|
+
|
108
107
|
IERC20Metadata(token).approve(
|
109
108
|
address(getTokenHandler()),
|
110
109
|
spendingLimitAmount.toInt());
|
111
|
-
|
112
|
-
emit LogComponentTokenHandlerApproved(address(getTokenHandler()), spendingLimitAmount);
|
113
110
|
}
|
114
111
|
|
115
112
|
function setWallet(address newWallet)
|
@@ -120,34 +117,22 @@ abstract contract Component is
|
|
120
117
|
{
|
121
118
|
// checks
|
122
119
|
address currentWallet = getWallet();
|
123
|
-
|
124
|
-
uint256 currentBalance = token.balanceOf(currentWallet);
|
125
|
-
|
126
|
-
if (currentBalance > 0) {
|
127
|
-
if (currentWallet == address(this)) {
|
128
|
-
// move tokens from component smart contract to external wallet
|
129
|
-
} else {
|
130
|
-
// move tokens from external wallet to component smart contract or another external wallet
|
131
|
-
uint256 allowance = token.allowance(currentWallet, address(this));
|
132
|
-
if (allowance < currentBalance) {
|
133
|
-
revert ErrorComponentWalletAllowanceTooSmall(currentWallet, newWallet, allowance, currentBalance);
|
134
|
-
}
|
135
|
-
}
|
136
|
-
}
|
120
|
+
uint256 currentBalance = getToken().balanceOf(currentWallet);
|
137
121
|
|
138
122
|
// effects
|
139
123
|
_setWallet(newWallet);
|
140
124
|
|
141
125
|
// interactions
|
142
126
|
if (currentBalance > 0) {
|
143
|
-
//
|
127
|
+
// move tokens from old to new wallet
|
128
|
+
emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
|
129
|
+
|
144
130
|
if (currentWallet == address(this)) {
|
145
|
-
//
|
146
|
-
|
131
|
+
// transfer from the component requires an allowance
|
132
|
+
getTokenHandler().distributeTokens(currentWallet, newWallet, AmountLib.toAmount(currentBalance));
|
133
|
+
} else {
|
134
|
+
getTokenHandler().collectTokens(currentWallet, newWallet, AmountLib.toAmount(currentBalance));
|
147
135
|
}
|
148
|
-
|
149
|
-
SafeERC20.safeTransferFrom(token, currentWallet, newWallet, currentBalance);
|
150
|
-
emit LogComponentWalletTokensTransferred(currentWallet, newWallet, currentBalance);
|
151
136
|
}
|
152
137
|
}
|
153
138
|
|
@@ -214,7 +199,7 @@ abstract contract Component is
|
|
214
199
|
|
215
200
|
|
216
201
|
function isRegistered() public virtual view returns (bool) {
|
217
|
-
return getRegistry().
|
202
|
+
return getRegistry().getNftIdForAddress(address(this)).gtz();
|
218
203
|
}
|
219
204
|
|
220
205
|
|
@@ -253,29 +238,24 @@ abstract contract Component is
|
|
253
238
|
}
|
254
239
|
|
255
240
|
|
256
|
-
/// @dev for component contracts that hold its own component information
|
257
|
-
/// this function creates and sets a token hanlder for the components tokens
|
258
|
-
function _createAndSetTokenHandler()
|
259
|
-
internal
|
260
|
-
{
|
261
|
-
ComponentStorage storage $ = _getComponentStorage();
|
262
|
-
$._tokenHandler = new TokenHandler(address($._token));
|
263
|
-
}
|
264
|
-
|
265
|
-
|
266
241
|
/// @dev depending on the source of the component information this function needs to be overwritten.
|
267
242
|
/// eg for instance linked components that externally store this information with the instance store contract
|
268
243
|
function _getComponentInfo() internal virtual view returns (IComponents.ComponentInfo memory info) {
|
269
244
|
ComponentStorage storage $ = _getComponentStorage();
|
270
|
-
|
245
|
+
|
271
246
|
return IComponents.ComponentInfo({
|
272
247
|
name: $._name,
|
273
248
|
productNftId: NftIdLib.zero(),
|
274
249
|
token: $._token,
|
275
|
-
tokenHandler:
|
250
|
+
tokenHandler: TokenHandler(address(0)),
|
276
251
|
wallet: $._wallet, // initial wallet address
|
277
252
|
data: $._data // user specific component data
|
278
253
|
});
|
279
254
|
}
|
280
255
|
|
256
|
+
function _approveTokenHandler(uint256 amount) internal {
|
257
|
+
ComponentStorage storage $ = _getComponentStorage();
|
258
|
+
$._token.approve(address(getComponentInfo().tokenHandler), amount);
|
259
|
+
}
|
260
|
+
|
281
261
|
}
|