Skip to main content

CLI for interacting with the TUSDT ink! smart contract system on subtensor(bittensor)

Project description

tusdt-cli

Command-line interface for the TUSDT stablecoin system — a set of ink! smart contracts deployed on the Bittensor (subtensor) network. TUSDT lets users lock native TAO tokens as collateral in vaults to mint a USD-pegged stablecoin. This CLI gives you full control over:

  • Vaults — create, deposit collateral, borrow TUSDT, repay, and release collateral
  • Token — check balances, transfer TUSDT, and manage spending approvals
  • Auctions — browse and bid on liquidation auctions for under-collateralised vaults
  • Oracle — inspect the on-chain price feed that determines collateral ratios

No web UI required — everything runs from your terminal.

Installation

pip install tusdt-cli

Local Development Installation

git clone https://github.com/TensorUSD/tusdt-cli
cd tusdt-cli
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .

Or using uv:

git clone https://github.com/TensorUSD/tusdt-cli
cd tusdt-cli
uv sync

Quickstart

The CLI comes pre-configured with the Finney RPC endpoint, contract addresses, and bundled ABI metadata. No upfront configuration is required — pass --wallet-name on any command that needs signing.

# Check CLI version
tusdt --version

# Get help for any command
tusdt --help
tusdt vault --help
tusdt vault create --help

1. List wallets

tusdt wallet list

2. Vault operations

Anywhere an address is expected you can pass a wallet name via --wallet-name and the CLI resolves the SS58 address from coldkeypub.txt automatically or use --owner and supply ss58 address

# Create a vault with 10 TAO as collateral (prompts for coldkey password)
tusdt vault create --amount 10 --wallet-name MyWallet

# View vault #0 (no password needed – reads coldkeypub.txt)
#                ↓vault ID
tusdt vault info 0 --wallet-name MyWallet
tusdt vault info 0 --owner 5GrwvaEF...

# List all vaults for a wallet
tusdt vault list --wallet-name MyWallet
tusdt vault list --owner 5GrwvaEF...

# Add 5 TAO collateral to vault #0
#                          ↓vault ID
tusdt vault add-collateral 0 --amount 5 --wallet-name MyWallet

# Borrow 100 TUSDT from vault #0
#                  ↓vaultID ↓TUSDT amount
tusdt vault borrow 0        100 --wallet-name MyWallet

# Repay 50 TUSDT to vault #0
#                 ↓vault ID ↓TUSDT amount
tusdt vault repay 0         50 --wallet-name MyWallet

# Release 2 TAO collateral from vault #0
#                              ↓vaultID ↓TAO amount
tusdt vault release-collateral 0        2 --wallet-name MyWallet

# Check max borrow capacity for vault #0
#                      ↓vault ID
tusdt vault max-borrow 0 --wallet-name MyWallet

# Check collateral value for vault #0
#                            ↓vault ID
tusdt vault collateral-value 0 --wallet-name MyWallet

3. Token operations

# Check balance (wallet name or SS58 address)
tusdt token balance --wallet-name MyWallet
tusdt token balance --owner 5GrwvaEF...

# Transfer 100 TUSDT to another wallet
#                    ↓recipient (wallet name or SS58)  ↓TUSDT amount
tusdt token transfer RecipientWallet                  100 --wallet-name MyWallet

# Approve a spender to use up to 1000 of your TUSDT
#                   ↓spender(wallet name or SS58) ↓TUSDT amount
tusdt token approve SpenderWallet                 1000 --wallet-name MyWallet

# Check allowance (spender wallet name or SS58 address)
#                     ↓spender
tusdt token allowance SpenderWallet --wallet-name MyWallet
tusdt token allowance SpenderWallet --owner 5GrwvaEF...

4. Auction operations

# List active liquidation auctions
tusdt auction list-active

# View auction details
#                ↓ auction ID
tusdt auction info 0

# Place a 500 TUSDT bid on auction #0
#                 ↓auctionID ↓TUSDT bid amount
tusdt auction bid 0          500 --wallet-name MyWallet --wallet-hotkey default

# Finalize a completed auction
#                      ↓ auction ID
tusdt auction finalize 0 --wallet-name MyWallet

# Withdraw refund for a non-winning bid
#                             ↓auctionID ↓bid ID
tusdt auction withdraw-refund 0          1 --wallet-name MyWallet

