Skip to content

Conversation

drewstaylor
Copy link
Member

@drewstaylor drewstaylor commented Sep 29, 2025

This PR adds support for custom token linking for tokens with mint / burn as token manager type in the ITS scripts. Additionally, it applies a temp fix to the Example contract scripts that makes the send-token script work for tokens with mint / burn token manager type. More work will need to be done to make the mint-token work for the Example contract scripts.


Note

Enable mint/burn token support across Sui ITS scripts with pre-mint on deploy and updated link-coin options/flow, plus doc updates.

  • Scripts:
    • sui/its-example.js
      • Pre-mint on origin deployment via --mintAmount before registration.
      • Register with register_coin_with_cap when --tokenManagerMode mint_burn; default remains lock_unlock.
    • sui/its.js
      • link-coin: dynamic token manager type (--tokenManagerMode), optional --destinationOperator passed as link params, improved errors.
      • Pass treasuryCap to custom registration when using mint/burn.
    • sui/utils/its-utils.js
      • Use provided treasuryCap flag/arg to extract and transfer TreasuryCapReclaimer (instead of config flag).
  • Docs (releases/sui/2025-09-ITS-v1.2.0.md):
    • Update examples to cover both lock_unlock and mint_burn flows; clarify steps and sample commands.

Written by Cursor Bugbot for commit ea5bc83. This will update automatically on new commits. Configure here.

Greptile Overview

Updated On: 2025-09-29 21:46:23 UTC

Summary

This PR adds comprehensive support for mint/burn tokens in Sui ITS scripts. The changes enable custom token linking for both lock/unlock and mint/burn token manager types, with enhanced script functionality for the Example contract.

Key changes include:

  • Added --mintAmount option to deploy-token command for pre-minting tokens before registration
  • Enhanced link-coin functionality with --tokenManagerMode and --destinationOperator parameters
  • Updated documentation with clear examples for both token manager types
  • Proper handling of TreasuryCap for mint/burn tokens during registration

The implementation correctly handles the different registration paths based on token manager type and maintains backward compatibility with existing lock/unlock functionality.

Confidence Score: 4/5

  • This PR is mostly safe to merge with one minor logical issue that should be addressed
  • Score reflects solid implementation of new functionality with comprehensive documentation updates, but reduced by one point due to a type coercion inconsistency in the minting logic that could cause unexpected behavior
  • sui/its-example.js requires attention for the type coercion issue in the mint amount handling

Important Files Changed

File Analysis

Filename        Score        Overview
sui/its-example.js 4/5 Added mint functionality for tokens before registration and support for mint_burn token manager mode with --mintAmount option
sui/its.js 4/5 Enhanced link-coin functionality with mint_burn token manager support and destinationOperator parameter
releases/sui/2025-09-ITS-v1.2.0.md 5/5 Updated documentation to support both lock/unlock and mint/burn token manager types with new examples and clarifications

Sequence Diagram

sequenceDiagram
    participant User
    participant Script as its-example.js
    participant ITS as InterchainTokenService
    participant TM as TokenManager
    
    User->>Script: deploy-token --tokenManagerMode mint_burn --mintAmount 100
    Script->>Script: Deploy coin package
    Script->>Script: Mint tokens (if mintAmount > 0)
    
    alt Token Manager Type: mint_burn
        Script->>ITS: register_coin_with_cap(metadata, treasuryCap)
        ITS->>TM: Create mint/burn token manager
    else Token Manager Type: lock_unlock  
        Script->>ITS: register_coin(metadata)
        ITS->>TM: Create lock/unlock token manager
    end
    
    Script->>User: Token deployed with appropriate manager type
    
    User->>Script: link-coin --tokenManagerMode mint_burn --destinationOperator 0x123
    Script->>ITS: register_coin_metadata(metadata)
    Script->>ITS: register_custom_coin(treasuryCap if mint_burn)
    Script->>ITS: link_coin(destinationChain, destinationAddress, tokenManagerType, linkParams)
    ITS->>User: Token linked with destination
