Tokenization

AToken

An vToken is issued whenever assets are supplied into a Vaultera market and is burnt again when those assets are withdrawn. Each vToken records how much of a crypto asset a user has placed with the protocol together with the yield that position has accrued. Because an vToken stays pegged to its matching supplied asset at a 1:1 ratio, it can be held, moved, or traded with confidence. Every bit of yield gathered by the vTokens' reserves flows straight to vToken holders, whose wallet balances rise continuously over time.

This contract is the implementation of the interest bearing token for the Vaultera Protocol. It inherits the ScaledBalanceTokenBase and EIP712Base token contracts.

Every standard EIP20 method is available on vTokens, including balanceOf , transfer , transferFrom , approve , totalSupply and so on.

balanceOf always reports the freshest balance held by a user, folding together both their principal balance and the yield that principal balance has produced.

The complete source code lives on the repo.

Write Methods

initialize

function initialize(    IPool initializingPool,    address treasury,    address underlyingAsset,    IVaulteraIncentivesController incentivesController,    uint8 aTokenDecimals,    string calldata aTokenName,    string calldata aTokenSymbol,    bytes calldata params) public virtual

Runs when a new vToken instance is initialized.

Input Parameters:

NameTypeDescription
initializingPoolIPoolThe address of the pool it is linked to
treasuryaddressThe treasury's onchain address
underlyingAssetaddressOnchain address of the underlying asset
incentivesControllerIVaulteraIncentivesControllerThe incentives controller attached to this vToken
aTokenDecimalsuint8Decimal count for the underlying asset
aTokenNamestringThe label of the vToken
aTokenSymbolstringThe ticker of the vToken
paramsbytesEncoded parameters used for any extra initialization

mint

function mint(    address caller,    address onBehalfOf,    uint256 amount,    uint256 index) external virtual override onlyPool returns (bool)

Issues amount vTokens to user .

Method Parameters:

NameTypeDescription
calleraddressThe address that triggers the mint
onBehalfOfaddressThe account that will receive the newly minted vTokens
amountuint256The quantity of tokens being minted
indexuint256The upcoming liquidity index of the reserve

Output Values:

TypeDescription
booltrue if the user's previous balance was equal to 0

burn

function burn(    address from,    address receiverOfUnderlying,    uint256 amount,    uint256 index) external virtual override onlyPool

Burns vTokens from user and transfers the matching amount of underlying to receiverOfUnderlying .

In certain cases, the mint event may fire during a burn transaction when the amount to burn is smaller than the interest the user has accrued.

Method Parameters:

NameTypeDescription
fromaddressThe wallet whose vTokens are scheduled to be burned
receiverOfUnderlyingaddressThe account set to receive the underlying asset back
amountuint256The quantity of tokens slated for burning
indexuint256The upcoming liquidity index for the reserve

mintToTreasury

function mintToTreasury(uint256 amount, uint256 index) external override onlyPool

Issues vTokens into the reserve treasury.

Input Parameters:

NameTypeDescription
amountuint256The quantity of tokens being minted
indexuint256The account set to receive the underlying asset back

transferOnLiquidation

function transferOnLiquidation(    address from,    address to,    uint256 value) virtual override onlyPool

Moves vTokens whenever a borrow position is liquidated, provided the liquidator opts to claim the vToken.

Input Parameters:

NameTypeDescription
fromaddressThe account being liquidated, the present holder of the vTokens
toaddressThe party receiving vTokens
valueuint256The quantity of tokens being transferred out

transferUnderlyingTo

function transferUnderlyingTo(address target, uint256 amount) external virtual override onlyPool

Sends the underlying asset across to target .

Run by the Pool to shift funds through borrow(), withdraw() and flashLoan().

Call Parameters:

NameTypeDescription
useraddressThe party receiving the underlying
amountuint256The quantity being transferred

handleRepayment

function handleRepayment(address user, address onBehalfOf, uint256 amount) external virtual override onlyPool

