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.
- param uniswap
Uniswap deployment on a Ganache mainnet fork. Set up prior calling this function. See ganache.py and test_ganache.py for more details.
- param base_token
The token of which tax properties we are figuring out.
- param quote_token
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.
- param buy_account
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.
- param sell_account
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.
- param approve
Perform quote token approval before wap test
- Parameters
base_token_details (Optional[eth_defi.token.TokenDetails]) –
Pass base token details. If not given automatically fetch.
- param quote_token_details
Pass quote token details. If not given automatically fetch.
- param gas_limit
Use this gas limit for all transactions, so that we do not need to call eth_estimateGas on the node.
- param gas_price
Use this gas price for all transactions, so that we do not need to call eth_estimateGas on the node.
- return
ToxTaxInfo tells us what we figure out about taxes. This can be later recorded to a database.
uniswap (eth_defi.uniswap_v2.deployment.UniswapV2Deployment) –
base_token (eth_typing.evm.HexAddress) –
quote_token (eth_typing.evm.HexAddress) –
buy_account (eth_typing.evm.HexAddress) –
sell_account (eth_typing.evm.HexAddress) –
buy_amount (float) –
quote_token_details (Optional[eth_defi.token.TokenDetails]) –
- Return type