- contracts: ProvenanceRegistry, AttestationRegistry, SettlementEscrow, MockUSDC (Foundry, OZ AccessControl/SafeERC20/ReentrancyGuard/Pausable), 55 tests - shared: typed ABI/type/address layer (viem, Base Sepolia) - agent: Fastify + Claude tool-calling verification service, deterministic scoring reconciliation, on-chain attest/settle, 73 tests - web: Next.js 15 dApp (wagmi/viem/RainbowKit) — supplier/buyer/verifier/deal, 80 tests - infra: Supabase schema + client, IPFS (Pinata + local fallback), 45 tests - integrated, security + TS reviewed, 18 findings fixed; 314 tests green Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
35 lines
1.1 KiB
Solidity
35 lines
1.1 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity 0.8.24;
|
|
|
|
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
import { SettlementEscrow } from "../../src/SettlementEscrow.sol";
|
|
|
|
/// @notice Malicious ERC20 that re-enters SettlementEscrow.settle on transfer.
|
|
/// @dev Used to prove the nonReentrant guard blocks reentrancy during settlement.
|
|
contract ReentrantToken is ERC20 {
|
|
SettlementEscrow public escrow;
|
|
bytes32 public targetBatch;
|
|
bool public armed;
|
|
|
|
constructor() ERC20("Reentrant", "RE") { }
|
|
|
|
function mint(address to, uint256 amount) external {
|
|
_mint(to, amount);
|
|
}
|
|
|
|
function arm(SettlementEscrow escrow_, bytes32 batchId) external {
|
|
escrow = escrow_;
|
|
targetBatch = batchId;
|
|
armed = true;
|
|
}
|
|
|
|
/// @dev On transfer (invoked by escrow.settle -> safeTransfer), attempt to re-enter settle.
|
|
function transfer(address to, uint256 value) public override returns (bool) {
|
|
if (armed) {
|
|
armed = false; // prevent infinite recursion if guard were absent
|
|
escrow.settle(targetBatch);
|
|
}
|
|
return super.transfer(to, value);
|
|
}
|
|
}
|