A comprehensive ERC-20-like token implementation built on the Stacks blockchain using Clarity, featuring advanced burning functionality, administrative controls, and security features.
- Name: FlameToken
- Symbol: FLAME
- Decimals: 8
- Initial Supply: 10,000,000 FLAME (1,000,000,000,000,000 with decimals)
- Blockchain: Stacks (Clarity)
- Standard Transfers: Send tokens between addresses with optional memo
- Allowance System: Approve delegates to spend tokens on your behalf
- Batch Operations: Gas-efficient mass transfers for airdrops
- Balance Queries: Check individual or multiple balances
- Self Burn: Users can burn their own tokens
- Delegated Burn: Burn tokens from another account (requires allowance)
- Emergency Burn: Owner can forcibly burn tokens from any account
- Toggle Control: Owner can enable/disable burning functionality
- Authorized Minting: Only approved creators can mint new tokens
- Creator Management: Owner can add/remove authorized minters
- Supply Controls: Built-in overflow protection
- Toggle Control: Owner can enable/disable minting functionality
- Pause Mechanism: Owner can freeze all contract operations
- Blacklist System: Ban specific addresses from all token operations
- Access Controls: Role-based permissions for different operations
- Input Validation: Comprehensive checks for all parameters
(get-name) → Token name
(get-symbol) → Token symbol
(get-decimals) → Token decimals
(get-total-supply) → Current total supply
(get-balance principal) → Balance of specific address
(get-allowance holder delegate) → Allowance amount
(is-paused) → Contract pause status
(is-burn-enabled) → Burn functionality status
(is-mint-enabled) → Mint functionality status
(check-blacklist user) → User ban status
(check-minter-status user) → User minter authorization
(get-system-info) → Complete contract information(transfer amount recipient memo) → Transfer tokens with optional memo
(transfer-from holder recipient amount) → Transfer using allowance
(approve delegate amount) → Set spending allowance
(increase-allowance delegate boost) → Increase existing allowance
(decrease-allowance delegate reduction) → Decrease existing allowance
(secure-transfer amount recipient) → Transfer with enhanced validation(burn amount) → Burn own tokens
(burn-from holder amount) → Burn tokens using allowance(mint amount recipient) → Create new tokens (authorized minters only)(mass-transfer drops) → Send tokens to multiple recipients
(setup-distribution drops) → Initial token distribution (owner only)(freeze-system) → Pause all contract operations
(unfreeze-system) → Resume contract operations
(toggle-destroy enabled) → Enable/disable burning
(toggle-create enabled) → Enable/disable minting
(ban-user user) → Add user to blacklist
(unban-user user) → Remove user from blacklist
(add-creator user) → Authorize user to mint tokens
(remove-creator user) → Remove minting authorization
(force-destroy target amount) → Emergency burn (owner only)| Code | Error | Description |
|---|---|---|
| 100 | ERR-NOT-AUTHORIZED | Insufficient permissions |
| 101 | ERR-NOT-OWNER | Not contract owner |
| 102 | ERR-LOW-BALANCE | Insufficient token balance |
| 103 | ERR-BAD-AMOUNT | Invalid amount (zero or overflow) |
| 104 | ERR-BAD-RECIPIENT | Invalid recipient address |
| 105 | ERR-SEND-FAILED | Transfer operation failed |
| 106 | ERR-DESTROY-FAILED | Burning disabled or failed |
| 107 | ERR-CREATE-FAILED | Minting disabled or failed |
| 108 | ERR-FROZEN | Contract is paused |
| 109 | ERR-ALREADY-FROZEN | Contract already paused |
| 110 | ERR-NOT-FROZEN | Contract not paused |
| 111 | ERR-BANNED | Address is blacklisted |
| 112 | ERR-BAD-PRINCIPAL | Invalid principal address |
| 113 | ERR-VALUE-TOO-HIGH | Amount exceeds maximum limit |
(contract-call? .flame-token transfer u100000000 'SP1HTBVD3S...) ;; Transfer 1 FLAME;; Approve delegate
(contract-call? .flame-token approve 'SP1HTBVD3S... u50000000) ;; Approve 0.5 FLAME
;; Delegate transfers
(contract-call? .flame-token transfer-from 'SP2OWNER... 'SP3RECIPIENT... u25000000);; Burn own tokens
(contract-call? .flame-token burn u10000000) ;; Burn 0.1 FLAME
;; Burn from allowance
(contract-call? .flame-token burn-from 'SP1HOLDER... u5000000);; Pause contract (owner only)
(contract-call? .flame-token freeze-system)
;; Add new minter (owner only)
(contract-call? .flame-token add-creator 'SP1NEWMINTER...)
;; Mint tokens (authorized minters only)
(contract-call? .flame-token mint u100000000 'SP1RECIPIENT...)- Owner Privileges: The contract owner has significant control including emergency burns and blacklisting
- Blacklist Impact: Banned addresses cannot participate in any token operations
- Pause Functionality: When frozen, most operations are disabled except emergency functions
- Minting Controls: Only authorized creators can mint, and minting can be globally disabled
- Overflow Protection: Built-in checks prevent arithmetic overflow attacks
- The contract automatically assigns the initial supply to the deployer
- The deployer becomes the contract owner and initial authorized minter
- All security features are enabled by default
- Consider carefully before adding minters or using emergency functions in production