Calldata
when submitting a transaction, the calldata is structured like so: the first 4 bytes contain the function signature and for each function argument you get 32 bytes padded with zeroes. In your example:
0x8f2b7a67000000000000000000000000a19a81a38bf2238a695629fa7b4a909a2390ddb40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000052fea3caafaaf3f95ec536b30714bff78dbac5b000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000013247aacf600000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000c17b109e146934d36c33e55fade9cbda791b03660000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c17b109e146934d36c33e55fade9cbda791b03660000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270
0x8f2b7a67
is the function signature and it's followed by 13 arguments (each struct key or array element counts as an argument)
000000000000000000000000a19a81a38bf2238a695629fa7b4a909a2390ddb4
(probably an address)
0000000000000000000000000000000000000000000000000000000000000000
(0)
000000000000000000000000052fea3caafaaf3f95ec536b30714bff78dbac5b
(looks like an address)
0000000000000000000000000000000000000000000000000000000000000001
(1)
00000000000000000000000000000000000000000000000000000000000000e0
(224)
0000000000000000000000000000000000000000000000000000000000000140
(320)
00000000000000000000000000000000000000000000000013247aacf6000000
(1379362269162373120)
0000000000000000000000000000000000000000000000000000000000000002
(2)
0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270
(another address)
000000000000000000000000c17b109e146934d36c33e55fade9cbda791b0366
(address again)
0000000000000000000000000000000000000000000000000000000000000002
(2)
000000000000000000000000c17b109e146934d36c33e55fade9cbda791b0366
(same address)
0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270
(and an address again)
Calldata in solidity is pretty cheap: 4 gas per 0x00
byte and 16 gas per byte with a non-zero value.
Tight-Packing
You could tight-pack these arguments together (see Tight Packing) but you would have to
- Find smaller types for each argument that will be consistent with their maximum value. For example for your argument #4 (1) maybe it's a
uint8
(max 255), or a uint16
(max 65535), ...
- Change your method so that it accepts packed
uint256
or bytes32
variables
- Extract each variable through bitwise operations
It's very likely that doing this will result in a higher gas cost.
If you post your function params and the code you use to call that function, I can propose some code implementing this solution
abi.encodePacked(var1,var2,etc.)