Skip to content

Instantly share code, notes, and snippets.

@Arachnid
Created November 4, 2016 15:08
Show Gist options
  • Save Arachnid/55840a95888f5bad95594158484be49c to your computer and use it in GitHub Desktop.
Save Arachnid/55840a95888f5bad95594158484be49c to your computer and use it in GitHub Desktop.
{u'calls': [{u'args': u'NfqkFg==',
u'calls': [{u'args': u'cKCCMQAAAAAAAAAAAAAAADridZOuPYpXXA1srVOnNvNhUseS',
u'calls': [],
u'error': None,
u'firststep': 232,
u'gas': 176091,
u'laststep': 399,
u'op': u'CALL',
u'return': u'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFGIMV93a4AAA=',
u'to': u'0xbb9bc244d798123fde783fcc1c72d3bb8c189413',
u'value': u'0'},
{u'args': u'qQWcuwAAAAAAAAAAAAAAAIs7O2JMPAOX09qP2GFRI5PVHcusAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFGIMV93a4AAA=',
u'calls': [],
u'error': None,
u'firststep': 478,
u'gas': 174892,
u'laststep': 1002,
u'op': u'CALL',
u'return': u'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE=',
u'to': u'0xbb9bc244d798123fde783fcc1c72d3bb8c189413',
u'value': u'0'}],
u'error': None,
u'firststep': 125,
u'gas': 201694,
u'laststep': 1047,
u'op': u'CALL',
u'return': u'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUYgxX3drgAAA==',
u'to': u'0x3ae27593ae3d8a575c0d6cad53a736f36152c792',
u'value': u'0'}],
u'firststep': 0,
u'laststep': 1097,
u'return': u'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE='}
{
"idx": 0,
"stack": [{"calls": [], "firststep": 0, "laststep": 0}],
"result": function() { return this.stack[0]; },
"step": function(log, db) {
var frame = this.stack[this.stack.length - 1];
if(log.err) {
frame["error"] = log.err;
} else if(log.depth == this.stack.length) {
switch(log.op.toString()) {
case "CALL":
case "CALLCODE":
var instart = log.stack.peek(3).Int64();
var insize = log.stack.peek(4).Int64();
this.stack.push({
"firststep": this.idx + 1,
"op": log.op.toString(),
"gas": log.stack.peek(0).Int64(),
"to": "0x" + log.stack.peek(1).Text(16),
"value": log.stack.peek(2).String(),
"args": log.memory.slice(instart, instart + insize),
"error": null,
"return": null,
"calls": []
});
frame["calls"].push(this.stack[this.stack.length - 1]);
break;
case "DELEGATECALL":
var instart = log.stack.peek(2).Int64();
var insize = log.stack.peek(3).Int64();
this.stack.push({
"firststep": this.idx + 1,
"op": log.op.toString(),
"gas": log.stack.peek(0).Int64(),
"to": "0x" + log.stack.peek(1).Text(16),
"args": log.memory.slice(instart, instart + insize),
"error": null,
"return": null,
"calls": []
});
frame["calls"].push(this.stack[this.stack.length - 1]);
break;
case "RETURN":
var out = log.stack.peek(0).Int64();
var outsize = log.stack.peek(1).Int64();
frame.return = log.memory.slice(out, out + outsize);
break;
case "STOP":
case "SUICIDE":
frame.return = log.memory.slice(0, 0);
break;
}
} else {
this.stack = this.stack.slice(0, log.depth);
}
this.stack[this.stack.length - 1].laststep = ++this.idx;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment