get_positions.equityPositions): each of its yield loops is closed, then one self-funded router call repays the stock debt, withdraws the stock, swaps it to USDG and returns the proceeds. Non-custodial.
Input
string
required
The vault’s id (
equity-0x…).string
required
Wallet that owns the vault and will sign.
integer[]
The yield loop id(s) to close with the stock leg (from
get_positions). Optional when the vault’s yieldLoopMatch is tagged, basis or mixed; required when it is ambiguous. Each must be this wallet’s open loop on the vault’s yield market. Nothing outside this list is ever closed.number
default:"0.01"
Ratio; capped at
0.01.integer
default:"1"
Vaults exist on
4663 only.Output
minLoanOut floors the USDG the router must return to you: the stock swap’s min-out less the debt (with a small interest buffer), exactly as the app builds it. Exit swaps carry no fee.
Executing
Same rules as the deposit batch: submitcalls as one atomic batch (EIP-5792 / Safe); a wallet that cannot batch sends them in order and must always send the final revoke.
Fail-closed cases
Refused when the wallet has no open vault for that id; when the stock leg has no debt (equityExit flash-loans the debt to repay it, so a debt-free leg is withdrawn straight from Morpho instead); or when the vault’s yieldLoopMatch is ambiguous and no yieldPositionIds were given — the tool never guesses which loop to close.
The yield loop of an open vault cannot be closed on its own through
build_manage_tx; this tool is the only way to unwind a vault.