Smart contracts for the perpgame launchpad — NAV-anchored token launches backed by leveraged-token treasuries on HyperEVM.
Read the whitepaper →
perpgame lets anyone launch a token whose price is anchored to the real net asset value (NAV) of an on-chain treasury. Each launch deploys two linked contracts:
AgentTreasury— an upgradeable (beacon proxy) vault that holds a weighted portfolio of Hyperliquid leveraged tokens (LTs). AREBALANCERrole sets target weights (with an on-chain reasoning CID), and the treasury redeems/acquires LTs to track them. The portfolio's USDC value defines the curve's NAV.AgentCurve— an ERC-20 token plus a NAV-anchored bonding curve. Buyers mint tokens by depositing USDC (forwarded into the treasury as new LT positions); sellers burn tokens to redeem their pro-rata share of NAV. An early-launch premium decays with supply.
Treasuries are produced by a single TreasuryFactory, which deploys the treasury + curve pair atomically behind a shared beacon, collects a protocol fee, and exposes a global emergency pause that halts buys and sells across every treasury at once.
The contracts target HyperEVM (Hyperliquid's EVM chain) and integrate with the Bounce leveraged-token factory and helper for LT pricing and atomic-redeem capacity.
src/
AgentTreasury.sol Upgradeable LT-portfolio vault; NAV source; rebalancer-managed
AgentCurve.sol ERC-20 + NAV-anchored bonding curve (buy/sell, premium decay)
TreasuryFactory.sol CREATE2 + beacon-proxy deployer, fees, global pause
interfaces/
IBounceLT.sol Minimal interface to Bounce leveraged tokens / global storage
test/
AgentTreasury.t.sol Treasury unit tests
AgentCurve.t.sol Curve unit tests
AgentCurve.fuzz.t.sol Property/fuzz tests for curve math
AgentTreasuryNavFreeze.t.sol NAV-freeze edge-case coverage
TreasuryFactory.t.sol Factory unit tests
TreasuryFactoryFork.t.sol Fork test against live HyperEVM state
BeaconUpgrade.t.sol Upgrade-safety / storage-layout tests
mocks/ USDC, Bounce LT/factory/helper, and factory mocks
script/
DeployTreasuryFactory.s.sol Deploys the beacon + factory
SimulateDeploy.s.sol Dry-run a launch end to end
enable_big_blocks.py HyperEVM big-block helper
scripts/
dump-artifacts.mjs Export ABI + bytecode for the frontend
seed-local-fork.sh Seed a local fork for testing
snapshots/ Gas/storage-layout snapshots used by upgrade tests
Built with Foundry, Solidity 0.8.28 (via-IR, optimizer on). Dependencies — OpenZeppelin contracts (standard + upgradeable) and forge-std — are vendored as git submodules under lib/.
⚠️ The contracts are upgradeable.AgentTreasuryis deployed behind a beacon proxy; storage layout is append-only and protected byBeaconUpgrade.t.sol. Read the upgrade-discipline notes inAgentTreasury.solbefore changing any state variable.
Audit. These contracts have been audited by Phage Security. The full report is available here: 2026-06 perpGame audit (PDF).
Responsible disclosure. If you discover a vulnerability, please email security@perpgame.xyz rather than opening a public issue. We will acknowledge your report and coordinate a fix and disclosure timeline with you.
- Install Foundry:
curl -L https://foundry.paradigm.xyz | bash foundryup - Clone with submodules (or initialize them after cloning):
git clone --recurse-submodules git@github.com:perpgame/contracts.git # or, in an existing checkout: git submodule update --init --recursive - Compile:
forge build
forge test -vvMost tests run against the mocks in test/mocks/. The fork tests (TreasuryFactoryFork.t.sol) require a HyperEVM RPC endpoint:
export HYPEREVM_RPC_URL=https://rpc.hyperliquid.xyz/evm
forge test -vvConfigure the environment (see foundry.toml for the RPC and verifier keys):
export DEPLOYER_PK=<hex private key>
export HYPEREVM_RPC_URL=https://rpc.hyperliquid.xyz/evmDeploy the beacon + factory, then launch treasuries through it:
forge script script/DeployTreasuryFactory.s.sol:DeployTreasuryFactory \
--rpc-url $HYPEREVM_RPC_URL --broadcastUse SimulateDeploy.s.sol to dry-run a full launch (treasury + curve) before broadcasting.
MIT
