๐ŸงฎVault Math (v1)

circle-info

You can find a full implementation of our vault mechanics in this spreadsheetarrow-up-right.

The function and variable names in this section have been edited to make them intelligible to readers; they might not exactly match the names used in the smart contrats. A correspondance table is available herearrow-up-right.

General Notation

Name
Definition

T

Time

T = 0

Initial state of the vault at deployment

T = t

Current epoch (the one that just ended)

T = t-1

Previous Epoch

๐ธ๐‘๐‘œ๐‘h๐ท๐‘ข๐‘Ÿ๐‘Ž๐‘ก๐‘–๐‘œ๐‘›\small ๐ธ๐‘๐‘œ๐‘โ„Ž๐ท๐‘ข๐‘Ÿ๐‘Ž๐‘ก๐‘–๐‘œ๐‘›

Length of one trading Epoch, currently set to 7 days

DA

Stands for "Deposit Asset", which is the asset users deposit into the vault (initially USDC). Vaults using different deposit assets (e.g. ETH, BTC) might be added in the future

Vault Level Variables

Name
Definition

๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ(t)\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ_{(t)}

Total amount of VaultToken in circulation = Total amount minted from users deposits โ€“ Total amount burnt from users withdrawals

๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’(๐‘ก)\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’_{(๐‘ก)}โ€‹

Value of one share of the vault denominated in deposit asset (e.g. USDC in a vault where users deposit USDC).

At T=0, ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’(0)=1\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’_{(0)}=1โ€‹

๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘๐‘ก\small ๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘๐‘ก

Annual Management Fee percentage (initially set at 1.5%)

๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘๐‘ก\small ๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘๐‘ก

Performance Fee percentage (initially set at 15%)

๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)\small ๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}

Management fee charged per vault token for the epoch, denominated in deposit asset (e.g. USDC)

๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)\small ๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}

Performance fee charged per vault token for the epoch, denominated in deposit asset (e.g. USDC)

๐ท๐‘’๐‘ฅ๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก)\small ๐ท๐‘’๐‘ฅ๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก)}

Amount of deposit asset (e.g. USDC) on the DEX where the trading strategy is being executed (e.g. dYdX) = Total amount deposited by users โ€“ Total amount withdraw by users +/- Total trading strategy P/L โ€“ Management and Perf Fees

๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)\small ๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}

Profit/Loss per vault token generated by the trading strategy for the epoch

๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (๐‘ก)\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(๐‘ก)}

Theoretical amount of VaultToken in circulation at the end of the epoch, assuming all users who initiated a withdrawal during that epoch have finalized it before the end of the following epoch (effectively burning their VaultToken and receiving their share of deposit asset). In reality, users can take as much time as they want before finalizing a withdrawal which could lead to a miss-match between what the VaultTokenSupply should be in theory, and what it is reality, which would introduce errors in the subsequent calculations.

At T=0, ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (0)=0\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(0)}=0

๐‘๐‘’๐‘ก๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก)\small ๐‘๐‘’๐‘ก๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก)}

Net amount to be transferred from/to the vault to/from the DEX wallet depending on deposits, withdrawals, fees and gas reserves for the epoch

T๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘€๐‘–๐‘›๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’๐ธ๐‘‡๐ป\small T๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘€๐‘–๐‘›๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’๐ธ๐‘‡๐ป

Minimum amount of ETH that should be in the TransferBot wallet to pay for gas at each epoch; if ETH balance falls below that threshold, a swap from the Deposit Asset (e.g. USDC) will be initiated, assuming there is enough Deposit Asset in the wallet [NOT IMPEMENTED YET]

๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐บ๐‘Ž๐‘ ๐‘…๐‘’๐‘ ๐‘’๐‘Ÿ๐‘ฃ๐‘’DA(๐‘ก)\small ๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐บ๐‘Ž๐‘ ๐‘…๐‘’๐‘ ๐‘’๐‘Ÿ๐‘ฃ๐‘’DA_{(๐‘ก)}

Amount of deposit asset (e.g. USDC) to be retain within the TransferBot wallet for the current epoch as a buffer to fund future gas fees [NOT IMPEMENTED YET]

๐‘‡๐‘Ÿan๐‘ fer๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA(๐‘ก)\small ๐‘‡๐‘Ÿan๐‘ fer๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA_{(๐‘ก)}

Amount of deposit asset (e.g. USDC) in the TransferBot wallet at the end of the current epoch, before accounting for ๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘๐‘’๐‘ค๐ท๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก\small ๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘๐‘’๐‘ค๐ท๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก [NOT IMPEMENTED YET]

