This repo contains the rust program and test code that allows you to swap USDC for SOL on the Solana blockchain (devnet) using the Pyth oracle. User can input the amount they want to send in USDC and the program will calculate the live exchange rate and send the appropriate amount of SOL to the user's wallet.
- Clone the repo
- Run
anchor buildto build the program - Run
anchor deployto deploy the program to the devnet - Copy the deployed program id from the terminal to the
Anchor.tomlfile anddeclare_id!()line in thelib.rs - Run
anchor build&anchor deployagain - Run
anchor testto run the test code
PYTH Devnet USDC/SOL price feed: "J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix"