Skip to content

Commit

Permalink
Merge pull request #686 from etherisc/feature/service-logging
Browse files Browse the repository at this point in the history
emit events in services (part 2)
  • Loading branch information
doerfli authored Sep 5, 2024
2 parents d8532da + 1c1468a commit b8481dc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/product/ClaimService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ contract ClaimService is

claimInfo.closedAt = TimestampLib.blockTimestamp();
instanceStore.updateClaim(policyNftId, claimId, claimInfo, CLOSED());

emit LogClaimServiceClaimClosed(policyNftId, claimId);
}


Expand Down
4 changes: 4 additions & 0 deletions contracts/product/IRiskService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import {StateId} from "../type/StateId.sol";

interface IRiskService is IService {

event LogRiskServiceRiskCreated(NftId productNftId, RiskId riskId);
event LogRiskServiceRiskUpdated(NftId productNftId, RiskId riskId);
event LogRiskServiceRiskStateUpdated(NftId productNftId, RiskId riskId, StateId newState);

error ErrorRiskServiceRiskProductMismatch(RiskId riskId, NftId riskProductNftId, NftId productNftId);

/// @dev Create a new risk with the given id and provided data.
Expand Down
6 changes: 6 additions & 0 deletions contracts/product/RiskService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ contract RiskService is
// add risk to RiskSet
RiskSet riskSet = instance.getRiskSet();
riskSet.add(riskId);

emit LogRiskServiceRiskCreated(productNftId, riskId);
}


Expand All @@ -91,6 +93,8 @@ contract RiskService is

riskInfo.data = data;
instance.getInstanceStore().updateRisk(riskId, riskInfo, KEEP_STATE());

emit LogRiskServiceRiskUpdated(productNftId, riskId);
}


Expand Down Expand Up @@ -118,6 +122,8 @@ contract RiskService is
} else if (state == PAUSED()) {
instance.getRiskSet().pause(riskId);
}

emit LogRiskServiceRiskStateUpdated(productNftId, riskId, state);
}

function _getAndVerifyActiveComponent(ObjectType expectedType)
Expand Down

0 comments on commit b8481dc

Please sign in to comment.