This project is a Solana program built using the Anchor framework. It allows users to deposit, withdraw, lock, and settle funds, as well as make payments to a treasury account. The program is designed to be used in conjunction with a bot and a treasury account, which are managed by an authority.
Before you begin, ensure you have the following installed:
- Node.js (v20 or higher)
- Bun
- Solana & Anchor
bun install
To compile the program, run:
anchor build
This command compiles the Solana program and generates the necessary artifacts.
To deploy the program to a local Solana validator, follow these steps:
- Start a local Solana validator:
solana-test-validator --reset
This command starts a local Solana blockchain instance.
- Ensure your Solana CLI is configured to use the local validator:
solana config set --url http://localhost:8899
- Airdrop SOL to your local wallet:
solana airdrop 2
solana airdrop 2 9nyhqLqmbWoUuNXA1XCVnEqiS9UWvxFYa1yynVVFzR4D
- Deploy the program to the local validator:
solana program deploy ./target/deploy/balance_payment.so --program-id ./programs/balance-payment/keypair.json
This command will deploy the program to the local Solana validator and output the program ID.
Initializes the program with an authority, treasury, and bot.
anchor run cli -- initialize --authority <AUTHORITY_PUBKEY> --treasury <TREASURY_PUBKEY> --bot 9nyhqLqmbWoUuNXA1XCVnEqiS9UWvxFYa1yynVVFzR4D
--authority
: The public key of the authority.--treasury
: The public key of the treasury account.--bot
: The public key of the bot account.
The app
folder contains a demo application that interacts with the Balance Payment program. To run the demo:
- Navigate to the
app
directory:
cd app
- Install dependencies:
bun install
- Start the development server:
bun run dev
- Open your browser and navigate to
http://localhost:5173
to view the demo.
This demo provides a user-friendly interface to interact with the Balance Payment program, enabling users to manage funds and simulate charging sessions.