Source Code Note: This module was adapted from Osmosis Labs. Creation fee support was removed because Neutron does not have a community pool.
Key Features
- Token Creation: Create custom denominations with unique identifiers
- Supply Management: Mint and burn tokens with admin controls
- Administrative Controls: Transfer admin rights and manage token permissions
- Metadata Support: Set token metadata via bank keeper
- Before-Send Hooks: Implement custom logic for token transfers via CosmWasm contracts
- Force Transfer: Admin-controlled transfer capabilities that bypass hooks
Token Denomination Format
Created tokens follow the format:factory/{creator_address}/{subdenom}
Example: factory/neutron1abc123.../mytoken
Available Operations
For Token Creators
Create Denomination
Mint Tokens
Burn Tokens
Change Admin
Set Metadata
Set Before-Send Hook
Force Transfer
Parameters
The module maintains the following governance-controlled parameters:Parameter | Type | Description |
---|---|---|
denom_creation_fee | []Coin | Fee required to create a new denomination |
denom_creation_gas_consume | uint64 | Additional gas cost for denomination creation |
fee_collector_address | string | Address receiving creation fees |
whitelisted_hooks | []WhitelistedHook | Approved contracts for before-send hooks |
Before-Send Hooks
Before-send hooks allow token admins to implement custom logic that executes before token transfers:Whitelisting Requirements
- Hook contracts must be pre-approved through governance
- Only specific code IDs and denom creators can set hooks
- Provides security against malicious hook contracts
Hook Types
- TrackBeforeSend: Monitoring hooks with gas limits (500,000 gas limit)
- BlockBeforeSend: Blocking hooks that can prevent transfers
Administrative Model
Token Administration
- Token creators become the initial admin with full control
- Admin can mint, burn, set metadata, configure hooks, and force transfers
- Admin rights can be transferred to another address
- Admin can be set to empty string to renounce control (irreversible)
Security Features
- Admin Controls: Only token admin can perform privileged operations
- Hook Restrictions: Governance-controlled hook whitelisting
- Module Account Protection: Burning from module accounts is prevented
- Gas Limits: Before-send hooks have gas consumption limits