Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract WETH error in the bot executor contract #18

Open
xinming365 opened this issue Mar 5, 2024 · 2 comments
Open

Extract WETH error in the bot executor contract #18

xinming365 opened this issue Mar 5, 2024 · 2 comments

Comments

@xinming365
Copy link

Dear sir,

I deployed a bot-executr contract on Arbitrum using your code. Currently, I want to extract the balance of the weth, however, I encountered this error.

ValueError: Execution reverted during call: 'execution reverted: WETH BALANCE REDUCTION'. This transaction will likely revert. If you wish to broadcast, include allow_revert:True as a transaction parameter.

Here is the traction parameters:

tx_params = { "from": bot_account.address, # "from": executor_contract.address, "chainId": brownie.chain.id, "gas": TX_GAS_LIMIT, "nonce": bot_account.nonce, "maxPriorityFeePerGas":0, "value":0, }
Here is the payloads:

TX_GAS_LIMIT= 250_000_000
withdrawal_amount = int(0.2*10**18)
TOKEN_CONTRACT_ADDRESS = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" # WETH address
payload_signature = brownie.web3.keccak(text="transfer(address,uint256)")

payload_data = eth_abi.encode_abi(
    ["address", "uint256"],
    [bot_account.address, withdrawal_amount])
payload = payload_signature[:4] + payload_data
# Get the hex value of the payload
payload_hex = '0x' + payload.hex()
# Submit the transaction, with the appropriate token to withdraw
tx = executor_contract.execute_payloads(
    [(TOKEN_CONTRACT_ADDRESS, payload_hex, 0)],
    tx_params
)`

I used brownie and connect the arb-chain network. I could not find the failure reason.

@salparadi
Copy link

salparadi commented Mar 5, 2024

Try passing balance_check = false with your execute_payloads call. I think the latest version of the executor has that True by default

@external
@payable
def execute_payloads(
    payloads: DynArray[payload, MAX_PAYLOADS],
    balance_check: bool = True,
    bribe_bips: uint256 = 0
):

@xinming365
Copy link
Author

xinming365 commented Mar 6, 2024

Thanks for your advice. I did not found that the execute_payloads function has a parameter of balance_check in the newer version, that's my fault. After modifying the old ABI, and add the balance_check parameter, I succeed. Thank you very much.

`

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants