This proposal defines a payee: a contract that an agent identity, held in an ERC-721 identity registry, uses as the address where it is paid. When the payee is swept, it pays each registered creditor what that creditor says it is owed, most senior first and up to a share of the swept balance the creditor agreed to, and forwards the rest to the agent's owner or an address the owner chose. What a creditor does not take, up to what it is owed, stays in the payee in reserve for it, so a lender that takes repayment only in full is repaid once its reserve covers what is due. The owner adds creditors, each junior to the ones before, and cannot remove a creditor that still has a claim. A small creditor interface lets any lender take part, and any payer, explorer or lender can tell that an identity's revenue address is encumbered. An optional part lets the payee be the provider of an ERC-8183 job: ERC-8183 pays the provider and takes the work only from it, so the payee submits the work for the owner and is paid by the job. Another lets the holders of an ERC-7254 revenue-sharing token share what the creditors leave, with the token as the payee's beneficiary.
ERC-8464 · draft under review
Agent Repay-First Payees
A revenue address for an agent identity that pays its creditors before its owner, and token holders after them.
StatusBeing built
Guided in the app: Repay-first payee.
- Pull request
- ethereum/ERCs #2108 (the text under review)
- Text pinned at
ERCS/erc-8464.mdat 75cc2e5
75cc2e53a4cd7c8deb86b09aaa46e1dc343cec43- Discussion
- Its thread on Ethereum Magicians
- Reference
- priors-agents/erc-repay-first-payees at 56f7fa0
56f7fa0efd1b24b697b10c72b4b639ecb99a8f2f - Markdown
- /erc/8464.md
What it is
Specification headings
- Interfaces
- The payee
- Adding and removing creditors
- Sweeping
- The creditor
- Acting as an ERC-8183 provider (optional)
- Paying holders after creditors (optional)
The abstract and headings above are the text at 75cc2e5, CC0. Read the full text at that commit.
Priors is building an income router after this draft. Nothing of it is live yet.
Try it
On Robinhood Chain testnet (46630), with the reference contracts at their pinned commits and test tokens of no value. Each action shows the call it prepares before your wallet signs it, and each send is simulated first.
Set up
Four steps, once: your wallet on Robinhood Chain testnet, a little test ETH for its fees, test dollars of no value, and a testnet identity. The forms below fill from them.
- 1
Wallet
Not connected. Any browser wallet works: the lab switches it to Robinhood Chain testnet (46630) and sends nothing on another chain.
- 2
Test ETH
For the testnet's network fees. The lab's drip sends a little to a connected wallet once a day.
- 3
Test dollars
The Lab Test Dollar (no value) that lines lend and launches pair with.
- 4
Testnet identity
An ERC-8004 identity on the testnet registry, for the forms that take an agent id.
The testnet contracts
| Contract | Address on testnet (46630) |
|---|---|
| The lab's payee factory (LabRepayFirstPayeeFactory: payees settable as the agentWallet) | 0xc22AEe8022CD230544a454B3566Bba0d5476C9da |
| The reference payee factory (RepayFirstPayeeFactory) | 0x4d42d8026a7B95070b17d63f65Ef1b0129D7211A |
| The lab's line creditor (LabLineCreditor) | 0xC97B451Ff90A093C978BBC818F1F7c3F0d7AEDDF |
| The testnet ERC-8004 identity registry | 0x8004A818BFB912233c491871b3d84c89A494BD9e |
| The lab's test dollar (LabTestDollar) | 0x64A419191369E6a79d562A65336073ec1bfbf4BD |
Actions
Reads
Deploy your own
Deploy the reference contract from its pinned commit with your own wallet, on the testnet: you become its lender, launchpad or backer. Its address shows once the receipt is in, and Check a contract below reads it.
With an agent
Your agent gets the same lab through the MCP server at https://lab.priors.trade/mcp or the HTTP API described by /openapi.json. It reads, and gets back unsigned testnet transactions to sign with its own testnet key. The lab holds no key of its own for you and never asks for one.
MCP tools for ERC-8464
lab_erc(8464)- What the draft does on the lab, its contracts and an agent's next calls.
lab_setup(address)- Test ETH, test dollars and the testnet identities of an address, with the calls to register one and mint test dollars.
lab_read(8464, "payee_address", { agent_id, factory })- The identity's payee address (before or after it is deployed).
lab_read(8464, "payee", { payee })- A payee: its agent, beneficiary, creditors and balance.
lab_read(8464, "reserved", { payee, creditor, token })- What a payee holds for a creditor.
lab_read(8464, "owed", { agent_id })- What an identity owes the lab's line creditor, and the loans it follows.
lab_prepare(8464, "deploy_payee", { agent_id, factory })- Deploy the identity's payee (at the address shown before). Who signs: anyone
lab_prepare(8464, "set_agent_wallet", { agent_id, payee, deadline })- Make the payee the identity's ERC-8004 agentWallet. Who signs: the identity's owner
lab_prepare(8464, "track_loan", { loan_id, line })- Have the lab's line creditor follow a lab loan. Who signs: anyone
lab_prepare(8464, "add_creditor", { payee, creditor, max_share_bps })- Add a creditor. Who signs: the identity's owner
lab_prepare(8464, "remove_creditor", { payee, creditor })- Remove a creditor. Who signs: the creditor, or the owner once it has no claim
lab_prepare(8464, "set_beneficiary", { payee, beneficiary })- Set where what is left goes. Who signs: the identity's owner
lab_prepare(8464, "pay", { payee, amount })- Pay the agent at its payee. Who signs: a buyer
lab_prepare(8464, "sweep", { payee, token })- Sweep: creditors first, then the beneficiary. Who signs: anyone
lab_prepare(8464, "set_operator", { payee, operator })- Name the payee's job operator (ERC-8183 provider). Who signs: the identity's owner
lab_deploy_prepare(8464, "payee", { agent_id, registry })- Your own RepayFirstPayee for an identity (the reference, without the factory).
lab_deploy_prepare(8464, "factory", { registry })- Your own RepayFirstPayeeFactory.
lab_check_contract(8464, chain, address)- The conformance read of any contract, on testnet or mainnet: supportsInterface and the views.
lab_feedback_draft(8464, note, txHash?)- The report text and the thread and issue links. It posts nothing.
HTTP
GET https://lab.priors.trade/api/lab/erc/8464GET https://lab.priors.trade/api/lab/read/8464/payee_address?agent_id=<agent_id>&factory=<factory>GET https://lab.priors.trade/api/lab/read/8464/payee?payee=<payee>GET https://lab.priors.trade/api/lab/read/8464/reserved?payee=<payee>&creditor=<creditor>&token=<token>GET https://lab.priors.trade/api/lab/read/8464/owed?agent_id=<agent_id>GET https://lab.priors.trade/api/lab/prepare/8464/deploy_payee?agent_id=<agent_id>&factory=<factory>GET https://lab.priors.trade/api/lab/prepare/8464/set_agent_wallet?agent_id=<agent_id>&payee=<payee>&deadline=<deadline>GET https://lab.priors.trade/api/lab/prepare/8464/track_loan?loan_id=<loan_id>&line=<line>GET https://lab.priors.trade/api/lab/prepare/8464/add_creditor?payee=<payee>&creditor=<creditor>&max_share_bps=<max_share_bps>GET https://lab.priors.trade/api/lab/prepare/8464/remove_creditor?payee=<payee>&creditor=<creditor>GET https://lab.priors.trade/api/lab/prepare/8464/set_beneficiary?payee=<payee>&beneficiary=<beneficiary>GET https://lab.priors.trade/api/lab/prepare/8464/pay?payee=<payee>&amount=<amount>GET https://lab.priors.trade/api/lab/prepare/8464/sweep?payee=<payee>&token=<token>GET https://lab.priors.trade/api/lab/prepare/8464/set_operator?payee=<payee>&operator=<operator>GET https://lab.priors.trade/api/lab/deploy/8464/payee?agent_id=<agent_id>®istry=<registry>GET https://lab.priors.trade/api/lab/deploy/8464/factory?registry=<registry>GET https://lab.priors.trade/api/lab/check/8464/<chain>/<address>GET https://lab.priors.trade/api/lab/setup/<address>
Connect it, for example in Claude Code: claude mcp add --transport http priors-lab https://lab.priors.trade/mcp
A prompt to copy
Use the Priors lab on Robinhood Chain testnet (chain id 46630), where every token is a test token of no value. Its MCP server is https://lab.priors.trade/mcp and this draft's page is https://lab.priors.trade/erc/8464.md. Try ERC-8464, Agent Repay-First Payees (a draft under review). Start with lab_setup for my testnet address to see my test ETH, test dollars and identities, then deploy the identity's payee (at the address shown before), then make the payee the identity's erc-8004 agentwallet, then have the lab's line creditor follow a lab loan, then add a creditor, then remove a creditor, then set where what is left goes with lab_prepare(8464, <action>, params). Each prepare returns an unsigned transaction { chainId: 46630, to, data, value }: sign and send it yourself with a testnet key, and refuse any other chain. Never ask me for a key. After each transaction, read the result back with lab_read and tell me what changed. If the draft or its reference code looks wrong, draft a report with lab_feedback_draft.
Check a contract
Paste any contract on either chain: the lab reads supportsInterface for IRepayFirstPayee 0xb5649e43 (computed from the pinned interface) and ERC-165's own, then calls each view. It only reads, so another implementer can test conformance with nothing signed.
Feedback
What you found goes where the draft is worked on: the discussion of the text in its thread on Ethereum Magicians, a bug in the reference code in its repository's issues. You post it under your own account. The lab posts nothing for anyone.