TrussDocs

Emergencies

A venue is exploited

What to do when a lending or swap venue a vault uses is exploited, from stopping new capital to bringing back what can still be withdrawn.

The vault values a lending venue's shares at the price the venue itself reports. A loss reaches the vault's share price only once the venue reports it, and until then the vault prices those shares as if nothing happened. Acting fast limits how much more goes in, and who is paid at the old price.

Key points

  • Stop new capital going into the venue, which any limit-lowering key can do at once.
  • Stop the instant path drawing on it, if it is the default source.
  • Hold settlement until the loss shows in the price, or exits are paid at the old price.
  • Withdraw before pausing the sub-account or removing the venue's price adapter, because both stop withdrawals.

Steps for a lending venue

  1. Stop new capital. The Sentry or the VaultAdmin lowers the venue's supply limit to zero on the lend policy, with lowerRateLimitCapacity(subAccount, venue, 0) and lowerRateLimitRefillRate, and lowers the sub-account's cap and push limit. A vault manager or the VaultAdmin can also call initiateDeregistration for the venue's shares, which stops anything adding to them while still allowing withdrawals.
  2. Stop the instant path from drawing on it. If the venue is the default source, a vault manager, the Sentry or the VaultAdmin calls clearDefaultSource(), or pauseInstant() to stop instant withdrawals altogether.
  3. Hold settlement. Revoke the settlers' roles, or have the settling service stop, until the venue's reported price shows the loss. A vault pause alone does not stop settlement.
  4. Bring back what can be withdrawn. A vault manager or the sub-account's trader withdraws through the lend module with executeModule, then sends the USDC back with returnAssetsToVault. Withdrawals carry no rate limit.
  5. Close it out once the sub-account holds none of the venue. Call finalizeDeregistration, then remove the venue's price adapter with removeOracleAdapterForAsset (VaultAdmin) if no other sub-account holds it.

When a withdrawal is refused

A withdrawal must return at least what the venue reports its shares are worth, less the lend policy's tolerance, which is fixed per vault. A venue that pays less than it reports refuses every withdrawal through the lend module until its reported price falls to what it pays. Two other actions also stop a withdrawal. Pausing the sub-account stops every trade, and removing the venue's price adapter leaves nothing to check the withdrawal against. So keep both for after the withdrawal, or for when nothing more can come back.

A swap venue or an attested account's venue

A swap is checked against the vault's own prices, so a bad route costs at most the swap tolerance per call. To stop it, the Sentry or the VaultAdmin lowers the affected swap limits to zero, or pauses the sub-account. On an attested sub-account, the VaultAdmin revokes the permitted calls to the venue with revokeCallShape. If the account's value is now wrong, follow An attestation is wrong.

What holders see

Until the venue reports its loss, the share price is unchanged, and any exit settled meanwhile is paid at the old price by the holders who stay. Once the loss shows, in the venue's price or in a withdrawal that brings back less, it falls on every holder through the share price.

Where to read more

PageWhat it covers
Tracked sub-accountsHow venue shares are valued
Rate limitsSupply, swap and push limits
Emergency controlsEvery control that acts at once
RisksVenue risk for holders