Solidity の abi.encode, abi.encodeXXX がよくわからなくなる
keccak256() には abi.encodePacked() を、adress.call() には abi.encodeWithSignature() を基本的には使う。
abi.encode(...) returns (bytes): ABI-encodes the given arguments
与えられた引数の型情報を意識して pad されてから連結した bytes を返却する
abi.encodePacked(...) returns (bytes): Performes packed encoding of the given arguments
もっともシンプルな動作。型情報を意識せず pad しないで連結する。
abi.encodeWithSelector(bytes4 selector, ...) returns (bytes): ABI-encodes the given arguments starting from the second and prepends the given four-byte selector
abi.encodeWithSignature(string signature, ...) returns (bytes): Equivalent to abi.encodeWithSelector(bytes4(keccak256(signature), ...)
x.call(bytes4(keccak256("f(uint256)"), a, b) と x.call(abi.encodeWithSignature("f(uint256)", a, b)) は同じで、その便利関数という感じ。
address.call(payload) に payload として渡すのはコレと覚えておくと良さそう
この signature は関数のシグネチャ。ボケーっとしてるとなんで署名が必要なんだっけ…?となる