Setoff

Developers

Run & deploy

Run the whole stack on your machine in two commands, with Arc's real contracts and free funds.

Run it locally

You need Arc Foundry (arc-forge, arc-cast, arc-anvil) and Node 20+.

bash
git clone --recursive https://github.com/Anshv784/setoff && cd setoff
./scripts/local.sh                    # fork Arc Testnet, deploy, seed 25 bills, settle a cycle
cd web && npm install && npm run dev  # http://localhost:3000

local.sh runs arc-anvil as a fork of Arc Testnet, so Arc's real USDC, EURC, Memo, Multicall3From and ERC-8004 registry exist locally. It writes throwaway keys to .local.env, including a funded test wallet to import into your browser wallet (RPC http://127.0.0.1:8545, chain id 5042002).

bash
cd solver && set -a && . ../.local.env && set +a
npm run demo:seed -- 20   # 20 more bills; net debtors fund their shortfall
npm run solve             # settle the next cycle

Tests

bash
cd contracts && arc-forge test   # 22 tests: unit, fuzz, invariants
cd solver && npm test            # 8 tests, including the brute-force comparison

Deploy

bash
cd contracts
arc-forge script script/Deploy.s.sol --rpc-url arc --broadcast --private-key $PK

Then set the address and deploy block in solver/src/config.ts and web/lib/config.ts, build the site with NEXT_PUBLIC_SETOFF_NETWORK=mainnet, and run the solver on a schedule.

Addresses

ContractAddress
Setoff (Arc Mainnet)0x9C09F52cFB6f2B563FD0fC27cf585DE33dD820A6
USDC0x3600000000000000000000000000000000000000
EURC0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1
Memo0x5294E9927c3306DcBaDb03fe70b92e01cCede505
Multicall3From0x522fAf9A91c41c443c66765030741e4AaCe147D0
ERC-8004 IdentityRegistry0x8004A169FB4a3325136EB29fA0ceB6D2e539a432