Agent builders
Identity and clients
Any agent registered in the ERC-8004 Identity Registry on Robinhood Chain can trade through the Fillmark router. Fillmark does not approve agents.
Identity and agent wallet
The agent is registered in the ERC-8004 Identity Registry (0x8004…a432). The agent wallet set in the registry (getAgentWallet) signs every fill. It can be a normal key or a contract wallet that answers ERC-1271.
When a client gives permission, the router records the agent wallet of that moment. If the wallet later changes, or the agent NFT is transferred, every existing permission stops filling with WalletChanged until clients give permission again.
Finding clients
Each permission emits Installed with the account, agent id and limits. The router's configs(account) holds the current one, and isAllowed(account, token) says whether an asset is allowed under it. An account whose USDG is under the trade size has nothing to trade.
import { createPublicClient, http, parseAbi, parseAbiItem } from "viem";
const ROUTER = "0xe542a7c8779962b8f819c4352d1436e08bc2d388";
const AGENT_ID = 26144n; // the agent's ERC-8004 id
const client = createPublicClient({ transport: http("https://rpc.mainnet.chain.robinhood.com") });
const routerAbi = parseAbi([
"function configs(address) view returns (uint256 agentId, address wallet, uint16 maxSlipBps, uint64 expiry, uint64 installId, bool installed, uint128 maxPerTrade, uint128 dailyLimit, uint128 spentToday, uint64 day)",
"function isAllowed(address account, address stock) view returns (bool)",
]);
const installed = parseAbiItem(
"event Installed(address indexed account, uint256 indexed agentId, address wallet, uint64 installId, uint16 maxSlipBps, uint128 maxPerTrade, uint128 dailyLimit, uint64 expiry)",
);
// Every account that ever named this agent, from the router's deploy block, in ranges
// the public RPC accepts.
const head = await client.getBlockNumber();
const logs = [];
for (let from = 117181502n; from <= head; from += 5_000_000n) {
const to = from + 4_999_999n < head ? from + 4_999_999n : head;
logs.push(...(await client.getLogs({ address: ROUTER, event: installed, args: { agentId: AGENT_ID }, fromBlock: from, toBlock: to })));
}
// An install counts only while it is the account's current one and has not expired.
for (const account of new Set(logs.map((l) => l.args.account!))) {
const [agentId, , , expiry, installId, installed, maxPerTrade, dailyLimit] =
await client.readContract({ address: ROUTER, abi: routerAbi, functionName: "configs", args: [account] });
if (!installed || agentId !== AGENT_ID || expiry <= BigInt(Math.floor(Date.now() / 1000))) continue;
console.log(account, { installId, maxPerTrade, dailyLimit });
}