Skip to content

Commit 04adcd2

Browse files
committed
Bump version of the simplicity-contracts. Added issuance verification.
1 parent d4a3e12 commit 04adcd2

File tree

18 files changed

+355
-407
lines changed

18 files changed

+355
-407
lines changed

Cargo.lock

Lines changed: 184 additions & 198 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ anyhow = { version = "1.0.100" }
1919

2020
tracing = { version = "0.1.41" }
2121

22-
contracts = { git = "https://github.com/BlockstreamResearch/simplicity-contracts.git", rev = "61616fb", package = "contracts" }
23-
cli-helper = { git = "https://github.com/BlockstreamResearch/simplicity-contracts.git", rev = "61616fb", package = "cli" }
22+
contracts = { git = "https://github.com/BlockstreamResearch/simplicity-contracts.git", rev = "b0ffdf1", package = "contracts" }
23+
cli-helper = { git = "https://github.com/BlockstreamResearch/simplicity-contracts.git", rev = "b0ffdf1", package = "cli" }
2424
simplicityhl-core = { version = "0.4.0", features = ["encoding"] }
2525

2626
simplicityhl = { version = "0.4.1" }

crates/cli-client/src/cli/browse.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl Cli {
1717
println!("Browsing available options and option offers from NOSTR...");
1818
println!();
1919

20-
let options_results = client.fetch_options(config.address_params()).await?;
20+
let options_results = client.fetch_options(config.network()).await?;
2121
let valid_options: Vec<OptionCreatedEvent> = options_results.into_iter().filter_map(Result::ok).collect();
2222

2323
println!("Available Options:");
@@ -46,7 +46,7 @@ impl Cli {
4646

4747
println!();
4848

49-
let offers_results = client.fetch_option_offers(config.address_params()).await?;
49+
let offers_results = client.fetch_option_offers(config.network()).await?;
5050
let valid_offers: Vec<OptionOfferCreatedEvent> = offers_results.into_iter().filter_map(Result::ok).collect();
5151

5252
println!("Available Option Offers (from NOSTR):");

crates/cli-client/src/cli/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl Cli {
6767
let seed = self.parse_seed()?;
6868
let db_path = config.database_path();
6969

70-
Wallet::open(&seed, &db_path, config.address_params()).await
70+
Wallet::open(&seed, &db_path, config.network()).await
7171
}
7272

7373
async fn get_read_only_client(&self, config: &Config) -> Result<ReadOnlyClient, Error> {

crates/cli-client/src/cli/option.rs

Lines changed: 38 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use simplicityhl::elements::secp256k1_zkp::SECP256K1;
2222
use simplicityhl::elements::{OutPoint, TxOut, TxOutSecrets};
2323
use simplicityhl::simplicity::hex::DisplayHex;
2424
use simplicityhl::tracker::TrackerLogLevel;
25-
use simplicityhl_core::{LIQUID_TESTNET_BITCOIN_ASSET, LIQUID_TESTNET_GENESIS, derive_public_blinder_key};
25+
use simplicityhl_core::{LIQUID_TESTNET_BITCOIN_ASSET, derive_public_blinder_key};
2626

2727
impl Cli {
2828
#[allow(clippy::too_many_lines)]
@@ -69,7 +69,7 @@ impl Cli {
6969
println!(" Per-contract strike: {settlement_per_contract}");
7070
println!(" Expiry: {} ({})", expiry, format_relative_time(expiry_time));
7171

72-
let script_pubkey = wallet.signer().p2pk_address(config.address_params())?.script_pubkey();
72+
let script_pubkey = wallet.signer().p2pk_address(config.network())?.script_pubkey();
7373
let is_lbtc_collateral = *collateral_asset == *LIQUID_TESTNET_BITCOIN_ASSET;
7474

7575
let initial_fee = fee.unwrap_or(PLACEHOLDER_FEE);
@@ -149,11 +149,11 @@ impl Cli {
149149
&args,
150150
issuance_asset_entropy,
151151
f,
152-
config.address_params(),
152+
config.network(),
153153
)?;
154154
Ok((pst, vec![first_fee_utxo.1.clone(), second_fee_utxo.1.clone()]))
155155
},
156-
|tx, utxos| sign_p2pk_inputs(tx, utxos, &wallet, config.address_params(), 0),
156+
|tx, utxos| sign_p2pk_inputs(tx, utxos, &wallet, config.network(), 0),
157157
)?;
158158

159159
println!(" Creation fee: {creation_fee} sats");
@@ -165,7 +165,7 @@ impl Cli {
165165
&args,
166166
issuance_asset_entropy,
167167
creation_fee,
168-
config.address_params(),
168+
config.network(),
169169
)?;
170170

171171
let creation_tx = pst.extract_tx()?;
@@ -178,7 +178,7 @@ impl Cli {
178178
.map_err(|e| Error::Config(format!("Failed to unblind grantor token output: {e}")))?;
179179
let creation_utxos = vec![first_fee_utxo.1.clone(), second_fee_utxo.1.clone()];
180180

181-
let creation_tx = sign_p2pk_inputs(creation_tx, &creation_utxos, &wallet, config.address_params(), 0)?;
181+
let creation_tx = sign_p2pk_inputs(creation_tx, &creation_utxos, &wallet, config.network(), 0)?;
182182

183183
let creation_txid = creation_tx.txid();
184184

@@ -225,12 +225,11 @@ impl Cli {
225225
&utxos,
226226
i,
227227
&branch,
228-
config.address_params(),
229-
*LIQUID_TESTNET_GENESIS,
228+
config.network(),
230229
TrackerLogLevel::None,
231230
)?;
232231
}
233-
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.address_params(), 2)?;
232+
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.network(), 2)?;
234233
let signed_weight = tx.weight();
235234
let fee_rate = config.get_fee_rate();
236235
let estimated = crate::fee::calculate_fee(signed_weight, fee_rate);
@@ -272,13 +271,12 @@ impl Cli {
272271
&funding_utxos,
273272
i,
274273
&option_branch,
275-
config.address_params(),
276-
*LIQUID_TESTNET_GENESIS,
274+
config.network(),
277275
TrackerLogLevel::None,
278276
)?;
279277
}
280278

