Price Data Feed

This section describes how to derive the price of rock.rETH shares.

tldr;

You can get the rock.rETH:ETH exchange rate here: https://etherscan.io/address/0x716f0c5453099690b54e7b72d9491a72b8df445e#readContract#F1

Overview

The price of a vault share represents the value of the underlying asset the share is a claim on.

USD

For example if 1 rock.rETH share is worth 1.05 rETH and rETH/USD = $5,000 USD, then 1 rock.rETH = 1.05 x $5,000 = $5,250. Conversely that means 1 rETH = 0.95238 rock.rETH (1/1.05).

ETH

Similarly for ETH, if 1 rock.rETH share is worth 1.05 rETH and 1 rETH = 1.1443 ETH then 1 rock.rETH = 1.05 x 1.1443 = 1.201515 ETH

Integration

For integration with RockSolid vaults, there are a number of ways to source pricing, both on-chain and via API.

On-chain

Rate Provider

The simplest way to calculate rock.rETH exchange rates is to use the Balancer rate provider deployed here. That returns the rock.rETH:ETH exchange rate in wei. For example, at the time of writing it is 1161699563412314198 which when converted to ETH is 1.16. I.e. 1 rock.rETH = 1.16 ETH. For display, you would source ETH/USD from your preferred provider

ERC-4626 style calculation

To obtain the value 1 rock.rETH share in the underlying asset rETH purely from the smart contract, you can use standard ERC-4626 methods. You convert an amount of shares to assets and divide by the scale of the underlying. To obtain rock.rETH to rETH it would be:

  • convertToAssets(10 ** vault.decimals()) / 10 ** underlyingAsset.decimals()

For USD, simply multiple by the rETH/USD exchange rate

API

We don't currently provide exchange rates via API. Please reach out at [email protected] if you need this.

Last updated