0

I deployed this contract.

https://github.com/flashbots/simple-arbitrage/blob/master/contracts/BundleExecutor.sol

And I transferred WETH to this contract.

How can I withdraw the WETH from this contract?

In the first place, was it not necessary to send WETH to this contract?

1
  • i have same problem to retire from my contract to my wallet. my contract do not have call funcion. can you help my to compiler call funcion to tranfer my found to my acount. sorry for my bad english. thank you for your helpme Commented Jun 1, 2023 at 4:03

1 Answer 1

0

You need to keep WETH in the contract I believe to make the swaps.

To withdraw, you can call the call(_to, _value, _data) function with:

  • _to = WETH_ADDRESS
  • _value = 0
  • _data:
_data = ethers.utils.hexConcat([
    '0xa9059cbb',  // selector of transfer(address,uint256)
    ethers.utils.defaultAbiCoder.encode(
        ['address', 'uint256'],
        [MY_ADDRESS, WETH_AMOUNT_IN_WEI]
    )
])

with MY_ADDRESS your wallet address, and WETH_AMOUNT_IN_WEI the amount in the contract you want to withdraw.

Basically with this method your contract will call WETH to make a transfer to your wallet.

1
  • 1
    Thanks very much! I successfully withdrew it! Commented Nov 5, 2022 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.