Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
d3e01cd
feat: add ton scripts
MakisChristou May 27, 2025
9c8c248
feat: add callContract script
MakisChristou May 27, 2025
f42959f
Merge branch 'axelarnetwork:main' into ton
MakisChristou Jun 25, 2025
7ee38cb
feat(ton): add initialize signers script
MakisChristou Jun 25, 2025
4333101
Merge branch 'axelarnetwork:main' into ton
MakisChristou Jun 27, 2025
fa33877
fix(ton): use npm package for cell building logic
MakisChristou Jun 29, 2025
225aa45
feat(ton): add signer rotation script
MakisChristou Jun 29, 2025
d3c90c7
feat(ton): gasService script: pay native gas
MakisChristou Jun 30, 2025
f27b511
Merge branch 'axelarnetwork:main' into ton
MakisChristou Jun 30, 2025
157437f
refactor: pay native gas script
MakisChristou Jun 30, 2025
440c54b
feat: implement pay jetton gas
MakisChristou Jul 2, 2025
3cc8986
feat: collect native and jetton gas
MakisChristou Jul 2, 2025
77295bb
feat: add jetton and native gas scripts
MakisChristou Jul 2, 2025
4b54f85
feat: implement jetton/native refunds
MakisChristou Jul 2, 2025
95d24ac
feat: add update gas info script
MakisChristou Jul 2, 2025
ff57b43
feat: implement on chain gas estimation script
MakisChristou Jul 2, 2025
3230378
feat: transfer operatorship script
MakisChristou Jul 2, 2025
3a09d58
feat: add proposal execution scripts
MakisChristou Jul 3, 2025
c6c1cdf
docs: readme
MakisChristou Jul 3, 2025
5c77d74
fix(ton): gasService jetton payment message structure
MakisChristou Jul 18, 2025
f9f709a
docs: consistent cli instructions
MakisChristou Jul 19, 2025
a3dd9c0
docs(ton): fixed typos
MakisChristou Jul 19, 2025
b4ad483
feat: add deploy-interchain-token script
MakisChristou Aug 12, 2025
42d6516
feat: add trusted chain
MakisChristou Aug 12, 2025
4e39b80
feat: add register token metadata
MakisChristou Aug 12, 2025
2c76e15
feat: deploy remote interchain token
MakisChristou Aug 12, 2025
4fc3256
feat: upgrade, interchain token transfer
MakisChristou Aug 13, 2025
737a15f
feat: implement link token script
MakisChristou Aug 13, 2025
6c60d24
feat: remove trusted chain
MakisChristou Aug 14, 2025
7a605e4
feat: register canonical token
MakisChristou Aug 14, 2025
754f1cf
feat: register custom token
MakisChristou Aug 14, 2025
5c2f27e
feat: deploy remote canonical token
MakisChristou Aug 14, 2025
7878baa
feat: pause/unpause
MakisChristou Aug 14, 2025
4420e8d
fix: gas service scripts
MakisChristou Aug 15, 2025
c2df66c
fix: update default gas amounts
MakisChristou Aug 15, 2025
59741e8
fix: update gas payment payload structure
MakisChristou Aug 15, 2025
2627784
feat: approve-remote-deployment
MakisChristou Aug 15, 2025
2d4b890
feat: use axelar-cgp-ton message builders
MakisChristou Aug 16, 2025
a3dd38b
feat: use getters for getter UX
MakisChristou Aug 17, 2025
47582ab
fix: downgrade axelar-cgp-ton
MakisChristou Aug 18, 2025
ce283f7
feat: use chainstack, fallback to toncenter
MakisChristou Aug 18, 2025
67e1c3d
feat: register canonical token
MakisChristou Aug 18, 2025
96f6c6d
feat: register custom token
MakisChristou Aug 18, 2025
467fccc
feat: register token metadata
MakisChristou Aug 18, 2025
e2015f3
feat: permissioned canonical token registration
MakisChristou Aug 18, 2025
a04abac
fix: add revoke deployment in readme
MakisChristou Aug 19, 2025
2f3905f
fix: upgrade script, its getter
MakisChristou Aug 20, 2025
19f5a3a
fix: toncenter fallback
MakisChristou Aug 20, 2025
b448b01
feat: pay gas service with interchain token transfer
MakisChristou Aug 21, 2025
54d93eb
refactor: interchain token transfer
MakisChristou Aug 21, 2025
8d8951c
fix: gas payment
MakisChristou Aug 22, 2025
be4a422
fix: link token gas payment
MakisChristou Aug 22, 2025
282f55e
fix: register token metadata gas payment
MakisChristou Aug 22, 2025
3bbcba2
feat: simplify UX
MakisChristou Aug 22, 2025
e54de74
fix: register canonical token arguments
MakisChristou Aug 22, 2025
3ae88ad
feat: gas payment for deploy remote canonical token
MakisChristou Aug 22, 2025
e132c20
refactor(its)
MakisChristou Aug 22, 2025
d547385
fix: simplify gas
MakisChristou Aug 22, 2025
d7bf2e2
feat: add helper getters
MakisChristou Aug 24, 2025
24a6fef
refactor(its)
MakisChristou Aug 25, 2025
75cba72
refactor: abi encoding
MakisChristou Aug 25, 2025
2e9e757
chore: migrate axelar-cgp-ton
MakisChristou Sep 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,834 changes: 2,767 additions & 2,067 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
"@axelar-network/axelar-cgp-sui": "1.1.3",
"@axelar-network/axelar-gmp-sdk-solidity": "6.0.4",
"@axelar-network/interchain-token-service": "2.1.0",
"@commonprefix/axelar-cgp-ton": "^1.2.21",
"@cosmjs/cosmwasm-stargate": "^0.32.1",
"@ledgerhq/hw-app-eth": "6.32.2",
"@mysten/ledgerjs-hw-app-sui": "^0.4.1",
"@mysten/sui": "^1.3.0",
"@stellar/stellar-sdk": "^13.0.0",
"@ton/ton": "^15.2.1",
"axios": "^1.7.2",
"csv-parser": "^3.0.0",
"path": "^0.12.7",
Expand All @@ -60,17 +62,17 @@
"commander": "^11.0.0",
"dotenv": "^16.0.1",
"eslint": "^8.57.0",
"form-data": "^4.0.0",
"fs-extra": "^11.1.1",
"hardhat": "~2.19.5",
"hardhat": "^2.26.0",
"husky": "^9.1.7",
"jszip": "^3.10.1",
"mocha": "^10.2.0",
"prettier": "^3.6.1",
"readline-sync": "^1.4.10",
"ts-node": "^10.9.2",
"typechain": "^8.3.2",
"typescript": "^5.8.3",
"form-data": "^4.0.0",
"jszip": "^3.10.1"
"typescript": "^5.8.3"
},
"engines": {
"node": ">=18"
Expand Down
310 changes: 310 additions & 0 deletions ton/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,310 @@

# TON operational scripts

This folder contains operational scripts for the TON AxelarGateway. It assumes an already deployed AxelarGateway.fc and an Executable.fc.

Required environment variables

```
MNEMONIC=
TONCENTER_API_KEY=
TON_GATEWAY_ADDRESS=
TON_GAS_SERVICE_ADDRESS=
TON_GOVERNANCE_ADDRESS=
TON_ITS_ADDRESS=
```

Optional environment variables (with defaults):

```
AXELAR_HUB_CHAIN_NAME=axelar # Default: 'axelar'
AXELAR_HUB_ADDRESS=axelar157hl7gpuknjmhtac2qnphuazv2yerfagva7lsu9vuj2pgn32z22qa26dk4 # Default: devnet address
```

The hub chain variables are used for cross-chain communication when registering tokens and sending gas service messages. The defaults work for mainnet, but you may need to override them for testnet or different environments.

## Approving a message

Run this with the hex encoded payload produced by the TON MultisigProver.

```bash
node ton/approveMessages.js <encoded-payload-hex>
```


## Executing a message

Run this to execute an approved message

```bash
node ton/relayerExecute.js <message-id> <source-chain> <source-address> <payload-hex> <executable-address> <destination-chain> <payload-hash>
```


## Sending a message from TON

```bash
node ton/callContract.js <destination-chain> <destination-contract-address> <payload-hex>
```


## Post Deployment (initialize signers)

```bash
node ton/initializeSigners.js <weighted-signers-json>
```

## Signer Rotation
In our design, signer rotation is a 2-step process. Thus we need both the proof generated by the MultisigProver but also the new signer config separately as it is not included in that proof.

```bash
node ton/signerRotation.js <encoded-payload-hex> <weighted-signers-json>
```

Where `weighted-signers-json` would be in the format:

```json
{
"signers": [
{
"signer": "79607624103790023686192160900267678169386878801005916234280733090365959006096",
"weight": "1"
}
],
"threshold": "1",
"nonce": "0"
}
```

## Transfer Operatorship

```bash
node ton/transferOperatorship.js <new-operator-address>
```

## Gas Service Scripts

Pay native gas for a contract call

```bash
node ton/gasService.js pay-native-gas <destination-chain> <destination-address> <payload-hex> <refund-address> <gas-amount>
```

Pay jetton gas for a contract call

```bash
node ton/gasService.js pay-jetton-gas <jetton-minter-address> <jetton-amount> <destination-chain> <destination-address> <payload-hex>
```

Collect native gas

```bash
node ton/gasService.js collect-gas <receiver-address> <amount>
```

Collect jettons

```bash
node ton/gasService.js collect-jettons <receiver-address> <jetton-amount> <jetton-minter-address>
```


Add native gas to previous transaction

```bash
node ton/gasService.js add-native-gas <tx-hash> <refund-address> <gas-amount>
```

Add jetton gas to previous transaction

```bash
node ton/gasService.js add-jetton-gas <tx-hash> <jetton-minter-address> <jetton-amount> <refund-address>
```

Refund native gas

```bash
node ton/gasService.js native-refund <tx-hash> <refund-address> <refund-amount>
```

Jetton Refund

```bash
node ton/gasService.js jetton-refund <tx-hash> <receiver-address> <jetton-amount> <jetton-minter-address>
```

Update Gas Information

```bash
node ton/gasService.js update-gas-info <gas-info-json> <gas-amount>
```

Where `gas-info-json` would be in the format:

```json
{
"ethereum": {
"gasEstimationType": 2,
"l1FeeScalar": 800000,
"axelarBaseFee": 300000,
"relativeGasPrice": 1500000,
"relativeBlobBaseFee": 80000,
"expressFee": 750000
}
}
```

Pay Gas (on-chain estimation)

```bash
node ton/gasService.js pay-gas <destination-chain> <destination-address> <payload-hex> <refund-address> <execution-gas-limit> <estimate-on-chain> <gas-amount>
```

## Governance

Execute a timelock proposal

```bash
node ton/governance.js execute-timelock-proposal <target-address> <native-ton-amount> <proposal-hash> <proposal-hex-data> <timelock-seconds> <actual-timelock-value> <gas-amount>
```

Execute an operator proposal

```bash
node ton/governance.js execute-operator-proposal <target-address> <native-ton-amount> <proposal-hash> <proposal-hex-data> <gas-amount>
```

## Upgrade

```bash
node ton/upgrade.js <contract-address> <new-code-box-hex>
```

## Interchain Token Service

All commands support the `--dry-run` flag to preview what would be executed without sending transactions.

### Interchain Token Flow

Deploy a new interchain token with optional minter:
```bash
node ton/its.js deploy-interchain-token <salt> <name> <symbol> <decimals> <initial-supply> [minter] [--dry-run]
```

Deploy the same token on a remote chain:
```bash
node ton/its.js deploy-remote-interchain-token <salt> <chain-name> [remote-minter] [--gas <amount>] [--dry-run]
```

Manage remote deployment permissions:
```bash
node ton/its.js approve-remote-deployment <salt> <deployer-address> <destination-chain> <minter-to-approve> [--dry-run]
node ton/its.js revoke-remote-deployment <salt> <deployer-address> <destination-chain> <minter-to-revoke> [--dry-run]
```

### Canonical Token Flow

Register an existing jetton as a canonical interchain token:
```bash
node ton/its.js register-canonical-token <jetton-minter-address> [--dry-run]
```

Register a canonical token with permissioned access (Admin only):
```bash
node ton/its.js register-canonical-token-permissioned <name> <symbol> <decimals> <jetton-minter-address> [--dry-run]
```

Deploy the canonical token on remote chains:
```bash
node ton/its.js deploy-remote-canonical-token <jetton-minter-address> <chain-name> [--gas <amount>] [--dry-run]
```

### Custom Token Flow

Register token metadata (TEP-64 standard) for hub communication:
```bash
node ton/its.js register-token-metadata <jetton-minter-address> [--gas <amount>] [--dry-run]
```

Register a custom token with specific token manager behavior:
```bash
node ton/its.js register-custom-token <salt> <token-manager-type> <operator-address> <jetton-minter-address> [--dry-run]
```

Link existing token to remote chain with custom parameters:
```bash
node ton/its.js link-token <salt> <chain-name> <destination-address> <token-manager-type> <link-params> [--gas <amount>] [--dry-run]
```

### Token Transfer (Works with any token type)

Transfer any registered token between chains:
```bash
node ton/its.js interchain-token-transfer <token-id> <chain-name> <destination-address> <amount> [--gas <amount>] [--dry-run]
```

### Flow Limit Management

Set flow limit for a specific token:

```bash
node ton/its.js set-flow-limit <token-id> <flow-limit> [--dry-run]
```

### Admin Operations

Add a trusted chain to the ITS (Operator or Owner):
```bash
node ton/its.js add-trusted-chain <chain-name> <chain-address> [--dry-run]
```

Remove a trusted chain from the ITS (Operator or Owner):
```bash
node ton/its.js remove-trusted-chain <chain-name> [--dry-run]
```

Change the operator of the ITS (Current operator only):
```bash
node ton/its.js change-operator <new-operator> [--dry-run]
```

Change the owner of the ITS (Owner only):
```bash
node ton/its.js change-owner <new-owner> [--dry-run]
```

Pause the ITS (Operator only):
```bash
node ton/its.js pause [--dry-run]
```

Unpause the ITS (Operator only):
```bash
node ton/its.js unpause [--dry-run]
```

### Information Commands

Get full state of the ITS contract:
```bash
node ton/its.js get-full-state [its-address]
```

Get comprehensive token manager information including flow data:
```bash
node ton/its.js get-token-manager <token-id>
```

Get minter proxy address for a jetton minter:
```bash
node ton/its.js get-minter-proxy <jetton-minter-address>
```

Get the ITS jetton wallet address for a given jetton minter:
```bash
node ton/its.js get-its-jetton-wallet <jetton-minter-address>
```

```bash
node ton/its.js get-token-manager <token-id>
```
Loading