Vault examples

This section contains example schemes Vault operations

Token vault is used to store referral fees on a separate contract similar to lp account. This will allow us to decrease tx fees for swaps since users won't have to pay for additional jetton transfer tx.

Vault address is defined by router_address, owner_address and router_token_Wallet_address, so for each token each user can have a dedicated vault contract.

Swap diagram with referral

Bob is user doing the swap, Alice is referral, Send is send token, Receive is receive token.

Withdraw from vault

Withdraw op can be called by anyone, not only the Vault owner. All excesses are sent to the owner.

Notes:

  • the Vault contract is deleted on withdraw in order to not pay storage fees (each deposit sends state init so it will be redeployed as soon as any new deposit occurs)

Last updated