settlekit/contracts/script/DeployLepton.s.sol
caelum0x 80adccccff feat(contracts): one-command Arc deploy for the three Lepton contracts
Add DeployLepton.s.sol — deploys RecursiveSplitDistributor, LeptonStreamSettlement,
and AgentReputationBond to Arc in one forge script, mirroring the existing
Deploy.s.sol style (minimal Vm surface, no forge-std). USDC (the native gas token
at 0x3600…0000) is the default settlement asset, overridable via ARC_USDC_ADDRESS.

Verified by dry-run: simulates all three deploys (gas ~1.46M) and returns their
addresses; broadcast needs a faucet-funded deployer key.

Document the full live-testnet runbook in the plan: CLI auth, contract deploy
(dry-run + broadcast), and flipping the sidecars to SETTLEMENT_PROVIDER=circle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 17:41:31 +03:00

56 lines
2.3 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {IERC20} from "../src/interfaces/IERC20.sol";
import {RecursiveSplitDistributor} from "../src/RecursiveSplitDistributor.sol";
import {LeptonStreamSettlement} from "../src/LeptonStreamSettlement.sol";
import {AgentReputationBond} from "../src/AgentReputationBond.sol";
/** Minimal cheatcode surface for a forge script (avoids a forge-std dependency). */
interface Vm {
function envOr(string calldata name, address defaultValue) external view returns (address);
function startBroadcast() external;
function stopBroadcast() external;
}
/**
* Deploy the three Lepton on-chain settlement contracts to Arc:
* - RecursiveSplitDistributor — fan out a citation/remix lineage in one tx (RFB 6)
* - LeptonStreamSettlement — per-second deposit/accrue/settle/close stream (RFB 4)
* - AgentReputationBond — ERC-8004-style bond post/release/slash (RFB 3)
*
* All three settle the same asset; on Arc that is USDC, the native gas token,
* which also exposes a 6-decimal ERC-20 interface at the address below.
*
* Env (Arc testnet default is the real bundled USDC address):
* ARC_USDC_ADDRESS default 0x3600…0000 (USDC, native gas token)
*
* Dry-run (simulation, no broadcast):
* forge script script/DeployLepton.s.sol
* Broadcast (needs a faucet-funded deployer; USDC is the gas token):
* forge script script/DeployLepton.s.sol --rpc-url https://rpc.testnet.arc.network \
* --private-key $DEPLOYER_KEY --broadcast
*/
contract DeployLepton {
Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
address internal constant DEFAULT_USDC = 0x3600000000000000000000000000000000000000;
function run()
external
returns (address distributor, address stream, address bond)
{
IERC20 usdc = IERC20(vm.envOr("ARC_USDC_ADDRESS", DEFAULT_USDC));
vm.startBroadcast();
RecursiveSplitDistributor distributorC = new RecursiveSplitDistributor(usdc);
LeptonStreamSettlement streamC = new LeptonStreamSettlement(usdc);
AgentReputationBond bondC = new AgentReputationBond(usdc);
vm.stopBroadcast();
distributor = address(distributorC);
stream = address(streamC);
bond = address(bondC);
}
}