If I only have the raw input data of a contract call, what would be the best way to decode it into readable form within Solidity?
"[INPUT]":"0x70a08231000000000000000000000000278261c4545d65a81ec449945e83a236666b64f5"
"[OUTPUT]":"0x0000000000000000000000000000000000000000000000000000000000000000"
"gas":{
"gas_left":5052320
"gas_used":4814
"total_gas_used":4096237
}
I'm doing this but I get a weird number which I don't think it's the right answer:
bytes memory data = '0x70a08231000000000000000000000000278261c4545d65a81ec449945e83a236666b64f5';
(uint num) = abi.decode(data, (uint256));
console.log(num);
// 21923419280131834915887268958100430612526877572263439172946489084502927749168
If I change data
to the following, I get:
hex'70a08231000000000000000000000000278261c4545d65a81ec449945e83a236666b64f5'
//50942633119752846454219349998365661925661254240480086959931673327308193899062
Thanks!