Skip to content

Commit

Permalink
Merge pull request #29 from rainprotocol/2023-10-09-crouter-mode
Browse files Browse the repository at this point in the history
Introduced `CURVE-ROUTER` mode [major]
  • Loading branch information
Siddharth2207 authored Oct 10, 2023
2 parents 5b31242 + a52231c commit 95ee8f2
Show file tree
Hide file tree
Showing 31 changed files with 18,191 additions and 39,081 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ logs
.env

## That one annoying file
.DS_Store
.DS_Store
.mem-cache
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ node arb-bot -k 12ab... -r https://... --orderbook-address 0x1a2b... --arb-addre
The app requires these arguments (all arguments can be set in env variables alternatively, more details below):
- `-k` or `--key`, Private key of wallet that performs the transactions. Will override the 'BOT_WALLET_PRIVATEKEY' in env variables
- `-r` or `--rpc`, RPC URL(s) that will be provider for interacting with evm, use different providers if more than 1 is specified to prevent banning. Will override the 'RPC_URL' in env variables
- `-m` or `--mode`, Running mode of the bot, must be one of: `0x` or `curve` or `router` or `srouter`, Will override the 'MODE' in env variables
- `-m` or `--mode`, Running mode of the bot, must be one of: `0x` or `curve` or `router` or `crouter` or `srouter`, Will override the 'MODE' in env variables
- `--orderbook-address`, Address of the deployed orderbook contract, Will override the 'ORDERBOOK_ADDRESS' in env variables
- `--arb-address`, Address of the deployed arb contract, Will override the 'ARB_ADDRESS' in env variables
- `--arb-contract-type`, Type of the Arb contract, can be either of `flash-loan-v2` or `flash-loan-v3` or `order-taker`, not availabe for `srouter` mode since it is a specialized mode, Will override the 'ARB_TYPE' in env variables
Expand Down Expand Up @@ -103,7 +103,7 @@ which will show:
Options:
-k, --key <private-key> Private key of wallet that performs the transactions. Will override the 'BOT_WALLET_PRIVATEKEY' in env variables
-r, --rpc <url...> RPC URL(s) that will be provider for interacting with evm, use different providers if more than 1 is specified to prevent banning. Will override the 'RPC_URL' in env variables
-m, --mode <string> Running mode of the bot, must be one of: `0x` or `curve` or `router` or `srouter`, Will override the 'MODE' in env variables
-m, --mode <string> Running mode of the bot, must be one of: `0x` or `curve` or `router` or `crouter` or `srouter`, Will override the 'MODE' in env variables
-o, --orders <path> The path to a local json file containing the orders details, can be used in combination with --subgraph, Will override the 'ORDERS' in env variables
-s, --subgraph <url...> Subgraph URL(s) to read orders details from, can be used in combination with --orders, Will override the 'SUBGRAPH' in env variables
--orderbook-address <address> Address of the deployed orderbook contract, Will override the 'ORDERBOOK_ADDRESS' in env variables
Expand Down Expand Up @@ -134,7 +134,7 @@ BOT_WALLET_PRIVATEKEY="123..."
# for specifying more than 1 RPC in the env, separate them by a comma and a space
RPC_URL="https://polygon-mainnet.g.alchemy.com/v2/{API_KEY}, https://rpc.ankr.com/polygon/{API_KEY}"

# bot running mode, one of "router", "0x", "curve", "srouter"
# bot running mode, one of "router", "0x", "curve", "crouter", "srouter"
MODE="router"

