NYXERON

The contract

What the NYXERON contract enforces on its own, and what it trusts the server for.

The NYXERON contract takes the drink payments and holds the stock units as NEP-245 multi tokens. It is written in Rust with near-sdk 5. On testnet it is nyxeron.testnet, paid in Circle's testnet USDC.

What it enforces on its own

What it trusts the server for

The contract can't read Robinhood Chain, so the owner key decides that a mint is backed. That key is a function-call key limited to this contract's owner methods: it can't move anyone's USDC or units. On mainnet, Proof compares the units in circulation with the shares the warehouse holds, so anyone can check the owner key's claims.

A drink, in the contract's words

The guest's account sends ft_transfer_call on USDC with this contract as the receiver, the exact amount, and a msg with the quote and the server's signature:

{
  "v": 2,
  "contract": "nyxeron.testnet",
  "id": "q_8f3a",
  "party": "42",
  "buyer": "<guest account>",
  "ceo": "<host account>",
  "token": "tsla",
  "qty": 3,
  "unit_price": "410000",
  "unit_wholesale": "390000",
  "expires_ms": 1793780000000
}

Prices are in micro-USDC. The contract checks the signature over the exact bytes it was given, then parses them.

When it is accepted:

  • the margin (unit_price − unit_wholesale) × qty goes to the host;
  • unit_wholesale × qty goes to the party's pot;
  • the guest is owed qty units of the stock;
  • a purchase event is emitted.

Methods

WhoMethodWhat it does
Ownerrelease_wholesale(party)Sends the party's pot to the treasury and closes the party to purchases
Ownermint_warehouse(token_id, amount, proof)Mints units to the warehouse; the proof is the purchase's transaction and backs one mint only
Ownersettle(party, op_id, transfers)Warehouse → guests, all or nothing, at most 32 transfers, each op_id once
Ownerregister_token, set_quote_key, set_paused, …Setup and the emergency stop
Anyoneclaim_margin()Sends the caller's held margin
Holdersmt_transfer, mt_batch_transfer, mt_transfer_callNEP-245 transfers, 1 yoctoNEAR

Views:

  • owed(party)
  • party_pot(party)
  • claimable_margin(account_id)
  • mt_balance_of(account_id, token_id)
  • mt_supply(token_id)
  • tokens()
  • is_used_proof(proof)
  • is_settled(op_id)
  • is_paused()
  • config()

Events (NEP-297):

  • nyxeron 1.0.0: purchase, refund, margin_held, release, release_failed.
  • nep245: mt_mint with the proof as memo, mt_transfer with the settle's op_id.

Tested

78 unit tests and 10 sandbox tests, which run against a real NEP-141 token, plus cargo fmt and clippy in CI. It had a security review in November 2026, and its code hasn't changed since.

On this page