hey guys, i'm trying to understand how to use the uniswap function swapExactTokensForTokens, but when i try to add to the path parameter i keep getting this error
Invalid type for argument in function call. Invalid implicit conversion from address[2] memory to address[] memory requested
googling it hasn't brought up any solution. how can i solve this?
parameter input is address[]
i'm passing in [token0, token1]
Mar 19, 2021, 2:39 AM
yea i get that, but how else would i be able to pass in to the path parameter without creating an array of n size?
i see. so you create a typed dynamic array but create it to size 2, then insert into the array by index
would this be the only way?
Mar 19, 2021, 2:45 AM
yes exactly
Mar 19, 2021, 2:46 AM
it feels much like a workaround rather than a proper solution, but i've not worked with solidity for too long
Mar 19, 2021, 2:46 AM
for memory arrays that is the only way
if it's for an array in the storage, then you could do path.push()
Mar 19, 2021, 2:47 AM
gotcha. thanks a lot!
Mar 19, 2021, 2:47 AM
sure =D 👍
Mar 19, 2021, 2:48 AM