๐‘‡๐‘Ÿan๐‘ ๐‘“er๐ต๐‘œ๐‘ก๐‘€๐‘–๐‘›๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA\small ๐‘‡๐‘Ÿan๐‘ ๐‘“er๐ต๐‘œ๐‘ก๐‘€๐‘–๐‘›๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA

Minimum amount of deposit asset (e.g. USDC) in the TransferBot wallet required to initiate a swap for ETH to fund future gas fees [NOT IMPEMENTED YET]

๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘‡๐‘Ž๐‘Ÿ๐‘”๐‘’๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA\small ๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘‡๐‘Ž๐‘Ÿ๐‘”๐‘’๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA

Targeted deposit asset (e.g. USDC) reserve in the TransferBot wallet to be swapped for ETH to fund gas fees [NOT IMPEMENTED YET]

๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’๐ธ๐‘‡๐ป(๐‘ก)\small ๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’๐ธ๐‘‡๐ป_{(๐‘ก)}

Current ETH balance in the TransferBot wallet [NOT IMPEMENTED YET]

Individual Users Variables

Name
Definition

๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘๐‘’๐‘ค๐ท๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก(๐‘ก,i)\small ๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘๐‘’๐‘ค๐ท๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก_{(๐‘ก,i)}

Amount of deposit asset (e.g. USDC) deposited by user i during the epoch t (when user called the InitiateDeposit() function). This amount is stored in the vault until the end of the current epoch, and then is sent to the DEX wallet to be used as trading capital

๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™(๐‘ก,i)\small ๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™_{(๐‘ก,i)}

Amount of VaultToken requested for withdrawal by user i during the epoch t (when user called the InitiateWithdrawal() function). The corresponding amount of deposit asset (e.g. USDC) will be withdrawn from the DEX wallet at the end of the current epoch and stored in the vault, where it will be available for the user to withdraw anytime after the end of the current epoch

๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก,i)\small ๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก,i)}

Total amount of VaultToken user i owns at the end of epoch t

TransferBot End of Epoch Routine & Math

Sequence of event is important given some variables dependency from one step to the next.

Step
Description

Call UpdateDexWalletBalance() function that call GetAccount() from dy/dx API and read the portfolio Equity value, then update that value into the vault smart contract (๐ท๐‘’๐‘ฅ๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก)\small ๐ท๐‘’๐‘ฅ๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก)}), except if the vault is empty (e.g. at T=0): IF: ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (๐‘ก)=0\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(๐‘ก)}=0, THEN: ๐ท๐‘’๐‘ฅ๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก)=โˆ‘i=0n๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘๐‘’๐‘ค๐ท๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก(๐‘ก,i)\small ๐ท๐‘’๐‘ฅ๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก)}=\sum_{i=0}^{n}๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘๐‘’๐‘ค๐ท๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก_{(๐‘ก,i)}, ELSE: ๐ท๐‘’๐‘ฅ๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก)=Read\small ๐ท๐‘’๐‘ฅ๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก)}=Read value\small value from\small from dy/dx\small dy/dx API\small API

Call MgtFeePerVaultToken() function: IF: ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (๐‘ก)=0\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(๐‘ก)}=0, THEN: ๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)=0\small ๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}=0, ELSE: ๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)=๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’(๐‘ก)โˆ—๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘๐‘กโˆ—๐ธ๐‘๐‘œ๐‘h๐ท๐‘ข๐‘Ÿ๐‘Ž๐‘ก๐‘–๐‘œ๐‘›365\small ๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}=๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’_{(๐‘ก)}*\frac{๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘๐‘ก โˆ— ๐ธ๐‘๐‘œ๐‘โ„Ž๐ท๐‘ข๐‘Ÿ๐‘Ž๐‘ก๐‘–๐‘œ๐‘›}{365}

Call PnLPerVaultToken() function: IF: ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (๐‘ก)=0\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(๐‘ก)}=0, THEN: ๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)=0\small ๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}=0, ELSE: ๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)=๐ท๐‘’๐‘ฅ๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก)๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (๐‘ก)โˆ’๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’(๐‘ก)\small ๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}=\frac{๐ท๐‘’๐‘ฅ๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก)}}{๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(๐‘ก)}}-๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’_{(๐‘ก)}

Call PerfFeePerVaultToken() function: IF: ๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)โ‰ค0\small ๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}\le 0, THEN: ๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)=0\small ๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}= 0, ELSE: ๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)=๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)โˆ—๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘๐‘ก\small ๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}= ๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}*๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘๐‘ก

