Getting Started with Euler V2 Development
Welcome to the Euler V2 Developer Portal! This guide will help you set up your development environment and start building on Euler V2. Whether you're creating custom lending vaults, integrating lending capabilities into your dApp, or building yield strategies, this guide will get you started.
Prerequisites
Before diving into development, make sure you have:
- A solid understanding of Ethereum development
- Familiarity with Solidity smart contracts
- Basic knowledge of DeFi protocols and lending mechanics
Setting Up Your Environment
1. Node.js and Package Manager
First, ensure you have Node.js installed (LTS version recommended):
# Check Node.js version
node --version
# Check npm version
npm --version
You can download Node.js from nodejs.org. While npm comes with Node.js, you might prefer using yarn:
npm install -g yarn
2. Blockchain Interaction Libraries
Choose one of these libraries to interact with the Ethereum blockchain:
Ethers.js (recommended for beginners):
npm install ethers
# or
yarn add ethers
Viem (modern, type-safe alternative):
npm install viem
# or
yarn add viem
3. Smart Contract Development
For smart contract development, we recommend using Foundry:
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup
4. Getting Contract ABIs
The euler-interfaces repository is your one-stop shop for all contract-related resources. It contains:
- Contract addresses across all supported networks
- ABIs for the most commonly used smart contracts
- Solidity interfaces for smart contract development
If you can't find what you need in the euler-interfaces repository, you can find the complete ABIs in the dedicated smart contract repositories, i.e.:
- euler-vault-kit for core vault contracts
- evk-periphery for peripheral contracts
5. Node Access
You'll need access to RPC. Options include:
- Infura: infura.io
- Alchemy: alchemy.com
- QuickNode: quicknode.com
- others
Key Contract Addresses
Having the correct contract addresses is crucial for interacting with Euler. You can find the latest addresses across all supported networks in either the euler-interfaces repository or our Contract Addresses page.
Common Development Tasks
Deploying a New Vault
There are two main ways to deploy a new vault in Euler V2:
-
Using the Vault Creator Tool (Recommended for most users):
- Visit create.euler.finance
- Follow the guided interface to configure and deploy your vault
- No coding required, perfect for quick deployments
- Limited functionality
-
Using euler-vault-scripts (Recommended for developers):
- Clone the euler-vault-scripts repository
- Use the provided scripts to deploy and configure your cluster of vaults
- Ideal for automated deployments and vaults further management
Interacting with Existing Vaults
To interact with an existing vault, you'll need to:
- Get the vault's address
- Get the underlying asset's address
- Approve the vault to spend your tokens
- Call the deposit function
Here's a simple example using ethers.js:
const { ethers } = require('ethers');
const { abi: vaultABI } = require('@euler-xyz/euler-interfaces/abi/EVault.json');
const { abi: erc20ABI } = require('@euler-xyz/euler-interfaces/abi/IERC20.json');
async function depositToVault(
vaultAddress,
assetAddress,
amount,
signer
) {
// Create contract instances
const vault = new ethers.Contract(vaultAddress, vaultABI, signer);
const asset = new ethers.Contract(assetAddress, erc20ABI, signer);
// Approve the vault to spend your tokens
const approveTx = await asset.approve(vaultAddress, amount);
await approveTx.wait();
// Deposit the tokens
const depositTx = await vault.deposit(amount, signer.address);
const receipt = await depositTx.wait();
// Get the amount of shares received
const shares = await vault.balanceOf(signer.address);
return shares;
}
The deposit function follows the ERC-4626 standard and returns the amount of shares received. The shares represent your proportional ownership of the vault's assets.
Need Help?
- Join our Discord for developer support
- Check our GitHub repositories
- Review our technical documentation