aere-contracts/contracts/mocks/MockSinkRouter.sol
Aere Network a13a649b77
Some checks are pending
contracts-ci / Install (lockfile) → compile → full test suite (push) Waiting to run
contracts-ci / PQC known-answer tests (NIST vectors) (push) Waiting to run
contracts-ci / Coverage (scoped, with artifacts) (push) Waiting to run
Initial public release
Aere Network public source. Everything here can be checked against the live
chain (chain id 2800, https://rpc.aere.network).

Scope note, stated up front rather than buried: consensus on chain 2800 is
classical secp256k1 ECDSA QBFT. The post-quantum work in this repository is at
the signature, precompile, account and transport layers. Nothing here makes the
consensus post-quantum, and no document in it should be read as claiming so.
2026-07-20 01:02:37 +03:00

32 lines
1.1 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// Mock V2-style AMM router that captures the amountOutMin passed in.
/// Used to verify AereSink's oracle-floor computation logic.
contract MockSinkRouter {
uint256 public lastAmountOutMin;
address public outTokenOverride;
function setOutToken(address t) external { outTokenOverride = t; }
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256
) external returns (uint256[] memory amounts) {
lastAmountOutMin = amountOutMin;
IERC20(path[0]).transferFrom(msg.sender, address(this), amountIn);
// Always return at least amountOutMin (success path) so we can verify
// the floor without triggering the try/catch fallback in AereSink.
address outT = outTokenOverride == address(0) ? path[path.length - 1] : outTokenOverride;
IERC20(outT).transfer(to, amountOutMin);
amounts = new uint256[](2);
amounts[0] = amountIn;
amounts[1] = amountOutMin;
}
}