agentleFS
BofAIBofAI/skills/usdd-skill/SKILL.md

USDD / JUST Protocol

Skill154 starsChanged 3 months agoMITView on GitHub

USDD stablecoin operations — PSM swaps (buyGem/sellGem), vault position queries, and balance checks via the JUST Protocol on TRON.

  • Installs packages

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always dry-run before PSM swaps: Verify amounts and token directions.

    line 158
  2. Distinctive:

    Check PSM reserves before swapping: If USDT reserves are low, buyGem may fail.

    line 159
  3. Distinctive:

    Verify CDP IDs: Always confirm the CDP ID and owner before acting on position data.

    line 162

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

USDD / JUST Protocol

Interact with USDD, TRON's over-collateralized stablecoin, via the JUST Protocol. Swap USDT for USDD at 1:1 through the Peg Stability Module (PSM), query vault (CDP) positions and protocol parameters, and check token balances.


Quick Start

cd usdd-skill && npm install
export TRON_PRIVATE_KEY="<your-private-key>"
export TRON_NETWORK="mainnet"

[!CAUTION] Never display or log the private key.


Available Scripts

1. psm-swap.js — Buy/Sell USDT via PSM (1:1, Zero Fee)

node scripts/psm-swap.js sell 1000 --dry-run    # Preview: 1000 USDT -> 1000 USDD
node scripts/psm-swap.js sell 500                # Execute: sell 500 USDT for USDD
node scripts/psm-swap.js buy 1000 --dry-run      # Preview: spend USDD -> 1000 USDT
node scripts/psm-swap.js buy 250                 # Execute: buy 250 USDT with USDD
  • sell <amount>: Sell USDT to PSM, receive USDD 1:1
  • buy <amount>: Buy USDT from PSM, spend USDD 1:1
  • Amount is always in USDT terms
  • Auto-handles TRC20 approval
  • Uses the direct buyGem/sellGem PSM interface (not the router)

[!NOTE] PSM fees (tin/tout) are currently 0%. Use psm-info.js to verify current fees.

Output: action, direction, amount_usdt, status, tx_id, needs_approval

2. psm-info.js — PSM State (Read-Only)

node scripts/psm-info.js

No private key required. Shows PSM fees (tin/tout), USDT reserves held by the GemJoin, and USDD total supply.

Output: fees (tin, tout, percentages), reserves (usdt_available), usdd (total_supply)

3. balance.js — Check Token Balances

node scripts/balance.js
node scripts/balance.js --address TXYzL2gqz5AB4dbGeiX9h8unkKHxuWwb

Queries balances for USDD, USDT, USDC, TRX, and JST. Uses --address for read-only lookups (no private key needed).

Output: wallet, balances[] (symbol, balance, address)

4. vault-info.js — Vault Positions & Parameters (Read-Only)

node scripts/vault-info.js                      # All vault types
node scripts/vault-info.js --vault TRX-A        # Specific vault type
node scripts/vault-info.js --cdp 42             # Specific CDP position

No private key required. Queries the Vat and DssCdpManager for vault parameters and individual CDP positions.

Without --cdp: shows global parameters per vault type (total debt, rate, spot price, debt ceiling, dust).

With --cdp <id>: shows a specific CDP's collateral locked, debt, and collateralization ratio.

Output (global): vaults[] (name, total_debt_usdd, rate, spot, debt_ceiling_usdd)

Output (CDP): cdp_id, owner, collateral_locked, actual_debt_usdd, collateralization_ratio


Usage Patterns

Get USDD via PSM (Simplest)

node scripts/psm-info.js                         # Check PSM reserves and fees
node scripts/psm-swap.js sell 1000 --dry-run      # Preview swap
node scripts/psm-swap.js sell 1000                # Execute: 1000 USDT -> 1000 USDD

Redeem USDD for USDT

node scripts/balance.js                           # Check USDD balance
node scripts/psm-swap.js buy 500 --dry-run        # Preview redemption
node scripts/psm-swap.js buy 500                  # Execute: spend USDD -> 500 USDT

Inspect Vault Health

node scripts/vault-info.js                        # View all vault type parameters
node scripts/vault-info.js --cdp 42               # Check specific CDP position

Supported Vaults

NameCollateralGemJoin AddressStability Fee
TRX-ATRXTJ1VWPvFVq7sVsN7J7dWJVZz4SLT14qRUr5%
TRX-BTRXTGQKnHDQNyc3QeHJ7YxH8wggdg89UVXyvX5%
TRX-CTRXTPUPPLTYLdbW4jxwD5g2T7ystxsR9HL2mt5%
sTRX-AsTRXTKha7zcAXZMaaWzoVmUHtvVFqr9GeiChgJ1%
USDT-AUSDTTDUkQbjrXs6xUbxGCLknWwJHxVTdysXBhy0%

Key Contracts

ContractAddressDescription
USDD Token (v2)TXDk8mbtRbXeYuMNS83CfKPaYYT8XWv9HzUSDD TRC20 (18 decimals)
UsddPsmTBXW4hS5KYjjbJXDpnrPf4zhkLwrpUjbyzPSM — buyGem/sellGem for 1:1 swaps
PSM GemJoinTSUYvQ5tdd3DijCD1uGunGLpftHuSZ12sQPSM USDT collateral adapter (sellGem: approve USDT here)
UsddJoinTUajR7CbXU6hX8n3XtNkitFAD25JvP99K6USDD join adapter (buyGem: approve USDD here)
DssCdpManagerTDDWjmQaquEtUn1Pa8wCd8dfWFPdQLGPYLCDP management (open, frob, flux)
VatTH5dhX7o39afSbfDT2e3c9k4itWjNKD4D9Core accounting engine
USDT TokenTR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6tUSDT TRC20 (6 decimals)
JST TokenTCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9JUST governance token (18 decimals)

Security Rules

  1. Never display private keys.
  2. Always dry-run before PSM swaps. Verify amounts and token directions.
  3. Check PSM reserves before swapping. If USDT reserves are low, buyGem may fail.
  4. Decimal mismatch awareness. USDD is 18 decimals, USDT/USDC are 6. Scripts handle normalization automatically.
  5. Vault positions are read-only. This skill queries but does not modify vault positions (no deposit/draw/repay/withdraw).
  6. Verify CDP IDs. Always confirm the CDP ID and owner before acting on position data.

Common Issues

ProblemSolution
Unknown tokenUse USDD, USDT, USDC, TRX, or JST
Insufficient balanceCheck wallet balance with balance.js before swapping
PSM swap failsPSM may be depleted — check reserves with psm-info.js
Unknown vaultUse TRX-A, TRX-B, TRX-C, sTRX-A, or USDT-A
Unknown networkSet TRON_NETWORK to mainnet, nile, or shasta
Vault shows all zerosThe ilk may not be active on this network, or the CDP ID does not exist

Version 2.0.0 — Created by M2M Agent Registry for Bank of AI

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.