Registry contract
Overview
The Registry contract is the central storage and routing system of the Vanna Protocol. It maps all critical contract addresses, VTokens, and user accounts. This contract acts as the single source of truth for verifying and referencing all active entities within the protocol
State Variables
initialized
bool
Ensures init()
is only called once
keys
string[]
List of all registered contract identifiers
accounts
address[]
List of all user accounts
vTokens
address[]
List of all active VToken contracts
ownerFor
mapping(address => address)
Maps account addresses to their owners
VTokenFor
mapping(address => address)
Maps underlying tokens to their VToken
addressFor
mapping(string => address)
Maps identifier strings to contract addresses
Initialization
init
Initializes the Registry with the deployer as the admin.
function init() external
setAddress
Registers or updates a contract address.
function setAddress(string calldata id, address _address) external
getAddress
Returns the address for a given identifier.
function getAddress(string calldata id) external view returns (address)
VToken Management
setVToken
Registers or updates the VToken contract for a specific underlying token.
function setVToken(address underlying, address vToken) external
getAllVTokens
Returns an array of all currently active VToken addresses in the system.
function getAllVTokens() external view returns (address[] memory)
Account Management
addAccount
Registers a new account with its owner.
function addAccount(address account, address owner) external
updateAccount
Updates ownership of an existing account.
function updateAccount(address account, address owner) external
closeAccount
Closes an account by removing its owner.
function closeAccount(address account) external
accountsOwnedBy
Returns all accounts owned by a given user.
function accountsOwnedBy(address user) external view returns (address[] memory)
getAllAccounts
Returns all protocol-managed accounts.
function getAllAccounts() external view returns (address[] memory)
Last updated