Skip to content

Commit

Permalink
Update CLI comands
Browse files Browse the repository at this point in the history
  • Loading branch information
dcpp committed Oct 22, 2024
1 parent ada50d5 commit 68edc28
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 32 deletions.
34 changes: 17 additions & 17 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ members = [

[workspace.package]
authors = ["ComposabilityLabs"]
version = "0.6.2"
version = "0.6.3"
edition = "2021"
license = "Apache-2.0"
rust-version = "1.79.0"

[workspace.dependencies]
anyhow = "1.0.89"
anyhow = "1.0.90"
fuels = { version = "0.66.9", features = ["fuel-core-lib"] }
tokio = { version = "1.40.0", features = ["rt", "macros"] }

6 changes: 3 additions & 3 deletions spark-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "spark-cli"
description = "Spark Rust CLI for Market & Orderbook contract interactions"
version = "0.6.2"
version = "0.6.3"
authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
Expand All @@ -15,8 +15,8 @@ anyhow = { workspace = true }
clap = { version = "4.5.20", features = ["derive"] }
dotenv = "0.15.0"
fuels = { workspace = true }
spark-market-sdk = { version = "0.6.2" }
spark-registry-sdk = { version = "0.6.2" }
spark-market-sdk = { version = "0.6.3" }
spark-registry-sdk = { version = "0.6.3" }
tokio = { workspace = true }

[[bin]]
Expand Down
14 changes: 7 additions & 7 deletions spark-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ spark-cli batch deploy-all \
```

Sample output:
Spark CLI v0.6.2
Spark CLI v0.6.3

BTC/USDC Market version 0.6.2 (1538) deployed to: 0x81acb82a64ff799836c19f4e7f9871cf6d13a1e5d286e815f91c26a1b92a8195
Deployment cost: 6324
BTC/USDC Market version 0.6.3 (1539) deployed to: 0xc5ed0d9b17beedd1c6c10a84bb496f12a5082aa3ce2ad55630bbcac22c64fcf4
Deployment cost: 6729

ETH/USDC Market version 0.6.2 (1538) deployed to: 0x3830aa30ddd4843dd13b6af7ae4fb59d8c5933b1a98cba9a80897c8ba5557307
Deployment cost: 6324
ETH/USDC Market version 0.6.3 (1539) deployed to: 0x944a3d62e65f3aefa7ac4a065eb9390a98806ef254aaece6df239ee78e6c2998
Deployment cost: 6729

MarketRegistry version 0.6.2 (1538) deployed to: 0xd76662328e464549b6f619401992127bed9b5cff3b46a3516e6b509d810b7035
Deployment cost: 7723
MarketRegistry version 0.6.3 (1539) deployed to: 0x0c26b7134516773469cd02030a783e43776d1fd26e0698b51af3cef4938e2925
Deployment cost: 8433

### Deploy BTC-USDC market

Expand Down
19 changes: 16 additions & 3 deletions spark-cli/src/commands/batch/deploy_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,26 @@ impl DeployAllCommand {
pub(crate) async fn run(&self) -> anyhow::Result<()> {
let wallet = setup(&self.rpc).await?;

let eth = "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07";
let btc = "0x38e4ca985b22625fff93205e997bfc5cc8453a953da638ad297ca60a9f2600bc";
let usdc = "0x336b7c06352a4b736ff6f688ba6885788b3df16e136e95310ade51aa32dc6f05";
let (eth, btc, usdc) = match &*self.rpc {
"testnet.fuel.network" => (
"0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07",
"0x38e4ca985b22625fff93205e997bfc5cc8453a953da638ad297ca60a9f2600bc",
"0x336b7c06352a4b736ff6f688ba6885788b3df16e136e95310ade51aa32dc6f05",
),
"mainnet.fuel.network" => (
"0xf169e13e98ae8908199148380684894458b7916f074b85ebad2aaad489ce0d54",
"0x0dc8cdbe2798cb45ebc99180afc0bc514ffb505a80f122004378955c1d23892c",
"0x22dfb618b9fc621a7d53f0f599dd427fb5688e280062a8de8883a27819d3f276",
),
_ => ("", "", ""),
};

let quote_asset = AssetId::from_str(&usdc).unwrap();
let quote_decimals = 6;
let price_decimals = 9;
let version = SparkMarketContract::sdk_version();
let matcher_fee = 1_000; // 0.001 USDC
let min_price = 500_000_000; // 500 USDC

// multi tier protocol fee structure
let protocol_fee = vec![
Expand Down Expand Up @@ -113,6 +124,7 @@ impl DeployAllCommand {
let _ = contract.set_protocol_fee(protocol_fee.clone()).await?;
let _ = contract.set_epoch(epoch, epoch_duration).await?;
let _ = contract.set_min_order_size(min_size).await?;
let _ = contract.set_min_order_price(min_price).await?;

// Balance post-deployment
let new_balance = wallet
Expand Down Expand Up @@ -153,6 +165,7 @@ impl DeployAllCommand {
let _ = contract.set_protocol_fee(protocol_fee.clone()).await?;
let _ = contract.set_epoch(epoch, epoch_duration).await?;
let _ = contract.set_min_order_size(min_size).await?;
let _ = contract.set_min_order_price(min_price).await?;

// Balance post-deployment
let new_balance = wallet
Expand Down

0 comments on commit 68edc28

Please sign in to comment.