# ERC-8467: Agent Credit Backers

> Robinhood Chain testnet (46630). Test tokens, no value. Reference contracts not audited. These are drafts under review, not standards.

A draft under review on ethereum/ERCs. Third parties stand behind a lender's line to an agent identity and take its loss, through lender hooks.

Status: Priors runs the model, not the interface.

- Pull request: https://github.com/ethereum/ERCs/pull/2111
- Text pinned at the pull request's head commit 75cfd375e4b70861c3b56e0f07fae5f819406357 (ERCS/erc-8467.md, CC0): https://github.com/priors-agents/ERCs/blob/75cfd375e4b70861c3b56e0f07fae5f819406357/ERCS/erc-8467.md
- Discussion: https://ethereum-magicians.org/t/erc-8467-agent-credit-backers/30062
- Reference implementation: https://github.com/priors-agents/erc-credit-backer-hooks/tree/62f461234e68e1e09570d5f4a792f71f3d3c1ba0 (commit 62f461234e68e1e09570d5f4a792f71f3d3c1ba0)
- This page: https://lab.priors.trade/erc/8467

## Abstract

This proposal lets a third party, a backer, stand behind a lender's credit line to an identity of an [ERC-721](https://eips.ethereum.org/EIPS/eip-721) identity registry, such as the Identity Registry of [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004), and absorb the line's losses. It extends the Agent Credit Lines draft, in which a lender lends an [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token to such identities. With the identity owner's signed consent, a backer puts itself behind a line of a given size. The lender then asks the backer before each draw (`canBorrow`), tells it of each draw (`onBorrow`), takes the principal of each defaulted loan from the backer's balance and tells it (`onDefault`), and tells it when part of the line is no longer its concern (`onRelease`). A backer can refuse a draw. It cannot stop a repayment, a default or the end of its backing. After a default, the backer, or anyone for it, can pay in a part of its charge it left unpaid (`payLoss`), and money paid toward the defaulted loan (`recover`) goes first to that part, then back to the backer, credited to it until anyone pays it out (`payBacker`), then to the lender's fee.

## Specification headings

1. Interfaces
2. What the Agent Credit Lines draft provides
3. Terms
4. Owner consent
5. Setting a backer
6. Removing a backer
7. Revoking consents
8. Drawing
9. Repaying
10. Defaults
11. After a default
12. Releases
13. Notifications
14. The backer

## At Priors

Priors runs this model on mainnet under its own contracts and interface, which do not conform to this draft.

## Live at Priors, mainnet read-only

These reads change nothing on Robinhood Chain mainnet (4663).

- `backers`: Priors' live backers in the draft's terms (backer, line, stake, loss). Params: `limit` (At most, uint, optional, default 50).

## Try it on testnet (46630)

Every action is prepared as an unsigned transaction { chainId: 46630, to, data, value }, signed by your own wallet or testnet key. Test tokens have no value.

Contracts:

- backedLine: 0x575f245a79D24Ca3C486c0F97d8F395398E0c292 (https://explorer.testnet.chain.robinhood.com/address/0x575f245a79D24Ca3C486c0F97d8F395398E0c292)
- backedLineFast: 0xD543D6bacA011C7DAA4Ba6d817Fa494a7976512d (https://explorer.testnet.chain.robinhood.com/address/0xD543D6bacA011C7DAA4Ba6d817Fa494a7976512d)
- testDollar: 0x64A419191369E6a79d562A65336073ec1bfbf4BD (https://explorer.testnet.chain.robinhood.com/address/0x64A419191369E6a79d562A65336073ec1bfbf4BD)

Actions:

- `stake`: Stake test dollars in your backer. Who signs: the backer's manager Params: `backer` (Your StakeBacker, address), `amount` (How many test dollars, amount).
- `back`: Back an identity's line, with its owner's signed consent. Who signs: the backer's manager Params: `backer` (Your StakeBacker, address), `agent_id` (The identity, agentId), `line` (The line, in test dollars, amount), `deadline` (The consent's deadline (as signed), time), `owner_consent` (The owner's BackerConsent signature (read consent first), bytes), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `lender` (The lender (empty: the lab's backed line chosen above), address, optional, default (the lab's)).
- `leave`: Stop backing an identity. Who signs: the backer's manager Params: `backer` (Your StakeBacker, address), `agent_id` (The identity, agentId), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `lender` (The lender (empty: the lab's backed line chosen above), address, optional, default (the lab's)).
- `withdraw_stake`: Withdraw stake no line holds. Who signs: the backer's manager Params: `backer` (Your StakeBacker, address), `to` (Where it goes, address), `amount` (How many test dollars, amount).
- `sync`: Sync a backing with the lender. Who signs: anyone Params: `backer` (The StakeBacker, address), `agent_id` (The identity, agentId), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `lender` (The lender (empty: the lab's backed line chosen above), address, optional, default (the lab's)).
- `approve_repay`: Let the backed line take a repayment or a loss payment. Who signs: the payer Params: `amount` (How many test dollars, amount), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `borrow`: Borrow on the backed line. Who signs: the identity's owner or its delegate Params: `agent_id` (The identity, agentId), `amount` (How many test dollars, amount), `term` (For how long, seconds), `to` (Who receives the loan, address), `max_fee` (The most fee you accept, amount), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `repay`: Repay a backed loan. Who signs: anyone Params: `loan_id` (The loan, uint), `max_due` (The most you pay, amount), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `mark_default`: Mark a backed loan defaulted (the backer pays). Who signs: anyone, after due plus grace Params: `loan_id` (The loan, uint), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `pay_loss`: Pay what a backer left unpaid of its charge. Who signs: anyone Params: `loan_id` (The loan, uint), `amount` (How many test dollars, amount), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `recover`: Pay toward a defaulted loan (recovery). Who signs: anyone Params: `loan_id` (The loan, uint), `amount` (How many test dollars, amount), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `pay_backer`: Pay a backer what recoveries credited it. Who signs: anyone Params: `backer` (The backer, address), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `remove_backer`: End an identity's backing. Who signs: its backer or its owner, with no active backed loan Params: `agent_id` (The identity, agentId), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `revoke_consents`: Void every unused consent. Who signs: the identity's owner Params: `agent_id` (The identity, agentId), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `set_delegate`: Name a delegate who may borrow for the identity. Who signs: the identity's owner Params: `agent_id` (The identity, agentId), `delegate` (The delegate (0x0 to remove), address), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `fund_line`: Fund your own backed line with test dollars. Who signs: the lender Params: `amount` (How many test dollars, amount), `contract` (Your own backed line's address, address).

Reads:

- `consent`: The EIP-712 BackerConsent the identity's owner signs (chain 46630). Params: `agent_id` (The identity, agentId), `backer` (The backer, address), `line` (The line, in test dollars, amount), `deadline` (Valid until (unix seconds, +1h), time), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `backing`: An identity's backer and line. Params: `agent_id` (The identity, agentId), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `loan`: A backed loan, and its loss. Params: `loan_id` (The loan, uint), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `backer`: A StakeBacker: its manager, stake and lines. Params: `backer` (The StakeBacker, address), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).
- `backer_line`: A StakeBacker's record of one backing. Params: `backer` (The StakeBacker, address), `agent_id` (The identity, agentId), `backed_line` (Which shared backed line: normal (1-day grace) or fast (5-minute grace, terms up to 10 minutes), string, optional, default normal), `contract` (Your own backed line's address (empty: the lab's shared one), address, optional).

Deploy your own:

- `stake_backer`: Your own StakeBacker: you are its manager. Params: `manager` (The manager (you), address), `asset` (The asset (empty: the test dollar), address, optional, default (the lab's)).
- `backed_line`: Your own BackedCreditLine: you lend. Params: `fee_bps` (The fee per 30 days, bps, uint, optional, default 100), `grace` (Grace after the due date, seconds, optional, default 3d), `max_term` (The longest term, seconds, optional, default 30d), `asset` (The asset (empty: the test dollar), address, optional, default (the lab's)), `registry` (The identity registry (empty: the testnet ERC-8004 one), address, optional, default (the lab's)).

## With an agent

- MCP (Streamable HTTP): https://lab.priors.trade/mcp. Tools for this draft: `lab_erc(8467)`, `lab_setup(address)`, `lab_read(8467, read, params)`, `lab_prepare(8467, action, params)`, `lab_deploy_prepare(8467, deploy, params)`, `lab_check_contract(8467, chain, address)`, `lab_feedback_draft(8467, note, txHash?)`.
- HTTP: https://lab.priors.trade/openapi.json describes GET https://lab.priors.trade/api/lab/erc/8467, /api/lab/read/8467/{read}, /api/lab/prepare/8467/{action}, /api/lab/deploy/8467/{deploy}, /api/lab/check/8467/{chain}/{address} and /api/lab/setup/{address}.

A prompt to give your agent:

```text
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/8467.md. Try ERC-8467, Agent Credit Backers (a draft under review). Start with lab_setup for my testnet address to see my test ETH, test dollars and identities, then stake test dollars in your backer, then back an identity's line, with its owner's signed consent, then stop backing an identity, then withdraw stake no line holds, then sync a backing with the lender, then let the backed line take a repayment or a loss payment with lab_prepare(8467, <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

Any address on testnet or mainnet: supportsInterface(0x9a4b754b) and the views, read only (`lab_check_contract`, or GET https://lab.priors.trade/api/lab/check/8467/{chain}/{address}).

## Feedback

The discussion of the text belongs in its thread: https://ethereum-magicians.org/t/erc-8467-agent-credit-backers/30062. A bug in the reference implementation goes to its repository's issues: https://github.com/priors-agents/erc-credit-backer-hooks/issues (a new one: https://github.com/priors-agents/erc-credit-backer-hooks/issues/new). The text under review: https://github.com/ethereum/ERCs/pull/2111/files. `lab_feedback_draft` writes the report; the lab posts nothing for anyone.
