-
Notifications
You must be signed in to change notification settings - Fork 18
Description
the abi data returned from the function is
0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000b33078656431633862366238623036316662623031333936323830623834316438666331653034366632312c302c50616e63616b65204c50732c3078356231663837346430623063356565313761343935636262373061623862663634313037613362642c3078653965376365613364656463613539383437383062616663353939626436396164643038376435362c42696e617279582c424e582c31382c4255534420546f6b656e2c425553442c31382c32350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b83078326338633834336632386235313738633638346430386134386662623331373161326337356433312c302c50616e63616b65204c50732c3078613032366164326365646131366361356663323866643363373266393965326333333263386132362c3078626234636462396362643336623031626431636261656266326465303864393137336263303935632c5843414420546f6b656e2c584341442c31382c5772617070656420424e422c57424e422c31382c32350000000000000000
the function is
getPoolInfoBatch(address[],uint8[])
returns
string[]
the correct decoded result using python
[
"0xed1c8b6b8b061fbb01396280b841d8fc1e046f21,0,Pancake LPs,0x5b1f874d0b0c5ee17a495cbb70ab8bf64107a3bd,0xe9e7cea3dedca5984780bafc599bd69add087d56,BinaryX,BNX,18,BUSD Token,BUSD,18,25",
"0x2c8c43f28b5178c684d08a48fbb3171a2c75d31,0,Pancake LPs,0xa026ad2ceda16ca5fc28fd3c72f99e2c332c8a26,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,XCAD Token,XCAD,18,Wrapped BNB,WBNB,18,25"
]
the decode result from libethc
decoded[0]: 0xed1c8b6b8b061fbb01396280b841d8fc1e046f21,0,Pancake LPs,0x5b1f874d0b0c5ee17a495cbb70ab8bf64107a3bd,0xe9e7cea3dedca5984780bafc599bd69add087d56,BinaryX,BNX,18,BUSD Token,BUSD,18,25
decoded[1]: 71a2c75d31,0,Pancake LPs,0xa026ad2ceda16ca5fc28fd3c72f99e2c332c8a26,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,XCAD Token,XCAD,18,Wrapped BNB,WBNB,18,25�Z��!
` ��[
the problem is on the second element.
the code i use is
std::string decoded1,decoded2;
uint64_t arrlen;
eth_abi_array(&abi, &arrlen); // array beign
uint8_t *val0,*val1;
size_t len;
eth_abi_bytes(&abi, &val0, &len);
char *final = (char *)val;
string decoded;
for (int i = 0; i < len; i++)
{
decoded += final[i];
}
eth_abi_bytes(&abi, &val1, &len);
char *final = (char *)val;
string decoded;
for (int i = 0; i < len; i++)
{
decoded += final[i];
}
eth_abi_array_end(&abi);
please help