How to..
Access Price on Verocket

How to Access (Historic) $VET Price on VeRocket Using the Call.API

VeRocket, a Uniswap v2 compatible exchange, provides on-chain swaps for different tokens. This allows you to access price information on-chain and deliver it through a public API without connecting to centralized services like Coingecko. In this example, we'll use the Call.API (opens in a new tab) to load the current VET price (measured in VeUSD) and the price from a specific point in the past.


Uniswap defines getAmountOut (opens in a new tab) that can be used to get the VeUSD value from a swap of a single vVET. The returned value will be the USD value of VET.

The function is defined as this:

function getAmountsOut(uint amountIn, address[] memory path) public view returns (uint[] memory amounts);
  • The input is the contract's amount, respecting its decimals.
  • The address list represents the routing of the swap; for this example, the path will be VET to VeUSD.
  • The output is the result for each step of the path.


The input parameters are defined as:

  1. amountIn = 1000000000000000000
    This equals 1 VET, as the contract has 18 decimals 1 + 18 x 0 (opens in a new tab).
  2. path[0] = 0x45429A2255e7248e57fce99E7239aED3f84B7a53
    Input: the Wrapped VET contract.
  3. path[1] = 0x4E17357053dA4b473e2daa2c65C2c949545724b8
    Output: the VeUSD contract.


The result will be a list of values, currently:


The decimals of the VeUSD contract are 6 (opens in a new tab) which requires the value 24135 to be divided by a 1 + 6 x 0:

24135 / 1000000 = 0.024135

That's the current value of VET in USD as of today (2023-04-20).

API Access


The GET variant is easy to share and can be easily implemented into frontend web applications. It is harder to read:

Readable version: (uint256 1000000000000000000, address[] 0x45429A2255e7248e57fce99E7239aED3f84B7a53|0x4E17357053dA4b473e2daa2c65C2c949545724b8) returns (uint256[] amounts)

URL encoded:,%20address[]%200x45429A2255e7248e57fce99E7239aED3f84B7a53%7C0x4E17357053dA4b473e2daa2c65C2c949545724b8)%20returns%20(uint256[]%20amounts) (opens in a new tab)


The POST variant is more verbose and easier to read. It should be used in backends:

curl -XPOST -d '
  "clauses": [ 
    "to": "0x576da7124c7bb65a692d95848276367e5a844d95",
    "abi": {
      "name": "getAmountsOut",
      "inputs": [
              "internalType": "uint256",
              "name": "amountIn",
              "type": "uint256"
              "internalType": "address[]",
              "name": "path",
              "type": "address[]"
      "outputs": [
              "internalType": "uint256[]",
              "name": "amounts",
              "type": "uint256[]"
      "type": "function"
    "args": [

Historical Data

Historical Data

revision can be passed as a parameter to retrieve the information for a specific block number (or ID) in the past.

For example, Block 11,824,314 was forged at 2022-04-01 and will reference the information from that time: (opens in a new tab)


That's $0,078358 for $VET at that time.


Using the Call.API (opens in a new tab) to access information from contracts can remove the need for custom backends. It opens the possibility to build a public API based on any kind of contract.

In this article's example, an API to access current and historical price information for tokens was demonstrated.