I'm trying to encode calldata using ethers.js for the following function:
function myFunction(uint8,uint8,uint256,uint256,uint256)
My code sample:
let iface = new ethers.utils.Interface([
"function myFunction(uint8,uint8,uint256,uint256,uint256)"
]);
let callData = iface.encodeFunctionData("myFunction", [
0,
1,
0,
0,
ethers.constants.MaxUint256,
]);
As a result, I get following calldata:
0xc4bc81b30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
I guess, it starts with function selector (8 bytes), then arguments (only uints) and it's possible to see that uint8-arguments take up the same amount of space as uint256-arguments (64 bytes). As a result, call with this calldata fails. How to encode it correctly?