erc20智能合约常见方法对应的签名编码:
常见例如:transfer(address,uint256)
编码为:web3.sha3("transfer(address,uint256)").substring(0,10) -> "0xa9059cbb"
balanceOf(address)
编码为:web3.sha3("balanceOf(address)").substring(0,10) -> "0x70a08231"
transfer(address,uint256): 0xa9059cbb
balanceOf(address):0x70a08231
decimals():0x313ce567
allowance(address,address): 0xdd62ed3e
symbol():0x95d89b41
totalSupply():0x18160ddd
name():0x06fdde03
approve(address,uint256):0x095ea7b3
transferFrom(address,address,uint256): 0x23b872dd
参考:
https://www.bokconsulting.com.au/blog/assessing-the-erc20-token-exchange-withdrawal-bug-exploit/