Loading

@drewstaylor drewstaylor self-assigned this Sep 29, 2025
@drewstaylor drewstaylor requested a review from a team as a code owner September 29, 2025 18:16
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@drewstaylor
Copy link
Member Author

drewstaylor commented Sep 29, 2025

Example tx for auto minted coins when calling ts-node sui/its-example deploy-token [options] [args]

https://suiscan.xyz/testnet/tx/3aRuSdDj4LXbvVYdzLbfkh5NNjfHP4eWn3eGmZtVgo4K

@drewstaylor drewstaylor marked this pull request as draft September 29, 2025 18:34
@drewstaylor
Copy link
Member Author

drewstaylor commented Sep 29, 2025

Example logs for ts-node sui/its link-coin [options] [args]

# lock_unlock
ts-node sui/its link-coin LNKL --tokenManagerMode lock_unlock "Custom link coin (lock / unlock)" 10 ethereum-sepolia 0x3fc29836e84e471a053d2d9e80494a867d670ead
# > Wallet address: 0x4cdab023fcddcf492891b9d72ce7b523c5b465883d02fedd1bbe81f4598cf40b
# > Wallet balance: 0.879896622 SUI
# > Confirm Published LNKL Tx? (y/n) y
# > Published LNKL: 4bQ4G6iqJX1eu64VFw6XxDHKjtKhRiwa9C5eqW9iAbka
# > Confirm Register Token Metadata (LNKL) Tx? (y/n) y
# > Register Token Metadata (LNKL): 9bgFRCXVRci9trhsPpD7Bc6G6JBCiA8brWLtBLtj5TVu
# > Confirm Register Custom Coin (LNKL) in InterchainTokenService Tx? (y/n) y
# > Register Custom Coin (LNKL) in InterchainTokenService: CeABHaKzjgw5E9fyX7FTnsp6dUy6YPjqtz6nM1KdBUAA
# > Confirm Link Coin (LNKL) Tx? (y/n) y
# > Link Coin (LNKL): 66LNGyLytgpY3hxk63A9LSwv8Njma8H8zL865WndS1rb

# mint_burn
ts-node sui/its link-coin --tokenManagerMode mint_burn --destinationOperator 0x13f8C723AeB8CA762c652c553a11a11483846d8B LNKM "Custom link coin (mint / burn)" 10 ethereum-sepolia 0x3fc29836e84e471a053d2d9e80494a867d670ead
# > Wallet address: 0x4cdab023fcddcf492891b9d72ce7b523c5b465883d02fedd1bbe81f4598cf40b
# > Wallet balance: 1.855284594 SUI
# > Confirm Published LNKM Tx? (y/n) y
# > Published LNKM: 8xeq3dCGtFUWkF4yr5mrYDbXJ6CTUjLatZd55Wy5SsZB
# > Confirm Register Token Metadata (LNKM) Tx? (y/n) y
# > Register Token Metadata (LNKM): EMBDsvZ831RkySvyWZ2BveAs1ooGBAnMK7rAuhCH59z9
# > Confirm Register Custom Coin (LNKM) in InterchainTokenService Tx? (y/n) y
# > Register Custom Coin (LNKM) in InterchainTokenService: CJonnPLnizqdrAuhJBGQebzFDqv5tt4TLGbzA6Q434MX
# > Confirm Link Coin (LNKM) Tx? (y/n) y
# > Link Coin (LNKM): Bmmkn4Hn8PsJBUyBuQ2e3Hxcj4ZCAMg9qTx8Sy9KwceG

@drewstaylor drewstaylor marked this pull request as ready for review September 29, 2025 21:43
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@drewstaylor drewstaylor merged commit 5f1f20e into main Sep 29, 2025
10 checks passed
@drewstaylor drewstaylor deleted the patch/sui-mint-burn-workflows branch September 29, 2025 22:58
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.

2 participants