Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ ODOS_REFERRAL_CODE=""
OOGABOOGA_API_KEY=""
OX_API_KEY=""
MAGPIE_API_KEY=""
ENSO_API_KEY=""
ENSO_API_KEY=""
BINANCE_WALLET_API_KEY=""
BINANCE_WALLET_SECRET_KEY=""
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@asteasolutions/zod-to-openapi": "7.2.0",
"@balmy/sdk": "0.9.0",
"@berachain-foundation/berancer-sdk": "1.1.7",
"@eulerxyz/euler-v2-sdk": "1.1.1",
"@uniformlabs/multiliquid-evm-sdk": "0.1.1",
"@uniswap/router-sdk": "1.15.0",
"@uniswap/sdk-core": "7.13.0",
Expand Down Expand Up @@ -73,7 +74,6 @@
"@types/qs": "^6.9.18",
"@types/supertest": "^6.0.2",
"@types/swagger-ui-express": "^4.1.7",
"euler-v2-sdk": "0.0.1-alpha",
"husky": "^9.1.7",
"lint-staged": "^17.0.4",
"pino-pretty": "^13.0.0",
Expand Down
58 changes: 41 additions & 17 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 20 additions & 17 deletions src/__tests__/live/swaps.live.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { spawn } from "node:child_process"
import { once } from "node:events"
import { type Server, createServer } from "node:http"
import type { AddressInfo } from "node:net"
import dotenv from "dotenv"
import {
type EulerSDK,
type SubAccount,
Expand All @@ -12,8 +11,10 @@ import {
type VaultEntity,
buildEulerSDK,
decodeSmartContractErrors,
flattenBatchEntries,
getSubAccountAddress,
} from "euler-v2-sdk"
} from "@eulerxyz/euler-v2-sdk"
import dotenv from "dotenv"
import {
http,
type Address,
Expand Down Expand Up @@ -138,14 +139,13 @@ describe.sequential("mainnet live swap flows", () => {

process.env.RPC_URL_1 = anvilUrl

const [{ buildCache }, { refreshContractBookAddresses }, { app }] =
await Promise.all([
import("@/common/utils/tokenList"),
import("@/common/utils/contractBook"),
import("@/server"),
])
const [{ buildCache }, { loadDeployments }, { app }] = await Promise.all([
import("@/common/utils/tokenList"),
import("@/common/utils/deployments"),
import("@/server"),
])

await refreshContractBookAddresses().catch(() => undefined)
await loadDeployments()
await buildCache()

appServer = createServer(app)
Expand All @@ -154,7 +154,9 @@ describe.sequential("mainnet live swap flows", () => {
swapApiUrl = `http://127.0.0.1:${(appServer.address() as AddressInfo).port}`

sdk = await buildEulerSDK({
rpcUrls: { [CHAIN_ID]: anvilUrl },
config: {
rpcUrls: { [CHAIN_ID]: anvilUrl },
},
swapServiceConfig: {
swapApiUrl,
},
Expand Down Expand Up @@ -227,7 +229,7 @@ describe.sequential("mainnet live swap flows", () => {
accountData.updateSubAccounts(afterDeposit)

const collateralQuote = pickQuote(
await sdk.swapService.getDepositQuote({
await sdk.swapService.fetchDepositQuote({
chainId: CHAIN_ID,
fromVault: EULER_PRIME_USDC_VAULT,
toVault: WSTETH_VAULT,
Expand Down Expand Up @@ -283,7 +285,7 @@ describe.sequential("mainnet live swap flows", () => {
accountData.updateSubAccounts(afterBorrow)

const repayQuote = pickQuote(
await sdk.swapService.getRepayQuotes({
await sdk.swapService.fetchRepayQuotes({
chainId: CHAIN_ID,
fromVault: WSTETH_VAULT,
fromAsset: WSTETH_ADDRESS,
Expand Down Expand Up @@ -362,7 +364,7 @@ describe.sequential("mainnet live swap flows", () => {
accountData.updateSubAccounts(afterBorrow)

const repayQuote = pickQuote(
await sdk.swapService.getRepayQuotes({
await sdk.swapService.fetchRepayQuotes({
chainId: CHAIN_ID,
fromVault: EULER_PRIME_USDC_VAULT,
fromAsset: USDC_ADDRESS,
Expand Down Expand Up @@ -405,7 +407,7 @@ describe.sequential("mainnet live swap flows", () => {
const assetDecimals = await readDecimals(route.asset)
const vaultDecimals = await readDecimals(route.vault)

const depositQuotes = await sdk.swapService.getDepositQuote({
const depositQuotes = await sdk.swapService.fetchDepositQuote({
chainId: CHAIN_ID,
fromVault: zeroAddress,
toVault: route.vault,
Expand All @@ -422,7 +424,7 @@ describe.sequential("mainnet live swap flows", () => {

expect(depositQuotes.length).toBeGreaterThan(0)

const redeemQuotes = await sdk.swapService.getSwapQuotes({
const redeemQuotes = await sdk.swapService.fetchSwapQuotes({
chainId: CHAIN_ID,
tokenIn: route.vault,
tokenOut: route.asset,
Expand Down Expand Up @@ -532,8 +534,9 @@ async function executePlan(plan: TransactionPlanItem[]) {
if (item.type !== "evcBatch") continue

const deployment = sdk.deploymentService.getDeployment(CHAIN_ID)
const batchData = sdk.executionService.encodeBatch(item.items)
const totalValue = item.items.reduce((sum, batchItem) => {
const batchItems = flattenBatchEntries(item.items)
const batchData = sdk.executionService.encodeBatch(batchItems)
const totalValue = batchItems.reduce((sum, batchItem) => {
return sum + batchItem.value
}, 0n)

Expand Down
Loading