Deals with the underlying that lands in the vToken once the transfer step has fully settled.

By default this hook does nothing, since for ordinary ERC20 tokens no follow-up work is required once the transfer wraps up. Down the line, though, certain vTokens might let holders stake the underlying to collect LM rewards. In a design like that, handleRepayment() would carry out the staking of the underlying asset on the holder's behalf.

Call Parameters:

NameTypeDescription
useraddressThe caller performing the repayment
onBehalfOfaddress`The address whose borrow position is being repaid
amountuint256The quantity being repaid

permit

function permit(    address owner,    address spender,    uint256 value,    uint256 deadline,    uint8 v,    bytes32 r,    bytes32 s) external override

Lets a holder authorize another account (or contract) to spend their funds by handing over a signed message. This unlocks gas-less flows and folds approval and transfer into a single call. Pass along a signed message to grant spending rights.

Implements permit in accordance with EIP-2612.

Call Parameters:

NameTypeDescription
owneraddressThe holder of the funds
spenderaddressThe spender of those funds
valueuint256How many tokens the approved spender may move
deadlineuint256The expiry timestamp for the signature; pass type(uint256).max for no
vuint8The signature's V value
rbytes32The signature's R value
sbytes32The signature's S value

A sample flow for signing and calling permit:

import { signTypedData_v4 } from "eth-sig-util";import { fromRpcSig } from "ethereumjs-util";// ... other importsimport aTokenAbi from "./aTokenAbi.json";// ... setup your web3 providerconst aTokenAddress = "ATOKEN_ADDRESS";const aTokenContract = new web3.eth.Contract(aTokenAbi, aTokenAddress);const privateKey = "YOUR_PRIVATE_KEY_WITHOUT_0x";const chainId = 1;const owner = "OWNER_ADDRESS";const spender = "SPENDER_ADDRESS";const value = 100; // Amount the spender is permittedconst nonce = 1; // The next valid nonce, use `_nonces()`const deadline = 1600093162;const permitParams = {  types: {    EIP712Domain: [      { name: "name", type: "string" },      { name: "version", type: "string" },      { name: "chainId", type: "uint256" },      { name: "verifyingContract", type: "address" },    ],    Permit: [      { name: "owner", type: "address" },      { name: "spender", type: "address" },      { name: "value", type: "uint256" },      { name: "nonce", type: "uint256" },      { name: "deadline", type: "uint256" },    ],  },  primaryType: "Permit",  domain: {    name: "aTOKEN_NAME",    version: "1",    chainId: chainId,    verifyingContract: aTokenAddress,  },  message: {    owner,    spender,    value,    nonce,    deadline,  },};const signature = signTypedData_v4(Buffer.from(privateKey, "hex"), {  data: permitParams,});// The signature can now be used to execute the transactionconst { v, r, s } = fromRpcSig(signature);await aTokenContract.methods  .permit({    owner,    spender,    value,    deadline,    v,    r,    s,  })  .send()  .catch((e) => {    throw Error(`Error permitting: ${e.message}`);  });

rescueTokens

function rescueTokens(    address token,    address to,    uint256 amount) external override onlyPoolAdmin

Recover and send out tokens that are stuck inside this contract. Only POOL_ADMIN.

Input Parameters:

NameTypeDescription
tokenaddressThe address for the token
toaddressThe wallet receiving the tokens
amountuint256How much of the token to send

View Methods

balanceOf

function balanceOf(address user)    public    view    virtual    override(IncentivizedERC20, IERC20)    returns (uint256)

Gives the token balance held by user .

Overrides the parent method.

Input Parameters:

NameTypeDescription
useraddressThe address for the user

Return Values:

TypeDescription
uint256The token balance held by a given user

totalSupply

function totalSupply() public view virtual override(IncentivizedERC20, IERC20 returns (uint256)

Yields the current number of tokens minted.

Supersedes the base method.

Return Values:

TypeDescription
uint256The total number of minted tokens

RESERVE_TREASURY_ADDRESS

function RESERVE_TREASURY_ADDRESS() external view override returns (address)

Provides the address of the Vaultera treasury, governed onchain, which collects the fees accrued by this vToken.

Return Values:

TypeDescription
addressThe address of the Vaultera treasury

UNDERLYING_ASSET_ADDRESS

function UNDERLYING_ASSET_ADDRESS() external view override returns (address)

Provides the address of the underlying reserve asset backing this vToken (E.g. WETH for vWETH).

Return Values:

TypeDescription
addressAddress of the underlying reserve asset

DOMAIN_SEPARATOR

function DOMAIN_SEPARATOR() public view override(IAToken, EIP712Base) returns (bytes32)

Fetch the domain separator for this token on the active chain.

Returns the cached copy when chainId matches, otherwise recomputes the separator.

Supersedes the base method to fully satisfy IAToken.

Return Values:

TypeDescription
bytes32The token's domain separator on the current chain

nonces

function nonces(address owner) public view override(IAToken, EIP712Base) returns (uint256)

Provides the nonce value for the address passed as a parameter; this is the nonce consumed when calling permit() .

Supersedes the base method to completely implement IAToken.

Input Parameters:

NameTypeDescription
owneraddressThe owner's onchain address

Return Values:

TypeDescription
uint256The owner's nonce value

Example:

const token = new Contract(aTokenAddress, vToken.abi, provider);await token.nonces(user);

Pure Methods

getRevision

function getRevision() internal pure virtual override returns (uint256)

Provides the revision number of the contract. Must be declared in the inheriting class as a constant.

Returns 0x1 .

Return Values:

TypeDescription
uint256The current revision

RwaAToken

RwaAToken is a purpose-built extension of the AToken contract tailored for Real-World Assets (RWAs). It tracks a user's supplied collateral within the Vaultera Horizon market. To satisfy regulatory obligations, RwaAToken instances remain non-transferable by default for end-users.

Core operations such as transfer , approve , and permit are switched off to block peer-to-peer movement of these tokens. The Vaultera Horizon market defines an ATOKEN_ADMIN_ROLE, which may be assigned to RWA issuers or their appointed managers to handle tasks such as wallet recovery or position migration. Any address holding this role can carry out authorized transfers on behalf of users, as described below.

Write Methods

authorizedTransfer

function authorizedTransfer(address from, address to, uint256 amount) external returns (bool)

Moves a quantity of vTokens from one user to another. This function may only be invoked by the RWAaTokenManager address that holds the ATOKEN_ADMIN_ROLE to precisely oversee vToken-specific transfers. It is meant for administrative operations, such as relocating a user's position to a fresh wallet. Every transfer remains bound by the protocol's health factor checks.

Input Parameters:

NameTypeDescription
fromaddressThe address funds move out of
toaddressThe address funds move in to
amountuint256The quantity of tokens to move

Return Values:

TypeDescription
booltrue when the transfer has succeeded

mint

function mint(    address caller,    address onBehalfOf,    uint256 amount,    uint256 index) public virtual returns (bool)

Mints amount vTokens to a user. This function overrides the standard mint so that the caller of the transaction must match the onBehalfOf address. In practice, this turns off the supplyOnBehalfOf functionality for RWAs.

Input Parameters:

NameTypeDescription
calleraddressThe address that performs the mint
onBehalfOfaddressThe wallet address set to receive the newly minted vTokens
amountuint256The number of tokens that will be minted
indexuint256The upcoming liquidity index for the reserve

Return Values:

TypeDescription
booltrue when the account's prior balance was equal to 0

Pure Functions

ATOKEN_ADMIN_ROLE

function ATOKEN_ADMIN_ROLE() external pure returns (bytes32)

Provides the bytes32 identifier assigned to the ATOKEN_ADMIN_ROLE . This role lets an account call authorizedTransfer .

Return Values:

TypeDescription
bytes32The identifier tied to the ATokenAdmin role

Unsupported Operations

To preserve the non-transferable and compliant design of RWA collateral, the majority of standard ERC20 interactions are turned off for RwaAToken . Invoking any of the functions listed below will revert with an OPERATION_NOT_SUPPORTED error:

  • permit

  • approve

  • increaseAllowance

  • decreaseAllowance

  • transfer

  • transferFrom

  • mintToTreasury

  • transferOnLiquidation

  • transferUnderlyingTo

StaticATokenFactory

The StataTokenFactory serves as both a factory and a registry contract that oversees every deployed StataToken instance for a given Vaultera pool. It supports deploying fresh StataToken instances on demand and enforces that only a single StataToken instance exists per underlying asset. The contract keeps a mapping that links each underlying asset to its matching StataToken address.

StataTokens are ERC-4626 compliant wrappers around Vaultera's vTokens that deliver a non-rebasing mechanism for yield accrual.

You can access the source code on RepoHub.

Write Actions

initialize

function initialize() external initializer

Sets up the StataTokenFactory contract for use. This method follows the Initializable pattern and must be invoked to prepare the contract once it has been deployed onchain. In the present build, it intentionally executes no operations.

createStataTokens

function createStataTokens(address[] memory underlyings) external returns (address[] memory)

Deploys fresh StataToken instances for the supplied underlying assets whenever they are not yet present. For every underlying asset passed in, the routine checks whether a matching StataToken already exists. When one is found, its existing StataToken address is returned. Otherwise, it deploys a new StataToken for that underlying asset, registers it, and returns the freshly created address.

Method Arguments:

NameTypeDescription
underlyingsaddress[]A list of underlying asset addresses

Output Values:

TypeDescription
address[]A list of StataToken addresses matching each of the supplied underlying assets

Emits:

  • A StataTokenCreated(address indexed stataToken, address indexed underlying) event is fired for every newly created StataToken.

Reverts:

  • NotListedUnderlying(address underlying) is raised when the underlying asset has not been listed in the

Read Methods

getStataTokens

function getStataTokens() external view returns (address[] memory)

Yields every StataToken instance deployed by this factory.

Output Values:

TypeDescription
address[]A list of all StataToken contract addresses

getStataToken

function getStataToken(address underlying) external view returns (address)

Provides the StataToken address for a specified underlying asset.

Method Arguments:

NameTypeDescription
underlyingaddressThe underlying asset's onchain address

Output Values:

TypeDescription
addressThe onchain address of the matching StataToken ; returns address(0) if absent

POOL

function POOL() external view returns (IPool)

Provides the onchain address of the Vaultera pool tied to this factory.

Return Values:

TypeDescription
IPoolThe address of the linked Vaultera pool

PROXY_ADMIN

function PROXY_ADMIN() external view returns (address)

Provides the proxy admin address that governs the StataToken proxies.

Return Values:

TypeDescription
addressThe proxy admin's onchain address

TRANSPARENT_PROXY_FACTORY

function TRANSPARENT_PROXY_FACTORY() external view returns (ITransparentProxyFactory)

Exposes the transparent proxy factory address used to spin up new StataToken proxies.

Return Values:

TypeDescription
ITransparentProxyFactoryThe transparent proxy factory's address

STATA_TOKEN_IMPL

function STATA_TOKEN_IMPL() external view returns (address)

Exposes the StataToken implementation address referenced whenever fresh StataToken instances are deployed.

Return Values:

TypeDescription
addressThe StataToken implementation's onchain address

VariableDebtToken

Provides a variable debt token that records the borrowing positions held by users in variable rate mode.

Because variable debt tokens are non-transferable, the transfer and approve functionalities remain disabled.

Each vToken holds a 1:1 peg to the underlying borrowed asset and reflects the full amount currently owed to the protocol, namely principal debt + interest accrued.

The VariableDebtToken contract extends both the DebtTokenBase and ScaledBalanceTokenBase token contracts.

You can read the full source code our repo.

Write Methods

initialize

function initialize(    IPool initializingPool,    address underlyingAsset,    IVaulteraIncentivesController incentivesController,    uint8 debtTokenDecimals,    string memory debtTokenName,    string memory debtTokenSymbol,    bytes calldata params) external virtual

Runs when a variableDebtToken instance is initialised.

Input Parameters:

NameTypeDescription
initializingPoolIPoolThe pool contract carrying out initialization here
underlyingAssetaddressThe address of the reserve asset backing this vToken (E.g. WETH for vWETH)
incentivesControllerIVaulteraIncentivesControllerThe contract that oversees any potential incentive distributions
debtTokenDecimalsuint8The decimal precision of the variableDebtToken, equal to the underlying's
debtTokenNamestringThe label of the variable debt token
debtTokenSymbolstringThe ticker of the variable debt token
paramsbytesA bundle of encoded parameters for extra initialization steps

mint

function mint(    address user,    address onBehalfOf,    uint256 amount,    uint256 index) external virtual override onlyPool returns (bool, uint256)

Issues the variable debt token to the onBehalfOf address.

Input Parameters:

NameTypeDescription
useraddressThe address that receives the borrowed underlying, acting as the delegatee under credit delegation, or matching onBehalfOf otherwise
onBehalfOfaddressThe address credited with the variable debt tokens
amountuint256The quantity of variable debt tokens to mint
indexuint256The reserve's current variable debt index

Return Values:

TypeDescription
booltrue when the user's prior balance equals 0, false otherwise
uint256The scaled aggregate debt of the reserve

burn

function burn(    address from,    uint256 amount,    uint256 index) external virtual override onlyPool returns (uint256)

Removes user variable debt.

Occasionally a burn transaction emits a mint event whenever the amount to burn is smaller than the interest the user has accrued.

Input Parameters:

NameTypeDescription
fromaddressThe address that will have its debt burned
amountuint256The quantity of debt tokens to be burned
indexuint256The reserve's current variable debt index

Return Values:

TypeDescription
uint256The scaled aggregate debt of the reserve

View Methods

UNDERLYING_ASSET_ADDRESS

function UNDERLYING_ASSET_ADDRESS() external view override returns (address)

Provides the address of the underlying asset backing this variableDebtToken (e.g. WETH for variableDebtWETH)

Return Values:

TypeDescription
addressThe underlying asset's onchain address

balanceOf

function balanceOf(address account) public view virtual override returns (uint256)

Provides the number of tokens held by account - the fully up to date accrued debt (principal + interest) belonging to the user.

A standard ERC20 method.

Input Parameters:

NameTypeDescription
accountaddressThis address's token balance

Return Values:

TypeDescription
uint256The number of tokens held by account

totalSupply

function totalSupply() public view virtual override returns (uint256)

Reports how many tokens are currently outstanding — the freshest aggregate debt owed across every account in the protocol for that particular variable rate of debt token.

A standard ERC20 method.

Return Values:

TypeDescription
uint256The count of tokens currently issued

Pure Methods

getRevision

function getRevision() internal pure virtual override returns (uint256)

Provides the revision identifier for this contract, which must be declared as a constant within the inheriting class.

Yields 0x1 .

Return Values:

TypeDescription
uint256The contract revision

NOT SUPPORTED OPERATIONS

Since it is not transferable by design, the variable debt token exposes none of the standard ERC20 functions for transfer and allowance .

Each of the methods listed here will revert with the error code 80, OPERATION_NOT_SUPPORTED : transfer , allowance , approve , transferFrom , increaseAllowance , decreaseAllowance .

We rely on cookies to improve how you navigate the site, tailor the content you see, and measure overall site traffic. Privacy Policy