A Dynamic Fundraising Stablecoin Protocol for Open-Source Projects
ZakoKen (雜魚券): Dynamic Fundraising Stablecoin with Dual-Liquidity Arbitrage
ZakoKen is an innovative fundraising stablecoin protocol that implements a novel "greed model" for sustainable open-source project funding. Built for ETHGlobal Buenos Aires hackathon, this project demonstrates how LayerZero's Omnichain Fungible Token (OFT) standard and Uniswap v4 hooks can be combined to create a dual-liquidity mechanism that stabilizes token prices while maximizing project treasury value through controlled arbitrage.
Core Innovation:
The protocol introduces a unique dual-pool architecture:
When price differentials exceed 0.5%, a project-controlled arbitrage bot executes profitable trades to stabilize prices and capture value for the treasury, creating a self-sustaining funding mechanism.
Technical Architecture:
Smart Contracts (Solidity):
Frontend (Next.js 15):
Cross-Chain Implementation:
Greed Model: The anti-speculation mechanism dynamically adjusts minting amounts based on:
Target Sponsor Tracks:
Technology Stack:
Smart Contracts:
Frontend:
Development Tools:
Partner Technology Integration:
LayerZero V2 OFT (Omnichain Fungible Token): We extended the LayerZero OFT standard to implement compose message functionality, which is the cornerstone of our cross-chain metadata transmission. Every mint operation calls mintWithCompose() which creates a compose message containing off-chain transaction metadata (tx hash, timestamp, amount, greed index). This data is then transmitted cross-chain using LayerZero's _lzSend() and processed via our custom lzCompose() implementation. The compose message format uses abi.encode() to pack structured data:
struct ComposeMsg { bytes32 transactionHash; uint256 timestamp; uint256 amount; address recipient; bytes32 projectId; uint256 greedIndex; }
This allows us to maintain transparency about off-chain transactions while enabling cross-chain token transfers between Ethereum Sepolia and Base Sepolia. The benefit: we can prove the legitimacy of minted tokens by linking them to real off-chain activity, creating trust in the fundraising mechanism.
Uniswap v4 Hooks: We implemented a custom hook (ZakoKenHook.sol) that calculates dynamic fees based on price deviation from the 1:1 peg. The hook implements beforeSwap() to inject custom fee logic and afterSwap() to track price movements. The dynamic fee formula is:
fee = BASE_FEE + (priceDeviation * 2)
Clamped between 0.01% (MIN_FEE) and 2% (MAX_FEE). This creates a natural stabilization mechanism where larger price deviations result in higher fees, discouraging destabilizing trades while allowing the arbitrage bot to profit. The hook also emits ArbitrageDetected events when price differentials exceed 0.5%, triggering treasury value capture.
Notable Hacks and Technical Challenges:
solidity: { compilers: [ { version: "0.8.24", settings: { optimizer: { enabled: true, runs: 200 }, viaIR: true } }, { version: "0.8.20", settings: { optimizer: { enabled: true, runs: 200 }, viaIR: true } } ] }
This allows us to compile Uniswap v4 hooks with the required compiler while maintaining compatibility with LayerZero contracts.
OpenZeppelin Version Downgrade: We discovered that LayerZero OFT V2 is incompatible with OpenZeppelin v5.x due to Ownable constructor changes. We downgraded to OpenZeppelin v4.9.6 and updated all contract constructors to remove the _owner parameter from Ownable initialization. This required careful refactoring of FixedExchange, ZakoKenHook, and MockUSDC contracts.
Greed Model Implementation: The anti-speculation greed model required tracking per-user minting history and calculating dynamic multipliers. We implemented three penalty factors:
The final formula combines these factors: multiplier = BASE_MULTIPLIER × velocityPenalty × sizePenalty × concentrationPenalty
Clamped between 0.5x and 5x to prevent extreme cases. This creates a fair distribution mechanism that rewards long-term supporters while penalizing speculators.
webpack: (config) => { config.externals.push('pino-pretty', 'lokijs', 'encoding'); return config; }
This prevents server-side bundling issues with browser-only Web3 libraries.
uint256 usdcAmount = (zkkAmount * exchangeRate) / BASIS_POINTS / 1e12;
The division by 1e12 converts from 18 decimals to 6 decimals while maintaining precision.
Testing Strategy: We wrote 68 Solidity tests using Foundry's forge-std framework, achieving 100% pass rate. Tests cover:
The test suite validates greed model calculations, cross-chain message encoding, dynamic fee computation, and collateral management.
Build Process:
Architecture Highlights:

