Skip to content

Conversation

@ikripaka
Copy link
Collaborator

@ikripaka ikripaka commented Nov 19, 2025

Summary

  • add cli interaction with protocols
  • overall code refactor to reuse existing code
  • add interaction with nostr events (maker/taker order replies, maker order placing)

Example Run 1

nostr-tool - https://github.com/0xtrr/nostr-tool

Prepare:

./simplicity-dex helpers faucet --fee-utxo 6e51e75d468f3aadf8749233d78daec1a077f738df97c0a6e0a32bd54b47a06a:0 --asset-name "testtt"
Test token asset entropy: 'c9ec346b74e1030bf2d1d000c5a996daa7ef2ebe85a7a6fa51aedee953eecdf0', asset_id: '3486e316c52aec04919d2401a29d880176787059fc94d2b7c5042d02c820e4e4', reissue_asset_id: '3c341dd8e07531221d0e1fcd40260d10a3778393f3c6829fbdb0aee594effbc2'
Broadcasted txid: e110c17d165e0a2bb9f6931dbfe9d90075e7330a2471b9f3e246265d196f9e6f
Asset creation -- done

Maker init

./simplicity-dex maker init --utxo-1 cfeed45a58ea2c084092e91f38a1a029b416707fd41e035d34a1a924111cffd6:0 \
--utxo-2 cfeed45a58ea2c084092e91f38a1a029b416707fd41e035d34a1a924111cffd6:1 \
--utxo-3 cfeed45a58ea2c084092e91f38a1a029b416707fd41e035d34a1a924111cffd6:2 \
--taker-funding-start-time 1764072100 \
--taker-funding-end-time 1764073100 \
--contract-expiry-time 1764075100 \
--early-termination-end-time 1764075100 \
--settlement-height 2195390 \
--principal-collateral-amount 1000 \
--incentive-basis-points 1000 \
--filler-per-principal-collateral 10 \
--strike-price 10 \
--settlement-asset-entropy c9ec346b74e1030bf2d1d000c5a996daa7ef2ebe85a7a6fa51aedee953eecdf0
Filler_token_entropy: '332ee339fa6ba11825aff8f6b37d947616f5ad35550f55cae58a7d5c0eb88584', grantor_collateral_entropy: 'd59f8c7888919de31b5943d6372358176eeac5dd617ddc35b457a0e62759c32c', grantor_settlement: '0f8be7673a075e3ea1a18e85c5411009f54f6ed98faa32a23b809999cafce266', taproot_pubkey: '87259fcc2da8a92273f0a3305d9a706062b3d1377dd774739e16f7a4f0eae990:027aed3517dd4c6e3cea2d67c16648a9284afc1b154f17fead32152889def8ca3d:tex1p9988q8kfq33m0y6wlsra683rur32k9vx58kqc6cceeks7tccu5yqhkjv7n', dcd_args: 'DCDArguments {
    taker_funding_start_time: 1764072100,
    taker_funding_end_time: 1764073100,
    contract_expiry_time: 1764075100,
    early_termination_end_time: 1764075100,
    settlement_height: 2195390,
    strike_price: 10,
    incentive_basis_points: 1000,
    fee_basis_points: 0,
    collateral_asset_id_hex_le: "144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49",
    settlement_asset_id_hex_le: "3486e316c52aec04919d2401a29d880176787059fc94d2b7c5042d02c820e4e4",
    filler_token_asset_id_hex_le: "2c3aa8ae0e199f9609e2e4b60a97a1f4b52c5d76d916b0a51e18ecded3d057b1",
    grantor_collateral_token_asset_id_hex_le: "ba817efa46ffb5dd5b985d2c6657376ceaf748eedfda3f88e273260c18538d73",
    grantor_settlement_token_asset_id_hex_le: "82b7bba397cafbf1918cc8fee11aa636eba97ee4c88a6efe954b90e8a85806ea",
    ratio_args: DCDRatioArguments {
        principal_collateral_amount: 1000,
        interest_collateral_amount: 100,
        total_collateral_amount: 1100,
        principal_asset_amount: 10000,
        interest_asset_amount: 1000,
        total_asset_amount: 11000,
        filler_token_amount: 100,
        grantor_collateral_token_amount: 100,
        grantor_settlement_token_amount: 100,
        filler_per_settlement_collateral: 11,
        filler_per_settlement_asset: 110,
        filler_per_principal_collateral: 10,
        grantor_settlement_per_deposited_asset: 110,
        grantor_collateral_per_deposited_collateral: 1,
        grantor_per_settlement_collateral: 11,
        grantor_per_settlement_asset: 110,
    },
    oracle_public_key: "4d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766",
}'
[Maker] Init order tx result: 71bca4d843e5851aa94106b49f9f28b7c69a754f5b5d8eb7d674aa36abae9890

Check

https://liquid.network/testnet/tx/71bca4d843e5851aa94106b49f9f28b7c69a754f5b5d8eb7d674aa36abae9890

Maker Fund

./simplicity-dex maker fund --filler-utxo 71bca4d843e5851aa94106b49f9f28b7c69a754f5b5d8eb7d674aa36abae9890:0 \
--grant-coll-utxo 71bca4d843e5851aa94106b49f9f28b7c69a754f5b5d8eb7d674aa36abae9890:1 \
--grant-settl-utxo 71bca4d843e5851aa94106b49f9f28b7c69a754f5b5d8eb7d674aa36abae9890:2 \
--settl-asset-utxo e110c17d165e0a2bb9f6931dbfe9d90075e7330a2471b9f3e246265d196f9e6f:1 \
--fee-utxo 9a862c3c2a292df41a274eee19c9af04db4edc7f274463e93945682b4961b4ec:0 \
--taproot-pubkey-gen 87259fcc2da8a92273f0a3305d9a706062b3d1377dd774739e16f7a4f0eae990:027aed3517dd4c6e3cea2d67c16648a9284afc1b154f17fead32152889def8ca3d:tex1p9988q8kfq33m0y6wlsra683rur32k9vx58kqc6cceeks7tccu5yqhkjv7n
Broadcasted txid: cb282465c64ccfc3acbab8bd79080bef34b2b0e5f49595444e623eeee780a26f
[Maker] Creating order, tx_id: cb282465c64ccfc3acbab8bd79080bef34b2b0e5f49595444e623eeee780a26f, event_id: EventId(f2c180ebe26f00d8550c64804170be7da2fa3595452d8dcb319769a67b14bc2d)

Check

https://liquid.network/testnet/tx/cb282465c64ccfc3acbab8bd79080bef34b2b0e5f49595444e623eeee780a26f

nostr-tool -r wss://relay.damus.io list-events --ids f2c180ebe26f00d8550c64804170be7da2fa3595452d8dcb319769a67b14bc2d

Taker fund

./simplicity-dex taker fund --filler-utxo cb282465c64ccfc3acbab8bd79080bef34b2b0e5f49595444e623eeee780a26f:5 \
--coll-utxo 316e81c7f3955856e63a79f9b95d3f5b5d6dc3a9493e6e3054950ae8db351c97:0 \
--coll-amount-deposit 1000 \
--maker-order-event-id f2c180ebe26f00d8550c64804170be7da2fa3595452d8dcb319769a67b14bc2d
[Taker] Tx fund sending result: 0d7affc8d601a4698d0f3e06ac5d63f281be9fa725781aaaf554243866bf8c47, reply event id: b347ac3024a6bfdb8467d54d21f6883f0ca06540c8d2383f8905b57b8d7de309

Check

https://liquid.network/testnet/tx/0d7affc8d601a4698d0f3e06ac5d63f281be9fa725781aaaf554243866bf8c47

nostr-tool -r wss://relay.damus.io list-events --ids b347ac3024a6bfdb8467d54d21f6883f0ca06540c8d2383f8905b57b8d7de309

Taker termination early

