- 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>
66 lines
2.7 KiB
Solidity
66 lines
2.7 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity 0.8.24;
|
|
|
|
import { Script } from "forge-std/Script.sol";
|
|
import { console2 } from "forge-std/console2.sol";
|
|
|
|
import { ProvenanceRegistry } from "../src/ProvenanceRegistry.sol";
|
|
import { AttestationRegistry } from "../src/AttestationRegistry.sol";
|
|
import { SettlementEscrow } from "../src/SettlementEscrow.sol";
|
|
import { MockUSDC } from "../src/MockUSDC.sol";
|
|
|
|
/// @title Deploy
|
|
/// @notice Deploys the four ProofChain contracts, grants AGENT_ROLE to AGENT_ADDRESS,
|
|
/// and writes deployed addresses to deployments/base-sepolia.json.
|
|
/// @dev Reads DEPLOYER_PRIVATE_KEY and AGENT_ADDRESS from env. Fails fast if missing.
|
|
contract Deploy is Script {
|
|
function run() external {
|
|
uint256 deployerKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
|
|
address agent = vm.envAddress("AGENT_ADDRESS");
|
|
require(agent != address(0), "AGENT_ADDRESS must be set");
|
|
|
|
address deployer = vm.addr(deployerKey);
|
|
|
|
vm.startBroadcast(deployerKey);
|
|
|
|
// Admin for all registries/escrow is the deployer.
|
|
ProvenanceRegistry provenance = new ProvenanceRegistry(deployer);
|
|
AttestationRegistry attestation = new AttestationRegistry(deployer, address(provenance));
|
|
SettlementEscrow escrow = new SettlementEscrow(deployer, address(attestation), address(provenance));
|
|
MockUSDC usdc = new MockUSDC();
|
|
|
|
// Wire roles: the verification agent may attest.
|
|
attestation.grantRole(attestation.AGENT_ROLE(), agent);
|
|
|
|
vm.stopBroadcast();
|
|
|
|
_writeDeployments(deployer, agent, address(provenance), address(attestation), address(escrow), address(usdc));
|
|
|
|
console2.log("ProvenanceRegistry:", address(provenance));
|
|
console2.log("AttestationRegistry:", address(attestation));
|
|
console2.log("SettlementEscrow:", address(escrow));
|
|
console2.log("MockUSDC:", address(usdc));
|
|
console2.log("AGENT_ROLE granted to:", agent);
|
|
}
|
|
|
|
function _writeDeployments(
|
|
address deployer,
|
|
address agent,
|
|
address provenance,
|
|
address attestation,
|
|
address escrow,
|
|
address usdc
|
|
) internal {
|
|
string memory obj = "deployments";
|
|
vm.serializeUint(obj, "chainId", block.chainid);
|
|
vm.serializeAddress(obj, "deployer", deployer);
|
|
vm.serializeAddress(obj, "agent", agent);
|
|
vm.serializeAddress(obj, "ProvenanceRegistry", provenance);
|
|
vm.serializeAddress(obj, "AttestationRegistry", attestation);
|
|
vm.serializeAddress(obj, "SettlementEscrow", escrow);
|
|
string memory json = vm.serializeAddress(obj, "MockUSDC", usdc);
|
|
|
|
vm.writeJson(json, "./deployments/base-sepolia.json");
|
|
}
|
|
}
|