Developers
Architecture
How Moony is structured onchain: the accounts that hold its state, the PDAs that address them, and the instruction set that governs them.
#Overview
Moony runs on a single Solana program, the open-source Flipcash Reserve Contract. Moony is described entirely by a small set of onchain accounts: an SPL token mint, a currency configuration account, a liquidity pool, and two token vaults. Everything about Moony's behavior, its supply, its price, and its redemption liquidity, is a function of these accounts and the immutable code that operates on them.
ccJYP5gjZqcEHaphcxAZvkxCrnTVfYMjyhSYkpQtf8ZVerify ↗ccJYP5…Qtf8Z
#Account model
Two program-owned accounts hold a currency's state. Both are plain, fixed-layout structs, readable by anyone.
CurrencyConfig
Stores the currency's identity: its authority, mint, human-readable name and symbol, and the seed used to derive its PDAs.
// PDA seeds: ["currency", mint]pub struct CurrencyConfig { authority: Pubkey, // set at init (Flipcash) mint: Pubkey, // SPL mint (target) name: [u8; 32], // currency name symbol: [u8; 8], // currency symbol seed: [u8; 32], // PDA seed // + bump seeds}
4muAfB6m1P7C3Znad1VUsoqYFwvGQRkWGpJ3A4vupxz6Verify ↗LiquidityPool
The Reserve itself: it links the currency to its USDF base, tracks both vaults, accrued fees, and the sell-fee rate. The base mint is hardcoded to USDF.
// PDA seeds: ["pool", currency]pub struct LiquidityPool { authority: Pubkey, // set at init (Flipcash) currency: Pubkey, // currency for this pool mint_a: Pubkey, // target (MNY) mint_b: Pubkey, // base (USDF, hardcoded) vault_a: Pubkey, // target vault vault_b: Pubkey, // base vault fees_accumulated: u64, // USDF, burned permissionlessly (anyone) sell_fee: u16, // basis points (100 = 1%) // + bump seeds}
5Ztd1ECKq4cXYt7BiRXK999hK2eQqtjJF9J3F1zw2jYCVerify ↗HWVNBLfwKyDAkV4YFffZrThsEke3kUko1VVuGjuDAHefVerify ↗8VhsmHR25oQSfNMT8nJNFZirsLZLAnz3eH9rr43pgY9FVerify ↗get-currency from the CLI reference.#PDA derivation
Every account is a Program-Derived Address, deterministically derived from fixed seeds. Given a currency's authority, name, and seed, anyone can recompute the full account hierarchy offline, no indexer or lookup required.
#Instruction set
These are the instructions that operate on Moony's Reserve. All of these are open to anyone; even burn_fees is permissionless (it only burns the pool’s accumulated fee USDF and pays the caller nothing).
buyDeposit USDF, receive MNY at the curve price.AnyonesellReturn MNY, receive USDF less the sell fee.Anyonebuy_and_deposit_into_vmBuy and deposit MNY into a Flipcash VM account in one transaction.Anyonesell_and_deposit_into_vmSell and deposit USDF proceeds into a VM account in one transaction.Anyoneburn_feesBurn accumulated USDF fees from the pool vault; reset the counter.Anyoneapi/src/sdk.rs) and a client crate that produce these exact instructions. The CLI reference covers the same operations from the command line.#Fixed parameters
Several values are compile-time constants in the program (api/src/consts.rs) that define Moony's hard limits.
21,000,0001010,000,000,0005AMAA9JV…4RYAUQ