./simplicity-dex taker termination-early \
--coll-utxo 0d7affc8d601a4698d0f3e06ac5d63f281be9fa725781aaaf554243866bf8c47:0 \
--filler-utxos 0d7affc8d601a4698d0f3e06ac5d63f281be9fa725781aaaf554243866bf8c47:1 \
--fee-utxo 0d7affc8d601a4698d0f3e06ac5d63f281be9fa725781aaaf554243866bf8c47:2 \
--filler-to-return 25 \
--maker-order-event-id f2c180ebe26f00d8550c64804170be7da2fa3595452d8dcb319769a67b14bc2d
[Taker] Early termination tx result: 5fac0a0b098c4d64bc6d3d7b622ef0dc93c1beae0d84ae89b0527081355f5f2e, reply event id: a181ee0a2e490781f410d5eeac1a045d18ebf209fad3d45608214e4d818398af

Check

https://liquid.network/testnet/tx/5fac0a0b098c4d64bc6d3d7b622ef0dc93c1beae0d84ae89b0527081355f5f2e

nostr-tool -r wss://relay.damus.io list-events --ids a181ee0a2e490781f410d5eeac1a045d18ebf209fad3d45608214e4d818398af

Maker termination collateral

./simplicity-dex maker termination-collateral \
--grant-coll-utxo cb282465c64ccfc3acbab8bd79080bef34b2b0e5f49595444e623eeee780a26f:6 \
--fee-utxo cb282465c64ccfc3acbab8bd79080bef34b2b0e5f49595444e623eeee780a26f:8 \
--coll-utxo cb282465c64ccfc3acbab8bd79080bef34b2b0e5f49595444e623eeee780a26f:3 \
--grantor-coll-burn 50 \
--maker-order-event-id f2c180ebe26f00d8550c64804170be7da2fa3595452d8dcb319769a67b14bc2d
[Maker] Termination collateral tx result: 0f27bb50de1366865c78b5667145831f3cb5c07ecfea806b9b1f948989fda4b7, reply event id: 657a8955c3994de2b470afab9dbe35b374ac883b7a29ae1ce31f8e030713379f

Check

https://liquid.network/testnet/tx/0f27bb50de1366865c78b5667145831f3cb5c07ecfea806b9b1f948989fda4b7

nostr-tool -r wss://relay.damus.io list-events --ids 657a8955c3994de2b470afab9dbe35b374ac883b7a29ae1ce31f8e030713379f

Maker termination settlement

./simplicity-dex maker termination-settlement \
--fee-utxo 0f27bb50de1366865c78b5667145831f3cb5c07ecfea806b9b1f948989fda4b7:4 \
--settl-asset-utxo cb282465c64ccfc3acbab8bd79080bef34b2b0e5f49595444e623eeee780a26f:4 \
--grant-settl-utxo cb282465c64ccfc3acbab8bd79080bef34b2b0e5f49595444e623eeee780a26f:7 \
--grantor-settl-burn 50 \
--maker-order-event-id f2c180ebe26f00d8550c64804170be7da2fa3595452d8dcb319769a67b14bc2d 
[Maker] Termination settlement tx result: b98a8548ffe9494a296f01cda896c52e8e9f8a5a4cd89d009097ec3a746a7284,  reply event id: bdf0a2c071e08cbf85340bc475773a303ecfb5b483e2ce27d1e3f64b8eb3d50e

Check

https://liquid.network/testnet/tx/b98a8548ffe9494a296f01cda896c52e8e9f8a5a4cd89d009097ec3a746a7284

nostr-tool -r wss://relay.damus.io list-events --ids bdf0a2c071e08cbf85340bc475773a303ecfb5b483e2ce27d1e3f64b8eb3d50e

Example Run 2

Prepare

./simplicity-dex helpers mint-tokens --reissue-asset-utxo e110c17d165e0a2bb9f6931dbfe9d90075e7330a2471b9f3e246265d196f9e6f:0  --fee-utxo 1ba06a4308b5c2015887c637267bebeb1359f32547ee4f7b242127cb2aecc747:1 --asset-name "testtt"
Minting asset: '3486e316c52aec04919d2401a29d880176787059fc94d2b7c5042d02c820e4e4', Reissue asset id: '3c341dd8e07531221d0e1fcd40260d10a3778393f3c6829fbdb0aee594effbc2'
Broadcasted txid: c6fcc8ffbdca9f0713705ec72d1c35f866d09ad2f6897a2c7664ae7d36e5fa4e
Asset minting -- done
./simplicity-dex helpers split-native-three --fee-utxo 436eee9aed16e1ce6c3554b1bfe7f32bd1e99fb484d0dc4295d76b3a46db4c56:0 --split-amount 25000
Broadcasted txid: 594f4f54788705a9df5e203042f19ef6536491985a230d290e726f1fe60db868
Split utxo result tx_id: 594f4f54788705a9df5e203042f19ef6536491985a230d290e726f1fe60db868

Maker init

./simplicity-dex maker init --utxo-1 594f4f54788705a9df5e203042f19ef6536491985a230d290e726f1fe60db868:0 \
--utxo-2 594f4f54788705a9df5e203042f19ef6536491985a230d290e726f1fe60db868:1 \
--utxo-3 594f4f54788705a9df5e203042f19ef6536491985a230d290e726f1fe60db868:2 \
--taker-funding-start-time 1764147742 \
--taker-funding-end-time 1764157742 \
--contract-expiry-time 1764158742 \
--early-termination-end-time 1764158742 \
--settlement-height 2196600 \
--principal-collateral-amount 1000 \
--incentive-basis-points 1000 \
--filler-per-principal-collateral 10 \
--strike-price 20 \
--settlement-asset-entropy c9ec346b74e1030bf2d1d000c5a996daa7ef2ebe85a7a6fa51aedee953eecdf0
Filler_token_entropy: '9b09308f6e37d31dcd5e7976d967c41ba4f0797d22aaf3f4926d536a58721c8d', grantor_collateral_entropy: '24d544e9f008b904742a566cf9a0170b713f16931fce61dfc38bd99134785767', grantor_settlement: '3c0dffa272f56165cc2cbc226b342ea441cc5914bf36c49dd480269eeb435ae5', taproot_pubkey: '3f9be5af32686f1e10971e6e9b0e852865140259a1fc68c2be3f79d62c40e6e9:021c8f9b0b6aea38ce42e2334b1543f862754b90c4db8afc3abb9bac8e9d530d90:tex1pg9jucrqtstdpyeulm674rhrxr49ax99cfvlxdsvx8us6zd0nvv6seqjdxl', dcd_args: 'DCDArguments {
    taker_funding_start_time: 1764147742,
    taker_funding_end_time: 1764157742,
    contract_expiry_time: 1764158742,
    early_termination_end_time: 1764158742,
    settlement_height: 2196600,
    strike_price: 20,
    incentive_basis_points: 1000,
    fee_basis_points: 0,
    collateral_asset_id_hex_le: "144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49",
    settlement_asset_id_hex_le: "3486e316c52aec04919d2401a29d880176787059fc94d2b7c5042d02c820e4e4",
    filler_token_asset_id_hex_le: "fc07ee1355ce8a1aa5d7823a8021f38c666d395f0efdc3e2cfd05c6174a458da",
    grantor_collateral_token_asset_id_hex_le: "2cfbfe94b69c42f307ea7a7a6fc3a7e9b9133af5a59b23a18a624b8291ba53e5",
    grantor_settlement_token_asset_id_hex_le: "53d66249ead130643643341f7fb6fc0a11f24ab828af08c0fd22b07885bf0f09",
    ratio_args: DCDRatioArguments {
        principal_collateral_amount: 1000,
        interest_collateral_amount: 100,
        total_collateral_amount: 1100,
        principal_asset_amount: 20000,
        interest_asset_amount: 2000,
        total_asset_amount: 22000,
        filler_token_amount: 100,
        grantor_collateral_token_amount: 100,
        grantor_settlement_token_amount: 100,
        filler_per_settlement_collateral: 11,
        filler_per_settlement_asset: 220,
        filler_per_principal_collateral: 10,
        grantor_settlement_per_deposited_asset: 220,
        grantor_collateral_per_deposited_collateral: 1,
        grantor_per_settlement_collateral: 11,
        grantor_per_settlement_asset: 220,
    },
    oracle_public_key: "4d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766",
}'
Broadcasted txid: ac5ee080f23fb2b0d43ac8b49e32e2070a46242ca6d688b399032a011676e902
[Maker] Init order tx result: ac5ee080f23fb2b0d43ac8b49e32e2070a46242ca6d688b399032a011676e902

