Coverage Summary for Class: ProgramSubtrace (co.rsk.rpc.modules.trace)

Class Class, % Method, % Line, %
ProgramSubtrace 0% (0/1) 0% (0/12) 0% (0/20)


1 /* 2  * This file is part of RskJ 3  * Copyright (C) 2017 RSK Labs Ltd. 4  * (derived from ethereumJ library, Copyright (c) 2016 <ether.camp>) 5  * 6  * This program is free software: you can redistribute it and/or modify 7  * it under the terms of the GNU Lesser General Public License as published by 8  * the Free Software Foundation, either version 3 of the License, or 9  * (at your option) any later version. 10  * 11  * This program is distributed in the hope that it will be useful, 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14  * GNU Lesser General Public License for more details. 15  * 16  * You should have received a copy of the GNU Lesser General Public License 17  * along with this program. If not, see <http://www.gnu.org/licenses/>. 18  */ 19  20 package co.rsk.rpc.modules.trace; 21  22 import org.ethereum.vm.DataWord; 23 import org.ethereum.vm.program.ProgramResult; 24 import org.ethereum.vm.program.invoke.InvokeData; 25  26 import java.util.Collections; 27 import java.util.List; 28  29 public class ProgramSubtrace { 30  private final TraceType traceType; 31  private final CallType callType; 32  private final CreationData creationData; 33  private final String creationMethod; 34  private final InvokeData invokeData; 35  private final ProgramResult programResult; 36  private final DataWord codeAddress; 37  private final List<ProgramSubtrace> subtraces; 38  39  public static ProgramSubtrace newSuicideSubtrace(InvokeData invokeData) { 40  return new ProgramSubtrace(TraceType.SUICIDE, CallType.NONE, null, null, invokeData, null, null, Collections.emptyList()); 41  } 42  43  public static ProgramSubtrace newCreateSubtrace(CreationData creationData, InvokeData invokeData, ProgramResult programResult, List<ProgramSubtrace> subtraces, boolean isCreate2) { 44  return new ProgramSubtrace(TraceType.CREATE, CallType.NONE, creationData, isCreate2 ? "create2" : "create", invokeData, programResult, null, subtraces); 45  } 46  47  public static ProgramSubtrace newCallSubtrace(CallType callType, InvokeData invokeData, ProgramResult programResult, DataWord codeAddress, List<ProgramSubtrace> subtraces) { 48  return new ProgramSubtrace(TraceType.CALL, callType, null, null, invokeData, programResult, codeAddress, subtraces); 49  } 50  51  private ProgramSubtrace(TraceType traceType, CallType callType, CreationData creationData, String creationMethod, InvokeData invokeData, ProgramResult programResult, DataWord codeAddress, List<ProgramSubtrace> subtraces) { 52  this.traceType = traceType; 53  this.callType = callType; 54  this.creationData = creationData; 55  this.creationMethod = creationMethod; 56  this.invokeData = invokeData; 57  this.programResult = programResult; 58  this.codeAddress = codeAddress; 59  this.subtraces = subtraces == null ? null : Collections.unmodifiableList(subtraces); 60  } 61  62  public TraceType getTraceType() { return this.traceType; } 63  64  public CallType getCallType() { return this.callType; } 65  66  public CreationData getCreationData() { return this.creationData; } 67  68  public String getCreationMethod() { return this.creationMethod; } 69  70  public InvokeData getInvokeData() { 71  return this.invokeData; 72  } 73  74  public ProgramResult getProgramResult() { 75  return this.programResult; 76  } 77  78  public DataWord getCodeAddress() { return this.codeAddress; } 79  80  public List<ProgramSubtrace> getSubtraces() { return this.subtraces == null ? null : Collections.unmodifiableList(this.subtraces); } 81 }