Repay a repo
For borrowers. Pay the repurchase amount before maturity and the pledge releases in the same instruction.
Repaying moves the repurchase amount to the lender and returns your pledged units to your free lane, in one instruction. It has to land before the repo's maturity; from then on only a default can close it.
Before you start
- The repo is active and its maturity is still ahead. Maturity is in UTC on the repo's row.
- The full repurchase amount is free in your ledger cash. Repayment is in full only, and the amount was fixed when the repo opened, so repaying early costs the same.
In the app
Find the repo
On /app/repo, My repos lists each repo you borrowed in with its repurchase amount to the atom, its maturity in UTC and the time left.
Repay
The row's Repay button shows only while the repo is active and before its maturity. It opens a dialog titled with the amount to the atom, for example Repay 95,091.095891 USD on HALDEN31: Review repay shows both legs, the cash to the lender and the units released to you, then Sign and send.
Settled
The repo reads Repaid and the units are free. Income they earned while pledged is still yours to claim.
Through the API
const repos = await api.repos({ wallet })
const active = repos.filter((r) => r.borrower.wallet === wallet && r.status === 'active')
for (const repo of active) {
if (Date.parse(repo.maturity) > Date.now()) await send(await api.buildRepay({ wallet, repoId: repo.id }), sign)
}curl "$AGORA_API/v1/repos?wallet=<wallet>"
curl -X POST "$AGORA_API/v1/build/repay" -H 'content-type: application/json' \
-d '{"wallet":"<wallet>","repoId":"<repo id>"}'send is the helper from A first settlement. Leave room before maturity: the transaction has to land, not only be signed, before that second.
What it ends in
| Repay | |
|---|---|
| Your cash, free | − repurchase amount |
| Lender's cash, free | + repurchase amount |
| Your units | pledged → free |
| The repo | Repaid |
The settlement is the kind repo-repay.
If it fails
RepoMatured: maturity has passed. The lender, or anyone, can now settle the default.RepoNotActive: the repo was already repaid or defaulted.InsufficientFreeCash: your free cash is short of the repurchase amount. Deposit or cancel a bid to free some.WrongAccount: the wallet isn't the repo's borrower.