Skip to content

Commit

Permalink
Merge pull request #19 from rainprotocol/2023-05-16-vault-balance-han…
Browse files Browse the repository at this point in the history
…dling [minor]

vault balances handling [minor]
  • Loading branch information
rouzwelt authored May 16, 2023
2 parents 77faaad + ca2145b commit e8c3a4b
Show file tree
Hide file tree
Showing 11 changed files with 2,389 additions and 463 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16
ADD . .
RUN npm install
CMD while true; do node arb-bot -k "${BOT_WALLET_PRIVATEKEY}" -r "${RPC_URL}" --orderbook-address "${ORDERBOOK_ADDRESS}" --arb-address "${ARB_ADDRESS}" | tee -a logs.txt && sleep 30; done;
CMD while true; do node arb-bot -k "${BOT_WALLET_PRIVATEKEY}" -r "${RPC_URL}" --orderbook-address "${ORDERBOOK_ADDRESS}" --arb-address "${ARB_ADDRESS}" | tee -a logs.txt && sleep 10; done;
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Other optional arguments are:
- `--subgraph-url` A custom subgraph endpoint URL, used to read order details from, the default is Rain Orderbook Subgraph. The custom subgraph should follow the Rain Orderbook Subgraph schema.
- `--interpreter-abi` The path to IInterpreter ABI json file used for instantiating ethers contract instances, should be absolute path, default is the `./src/abis/IInerpreterV1.json`.
- `--arb-abi` The path to Arb (ZeroExOrderBookFlashBorrower) ABI json file used for instantiating ethers contract instances, should be absolute path, default is the `./src/abis/ZeroExOrderBookFlashBorrower.json`.
- `--orderbook-abi` The path to Orderbook ABI json file used for instantiating ethers contract instances, should be absolute path, default is the `./src/abis/OrderBook.json`.
- `--no-monthly-ratelimit` Used to respect monthly 200k 0x API calls, mainly used when not running this app on a bash loop, e.g. Github Actions
- `-h` or `--help` To show the CLI command's help
- `-v` or `--version` To show the app's version
Expand All @@ -61,6 +62,7 @@ which will show:
--arb-address <address> Address of the deployed arb contract. Will override 'arbAddress' field in './config.json' file
--interpreter-abi <path> Path to the IInterpreter contract ABI, default is the ABI in the './stc/abis' folder
--arb-abi <path> Path to the Arb (ZeroExOrderBookFlashBorrower) contract ABI, default is the ABI in the './stc/abis' folder
--orderbook-abi <path> Path to the Orderbook contract ABI, should be absolute path, default is the ABI in the './src/abis' folder
--no-monthly-ratelimit Pass to make the app respect 200k 0x API calls per month rate limit, mainly used when not running this app on a bash loop
-V, --version output the version number
-h, --help output usage information
Expand Down Expand Up @@ -110,7 +112,7 @@ const wallet = new ethers.Wallet(walletPrivateKey, provider)
const queryResult = await arb.query(subgraphUrl);

// to get the configuration object
const config = await arb.getConfig(wallet, orderbookAddress, arbAddress, ...[ arbAbiPath, interpreterAbiPath ]);
const config = await arb.getConfig(wallet, orderbookAddress, arbAddress, ...[ arbAbiPath, interpreterAbiPath, orderbookAbiPath ]);

