RAY Tokens

Interact with the ERC-20 version of RAY deposits.

Overview

RAY deposits are represented as ERC-20 tokens, called RAY tokens. RAY tokens perpetually increase in value as the underlying accrues interest, and can be used in many applications through its ERC-20 interface.

Mainnet Contracts

Kovan Contracts

Testing Resources

Kovan ETH can be retrieved from the Kovan faucet, and Kovan DAI and Kovan USDC are available through the Compound app.

Community & Team Support

Please use the RAY Discord to ask questions, interact with the community, and talk to RAY developers! RAY Discord Invite

Gas Costs

Action

Average

Mint

127,480

Withdraw

644,306

Mint

Deposit assets and receive RAY tokens. Deposits of ERC-20 tokens require approval of the appropriate RAY token contract beforehand.

Note the unique function signature for ETH and ERC-20 mints. The function to use depends on your deposit token (ETH or an ERC-20). Use the tabs below to toggle the functions.

Ether
ERC-20 Tokens
Ether
function mint() external payable returns (uint);
ERC-20 Tokens
function mint(uint mintAmount) external returns (uint);

msg.sender is the account which deposits the assets.

Function Parameters
Return Values
Function Parameters

Ether

There are no function parameters. However, remember to send the ETH value in the transaction as the value field.

ERC-20 Tokens

mintAmount - amount to deposit in the smallest units of the asset.

Return Values

The amount of RAY tokens received in exchange for the deposited assets.

Balance of Underlying

Retrieve the amount of the underlying (deposited) asset a RAY token holder owns. Uses the exchangeRateBurn() (see below).

Ether & ERC-20 Tokens
Ether & ERC-20 Tokens
function balanceOfUnderlying(address owner) external returns (uint)
Function Parameters
Return Values
Function Parameters

Ether & ERC-20 Tokens

owner - Address of the RAY token holder.

Return Values

The balance of the underlying asset, in the smallest units of the asset.

Redeem

Redeem a number of RAY tokens for the underlying asset.

Ether & ERC-20 Tokens
Ether & ERC-20 Tokens
function redeem(uint redeemTokens) external returns (uint)
Function Parameters
Return Values
Function Parameters

Ether & ERC-20 Tokens

redeemTokens - the amount of RAY tokens to redeem.

Return Values

The amount of the underlying assets received by the caller.

Redeem Underlying

Redeem a specified amount of the underlying asset.

Ether & ERC-20 Tokens
Ether & ERC-20 Tokens
function redeemUnderlying(uint redeemAmount) external
Function Parameters
Return Values
Function Parameters

Ether & ERC-20 Tokens

redeemAmount - the amount of the underlying asset to redeem, in the smallest units of the underlying asset.

Return Values

Nothing.

Exchange Rates

Each RAY Token is convertible into a perpetually increasing quantity of the underlying asset, as yield is earned by RAY.

Exchange Rate Current Use exchangeRateCurrent() to find the current exchange rate between RAY Tokens <> underlying asset. This is the fully realized value of a RAY Token. Use this to find the full value of a RAY Token. Note, the function is not view because it may change state.

Ether & ERC-20 Tokens
Ether & ERC-20 Tokens
function exchangeRateCurrent() external returns (uint)
Return Values
Return Values

The fully realized exchange rate between RAY Tokens and the underlying asset, in units of wei (scaled by 1e18).

Exchange Rate Burn

Use exchangeRateBurn() to find the burn exchange rate between RAY Tokens <> underlying asset. This is always either less than or equal to the exchangeRateCurrent() - and doesn't reflect all the yield earnt by RAY. The burn exchange rate is used to price RAY Tokens on burn - also known as withdrawals from RAY. Use this to get the value of a RAY Token if one was to withdrew at that instant.

Note, this function is not view because it may change state - though generally, it won't.

Ether & ERC-20 Tokens
Ether & ERC-20 Tokens
function exchangeRateBurn() external returns (uint)
Return Values
Return Values

The exchange rate between RAY Tokens and the underlying asset, used to price RAY Tokens upon withdrawal from the system. In units of wei (scaled by 1e18).