Skip to content

Commit

Permalink
refactor PricingService to inherit from Service (#654)
Browse files Browse the repository at this point in the history
  • Loading branch information
doerfli authored and matthiaszimmermann committed Sep 3, 2024
1 parent d40b55a commit 4441b74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
11 changes: 6 additions & 5 deletions contracts/product/PricingService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity ^0.8.20;

import {Amount, AmountLib} from "../type/Amount.sol";
import {ContractLib} from "../shared/ContractLib.sol";
import {Seconds} from "../type/Seconds.sol";
import {UFixed, UFixedLib} from "../type/UFixed.sol";
import {ObjectType} from "../type/ObjectType.sol";
Expand All @@ -21,14 +22,14 @@ import {IPolicy} from "../instance/module/IPolicy.sol";
import {IBundle} from "../instance/module/IBundle.sol";
import {IDistribution} from "../instance/module/IDistribution.sol";

import {ComponentVerifyingService} from "../shared/ComponentVerifyingService.sol";
import {Service} from "../shared/Service.sol";

import {IPricingService} from "./IPricingService.sol";
import {IDistributionService} from "../distribution/IDistributionService.sol";


contract PricingService is
ComponentVerifyingService,
Service,
IPricingService
{
IDistributionService internal _distributionService;
Expand Down Expand Up @@ -81,11 +82,11 @@ contract PricingService is
// verify product
(
IRegistry.ObjectInfo memory registryInfo,
IInstance instance
) = _getAndVerifyComponentInfo(productNftId, PRODUCT(), false);
address instanceAddress
) = ContractLib.getInfoAndInstance(getRegistry(), productNftId, false);

// get instance reader from local instance variable
reader = instance.getInstanceReader();
reader = IInstance(instanceAddress).getInstanceReader();

NftId riskProductNftId = reader.getRiskInfo(riskId).productNftId;
if (productNftId != riskProductNftId) {
Expand Down
9 changes: 3 additions & 6 deletions scripts/libs/services.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

import { getImplementationAddress } from '@openzeppelin/upgrades-core';
import { AddressLike, BytesLike, Signer, id } from "ethers";
import { ethers as hhEthers } from "hardhat";
import {
AccountingService, AccountingServiceManager, AccountingService__factory,
ApplicationService, ApplicationServiceManager, ApplicationService__factory,
BundleService, BundleServiceManager, BundleService__factory,
ClaimService, ClaimServiceManager, ClaimService__factory,
ComponentService, ComponentServiceManager, ComponentService__factory,
ComponentService,
ComponentService__factory,
DistributionService, DistributionServiceManager, DistributionService__factory,
IRegistry__factory,
InstanceService, InstanceServiceManager, InstanceService__factory,
Expand All @@ -17,19 +16,17 @@ import {
PricingService, PricingServiceManager, PricingService__factory,
ProxyManager,
RegistryService,
RegistryServiceManager,
RegistryService__factory,
ReleaseRegistry,
RiskService, RiskServiceManager, RiskService__factory,
StakingService, StakingServiceManager, StakingService__factory
} from "../../typechain-types";
import { logger } from "../logger";
import { deployContract, deployProxyManagerContract } from "./deployment";
import { deployProxyManagerContract } from "./deployment";
import { LibraryAddresses } from "./libraries";
import { RegistryAddresses } from "./registry";
import { createRelease } from "./release";
import { executeTx, getFieldFromTxRcptLogs, getTxOpts } from "./transaction";
import { prepareVerificationData } from './verification';


export type ServiceAddresses = {
Expand Down

0 comments on commit 4441b74

Please sign in to comment.