// to run the clearing process and get the report object which holds the report of cleared orders
const reports = await arb.clear(wallet, config, queryResult, ...[ slippage, prioritization ])
Expand Down
2 changes: 2 additions & 0 deletions arb-bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const getOptions = async argv => {
.option("--arb-address <address>", "Address of the deployed arb contract. Will override 'arbAddress' field in './config.json' file")
.option("--interpreter-abi <path>", "Path to the IInterpreter contract ABI, should be absolute path, default is the ABI in the './src/abis' folder")
.option("--arb-abi <path>", "Path to the Arb (ZeroExOrderBookFlashBorrower) contract ABI, should be absolute path, default is the ABI in the './src/abis' folder")
.option("--orderbook-abi <path>", "Path to the Orderbook contract ABI, should be absolute path, default is the ABI in the './src/abis' folder")
.option("--no-monthly-ratelimit", "Pass to make the app respect 200k 0x API calls per month rate limit, mainly used when not running this app on a bash loop")
.version(version)
.parse(argv)
Expand Down Expand Up @@ -77,6 +78,7 @@ const main = async argv => {

if (options.interpreterAbi) config.interpreterAbi = options.interpreterAbi;
if (options.arbAbi) config.arbAbi = options.arbAbi;
if (options.orderbookAbi) config.orderbookAbi = options.orderbookAbi;

const reports = await clear(
signer,
Expand Down
49 changes: 36 additions & 13 deletions docs/html/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ <h5>Parameters:</h5>
<td class="type">


<span class="param-type">number</span>
<span class="param-type">string</span>



Expand Down Expand Up @@ -572,7 +572,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line274">line 274</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line278">line 278</a>
</li></ul></dd>


Expand Down Expand Up @@ -808,7 +808,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line144">line 144</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line145">line 145</a>
</li></ul></dd>


Expand Down Expand Up @@ -1240,7 +1240,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line192">line 192</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line193">line 193</a>
</li></ul></dd>


Expand Down Expand Up @@ -1286,7 +1286,7 @@ <h5>Returns:</h5>



<h4 class="name" id="getConfig"><span class="type-signature"></span>getConfig<span class="signature">(wallet, orderbookAddress, arbAddress, interpreterAbiPath, arbAbiPath)</span><span class="type-signature"></span></h4>
<h4 class="name" id="getConfig"><span class="type-signature"></span>getConfig<span class="signature">(wallet, orderbookAddress, arbAddress, arbAbiPath, interpreterAbiPath, orderbookAbiPath)</span><span class="type-signature"></span></h4>



Expand Down Expand Up @@ -1397,6 +1397,29 @@ <h5>Parameters:</h5>



<tr>

<td class="name"><code>arbAbiPath</code></td>


<td class="type">


<span class="param-type">string</span>



</td>





<td class="description last">(optional) The path to Arb contract ABI, default is ABI in './src/abis' folder</td>
</tr>



<tr>

<td class="name"><code>interpreterAbiPath</code></td>
Expand All @@ -1422,7 +1445,7 @@ <h5>Parameters:</h5>

<tr>

<td class="name"><code>arbAbiPath</code></td>
<td class="name"><code>orderbookAbiPath</code></td>


<td class="type">
Expand All @@ -1438,7 +1461,7 @@ <h5>Parameters:</h5>



<td class="description last">(optional) The path to Arb contract ABI, default is ABI in './src/abis' folder</td>
<td class="description last">(optional) The path to Orderbook contract ABI, default is ABI in './src/abis' folder</td>
</tr>


Expand Down Expand Up @@ -1479,7 +1502,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line246">line 246</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line248">line 248</a>
</li></ul></dd>


Expand Down Expand Up @@ -1649,7 +1672,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line168">line 168</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line169">line 169</a>
</li></ul></dd>


Expand Down Expand Up @@ -2042,7 +2065,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line31">line 31</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line32">line 32</a>
</li></ul></dd>


Expand Down Expand Up @@ -2504,7 +2527,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line73">line 73</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line74">line 74</a>
</li></ul></dd>


Expand Down Expand Up @@ -2641,7 +2664,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line223">line 223</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line224">line 224</a>
</li></ul></dd>


Expand Down Expand Up @@ -3005,7 +3028,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed May 10 2023 22:38:46 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Tue May 16 2023 22:18:36 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed May 10 2023 22:38:46 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Tue May 16 2023 22:18:36 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
Loading

0 comments on commit e8c3a4b

Please sign in to comment.