estimate_token_taxes

Documentation for eth_defi.uniswap_v2.token_tax.estimate_token_taxes function.

estimate_token_taxes(uniswap, base_token, quote_token, buy_account, sell_account, buy_amount, approve=True, quote_token_details=None, base_token_details=None, gas_limit=None, gas_price=None)[source]

Estimates different token taxes for a token by running Ganache simulations for it.

Parameters
  • uniswap (eth_defi.uniswap_v2.deployment.UniswapV2Deployment) – Uniswap deployment on a Ganache mainnet fork. Set up prior calling this function. See ganache.py and test_ganache.py for more details.

  • base_token (eth_typing.evm.HexAddress) – The token of which tax properties we are figuring out.

  • quote_token (eth_typing.evm.HexAddress) – Address of the quote token used for the trading pair. E.g. BUDS, WBNB Based on this information we can derive Uniswap trading pair address.

  • buy_account (eth_typing.evm.HexAddress) – The account that does initial buy to measure the buy tax. This account must be loaded with gas money (ETH/BNB) and quote_token for a purchase.

  • sell_account (eth_typing.evm.HexAddress) – The account that receives the token transfer and does the sell to measure the sell tax. This account must be loaded with gas money for the sell.

  • approve – Perform quote token approval before wap test

  • base_token_details (Optional[eth_defi.token.TokenDetails]) – Pass base token details. If not given automatically fetch.

  • quote_token_details (Optional[eth_defi.token.TokenDetails]) – Pass quote token details. If not given automatically fetch.

  • gas_limit (Optional[int]) – Use this gas limit for all transactions, so that we do not need to call eth_estimateGas on the node.

  • gas_price (Optional[int]) – Use this gas price for all transactions, so that we do not need to call eth_estimateGas on the node.

  • buy_amount (float) –

Returns

ToxTaxInfo tells us what we figure out about taxes. This can be later recorded to a database.

Return type

eth_defi.uniswap_v2.token_tax.TokenTaxInfo