Interacting with Moony via CLI
A command-line path to acquire, query, and redeem Moony directly against the Reserve, using the open-source Flipcash Program. Every command calls the same onchain program on the same terms: the same pricing curve, the same fees, no special access.
01Introduction
This page documents how to interact with Moony from the command line, using the CLI shipped with the open-source Flipcash Program. It covers querying the Reserve's onchain state, acquiring MNY with USDF, and redeeming MNY back to USDF, all by calling the Reserve contract directly.
The CLI is part of the open-source release of the Flipcash Program; it was not built by Moony Labs and confers no privileged access. Because the Reserve is open, anyone can interact with it programmatically or build a compatible interface. The CLI is simply the reference tool for doing so from a terminal. It calls the same onchain Reserve under the same immutable rules, the same pricing curve, and the same hardcoded fees.
The path end to end
If you're starting from scratch, this is the full sequence. Each step links to its section below.
- Install the prerequisites, Rust and the Solana CLI.
- Create and fund a keypair with a little SOL (for fees) and USDF (to spend).
- Build the
flipcashbinary from source. - Point every command at mainnet with
--cluster m. - Run
get-currencyfirst to confirm your setup works. It moves no funds. - Buy a tiny test amount, verify it onchain, then transact for real.
02Prerequisites
Before you begin, make sure you have the following in place:
- Rust toolchain,
rustcandcargo. Install via the official instructions at rust-lang.org. - Solana CLI tools, install from the Solana documentation.
- A Solana keypair file, default location
~/.config/solana/id.json. - A small amount of SOL in that keypair to pay transaction fees.
- USDF in the wallet if you intend to buy Moony, see Caveats & risks on acquiring USDF.
- Familiarity with command-line tools and basic Solana concepts.
Confirm the toolchain is installed before going further:
$ rustc --version$ cargo --version$ solana --version
Create and fund a keypair
If you don't already have a Solana keypair, create one. The CLI uses ~/.config/solana/id.json by default; pass --keypair <path> to use a different file.
# Create a keypair (skip if you already have one)$ solana-keygen new # Show your wallet address and mainnet balance$ solana address$ solana balance --url m
Send a small amount of SOL to that address to cover transaction fees (a fraction of a SOL covers many transactions), plus the USDF you intend to spend. Both must be in the same keypair you sign with.
03Installation
Clone the open-source repository and build the CLI binary from source:
# Clone the Flipcash Program (MIT)$ git clone https://github.com/code-payments/flipcash-program$ cd flipcash-program && cargo build --release
The compiled binary is written to ./target/release/flipcash. Add it to your PATH, or invoke it with an absolute path. The crate is named flipcash-cli, but the built binary is flipcash. That is the command you run; the program’s own --help still prints “flipcash-cli”. For additional installation notes, see the repository README.
04Cluster configuration
Moony lives on Solana mainnet. Every command must point there explicitly with --cluster m. The CLI defaults to localnet, which has no knowledge of Moony and will not work for real transactions.
$ flipcash --cluster m <command>
You can also pass a custom RPC endpoint instead of the m shorthand if you run your own node or use a dedicated provider.
--cluster m, commands run against localnet and will not touch real Moony. Running on devnet or testnet interacts with different (or non-existent) state.05Querying Moony's state get-currency
Returns Moony's current onchain state: the currency authority, mint, vaults, accumulated fees, and the sell-fee rate. Nothing is signed and no funds move. This is the safest command to run first to confirm your setup works.
$ flipcash --cluster m get-currency \ --mint 4muAfB6m1P7C3Znad1VUsoqYFwvGQRkWGpJ3A4vupxz6 Currency Metadata: Authority: <authority> Mint: 4muAfB6m1P7C3Znad1VUsoqYFwvGQRkWGpJ3A4vupxz6 Name: Moony Symbol: MNY Pool Metadata: Authority: <authority> Currency: <currency PDA> Mint A (Target): 4muAfB6m…vupxz6 Mint B (Base): 5AMAA9JV…4RYAUQ Vault A: <MNY vault> Vault B: <USDF vault> Fees Accumulated: <accrued> Sell Fee: 100 bps (1%)
Use this to verify Moony's parameters or to read the current Reserve state before and after a transaction.
06Buying Moony buy
Spends USDF to acquire MNY at the current curve position. The --amount flag specifies the USDF to spend, not the MNY to receive. The amount of MNY you get is determined by the curve at the moment the transaction executes. This command signs and submits a transaction with your keypair.
# Buy Moony with 10 USDF$ flipcash --cluster m buy \ --mint 4muAfB6m1P7C3Znad1VUsoqYFwvGQRkWGpJ3A4vupxz6 \ --amount 10.0 Buy transaction successful. Signature: 5h2k…aB9c
Once the transaction confirms, MNY appears in your wallet. View it on the Solana Explorer using the returned signature (explorer.solana.com/tx/<signature>).
07Selling Moony sell
Returns MNY to the Reserve and receives USDF, less the 1% redemption fee. The --amount flag specifies the MNY to sell, not the USDF to receive. This command signs and submits a transaction with your keypair.
# Sell 5 MNY back to the Reserve$ flipcash --cluster m sell \ --mint 4muAfB6m1P7C3Znad1VUsoqYFwvGQRkWGpJ3A4vupxz6 \ --amount 5.0 Sell transaction successful. Signature: 8tQp…dF1m
- The 1% fee is deducted from the USDF you receive. It stays in the Reserve and is burned by a permissionless instruction; because USDF is a Coinbase Custom Stablecoin backed 1:1 by USDC, the burn redeems the equivalent USDC to Flipcash.
- Selling moves the curve down, the next buyer enters at a lower price.
- USDF is returned to your keypair's USDF token account.
08Verification
After any transaction, confirm the result independently rather than trusting the CLI's output alone:
- Check the transaction confirmed on the Solana Explorer using the returned signature.
- Check your wallet's MNY balance, view the MNY token on Explorer.
- Confirm the Reserve state changed: run
get-currencyagain and compare. - Cross-reference with Solscan for human-readable token information.
09Caveats & risks
0.01 USDF).- Always specify mainnet with
--cluster m. Running on devnet or testnet will not interact with real Moony. - The mint address must be exact:
4muAfB6m1P7C3Znad1VUsoqYFwvGQRkWGpJ3A4vupxz6. Any typo will either fail or interact with a different, or non-existent, currency. - Keypair security: protect your keypair file. Anyone with access to it can spend your funds.
- USDF, specifically: you need USDF, not USDC, USDT, or another stablecoin. The CLI performs no automatic conversion.
- Acquiring USDF: USDF is listed on Coinbase, and developers holding USDC can swap it for USDF onchain via the Coinbase USDC↔USDF swap program.
10Reference addresses
The canonical onchain addresses, provided for verification. Each links to the Solana Explorer.
11Programmatic integration
For deeper integration, building an application rather than running CLI commands, the Flipcash Program exposes Rust instruction builders (api/src/sdk.rs) and a client crate. It is the same open path anyone can use to build wallets, exchanges, or other Moony-compatible interfaces.
# SDK entry point in the open-source programapi/src/sdk.rs · github.com/code-payments/flipcash-program
Start from the source rather than this page; it is the authoritative reference for the program's instructions and accounts.
12Building your own interface
The CLI is a thin wrapper over the Flipcash Program's instruction set. For deeper integration, a wallet, an exchange, a service, or any custom client, build against the program's instruction builders directly (api/src/sdk.rs and the client crate). They produce the identical Reserve instructions the CLI uses, so anything the CLI can do, your own code can too.
The Reserve is open and there is no exclusivity: the CLI and any third-party client reach the same program on the same terms, the same curve, the same fees, the same immutable logic.