-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Store dynamic bytes to call swap function with solidity assembly #188
Comments
In order to pass a zero-length bytes value to the swap function of the UniswapV2 pair, you can simply store a single zero byte at memory location 0x64. This can be done using the mstore8 opcode, which stores a single byte at the specified memory location. Here's the modified assembly code with the mstore8 instruction to set the length of the data parameter to zero:
|
fallback() external payable { |
much appreciated, this works! |
Hi, I want to save gas with solidity inline assembly when calling UniswapV2 pair's swap function. Here is my code:
The parameters of swap function are:
I can store uint, and address variables in memory, but I want calldata_data be zero-length bytes, so what value should be stored from 0x64? Thanks!
The text was updated successfully, but these errors were encountered: