I'm passing some arguments to a function and abi.encode()-ing them. Then I pass this data to another function where I abi.decode() it, but Im not entirely sure how to do it:
Arguments I'm encoding:
uint256 quantity
uint8 addresses_array_length
address[] addresses_array
address[] addresses_array2
// addresses_array2.length = addresses_array.length - 1, always
I then pass this data and I'd like to decode it in exactly the same format (i.e. uint256, uint8, address[] and address[]).
How should I do this?
From what I read I should do something like:
assembly { //is it necessary to do all this within this assembly struct?
quantity := mload(add(data, 32))
addresses_array_length := mload(add(data, 1))
// Now how should I do for the arrays?
}
Thanks
addresses_array_length, but still not sure how to continue. – Hiperfly Jun 10 '21 at 07:56abi.decodeisn t used for variable length array but is instead used as arguments for functions in someone s else implementation? https://ethereum.stackexchange.com/q/159866 – user2284570 Feb 16 '24 at 11:39