From 173402244998d8a76cb3010d6af1f2a590ad2cf3 Mon Sep 17 00:00:00 2001 From: Lesigh-3100 Date: Fri, 29 Sep 2023 11:48:46 +0300 Subject: [PATCH] Fixed an issue in which bancor POL balances were not updated correctly --- fastlane_bot/data/tokens.csv | 4 ++++ fastlane_bot/events/multicall_utils.py | 2 +- fastlane_bot/events/pools/bancor_pol.py | 9 ++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/fastlane_bot/data/tokens.csv b/fastlane_bot/data/tokens.csv index 648e11495..b38cc9351 100644 --- a/fastlane_bot/data/tokens.csv +++ b/fastlane_bot/data/tokens.csv @@ -4178,3 +4178,7 @@ 4176,AURA-16bE,AURA,AURA,0x6047e101aaa9Ab9b02fe5Cbc1DD03c2C7C8516bE,18 4177,REMIO-Fdbc,REMIO,REMIO,0xa35Bd2246978Dfbb1980DFf8Ff0f5834335dFdbc,18 4178,RNB-e743,RNB,RNB,0x2A039B1D9bBDccBb91be28691b730ca893e5e743,18 +4179,IOST-883b,IOST,IOST,0xf063Dc5160721A3c35A9A853a4498FFF32e9883b,18 +4180,KOPE-52e5,KOPE,KOPE,0x15B479Fd41749d5e4aD7EE06F55c7360e54052e5,18 +4181,NEAR-f6a4,NEAR,NEAR,0x85F17Cf997934a597031b2E18a9aB6ebD4B9f6a4,24 +4182,BENT-C375,BENT,BENT,0x01597E397605Bf280674Bf292623460b4204C375,18 diff --git a/fastlane_bot/events/multicall_utils.py b/fastlane_bot/events/multicall_utils.py index 5ab6bef9d..a864ce272 100644 --- a/fastlane_bot/events/multicall_utils.py +++ b/fastlane_bot/events/multicall_utils.py @@ -273,7 +273,7 @@ def _extract_pol_params_for_multicall(result: Any, pool_info: Dict, mgr: Any) -> mgr.web3.eth.contract(abi=ERC20_ABI, address=tkn0_address)) if tkn0_address not in mgr.token_contracts: mgr.token_contracts[tkn0_address] = tkn_contract - tkn_balance = tkn_contract.functions.balanceOf(tkn0_address).call() + tkn_balance = tkn_contract.functions.balanceOf(mgr.cfg.BANCOR_POL_ADDRESS).call() result = { "fee": "0.000", "fee_float": 0.000, diff --git a/fastlane_bot/events/pools/bancor_pol.py b/fastlane_bot/events/pools/bancor_pol.py index 0d6f32886..3da6e4806 100644 --- a/fastlane_bot/events/pools/bancor_pol.py +++ b/fastlane_bot/events/pools/bancor_pol.py @@ -70,9 +70,12 @@ def update_from_event( if event_args["args"]["token"] == self.state["tkn0_address"] and event_type in [ "TokenTraded" ]: - data["tkn0_balance"] = ( - self.state["tkn0_balance"] - event_args["args"]["amount"] - ) + # *** Balance now updated from multicall *** + pass + # if self.state['last_updated_block'] < event_args['blockNumber']: + # data["y_0"] = ( + # self.state["y_0"] - event_args["args"]["amount"] + # ) for key, value in data.items(): self.state[key] = value