# Check your bid on auction #0 (no password, reads coldkeypub.txt)
#                    ↓ auction ID
tusdt auction my-bid 0 --wallet-name MyWallet

5. Oracle operations

# View latest price
tusdt oracle price

# View current round
tusdt oracle round

Network selection

Two networks are available: finney (mainnet, default) and testnet.

# Per-command override (not saved)
tusdt vault list --wallet-name MyWallet --network testnet
tusdt oracle price --network testnet

# Save as default
tusdt config set --network testnet

# Switch back
tusdt config set --network finney

Configuration

Configuration is stored in ~/.tusdt-cli/config.json. Most users won't need to edit it — --wallet-name and --network on each command cover the common cases.

# View current config
tusdt config show

# Pre-configure a wallet (avoids passing --wallet-name every time)
tusdt config set --wallet-name MyWallet

# Use a mnemonic seed phrase instead
tusdt config set --signer "word1 word2 word3 ... word12"

# Override contract addresses or RPC
tusdt config set --rpc wss://custom-endpoint:443
tusdt config set --vault 5Hh...
Key Description Default
network Active network preset finney
rpc WebSocket RPC endpoint wss://entrypoint-finney.opentensor.ai:443
vault_address Vault contract SS58 address 5HhJKNf7XjmppAyPeBKN5xQk6joNMWHTnEgup4msxfcKcYKp
token_address Token (ERC-20) contract SS58 address 5GGqBAYWW84wvdTeZGM68dHng1UaWTxxc4ZzFhuQXF9zqK9J
auction_address Auction contract SS58 address 5Cninzamn4GVi1J1St578ENyNEDrMi5hXucY7rUj1WzREgAt
oracle_address Oracle contract SS58 address 5FqciR795agP8wEojv2TRegwN757EJURyzjDREUvzCX3cqZS
vault_metadata Path to vault ABI JSON bundled
token_metadata Path to token ABI JSON bundled
auction_metadata Path to auction ABI JSON bundled
oracle_metadata Path to oracle ABI JSON bundled
signer Mnemonic seed phrase or keyfile path
wallet_name Default bittensor wallet name
wallet_hotkey Default hotkey name default
wallet_path Path to wallets directory ~/.bittensor/wallets
decimals Decimal places for balance display 9

Networks

Network RPC endpoint
finney wss://entrypoint-finney.opentensor.ai:443
testnet wss://test.finney.opentensor.ai:443

Transaction output

All write operations (create vault, borrow, transfer, bid, etc.) display a progress spinner and, on success, print the extrinsic hash with a Taostats explorer link:

Finalized
┌─ Transaction ──────────────────────────────────────────────────┐
│  Extrinsic: 0xabc123…                                          │
│  Block: 0xdef456…                                              │
│  Explorer: https://taostats.io/hash/0xabc…?network=finney      │
└────────────────────────────────────────────────────────────────┘

The network parameter in the URL matches the --network flag (or the configured default).

Contributing

Contributions are welcome. To get started:

  1. Fork the repository and clone your fork
  2. Install in development mode: pip install -e . (or uv sync)
  3. Create a branch for your change: git checkout -b my-feature
  4. Make your changes and test locally
  5. Submit a pull request against main

Please keep pull requests focused — one feature or fix per PR.

Repositories

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tusdt_cli-0.1.3.tar.gz (145.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tusdt_cli-0.1.3-py3-none-any.whl (56.4 kB view details)

Uploaded Python 3

File details

Details for the file tusdt_cli-0.1.3.tar.gz.

File metadata

  • Download URL: tusdt_cli-0.1.3.tar.gz
  • Upload date:
  • Size: 145.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for tusdt_cli-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1d33bf669d41d92efd6f530b5f275cbcb27c2cfa8c9e55b8eb6b1eebdb183b6e
MD5 ed8dab248f062a4ad5d89760cc57cc1c
BLAKE2b-256 e3a20dedffb79b005d53bd9bcdebad1c821aad4287c8ea14aa8222f64beddc36

See more details on using hashes here.

File details

Details for the file tusdt_cli-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: tusdt_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 56.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for tusdt_cli-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d14ab73a138e5c24606d49fc032ac67e7082a73fd9697c3bfbcafbade3c7c123
MD5 096b3b84d75f17b4b6e4c66bfd47ab63
BLAKE2b-256 be6b5dbca2ff1a388702124b36810bdb4bc7fdbfd29a3515940e7bf4621e0157

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page