Skip to content

Commit a027c25

Browse files
authored
Fixes (#20)
* fixes
1 parent 1108a3c commit a027c25

File tree

9 files changed

+90
-101
lines changed

9 files changed

+90
-101
lines changed

assets/gas.png

147 KB
Loading

pages/bundler-api/actions/_meta.json

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
{
2-
"route": "Route",
3-
"deposit": "Deposit",
4-
"harvest": "Harvest",
5-
"borrow": "Borrow",
6-
"repay": "Repay",
7-
"redeem": "Redeem",
8-
"apiswap": "API Swap",
9-
"swap": "Swap",
10-
"transfer": "Transfer",
11-
"withdraw": "Withdraw",
12-
"approve": "Approve",
13-
"permitTransferFrom": "Permit TransferFrom"
2+
"route": "Route",
3+
"deposit": "Deposit",
4+
"apiswap": "API Swap",
5+
"harvest": "Harvest",
6+
"borrow": "Borrow",
7+
"repay": "Repay",
8+
"redeem": "Redeem",
9+
"swap": "Swap",
10+
"transfer": "Transfer",
11+
"withdraw": "Withdraw",
12+
"approve": "Approve",
13+
"permitTransferFrom": "Permit TransferFrom"
1414
}
15-

pages/bundler-api/actions/apiswap.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The bundle endpoint enables bundling of many actions into one transaction, and f
3939

4040
Convert from [WETH](https://etherscan.io/address/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) to [USDC](https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) assuming the user has WETH in their wallet. More more efficiency it is advised to use the [route endpoint](./route.md) for these types of actions
4141

42-
```
42+
```bash copy
4343
curl -X POST \
4444
-H "Content-Type: application/json" \
4545
-H "Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation" \

pages/bundler-api/actions/route.mdx

+21-30
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,18 @@
11
# Route
22

3-
## Summary
4-
53
Routing is the action for taking funds from the callers wallet, and converting it into a token, whether that is a [DeFi Position Token](../../concepts/tokens/defiTokens.mdx), or a [Base Token](../../concepts/tokens/baseTokens.mdx).
64

75
This endpoint is a pathfinder for determine best price and gas execution across Enso dataset, DEX aggregators, and direct depositing into DeFi protocols.
86

97
## Entering into a DeFi position
108

11-
With Enso you can simply use Route to obtain the DeFi position token resulting in quick, and easy integration with all the logic for each particular protocol interaction logic abstracted away.
9+
With Enso you can use Route to obtain the DeFi position token resulting in quick, and easy integration with all the logic for each particular protocol interaction logic abstracted away.
1210

1311
You can use the route action:
1412

1513
1. As an [individual call](../../router-api/introduction.mdx)
1614
2. Or in a [bundle of calls](../../bundler-api/introduction.mdx)
1715

18-
### Individual call
19-
20-
There are 2 options for using this individual call 1. EOA: Approving the contract for the route 2. Smart Wallets:
21-
22-
#### Approve first
23-
24-
#### Execution
25-
26-
```
27-
curl --request POST \
28-
--url 'http://api.enso.finance/api/v1/shortcuts/route?chainId=1&fromAddress=0x9008D19f58AAbD9eD0D60971565AA8510560ab41&tokenIn=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&tokenOut=0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56&amountIn=326880000000000000000&tokenInAmountToTransfer=326880000000000000000' \
29-
--header 'content-type: application/json' \
30-
```
31-
3216
```javascript
3317
fromAddress: 'Address to use funds from'
3418
tokenIn: 'Address of token to send'
@@ -37,34 +21,41 @@ amountIn: 'Raw amount to send'
3721
tokenInAmountToTransfer: '326880000000000000000'
3822
```
3923

40-
## Endpoints
24+
## Example
4125

4226
### POST [/api/v1/shortcuts/bundle](../introduction.mdx)
4327

4428
The bundle endpoint enables bundling of many actions into one transaction, and for the examples below we will simply do one action of deposit.
4529

4630
For example we can bundle the following operations in one single transaction:
4731

48-
- Convert from BAL and WETH to a Balancer [BAL80WETH20](https://etherscan.io/address/0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56)
49-
- Convert from ETH to the ETH/stEth Curve pool [steCrv](https://etherscan.io/address/0x06325440D014e39736583c165C2963BA99fAf14E)
32+
- Deposit from ETH to [stEth](https://etherscan.io/address/0xae7ab96520de3a18e5e111b5eaab095312d7fe84)
33+
- Deposit from ETH to the ETH/stEth Curve pool [steCrv](https://etherscan.io/address/0x06325440D014e39736583c165C2963BA99fAf14E)
5034

51-
```
35+
```bash copy
5236
curl -X POST \
53-
-H "Content-Type: application/json" \
54-
-H "Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation" \
55-
--data '[
37+
-H 'Content-Type: application/json' \
38+
-H 'Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation' \
39+
-d '[
40+
{
41+
"protocol": "enso",
42+
"action": "route",
43+
"args": {
44+
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
45+
"tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
46+
"amountIn": "1000000000"
47+
}
48+
},
5649
{
5750
"protocol": "enso",
5851
"action": "route",
5952
"args": {
60-
"slippage": 300,
61-
"tokenIn": ["0xba100000625a3754423978a60c9317c58a424e3D", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],
62-
"tokenOut": "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56",
63-
"amountIn": [1000000000, 1000000000],
64-
"tokenInAmountToApprove": [1000000000, 1000000000],
53+
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
54+
"tokenOut": "0x06325440d014e39736583c165c2963ba99faf14e",
55+
"amountIn": "1000000000"
6556
}
6657
}
6758
]' \
68-
"https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0x7713974908Be4BEd47172370115e8b1219F4A5f0"
59+
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045'
6960

7061
```

pages/bundler-api/api-reference/bundle.mdx

+22-21
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,27 @@ Both transactions are bundled together in a single one.
4343

4444
```bash copy
4545
curl -X POST \
46-
-H "Content-Type: application/json" \
47-
-H "Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation" \
48-
--data '[
49-
{
50-
"protocol": "enso",
51-
"action": "route",
52-
"args": {
53-
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
54-
"tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
55-
"amountIn": "1000000000"
56-
}
57-
},
58-
{
59-
"protocol": "enso",
60-
"action": "route",
61-
"args": {
62-
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
63-
"tokenOut": "0x06325440d014e39736583c165c2963ba99faf14e",
64-
"amountIn": "1000000000"
46+
-H 'Content-Type: application/json' \
47+
-H 'Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation' \
48+
-d '[
49+
{
50+
"protocol": "enso",
51+
"action": "route",
52+
"args": {
53+
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
54+
"tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
55+
"amountIn": "1000000000"
56+
}
57+
},
58+
{
59+
"protocol": "enso",
60+
"action": "route",
61+
"args": {
62+
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
63+
"tokenOut": "0x06325440d014e39736583c165c2963ba99faf14e",
64+
"amountIn": "1000000000"
65+
}
6566
}
66-
}]' \
67-
"https://api.enso.finance/api/v1/shortcuts/bundle?chainId=<your_chainId>&fromAddress=<your_fromAddress>"
67+
]' \
68+
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
6869
```

pages/bundler-api/introduction.mdx

+31-33
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { Callout } from 'nextra/components'
2+
import Image from 'next/image'
3+
import gas from '../../assets/gas.png'
24

35
## What is the Bundle API?
46

@@ -14,7 +16,11 @@ The Bundle API takes care of optimizing the execution sequence and estimating th
1416

1517
## Gas Savings
1618

17-
// TODO: Add gas savings table/image
19+
More transactions bundled together means more gas savings. The Bundle API is designed to optimize the execution sequence of the bundled actions, which can result in significant gas savings:
20+
21+
<br></br>
22+
23+
<Image src={gas} alt="Gas Chart" width={700} />
1824

1925
---
2026

@@ -25,45 +31,37 @@ The Bundle API takes care of optimizing the execution sequence and estimating th
2531
👉 Run this curl request to see a live route response for entering a Curve Pool with ETH
2632

2733
```bash copy
28-
curl -X POST 'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=<your_chainId>&fromAddress=<your_fromAddress>' \
29-
-H 'Content-Type: application/json' \
30-
-d [
31-
{
32-
"protocol": "enso",
33-
"action": "route",
34-
"args": {
35-
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
36-
"tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
37-
"amountIn": "1000000000"
38-
}
39-
},
40-
{
41-
"protocol": "enso",
42-
"action": "route",
43-
"args": {
44-
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
45-
"tokenOut": "0x06325440d014e39736583c165c2963ba99faf14e",
46-
"amountIn": "1000000000"
34+
curl -X POST \
35+
-H 'Content-Type: application/json' \
36+
-H 'Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation' \
37+
-d '[
38+
{
39+
"protocol": "enso",
40+
"action": "route",
41+
"args": {
42+
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
43+
"tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
44+
"amountIn": "1000000000"
45+
}
46+
},
47+
{
48+
"protocol": "enso",
49+
"action": "route",
50+
"args": {
51+
"tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
52+
"tokenOut": "0x06325440d014e39736583c165c2963ba99faf14e",
53+
"amountIn": "1000000000"
54+
}
4755
}
48-
}
49-
]
56+
]' \
57+
'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
58+
5059
```
5160

5261
👉 Or try it out in the [Swagger UI](https://api.enso.finance/api#/shortcuts/BundleController_bundleShortcutTransaction)
53-
)
5462

5563
Details:
5664
Let's say you want to go from Ether to a the steCrv Curve pool. Also, you want to deposit the Curve LP into the Curve Gauge.
5765
In the route endpoint you would simply pass a tokenIn (Ether), the amount and the tokenOut (the Curve Gauge).
5866

5967
Enso will take care to swap your token in to the required token (if needed), deposit the LP into the Curve Gauge and stake the LP tokens into the Curve Gauge.
60-
61-
It will return:
62-
63-
## Why to use?
64-
65-
## Under the hood
66-
67-
```
68-
69-
```

pages/developer-resources.mdx

Whitespace-only changes.

pages/examples/eoa/route-1-position.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ await ERC20(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2).approve(address, 5 Ether
6161

6262
### Execute: Build actions
6363

64-
We are using the [Route action](../../bundler-api/actions/route) inside of the [Bundle endpoint](../../bundler-api/api-reference/overview) as this action compares the best execution route for token amount out, and gas execution price. For example, it might be better to purchase yvWETH on a secondary exchange than directly depositing it depending upon the exchange rate of that token on the secondary market.
64+
We are using the [Route endpoint](../../router-api/api-reference/overview) as this it compares the best execution route for token amount out, and gas execution price. For example, it might be better to purchase yvWETH on a secondary exchange than directly depositing it depending upon the exchange rate of that token on the secondary market.
6565

6666
```bash copy
67-
curl -X POST \
67+
curl -X GET \
6868
-H "Content-Type: application/json" \
6969
-H "Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation" \
7070
"https://api.enso.finance/api/v1/shortcuts/route?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&priceImpact=false&toEoa=true&amountIn=1000000000000000000&slippage=300&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&tokenOut=0xae7ab96520de3a18e5e111b5eaab095312d7fe84"

pages/examples/smart-wallet/route-1-position.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ It returns the following:
3939

4040
### Execute: Fetch the actions
4141

42-
We are using the [Route action](../../bundler-api/actions/route) inside of the [Bundle endpoint](../../bundler-api/api-reference/overview) as this action compares the best execution route for token amount out, and gas execution price. For example, it might be better to purchase yvWETH on a secondary exchange than directly depositing it depending upon the exchange rate of that token on the secondary market.
42+
We are using the [Route endpoint](../../router-api/api-reference/overview) as it compares the best execution route for token amount out, and gas execution price. For example, it might be better to purchase yvWETH on a secondary exchange than directly depositing it depending upon the exchange rate of that token on the secondary market.
4343
Note that the we set `toEoA` to _false_, as we are using a smart wallet.
4444

4545
```bash copy

0 commit comments

Comments
 (0)