
Everything the machine does is emitted by one Solana program and one NEAR contract, and signed by a NEAR chain signatures key that only signs what those two emit.
| ACCOUNT | HOLDS | WRITTEN |
|---|---|---|
| machine | light, last fill, last vend, authority | every fill and vend |
| coil 1 to 12 | asset, pitch, rotation, balance, state, notch, vends | every curve trade and every fill |
| tray | dust, burned total | every vend, dispense and burn |
| packet | tokens, age, status, recipient | on vend, every later vend, dispense or burn |
| fill record | intent, legs, amounts, quoted, spread | every fill |
| vend record | coil, packet, tokens bought, trigger, recipient | every vend |
Called by the curve trade listener with the trade's signature, side and size. Advances every coil. May vend. May clear a jam. May kick.
Called by the NEAR contract through chain signatures with a settled intent. Moves balances between two coils and records the spread.
Called by advance when a coil crosses 360. Emits the packet sale intent and the curve buy, creates the packet in the tray, dispenses the previous packet, burns stale ones.
Called by fill when a dark coil's balance becomes positive.
The program is deployed with a human readable name so explorers show it as near snack machine instead of an address. The IDL is uploaded on chain with anchor idl init against the deployed program id, the program name in Anchor.toml and the declare_id crate is near_snack_machine, the metadata is set with the Solana program metadata CLI so the name near snack machine and a one line description are attached to the program account, and the program is verified against its public source with the verifiable build tool so the explorer shows the verified mark. The program id above is the one these steps were run against.