LIFO is a memecoin on NEAR whose reserve pays the newest buyers first in a crash, so the earliest holders, not the latest, wait at the back of the line.
Watch the film (1:42): a crash played on the live page on NEAR testnet, narrated by Marc.
| Live page | Track | What NEAR does here | Headline result (simulated) |
|---|---|---|---|
| lifo-amt.pages.dev | Memecoins With Mechanics (memecoins) |
An NEP-141 token whose sell rule is in a contract with no access keys, on testnet | Insider dump, 10 seeds: the late group gets 0.781 NEAR back per NEAR under LIFO, 0.503 under the same gate and rounds paid pro rata, 0.317 under a FIFO baseline that sells at once |
For judges · See it work · The problem · How it works · Results · Controls · A strategic insider · What NEAR does here · Review findings · Evidence · Claims · Run it
I built LIFO solo. I hold an MSc in Finance from Grenoble École de Management and work as an auditor in the technology practice of a large European banking group, where my missions cover payment systems and governance. A cap on what can leave a pool per period is a tool finance already uses against runs: some EU money market funds may limit redemptions to 10 % of the fund per working day (Regulation (EU) 2017/1131, Article 34). LIFO puts such a cap on a memecoin's reserve and adds an order of payment. As in an audit, every figure below comes with the command that produced it.
The repository's history starts on 7 November 2026 (git log --reverse), and everything in it was written for this hackathon.
Links go to the code at the release tag v1.1.0.
| Criterion | Where it is answered |
|---|---|
| Technical implementation | The sell rule is in the contract, not in a server. Settlement: settle_finished (the gate, newest vintage first) and claim_settled. 256-bit curve and gate arithmetic: gate_fill. The contract replays the Python model's vectors: vectors.rs, 210 cases and 3,685 steps. Every rule is a numbered requirement (docs/REQUIREMENTS.md) and the contract tests are named after them. Gas per settlement: 1.86 to 3.41 Tgas (Evidence). |
| Design | A page that shows the mechanic as a stack of plates, one per purchase period, with the round clock and the gate: web/index.html, web/app.js. Every action on it is a real testnet transaction (See it work). |
| Impact | Who is left holding the bag in a crash (The problem), measured on the same agents and seeds under LIFO and FIFO (Results) and against control rules that keep the gate and the rounds and change only the order (Controls), and against an insider who plans its exit (A strategic insider). |
| Originality | Exits are ordered by the vintage of the tokens, the date they were bought from the market. No memecoin found that orders exits by purchase vintage (Prior art). Token lots keep their vintage through transfers, and a refund after ft_transfer_call cannot make a token newer: refund, its tests. |
| Sustainability | No owner, no admin method, no upgrade method, no way to change a parameter (new runs once). Both testnet contracts have 0 access keys, checked every 6 hours by live.yml. A settlement costs the same for 1 or 48 sellers, and any account can call it. |
Against the example prompt of the track:
| Requirement | Answer |
|---|---|
| An NEP-141 token with the mechanic in the contract | Yes. The gate and the vintage order are in contract/src/lib.rs; the Worker behind the page only signs for demo accounts and calls settle on a timer. |
| All parameters set at launch, readable, no admin key | new sets them once; get_params returns them; the testnet contracts have 0 access keys. |
| Sybil resistance with its limits written plainly | LIFO works without identities: splitting tokens across accounts changes payouts by rounding only (B6, tested in the contract and in the model). An insider who buys back through a second account is simulated with its numbers in A strategic insider. |
| A page with the current state and a log | lifo-amt.pages.dev: plates, round clock, gate, pool, settled rounds and latest actions, each with a link to its transaction. |
| Simulate first | 60-day simulations of five scenarios, 10 seeds, LIFO against FIFO (Results) and against three control rules with the same gate (Controls). |
Open lifo-amt.pages.dev. It is the same contract code on a fast clock (rounds of 60 s, plates of 3 min), so a crash takes minutes. The switch at the top right selects the launch rules (rounds of 10 min, plates of 24 h).
- Pick a role (early buyer, late buyer, insider, panic seller) and press Buy or Sell. The server signs a real testnet transaction for that demo account; each action is limited to 8 per visitor per 10 minutes.
- Watch the plates. The newest plate is on top and is paid first. Hatched parts are waiting to be sold in the round.
- When a round ends, the gate settles it. If sellers ask for more than 5 % of the reserve, the newest plates are paid and the older ones wait.
The live page during round 1944 on testnet (sped up while the sells arrive). The newest plate is paid; the insider's plate 2, at the bottom, waits.
The screenshots below are the live page at 2x in headless Chromium on 9 November 2026, during a crash played through the page's own buttons (results/crash-page.json lists every transaction). The late buyer and the panic seller bought plate 648. Then, in round 1944, the insider asked to sell everything it holds (plate 2), and the late buyer and the panic seller asked to sell everything they hold (plates 648, 643 and 4).
Before the round ends: every plate being sold is hatched, and 9.57 NEAR is asked against a limit of 0.623 NEAR.
After the Worker's timer settled the round: 0.623 NEAR left the reserve, all of it to plate 648, which shrank from 37.5 M to 26.1 M LIFO. Plates 643, 4 and 2 got nothing this round, and their tokens came back with their vintages.
When a memecoin crashes, the holders who bought last lose most, and the crash is the usual ending: Solidus Labs flagged 98.6 % of the more than seven million tokens launched on Pump.fun since January 2024 as rug pulls or pump-and-dump schemes (CoinDesk, 8 May 2025). That is an analytics firm's classification, and Pump.fun disputes it.
Every memecoin market runs first in, first out: whoever sells first gets the best price, and the last buyers are the exit liquidity. LIFO changes the order that matters in a crash: the reserve pays the newest buyers before the oldest. In calm markets nothing is different.
Full rules, every parameter and every rounding rule: RULES.md. In short:
- One market and one reserve. Buys go through a constant-product curve with virtual reserves (30 NEAR and 1,073,000,000 tokens) and execute at once.
- Vintages. Each buy creates a lot stamped with its vintage, the 24-hour period it was bought in. Vintages travel with the tokens through transfers. Tokens leave an account newest first.
- Sell requests. Selling is a request for the current round (10 minutes at launch). The tokens are locked with their vintages.
- The gate. When a round ends, the next call to the contract settles it. At most 5 % of the reserve can leave per round. If all requests fit, all are filled. If not, vintages are filled from newest to oldest; the vintage where the room runs out is shared pro rata; older vintages get nothing this round.
- One price per batch. Every filled token in the batch gets the same price. Unfilled tokens go back to their owners with their vintage, and an unfilled seller asks again.
- No keys. There is no owner, no admin method, no upgrade method.
Launch parameters: gate 500 bps, round 10 min, vintage 24 h, sell fee 50 bps (stays in the reserve), at most 16 lots per account, maximum supply 80 % of the virtual tokens (this caps the reserve at 120 NEAR).
The reference model lifo/model.py uses exact integers. It writes test vectors; the contract replays them and agrees on every step. The Worker (worker/) holds the keys of the five demo accounts and a one-minute timer that settles finished rounds. The contract accounts hold no key.
All figures in this section are simulated. The simulation (lifo/sim.py) runs 60 days with 20 early buyers, one insider who buys first, retail arrivals with random sizes and holding times, a late group of 120 buyers in the three days before day 20, and holders who sell everything when the price falls a drawn fraction below their peak. Each scenario runs on the same agents and the same seed under LIFO and under a FIFO baseline with the same curve and fee that executes every sell at once. Agent behaviour is drawn from distributions chosen for this model.
Command: python -m lifo.sweep --seeds 10 --workers 4, seeds 1 to 10, launch parameters. Late group's NEAR back per NEAR invested, mean of 10 seeds (results/RECOMMENDED.md):
| Scenario | LIFO | FIFO | Seeds where LIFO is better |
|---|---|---|---|
| Insider dump at the peak | 0.781 | 0.317 | 10 of 10 |
| Panic after a shock | 0.877 | 0.721 | 7 of 10 |
| Calm growth | 1.284 | 1.275 | 5 of 10 |
| Slow distribution by early holders | 0.709 | 0.653 | 10 of 10 |
| Insider who refreshes its tokens (below) | 0.449 | 0.319 | 10 of 10 |
Insider dump, seed 1, days 17 to 23, launch parameters, simulated. Under FIFO the price falls in one round; under LIFO the gate spreads the fall over hours and the late group is paid first.
Around the crash:
- In the 48 hours after the insider dump's peak, the newest third of vintages got 74 % of the NEAR paid out under LIFO and 32 % under FIFO. The largest one-hour price drop was 34 % under LIFO and 92 % under FIFO.
- Early holders are paid after the newest buyers and still come out ahead: 1.271 NEAR back per NEAR in the insider dump (1.374 under FIFO), with the oldest holders' last fill 16.0 hours after they asked, on average; 1.306 in the panic (1.661 under FIFO).
- In calm growth LIFO matches FIFO: 1.284 against 1.275 for the late group.
- The sweep covers 144 parameter sets (9,000 runs). 99 of them meet the criterion set before the sweep: more NEAR back for the late group under LIFO in both the insider dump and the panic, with calm growth within 0.01 of FIFO (
results/SWEEP.md). Queue-fear sensitivity:results/SENSITIVITY.md.
The FIFO baseline above sells at once with no gate, so it differs from LIFO in three ways: the cap of 5 % of the reserve per round, the rounds (one price per batch) and the order (newest vintage first). Three control rules keep LIFO's curve, fee and queue-fear assumption and add one part at a time. Same agents, seeds 1 to 10, launch parameters. Command python -m lifo.controls --seeds 10 --workers 4, code lifo/controls.py, every table, with the insider's eight strategies under each rule, in results/CONTROLS.md.
Late group's NEAR back per NEAR invested, mean of 10 seeds:
| Scenario | FIFO, at once | Cap only, at once | Cap + rounds, pro rata | Cap + rounds, oldest first | LIFO: cap + rounds, newest first |
|---|---|---|---|---|---|
| Insider dump at the peak | 0.317 | 0.654 | 0.503 | 0.255 | 0.781 |
| Panic after a shock | 0.721 | 0.734 | 0.723 | 0.532 | 0.877 |
| Slow distribution by early holders | 0.653 | 0.634 | 0.619 | 0.453 | 0.709 |
| Calm growth | 1.275 | 1.284 | 1.283 | 1.280 | 1.284 |
Mean of 10 seeds, simulated.
- Newest first is what lifts the late group above the same cap and rounds: +0.278 NEAR per NEAR in the insider dump, +0.154 in the panic, +0.090 in the slow distribution, on 10 of 10 seeds each.
- The rounds keep the order fair. With a cap alone, the first sells in a round take the room: when the insider's sells land first in every round, as a faster bot's would, the late group gets 0.339. In a LIFO round every seller gets the same price, so arrival order changes nothing.
- The order decides who is paid. Oldest first, the mirror of LIFO, pays the insider first and gives the late group 0.255 in the dump. Newest first gives it 0.781.
An insider who plans its exit can sell old tokens in calm rounds and buy new ones from a second account, so the new tokens carry a new vintage: a refresh. I simulated it with six other insider strategies. 10 seeds, launch parameters, the insider puts in 8 NEAR (results/REFRESH.md, command python -m lifo.refresh --seeds 10 --workers 4; both rules on the same agents in results/CONTROLS.md):
| Insider strategy | Insider ends with, LIFO (NEAR) | Insider ends with, FIFO (NEAR) | Late group, LIFO | Late group, FIFO |
|---|---|---|---|---|
| Dump everything at the peak | 14.49 | 46.58 | 0.781 | 0.317 |
| Refresh over the 12 hours before the dump, then dump | 41.10 | 46.36 | 0.449 | 0.319 |
- Against a dump at the peak, LIFO takes the insider from 46.58 NEAR to 14.49 and lifts the late group from 0.317 to 0.781 NEAR back per NEAR.
- Against the refresh, the late group gets 0.449 NEAR back per NEAR under LIFO and 0.319 under FIFO, on 10 of 10 seeds.
- The launch rules use a 24-hour vintage. It costs ordinary buyers nothing and takes about one NEAR off the refresh. The study also measured a buy fee, a sell fee on young tokens, a minimum age and vintages up to 7 days (
results/REFRESH.md).
Seven insider strategies, mean of 10 seeds, simulated. Dump: sell everything at the peak. Slow: sell in slices over 12 or 48 hours. Refresh: sell in slices and buy back from a second account, then dump.
| Piece | Use |
|---|---|
| NEP-141, NEP-145, NEP-148 | The token is a fungible token whose balance is a list of lots (vintage, amount). A transfer moves the sender's newest lots and keeps their vintages; the receiver's lots merge by vintage. Each account pays for its own storage; a sell request reserves 2,112 bytes until it is claimed. |
| NEP-297, NEP-330 | Events for buy, sell_request, settle, claim and transfer carry enough data to rebuild every account's lots (a test does it). Source metadata links to this repository. |
| Async receipts | ft_transfer_call returns through ft_resolve_transfer one receipt later, when the receiver may have moved the tokens. The refund is taken from the receiver's oldest lots and is never newer than the oldest vintage sent, so a refund cannot give a token a newer vintage. |
| Bounded settlement | A settlement does work per vintage, not per seller. Each seller's payout is computed from the epoch's aggregates when that seller claims, so no call loops over all sellers. On a local sandbox a settlement cost 1.86 Tgas for 1 vintage and 3.41 Tgas for 48 vintages, against the 300 Tgas limit, and was the same for 1 or 48 requests. MAX_LOTS is at most 64 so a transfer stays bounded. |
| Contract with no keys | After new, the full-access key of both testnet contracts was deleted. Public RPC shows 0 access keys and the code hash Fy1WD6gTKfzB2vNSRFjXRSH3CXNqPxQU3o7caecp27pd, the base58 form of the SHA-256 below. python scripts/live_check.py reads it. |
| Testnet | launch.lifo.testnet (launch rules) and demo.lifo.testnet (rounds of 60 s, plates of 3 min), deployed from the same wasm. |
Wasm: 213,191 bytes, SHA-256 de5cb631a9759d245d3651e30dd5eff4f5d3066a4905d5aa8a35bd62c492675a. Panic messages of dependencies carry the build machine's paths, so a build on another machine can give another hash; CI builds the wasm, prints both hashes and checks the size within 5 %.
Not NEAR-specific but part of the page: a Cloudflare Worker (free plan) serves /api, signs for five demo accounts with ed25519 keys held as secrets, and settles rounds once a minute. It reads the chain through three public testnet RPC endpoints and moves to the next one on a rate limit or a server error (worker/src/chain.js). Rate limits on visitors are in worker/src/limits.js; deployment: worker/DEPLOY.md.
node scripts/crash.mjs --network testnet --keys <keys file> --rpc https://test.rpc.fastnear.com ran on demo.lifo.testnet on 8 November 2026 (01:00:54 to 01:11:20 UTC) and wrote results/crash-testnet.json (14 transactions: 12 accepted, 2 refused with nothing to claim). The early buyer and the insider buy in plate 2, the early buyer buys again in plate 3, a late wave of four buys follows in plate 4. Then the insider, one panic seller and one late buyer ask to sell everything in the same round.
| Step | Transaction (testnet explorer) |
|---|---|
| Insider buys 3 NEAR in plate 2 | 37UQVy2G…VsMm5jy |
| Insider asks to sell everything | 75TZKuyT…itFG6 |
| Late buyer asks to sell everything | GjVjeuNR…TfMsy |
| Panic seller claims its payout | 38qSK4uA…xGZ |
Result in the file, NEAR spent on buys and NEAR paid back by the contract at the end of the run: early 3.000 spent, 0 paid; late 2.000 spent, 0.263 paid; insider 3.000 spent, 0.474 paid; panic 2.000 spent, 0.236 paid. The gate bound in round 14 and let 0.499 NEAR leave (5 % of a reserve of about 10 NEAR); it was paid to the late and panic accounts (plate 4), and the insider's plate 2 got nothing until round 15. It shows the order of payment on a small pool. Rounds 14 and 15 were settled by the Worker's timer, not by the script, so the file's settled_rounds list is empty; the page lists both settlements with their transactions. The two refused claim calls came 3 seconds after the Worker's timer had claimed for the same accounts (FxFpF9fP… for the late buyer, 8pffCESG… for the insider).
An independent review of the contract led to two fixes in its rules, and the model replaced the rounding rule of my first specification. All three have tests.
| Finding | Fix | Test |
|---|---|---|
A colluding receiver of ft_transfer_call could pass the tokens on, report them unused, and have its own older tokens credited to the sender with the newer vintage. Returning the receiver's lots newest first would instead let anyone send old tokens to a busy account that refunds and get its newest tokens back. |
The refund takes the receiver's lots oldest first, and each returned token gets the older of its own vintage and the oldest vintage sent (rule B4'). | b4_a_refund_after_the_receiver_moved_the_tokens_turns_no_old_token_into_a_newer_vintage and three more b4_ tests; the same cases in tests/test_model.py (test_a_refund_after_the_receiver_moved_the_tokens_turns_no_old_token_into_a_newer_vintage and five others) |
| Vintages were 32 bits wide. With 1 ns vintages the value wrapped to 0 after 2^32 ns (4.3 s). | Vintages are 64-bit in records, keys, views and events. | vintages_above_u32_max_do_not_wrap |
| The spec said to round the boundary vintage's pro rata shares down per request. Two one-unit requests at a boundary that can fill one unit both round to zero, the curve has bought one unit, and both sellers get their unit back: tokens are created. | The shares use the exact split floor((s + a) * f / r) - floor(s * f / r). They add up exactly to the vintage's fill. |
c5_the_boundary_vintage_is_shared_pro_rata_and_adds_up_exactly and test_the_boundary_vintage_is_shared_pro_rata_and_the_shares_add_up_exactly in the model tests |
Every figure comes from a command in this repository.
| What | Result | Command or file |
|---|---|---|
| Python model tests | 92 passed, in random order | python -m pytest -q --cov (see Run it) |
Coverage of lifo/model.py |
100 % of 368 statements and 84 branches; the floor is 95 % | same command; pyproject.toml |
| Lint, format, types | ruff, ruff format --check and strict mypy pass |
ruff check ., mypy |
| Contract tests | 34 unit tests named by requirement, 2 replay tests | cargo test -p lifo -j 4 -q |
| Vectors replayed by the contract | edge.json: 10 cases, 134 steps; random.json: 200 cases, 3,551 steps. After every step the contract compares the result or the error, the reserve, the supply, every account's lots and payouts, and the open requests |
contract/tests/vectors.rs |
| Worker and page tests | 33 and 15 passed | node --test (see Run it) |
| Sandbox checks | 21 passed, 0 failed (initialisation, deposits on every method, source metadata) | results/e2e-checks.md |
| Gas, local sandbox (nearcore 2.14.0) | settle 1.86, 1.87, 2.36 and 3.41 Tgas for 1, 1, 16 and 48 vintages (1, 48, 48 and 48 requests); claim 2.26 to 2.43 Tgas on average; buy 3.16 to 3.20 Tgas |
results/gas.md |
| Controls: same gate and rounds, order changed | 550 runs, 10 seeds, 5 rules | python -m lifo.controls --seeds 10 --workers 4; results/CONTROLS.md |
| Scripted crash, testnet | 14 transactions | results/crash-testnet.json |
| Crash through the page's buttons, testnet | 9 transactions; round 1944 paid 0.623 NEAR, all to the newest plate | results/crash-page.json |
| Accessibility, live page (axe-core 4.10.2) | 0 violations at 1440 px and 390 px, demo and launch deployments | cd e2e && npm ci && node axe.mjs |
| Both contracts, public RPC | code hash equals the reviewed wasm; 0 access keys | python scripts/live_check.py |
Each row is a claim this README makes, where it is implemented, and a test that fails if it stops being true. Requirement codes refer to docs/REQUIREMENTS.md; contract tests are in contract/tests/requirements.rs.
| Claim | Where | Test |
|---|---|---|
| When the gate binds, newer vintages are filled before any older one (C5) | settle_finished in contract/src/lib.rs |
c5_newer_vintage_filled_before_older |
| At most 5 % of the reserve leaves per round; the fill is the largest amount under the cap (C3) | gate_fill in contract/src/math.rs |
c3_gate_fill_is_the_largest_amount_under_the_cap; Hypothesis test_the_gate_fill_is_the_exact_largest_amount_under_the_cap |
| In a calm round every request is filled in full (C4) | settle_finished |
c4_a_calm_epoch_fills_every_request |
| Every filled token in a round gets the same price (C6) | claim_settled |
c6_every_filled_token_gets_the_same_price |
| Unfilled tokens come back with their vintage (C7) | claim_settled |
c7_unfilled_tokens_come_back_with_their_vintage_and_no_place_in_line |
| The boundary vintage is shared pro rata and the shares add up exactly (C5) | settle_finished, claim_settled |
c5_the_boundary_vintage_is_shared_pro_rata_and_adds_up_exactly |
| Vintages travel with the tokens through transfers (B2) | ft_transfer |
b2_received_tokens_keep_their_vintages_and_merge_with_equal_ones |
| No path, refunds included, makes a token newer (B4', B5) | refund |
b5_no_path_gives_tokens_a_newer_vintage and the four b4_ tests |
| LIFO's gain over FIFO splits into the cap, the rounds and the order; each control rule changes one of them | KINDS in lifo/sim.py, lifo/controls.py |
test_every_order_lets_the_same_amount_leave_the_reserve and six more in tests/test_controls.py |
| Splitting across accounts changes payouts by rounding only (B6) | lots and settlement | b6_splitting_across_accounts_changes_the_payout_by_rounding_only; Hypothesis test_splitting_tokens_across_accounts_changes_what_they_are_paid_only_by_rounding |
| A settlement costs the same for 1 or 48 sellers (C8) | per-vintage aggregates | c8_settlement_cost_does_not_grow_with_the_number_of_sellers; results/gas.md |
No parameter can change after new, and there is no admin (A1) |
new |
a1_parameters_never_change, a1_initialisation_checks_every_parameter |
| The reserve always covers buying back the whole supply (A5) | curve arithmetic | a5_reserve_covers_buying_back_the_whole_supply |
| Events are enough to rebuild every account's lots (D2) | NEP-297 events | d2_events_rebuild_every_account_lots |
| The contract agrees with the Python model on 210 cases and 3,685 steps (M3) | contract/tests/vectors.rs |
g3_contract_replays_every_edge_vector, g3_contract_replays_every_random_vector |
| Both testnet contracts run the reviewed wasm and have 0 access keys | public RPC | python scripts/live_check.py, every 6 hours in live.yml |
| A visitor gets 8 actions in 10 minutes and the whole demo 120 an hour | worker/src/limits.js |
a visitor gets 8 actions in 10 minutes, then a 429 with the wait, and nothing is signed for the refused one (worker/test/ops.test.js) |
| The page keeps running when an RPC endpoint is rate-limited | createRpc in worker/src/chain.js, worker/src/memo.js |
a rate-limited or failing endpoint moves the call to the next one, which is then tried first; when the chain cannot be read, the last good state is served with the current time and its age, up to the limit |
| The page says who is paid in a round where the gate binds | describeRound in web/lib.js |
a round where the gate binds says who was filled, who was partly filled and who waits (web/test/lib.test.js) |
| Every plate label meets the WCAG AA contrast of 4.5:1 | plateColor in web/lib.js |
every plate label meets the WCAG AA contrast of 4.5 to 1, for stacks of 1 to 12 plates (web/test/lib.test.js); e2e/axe.mjs on the live page |
| A demo role that cannot pay is told so before anything is signed | act in worker/src/ops.js |
a buy by a role that cannot pay its deposit and gas is refused before anything is signed, and says why (worker/test/ops.test.js) |
Python 3.12 and uv for the model; Rust 1.97.1 with the wasm32-unknown-unknown target for the contract; Node 24 for the Worker and page tests. Nothing needs a key or an account.
git clone https://github.com/Marc-Dvci/lifo && cd lifo
uv venv --python 3.12 .venv
.venv\Scripts\activate # Windows. On Linux or macOS: source .venv/bin/activate
uv pip install -r requirements-dev.txt
1. Python tests (about 2 minutes):
python -m pytest -q --cov
Ends with (on 9 November 2026):
lifo\model.py 368 0 84 0 100%
Required test coverage of 95.0% reached. Total coverage: 100.00%
92 passed in 169.88s (0:02:49)
2. The vector generator. It writes the files the contract replays:
python -m lifo.vectors
edge.json: 10 cases, 51 KiB
random.json: 200 cases, 1341 KiB
python -m lifo.vectors --check compares the output with the committed files, prints nothing and exits 0 when they agree.
3. The sweep (about 9 minutes on 4 workers). It rewrites the tables and figures in results/ with the current commit and run time:
python -m lifo.sweep --seeds 10 --workers 4
The last line starts with 9000 runs and ends with 99 sets pass G1. The run recorded in results/SWEEP.md took 491 s. The refresh study is python -m lifo.refresh --seeds 10 --workers 4 (195 s as recorded in results/RECOMMENDED.md); python -m lifo.refresh --from-csv redraws it from results/refresh.csv. The controls are python -m lifo.controls --seeds 10 --workers 4 (550 runs; runtime in results/CONTROLS.md), and --from-csv redraws them from results/controls.csv.
4. Contract tests (about 1 minute once built):
cargo test -p lifo -j 4 -q
Among its result lines: 34 passed (the requirement tests) and 2 passed (the vector replay).
5. The wasm and its hash. With cargo-near 0.22.0:
cd contract
cargo near build non-reproducible-wasm --no-abi
sha256sum ../target/near/lifo/lifo.wasm # PowerShell: Get-FileHash ..\target\near\lifo\lifo.wasm
On the machine that built the deployed contracts the file is 213,191 bytes with SHA-256 de5cb631a9759d245d3651e30dd5eff4f5d3066a4905d5aa8a35bd62c492675a. Your hash may differ (see What NEAR does here); the size should be close.
6. Worker and page tests:
npm ci --prefix e2e
node --test "worker/test/*.test.js"
node --test "web/test/*.test.js"
They end with pass 33 and pass 15. The first line installs near-api-js, which one Worker test uses as the reference for the transaction bytes the Worker signs; without it that test is skipped.
7. The testnet contracts and the live page:
python scripts/live_check.py
launch.lifo.testnet: code hash Fy1WD6gTKfzB2vNSRFjXRSH3CXNqPxQU3o7caecp27pd (matches the reviewed wasm), 0 access keys
demo.lifo.testnet: code hash Fy1WD6gTKfzB2vNSRFjXRSH3CXNqPxQU3o7caecp27pd (matches the reviewed wasm), 0 access keys
https://lifo-amt.pages.dev/api/state?d=demo: HTTP 200, <size> bytes of JSON
8. Sandbox end-to-end (Linux or WSL). It needs the NEAR sandbox binary (nearcore 2.14.0) in $SANDBOX_DIR/Linux-x86_64/near-sandbox; on distributions older than glibc 2.39, GLIBC_DIR points at an extracted glibc tree (see the header of e2e/sandbox.sh). Run it after step 5, since the script deploys the built wasm:
bash e2e/sandbox.sh start
cd e2e && npm install && node checks.mjs
cd .. && bash e2e/sandbox.sh stop
checks.mjs ends with 21 passed, 0 failed and rewrites results/e2e-checks.md. The gas measurement is node gas.mjs in the same folder (about 11 minutes; results/gas.md).
9. Spelling and links: codespell and python scripts/check_links.py (ends with 0 broken link(s)). The workflows in .github/workflows/ run all of the above except the sandbox.
Uniform-price launch auctions (Metaplex, Uniswap's continuous clearing auctions, meme.cooking) give every early depositor the same price and lock liquidity against launch sniping and rugs. Tripwire, another entry in this hackathon, makes token accounts keyless. Redemption gates and exit queues exist in stablecoins and staking. Those address the launch or the pool; LIFO addresses who is paid first once holders sell. No memecoin found that orders exits by purchase vintage (web search, 7 November 2026).
The contracts, the transactions, the page and the tests are real and run on testnet or locally. Each simulated figure names its scenario and seeds. Testnet NEAR has no value.
| Path | What |
|---|---|
RULES.md |
The mechanism, every parameter, every rounding rule and the attack studies |
docs/REQUIREMENTS.md |
The rules as numbered requirements, with every change and its reason; the tests are named after them |
lifo/ |
Python reference model (model.py), simulator (sim.py), sweep, refresh study, controls, vector generator |
tests/ |
Unit and Hypothesis property tests of the model |
contract/ |
Rust NEAR contract (near-sdk 5) and its tests; see contract/README.md |
vectors/ |
Test vectors written by the model and replayed by the contract |
results/ |
Tables, figures and run records, each with its command, seeds and commit |
worker/, pages/, web/ |
The demo Worker, the Pages function that hands /api to it, and the page |
e2e/, scripts/ |
Sandbox checks and gas runs; provisioning, the scripted crash and the live check |
My other NEAR HACKATHON entry is Lockstep (https://github.com/Marc-Dvci/lockstep), in Social Money; the two share no code.
MIT, see LICENSE.







