The SPL Token Auto Purchase program is a Solana smart-contract build that allows users to automatically purchase SPL tokens on the Raydium V4 DEX. The program is designed to be simple, efficient, and secure, and it can be easily integrated into other Solana projects.
- cargo 1.88.0
- solana-cli 2.2.21
- Clone the repository:
git clone https://github.com/iupiew/spl-token-auto-purchase.git- Change into the project directory:
cd spl-token-auto-purchaseTo build the project, run the following command:
cargo build-sbfTo test the project, run the following command:
cargo test --test integration_test -- --test-threads=1 --nocaptureTo deploy the project to devnet, run the following command:
solana config set --url devnet && solana program deploy target/deploy/spl_token_auto_purchase.so- Migrate from
borshtobytemuckfor account data serialization- Update instruction data structures with
#[repr(C)],Pod, andZeroable - Refactor account state structs to use
bytemuck - Add proper padding for alignment
- Update deserialization logic to use
bytemuck::from_bytes()
- Update instruction data structures with
- Remove
serde_jsondependency (not needed for on-chain programs) - Replace
thiserrorwithnum-derivefor lighter error handling- Convert error enums to use
#[derive(FromPrimitive)] - Update error handling to use numeric error codes
- Convert error enums to use
Contributions are welcome! Please feel free to open an issue or submit a pull request.