Call UpdateVaultTokenPrice() function: IF: T=0\small T=0, THEN: ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’(๐‘ก)=1\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’_{(๐‘ก)}=1,

ELSE: ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’(๐‘ก)=๐‘€๐ด๐‘‹((๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’(๐‘ก)+๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)โˆ’๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)โˆ’๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)),0)\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’_{(๐‘ก)}= ๐‘€๐ด๐‘‹((๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’_{(๐‘ก)}+๐‘ƒ๐‘›๐ฟ๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)} โˆ’๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}โˆ’๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}), 0)

Call CalculateTransferBotGasReserveDA() function: [NOT IMPLEMENTED YET] ๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐บ๐‘Ž๐‘ ๐‘…๐‘’๐‘ ๐‘’๐‘Ÿ๐‘ฃ๐‘’DA(๐‘ก)=๐‘€๐ผ๐‘(๐‘€๐ด๐‘‹(๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘‡๐‘Ž๐‘Ÿ๐‘”๐‘’๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DAโˆ’\small ๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐บ๐‘Ž๐‘ ๐‘…๐‘’๐‘ ๐‘’๐‘Ÿ๐‘ฃ๐‘’DA_{(๐‘ก)}= ๐‘€๐ผ๐‘( ๐‘€๐ด๐‘‹(๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘‡๐‘Ž๐‘Ÿ๐‘”๐‘’๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA โˆ’ ๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA(๐‘ก),0),\small ๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA_{(๐‘ก)}, 0), (๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)+๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก))\small (๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}+๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}) โˆ—๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (๐‘กโˆ’1))\small โˆ—๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(๐‘กโˆ’1)})

Call CalculateNetTransferBalance() function: ๐‘๐‘’๐‘ก๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก)=โˆ‘i=0n(๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘๐‘’๐‘ค๐ท๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก(๐‘ก,๐‘–))\small ๐‘๐‘’๐‘ก๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก)}=\sum_{i=0}^{n}(๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘๐‘’๐‘ค๐ท๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก_{(๐‘ก,๐‘–)}) โ€’โˆ‘i=0n(๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™(๐‘ก,๐‘–))โˆ—๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’(๐‘ก)\small โ€’\sum_{i=0}^{n}(๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™_{(๐‘ก,๐‘–)})โˆ—๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’_{(๐‘ก)} โˆ’(๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)+๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก))\small โˆ’(๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}+๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}) โˆ—๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (๐‘ก)\small โˆ—๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(๐‘ก)}

Call DexTransfer() function: IF: ๐‘๐‘’๐‘ก๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก)>0\small ๐‘๐‘’๐‘ก๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก)}\gt 0, THEN: ๐‘†๐‘’๐‘›๐‘‘ย ๐‘๐‘’๐‘ก๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก)ย ๐‘“๐‘Ÿ๐‘œ๐‘šย Vaultย ๐‘ก๐‘œย DEXย wallet\small \text{๐‘†๐‘’๐‘›๐‘‘ }๐‘๐‘’๐‘ก๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก)}\text{ ๐‘“๐‘Ÿ๐‘œ๐‘š Vault ๐‘ก๐‘œ DEX wallet} , ELSE: ๐‘†๐‘’๐‘›๐‘‘ย ๐‘๐‘’๐‘ก๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’(๐‘ก)ย ๐‘“๐‘Ÿ๐‘œ๐‘šย DEXย toย Vaultย wallet\small \text{๐‘†๐‘’๐‘›๐‘‘ }๐‘๐‘’๐‘ก๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’_{(๐‘ก)}\text{ ๐‘“๐‘Ÿ๐‘œ๐‘š DEX to Vault wallet}

Call FeesTransfer() function: ๐‘†๐‘’๐‘›๐‘‘ย ((๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(๐‘ก)+๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›(t))โˆ—๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (t)โˆ’๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐บ๐‘Ž๐‘ ๐‘…๐‘’๐‘ ๐‘’๐‘Ÿ๐‘ฃ๐‘’DA(๐‘ก))ย ๐‘“๐‘Ÿ๐‘œ๐‘šย Vaultย ๐‘ก๐‘œย protocolย Tresauryย wallet\small \text{๐‘†๐‘’๐‘›๐‘‘ } \bigl((๐‘€๐‘”๐‘ก๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(๐‘ก)}+๐‘ƒ๐‘’๐‘Ÿ๐‘“๐น๐‘’๐‘’๐‘ƒ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›_{(t)})*๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(t)}-๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐บ๐‘Ž๐‘ ๐‘…๐‘’๐‘ ๐‘’๐‘Ÿ๐‘ฃ๐‘’DA_{(๐‘ก)}\bigl)\text{ ๐‘“๐‘Ÿ๐‘œ๐‘š Vault ๐‘ก๐‘œ protocol Tresaury wallet}

