Thales Solana contracts
- Go to: Solana Playbook environment
- Create a new project Anchor (Rust) with dummy name
- In the Projects menu -> import from github
- copy-paste
https://github.com/thales-markets/solana-contracts
and press import - Go to Build & Deploy (top left corner second menu or press Ctrl+Shift+B)
- Run Build
- Connect to Playground wallet
- Create new keypair by connecting to Playground wallet
- Use the terminal to obtain airdrop by running:
solana airdrop 5
- In tests, right-click on
playbook_test.test.ts
-> run Test
- Go to: Solana Playbook environment
- Create a new project
- Add name and choose framework: Anchor (Rust)
- Copy-paste from `programs/speed-markets/src/lib.rs into src-> lib.rs
- Copy-paste from
tests/playbook.ts
totests-> anchor.test.rs
- Go to Build & Deploy (top left corner second menu or press Ctrl+Shift+B)
- Run Build
- Create new keypair by connecting to Playground wallet
- Use the terminal to obtain airdrop by running:
solana airdrop 5
OR go to Wallet (top right corner -> left (...) menu -> airdrop) - After successful airdrop, run Deploy
- Run
test
in the terminal
Main logic in:
speed-markets/program/speed-markets/src/lib.rs
Installing packages in:
speed-markets/program/speed-markets/src/Cargo.toml
Main tests in:
speed-markets/tests/speed-markets_devnet.js
Playbook test:
speed-markets/tests/playbook_test.ts
main - branch currently suitable for testing successful flow init -> create -> resolve
playbook_working_code - branch with most advanced logic, lacks proper testing
Used this source for installation
Needed:
- In the programs/<program_id>/, run:
cargo add mpl-token-metadata
to add the mpl-token-metadata package as dependency - Other important dependencies:
anchor-spl
(SPL tokens),mpl-token-metadata
(Tokens metadata); - Adding a new custom program to the package:
anhor new <program-name>
(kebab style of naming) - Local imports:
puppet = { path = "../puppet", features = ["cpi"]}
imports puppet program to be used with Cross Program Invokation (CPI)