use rust_util::XResult; use crate::tx::Transaction; use crate::engine_plugin_credit::ContractEngineCredit; pub struct ContractEngine { } impl ContractEngine { pub fn new() -> Self { Self{} } pub fn execute(&self, tx: &Transaction) -> XResult<()> { tx.verify()?; let tx_body = tx.parse_body()?; match tx_body.contract.as_str() { "credit" => { ContractEngineCredit::new().execute(tx, &tx_body)?; }, c => return simple_error!("Unknown cotract: {}", c), } Ok(()) } }