Friktion
Search…
Deposit/Withdraw Accounts
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.
Pending Deposit:
Tracks a single deposit made during a specific 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 a specific 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,
}
​
Copy link