Announcing the Euler SDK

Calling all smart contract developers — integrate Euler into your workflows now!

As Euler grows and matures, attracting lenders and borrowers, the Euler community is also looking for ways to encourage developers to build cool products and integrations on top of the platform. To reach that goal, a JavaScript SDK for Euler has been released.

With this initial release, the SDK provides:

  • Easy access to instances of all Euler smart contracts, including mining contracts, the EUL token and peripheries such as FlashLoan.
  • Built-in configurations for Ethereum mainnet and Ropsten testnet.
  • Tools for working with Euler’s batch transactions.
  • Tools for signing and applying the EIP2612 permits.

For details, please read the docs. Here are just a few quick examples of how to use the SDK to interact with the Euler platform.

The Euler class

To begin with, import the Euler class and instantiate it with a standard ethers provider or signer:

import { Euler } from "@eulerxyz/euler-sdk"

const provider = new ethers

const signer = new ethers.Wallet("<PRV_KEY>", provider)

const e = new Euler(signer)


By default, you will get an instance configured for the mainnet. The main Euler singleton contracts are provided on the contracts property. They are simply vanilla instances of the ethers Contract class. Helpers are also available for factory-created contracts (eTokens, dTokens, pTokens).

const eUsdcAddress = await e

await e.eToken(eUsdcAddress).deposit(0, 1M_USDC)

Batch transactions

Now let’s try something more interesting. We’ll take advantage of batch transactions and deferred liquidity check, some of Euler’s coolest features. We’re going to build a leveraged position in a single transaction, in the same way the Short feature works in the Euler dapp. We’re going to mint the shorted token (WETH) and swap it on Uniswap V3 for collateral or long token (USDC). We need to defer the liquidity check because presumably the minted amount is too large to be sustained by existing collateral, and the liquidity check would fail on mint. Only when the minted deposit is swapped back to collateral is the health score restored.

const batchItems = [
contract: "markets",
method: "enterMarket",
contract: "eToken",
method: "mint",
args: [0, 1M_USDC]
contract: "swap",
method: "swapUniExactInputSingle",
args: [{
subAccountIdIn: 0,
subAccountIdOut: 0,
underlyingIn: WETH_ADDRESS,
underlyingOut: USDC_ADDRESS,
amountIn: 1M_USDC,
amountOutMinimum: mySlippageTolerance,
deadline: 0,
fee: 300, // use 0.3% USDC/WETH pool
sqrtPriceLimitX96: 0

const encodedBatch = e.buildBatch(batchItems)

const deferredLiquidityCheckAccount = await e

await e
.batchDispatch(encodedBatch, [deferredLiquidityCheckAccount])


Finally, the SDK handles signing and applying EIP2612 permits. The list of tokens supporting permits and the data needed to construct the signatures is provided by Euler’s token list.

const agEur = eulerTokenList.find(t => t.symbol === 'agEUR')
const eagEurAddr = e

const batchItems = [
await e.signPermitBatchItem(agEur),
contract: e.eToken(eagEurAddr),
method: "deposit",
args: [0, 1M_AGEUR]

What’s next

The current release provides a very basic set of features, and there’s obviously room for improvement. Work will be done on improving the SDK in the near future, but contributions, ideas, and requests from the community are also encouraged. Please feel free to open a pull request or reach out on Discord.



About Euler

Euler is a capital-efficient permissionless lending protocol that helps users to earn interest on their crypto assets or hedge against volatile markets without the need for a trusted third-party. Euler features a number of innovations not seen before in DeFi, including permissionless lending markets, reactive interest rates, protected collateral, MEV-resistant liquidations, multi-collateral stability pools, sub-accounts, risk-adjusted loans, and much more. For more information, visit

Join the Community

Follow us on Twitter. Join our Discord. Keep in touch on Telegram (community, announcements). Check out our website.

2024 Euler © All Rights Reserved

Press enquiry:

[email protected]