Frax Vaults

Why is the vault giving me a "Not enough unlocked tokens to withdraw" error?

Adamant offers vaults for some Frax reward pools that have a mandatory minimum lock duration (aka "Lock Pools").

Users will get the "Not enough unlocked tokens to withdraw" error if there aren't enough unlocked stakes for the vault to process their withdrawals.

Here's how that can happen:

When a user withdraws from a Lock Pool vault, the vault restakes any excess tokens in the pool, which are locked for the minimum lock duration. If many users withdraw in one day, that could cause all staked tokens to be withdrawn and then relocked.

Alice deposits 1 FRAX token in the vault.

The vault stakes in the pool and creates a new locked stake.

Bob also deposits 1 FRAX token in the vault.

The vault stakes in the pool and creates another locked stake.

There are now two locked stakes, each consisting of 1 FRAX token.

Joe also deposits 1 FRAX token in the vault.

The vault stakes in the pool and creates another locked stake.

There are now three locked stakes, each consisting of 1 FRAX token.

Over the next 24 hours, the vault earns 0.3 FRAX profit, which is split between Alice, Bob, and Joe. Each of them now have a balance of 1.1 FRAX in the vault.

The 0.3 FRAX is added to the vault's first locked stake. (It isn't split between each locked stake because calling the deposit function three times would drastically increase the gas cost)

There is now one locked stake with 1.3 FRAX tokens and two locked stakes with 1 FRAX token.

24 hours later:

Alice withdraws 1.1 FRAX tokens from the vault. To process her withdrawal, the vault withdraws the first stake, which had 1.3 FRAX tokens. The remaining 0.2 FRAX tokens are locked again. There is now one locked stake with 0.2 FRAX tokens and two locked stakes with 1 FRAX token.

Bob withdraws 1.1 FRAX tokens from the vault. To process his withdrawal, the vault withdraws the second stake, which has 1 FRAX token, and the third stake, which has 1 FRAX token. The remaining 0.9 FRAX tokens are locked again. There is now one locked stake with 0.2 FRAX tokens and one locked stake with 0.9 FRAX tokens.

When Joe attempts to withdraw, he will get an error because there aren't any unlocked tokens to withdraw. He will need to wait 24 more hours until the two new locked stakes have unlocked.

Last updated