Skip to main content

Asset Management: Deposits & Withdrawals

The vault provides two primary functions for moving assets: deposit for adding funds and withdraw for removing them. Each function has distinct authorization rules to maximize flexibility while ensuring security.

Depositing Tokens

The deposit function allows users to fund the vault.

Authorization: Anyone on the Stellar network can deposit tokens into the vault.

Process: The depositor must authorize the transaction, which calls the deposit() function to transfer a specified amount of a token from their address to the vault’s contract address.

Withdrawing Tokens

The withdraw function allows for the secure removal of assets from the vault.

Authorization: This is a highly privileged action. Only the Owner of the vault can invoke this function.

Process: The owner calls withdraw(), specifying the token, amount, and destination address. The contract first verifies the owner’s authorization and then checks its internal balance before executing the transfer.

Next Steps

Trading Operations

Learn how the vault executes swaps by interacting with an external router.