Here are:
And here are:
As you can see, I call the swap method of the smart contract with a value of 1 BNB. This method:
- receives 1 BNB.
- deposits the 1 BNB into the WBNB contract. At this moment, 1 WBNB lies in the proxy.
- withdraws the 1 WBNB. At this moment, 1 BNB lies in the proxy.
- sends the 1 BNB back to the user.
The transaction seems to fail at the end of step 3.
Moreover, if I directly call the implementation contract, it works.
So the issue seems to be coming specifically from the proxy. But after many hours of debugging, I have no idea why this fails… can someone please help?
Inside the
withdraw
function of WBNB contract, it usestransfer
to send BNB. Withtransfer
, there is a fixed gas limit of 2300 gas, which is enough to complete the transfer operation, normally.But when you call it behind a proxy, the proxy must perform an extra
SLOAD
operation to fetch the implementation address. TheSLOAD
has an increased price since EIP1884, making the total price exceeds 2300, causing the transaction to fail.