Files
smom-dbis-138/test/emoney/mocks/MockLightClient.sol

49 lines
1.4 KiB
Solidity
Raw Normal View History

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* @title MockLightClient
* @notice Mock light client for testing BridgeVault138 unlock functionality
* @dev Always returns true for proof verification in tests
*/
contract MockLightClient {
mapping(bytes32 => mapping(bytes32 => bool)) private _verifiedProofs;
bool public alwaysVerify = true;
/**
* @notice Sets whether proofs should always verify
* @param _alwaysVerify If true, all proofs verify; if false, only pre-registered proofs verify
*/
function setAlwaysVerify(bool _alwaysVerify) external {
alwaysVerify = _alwaysVerify;
}
/**
* @notice Registers a proof as verified for testing
* @param sourceChain Source chain identifier
* @param sourceTx Source transaction hash
*/
function registerProof(bytes32 sourceChain, bytes32 sourceTx) external {
_verifiedProofs[sourceChain][sourceTx] = true;
}
/**
* @notice Verifies a proof
* @param sourceChain Source chain identifier
* @param sourceTx Source transaction hash
* @param proof Proof data (unused in mock)
* @return true if proof is verified, false otherwise
*/
function verifyProof(
bytes32 sourceChain,
bytes32 sourceTx,
bytes calldata proof
) external view returns (bool) {
if (alwaysVerify) {
return true;
}
return _verifiedProofs[sourceChain][sourceTx];
}
}