Skip to content

Commit

Permalink
Clippy eliminate warnings & seperate workspace for kairos-deposit-con…
Browse files Browse the repository at this point in the history
…tract
  • Loading branch information
jonas089 committed Feb 26, 2024
1 parent a33af39 commit cd684b1
Show file tree
Hide file tree
Showing 29 changed files with 985 additions and 229 deletions.
122 changes: 26 additions & 96 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ resolver = "2"
members = [
"kairos-cli",
"kairos-server",
"kairos-deposit-contract/contract",
"kairos-deposit-contract/malicious-reader",
"kairos-deposit-contract/malicious-session",
"kairos-deposit-contract/tests",
"kairos-deposit-contract/withdrawal-session",
"kairos-deposit-contract-tests",
"kairos-deposit-contract/contract-types",
"kairos-deposit-contract/deposit-session",
"kairos-contract-cli"
]

[workspace.package]
name = "kairos"
version = "0.1.0"
edition = "2021"
edition = "2021"
24 changes: 13 additions & 11 deletions kairos-contract-cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use std::i64;

use crate::deployments::{
call_create_purse, call_incr_counter, deploy_handler, get_deposit_event, put_deposit_session,
call_create_purse, call_incr_counter, get_counter, get_deposit_event, put_deposit_session,
put_withdrawal_session,
};
use casper_types::{URef, U512};
use clap::{Command, Parser, Subcommand};
use kairos_contract_cli::deployments::get_counter;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(propagate_version = true)]
Expand All @@ -15,6 +14,10 @@ struct Cli {
command: Option<Commands>,
}

// I want to allow CAPS here,
// because these enum variants are constant methods.
#[allow(non_camel_case_types)]
#[allow(clippy::upper_case_acronyms)]
#[derive(Subcommand)]
enum Commands {
CREATE_PURSE {
Expand Down Expand Up @@ -139,7 +142,7 @@ pub async fn commander() {
wasm_path,
contract_addr,
U512::from(*amount),
URef::from_formatted_str(&destination).unwrap(),
URef::from_formatted_str(destination).unwrap(),
)
.await;
println!("Deploy Hash: {:?}", &withdrawal_hash);
Expand Down Expand Up @@ -167,20 +170,19 @@ pub async fn commander() {
let value = get_counter::get(
node_address,
rpc_port.to_owned(),
URef::from_formatted_str(&counter_uref).unwrap(),
URef::from_formatted_str(counter_uref).unwrap(),
)
.await;
println!("Counter value: {:?}", &value);
}
None => {
println!(
"
Possible commands:
create_purse, get_counter, get_deposit, incr_counter, deposit, withdrawal
"
This cli-tool is used in a complex build environment that depends on many branches and is only for development.
\n
If you're not sure how to use this tool, then it is currently not for you. Please check back later and follow R&D progress on Kairos L2 development.
\n
Much love :)
");
);
}
}
}
7 changes: 3 additions & 4 deletions kairos-contract-cli/src/deployments/call_create_purse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ pub async fn call(
let secret_key_bytes = fs::read(secret_key_path).unwrap();
let secret_key: SecretKey = SecretKey::from_pem(secret_key_bytes.clone()).unwrap();
let layer_one_deploy_handler = LayerOneDeployHandler {
node_address: node_address,
node_address,
rpc_port: JsonRpcId::String(rpc_port),
secret_key,
};
let mut deploy = layer_one_deploy_handler.build_deploy(
chain_name,
raw_deploy,
&SecretKey::from_pem(secret_key_bytes.clone()).unwrap(),
10_000_000_0000u64,
100_000_000_000u64,
);
deploy.sign(&SecretKey::from_pem(secret_key_bytes).unwrap());
let deploy_result = layer_one_deploy_handler.put_deploy(deploy).await;
deploy_result
layer_one_deploy_handler.put_deploy(deploy).await
}
Loading

0 comments on commit cd684b1

Please sign in to comment.