style: code style
This commit is contained in:
@@ -12,9 +12,15 @@ impl Command for CommandImpl {
|
||||
|
||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||
SubCommand::with_name(self.name()).about("Create credit contract subcommand")
|
||||
.arg(Arg::with_name("name").long("name").short("n").required(true).takes_value(true).help("Contract name"))
|
||||
.arg(Arg::with_name("limit").long("limit").short("l").required(true).takes_value(true).help("Contract credit limit"))
|
||||
.arg(Arg::with_name("key").long("key").short("k").required(true).takes_value(true).help("Key pair"))
|
||||
.arg(Arg::with_name("name").long("name").short("n")
|
||||
.required(true).takes_value(true).help("Contract name")
|
||||
)
|
||||
.arg(Arg::with_name("limit").long("limit").short("l")
|
||||
.required(true).takes_value(true).help("Contract credit limit")
|
||||
)
|
||||
.arg(Arg::with_name("key").long("key").short("k")
|
||||
.required(true).takes_value(true).help("Key pair")
|
||||
)
|
||||
}
|
||||
|
||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||
|
||||
@@ -12,10 +12,18 @@ impl Command for CommandImpl {
|
||||
|
||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||
SubCommand::with_name(self.name()).about("Issue credit contract subcommand")
|
||||
.arg(Arg::with_name("name").long("name").short("n").required(true).takes_value(true).help("Contract name"))
|
||||
.arg(Arg::with_name("receiver").long("receiver").short("r").required(true).takes_value(true).help("Receiver"))
|
||||
.arg(Arg::with_name("credit").long("credit").short("c").required(true).takes_value(true).help("Credit"))
|
||||
.arg(Arg::with_name("key").long("key").short("k").required(true).takes_value(true).help("Key pair"))
|
||||
.arg(Arg::with_name("name").long("name").short("n")
|
||||
.required(true).takes_value(true).help("Contract name")
|
||||
)
|
||||
.arg(Arg::with_name("receiver").long("receiver").short("r")
|
||||
.required(true).takes_value(true).help("Receiver")
|
||||
)
|
||||
.arg(Arg::with_name("credit").long("credit").short("c")
|
||||
.required(true).takes_value(true).help("Credit")
|
||||
)
|
||||
.arg(Arg::with_name("key").long("key").short("k")
|
||||
.required(true).takes_value(true).help("Key pair")
|
||||
)
|
||||
}
|
||||
|
||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||
|
||||
@@ -12,9 +12,15 @@ impl Command for CommandImpl {
|
||||
|
||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||
SubCommand::with_name(self.name()).about("Query credit contract subcommand")
|
||||
.arg(Arg::with_name("name").long("name").short("n").required(true).takes_value(true).help("Contract name"))
|
||||
.arg(Arg::with_name("account").long("account").short("a").required(true).takes_value(true).help("Account"))
|
||||
.arg(Arg::with_name("key").long("key").short("k").required(true).takes_value(true).help("Key pair"))
|
||||
.arg(Arg::with_name("name").long("name").short("n")
|
||||
.required(true).takes_value(true).help("Contract name")
|
||||
)
|
||||
.arg(Arg::with_name("account").long("account").short("a")
|
||||
.required(true).takes_value(true).help("Account")
|
||||
)
|
||||
.arg(Arg::with_name("key").long("key").short("k")
|
||||
.required(true).takes_value(true).help("Key pair")
|
||||
)
|
||||
}
|
||||
|
||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||
|
||||
@@ -12,8 +12,12 @@ impl Command for CommandImpl {
|
||||
|
||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||
SubCommand::with_name(self.name()).about("Queryall credit contract subcommand")
|
||||
.arg(Arg::with_name("name").long("name").short("n").required(true).takes_value(true).help("Contract name"))
|
||||
.arg(Arg::with_name("key").long("key").short("k").required(true).takes_value(true).help("Key pair"))
|
||||
.arg(Arg::with_name("name").long("name").short("n")
|
||||
.required(true).takes_value(true).help("Contract name")
|
||||
)
|
||||
.arg(Arg::with_name("key").long("key").short("k")
|
||||
.required(true).takes_value(true).help("Key pair")
|
||||
)
|
||||
}
|
||||
|
||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||
|
||||
@@ -12,10 +12,18 @@ impl Command for CommandImpl {
|
||||
|
||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||
SubCommand::with_name(self.name()).about("Transfer credit contract subcommand")
|
||||
.arg(Arg::with_name("name").long("name").short("n").required(true).takes_value(true).help("Contract name"))
|
||||
.arg(Arg::with_name("receiver").long("receiver").short("r").required(true).takes_value(true).help("Receiver"))
|
||||
.arg(Arg::with_name("credit").long("credit").short("c").required(true).takes_value(true).help("Credit"))
|
||||
.arg(Arg::with_name("key").long("key").short("k").required(true).takes_value(true).help("Key pair"))
|
||||
.arg(Arg::with_name("name").long("name").short("n")
|
||||
.required(true).takes_value(true).help("Contract name")
|
||||
)
|
||||
.arg(Arg::with_name("receiver").long("receiver").short("r")
|
||||
.required(true).takes_value(true).help("Receiver")
|
||||
)
|
||||
.arg(Arg::with_name("credit").long("credit").short("c")
|
||||
.required(true).takes_value(true).help("Credit")
|
||||
)
|
||||
.arg(Arg::with_name("key").long("key").short("k")
|
||||
.required(true).takes_value(true).help("Key pair")
|
||||
)
|
||||
}
|
||||
|
||||
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
|
||||
|
||||
@@ -10,7 +10,9 @@ impl Command for CommandImpl {
|
||||
|
||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||
SubCommand::with_name(self.name()).about("Generate key pair subcommand")
|
||||
.arg(Arg::with_name("output").long("output").short("o").required(true).takes_value(true).help("Key pair output"))
|
||||
.arg(Arg::with_name("output").long("output").short("o")
|
||||
.required(true).takes_value(true).help("Key pair output")
|
||||
)
|
||||
.arg(Arg::with_name("tag").long("tag").short("t").takes_value(true).help("Key pair output"))
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,13 @@ impl CreditContract {
|
||||
return simple_error!("Cannot issue 0 credit!");
|
||||
}
|
||||
if self.issue_amount + credit > self.credit_limit {
|
||||
return simple_error!("Issue too much credit, current: {}, issue: {}, limit: {}, left: {}", self.issue_amount, credit, self.credit_limit, self.credit_limit - self.issue_amount);
|
||||
return simple_error!(
|
||||
"Issue too much credit, current: {}, issue: {}, limit: {}, left: {}",
|
||||
self.issue_amount,
|
||||
credit,
|
||||
self.credit_limit,
|
||||
self.credit_limit - self.issue_amount
|
||||
);
|
||||
}
|
||||
match self.credit.get_mut(receiver) {
|
||||
None => { self.credit.insert(receiver.to_owned(), credit); },
|
||||
|
||||
Reference in New Issue
Block a user