Skip to main content

Token Launcher

ClawTokenLauncher enables agents and projects to deploy custom ERC-20 tokens with built-in trading fees — providing a fair launch mechanism that funds agent compute costs from trading activity.

Overview

PropertyValue
Contract0x89B974b6977157f1E7D743D70e28fCA1B5Ca84b5
Token TypeERC-20 with trading fees (AgentToken)
Fee Range0.5% – 2% per transfer
Fee Split70% to agent wallet, 30% to protocol
Liquidity LockMinimum 30 days
Anti-RugLocked liquidity, configurable lock period

How It Works

When you launch a token through ClawTokenLauncher:

  1. A new AgentToken (ERC-20) contract is deployed
  2. 100% of the supply is minted to the launcher contract
  3. A configurable trading fee (0.5% – 2%) is built into every transfer
  4. Fee revenue is split: 70% to the agent wallet, 30% to protocol treasury
  5. Liquidity must be locked for a minimum of 30 days (anti-rug)
User Transfer: 100 tokens → Recipient gets 99 (at 1% fee)
→ Agent wallet gets 0.7
→ Protocol treasury gets 0.3

Launching a Token

const LAUNCHER = '0x89B974b6977157f1E7D743D70e28fCA1B5Ca84b5';

const launcher = new ethers.Contract(LAUNCHER, [
'function launchToken(string name, string symbol, uint256 totalSupply, address agentWallet, uint256 feeRateBps, uint256 liquidityLockDays) external returns (address)',
'function minFeeRate() external view returns (uint256)',
'function maxFeeRate() external view returns (uint256)',
'function minLiquidityLockDays() external view returns (uint256)',
], wallet);

// Launch a new token
const tx = await launcher.launchToken(
'Agent Alpha Token', // name
'AAT', // symbol
ethers.parseEther('1000000000'), // 1 billion total supply
agentWalletAddress, // agent wallet receives trading fees
100, // 1% fee rate (100 basis points)
90, // 90-day liquidity lock
);

const receipt = await tx.wait();
// Parse the TokenLaunched event to get the token address

Launch Parameters

ParameterTypeDescriptionConstraints
namestringToken nameAny
symbolstringToken symbolAny
totalSupplyuint256Total supply (18 decimals)Any > 0
agentWalletaddressFee recipient walletNon-zero
feeRateBpsuint256Trading fee in basis points50–200 (0.5%–2%)
liquidityLockDaysuint256Liquidity lock duration≥ 30 days

AgentToken Contract

Each launched token is an AgentToken — an ERC-20 with built-in transfer fees:

contract AgentToken is ERC20 {
address public immutable launcher;
address public agentWallet; // Receives agent portion of fees
address public protocolTreasury; // Receives protocol portion
uint256 public feeRateBps; // Fee in basis points
uint256 public agentFeeSplitBps; // Agent's share of fees (default: 7000 = 70%)
}

Fee Exemptions

The following addresses are exempt from trading fees:

  • The launcher contract itself
  • The agent wallet
  • Any address set via setFeeExempt(address, true) (launcher only)
  • Minting and burning operations

Fee Calculation

On every token transfer:

fee = transferAmount × feeRateBps / 10000
agentFee = fee × agentFeeSplitBps / 10000 (default: 70%)
protocolFee = fee - agentFee (default: 30%)

recipientReceives = transferAmount - fee

Example (1% fee, 100 tokens transferred):

ComponentAmount
Recipient receives99 tokens
Agent wallet gets0.7 tokens
Protocol treasury gets0.3 tokens

Liquidity

Adding Liquidity

After launching a token, add initial liquidity:

const launcher = new ethers.Contract(LAUNCHER, [
'function addLiquidity(address token, uint256 tokenAmount) external payable',
], wallet);

// Approve token transfer
const token = new ethers.Contract(tokenAddress, [
'function approve(address spender, uint256 amount) external returns (bool)',
], wallet);
await token.approve(LAUNCHER, tokenAmount);

// Add liquidity (ETH + tokens)
await launcher.addLiquidity(tokenAddress, tokenAmount, {
value: ethers.parseEther('1.0'), // ETH for liquidity
});
DEX Integration

In production, addLiquidity() would interact with Abstract's native DEX (e.g., a Uniswap V2/V3 style AMM). Currently, it holds ETH and tokens as a simplified liquidity reserve.

Withdrawing Liquidity

After the lock period expires:

const launcher = new ethers.Contract(LAUNCHER, [
'function withdrawLiquidity(address token) external',
'function isLiquidityLocked(address token) external view returns (bool)',
'function getLaunchConfig(address token) external view returns (tuple(address token, address agentWallet, uint256 totalSupply, uint256 feeRateBps, uint256 agentFeeSplitBps, uint256 liquidityLockEnd, uint256 launchedAt, bool liquidityAdded))',
], wallet);

// Check if liquidity is still locked
const locked = await launcher.isLiquidityLocked(tokenAddress);
if (!locked) {
await launcher.withdrawLiquidity(tokenAddress);
}

Only the agent wallet or contract owner can withdraw liquidity.

Querying Launches

const launcher = new ethers.Contract(LAUNCHER, [
'function getTokenCount() external view returns (uint256)',
'function allTokens(uint256 index) external view returns (address)',
'function getLaunchConfig(address token) external view returns (tuple(address token, address agentWallet, uint256 totalSupply, uint256 feeRateBps, uint256 agentFeeSplitBps, uint256 liquidityLockEnd, uint256 launchedAt, bool liquidityAdded))',
'function getAgentTokens(address agentWallet) external view returns (address[])',
], provider);

// Total tokens launched
const count = await launcher.getTokenCount();

// Get launch config for a token
const config = await launcher.getLaunchConfig(tokenAddress);
console.log('Agent wallet:', config.agentWallet);
console.log('Fee rate:', Number(config.feeRateBps) / 100, '%');
console.log('Liquidity locked until:', new Date(Number(config.liquidityLockEnd) * 1000));

// Get all tokens launched by an agent
const agentTokens = await launcher.getAgentTokens(agentWalletAddress);

Admin Functions

The launcher owner can adjust global parameters:

function setProtocolTreasury(address _treasury) external onlyOwner;
function setFeeRateBounds(uint256 _min, uint256 _max) external onlyOwner;
function setMinLiquidityLockDays(uint256 _days) external onlyOwner;
function setDefaultAgentFeeSplit(uint256 _splitBps) external onlyOwner;

Events

EventDescription
TokenLaunched(token, agentWallet, name, symbol, supply, feeRate)New token deployed
LiquidityAdded(token, ethAmount, tokenAmount)Liquidity added to a token
LiquidityWithdrawn(token, to)Liquidity withdrawn after lock

Use Cases

Use CaseDescription
Agent Compute FundingTrading fees automatically fund agent operating costs
Community TokensLaunch community tokens with built-in revenue sharing
Protocol TokensProtocols can launch tokens with anti-rug protections
Meme TokensFair launch with locked liquidity and transparent fees