Maker fund

./simplicity-dex maker fund --filler-utxo ac5ee080f23fb2b0d43ac8b49e32e2070a46242ca6d688b399032a011676e902:0 \
--grant-coll-utxo ac5ee080f23fb2b0d43ac8b49e32e2070a46242ca6d688b399032a011676e902:1 \
--grant-settl-utxo ac5ee080f23fb2b0d43ac8b49e32e2070a46242ca6d688b399032a011676e902:2 \
--settl-asset-utxo c6fcc8ffbdca9f0713705ec72d1c35f866d09ad2f6897a2c7664ae7d36e5fa4e:1 \
--fee-utxo ac5ee080f23fb2b0d43ac8b49e32e2070a46242ca6d688b399032a011676e902:3 \
--taproot-pubkey-gen 3f9be5af32686f1e10971e6e9b0e852865140259a1fc68c2be3f79d62c40e6e9:021c8f9b0b6aea38ce42e2334b1543f862754b90c4db8afc3abb9bac8e9d530d90:tex1pg9jucrqtstdpyeulm674rhrxr49ax99cfvlxdsvx8us6zd0nvv6seqjdxl
Broadcasted txid: 014429bfec246d85dbaa352df2fa76a59cfbfce9a65c81dcbf101d45eec70890
[Maker] Creating order, tx_id: 014429bfec246d85dbaa352df2fa76a59cfbfce9a65c81dcbf101d45eec70890, event_id: EventId(c7eb27af6d7f5723888437d70e6cf3c1d4234cedc78e9031668d637a71e0d0e9)

Taker fund

./simplicity-dex taker fund --filler-utxo 014429bfec246d85dbaa352df2fa76a59cfbfce9a65c81dcbf101d45eec70890:5 \
--coll-utxo 05547088d877a58ecd3fe487ddccf3635005c9e7504bfe64de5fc5d76fbe71b9:0 \
--coll-amount-deposit 1000 \
--maker-order-event-id c7eb27af6d7f5723888437d70e6cf3c1d4234cedc78e9031668d637a71e0d0e9
[Taker] Tx fund sending result: f21d032d36721f2c0a188de7e7229aecadabd788fc030ee79732aeefe0003361, reply event id: 30bdbf8243a12d8a842a8160a537c599c37088d469fb78461fb02fa5637d6632

Maker settlement

Taker settlement

@ikripaka ikripaka self-assigned this Nov 19, 2025
@ikripaka ikripaka marked this pull request as draft November 19, 2025 11:09
@ikripaka ikripaka force-pushed the feature/contract_impl branch 2 times, most recently from c40a36c to 9503f02 Compare November 26, 2025 15:39
@KyrylR KyrylR marked this pull request as ready for review December 1, 2025 11:35
@KyrylR KyrylR force-pushed the feature/contract_impl branch from 92eb7d5 to b1680d0 Compare December 1, 2025 11:39
Copy link
Collaborator

@KyrylR KyrylR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b1680d0

@KyrylR KyrylR merged commit 1d1ec0e into main Dec 1, 2025
1 check passed
@KyrylR KyrylR deleted the feature/contract_impl branch December 1, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants