API/On-chain reference

offer

essey_sui::offer — standing offers. An offer holds no capital. See Offers.

publicpost#
Move
public fun post<T, C>(cap: &AgentCap, t: &Treasury<T>, rate_bps: u64, max_ltv_bps: u64, min_fill: u64, max_fill: u64, size: u64, duration_ms: u64, expires_at_ms: u64, acc: &Access, clock: &Clock, ctx: &mut TxContext)

Needs: the lender's AgentCap for t, and the lending Access object, which must admit the sender (access::assert_open_now; access in GET /v1/config). Shares a new Offer<T, C> for collateral C.

Checks: the cap belongs to t (EWrongTreasury); the terms fit the cap's mandate now — cap live, expiry after now and no later than the cap's own (EOfferExpiry), fill range inside the mandate's and min_fill > 0 (EFillOutOfBounds), max_ltv_bps above zero and within the mandate's ceiling for C (EOverLtv), rate at or above the floor (ERateBelowFloor), term allowed (EDurationNotAllowed) — and size ≥ max_fill (EOverSize).

publiccancel#
Move
public fun cancel<T, C>(cap: &AgentCap, offer: Offer<T, C>)

Needs: the AgentCap that posted it (EWrongCap). Deletes the offer.

publicterms#
Move
public fun terms<T, C>(offer: &Offer<T, C>): (ID, ID, u64, u64, u64, u64, u64, u64, u64)

(treasury_id, cap_id, rate_bps, max_ltv_bps, min_fill, max_fill, size, duration_ms, expires_at_ms).

Package-only#

fill is called by loan::fill and the borrower desk with a loan-to-value computed at the live price and the real borrower. It checks the treasury, expiry (EOfferExpired), the fill range (EFillOutOfBounds), the size (EOverSize), the offer's ceiling (EOverLtv), then draws through the lender's mandate. sealed and burn make and destroy the one-shot offer a sealed room settles through.

Events#

OfferPosted, OfferFilled { offer_id, amount, outstanding, taker }, OfferCancelled { offer_id }.

Abort codes#

1 EWrongTreasury, 2 EWrongCap, 3 EOfferExpired, 4 EFillOutOfBounds, 5 EOverSize, 6 EOverLtv; from the mandate check, the treasury codes.