Skip to content

Commit

Permalink
Fix NB Test 033, Add test 050
Browse files Browse the repository at this point in the history
Adjusted dummy data and modified Bancor V2 test for Test 033
Added test 050 - it uses a new dummy data file to search for an arb with a Bancor V2 pool, then ensures that the route struct includes the Bancor V2 pool Anchor in the customAddress field
  • Loading branch information
Lesigh-3100 committed Aug 28, 2023
1 parent 6623f02 commit 5a21bb4
Show file tree
Hide file tree
Showing 4 changed files with 358 additions and 20 deletions.
8 changes: 4 additions & 4 deletions fastlane_bot/data/event_test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@
},
"bancor_v2_event": {
"args": {
"_token1": "0xB2607CB158bc222DD687e4D794c607B5ce983Ce2",
"_token2": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"_rateN": 701296523896722535,
"_rateD": 124447579392500555356},
"_token1": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"_token2": "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C",
"_rateN": 5698079648237338312679700,
"_rateD": 1404376232459809237924},
"event": "TokenRateUpdate",
"logIndex": 106,
"transactionIndex": 22,
Expand Down

Large diffs are not rendered by default.

60 changes: 44 additions & 16 deletions resources/NBTest/NBTest_033_Pools.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,32 +96,35 @@
},
{
"cell_type": "markdown",
"source": [
"## test_bancor_v2_pool"
],
"id": "5e07f1229048cd9c",
"metadata": {
"collapsed": false
},
"id": "5e07f1229048cd9c"
"source": [
"## test_bancor_v2_pool"
]
},
{
"cell_type": "code",
"execution_count": 4,
"outputs": [],
"source": [
"bancor_v2_pool = BancorV2Pool()\n",
"bancor_v2_pool.update_from_event(setup_data['bancor_v2_event'], {'cid': '0x', 'fee': '0.000', 'fee_float': 0.0, 'exchange_name': 'bancor_v2'})\n",
"assert (bancor_v2_pool.state['tkn0_balance'] == setup_data['bancor_v2_event']['args']['_rateN'])\n",
"assert (bancor_v2_pool.state['tkn1_balance'] == setup_data['bancor_v2_event']['args']['_rateD'])"
],
"id": "4dfe57c17c271eec",
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-08-27T13:30:38.982584Z",
"start_time": "2023-08-27T13:30:38.975758Z"
}
},
"collapsed": false
},
"id": "4dfe57c17c271eec"
"outputs": [],
"source": [
"bancor_v2_pool = BancorV2Pool()\n",
"bancor_v2_pool.state['tkn0_address'] = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'\n",
"bancor_v2_pool.state['tkn1_address'] = '0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C'\n",
"bancor_v2_pool.state['anchor']= '0xb1CD6e4153B2a390Cf00A6556b0fC1458C4A5533'\n",
"bancor_v2_pool.update_from_event(setup_data['bancor_v2_event'], {'cid': '0x', 'fee': '0.000', 'fee_float': 0.0, 'exchange_name': 'bancor_v2'})\n",
"assert (bancor_v2_pool.state['tkn0_balance'] == setup_data['bancor_v2_event']['args']['_rateN']), f\"expected {bancor_v2_pool.state['tkn0_balance']}, found {setup_data['bancor_v2_event']['args']['_rateN']}\"\n",
"assert (bancor_v2_pool.state['tkn1_balance'] == setup_data['bancor_v2_event']['args']['_rateD']), f\"expected {bancor_v2_pool.state['tkn1_balance']}, found {setup_data['bancor_v2_event']['args']['_rateD']}\""
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -195,7 +198,16 @@
"outputs": [
{
"data": {
"text/plain": "{'cid': '0x',\n 'fee': '0.000',\n 'fee_float': 0.0,\n 'exchange_name': 'bancor_v3',\n 'tkn0_balance': 2981332708522538339515032,\n 'tkn1_balance': 2981332708522538339515032,\n 'tkn0_symbol': 'tkn0',\n 'tkn1_symbol': 'tkn1'}"
"text/plain": [
"{'cid': '0x',\n",
" 'fee': '0.000',\n",
" 'fee_float': 0.0,\n",
" 'exchange_name': 'bancor_v3',\n",
" 'tkn0_balance': 2981332708522538339515032,\n",
" 'tkn1_balance': 2981332708522538339515032,\n",
" 'tkn0_symbol': 'tkn0',\n",
" 'tkn1_symbol': 'tkn1'}"
]
},
"execution_count": 7,
"metadata": {},
Expand Down Expand Up @@ -288,6 +300,22 @@
"assert (carbon_v1_pool.state['z_1'] == 0)\n",
"assert (carbon_v1_pool.state['A_1'] == 0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fb389643",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "afb5a056",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -309,7 +337,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
"version": "3.10.1"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 5a21bb4

Please sign in to comment.