proofchain/packages/contracts/test/payments/mocks/MockReputationEngine.sol
caelum0x e361a8dc22 feat: ProofChain platform — 64 contracts (11 modules), backend API, expanded web
- core: AddressBook registry, Roles lib, ProofChainAccess base, Pauser
- modules: provenance, payments/treasury, identity, reputation, finance/RWA,
  insurance, disputes+governance, esg/tokenization, marketplace, rewards
- @proofchain/api: 33 routers + event indexer (Supabase)
- web: 37 pages incl landing, explorer, finance, governance, esg, marketplace
- 704 forge tests + 449 vitest tests green; 61 ABIs exported

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-31 19:22:38 +03:00

42 lines
1.3 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import { IReputationEngine } from "../../../src/interfaces/IReputationEngine.sol";
/// @notice Minimal {IReputationEngine} stand-in for exercising the escrow/router reputation hook.
/// @dev Records the last outcome and a call counter. `shouldRevert` proves the hook degrades
/// gracefully (settlement must not brick when the engine reverts).
contract MockReputationEngine is IReputationEngine {
struct LastOutcome {
address supplier;
bool passed;
uint16 score;
}
LastOutcome public last;
uint256 public calls;
mapping(address => uint256) public recorded;
bool public shouldRevert;
function setShouldRevert(bool value) external {
shouldRevert = value;
}
function recordOutcome(address supplier, bool passed, uint16 score) external override {
if (shouldRevert) revert("reputation: forced revert");
last = LastOutcome({ supplier: supplier, passed: passed, score: score });
calls += 1;
recorded[supplier] += 1;
emit OutcomeRecorded(supplier, passed, score, score);
}
function reputationOf(address)
external
pure
override
returns (uint16 avgScoreBps, uint256 totalDeals, uint16 passRateBps, uint256 disputes)
{
return (0, 0, 0, 0);
}
}