Live-wiring (flip to production by config, no code change): - settlementProviderFromEnv (local/Circle) wired into every sidecar startSidecar - createFeedPoller fetches a live RSSHub JSON feed and ingests on an interval On-chain contracts (Foundry, Solc 0.8.30, forge test green): - RecursiveSplitDistributor.sol: settle a citation/remix lineage in one tx (RFB 6) - LeptonStreamSettlement.sol: per-second stream w/ reserve, proof-of-flow pause/resume, settle, close+refund (RFB 4) - AgentReputationBond.sol: ERC-8004-style USDC bond, release/slash (RFB 3) All green: full typecheck, 885 JS tests, 25 Foundry tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
59 lines
1.8 KiB
Solidity
59 lines
1.8 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {IERC20} from "../src/interfaces/IERC20.sol";
|
|
|
|
/** Minimal subset of the Foundry cheatcode interface used by these tests. */
|
|
interface Vm {
|
|
function prank(address) external;
|
|
function expectRevert() external;
|
|
function expectRevert(bytes4 selector) external;
|
|
function expectEmit(bool, bool, bool, bool) external;
|
|
function warp(uint256) external;
|
|
}
|
|
|
|
/** Tiny self-contained test base (avoids a forge-std dependency). */
|
|
contract Test {
|
|
Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
|
|
|
|
function assertEq(uint256 a, uint256 b) internal pure {
|
|
require(a == b, "assertEq(uint) failed");
|
|
}
|
|
|
|
function assertEq(address a, address b) internal pure {
|
|
require(a == b, "assertEq(address) failed");
|
|
}
|
|
|
|
function assertTrue(bool c) internal pure {
|
|
require(c, "assertTrue failed");
|
|
}
|
|
}
|
|
|
|
/** Mintable mock ERC-20 standing in for USDC. */
|
|
contract MockERC20 is IERC20 {
|
|
mapping(address => uint256) public override balanceOf;
|
|
mapping(address => mapping(address => uint256)) public allowance;
|
|
|
|
function mint(address to, uint256 amount) external {
|
|
balanceOf[to] += amount;
|
|
}
|
|
|
|
function approve(address spender, uint256 amount) external returns (bool) {
|
|
allowance[msg.sender][spender] = amount;
|
|
return true;
|
|
}
|
|
|
|
function transfer(address to, uint256 amount) external override returns (bool) {
|
|
balanceOf[msg.sender] -= amount;
|
|
balanceOf[to] += amount;
|
|
return true;
|
|
}
|
|
|
|
function transferFrom(address from, address to, uint256 amount) external override returns (bool) {
|
|
allowance[from][msg.sender] -= amount;
|
|
balanceOf[from] -= amount;
|
|
balanceOf[to] += amount;
|
|
return true;
|
|
}
|
|
}
|