281-
let funding_tx = sign_p2pk_inputs(funding_tx, &funding_utxos, &wallet, config.address_params(), 2)?;
279+
let funding_tx = sign_p2pk_inputs(funding_tx, &funding_utxos, &wallet, config.network(), 2)?;
282280

283281
if *broadcast {
284282
cli_helper::explorer::broadcast_tx(&creation_tx).await?;
@@ -372,7 +370,7 @@ impl Cli {
372370
} => {
373371
println!("Exercising option...");
374372

375-
let script_pubkey = wallet.signer().p2pk_address(config.address_params())?.script_pubkey();
373+
let script_pubkey = wallet.signer().p2pk_address(config.network())?.script_pubkey();
376374
let option_entries = get_option_tokens_from_wallet(&wallet, OPTION_SOURCE, &script_pubkey).await?;
377375
if option_entries.is_empty() {
378376
return Err(Error::Config("No option contract tokens found".to_string()));
@@ -390,7 +388,7 @@ impl Cli {
390388
let tpg = TaprootPubkeyGen::build_from_str(
391389
&entry.taproot_pubkey_gen_str,
392390
&entry.option_arguments,
393-
wallet.params(),
391+
wallet.network(),
394392
&contracts::options::get_options_address,
395393
)?;
396394

@@ -446,7 +444,7 @@ impl Cli {
446444
let taproot_pubkey_gen = TaprootPubkeyGen::build_from_str(
447445
&enriched_entry.taproot_pubkey_gen_str,
448446
&option_arguments,
449-
wallet.params(),
447+
wallet.network(),
450448
&contracts::options::get_options_address,
451449
)?;
452450

@@ -568,11 +566,10 @@ impl Cli {
568566
&utxos,
569567
0,
570568
&branch,
571-
config.address_params(),
572-
*LIQUID_TESTNET_GENESIS,
569+
config.network(),
573570
TrackerLogLevel::None,
574571
)?;
575-
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.address_params(), 1)?;
572+
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.network(), 1)?;
576573
let signed_weight = tx.weight();
577574
let fee_rate = config.get_fee_rate();
578575
let estimated = crate::fee::calculate_fee(signed_weight, fee_rate);
@@ -608,12 +605,11 @@ impl Cli {
608605
&utxos,
609606
0,
610607
&option_branch,
611-
config.address_params(),
612-
*LIQUID_TESTNET_GENESIS,
608+
config.network(),
613609
TrackerLogLevel::None,
614610
)?;
615611

616-
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.address_params(), 1)?;
612+
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.network(), 1)?;
617613

618614
if *broadcast {
619615
cli_helper::explorer::broadcast_tx(&tx).await?;
@@ -659,7 +655,7 @@ impl Cli {
659655
} => {
660656
println!("Expiring option...");
661657

662-
let script_pubkey = wallet.signer().p2pk_address(config.address_params())?.script_pubkey();
658+
let script_pubkey = wallet.signer().p2pk_address(config.network())?.script_pubkey();
663659
let grantor_entries = get_grantor_tokens_from_wallet(&wallet, OPTION_SOURCE, &script_pubkey).await?;
664660
if grantor_entries.is_empty() {
665661
return Err(Error::Config("No grantor tokens found".to_string()));
@@ -677,7 +673,7 @@ impl Cli {
677673
let tpg = TaprootPubkeyGen::build_from_str(
678674
&entry.taproot_pubkey_gen_str,
679675
&entry.option_arguments,
680-
wallet.params(),
676+
wallet.network(),
681677
&contracts::options::get_options_address,
682678
)?;
683679

@@ -735,7 +731,7 @@ impl Cli {
735731
let taproot_pubkey_gen = TaprootPubkeyGen::build_from_str(
736732
&enriched_entry.taproot_pubkey_gen_str,
737733
&option_arguments,
738-
wallet.params(),
734+
wallet.network(),
739735
&contracts::options::get_options_address,
740736
)?;
741737

@@ -810,11 +806,10 @@ impl Cli {
810806
&utxos,
811807
0,
812808
&branch,
813-
config.address_params(),
814-
*LIQUID_TESTNET_GENESIS,
809+
config.network(),
815810
TrackerLogLevel::None,
816811
)?;
817-
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.address_params(), 1)?;
812+
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.network(), 1)?;
818813
let signed_weight = tx.weight();
819814
let fee_rate = config.get_fee_rate();
820815
let estimated = crate::fee::calculate_fee(signed_weight, fee_rate);
@@ -846,12 +841,11 @@ impl Cli {
846841
&utxos,
847842
0,
848843
&option_branch,
849-
config.address_params(),
850-
*LIQUID_TESTNET_GENESIS,
844+
config.network(),
851845
TrackerLogLevel::None,
852846
)?;
853847

854-
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.address_params(), 1)?;
848+
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.network(), 1)?;
855849

856850
if *broadcast {
857851
cli_helper::explorer::broadcast_tx(&tx).await?;
@@ -894,7 +888,7 @@ impl Cli {
894888
} => {
895889
println!("Claiming settlement...");
896890

897-
let script_pubkey = wallet.signer().p2pk_address(config.address_params())?.script_pubkey();
891+
let script_pubkey = wallet.signer().p2pk_address(config.network())?.script_pubkey();
898892
let grantor_entries = get_grantor_tokens_from_wallet(&wallet, OPTION_SOURCE, &script_pubkey).await?;
899893
if grantor_entries.is_empty() {
900894
return Err(Error::Config("No grantor tokens found".to_string()));
@@ -912,7 +906,7 @@ impl Cli {
912906
let tpg = TaprootPubkeyGen::build_from_str(
913907
&entry.taproot_pubkey_gen_str,
914908
&entry.option_arguments,
915-
wallet.params(),
909+
wallet.network(),
916910
&contracts::options::get_options_address,
917911
)?;
918912

@@ -970,7 +964,7 @@ impl Cli {
970964
let taproot_pubkey_gen = TaprootPubkeyGen::build_from_str(
971965
&enriched_entry.taproot_pubkey_gen_str,
972966
&option_arguments,
973-
wallet.params(),
967+
wallet.network(),
974968
&contracts::options::get_options_address,
975969
)?;
976970

@@ -1058,11 +1052,10 @@ impl Cli {
10581052
&utxos,
10591053
0,
10601054
&branch,
1061-
config.address_params(),
1062-
*LIQUID_TESTNET_GENESIS,
1055+
config.network(),
10631056
TrackerLogLevel::None,
10641057
)?;
1065-
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.address_params(), 1)?;
1058+
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.network(), 1)?;
10661059
let signed_weight = tx.weight();
10671060
let fee_rate = config.get_fee_rate();
10681061
let estimated = crate::fee::calculate_fee(signed_weight, fee_rate);
@@ -1094,12 +1087,11 @@ impl Cli {
10941087
&utxos,
10951088
0,
10961089
&option_branch,
1097-
config.address_params(),
1098-
*LIQUID_TESTNET_GENESIS,
1090+
config.network(),
10991091
TrackerLogLevel::None,
11001092
)?;
11011093

1102-
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.address_params(), 1)?;
1094+
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.network(), 1)?;
11031095

11041096
if *broadcast {
11051097
cli_helper::explorer::broadcast_tx(&tx).await?;
@@ -1145,7 +1137,7 @@ impl Cli {
11451137
} => {
11461138
println!("Cancelling option...");
11471139

1148-
let user_script_pubkey = wallet.signer().p2pk_address(config.address_params())?.script_pubkey();
1140+
let user_script_pubkey = wallet.signer().p2pk_address(config.network())?.script_pubkey();
11491141
let token_entries = get_option_tokens_from_wallet(&wallet, OPTION_SOURCE, &user_script_pubkey).await?;
11501142
if token_entries.is_empty() {
11511143
return Err(Error::Config("No option tokens found".to_string()));
@@ -1164,7 +1156,7 @@ impl Cli {
11641156
let taproot_pubkey_gen = TaprootPubkeyGen::build_from_str(
11651157
&enriched_entry.taproot_pubkey_gen_str,
11661158
&option_arguments,
1167-
wallet.params(),
1159+
wallet.network(),
11681160
&contracts::options::get_options_address,
11691161
)?;
11701162

@@ -1205,7 +1197,7 @@ impl Cli {
12051197

12061198
let initial_fee = fee.unwrap_or(PLACEHOLDER_FEE);
12071199

1208-
let script_pubkey = wallet.signer().p2pk_address(config.address_params())?.script_pubkey();
1200+
let script_pubkey = wallet.signer().p2pk_address(config.network())?.script_pubkey();
12091201
let fee_filter = UtxoFilter::new()
12101202
.asset_id(*LIQUID_TESTNET_BITCOIN_ASSET)
12111203
.script_pubkey(script_pubkey.clone())
@@ -1265,11 +1257,10 @@ impl Cli {
12651257
&utxos,
12661258
0,
12671259
&branch,
1268-
config.address_params(),
1269-
*LIQUID_TESTNET_GENESIS,
1260+
config.network(),
12701261
TrackerLogLevel::None,
12711262
)?;
1272-
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.address_params(), 1)?;
1263+
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.network(), 1)?;
12731264
let signed_weight = tx.weight();
12741265
let fee_rate = config.get_fee_rate();
12751266
let estimated = crate::fee::calculate_fee(signed_weight, fee_rate);
@@ -1302,12 +1293,11 @@ impl Cli {
13021293
&utxos,
13031294
0,
13041295
&option_branch,
1305-
config.address_params(),
1306-
*LIQUID_TESTNET_GENESIS,
1296+
config.network(),
13071297
TrackerLogLevel::None,
13081298
)?;
13091299

1310-
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.address_params(), 1)?;
1300+
let tx = sign_p2pk_inputs(tx, &utxos, &wallet, config.network(), 1)?;
13111301

13121302
if *broadcast {
13131303
cli_helper::explorer::broadcast_tx(&tx).await?;

0 commit comments

Comments
 (0)