This guide details the steps for deploying smart contracts, executing test suites.
Ensure your development setup includes the following tools:
- Node.js: https://nodejs.org/
- Yarn (Optional): https://yarnpkg.com/
- Rust: https://www.rust-lang.org/tools/install
- Solana CLI: https://docs.solana.com/cli/install-solana-cli-tools
- Anchor: https://project-serum.github.io/anchor/getting-started/installation.html
You can find the configuration example in .env.example
-
Build the contract: Compile your contract in the project root:
anchor build
Run
anchor keys listto get the new program idReplace the program id on
lib.rs,.env,Anchor.tomlwith the new one -
Deploy the contract: Deploy to the network with Anchor:
anchor deploy
-
Upload program's IDL:
anchor idl init -f target/idl/remitano_test.json
The cluster property in Anchor.toml should be localnet
Execute the Anchor-generated test suite:
anchor testRemember to update the .env
- Create token:
yarn run createToken - Init:
yarn run init {tokenAddress} - Provide liquidity:
yarn run provideLiquidity {configPDA} {tokenAmount} {lamportAmount} - Swap:
yarn run swap {configPDA} {amount} {isSolToToken}. With isSolToToken = 1 or 0
- Program ID =>
9ZXve67dGXtRVTiK9CyiFHX6wQXJALxY6bKhm4Tn6mx9 - Token =>
A48JQmCwFdyVzUc5azETuMaLg9ZRCHnUARjWkbmkFXAd - Config =>
6WLpiybuKshXkJ38e8xf68n5SWg2URkrQpSH2EyBHFmp
- Init config: https://explorer.solana.com/tx/26Fq2t3TuZeJVAuN3xAkuMvEYCLr8JiR9ALbdoZHHervdaEHutxHX8JAEudLbD8QCWu8oWpTWGMvYQJMGjv9otcQ?cluster=devnet
- Provide Liquidity: https://explorer.solana.com/tx/3YAZ61vTHCzoWpc5WS6FgWkVaNd9PA5UPg87b6nwX9sur9QngMobNGNzDzDCb2wB98oP4CNXBUanFz9aDK2B4MTY?cluster=devnet
- Swap: