style: credit contract style

This commit is contained in:
2021-01-01 22:31:05 +08:00
parent 602e14071b
commit ba35489cdf
2 changed files with 8 additions and 10 deletions

View File

@@ -25,10 +25,6 @@ impl CreditContract {
Ok(c)
}
pub fn load(name: &str) -> XResult<Self> {
load_credit_contract(name)
}
pub fn issue(&mut self, tx: &Transaction, receiver: &str, credit: u32) -> XResult<()> {
if &self.admin != &tx.sender {
return simple_error!("Current user is not admin, {} vs {:?}", self.admin, tx.sender);
@@ -82,7 +78,9 @@ impl CreditContract {
}
}
fn load_credit_contract(name: &str) -> XResult<CreditContract> {
// ========================================================================= //
pub fn load_credit_contract(name: &str) -> XResult<CreditContract> {
let json = fs::read_to_string(name)?;
serde_json::from_str(&json).map_err(|e| e.into())
}