Overview
Each TIP-20 token references a transfer policy by ID:Policy Types
TIP-403 supports three policy types:Whitelist Policies
Only addresses on the whitelist can participate:- KYC-required tokens (only verified users)
- Private securities (only accredited investors)
- Internal company tokens (only employees)
Blacklist Policies
All addresses except those on the blacklist can participate:- Sanctions compliance (block OFAC addresses)
- Fraud prevention (block compromised addresses)
- Terms of service enforcement (block violators)
Compound Policies (TIP-1015)
Different rules for senders, recipients, and mint recipients:- Vendor credits (anyone can receive, only vendor can be paid)
- Asymmetric compliance (different rules for in/out flows)
- Restricted minting (tight control on issuance, loose on transfers)
Transfer Authorization
Standard Transfers
All transfer methods check both sender and recipient authorization:transfer(to, amount)transferFrom(from, to, amount)transferWithMemo(to, amount, memo)transferFromWithMemo(from, to, amount, memo)systemTransferFrom(from, to, amount)(FeeManager only)
Mint Operations
Mints check mint recipient authorization:- Stricter control over token issuance
- Prevent minting to unauthorized addresses
- Support vendor credit scenarios (loose minting, tight transfers)
Burn Operations
Standard Burn
Burning from caller’s own balance checks sender authorization:Burn Blocked (TIP-1015)
Burning from blocked addresses requires sender to be unauthorized:Burn At (TIP-1006)
Burning from any address bypasses policy checks:Reward Operations
Reward distribution and claims check policies:Built-In Policies
The TIP-403 registry includes two built-in policies:Changing Policies
Token administrators can change the active policy:- Takes effect immediately
- All future transfers use new policy
- Existing balances are not affected
- Users may become unable to transfer if newly unauthorized
Compound Policies (TIP-1015)
Overview
Compound policies enable different authorization rules for different transfer directions:Creating Compound Policies
- Users can receive minted credits (mint recipient = anyone)
- Users can spend credits only to vendor (recipient = vendor only)
- Peer-to-peer transfers are blocked (recipient must be vendor)
Use Case: Vendor Credits
Use Case: Asymmetric Compliance
Different rules for sending vs. receiving:- KYC users can send to anyone (including blocked addresses for seizures)
- Non-KYC users cannot send
- Non-KYC users can receive (e.g., refunds)
- Only KYC users can receive new token issuance
Authorization Logic
For compound policies, authorization delegates to component policies:Immutability
Compound policies are immutable once created:- Cannot change component policy IDs
- No admin (admin = address(0))
- Cannot add/remove addresses from compound policy itself
- Modify component policies (if they have admins)
- Or create new compound policy and switch token to it
Policy Administration
Creating Policies
- Start at 2 (0 and 1 are built-in)
- Increment sequentially
- Unique across all policy types
- Permanent (cannot be deleted)
Modifying Policies
Simple policies (whitelist/blacklist) can be modified by their admin:Transferring Policy Admin
Gas Costs
Policy Checks
| Policy Type | Operation | Gas Cost |
|---|---|---|
| Always-allow (policy 1) | Any transfer | ~0 (short-circuit) |
| Whitelist | Check membership | ~2,100 (1 SLOAD) |
| Blacklist | Check membership | ~2,100 (1 SLOAD) |
| Compound | Check both sender/recipient | ~4,200 (2 SLOADs) |
Policy Creation
| Operation | Gas Cost |
|---|---|
| Create whitelist/blacklist | ~50,000 |
| Create compound policy | ~100,000 |
| Add to whitelist/blacklist (new) | ~250,000 (TIP-1000 state creation) |
| Add to whitelist/blacklist (update) | ~5,000 |
| Remove from whitelist/blacklist | ~5,000 |
Transfer Impact
Policy checks add to total transfer cost:| Scenario | Base Cost | Policy Cost | Total |
|---|---|---|---|
| Transfer with always-allow | 50,000 | ~0 | ~50,000 |
| Transfer with whitelist | 50,000 | ~4,200 | ~54,200 |
| Transfer with compound | 50,000 | ~8,400 | ~58,400 |
Integration Patterns
KYC Token
Sanctions Compliance
Tiered Access
Error Handling
Best Practices
Policy Design
-
Start permissive, tighten later
- Launch with policy 1 (always-allow)
- Collect KYC data off-chain
- Switch to whitelist when ready
-
Use compound policies for flexibility
- Separate sender and recipient rules
- Enable one-way flows (e.g., refunds to blocked users)
- Support vendor credit models
-
Test policy changes
- Verify policy exists before switching
- Check impact on existing holders
- Announce changes in advance
Security
-
Protect policy admin keys
- Policy admin can authorize/block any address
- Consider multisig for policy administration
- Monitor policy modification events
-
Monitor for abuse
- Track
SetMembershipUpdatedevents - Alert on unexpected policy changes
- Log policy switches for audit trail
- Track
-
Handle blocked users gracefully
- Provide off-chain notification before blocking
- Support appeals process
- Document policy enforcement criteria
Gas Optimization
-
Batch policy updates
- Use
batchUpdateSetfor multiple addresses - Reduces transaction overhead
- Cheaper than individual calls
- Use
-
Reuse policies
- Share policies across multiple tokens
- Reduces deployment costs
- Simplifies administration
-
Consider policy complexity
- Simple policies are cheaper to check
- Compound policies add ~4,000 gas per transfer
- Balance compliance needs vs. gas costs