Overview

Ethena’s public API consists of 3 main endpoints. We offer the ability to stream indicative quotes, perform a formal RFQ and finally submitting of signed orders.

Only whitelisted users are able to successfully interact with the API interface. We recommend reaching out in our discord if you would like to be whitelisted.

Addresses on Ethereum mainnet

USDe: 0x4c9EDD5852cd905f086C759E8383e09bff1E68B3

Ethena Mint and Redeem Smart Contract: 0xe3490297a08d6fC8Da46Edb7B6142E4F461b62D3

These addresses are the production USDe and minting contract. Care should be taken using them as real value will be transferred.

Mint & Redeem Smart Contract ABI

Server location

Ethena's infrastructure is hosted on AWS Asia Pacific (Hong Kong) region, ap-east-1. Low latency with our infrastructure is necessary to algorithmically mint or redeem with Ethena as quotes are valid for limited time.

Connection URLs

Whitelisted users are able to use either https://public.api.ethena.fi or https://private.api.ethena.fi

You must provide an IP address to be whitelisted if you wish to use the private.api.ethena.fi connection URL. There is no difference in priority, performance, or rate limits between the two connection URLs.

Approvals Added to Whitelisted Addresses

Ensure you have approved the Mint & Redeem Smart Contract for your whitelisted wallet addresses.

Pair Availability Endpoint

This endpoint returns the pairs available to directly mint & redeem with.

No parameters required

Our response

key

Possible values

Description

mint

["USDT/USDE", "USDC/USDE"]

The available pairs to directly mint with.

redeem

["USDT/USDE", "USDC/USDE"]

The available pairs to directly redeem with.

Example request

curl 'https://public.api.ethena.fi/asset-availability'

Example response

{
    "mint": [
        "USDT/USDE"
    ],
    "redeem": [
        "USDT/USDE"
    ]
}

RFQ Request Endpoint

Call the RFQ endpoint to receive a formal mint/redeem quote. Quotes are valid for 500 milliseconds upon us sending our response.

Your request

key

Possible values

Description

pair

USDT/USDe, USDC/USDe

collateral/usde pairs we support

side

mint,redeem

size

21.2918

size of asset you will send us. stETH for mint, USDe for redeem

Our response

key

Possible values

Description

rfq_id

RFQ-B7MT6QD2JKFFC

Unique ID to be sent back to us when submitting order

pair

USDT/USDe

side

mint, redeem

size

1

size of asset you will send us. stETH for mint, USDe for redeem.

amount

1552.2695

amount of asset you will receive, before gas. USDe for mint, stETH for redeem.

collateral_asset_address

0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84

The non-USDe asset in the transaction

usde_address

0x8191DC3053Fe4564c17694cB203663d3C07B8960

Address of USDe

collateral_amount

1000000000000000000

Use this value for EIP712 signature. For mints, this is the same as size but in 18 decimals. For redeems, this is amount minus gas converted to stETH in 18 decimals

usde_amount

1550198770000000000000

Use this value for EIP712 signature. For redeems, this is the same as size but in 18 decimals. For mint, this is amount minus gas in 18 decimals

gas

2.070727513

the gas price of this tx in USD.

Example mint request

https://public.ethena.fi/rfq?pair=stETH/USDe&side=mint&size=1

Response

{
   "amount":"1552.2695",
   "collateral_amount":"1000000000000000000",
   "collateral_asset_address":"0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
   "gas":"2.070727513",
   "minting_contract_address":"0x980C680a90631c8Ea49fA37B47AbC3154219EC1a",
   "pair":"stETH/USDe",
   "rfq_id":"RFQ-GFMS55T786TWR",
   "side":"MINT",
   "size":"1",
   "usde_address":"0x8191DC3053Fe4564c17694cB203663d3C07B8960",
   "usde_amount":"1550198770000000000000"
}

Example redeem request

https://public.ethena.fi/rfq?pair=stETH/USDe&side=redeem&size=1000

Response

{
   "amount":"0.64394361",
   "collateral_amount":"642561610000000000",
   "collateral_asset_address":"0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
   "gas":"2.146150654",
   "minting_contract_address":"0x980C680a90631c8Ea49fA37B47AbC3154219EC1a",
   "pair":"stETH/USDe",
   "rfq_id":"RFQ-TYDSEL08FSU2W",
   "side":"REDEEM",
   "size":"1000",
   "usde_address":"0x8191DC3053Fe4564c17694cB203663d3C07B8960",
   "usde_amount":"1000000000000000000000"
}

Orders Submission Endpoint

After receiving the RFQ response, if you wish to execute the order as quoted, sign an EIP-712 signature using the usde_amount and collateral_amount values. Our system only accepts orders with matching values for the 2 fields, and if the order is submitted and received within 500 milliseconds of our previous RFQ response.

The order process has no interaction with the smart contracts as Ethena receives your orders, passes them through checks, then submits the order onchain.

For EIP-1271 users, you must add the signature_type parameter with the value EIP1271 to the request. The default is EIP712 so the former is only required if you're using EIP-1271.

url = {ethena_url}order?signature={signature_hex}&signature_type=EIP1271

Example payload

key

value

Description

signature

0xf80a44c799d13f257fa25459a9e2d36dadfea48a78f699de3f09fc3009a0e92d63b51ce85003c95cd7f4b80c271659092b898192d83fcd0dc1e3aae7483d59931b

Resulting signature from signing the order

order

See EIP712 signature ORDER_TYPE below

The order in plain json that they used to sign and create the signature

curl -d '{ "benefactor": "0x796Ee28CE42BF7bd43A09aCd43FAd0aACD7C3b29", "beneficiary": "0x796Ee28CE42BF7bd43A09aCd43FAd0aACD7C3b29", "collateral_amount": "2369467000000000", "collateral_asset": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", "expiry": 1697333516, "nonce": 353680841566917, "order_type": "MINT", "usde_amount": "1645047190000000000" }' -H "Content-Type: application/json" -X POST https://public.ethena.fi/order?signature=0xf80a44c799d13f257fa25459a9e2d36dadfea48a78f699de3f09fc3009a0e92d63b51ce85003c95cd7f4b80c271659092b898192d83fcd0dc1e3aae7483d59931b&order_id=RFQ-5X5PFG1N782KM

Response

{
   "tx":"0xb0e5aad7c1e905b3dfe27dea73327eec6e31d89081e78e4442cd34aa5f9e41ae"
}

The tx that went onchain

https://etherscan.io/tx/0xb0e5aad7c1e905b3dfe27dea73327eec6e31d89081e78e4442cd34aa5f9e41ae

EIP712 signature ORDER_TYPE

bytes32 private constant ORDER_TYPE = keccak256( "Order(uint8 order_type, uint256 expiry, uint256 nonce, address benefactor, address beneficiary, address collateral_asset, uint256 collateral_amount, uint256 usde_amount)" );

order key

values

Notes

order_type

0 or 1

0 for mint, 1 for redeem

expiry

1697334256

Use an expiry of current time + 45s

nonce

256

Use a unique int for each order. eg timestamp

benefactor

0x796Ee28CE42BF7bd43A09aCd43FAd0aACD7C3b29

address of signer. address where the asset is taken from (stETH for mint, USDe for redeem)

beneficiary

0x796Ee28CE42BF7bd43A09aCd43FAd0aACD7C3b29

address that receives funds. (USDe for mint, stETH for redeem).

collateral_asset

0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84

stETH address

collateral_amount

2369467000000000

Amount of stETH in 18 decimals. Use the exact value provided in RFQ

usde_amount

1645047190000000000

Amount of USDe in 18 decimals. Use the exact value provided in RFQ

Example raw order (before signing)

{
   "benefactor":"0x796Ee28CE42BF7bd43A09aCd43FAd0aACD7C3b29",
   "beneficiary":"0x796Ee28CE42BF7bd43A09aCd43FAd0aACD7C3b29",
   "collateral_amount":"2369467000000000",
   "collateral_asset":"0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
   "expiry":1697333516,
   "nonce":353680841566917,
   "order_type":"MINT",
   "usde_amount":"1645047190000000000"
}

Our response

We will either respond with a tx hash, where your order passed our checks and is sent to the blockchain or a failure message with a reason for failure.

The most common failure reasons include an invalid EIP-712 signature, submitting an order after the quote has expired or not having sufficient assets in your address for the mint or redeem.

Last updated