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.

Addresses on Ethereum mainnet

USDe: 0x4c9EDD5852cd905f086C759E8383e09bff1E68B3

Ethena Minting contract: 0x2CC440b721d2CaFd6D64908D6d8C4aCC57F8Afc3

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

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.

Indicative quote endpoint

This endpoint continuously updates at 0.25s intervals. It provides up to date information on mint/redeem pricing and size limits at the current instant.

Your request

key

Possible values

Description

pair

stETH/USDe

the only pair collateral/usde pair accepted

Our response

key

Possible values

Description

pair

stETH/USDe

the only pair collateral/usde pair accepted

mint

array of mapping [{size: 2, price: 1545.32},…]

indicative price of minting stETH for USDe by size

redeem

array of mapping [{size: 2, price: 1545.33},…]

indicative price of redeeming USDe for stETH by size

size

2,4,8,16,32…

size of base asset. (stETH)

price

1800.21

Price to buy/sell each stETH in USDe, before gas

gas

6.4718

Estimated gas cost of the tx.

max-mint

100000

maximum size of USDe you can mint in an order

max-redeem

100000

maximum size of USDe you redeem mint in an order

remaining-mint

80000

remaining USDe amount you can mint this block

remaining-redeem

80000

remaining USDe amount you can redeem this block

Note: Table fields in Purple are yet to be implemented.

Remaining mint and redeem amounts exist as Ethena’s minting contract has a configurable per block limit of mints and redeems. The value we will launch with is 100,000.

At the start of each block, the limit is refreshed to 100,000. On Ethena receiving an order, the remaining mint/redeem values are deducted by the order’s size, checked then sent on chain; executed on a first come first serve basis.

Example request

curl 'https://api2.ethena.fi/indicative?pair=stETH/USDe'

Example response

{
   "gas":"1.959465760",
   "max-mint":100000,
   "max-redeem":100000,
   "mint":[
      {
         "price":"1545.32",
         "size":2
      },
      {
         "price":"1545.32",
         "size":4
      },
      {
         "price":"1545.32",
         "size":8
      },
      {
         "price":"1545.32",
         "size":16
      },
      {
         "price":"1545.32",
         "size":32
      }
   ],
   "pair":"stETH/USDe",
   "redeem":[
      {
         "price":"1545.33",
         "size":2
      },
      {
         "price":"1545.33",
         "size":4
      },
      {
         "price":"1545.33",
         "size":8
      },
      {
         "price":"1545.33",
         "size":16
      },
      {
         "price":"1545.33",
         "size":32
      }
   ]
}

RFQ 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

stETH/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

stETH/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://api2.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://api2.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.

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

rfq_id

RFQ-5X5PFG1N782KM

rfq_id from rfq step

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://api2.ethena.fi/order?signature=0xf80a44c799d13f257fa25459a9e2d36dadfea48a78f699de3f09fc3009a0e92d63b51ce85003c95cd7f4b80c271659092b898192d83fcd0dc1e3aae7483d59931b&rfq_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