Skip to content

Commit b90dbe4

Browse files
committed
Managed Token and Managed Token Pool README.md
1 parent 6ad0641 commit b90dbe4

File tree

3 files changed

+414
-1
lines changed

3 files changed

+414
-1
lines changed

contracts/ccip/ccip/sources/token_admin_registry.move

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,11 @@ module ccip::token_admin_registry {
295295
// | Register Pool |
296296
// ================================================================
297297

298+
/// Registers a token pool with the Token Admin Registry, establishing a 1:1 mapping
299+
/// between the local token and the pool address.
300+
///
301+
/// WARNING: The `initial_administrator` parameter cannot be changed after registration.
302+
/// Ensure you control this address, as it will have full administrative control over the pool.
298303
public fun register_pool<ProofType: drop>(
299304
token_pool_account: &signer,
300305
token_pool_module_name: vector<u8>,

contracts/ccip/ccip_token_pools/README.md

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ Tokens with dynamic dispatch are supported for both pools, however the deposit a
1010

1111
## Pool Types
1212

13-
There are **3 types** of token pools available on Aptos:
13+
There are **4 types** of token pools available on Aptos:
1414

1515
1. **Lock/Release Token Pool** (`lock_release_token_pool`)
1616
2. **Burn/Mint Token Pool** (`burn_mint_token_pool`)
1717
3. **USDC Token Pool** (`usdc_token_pool`)
18+
4. **Managed Token Pool** (`managed_token_pool`)
1819

1920
### 1. Lock/Release Token Pool (`lock_release_token_pool`)
2021

@@ -84,6 +85,31 @@ There are **3 types** of token pools available on Aptos:
8485

8586
- Specifically for USDC token transfers
8687

88+
### 4. Managed Token Pool (`managed_token_pool`)
89+
90+
- Designed specifically for tokens deployed with the managed token package
91+
- Uses allowlist-based permission system for secure mint/burn operations
92+
- **Does not support dynamic dispatch** - calls `fungible_asset` module functions directly
93+
- Managed token uses internal refs, not dynamic dispatch mechanisms
94+
95+
**Operation Modes**:
96+
97+
- Pool's resource account must be added to managed token's allowlists before operation
98+
- Pool calls `managed_token::mint()` and `managed_token::burn()` functions directly
99+
- Managed token validates permissions via allowlist checks
100+
101+
**Mechanism**:
102+
103+
- **Outbound**: Pool calls managed token to burn tokens from total supply
104+
- **Inbound**: Pool calls managed token to mint new tokens to recipient
105+
106+
**When to Use**:
107+
108+
- For tokens deployed with the managed token package
109+
- When you need allowlist-based control over token operations
110+
- Multiple protocol integrations while retaining developer control
111+
- **Cannot be used with existing standard fungible assets**
112+
87113
## Deployment Guide
88114

89115
### Prerequisites
@@ -139,6 +165,49 @@ token_messenger_minter=<TOKEN_MESSENGER_MINTER_ADDRESS>,\
139165
deployer=<DEPLOYER_ADDRESS>
140166
```
141167

168+
For **Managed Token Pool**:
169+
170+
```bash
171+
aptos move deploy-object \
172+
--package-dir contracts/ccip/ccip_token_pools/managed_token_pool \
173+
--address-name managed_token_pool \
174+
--named-addresses managed_token=<MANAGED_TOKEN_ADDRESS>,\
175+
managed_token=<MANAGED_TOKEN_ADDRESS>,\
176+
ccip=<CCIP_ADDRESS>,\
177+
ccip_token_pool=<CCIP_TOKEN_POOL_ADDRESS>,\
178+
token_pool_administrator=<TOKEN_POOL_ADMINISTRATOR_ADDRESS>,\
179+
mcms=<MCMS_ADDRESS>,\
180+
mcms_register_entrypoints=<MCMS_REGISTER_ENTRYPOINTS_ADDRESS>
181+
```
182+
183+
### ⚠️ **CRITICAL: Token Pool Administrator Configuration**
184+
185+
**Before deploying**, carefully verify the `token_pool_administrator` address configuration:
186+
187+
- **Risk**: If set to an address you don't control, the token pool becomes **permanently locked** with no recovery mechanism
188+
- **Recommendation**: Use your deployer address, a multisig you control, or another address where you definitely hold the private key
189+
- **Common Mistakes to Avoid**:
190+
- Using `@0x0` (zero address)
191+
- Typos in the address configuration
192+
- Using test addresses in production deployments
193+
- Copy-pasting addresses from different environments
194+
195+
**Example Safe Configuration:**
196+
197+
```toml
198+
# In your Move.toml or deployment command
199+
token_pool_administrator = "0x123...abc" # ✅ Your controlled address
200+
```
201+
202+
**What the Administrator Controls:**
203+
204+
- Pool initialization and configuration
205+
- Cross-chain settings and rate limits
206+
- Pool upgrades and parameter changes
207+
- Administrative role transfers
208+
209+
**There is no recovery mechanism if the administrator address is set incorrectly.** Double-check this address before deployment.
210+
142211
### Initialize Pool
143212

144213
**Lock/Release Pool**:
@@ -163,6 +232,27 @@ burn_mint_token_pool::initialize(admin_signer, burn_ref, mint_ref);
163232
usdc_token_pool::initialize(admin_signer);
164233
```
165234

235+
**Managed Token Pool**:
236+
237+
```move
238+
// No initialization required - pool is ready after deployment
239+
// However, you MUST add the pool to managed token allowlists:
240+
241+
let pool_store_address = managed_token_pool::get_store_address();
242+
243+
managed_token::apply_allowed_minter_updates(
244+
token_owner,
245+
vector[], // remove
246+
vector[pool_store_address] // add pool as minter
247+
);
248+
249+
managed_token::apply_allowed_burner_updates(
250+
token_owner,
251+
vector[], // remove
252+
vector[pool_store_address] // add pool as burner
253+
);
254+
```
255+
166256
### Configure Cross-Chain Support
167257

168258
```move
@@ -403,6 +493,15 @@ apply_chain_updates(admin, vector[], chain_selectors, remote_pools, remote_token
403493
- **Cause**: Token is not associated with any pool in Token Admin Registry
404494
- **Solution**: Deploy and register a pool for the token
405495

496+
**"Not allowed minter/burner" (Managed Token Pool)**
497+
498+
- **Cause**: Pool not added to managed token's allowlists
499+
- **Solution**: Add pool's store address to managed token allowlists:
500+
```move
501+
managed_token::apply_allowed_minter_updates(token_owner, vector[], vector[pool_store_address]);
502+
managed_token::apply_allowed_burner_updates(token_owner, vector[], vector[pool_store_address]);
503+
```
504+
406505
### Diagnostic Commands
407506

408507
```move
@@ -414,6 +513,11 @@ pool::get_remote_pools(chain_selector);
414513
// Check token admin registry
415514
token_admin_registry::get_pool(token_address);
416515
token_admin_registry::get_administrator(token_address);
516+
517+
// For managed token pool specifically
518+
managed_token_pool::get_store_address(); // Get pool's resource account address
519+
managed_token::is_minter_allowed(pool_store_address); // Check minter permission
520+
managed_token::is_burner_allowed(pool_store_address); // Check burner permission
417521
```
418522

419523
## Migration from Other Chains

0 commit comments

Comments
 (0)