tusdt-cli 0.3.0__tar.gz → 0.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/PKG-INFO +1 -1
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/pyproject.toml +1 -1
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/__init__.py +1 -1
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/client.py +25 -9
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/commands/auction.py +9 -2
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/commands/governance.py +44 -19
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/commands/oracle.py +3 -2
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/commands/vault.py +24 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/config.py +7 -7
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/.gitignore +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/LICENSE +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/README.md +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/requirements.txt +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/abi/tusdt_auction.json +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/abi/tusdt_election.json +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/abi/tusdt_erc20.json +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/abi/tusdt_governance.json +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/abi/tusdt_oracle.json +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/abi/tusdt_treasury.json +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/abi/tusdt_vault.json +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/cli.py +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/commands/__init__.py +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/commands/election.py +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/commands/token.py +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/commands/treasury.py +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/utils.py +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/src/tusdt_cli/wallet.py +0 -0
- {tusdt_cli-0.3.0 → tusdt_cli-0.3.5}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tusdt-cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: CLI for interacting with the TUSDT ink! smart contract system on subtensor(bittensor)
|
|
5
5
|
Project-URL: Homepage, https://github.com/tensorusd/tusdt-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/tensorusd/tusdt-cli
|
|
@@ -488,8 +488,17 @@ class TUSDTClient:
|
|
|
488
488
|
keypair: Keypair,
|
|
489
489
|
params: dict[str, Any],
|
|
490
490
|
) -> dict[str, Any]:
|
|
491
|
-
"""Schedule a contract parameter update with timelock.
|
|
492
|
-
|
|
491
|
+
"""Schedule a contract parameter update with timelock.
|
|
492
|
+
|
|
493
|
+
Reads current on-chain params, merges with user-supplied changes,
|
|
494
|
+
and sends the complete 11-field VaultContractParamsConfig struct.
|
|
495
|
+
"""
|
|
496
|
+
current = unwrap_plain(self._read(self.vault, keypair, "get_contract_params"))
|
|
497
|
+
if not isinstance(current, dict):
|
|
498
|
+
raise ContractError(f"Expected dict from get_contract_params, got {type(current).__name__}")
|
|
499
|
+
merged = dict(current)
|
|
500
|
+
merged.update(params)
|
|
501
|
+
return self._exec(self.vault, keypair, "set_contract_params", args={"params": merged})
|
|
493
502
|
|
|
494
503
|
def execute_params_update(self, keypair: Keypair) -> dict[str, Any]:
|
|
495
504
|
"""Execute the pending contract parameter update after timelock."""
|
|
@@ -594,8 +603,17 @@ class TUSDTClient:
|
|
|
594
603
|
return self._exec(self.governance, keypair, "set_council", args={"members": members})
|
|
595
604
|
|
|
596
605
|
def gov_vault_set_contract_params(self, keypair: Keypair, params: dict) -> dict[str, Any]:
|
|
597
|
-
"""Schedule a vault contract parameter update via governance.
|
|
598
|
-
|
|
606
|
+
"""Schedule a vault contract parameter update via governance.
|
|
607
|
+
|
|
608
|
+
Reads current on-chain params from the vault, merges with user-supplied
|
|
609
|
+
changes, and sends the complete 11-field struct via governance forwarder.
|
|
610
|
+
"""
|
|
611
|
+
current = unwrap_plain(self._read(self.vault, keypair, "get_contract_params"))
|
|
612
|
+
if not isinstance(current, dict):
|
|
613
|
+
raise ContractError(f"Expected dict from get_contract_params, got {type(current).__name__}")
|
|
614
|
+
merged = dict(current)
|
|
615
|
+
merged.update(params)
|
|
616
|
+
return self._exec(self.governance, keypair, "vault_set_contract_params", args={"params": merged})
|
|
599
617
|
|
|
600
618
|
def gov_vault_cancel_update(self, keypair: Keypair) -> dict[str, Any]:
|
|
601
619
|
"""Cancel a pending vault contract parameter update via governance."""
|
|
@@ -939,7 +957,7 @@ class TUSDTClient:
|
|
|
939
957
|
debt_balance: int,
|
|
940
958
|
min_bid: int,
|
|
941
959
|
liquidation_price: int,
|
|
942
|
-
duration_ms: int,
|
|
960
|
+
duration_ms: int | None = None,
|
|
943
961
|
) -> dict[str, Any]:
|
|
944
962
|
"""Create a new liquidation auction (controller only)."""
|
|
945
963
|
return self._exec(
|
|
@@ -952,10 +970,8 @@ class TUSDTClient:
|
|
|
952
970
|
"collateral_balance": collateral_balance,
|
|
953
971
|
"debt_balance": debt_balance,
|
|
954
972
|
"min_bid": min_bid,
|
|
955
|
-
|
|
956
|
-
"
|
|
957
|
-
# Option<u64> — must be explicitly wrapped in Some
|
|
958
|
-
"duration_ms": {"Some": duration_ms},
|
|
973
|
+
"liquidation_price": liquidation_price,
|
|
974
|
+
"duration_ms": duration_ms,
|
|
959
975
|
},
|
|
960
976
|
)
|
|
961
977
|
|
|
@@ -729,7 +729,12 @@ def auction_admin_cmd(ctx: click.Context, network: str | None) -> None:
|
|
|
729
729
|
@click.option(
|
|
730
730
|
"--liquidation-price", type=int, required=True, help="Liquidation price as raw integer (10^18 scale)"
|
|
731
731
|
)
|
|
732
|
-
@click.option(
|
|
732
|
+
@click.option(
|
|
733
|
+
"--duration-ms",
|
|
734
|
+
type=int,
|
|
735
|
+
default=None,
|
|
736
|
+
help="Auction duration in milliseconds (uses contract default if omitted)",
|
|
737
|
+
)
|
|
733
738
|
@_wallet_option
|
|
734
739
|
@_network_option
|
|
735
740
|
@click.pass_context
|
|
@@ -741,7 +746,7 @@ def create_auction_cmd(
|
|
|
741
746
|
debt_balance: str,
|
|
742
747
|
min_bid: str,
|
|
743
748
|
liquidation_price: int,
|
|
744
|
-
duration_ms: int,
|
|
749
|
+
duration_ms: int | None,
|
|
745
750
|
wallet_name: str | None,
|
|
746
751
|
network: str | None,
|
|
747
752
|
) -> None:
|
|
@@ -766,11 +771,13 @@ def create_auction_cmd(
|
|
|
766
771
|
vault_owner = resolve_ss58(vault_owner, config.get("wallet_path"))
|
|
767
772
|
except Exception as exc:
|
|
768
773
|
print_error(str(exc))
|
|
774
|
+
return
|
|
769
775
|
|
|
770
776
|
try:
|
|
771
777
|
keypair = get_signer_keypair(config)
|
|
772
778
|
except Exception as exc:
|
|
773
779
|
print_error(str(exc))
|
|
780
|
+
return
|
|
774
781
|
|
|
775
782
|
print_info(f"Signer: {keypair.ss58_address}")
|
|
776
783
|
print_info(f"Creating auction for vault {vault_id} (owner: {vault_owner})...")
|
|
@@ -292,11 +292,11 @@ def get_snapshot(ctx: click.Context, epoch: int, network: str | None) -> None:
|
|
|
292
292
|
@_network_option
|
|
293
293
|
@click.pass_context
|
|
294
294
|
def quorum(ctx: click.Context, epoch: int, network: str | None) -> None:
|
|
295
|
-
"""Show quorum
|
|
295
|
+
"""Show the absolute quorum threshold for a given epoch.
|
|
296
296
|
|
|
297
297
|
\b
|
|
298
298
|
EPOCH is the epoch number to query (integer).
|
|
299
|
-
Returns
|
|
299
|
+
Returns the minimum yes-vote balance required for a proposal to pass.
|
|
300
300
|
Examples:
|
|
301
301
|
tusdt governance quorum 42
|
|
302
302
|
tusdt governance quorum 42 --network testnet
|
|
@@ -312,18 +312,13 @@ def quorum(ctx: click.Context, epoch: int, network: str | None) -> None:
|
|
|
312
312
|
print_error(str(exc))
|
|
313
313
|
return
|
|
314
314
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
"No": format_balance(result[1], decimals),
|
|
323
|
-
},
|
|
324
|
-
)
|
|
325
|
-
else:
|
|
326
|
-
print_dict(f"Quorum – Epoch {epoch}", {"Raw": result})
|
|
315
|
+
print_dict(
|
|
316
|
+
f"Quorum – Epoch {epoch}",
|
|
317
|
+
{
|
|
318
|
+
"Quorum (raw)": result,
|
|
319
|
+
"Quorum": format_balance(result, decimals),
|
|
320
|
+
},
|
|
321
|
+
)
|
|
327
322
|
|
|
328
323
|
|
|
329
324
|
# ------------------------------------------------------------------
|
|
@@ -625,6 +620,21 @@ def set_council_cmd(
|
|
|
625
620
|
@click.option(
|
|
626
621
|
"--transaction-fee", type=int, default=None, help="Transaction fee in basis points (e.g. 3 for 0.03%)"
|
|
627
622
|
)
|
|
623
|
+
@click.option(
|
|
624
|
+
"--min-vault-collateral", type=str, default=None, help="Minimum vault collateral in human-readable units"
|
|
625
|
+
)
|
|
626
|
+
@click.option(
|
|
627
|
+
"--max-vault-collateral",
|
|
628
|
+
type=str,
|
|
629
|
+
default=None,
|
|
630
|
+
help="Maximum per-vault collateral in human-readable units",
|
|
631
|
+
)
|
|
632
|
+
@click.option(
|
|
633
|
+
"--max-total-collateral",
|
|
634
|
+
type=str,
|
|
635
|
+
default=None,
|
|
636
|
+
help="Maximum total collateral across all vaults in human-readable units",
|
|
637
|
+
)
|
|
628
638
|
@_wallet_option
|
|
629
639
|
@_network_option
|
|
630
640
|
@click.pass_context
|
|
@@ -638,6 +648,9 @@ def gov_vault_set_params_cmd(
|
|
|
638
648
|
auction_duration_ms: int | None,
|
|
639
649
|
max_oracle_age_ms: int | None,
|
|
640
650
|
transaction_fee: int | None,
|
|
651
|
+
min_vault_collateral: str | None,
|
|
652
|
+
max_vault_collateral: str | None,
|
|
653
|
+
max_total_collateral: str | None,
|
|
641
654
|
wallet_name: str | None,
|
|
642
655
|
network: str | None,
|
|
643
656
|
) -> None:
|
|
@@ -671,6 +684,12 @@ def gov_vault_set_params_cmd(
|
|
|
671
684
|
params["max_oracle_age_ms"] = max_oracle_age_ms
|
|
672
685
|
if transaction_fee is not None:
|
|
673
686
|
params["transaction_fee"] = transaction_fee
|
|
687
|
+
if min_vault_collateral is not None:
|
|
688
|
+
params["min_vault_collateral"] = parse_balance(min_vault_collateral, decimals)
|
|
689
|
+
if max_vault_collateral is not None:
|
|
690
|
+
params["max_vault_collateral"] = parse_balance(max_vault_collateral, decimals)
|
|
691
|
+
if max_total_collateral is not None:
|
|
692
|
+
params["max_total_collateral"] = parse_balance(max_total_collateral, decimals)
|
|
674
693
|
|
|
675
694
|
if not params:
|
|
676
695
|
print_error("Provide at least one parameter to update")
|
|
@@ -1203,7 +1222,10 @@ def gov_auction_set_admin_cmd(
|
|
|
1203
1222
|
"--approval-bps", type=int, required=True, help="Approval threshold in basis points (e.g., 5001 for >50%)"
|
|
1204
1223
|
)
|
|
1205
1224
|
@click.option(
|
|
1206
|
-
"--min-proposer-stake",
|
|
1225
|
+
"--min-proposer-stake",
|
|
1226
|
+
type=str,
|
|
1227
|
+
required=True,
|
|
1228
|
+
help="Minimum subnet alpha stake in human-readable units (e.g. 1000.0)",
|
|
1207
1229
|
)
|
|
1208
1230
|
@click.option(
|
|
1209
1231
|
"--submission-open-day", type=int, required=True, help="First day of month proposals are accepted (1-28)"
|
|
@@ -1222,7 +1244,7 @@ def update_params_cmd(
|
|
|
1222
1244
|
voting_period_ms: int,
|
|
1223
1245
|
quorum_bps: int,
|
|
1224
1246
|
approval_bps: int,
|
|
1225
|
-
min_proposer_stake:
|
|
1247
|
+
min_proposer_stake: str,
|
|
1226
1248
|
submission_open_day: int,
|
|
1227
1249
|
submission_close_day: int,
|
|
1228
1250
|
) -> None:
|
|
@@ -1231,11 +1253,14 @@ def update_params_cmd(
|
|
|
1231
1253
|
\b
|
|
1232
1254
|
All six parameters are required.
|
|
1233
1255
|
Examples:
|
|
1234
|
-
tusdt governance update-params --voting-period-ms 172800000 --quorum-bps 2000 --approval-bps 5001 --min-proposer-stake
|
|
1256
|
+
tusdt governance update-params --voting-period-ms 172800000 --quorum-bps 2000 --approval-bps 5001 --min-proposer-stake 1000.0 --submission-open-day 1 --submission-close-day 7 --wallet-name MyWallet
|
|
1235
1257
|
"""
|
|
1236
1258
|
config = load_config(network=network)
|
|
1237
1259
|
if wallet_name:
|
|
1238
1260
|
config["wallet_name"] = wallet_name
|
|
1261
|
+
decimals = config.get("decimals", 9)
|
|
1262
|
+
|
|
1263
|
+
raw_min_stake = parse_balance(min_proposer_stake, decimals)
|
|
1239
1264
|
|
|
1240
1265
|
try:
|
|
1241
1266
|
keypair = get_signer_keypair(config)
|
|
@@ -1245,7 +1270,7 @@ def update_params_cmd(
|
|
|
1245
1270
|
|
|
1246
1271
|
print_info(f"Signer: {keypair.ss58_address}")
|
|
1247
1272
|
print_info(
|
|
1248
|
-
f"Updating governance parameters: voting_period_ms={voting_period_ms}, quorum_bps={quorum_bps}, approval_bps={approval_bps}, min_proposer_stake={
|
|
1273
|
+
f"Updating governance parameters: voting_period_ms={voting_period_ms}, quorum_bps={quorum_bps}, approval_bps={approval_bps}, min_proposer_stake={raw_min_stake}, submission_open_day={submission_open_day}, submission_close_day={submission_close_day}"
|
|
1249
1274
|
)
|
|
1250
1275
|
|
|
1251
1276
|
try:
|
|
@@ -1255,7 +1280,7 @@ def update_params_cmd(
|
|
|
1255
1280
|
voting_period_ms,
|
|
1256
1281
|
quorum_bps,
|
|
1257
1282
|
approval_bps,
|
|
1258
|
-
|
|
1283
|
+
raw_min_stake,
|
|
1259
1284
|
submission_open_day,
|
|
1260
1285
|
submission_close_day,
|
|
1261
1286
|
)
|
|
@@ -243,6 +243,7 @@ def commit_round(
|
|
|
243
243
|
keypair = get_signer_keypair(config)
|
|
244
244
|
except Exception as exc:
|
|
245
245
|
print_error(str(exc))
|
|
246
|
+
return
|
|
246
247
|
|
|
247
248
|
print_info(f"Signer: {keypair.ss58_address}")
|
|
248
249
|
if raw_override is not None:
|
|
@@ -488,7 +489,7 @@ def summary(ctx: click.Context, network: str | None) -> None:
|
|
|
488
489
|
|
|
489
490
|
|
|
490
491
|
# ------------------------------------------------------------------
|
|
491
|
-
#
|
|
492
|
+
# get-netuid
|
|
492
493
|
# ------------------------------------------------------------------
|
|
493
494
|
|
|
494
495
|
|
|
@@ -730,7 +731,7 @@ def commit_round_gov(
|
|
|
730
731
|
|
|
731
732
|
|
|
732
733
|
@oracle_group.command("set-netuid")
|
|
733
|
-
@click.argument("netuid", type=
|
|
734
|
+
@click.argument("netuid", type=click.IntRange(min=0, max=65535), metavar="<netuid>")
|
|
734
735
|
@_wallet_option
|
|
735
736
|
@_network_option
|
|
736
737
|
@click.pass_context
|
|
@@ -1190,6 +1190,21 @@ def unpause_contract(ctx: click.Context, wallet_name: str | None, network: str |
|
|
|
1190
1190
|
@click.option(
|
|
1191
1191
|
"--transaction-fee", type=int, default=None, help="Transaction fee in basis points (e.g. 3 for 0.03%%)"
|
|
1192
1192
|
)
|
|
1193
|
+
@click.option(
|
|
1194
|
+
"--min-vault-collateral", type=str, default=None, help="Minimum vault collateral in human-readable units"
|
|
1195
|
+
)
|
|
1196
|
+
@click.option(
|
|
1197
|
+
"--max-vault-collateral",
|
|
1198
|
+
type=str,
|
|
1199
|
+
default=None,
|
|
1200
|
+
help="Maximum per-vault collateral in human-readable units",
|
|
1201
|
+
)
|
|
1202
|
+
@click.option(
|
|
1203
|
+
"--max-total-collateral",
|
|
1204
|
+
type=str,
|
|
1205
|
+
default=None,
|
|
1206
|
+
help="Maximum total collateral across all vaults in human-readable units",
|
|
1207
|
+
)
|
|
1193
1208
|
@_wallet_option
|
|
1194
1209
|
@_network_option
|
|
1195
1210
|
@click.pass_context
|
|
@@ -1203,6 +1218,9 @@ def set_params(
|
|
|
1203
1218
|
auction_duration_ms: int | None,
|
|
1204
1219
|
max_oracle_age_ms: int | None,
|
|
1205
1220
|
transaction_fee: int | None,
|
|
1221
|
+
min_vault_collateral: str | None,
|
|
1222
|
+
max_vault_collateral: str | None,
|
|
1223
|
+
max_total_collateral: str | None,
|
|
1206
1224
|
wallet_name: str | None,
|
|
1207
1225
|
network: str | None,
|
|
1208
1226
|
) -> None:
|
|
@@ -1236,6 +1254,12 @@ def set_params(
|
|
|
1236
1254
|
params["max_oracle_age_ms"] = max_oracle_age_ms
|
|
1237
1255
|
if transaction_fee is not None:
|
|
1238
1256
|
params["transaction_fee"] = transaction_fee
|
|
1257
|
+
if min_vault_collateral is not None:
|
|
1258
|
+
params["min_vault_collateral"] = parse_balance(min_vault_collateral, decimals)
|
|
1259
|
+
if max_vault_collateral is not None:
|
|
1260
|
+
params["max_vault_collateral"] = parse_balance(max_vault_collateral, decimals)
|
|
1261
|
+
if max_total_collateral is not None:
|
|
1262
|
+
params["max_total_collateral"] = parse_balance(max_total_collateral, decimals)
|
|
1239
1263
|
|
|
1240
1264
|
if not params:
|
|
1241
1265
|
print_error("Provide at least one parameter to update")
|
|
@@ -16,13 +16,13 @@ _ABI_DIR = Path(__file__).resolve().parent / "abi"
|
|
|
16
16
|
NETWORKS: dict[str, dict[str, str]] = {
|
|
17
17
|
"finney": {
|
|
18
18
|
"rpc": "wss://entrypoint-finney.opentensor.ai:443",
|
|
19
|
-
"vault_address": "
|
|
20
|
-
"token_address": "
|
|
21
|
-
"auction_address": "
|
|
22
|
-
"oracle_address": "
|
|
23
|
-
"governance_address": "
|
|
24
|
-
"treasury_address": "
|
|
25
|
-
"election_address": "
|
|
19
|
+
"vault_address": "5F8ykW4bse6kUHi65XqAzSfrrgKHDXXEBoReUZmUVc7r8q3A",
|
|
20
|
+
"token_address": "5GjL2MKErF9ocXZBZZFueoWgf8wAnY1gcgLkDMj2bTsAsg6g",
|
|
21
|
+
"auction_address": "5Djyz3DAsL6HyZGBFKNK7fdaMP2Q21hn5sdPhigpHdcfGZ1a",
|
|
22
|
+
"oracle_address": "5GcaftCj1psi5489Dp8RiL5UmMsbRMf9XsfNrDMMsfM5hFoB",
|
|
23
|
+
"governance_address": "5Dg67UzxqncU4UVGtviQhuQ12Dy23oBGd9TCNF9YWy2t6KFR",
|
|
24
|
+
"treasury_address": "5FBcioi6uRMNPMyVZDQSb6BD3JwGjaZs8mkPeSp6JLxNfLgq",
|
|
25
|
+
"election_address": "5CYCj8LcCpZqQ9dgBpwQZsVWsmcstBu1TWqyg68N2kU6TWtr",
|
|
26
26
|
},
|
|
27
27
|
"testnet": {
|
|
28
28
|
"rpc": "wss://test.finney.opentensor.ai:443",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|