# arb contract address
Expand Down Expand Up @@ -238,7 +238,7 @@ const sgFilters = { // fil
const orderDetails = await RainArbBot.getOrderDetails(subgraphs, ordersJson, config.signer, sgFilters);

// to run the clearing process and get the report object which holds the report of cleared orders
const mode = "srouter" // mode can be one of "router", "0x" or "curve" or "srouter"
const mode = "srouter" // mode can be one of "router" or "0x" or "curve" or "crouter" or "srouter"
const reports = await RainArbBot.clear(mode, config, orderDetails, ...[clearOptions])
```
<br>
Expand Down
2 changes: 1 addition & 1 deletion arb-bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const getOptions = async argv => {
const cmdOptions = new Command("node arb-bot")
.option("-k, --key <private-key>", "Private key of wallet that performs the transactions. Will override the 'BOT_WALLET_PRIVATEKEY' in env variables")
.option("-r, --rpc <url...>", "RPC URL(s) that will be provider for interacting with evm, use different providers if more than 1 is specified to prevent banning. Will override the 'RPC_URL' in env variables")
.option("-m, --mode <string>", "Running mode of the bot, must be one of: `0x` or `curve` or `router` or `srouter`, Will override the 'MODE' in env variables")
.option("-m, --mode <string>", "Running mode of the bot, must be one of: `0x` or `curve` or `router` or `crouter` or `srouter`, Will override the 'MODE' in env variables")
.option("-o, --orders <path>", "The path to a local json file containing the orders details, can be used in combination with --subgraph, Will override the 'ORDERS' in env variables")
.option("-s, --subgraph <url...>", "Subgraph URL(s) to read orders details from, can be used in combination with --orders, Will override the 'SUBGRAPH' in env variables")
.option("--orderbook-address <address>", "Address of the deployed orderbook contract, Will override the 'ORDERBOOK_ADDRESS' in env variables")
Expand Down
223 changes: 222 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,228 @@
"proxyAddress": "0xdef1c0ded9bec7f1a1670819833240f027b25eff"
},
"curve": {
"pools": []
"pools": [
{
"address": "0xDcEF968d416a41Cdac0ED8702fAC8128A64241A2",
"coins": [
{
"symbol": "FRAX",
"address": "0x853d955aCEf822Db058eb8505911ED77F175b99e",
"decimals": 18
},
{
"symbol": "USDC",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6
}
]
},
{
"address": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
"coins": [
{
"symbol": "DAI",
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"decimals": 18
},
{
"symbol": "USDC",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6
},
{
"symbol": "USDT",
"address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"decimals": 6
}
]
},
{
"address": "0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B",
"coins": [
{
"symbol": "FRAX",
"address": "0x853d955aCEf822Db058eb8505911ED77F175b99e",
"decimals": 18
},
{
"symbol": "3Crv",
"address": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
"decimals": 18
}
],
"underlyingCoins": [
{
"symbol": "FRAX",
"address": " ",
"decimals": 18
},
{
"symbol": "DAI",
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"decimals": 18
},
{
"symbol": "USDC",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6
},
{
"symbol": "USDT",
"address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"decimals": 6
}
]
},
{
"address": "0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA",
"coins": [
{
"symbol": "LUSD",
"address": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0",
"decimals": 18
},
{
"symbol": "3Crv",
"address": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
"decimals": 18
}
],
"underlyingCoins": [
{
"symbol": "LUSD",
"address": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0",
"decimals": 18
},
{
"symbol": "DAI",
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"decimals": 18
},
{
"symbol": "USDC",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6
},
{
"symbol": "USDT",
"address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"decimals": 6
}
]
},
{
"address": "0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c",
"coins": [
{
"symbol": "ALUSD",
"address": "0xbc6da0fe9ad5f3b0d58160288917aa56653660e9",
"decimals": 18
},
{
"symbol": "3Crv",
"address": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
"decimals": 18
}
],
"underlyingCoins": [
{
"symbol": "ALUSD",
"address": "0xbc6da0fe9ad5f3b0d58160288917aa56653660e9",
"decimals": 18
},
{
"symbol": "DAI",
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"decimals": 18
},
{
"symbol": "USDC",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6
},
{
"symbol": "USDT",
"address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"decimals": 6
}
]
},
{
"address": "0x5a6A4D54456819380173272A5E8E9B9904BdF41B",
"coins": [
{
"symbol": "MIM",
"address": "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3",
"decimals": 18
},
{
"symbol": "3Crv",
"address": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
"decimals": 18
}
],
"underlyingCoins": [
{
"symbol": "MIM",
"address": "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3",
"decimals": 18
},
{
"symbol": "DAI",
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"decimals": 18
},
{
"symbol": "USDC",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6
},
{
"symbol": "USDT",
"address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"decimals": 6
}
]
},
{
"address": "0x4f062658eaaf2c1ccf8c8e36d6824cdf41167956",
"coins": [
{
"symbol": "GUSD",
"address": "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd",
"decimals": 18
},
{
"symbol": "3Crv",
"address": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
"decimals": 18
}
],
"underlyingCoins": [
{
"symbol": "GUSD",
"address": "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd",
"decimals": 18
},
{
"symbol": "DAI",
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"decimals": 18
},
{
"symbol": "USDC",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6
},
{
"symbol": "USDT",
"address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"decimals": 6
}
]
}
]
},
"nativeToken": {
"symbol": "ETH",
Expand Down
Loading

0 comments on commit 95ee8f2

Please sign in to comment.