DeFi Strategy Shortcuts
Plume has partnered with Enso to create Shortcuts to turn crosschain DeFi strategies into atomic, gas-efficient transactions for liquidity migration and provide seamless user experience to dApps.
Getting Started
Enso's battle-tested routing engine provides a standardized interface to interact with different protocols, despite their differences.
Routing APIs. Both routing APIs return a transaction object—the executable form of the route, which executes atomically, regardless of the number of steps:
/route API: Specify input/output tokens and run optimized execution paths
/bundle API: Chain custom shortcut blueprints that interact with various protocols by chaining different actions
Utility APIs. Additional APIs bring information about:
supported tokens with TVL and APY values,
available actions - the unified interaction interfaces used to build routes declaratively,
wallet balanaces and DeFi positions for any address.
You can explore supported tokens and protocols using Enso Navigator.
To explore what's possible with Enso, check out Routing Examples, and for further ideas check out the Shortcuts Library.
Integration
You can integrate Enso in your UI or backends in following ways:
Crosschain Route Widget—a React component and a standalone application for frictionless token transfers. Whereas You can integrate into your own application.
Routing Examples
The following examples demonstrate how to use Enso's GET /route API with protocols such as Mystic, Solera, Nucleus, Tempest, Dinero, and Origin.
Basic Token Swap
The simplest route you can construct with Enso is a token swap. In this example, we're creating a path from bridged USDC.e to PUSD. The result will contain:
route.route
: The route object with the exact path and parametersroute.tx
: The transaction object that can be executed on-chain
const client = new EnsoClient({
apiKey: 'your-api-key'
});
const route = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000000000000'],
slippage: '300',
tokenIn: ['0x54FD4da2Fa19Cf0f63d8f93A6EA5BEd3F9C042C6'],
tokenOut: ['0xdddD73F5Df1F0DC31373357beAC77545dC5A6f3F'],
routingStrategy: 'router'
});
console.log("Route", route.route);
console.log("Transaction", route.tx);
Mystic Vaults: Depositing PLUME for myUSDC
The following call will construct a route for depositing PLUME (tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
) as a collateral to get myUSDC (tokenOut=0x6c92efa3F77760619bb13d395836415ac18C86dc
), with receiver address getting all output tokens.
Under the hood, the route designs two operations:
swap PLUME (input token) for USDC.e
deposit USDC.e into the myUSDC pool, interacting with primary
0xCE192A6E105cD8dd97b8Dedc5B5b263B52bb6AE0
The exact route is determined at runtime, and optimized against current market conditions.
Explore Mystic Positions.
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000000000000'],
slippage: '300',
tokenIn: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'],
tokenOut: ['0x6c92efa3F77760619bb13d395836415ac18C86dc'],
routingStrategy: 'router'
});
console.log("Route", route.route);
console.log("Transaction", route.tx);
Solera: Depositing PLUME for aPlunALPHA
The following call will generate a route for depositing PLUME tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
as a collateral to get aPlunALPHA tokenOut=0x5d0EC9B10e6759719CeFE14b8c881634678b32f2
, with receiver address getting all output tokens.
In this multi-step process, Enso saves you 2 transactions by constructing a route with:
swap PLUME for PUSD using enso.swap action
deposit PUSD into NALPHA Nucleus pool, interacting with primary
0xc9f6a492fb1d623690dc065bbced6dfb4a324a35
deposit NALPHA into the Solera pool, interacting with primary
0x5d0ec9b10e6759719cefe14b8c881634678b32f2
Check out supported Solera Vaults.
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000000000'],
slippage: '300',
tokenIn: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'],
tokenOut: ['0x5d0EC9B10e6759719CeFE14b8c881634678b32f2'],
routingStrategy: 'router'
});
Nucleus: Depositing USDC.e into an nYIELD Vault
The following call will design a route for depositing USDC tokenIn=0x78adD880A697070c1e765Ac44D65323a0DcCE913
as a collateral to get nYIELD tokenOut=0x892dFF5257B39F7AFb7803Dd7C81E8ecDB6af3E8
, with receiver address getting all output tokens.
The internal mechanics of this route include:
swap USDC for PUSD using enso.swap action
deposit PUSD into nYIELD Nucleus pool, interacting with primary
0x92a735f600175fe9ba350a915572a86f68ebbe66
to get nUSDY
Browse through Nucleus positions.
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0x78adD880A697070c1e765Ac44D65323a0DcCE913'],
tokenOut: ['0x892DFf5257B39f7afB7803dd7C81E8ECDB6af3E8'],
routingStrategy: 'delegate'
});
console.log("Route", route.route);
console.log("Transaction", route.tx);
Tempest: Depositing USDC.e into a Tempest Vault
At the protocol level, the route maps:
swap USDC.e for PUSD using enso.swap action
deposit PUSD into Tempest pool, interacting with primary
0x3c4f9804ce0810821f61289eb4f92c8e5007c119
Explore Tempest Positions.
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0x78adD880A697070c1e765Ac44D65323a0DcCE913'],
tokenOut: ['0x3C4F9804ce0810821F61289Eb4F92c8E5007c119'],
routingStrategy: 'delegate'
});
console.log("Route", route.route);
console.log("Transaction", route.tx);
Dinero: Staking PLUME for pETH
This call will generate a route for staking Plume as a collateral to get pETH.
The route will swap PLUME for PUSD using enso.swap
action, and deposit PUSD into the Dinero pool, interacting with primary 0x3c4f9804ce0810821f61289eb4f92c8e5007c119
.
Explore Dinero Positions.
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'],
tokenOut: ['0x39d1F90eF89C52dDA276194E9a832b484ee45574'],
routingStrategy: 'delegate'
});
console.log("Route", route.route);
console.log("Transaction", route.tx);
Origin: Depositing USDC.e into an Origin Vault
This call will generate a route for depositing USDC.e as a collateral to get SUPEROETH, encapsulating the following steps:
swap USDC.e for WETH using enso.swap action
deposit PUSD into the Origin pool, interacting with primary
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'],
tokenOut: ['0x39d1F90eF89C52dDA276194E9a832b484ee45574'],
routingStrategy: 'delegate'
});
console.log("Route", route.route);
console.log("Transaction", route.tx);
Explore Origin Positions.
Rooster: Depositing PUSD into a Rooster pool
This example requests a route for depositing PUSD into a Rooster pool, with the following steps:
split PUSD to NALPHA and PUSD using the enso.split action
deposit NALPHA and PUSD into the Rooster pool, interacting with primary 0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038
Explore Rooster Pools.
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0xdddd73f5df1f0dc31373357beac77545dc5a6f3f'],
tokenOut: ['0xfc3bd0e01b4e755aedd2a4087ccdb90c4d28f038'],
routingStrategy: 'delegate'
});
console.log("Route", route.route);
console.log("Transaction", route.tx);
Nest: Depositing PUSD into a Nest Alpha Vault for NALPHA
This example requests a route for depositing PUSD into a Rooster pool, with the following steps:
swap PUSD for WETH using the
enso.swap
actiondeposit WETH into the Nest pool, interacting with primary
0xc9f6a492fb1d623690dc065bbced6dfb4a324a35
const routeData = await client.getRouteData({
fromAddress: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
receiver: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
chainId: 98866,
amountIn: ['1000000000'],
slippage: '300',
tokenIn: ['0xca59ca09e5602fae8b629dee83ffa819741f14be'],
tokenOut: ['0x593ccca4c4bf58b7526a4c164ceef4003c6388db'],
routingStrategy: 'delegate'
});
console.log("Route", route.route);
console.log("Transaction", route.tx);
Resources
Last updated