Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewvious committed Jan 17, 2024
1 parent 95663aa commit 75afbbc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
3 changes: 1 addition & 2 deletions crates/wasm_cli/src/commands/testbalance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ use crate::commands::testinitdb::*;

#[derive(Parser, Debug, Clone)]
pub struct TestBalanceOpts {
/// This is the path to the database to be created/used. #716, this path is what we'll feed
/// into the database driver.
/// This is the path to the database to be used.
// TODO: Make this an option, and look for the db path in the file tree
// using std::fs or std::env if we choose to allow it.
// REASON: If the db path is the current directory, we should infer this.
Expand Down
14 changes: 4 additions & 10 deletions crates/wasm_cli/src/commands/testcontract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ use crate::commands::testinitdb;

#[derive(Parser, Debug)]
pub struct TestContractOpts {
/// This is the path to the database to be created/used. #716, this path is what we'll feed
/// into the database driver.
/// This is the path to the database to be used.
#[clap(short, long)]
pub dbpath: String,
/// The path to the WASM object file to load and describe
Expand All @@ -41,16 +40,14 @@ pub struct TestContractOpts {
/// The contract caller's Address.
#[clap(short, long, value_parser, value_name = "CONTRACT_CALLER")]
pub contract_caller: primitives::Address,
/// The function to call within the smart contract. #716 this will influence the JSON we
/// The function to call within the smart contract. This will influence the JSON we
/// generate below to pass into the smart contract when we execute it. TODO: mg@ needs to also
/// remember to add some function-specific arguments here to allow those to be passed in.
#[clap(short, long, value_parser, value_name = "FUNCTION")]
pub function: String,
/// The arguments to pass into the function as a JSON object. See the `versatus-rust` github
/// repository for the inputs that supported functions take. For now, this is a string
/// interpretted as a JSON object, whereas later, it'll likely be more formal. #716, this JSON
/// will equate to the data in the FunctionInputs enum here:
/// https://github.com/versatus/versatus-rust/blob/main/src/versatus_rust.rs#L94
/// interpretted as a JSON object, whereas later, it'll likely be more formal.
#[clap(short, long, value_parser, value_name = "JSON", default_value = "[]")]
pub inputs: String,
/// An environment variable to pass to the running WASM module. May be used
Expand Down Expand Up @@ -168,10 +165,7 @@ fn update_db(storage_connection: &Storage, contract_outputs: &SmartContractOutpu

Ok(())
}
// #716 This JSON string is a placeholder to allow the code to compile. What we need to do is
// to build the JSON to match the JSON generated by the example in the versatus-rust
// repository, but build it from the contents of the database and command line inputs. We can
// assume (for now) that all contracts will be ERC20 when dealing with inputs and outputs.

fn create_contract_inputs(
caller: &primitives::Address,
function: &str,
Expand Down
10 changes: 3 additions & 7 deletions crates/wasm_cli/src/commands/testinitdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,14 @@ pub const DEFAULT_ADDRESSES: &[Address; 10] = &[

#[derive(Clone, Parser, Debug)]
pub struct TestInitDBOpts {
/// This is the path to the database to be created/used. #716, this path is what we'll feed
/// into the database driver.
/// This is the path to the database to be created.
#[clap(short, long)]
pub dbpath: String,
/// Force DB to be initialised, even if it already exists. #716 I think that if this option is
/// missing or false, we should only recreate the database from defaults if it doesn't already
/// exist. If it exists, we should exit with a failure and an error message indicating that the
/// database already exists and to use --force.
/// Force DB to be initialised, even if it already exists.
#[clap(short, long)]
pub force: bool,
/// Default balance for new test accounts created. The protocol supports values up to
/// [ethnum::U256] in size, but u128 ought to be fine for now.
/// U256 in size.
#[clap(short, long)]
pub default_balance: Option<U256>,
#[clap(short, long)]
Expand Down

0 comments on commit 75afbbc

Please sign in to comment.