尚未收集仓库信息。
尚未检测到更新。GitHub 发布版本后会显示在这里。
Meme coin launchpad on NEAR where every coin has to be kept alive. USDC only, testnet.
翻译准备中
正在加载完整 README。
查看完整 README ↗NearBowl is a USDC meme-coin launchpad on NEAR. Anyone can launch a coin by sending USDC into one factory contract. That USDC is the coin's pool. People trade against a linear bonding curve, quoted only in USDC. Nobody can withdraw the pool except through the rules below.
Each coin is a pet that has to be fed.
This repository is a testnet prototype. The app is at https://nearbowl.vercel.app/.
Price grows with the square root of the pool. With reserve R and supply s:
p(s) = k s
R(s) = k s² / 2
s(R) = sqrt(2R / k)
market cap = p · s = 2R
The contract stores R and s. k = 2R / s² is derived, so a fee that stays in the pool without minting raises k. USDC in and out does not depend on k. Token amounts use 18 decimals. USDC amounts use 6 decimals (1 USDC = 1_000_000).
Buy. A gross amount is split into a 1% fee. 0.50% stays in the reserve and mints nothing (inheritance), 0.30% is protocol fees, 0.20% is creator fees. The other 99% is to_curve. Tokens minted:
s_new = floor_isqrt( s² · (R + to_curve) / R )
Sell. A holder selling down to supply s' receives, before the 1% fee:
payout = R · (1 − (s' / s) ^ (2 − w))
w = 0 is the curve: R (1 − (s' / s)²).w = 1 is pro-rata: R · x / s.Hunger weight, rounded up to the next 1/64 (that favors the pool):
w_time = ceil(64 · clamp(1 − T_rem / T_ref, 0, 1)) / 64
w = max(w_time, scar)
T_ref is the initial life (24 hours in production and on the public testnet factory, 45 seconds on the legacy short timer). The scar jumps up to w_time immediately and falls by at most 1/64 per recovery step (90 minutes in production and on the public testnet factory, 3 seconds on the legacy short timer). Feeding a coin back to full does not instantly restore curve exits. The public factory is pet.nearbowl.testnet. Its timers are in Deploy to testnet, and timer controls are off. factory.nearbowl.testnet is a legacy short-timer factory (45 second initial life, 180–540 second cap, timer controls on). The app does not use it. scripts/demo.mjs is the only thing that still talks to that legacy factory.
Timer. Only buys extend it. A buy of G USDC (at least 1) adds
raw = G · ext_per_usdc · f
f = 1 when time left ≥ twilight
f = 0.25 + 0.75 · T_rem / T_tw otherwise
Each account has a leaky bucket. Recent raw seconds leak at 0.25 per second. The next raw seconds are credited at 100% for the first tier, 50% for the second, and 0% after that. One account cannot keep a coin alive by itself. The new remaining time is capped by max_life(R): 24 hours below 1,000 USDC, 72 hours above 100,000 USDC, linear between (180 seconds to 540 seconds on the short demo timer).
Death and claims. Death is lazy: the next write notices now ≥ deadline, snapshots (R, s), and stops trading. A claim pays floor(R_snap · x / s_snap). The creator also claims the seed tokens, then keeps floor(gross / 2). The rest of that gross is a protocol fee. Ignoring fees, the creator breaks even only if the pool is about 4× the seed at death, because 1 / (1 − 0.5)² = 4.
Every integer step rounds toward the pool. Sums of squares use 256-bit intermediates because a normal seed supply does not fit in u128 when squared.
The reference math is sim/sim.py. python3 sim/sim.py checks the formulas. The contract's integer path matches that file's Factory model.
One factory contract (contracts/factory, near-sdk 5.30.1, near_sdk::store collections) holds every coin in an internal ledger. USDC comes in only through ft_on_transfer from the configured token account. Sells and claims send USDC out with ft_transfer, then a private callback. If that transfer fails, the callback restores the burned tokens, the reserve, and the fees.
Coins do not show up as NEP-141 tokens in wallets. Three read-only views use NEP-245-shaped names (mt_balance_of, mt_batch_balance_of, mt_supply) so generic tooling can read balances. There is no mt_transfer. The contract does not claim NEP-245 compliance.
tUSDC (contracts/tusdc) is a testnet-only mock NEP-141 with 6 decimals and a public faucet (100 tUSDC, once a minute per account). The factory does not special-case it. Point usdc_account_id at Circle testnet USDC 3e2210e1184b45b64c8a434c0a7e7b23cc04ea7eb7a6c3c32520d03d4afcb8af and the same wasm works. Do not use bridged USDC.e.
The web app (web/) is Next.js App Router. It reads the factory over RPC and sends transactions with NEAR Wallet Selector (Meteor, MyNearWallet, HOT, Intear).
python3 sim/sim.py
cargo test --workspace --exclude nearbowl-sandbox
bash scripts/build-contracts.sh
cargo test -p nearbowl-sandbox -- --test-threads=1
Sandbox tests need OpenSSL headers (libssl-dev, pkg-config) and a built wasm. They cover launch → buy → feed → sell → death → claim, a wrong token, a malformed message, a launch without storage, a buy on a dead coin, a payout to an account that is not registered on USDC, and demo_set_remaining with demo controls off.
以上为 README 的开头部分。其余内容请阅读原文。 查看完整 README ↗