Vanna Account
Overview
The Account contract acts as a dynamic and distributed asset reserve that holds a user’s collateral and borrowed assets. It facilitates asset management and enables interactions with external contracts for seamless transactions. The contract is designed for integration into DeFi protocols that require secure and controlled asset management, particularly for leveraged positions.
getAssets
Description: Returns the list of ERC-20 assets (collaterals and borrows) associated with the account.
Signature:
function getAssets() external view returns (address[] memory)Returns:
assets: An array of asset addresses in the account.
getBorrows
Description: Returns the list of ERC-20 tokens that are borrowed by the account.
Signature:
function getBorrows() external view returns (address[] memory)Returns:
borrows: An array of borrowed asset addresses in the account.
addAsset
Description: Adds a given ERC-20 token to the
assetslist.Signature:
Parameters:
token: The ERC-20 token address to add to the assets list.
Modifiers:
accountManagerOnly
addBorrow
Description: Adds a given ERC-20 token to the
borrowslist.Signature:
Parameters:
token: The ERC-20 token address to add to the borrows list.
Modifiers:
accountManagerOnly
removeAsset
Description: Removes a given ERC-20 token from the
assetslist.Signature:
Parameters:
token: The ERC-20 token address to remove from the assets list.
Modifiers:
accountManagerOnly
removeBorrow
Description: Removes a given ERC-20 token from the
borrowslist.Signature:
Parameters:
token: The ERC-20 token address to remove from the borrows list.
Modifiers:
accountManagerOnly
hasNoDebt
Description: Returns
trueif the account has no borrowed assets, otherwise returnsfalse.Signature:
Returns:
hasNoDebt: A boolean indicating whether the account has no debt.
exec
Description: Executes a transaction with an external contract. The
accountManagercan use this function to interact with other contracts.Signature:
Parameters:
target: The address of the external contract to interact with.amt: The amount of Ether to send to the target contract.data: The encoded function signature and parameters for the external contract.
Returns:
success: A boolean indicating whether the transaction was successful.retData: The data returned by the target contract.
sweepTo
Description: Transfers all assets (ERC-20 tokens and Ether) from the account to the specified address. After the transfer, the contract clears the
assetslist.Signature:
Parameters:
toAddress: The address to which all assets will be sent.
Modifiers:
accountManagerOnly
Internal Functions
Description: Removes a specific ERC-20 token from an array of addresses (used for removing assets or borrowed tokens).
Signature:
Parameters:
arr: The array of addresses (eitherassetsorborrows).token: The token address to remove from the array.
Last updated