simplified trace from functions, removed clippy warnings
This commit is contained in:
parent
3e09f99845
commit
239e2c82e6
@ -27,6 +27,15 @@ pub enum ActionValue {
|
|||||||
Apparent(U256)
|
Apparent(U256)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ActionValue {
|
||||||
|
/// Returns action value as U256.
|
||||||
|
pub fn value(&self) -> U256 {
|
||||||
|
match *self {
|
||||||
|
ActionValue::Transfer(x) | ActionValue::Apparent(x) => x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: should be a trait, possible to avoid cloning everything from a Transaction(/View).
|
// TODO: should be a trait, possible to avoid cloning everything from a Transaction(/View).
|
||||||
/// Action (call/create) input params. Everything else should be specified in Externalities.
|
/// Action (call/create) input params. Everything else should be specified in Externalities.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -90,9 +90,9 @@ impl TraceAction {
|
|||||||
TraceAction::Call(TraceCall {
|
TraceAction::Call(TraceCall {
|
||||||
from: p.sender.clone(),
|
from: p.sender.clone(),
|
||||||
to: p.address.clone(),
|
to: p.address.clone(),
|
||||||
value: match p.value { ActionValue::Transfer(ref x) | ActionValue::Apparent(ref x) => x.clone() },
|
value: p.value.value(),
|
||||||
gas: p.gas.clone(),
|
gas: p.gas,
|
||||||
input: p.data.clone().unwrap_or(vec![]),
|
input: p.data.clone().unwrap_or_else(Vec::new),
|
||||||
result: None,
|
result: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -101,9 +101,9 @@ impl TraceAction {
|
|||||||
pub fn from_create(p: &ActionParams) -> TraceAction {
|
pub fn from_create(p: &ActionParams) -> TraceAction {
|
||||||
TraceAction::Create(TraceCreate {
|
TraceAction::Create(TraceCreate {
|
||||||
from: p.sender.clone(),
|
from: p.sender.clone(),
|
||||||
value: match p.value { ActionValue::Transfer(ref x) | ActionValue::Apparent(ref x) => x.clone() },
|
value: p.value.value(),
|
||||||
gas: p.gas.clone(),
|
gas: p.gas,
|
||||||
init: p.code.clone().unwrap_or(vec![]),
|
init: p.code.clone().unwrap_or_else(Vec::new),
|
||||||
result: None,
|
result: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user