We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I am trying to simulate a call to UniswapV2Router02.swapExactETHForTokens() (link)
That method returns a uint[], so I tried mocking that using: abi.rawEncode([ "uint[]" ], [ [1] ])
abi.rawEncode([ "uint[]" ], [ [1] ])
Here is the complete method mock definition:
await uniswapV2Router02.givenMethodReturn( uniswapEncorder.encodeRouterETHForTokens(), abi.rawEncode([ "uint[]" ], [ [1] ]) );
Is it possible to encode an array of values?
Thanks!
The text was updated successfully, but these errors were encountered:
Yes, this is possible. The way to do it should be:
const method = await mockedUniswap.contract.methods.swapExactETHForTokens(0, [], 0x00...00, 0).encodeABI(); const result = web3.eth.abi.encodeParameter("uint[]", [1,2,3]) await mock.givenMethonReturn(method, result)
Sorry, something went wrong.
It worked! Thanks @fleupold
No branches or pull requests
Hi, I am trying to simulate a call to UniswapV2Router02.swapExactETHForTokens() (link)
That method returns a uint[], so I tried mocking that using:
abi.rawEncode([ "uint[]" ], [ [1] ])
Here is the complete method mock definition:
Is it possible to encode an array of values?
Thanks!
The text was updated successfully, but these errors were encountered: