yxToken (DyDx tokenization)
yxTokens allow users to earn interests on DAI and USDc via DyDx protocol in an easy and composable way. The contract is used to create ERC20 representing lending positions on DyDx protocol. When you lend assets you will receive yxTokens representing your share of the contract balance in DyDx protocol.
When you redeem funds you will burn yxTokens and unlock your assets + interest accrued.
The yxToken amount when minting is determined by a price taken directly from DyDx (usinggetMarketCurrentIndex method), the price of each yxToken should always increase because it represents the deposited notional + interest accrued.
You can find the source code here.
CONTRACT
ABI
ADDRESS
​
1
interface yxToken {
2
// Get current yxToken price in underlying (eg. DAI)
3
function price() public view returns (uint256)
4
// Get address of the underlying token used
5
function underlying() public view returns (address)
6
// Get DyDx available liquidity for underlying
7
function availableLiquidity() external view returns (uint256)
8
// Get balance in underlying of an address
9
function balanceInUnderlying(address who) external view returns (uint256)
10
// Lend funds on DyDx and get back yxTokens.
11
// User should approve this contract to spend `underluing` before calling this
12
function mint(uint256 _amount) external returns (uint256 newTokens)
13
// Redeem funds from DyDx by burning yxTokens
14
function redeem(uint256 _amount, address _account) external returns (uint256 tokens)
15
}
Copied!
Last modified 10mo ago
Copy link