Friktion
Search…
⌃K

Deposit/Withdraw

All volts share the same instruction set, account state format, and user experience when handling deposits & withdrawals. The greatest difficulty in this system is handling deposits that cannot be settled instantly, since Friktion must support volts that do not have easily priced assets (options and other derivatives).
Deposit/Withdraw Flow for Friktion Volts
The Round account (see here) is also vital to pending deposit/withdrawal calculations. It is referred to below.

Instant Deposit/Withdrawal

A deposit/withdrawal into any volt that immediately 1. issues share tokens 2. begins participating in the volt strategy. This is only guaranteed to be enabled on each volt in the following cases:
  • The volt is newly created, and has not begun its first epoch.
  • The volt is in a period between ending the last epoch and beginning the new.
All other deposits/withdraws are processed as pending. They will resolve and begin participating in the the volt at the beginning of the following epoch (see chart above).
Only a single deposit and single withdrawal can exist for a volt at any one time.
Pending Deposit:
Tracks a single deposit made during an epoch. Once that epoch ends, the pending deposit is convertible to a proportional number of fTokens. This is calculated using the math described here
/**
* User-specific PDA. Tracks information about their pending deposits.
* NOTES:
* 1. There may only be one pending deposit (across all rounds) at any point in time
* 2. However, pending deposits will accumulate if made in same round.
* 3. Pending deposits from previous rounds may be claimed with the instruction "claim_pending"
*/
pub struct PendingDeposit {
// unnecessary variable. indicates whether account exists
pub initialized: bool,
// round number this pending deposit is for.
// #NOTE: round_number == 0 implies "no existing pending deposit"
pub round_number: u64,
// total amount that is or was pending to be deposited.
// this number is used to calculate the # of volt tokens user should expect to receive after calling claim_pending.
// this is incremented with new deposits, and decremented after calling claim_pending
pub num_underlying_deposited: u64,
}
Pending Withdrawal:
Tracks a single withdrawal made during an epoch. Once that epoch ends, the withdrawal deposit is convertible to a proportional number of underlying tokens. This is calculated using the math described here
/**
* User-specific PDA. Tracks information about their pending withdrawals.
* NOTES:
* 1. There may only be one pending withdrawal (across all rounds) at any point in time
* 2. However, pending withdrawals will accumulate if made in same round.
* 3. Pending withdrawals from previous rounds may be claimed with the instruction "claim_pending_withdrawal"
*/
pub struct PendingWithdrawal {
// unnecessary variable. indicates whether account exists
pub initialized: bool,
// round number this pending withdrawal is for.
// #NOTE: round_number == 0 implies "no existing pending withdrawal"
pub round_number: u64,
// total amount that is or was pending to be deposited.
// this number is used to calculate the # of volt tokens user should expect to receive after calling claim_pending.
// this is incremented with new deposits, and decremented after calling claim_pending
pub num_volt_redeemed: u64,
}

Cancel

During the epoch it was created in, a pending deposit/withdrawal is cancellable. This returns all deposited assets to the user immediately. A deposit/withdrawal can only be cancelled entirely.