func (self *JSRE) dump(call otto.FunctionCall) otto.Value { var state *ethstate.State if len(call.ArgumentList) > 0 { var block *ethchain.Block if call.Argument(0).IsNumber() { num, _ := call.Argument(0).ToInteger() block = self.ethereum.BlockChain().GetBlockByNumber(uint64(num)) } else if call.Argument(0).IsString() { hash, _ := call.Argument(0).ToString() block = self.ethereum.BlockChain().GetBlock(ethutil.Hex2Bytes(hash)) } else { fmt.Println("invalid argument for dump. Either hex string or number") } if block == nil { fmt.Println("block not found") return otto.UndefinedValue() } state = block.State() } else { state = self.ethereum.StateManager().CurrentState() } v, _ := self.Vm.ToValue(state.Dump()) return v }