PonzuRecipe (Factory)
Copy
Ask AI
const PONZU_RECIPE = '0x1155484c5fE614538d83c444f9a6dB662E6a7153'
const RECIPE_ABI = parseAbi([
'function craftPonzu((' +
'address owner, ' +
'address keyContract, ' +
'uint256 initialBuyAmount, ' +
'uint256 vestingDuration, ' +
'bytes32 pricingStrategyTemplate, ' +
'bytes pricingStrategyData, ' +
'bytes feeStrategyData, ' +
'string tokenName, ' +
'string tokenSymbol, ' +
'string metadata, ' +
'string imageURI' +
') params) payable',
])
Deploy a Token
Copy
Ask AI
import { parseEther, parseAbi, keccak256, toBytes, encodeAbiParameters } from 'viem'
// Calculate pricing
const targetRaise = parseEther('3')
const endPriceWei = (targetRaise * 20n) / (11n * 690_000n)
const startPriceWei = endPriceWei / 10n
const pricingStrategyTemplate = keccak256(toBytes('LinearPricingStrategy'))
const pricingStrategyData = encodeAbiParameters(
[{ type: 'uint256' }, { type: 'uint256' }],
[startPriceWei, endPriceWei],
)
const devBuyEth = parseEther('0.1') // optional first purchase (0n to skip)
const params = {
owner: account.address,
keyContract: '0x0000000000000000000000000000000000000000',
initialBuyAmount: devBuyEth,
vestingDuration: 864000n, // 10 days in seconds
pricingStrategyTemplate,
pricingStrategyData,
feeStrategyData: '0x',
tokenName: 'My Token',
tokenSymbol: 'MYTKN',
metadata: 'ipfs://Qm...',
imageURI: 'ipfs://Qm...',
}
// 0.005 ETH creation fee + dev buy
const value = parseEther('0.005') + devBuyEth
const hash = await wallet.writeContract({
address: PONZU_RECIPE,
abi: RECIPE_ABI,
functionName: 'craftPonzu',
args: [params],
value,
})
Parse Deployed Addresses
Copy
Ask AI
const ponzuCraftedTopic = keccak256(toBytes(
'PonzuCrafted(address,string,(address,address,address,address,address,address,address,address,address))'
))
const receipt = await publicClient.waitForTransactionReceipt({ hash })
const log = receipt.logs.find(l => l.topics[0] === ponzuCraftedTopic)!
const [, , addresses] = decodeAbiParameters(
[
{ type: 'string' },
{
type: 'tuple',
components: [
{ name: 'project', type: 'address' },
{ name: 'operator', type: 'address' },
{ name: 'token', type: 'address' },
{ name: 'presale', type: 'address' },
{ name: 'launcher', type: 'address' },
{ name: 'distributor', type: 'address' },
{ name: 'farm', type: 'address' },
{ name: 'ponzuBottle', type: 'address' },
{ name: 'liquidityCard', type: 'address' },
],
},
],
log.data,
)
Presale
Copy
Ask AI
const PRESALE_ABI = parseAbi([
'function presale(uint256 minTokenAmount, address platformReferrer, address orderReferrer) payable',
'function refund(uint256 tokenAmount)',
'function claim()',
'function claimETH(uint256 tokenId)',
'function triggerLaunch()',
'function tokensAvailable() view returns (uint256)',
'function launched() view returns (bool)',
'function launchTime() view returns (uint256)',
'function purchases(uint256 tokenId) view returns (uint256)',
'function ethContributions(uint256 tokenId) view returns (uint256)',
])
Buy Tokens
Copy
Ask AI
const ethToSpend = parseEther('0.1')
const minTokensOut = 0n // slippage guard
const ZERO = '0x0000000000000000000000000000000000000000'
await wallet.writeContract({
address: presaleAddress,
abi: PRESALE_ABI,
functionName: 'presale',
args: [minTokensOut, ZERO, ZERO],
value: ethToSpend,
})
Read Presale State
Copy
Ask AI
const tokensAvailable = await publicClient.readContract({
address: presaleAddress, abi: PRESALE_ABI,
functionName: 'tokensAvailable',
})
const launched = await publicClient.readContract({
address: presaleAddress, abi: PRESALE_ABI,
functionName: 'launched',
})
const launchTime = await publicClient.readContract({
address: presaleAddress, abi: PRESALE_ABI,
functionName: 'launchTime',
})
Refund (Before Launch)
Copy
Ask AI
await wallet.writeContract({
address: presaleAddress, abi: PRESALE_ABI,
functionName: 'refund',
args: [tokensToRefund],
})
Trigger Launch (When Sold Out)
Copy
Ask AI
await wallet.writeContract({
address: presaleAddress, abi: PRESALE_ABI,
functionName: 'triggerLaunch',
args: [],
})
Claim Vested Tokens (One-Time)
Copy
Ask AI
await wallet.writeContract({
address: presaleAddress, abi: PRESALE_ABI,
functionName: 'claim',
args: [],
})
Claim ETH Rewards (Repeatable)
Copy
Ask AI
await wallet.writeContract({
address: presaleAddress, abi: PRESALE_ABI,
functionName: 'claimETH',
args: [bottleTokenId],
})
PonzuSwap (DEX)
Copy
Ask AI
const PONZU_SWAP_FACTORY = '0x1DCA548D67938E6162f0756985cC3e539Aae30C2'
const PONZU_ROUTER = '0xb90BD8EA30dE3b1DF07Eb574374229F4213F649e'
const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
const FACTORY_ABI = parseAbi([
'function getPair(address tokenA, address tokenB) view returns (address pair)',
])
const ROUTER_ABI = parseAbi([
'function swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) payable returns (uint256[] amounts)',
'function swapExactTokensForETH(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns (uint256[] amounts)',
])
const PAIR_ABI = parseAbi([
'function getReserves() view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)',
'function approve(address spender, uint256 amount) returns (bool)',
])
const ERC20_ABI = parseAbi([
'function approve(address spender, uint256 amount) returns (bool)',
])
Buy Tokens (ETH -> Token)
Copy
Ask AI
const ethIn = parseEther('0.1')
const minOut = 0n
const deadline = BigInt(Math.floor(Date.now() / 1000) + 300)
await wallet.writeContract({
address: PONZU_ROUTER, abi: ROUTER_ABI,
functionName: 'swapExactETHForTokens',
args: [minOut, [WETH, tokenAddress], account.address, deadline],
value: ethIn,
})
Sell Tokens (Token -> ETH)
Copy
Ask AI
// Step 1: Approve
await wallet.writeContract({
address: tokenAddress, abi: ERC20_ABI,
functionName: 'approve',
args: [PONZU_ROUTER, tokenAmountIn],
})
// Step 2: Swap
await wallet.writeContract({
address: PONZU_ROUTER, abi: ROUTER_ABI,
functionName: 'swapExactTokensForETH',
args: [tokenAmountIn, minEthOut, [tokenAddress, WETH], account.address, deadline],
})
Farm (LP Staking)
Copy
Ask AI
const ZAP_ETH = '0x33a1FB28125e3a396743Ac40B43f56499a13575D'
const ZAP_ABI = parseAbi([
'function calculateExpectedLP(address tokenB, uint256 ethAmount) view returns (uint256)',
'function zapETHToLP(address tokenB, uint256 minLPTokens) payable returns (uint256 lpAmount)',
])
const FARM_ABI = parseAbi([
'function stake(uint256 amount)',
'function stakeNewCard(uint256 amount)',
'function unstake(uint256 cardId)',
'function claim(uint256 cardId)',
'function claimETH(uint256 cardId)',
])
ZapETH -> LP (One Transaction)
Copy
Ask AI
const expectedLP = await publicClient.readContract({
address: ZAP_ETH, abi: ZAP_ABI,
functionName: 'calculateExpectedLP',
args: [tokenAddress, ethAmount],
})
const slippage = 50n // 0.5%
const minLP = expectedLP * (10000n - slippage) / 10000n
await wallet.writeContract({
address: ZAP_ETH, abi: ZAP_ABI,
functionName: 'zapETHToLP',
args: [tokenAddress, minLP],
value: ethAmount,
})
Stake LP
Copy
Ask AI
// Approve LP to Farm
await wallet.writeContract({
address: pairAddress, abi: PAIR_ABI,
functionName: 'approve',
args: [farmAddress, lpAmount],
})
// Stake (mint new LiquidityCard)
await wallet.writeContract({
address: farmAddress, abi: FARM_ABI,
functionName: 'stakeNewCard',
args: [lpAmount],
})
Claim Rewards
Copy
Ask AI
// Token rewards (one-time per card)
await wallet.writeContract({
address: farmAddress, abi: FARM_ABI,
functionName: 'claim', args: [cardId],
})
// ETH rewards (repeatable)
await wallet.writeContract({
address: farmAddress, abi: FARM_ABI,
functionName: 'claimETH', args: [cardId],
})
Unstake
Copy
Ask AI
// Full withdrawal. Burns LiquidityCard. May apply early exit penalty.
await wallet.writeContract({
address: farmAddress, abi: FARM_ABI,
functionName: 'unstake', args: [cardId],
})
Full Reference
Complete unabridged ABI: ponzu.app/SKILL.md.Contract Addresses
Deployed addresses for Ethereum mainnet and Sepolia testnet.