Call UpdateVaultTokenSupplyPostWithdrawals() function: ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (๐‘ก)=๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ (๐‘ก)+๐ด๐‘š๐‘œ๐‘ข๐‘›๐‘กย ๐‘œ๐‘“ย ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›ย ๐‘ก๐‘œย ๐‘๐‘’ย ๐‘š๐‘–๐‘›๐‘ก๐‘’๐‘‘โˆ’๐ด๐‘š๐‘œ๐‘ข๐‘›๐‘กย ๐‘œ๐‘“ย ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›ย ๐‘ก๐‘œย ๐‘๐‘’ย ๐‘๐‘ข๐‘Ÿ๐‘›๐‘ก\small ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(๐‘ก)} =๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘†๐‘ข๐‘๐‘๐‘™๐‘ฆ๐‘ƒ๐‘œ๐‘ ๐‘ก๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™๐‘ _{(๐‘ก)}+\text{๐ด๐‘š๐‘œ๐‘ข๐‘›๐‘ก ๐‘œ๐‘“ ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘› ๐‘ก๐‘œ ๐‘๐‘’ ๐‘š๐‘–๐‘›๐‘ก๐‘’๐‘‘} โˆ’\text{๐ด๐‘š๐‘œ๐‘ข๐‘›๐‘ก ๐‘œ๐‘“ ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘› ๐‘ก๐‘œ ๐‘๐‘’ ๐‘๐‘ข๐‘Ÿ๐‘›๐‘ก} WITH: ๐ด๐‘š๐‘œ๐‘ข๐‘›๐‘กย ๐‘œ๐‘“ย ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›ย ๐‘ก๐‘œย ๐‘๐‘’ย ๐‘š๐‘–๐‘›๐‘ก๐‘’๐‘‘=โˆ‘i=0n๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘๐‘’๐‘ค๐ท๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก(t,i)๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’(t)\small \text{๐ด๐‘š๐‘œ๐‘ข๐‘›๐‘ก ๐‘œ๐‘“ ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘› ๐‘ก๐‘œ ๐‘๐‘’ ๐‘š๐‘–๐‘›๐‘ก๐‘’๐‘‘}=\sum_{i=0}^{n}\frac{๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘๐‘’๐‘ค๐ท๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก_{(t,i)}}{๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘ƒ๐‘Ÿ๐‘–๐‘๐‘’_{(t)}} ๐ด๐‘š๐‘œ๐‘ข๐‘›๐‘กย ๐‘œ๐‘“ย ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›ย ๐‘ก๐‘œย ๐‘๐‘’ย ๐‘๐‘ข๐‘Ÿ๐‘›๐‘ก=โˆ‘i=0n๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘Š๐‘–๐‘กh๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™(t,i)\small \text{๐ด๐‘š๐‘œ๐‘ข๐‘›๐‘ก ๐‘œ๐‘“ ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘› ๐‘ก๐‘œ ๐‘๐‘’ ๐‘๐‘ข๐‘Ÿ๐‘›๐‘ก}=\sum_{i=0}^{n}๐‘ˆ๐‘ ๐‘’๐‘Ÿ๐‘‰๐‘Ž๐‘ข๐‘™๐‘ก๐‘‡๐‘œ๐‘˜๐‘’๐‘›๐‘Š๐‘–๐‘กโ„Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ค๐‘Ž๐‘™_{(t,i)}

Call SwapDAforETH() function to swap some deposit asset (e.g. USDC) to ETH for future gas fees: [NOT IMPEMENTED YET] IF: (๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’๐ธ๐‘‡๐ป(t)<๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘€๐‘–๐‘›๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’๐ธ๐‘‡๐ป)\small (๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’๐ธ๐‘‡๐ป_{(t)}<๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘€๐‘–๐‘›๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’๐ธ๐‘‡๐ป) AND (๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA(t)>๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘€๐‘–๐‘›๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA)\small (๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA_{(t)}>๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘€๐‘–๐‘›๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA) THEN: Swapย ๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA(t)ย forย ETHย usingย Uniswap\small \text{Swap }๐‘‡๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘“๐‘’๐‘Ÿ๐ต๐‘œ๐‘ก๐‘Š๐‘Ž๐‘™๐‘™๐‘’๐‘ก๐ต๐‘Ž๐‘™๐‘Ž๐‘›๐‘๐‘’DA_{(t)}\text{ for ETH using Uniswap}

Last updated