ERC-8467 Agent credit backer (Agent Credit Backers)
Draft · Vaults & DeFi · created 2026-10-20
A standard in which a third-party backer, with the signed consent of the identity owner, stands behind an agent's credit line and absorbs principal losses if the loan defaults. Pre-loan approval and post-loan notification work the same way across multiple lenders.
Why it is needed
A credit line extended to an agent identity is ultimately a bet on who stands behind it. Today, lenders already let third parties such as stakers, vaults, or their own treasuries back credit lines, but only through dedicated hooks each lender writes for itself. As a result, a backer who vouches for an agent at one lender cannot vouch for the same agent at another lender, and lenders cannot accept backers built for someone else's contract. The information a backer and a lender need to exchange is simple and identical across any lender: whether this loan may proceed, the fact that the loan was issued, whether the loan defaulted and how large the loss is, and which part of the limit is no longer the backer's responsibility. Without standardizing these four calls, the loss-handling process, and how the identity owner consents, backers have to rebuild a custom integration for every new lender, and there is no transparent on-chain way to see who is carrying what credit risk.
What to implement
function identityRegistry() external view returns (address);: Returns the address of the ERC-721 identity registry this lender uses.function asset() external view returns (address);: Returns the address of the ERC-20 token used for lending and repayment.function isController(uint256 agentId, address account) external view returns (bool);: Checks whether a given account is the owner of the agent identity or an agent recognized by the lender.function availableCredit(uint256 agentId) external view returns (uint256);: Returns the maximum additional amount that identity can borrow right now.function quote(uint256 agentId, uint256 amount, uint64 term) external view returns (uint256 fee);: Precalculates and returns the fee that would be charged for a loan of a given amount and duration.function borrow(uint256 agentId, uint256 amount, uint64 term, address to, uint256 maxFee) external returns (uint256 loanId);: Called by the identity's agent to actually issue the loan, and returns the ID of the new loan.function amountDue(uint256 loanId) external view returns (uint256);: Returns the amount currently required to repay the given loan.function repay(uint256 loanId, uint256 maxDue) external returns (uint256 paid);: Can be called by anyone to fully repay a loan, and returns the amount actually paid.function markDefault(uint256 loanId) external;: Can be called by anyone to mark a loan as defaulted once its repayment deadline (defaultableAt) has passed.function loanInfo(uint256 loanId) external view returns (LoanInfo memory);: Returns the loan's full details, including identity, owner, principal, fee, issuance/maturity/defaultable timestamps, and status.event Borrowed(uint256 indexed loanId, uint256 indexed agentId, address indexed to, uint256 principal, uint256 fee, uint64 dueAt);: An event emitted when a new loan is issued.event Repaid(uint256 indexed loanId, uint256 indexed agentId, address indexed payer, uint256 principal, uint256 fee);: An event emitted when a loan is repaid.event Defaulted(uint256 indexed loanId, uint256 indexed agentId, address indexed owner, uint256 principal);: An event emitted when a loan is marked as defaulted.function canBorrow(address lender, uint256 agentId, uint256 amount, uint64 term, uint256 fee, address caller, address owner, address to) external view returns (bool);: Called by the lender before sending funds, asking the backer whether this loan is permitted. Anything other than true is treated as a rejection.function onBorrow(address lender, uint256 agentId, uint256 loanId) external;: Called by the lender after a loan is issued to notify the backer.function onDefault(address lender, uint256 agentId, uint256 loanId, uint256 principal, uint256 paid) external;: Called by the lender after it takes the principal from the backer's assets, notifying the backer of the default and how much was actually recovered.function onRelease(address lender, uint256 agentId, uint256 amount, uint8 reason) external;: A notification that part of the limit is no longer the backer's responsibility.event BackerSet(uint256 indexed agentId, address indexed backer, uint256 line);: An event emitted when a backer is newly assigned, the limit changes, or backing ends.event BackerCharged(uint256 indexed loanId, uint256 indexed agentId, address indexed backer, uint256 principal, uint256 paid);: An event that records, on default, the principal charged to the backer and how much was actually recovered.event BackerHookFailed(uint256 indexed agentId, address indexed backer, bytes4 selector);: An event emitted when a notification call to the backer fails.event LossPaid(uint256 indexed loanId, address indexed backer, address indexed payer, uint256 amount);: An event emitted when someone repays an outstanding portion of a default loss on behalf of the backer.event Recovered(uint256 indexed loanId, address indexed backer, address indexed payer, uint256 amount, uint256 toBacker);: An event emitted when funds are recovered and distributed after a default.event BackerPaid(address indexed backer, uint256 amount);: An event emitted when recovered funds accrued to a backer are actually paid out.event ConsentsRevoked(uint256 indexed agentId, address indexed owner, uint256 nonce);: An event emitted when an identity owner invalidates their own consent signatures.function backerOf(uint256 agentId) external view returns (address);: Returns the current backer address for the given identity, or the zero address if there is none.function backedLine(uint256 agentId) external view returns (uint256 line, uint256 outstanding);: Returns the backing limit for the given identity together with the current total outstanding principal under it.function backerOfLoan(uint256 loanId) external view returns (address);: Returns which backer a given loan was issued under.function consentNonce(uint256 agentId) external view returns (uint256);: Returns the current nonce value used for that identity's consent signatures.function lossInfo(uint256 loanId) external view returns (uint256 paid, uint256 unpaid, uint256 recovered, uint256 returned);: Returns, for a defaulted loan, how much the backer has paid, how much remains unpaid, the total amount recovered, and the backer's accrued share.function dueToBacker(address backer) external view returns (uint256);: Returns the amount of recovered funds accrued to the backer that has not yet been paid out.function payLoss(uint256 loanId, uint256 amount) external returns (uint256 taken);: Can be called by anyone to repay, on the backer's behalf, the portion of a default loss still unpaid.function recover(uint256 loanId, uint256 amount) external returns (uint256 taken);: Allocates incoming funds after a default in the order of unpaid balance, the backer's share, and fees.function payBacker(address backer) external returns (uint256 amount);: Anyone can call this to actually pay the backer the portion of recovered funds credited to them.function setBacker(uint256 agentId, address backer, uint256 line, uint256 deadline, bytes calldata ownerConsent) external;: Called by the backer themselves, using the identity owner's signed consent, to register as that identity's backer or change the limit.function removeBacker(uint256 agentId) external;: Called by the backer or the identity owner to end the backing relationship once there is no outstanding principal.function revokeConsents(uint256 agentId) external;: Called by the identity owner to invalidate all of their own consent signatures that have not yet been used.
In depth
Structure of the three interfaces
This standard consists of three interfaces. IAgentCreditLine is carried over directly from the Agent Credit Lines draft's interface, defining the existing lending flow including identityRegistry (an ERC-721 identity registry), asset (the ERC-20 token being lent), and borrow/repay/markDefault. ICreditBacker is the backer-side interface newly added by this standard, with only four calls: canBorrow, onBorrow, onDefault, and onRelease. IBackedCreditLine extends IAgentCreditLine, adding the backing-related functions and events that the lender must implement. The lender must implement IBackedCreditLine and IAgentCreditLine, the backer must implement ICreditBacker, and both must support the corresponding interface identifiers and 0x01ffc9a7 via ERC-165.
Setting up backing and owner consent
Backing is limited to at most one backer per identity per lender. To call setBacker, msg.sender must be the backer themselves, and an ownerConsent is required in which the identity owner has signed a BackerConsent(lender, agentId, backer, line, nonce, deadline) struct via EIP-712. The nonce must match consentNonce(agentId), and on success the nonce increments by 1 so the same signature cannot be reused. The call fails if line is 0, the deadline has passed, or the signature is invalid. Attempting to change the backer while there is outstanding principal fails, as does reducing the same backer's limit below the outstanding amount. The owner can invalidate signatures that have not yet been used via revokeConsents.
Approval procedure when issuing a loan
When an identity with a backer calls borrow, amount must not exceed (line - outstanding), and availableCredit will not return a value exceeding that difference either. Before sending the asset, the lender must call the backer's canBorrow(lender, agentId, amount, term, fee, caller, owner, to) and receive true before proceeding. If this call reverts or returns anything other than true, it is treated as a rejection. After sending the asset, the lender notifies via onBorrow(lender, agentId, loanId); if this call reverts, the entire transaction also reverts. canBorrow must not depend on msg.sender, so that anyone can query it beforehand with the same arguments to know in advance whether it would be approved, before signing.
Repayment does not call the backer
repay makes no call to the backer whatsoever. When a loan issued under a backer is repaid, only that principal is removed from outstanding. This is a deliberate design so that the backer cannot block normal repayment, since if the backer could refuse repayment, a loan that should have been repaid normally could instead be forced into default.
Handling default: principal recovery and notification
When markDefault marks a loan under a backer as defaulted, the lender first charges that loan's principal (excluding fees) to the backer, subtracting it from line and outstanding, then takes the smallest of the principal, the backer's balanceOf, and the backer's allowance via transferFrom(backer, lender, amount). These three calls (the two reads and the transferFrom) must be executed with a fixed gas limit set by the lender, and if that gas limit cannot be provided, the entire transaction must revert rather than proceeding with less gas. Only the first 32 bytes of the return value are read, and nothing that happens on the asset side causes a revert during this process. Afterward, a BackerCharged event is emitted and onDefault(lender, agentId, loanId, principal, paid) is called as a notification.
Post-default loss repayment: payLoss, recover, payBacker
For each defaulted loan, lossInfo tracks four values: paid (the amount the backer has paid), unpaid (the share not yet paid), recovered (the total amount brought in via recover), and returned (the portion of that credited to the backer). payLoss lets anyone repay the unpaid amount on the backer's behalf, and funds paid this way are treated as if the backer paid them at the time of default. recover applies incoming funds after a default in order: first reducing unpaid (held by the lender), then crediting the backer for the share they already paid (paid - returned) by increasing dueToBacker (not transferring directly), and finally filling the fee. payBacker allows anyone to call it to actually transfer the amount accumulated in dueToBacker(backer) to the backer. None of these three functions calls the backer.
Limit release notification (onRelease)
onRelease(lender, agentId, amount, reason) is a notification for when part of the limit is removed from the backer's liability. There are only three reasons: 1 (Lowered) is the amount by which the same backer's limit was reduced, 2 (Removed) is the entire limit when backing ended via removeBacker, and 3 (Replaced) is the entire limit of the backer who was replaced when a different backer took over. onDefault and onRelease are notifications, so they are called with a minimum of 100,000 gas as set by the lender; if the backer reverts, runs out of gas, or returns any data, the lender does not revert but simply records a BackerHookFailed event and completes the original operation.
A draft that is not yet finalized
This proposal is currently in Draft status, an early stage where the details of the specification or the composition of functions may still change, or discussion may stall.
Things to watch out for
- The backer's capacity to back is governed by balance and approval: The lender can only take as much as the backer's asset balance and allowance at the time of default, and the backer can move funds or lower the allowance before that happens. The lender should check the backer's balance and allowance before every loan and prioritize backers whose funds cannot be withdrawn while the limit is open.
- The lender is trusted with the approved amount: The lender can take up to the approved amount at any time, and also holds the backer's share of recovered funds until it is paid out via payBacker. The backer should only approve lenders they have thoroughly vetted, and only up to the limit they actually intend to back there.
- Consent signatures should be kept short-lived: Consent is valid until the deadline, so the owner should sign with a short deadline. Signatures that are no longer meant to be used should be invalidated directly via revokeConsents rather than waiting for the deadline.
- Backing does not automatically end when the owner changes: If an identity is transferred to someone else, the backing relationship remains in place as is. A backer who backed a specific owner should check the owner value in canBorrow and reject the loan if it is not the owner they consented to, and anyone buying an identity should check backerOf before purchasing.
- Every hook is an external call with reentrancy risk: canBorrow, onBorrow, onDefault, and onRelease are all points where the lender calls a contract it did not write. The lender must update its own state before making these calls and protect borrow, repay, markDefault, setBacker, and removeBacker from reentrancy.