From 2cb1937e1e4a50b420619276273195db24287a1a Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 19 Mar 2016 22:37:11 +0100 Subject: [PATCH] Move code to right module. --- ethcore/src/substate.rs | 25 ------------------------- ethcore/src/trace.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/ethcore/src/substate.rs b/ethcore/src/substate.rs index 9e6d0cea2..0610bffb8 100644 --- a/ethcore/src/substate.rs +++ b/ethcore/src/substate.rs @@ -65,31 +65,6 @@ impl Substate { } } -impl TraceAction { - /// Compose a `TraceAction` from an `ActionParams`, knowing that the action is a call. - pub fn from_call(p: &ActionParams) -> TraceAction { - TraceAction::Call(TraceCall { - from: p.sender.clone(), - to: p.address.clone(), - value: match p.value { ActionValue::Transfer(ref x) | ActionValue::Apparent(ref x) => x.clone() }, - gas: p.gas.clone(), - input: p.data.clone().unwrap_or(vec![]), - result: None, - }) - } - - /// Compose a `TraceAction` from an `ActionParams`, knowing that the action is a create. - pub fn from_create(p: &ActionParams) -> TraceAction { - TraceAction::Create(TraceCreate { - from: p.sender.clone(), - value: match p.value { ActionValue::Transfer(ref x) | ActionValue::Apparent(ref x) => x.clone() }, - gas: p.gas.clone(), - init: p.code.clone().unwrap_or(vec![]), - result: None, - }) - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/ethcore/src/trace.rs b/ethcore/src/trace.rs index 1f45e846f..858230bcd 100644 --- a/ethcore/src/trace.rs +++ b/ethcore/src/trace.rs @@ -83,3 +83,29 @@ impl Default for Trace { } } } + +impl TraceAction { + /// Compose a `TraceAction` from an `ActionParams`, knowing that the action is a call. + pub fn from_call(p: &ActionParams) -> TraceAction { + TraceAction::Call(TraceCall { + from: p.sender.clone(), + to: p.address.clone(), + value: match p.value { ActionValue::Transfer(ref x) | ActionValue::Apparent(ref x) => x.clone() }, + gas: p.gas.clone(), + input: p.data.clone().unwrap_or(vec![]), + result: None, + }) + } + + /// Compose a `TraceAction` from an `ActionParams`, knowing that the action is a create. + pub fn from_create(p: &ActionParams) -> TraceAction { + TraceAction::Create(TraceCreate { + from: p.sender.clone(), + value: match p.value { ActionValue::Transfer(ref x) | ActionValue::Apparent(ref x) => x.clone() }, + gas: p.gas.clone(), + init: p.code.clone().unwrap_or(vec![]), + result: None, + }) + } +} +