Skip to content

Commit

Permalink
fix: correct buy amount
Browse files Browse the repository at this point in the history
  • Loading branch information
gosuto-inzasheru committed Nov 18, 2023
1 parent 02a6559 commit 113ea4d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ async def get_cow_quote(sell_token_address, sell_mantissa, buy_token_address):
r = requests.post(cow_url, json=data)
r.raise_for_status()
quote = r.json()["quote"]
buy_amount = quote["buyAmount"]
sell_amount = quote["sellAmount"]
fee_amount = quote["feeAmount"]
fee_factor = int(fee_amount) / int(sell_amount) + 1
return str(int(int(sell_amount) * fee_factor))
return str(int(int(buy_amount) * fee_factor))

fusion = await get_fusion_quote(
sell_token_address, sell_mantissa, buy_token_address
Expand Down

0 comments on commit 113ea4d

Please sign in to comment.