API reference

Public functions, documented.

Every external function across BondingCurve, Router, PairFactory, TokenFactory, NFTFactory, and Treasury. Generated from NatSpec comments on the deployed contracts.

contracts 8 external fns 32 solc 0.8.24 spec NatSpec

BondingCurve.sol

Sells 0x1 along a linear price curve in exchange for ETH. One-way; the contract has no sell-back. 900M 0x1 are held in the contract at deploy and sold over ~521 ETH.

function mint(uint256 amount) external payable
state-changing

Mint amount 0x1 to the caller's address against the current curve price. Caller must attach cost = ((s+a)² - s²) / (2·SCALE) ETH or more.

amountuint2560x1 to mint · max 500,000 per tx

Reverts with AmountIsZero, AmountAboveCap, CurveExhausted, or InsufficientEth.

function quote(uint256 amount) external view returns (uint256)
view

Return the ETH cost to mint amount 0x1 at the current supply. Useful for slippage-aware UIs.

function withdrawToTreasury() external
state-changing

Forward the contract's full ETH balance to the Treasury contract. Anyone can call. No keeper required.

ECTRouter.sol

User-facing entry point for swaps. Routes through 0x1 automatically when called with two non-0x1 tokens.

function swapExactETHForTokens(uint256 amountOutMin, address tokenOut) external payable returns (uint256)
state-changing

Swap attached ETH for tokenOut. Reverts if output is below amountOutMin. Routes ETH → 0x1 → tokenOut (two hops) unless tokenOut == 0x1.

function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address tokenIn, address tokenOut) external returns (uint256)
state-changing

Swap tokenIn → tokenOut. If neither is 0x1, routes via 0x1 in two hops. Caller must approve the router for amountIn.

ECTPairFactory.sol

Deploys 0x1-anchored Uniswap-V2-style pairs. Enforces that one side of every pair is 0x1.

function createPair(address tokenA, address tokenB) external returns (address)
state-changing

Deploy a new pair. Reverts with MustIncludeZeroX1 if neither tokenA nor tokenB equals 0x1. The pair becomes immediately routable through the Router.

TokenFactory.sol

Deploys fresh fixed-supply ERC-20s in exchange for 1000 0x1, 980 of which are burned.

function launch(string name, string symbol, uint256 supply, address to) external returns (address)
state-changing

Deploy a new token contract with fixed supply minted to to. Caller must approve 1000 0x1 to the factory. 980 burned, 20 to treasury.

NFTFactory.sol

Deploys ERC-721 collections in exchange for 500 0x1, 490 burned.

function launch(string name, string symbol, uint256 size, uint256 mintPrice) external returns (address)
state-changing

Deploy a new ERC-721 collection. mintPrice is denominated in 0x1. Creator gets 99% of mint proceeds, treasury gets 1%.

Treasury.sol

Ownable2Step holding all protocol revenue. Owner is a recommended multisig.

function withdraw(address to, uint256 amount) external onlyOwner
owner-only

Withdraw amount ETH to to. Owner-only. See SECURITY.md for the threat model.

Custom errors

All revert conditions are typed. Use them in your error handling.

AmountIsZeroerrormint/swap called with amount = 0
AmountAboveCaperrorper-tx mint exceeds 500,000 0x1
CurveExhaustederrormint would push past 900M tokens sold
InsufficientEtherrorattached ETH below cost
MustIncludeZeroX1errorcreatePair without 0x1 on a side
SlippageExceedederrorswap output below amountOutMin

Indexed events

All public actions emit indexed events for off-chain consumption.

Mintedeventbuyer, amount, cost, totalSold
SwapeventtokenIn, tokenOut, amountIn, amountOut, sender
PairCreatedeventtokenA, tokenB, pair, allPairsLength
TokenLaunchedeventtoken, creator, supply, name, symbol
CollectionLaunchedeventcollection, creator, size, mintPrice