From b9dda84e30d634aea056483a13c273162e2301fa Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Fri, 13 Jul 2018 12:53:42 -0400 Subject: [PATCH] writing internals correctly --- eth/tracers/tracer.go | 15 ++++++++++++++- .../web3/transfer-through-master/test/test.js | 8 +++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/eth/tracers/tracer.go b/eth/tracers/tracer.go index 225021c204..27d016a086 100644 --- a/eth/tracers/tracer.go +++ b/eth/tracers/tracer.go @@ -32,6 +32,7 @@ import ( "github.com/ethereum/go-ethereum/log" "gopkg.in/olebedev/go-duktape.v3" "database/sql" + "reflect" ) // bigIntegerJS is the minified version of https://github.com/peterolson/BigInteger.js. @@ -595,6 +596,12 @@ func (i *Internals) SWriteInteralTxs(hash common.Hash) { if err != nil { return } + fmt.Println("[VALUE]", reflect.TypeOf(i.Value)) + test := "0x3782dace9d900000" + if test == i.Value { + fmt.Println("[EQUAL]: ", test, i.Value) + } + gas, _ := hexutil.DecodeUint64(i.Gas) gasUsed, _ := hexutil.DecodeUint64(i.GasUsed) @@ -609,6 +616,11 @@ func (i *Internals) SWriteInteralTxs(hash common.Hash) { } func (i *Internals) InternalRecursive(hash common.Hash) { + amount, _ := hexutil.DecodeUint64(i.Value) + if i.Type != "CREATE" { + fmt.Println("[INSIDE RECURSIVE VALUE]", amount) + fmt.Printf("%+v", i) + } i.SWriteInteralTxs(hash) lengthOfCalls := len(i.Calls) if lengthOfCalls == 0 { @@ -713,7 +725,8 @@ func (jst *Tracer) SGetResult(hash common.Hash) (json.RawMessage, error) { if err := json.Unmarshal(result, &dat); err != nil { panic(err) } - fmt.Println("[THIS IS HASH]", hash.Hex()) + //fmt.Println("[THIS IS HASH]", hash.Hex()) + //fmt.Println("DAT DATA STRUCTURE" , dat) dat.InternalRecursive(hash) return result, jst.err diff --git a/shyft-cli/web3/transfer-through-master/test/test.js b/shyft-cli/web3/transfer-through-master/test/test.js index 6153da25c4..c74a91a706 100755 --- a/shyft-cli/web3/transfer-through-master/test/test.js +++ b/shyft-cli/web3/transfer-through-master/test/test.js @@ -4,13 +4,19 @@ var Transfers2 = artifacts.require("Transfers2"); contract('Transfers', function(accounts) { var addressA = web3.eth.accounts[0]; var addressB = web3.eth.accounts[1]; + console.log("Addr A:", addressA) + console.log("Addr B:", addressB) + var transfers; web3.eth.defaultAccount = web3.eth.accounts[0]; it("should initialize", async() => { transfers = await Transfers.new(); transfers2 = await Transfers2.new(); - assert(transfers !== undefined, ""); + console.log("Transfer addr1", transfers.address) + console.log("Transfer addr2", transfers2.address) + + assert(transfers !== undefined, ""); assert(transfers2 !== undefined, ""); })