MonoPump Integration
This guide covers programmatic integration with MonoPump, the bonding curve token launchpad on Monolythium. Use this to build frontends, bots, or backend services that create tokens, execute trades, and track graduation events.
For a conceptual overview of MonoPump, see MonoPump.
Contract Addresses
Testnet (Chain ID: 6940)
| Contract | Address |
|---|---|
| MonoPump | 0x6f9edea7ce78787fb4912832f00c670d0f10e7d5 |
| Referral | 0xEC3d6023dF47741d22b025712C667272C88CF074 |
| CreatorVesting | 0x476d9928b44E14190FB6c4eC56AA58216cbA2294 |
| MonoRouter | 0xec3d6023df47741d22b025712c667272c88cf074 |
| FeeCollector | 0xfdfd508c8e550bc16d56767c21c1ba00ed060ff0 |
Key Function Signatures
Launch a Token (Basic)
function launch(string calldata name, string calldata symbol)
external returns (address token);
Creates a basic PumpToken with 1B fixed supply on the bonding curve. No additional features.
Launch a Token (Advanced)
function launchAdvanced(
string calldata name,
string calldata symbol,
TokenMetadata calldata metadata,
AntiWhaleConfig calldata antiWhale,
VestingConfig calldata vesting
) external payable returns (address token);
Creates a PumpTokenV2 with optional metadata, anti-whale protection, and creator vesting.
Buy Tokens
function buy(address token, uint256 minTokensOut, address referrer)
external payable;
Sends LYTH to buy tokens along the bonding curve. The minTokensOut parameter provides slippage protection. Pass address(0) for referrer if no referral.
Sell Tokens
function sell(address token, uint256 tokenAmount, uint256 minLythOut)
external;
Sells tokens back to the bonding curve for LYTH. Requires prior ERC-20 approval of the MonoPump contract.
Fee Structure
| Fee | Rate | When | Recipient |
|---|---|---|---|
| Buy fee | 2% (200 bps) | Every purchase | FeeCollector (or Referral contract if referrer set) |
| Sell tax | 20% decaying to 0% over 7 days | Every sale during decay period | FeeCollector |
| Graduation fee | 1.5% (150 bps) | At graduation | FeeCollector |
Referral Fee Split
When a referrer is set, the 2% buy fee flows through the Referral contract:
- 5% of the fee goes to the referrer (configurable up to 10%)
- 95% of the fee goes to the FeeCollector
Example: On a 1 LYTH purchase, the 0.02 LYTH fee is split as 0.001 LYTH to the referrer and 0.019 LYTH to the FeeCollector.
Bonding Curve Mechanics
MonoPump uses a linear bonding curve:
price(supply) = initialPrice + (curveCoefficient * supply) / 1e18
| Parameter | Default Value |
|---|---|
| Total Supply | 1,000,000,000 (1B tokens) |
| Initial Price (p0) | 0.000001 LYTH |
| Curve Coefficient (k) | 1e6 |
| Graduation Threshold | 10 LYTH raised |
When the total LYTH raised reaches the graduation threshold, the token graduates automatically: liquidity migrates to MonoSwap, LP tokens are burned to 0x...dEaD, and the token trades freely on the DEX.
Integration with viem
Setup
import { createPublicClient, createWalletClient, http, parseEther, formatEther } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
const monolythiumTestnet = {
id: 6940,
name: 'Monolythium Testnet',
nativeCurrency: { name: 'Lythium', symbol: 'LYTH', decimals: 18 },
rpcUrls: {
default: { http: ['https://evm.testnet.mononodes.xyz'] },
},
blockExplorers: {
default: { name: 'Monoscan', url: 'https://testnet.monoscan.xyz' },
},
} as const;
const account = privateKeyToAccount('0xYOUR_PRIVATE_KEY');
const publicClient = createPublicClient({
chain: monolythiumTestnet,
transport: http(),
});
const walletClient = createWalletClient({
account,
chain: monolythiumTestnet,
transport: http(),
});
const MONOPUMP = '0x6f9edea7ce78787fb4912832f00c670d0f10e7d5';
Launch a Token
const monoPumpAbi = [
{
name: 'launch',
type: 'function',
stateMutability: 'nonpayable',
inputs: [
{ name: 'name', type: 'string' },
{ name: 'symbol', type: 'string' },
],
outputs: [{ name: 'token', type: 'address' }],
},
] as const;
const hash = await walletClient.writeContract({
address: MONOPUMP,
abi: monoPumpAbi,
functionName: 'launch',
args: ['My Token', 'MTK'],
});
const receipt = await publicClient.waitForTransactionReceipt({ hash });
console.log('Token launched in tx:', receipt.transactionHash);
Buy Tokens
const buyAbi = [
{
name: 'buy',
type: 'function',
stateMutability: 'payable',
inputs: [
{ name: 'token', type: 'address' },
{ name: 'minTokensOut', type: 'uint256' },
{ name: 'referrer', type: 'address' },
],
outputs: [],
},
] as const;
const hash = await walletClient.writeContract({
address: MONOPUMP,
abi: buyAbi,
functionName: 'buy',
args: [
'0xTokenAddress', // token to buy
0n, // minTokensOut (0 for no slippage protection)
'0x0000000000000000000000000000000000000000', // no referrer
],
value: parseEther('1'), // 1 LYTH to spend
});
Sell Tokens
import { erc20Abi } from 'viem';
const tokenAddress = '0xTokenAddress';
const sellAmount = parseEther('1000000'); // 1M tokens
// Step 1: Approve MonoPump to spend your tokens
await walletClient.writeContract({
address: tokenAddress,
abi: erc20Abi,
functionName: 'approve',
args: [MONOPUMP, sellAmount],
});
// Step 2: Sell
const sellAbi = [
{
name: 'sell',
type: 'function',
stateMutability: 'nonpayable',
inputs: [
{ name: 'token', type: 'address' },
{ name: 'tokenAmount', type: 'uint256' },
{ name: 'minLythOut', type: 'uint256' },
],
outputs: [],
},
] as const;
await walletClient.writeContract({
address: MONOPUMP,
abi: sellAbi,
functionName: 'sell',
args: [tokenAddress, sellAmount, 0n],
});
Listen for Graduation Events
const graduatedAbi = [
{
name: 'Graduated',
type: 'event',
inputs: [
{ name: 'token', type: 'address', indexed: true },
{ name: 'pair', type: 'address', indexed: false },
{ name: 'liquidity', type: 'uint256', indexed: false },
],
},
] as const;
const unwatch = publicClient.watchContractEvent({
address: MONOPUMP,
abi: graduatedAbi,
eventName: 'Graduated',
onLogs: (logs) => {
for (const log of logs) {
console.log(`Token ${log.args.token} graduated!`);
console.log(`DEX pair: ${log.args.pair}`);
console.log(`Liquidity: ${formatEther(log.args.liquidity)} LYTH`);
}
},
});
Integration with ethers.js
Buy Tokens
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider('https://evm.testnet.mononodes.xyz');
const wallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);
const monoPump = new ethers.Contract(
'0x6f9edea7ce78787fb4912832f00c670d0f10e7d5',
['function buy(address token, uint256 minTokensOut, address referrer) payable'],
wallet,
);
const tx = await monoPump.buy(
'0xTokenAddress',
0, // minTokensOut
'0x0000000000000000000000000000000000000000', // no referrer
{ value: ethers.parseEther('1') },
);
await tx.wait();
Referral Integration
To earn referral fees, register users through the Referral contract before their first trade:
const referralAbi = [
{
name: 'register',
type: 'function',
stateMutability: 'nonpayable',
inputs: [
{ name: 'referee', type: 'address' },
{ name: 'referrer', type: 'address' },
],
outputs: [],
},
] as const;
// The referee must call this themselves (msg.sender == referee)
await walletClient.writeContract({
address: '0xEC3d6023dF47741d22b025712C667272C88CF074',
abi: referralAbi,
functionName: 'register',
args: [refereeAddress, referrerAddress],
});
Alternatively, pass the referrer address in the buy() call. If the user has no referrer set, MonoPump registers the relationship during the first purchase (when configured as an authorized caller on the Referral contract).
Claiming Referral Rewards
const claimAbi = [
{
name: 'claim',
type: 'function',
stateMutability: 'nonpayable',
inputs: [],
outputs: [],
},
{
name: 'pendingRewards',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'referrer', type: 'address' }],
outputs: [{ name: '', type: 'uint256' }],
},
] as const;
const pending = await publicClient.readContract({
address: '0xEC3d6023dF47741d22b025712C667272C88CF074',
abi: claimAbi,
functionName: 'pendingRewards',
args: [referrerAddress],
});
console.log(`Pending rewards: ${formatEther(pending)} LYTH`);
// Claim accumulated rewards
await walletClient.writeContract({
address: '0xEC3d6023dF47741d22b025712C667272C88CF074',
abi: claimAbi,
functionName: 'claim',
});
Graduation Process
Graduation happens automatically when the total LYTH raised by a token reaches the graduation threshold (default: 10 LYTH). No manual trigger is required -- it executes at the end of the buy transaction that crosses the threshold.
- 1.5% graduation fee is deducted from total raised LYTH and sent to FeeCollector
- Remaining LYTH + unsold tokens are added as liquidity on MonoSwap via MonoRouter
- LP tokens are burned to
0x000000000000000000000000000000000000dEaD - The token is marked as graduated and can no longer be traded on the bonding curve
- A
Graduated(token, pair, liquidity)event is emitted
After graduation, the token trades freely on MonoSwap like any other pair.
Related
- MonoPump -- Conceptual overview, launch tiers, bonding curve math
- Referral Program -- Full referral mechanics and reward rates
- Contract Addresses -- All deployed contract addresses
- Trading API -- REST API for market data and order execution