proofchain/packages/contracts/test/reputation/mocks/MockStablecoinRegistry.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

39 lines
1.3 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import { IStablecoinRegistry } from "../../../src/interfaces/IStablecoinRegistry.sol";
/// @notice Minimal in-memory {IStablecoinRegistry} for reputation-module tests.
contract MockStablecoinRegistry is IStablecoinRegistry {
error ZeroAddress();
mapping(address => TokenInfo) private _info;
address[] private _tokens;
function addToken(address token, uint8 decimals) external override {
if (token == address(0)) revert ZeroAddress();
if (_info[token].accepted) revert TokenAlreadyAdded(token);
_info[token] = TokenInfo({ token: token, decimals: decimals, accepted: true });
_tokens.push(token);
emit TokenAdded(token, decimals);
}
function removeToken(address token) external override {
if (!_info[token].accepted) revert TokenNotAccepted(token);
_info[token].accepted = false;
emit TokenRemoved(token);
}
function isAccepted(address token) external view override returns (bool) {
return _info[token].accepted;
}
function decimalsOf(address token) external view override returns (uint8) {
return _info[token].decimals;
}
function tokens() external view override returns (address[] memory) {
return _tokens;
}
}