Docs/Core concepts

What your agent can and cannot touch

Every object an agent's key can pass into a transaction is tied, on chain, to something only you set, or to something no caller chooses. This page lists them for a borrowing agent and a lending agent. It follows the desk-bindings review, which lists every entry an AgentCap can call.

A borrowing agent#

What the agent passesWhat ties it to your rules
Your SUI treasury (collateral out)The agent's cap must belong to it, be live, and stay within its per-transaction and 24-hour limits.
The cash treasury (proceeds in)Must be the cash treasury your borrow rules name; any other aborts 28.
An offer (rate and term)Held to your maximum rate, shortest term and repay-by.
A loan amount (debt size)Held to the borrowing allowance you set: no more than what is left, which the loan then uses up.
A pool (lender and floating rate)Must be the pool your rules pin; its rate at opening is held to your maximum.
The market and the priceOne market per pair, created only with the MarketAdminCap; the price must come from that market's own oracle and feed. The market's borrow limit, liquidation line and bonus are not yours to set: the MarketAdminCap can change them, including lowering the line until open loans become liquidatable, but only after a public proposal and two days' notice. See What the MarketAdminCap can and cannot do.
A loan to repay, top up or claimIts deed must be held by your SUI treasury, and repayments come only from the cash treasury the loan recorded when it opened.
The lender's paymentGoes only to that loan's own lender.

A borrowing agent's caps pay only you, so its own address holds nothing but gas, and the public loan and pool entry points that take coins from the signer's address have nothing to take. Closing a sealed room needs the room's borrower as sender, which is your wallet, not the agent.

A lending agent#

What the agent passesWhat ties it to your rules
An offer's termsChecked against your lend mandate when posted and again at every fill.
A sealed-bid consentLets one sealed fill draw, still held to your lend mandate.
A spendOnly to recipients you listed; a hosted lender's limit is one unit, payable only to you.

How much the agent can borrow#

Your borrowing allowance. Every new desk loan uses it up by its amount, a refinance only by what it borrows over the old loan's debt, and a loan over what is left aborts 29. Repaying does not give it back; only your next signature of the borrow rules does. On top of that, each loan is still bounded by the market's borrow limit against the collateral the agent puts in, and by the lender's offer.

So even with a stolen agent key, the agent cannot borrow more than you allowed until you sign new rules, and the money still lands in your own cash treasury.

What no agent key can change#

Your limits, lend mandate and borrow rules, including the borrowing allowance (only your OwnerCap sets them), any market's oracle, and the code itself: the package is immutable. A market's risk numbers are not yours either; they change only through the MarketAdminCap's public, two-day proposals.