Skip to content

Instantly share code, notes, and snippets.

@tinybike
Created December 4, 2017 00:09
Show Gist options
  • Save tinybike/ca5f1bdebea54806a3bbd37d15e1f996 to your computer and use it in GitHub Desktop.
Save tinybike/ca5f1bdebea54806a3bbd37d15e1f996 to your computer and use it in GitHub Desktop.
var speedomatic = require("speedomatic");
var abiInputs = [
{ name: '_endTime', type: 'uint256' },
{ name: '_feePerEthInWei', type: 'uint256' },
{ name: '_denominationToken', type: 'address' },
{ name: '_designatedReporterAddress', type: 'address' },
{ name: '_topic', type: 'bytes32' },
{ name: '_description', type: 'string' },
{ name: '_extraInfo', type: 'string' }
];
var abiEncodedData = "0x000000000000000000000000000000000000000000000000000000005c2b1e0000000000000000000000000000000000000000000000000000000000081234560000000000000000000000001fad5280b1797880ea0fe13dcb0539e515eae1fa000000000000000000000000c5ed899b0878656feb06467e2e9ede3ae73cbcb7737061636500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000006857696c6c20537061636558207375636365737366756c6c7920636f6d706c6574652061206d616e6e656420666c6967687420746f2074686520496e7465726e6174696f6e616c2053706163652053746174696f6e2062792074686520656e64206f6620323031383f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002287b227265736f6c7574696f6e536f75726365223a22687474703a2f2f7777772e7370616365782e636f6d222c2274616773223a5b22537061636558222c227370616365666c69676874225d2c226c6f6e674465736372697074696f6e223a2253706163655820686974206120626967206d696c6573746f6e65206f6e204672696461792077697468204e41534120636f6e6669726d696e67206f6e2046726964617920746861742074686520456c6f6e204d75736b2d6c656420737061636520636172676f20627573696e6573732077696c6c206c61756e636820617374726f6e6175747320746f2074686520496e7465726e6174696f6e616c2053706163652053746174696f6e20627920323031372e5c6e5c6e4c61737420796561722c20746865207370616365206167656e63792074656e7461746976656c79206177617264656420612024322e362062696c6c696f6e20636f6e747261637420746f2053706163655820746f206361727279206372657720746f2073706163652e204e415341e280997320616e6e6f756e63656d656e74206f6e2046726964617920666f726d616c697a657320746865206465616c2c20776869636820696e766f6c76657320537061636558206c6f6164696e6720697473204372657720447261676f6e2073706163656372616674207769746820617374726f6e6175747320616e642073656e64696e67207468656d206265796f6e64207468652073747261746f7370686572652e227d000000000000000000000000000000000000000000000000";
speedomatic.abiDecodeData(abiInputs, abiEncodedData);
// output:
[ '1546329600',
'135410774',
'0x1fad5280b1797880ea0fe13dcb0539e515eae1fa',
'0xc5ed899b0878656feb06467e2e9ede3ae73cbcb7',
'0x7370616365000000000000000000000000000000000000000000000000000000',
'Will SpaceX successfully complete a manned flight to the International Space Station by the end of 2018?',
'{"resolutionSource":"http://www.spacex.com","tags":["SpaceX","spaceflight"],"longDescription":"SpaceX hit a big milestone on Friday with NASA confirming on Friday that the Elon Musk-led space cargo business will launch astronauts to the International Space Station by 2017.\\n\\nLast year, the space agency tentatively awarded a $2.6 billion contract to SpaceX to carry crew to space. NASA’s announcement on Friday formalizes the deal, which involves SpaceX loading its Crew Dragon spacecraft with astronauts and sending them beyond the stratosphere."}' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment