Exploring architectures for options trading on Serum
cargo test --features program --lib --manifest-path options/Cargo.toml
- Make sure the local test net is running
solana-test-validator
- Build and test the options program
cargo test-bpf --manifest-path options/Cargo.toml
- Run tests and have them fail
- Identifier the file that was running (see “Running **”)
- in terminal run
rust-lldb +nightly FILE_PATH
- set a break point (for example
b instruction.rs:157
) - Run tests with
run —test
- Run local Solana cluster
yarn localnet:up
- Build program
cargo build-bpf --manifest-path options/Cargo.toml
- Deploy program
solana program deploy --program-id $PWD/options/deployed_programs/psyoptions-local-keypair.json $PWD/options/target/deploy/psyoptions.so
- NOTE: To use the above you must set your Solana config file (usually located at ~/.config/solana/cli/config.yml) to point to the local cluster AND use an appropriate localnet keypair that has some SOL. Follow the docs to generate keypair and airdrop some tokens
- Run the script to build an options market
npx babel-node scripts/buildAndInitMarket.js YOUR_PROGRAM_ADDRESS
- Integration Tests
- Wrap the load_bpf_program method and cache the program id so it's not being loaded on each test
- Build with anchor
anchor build -p psy_american --verifiable
- Use an insecure computer to run
solana program write-buffer <target-path> --buffer <buffer-keypair>
- change authority
solana program set-buffer-authority <buffer-address> --new-buffer-authority <hardware-wallet-address>
- Verify the buffer binary is correct
anchor verify -p <lib-name> <buffer-address> --provider.cluster mainnet
- Switch to hardeware wallet.
- Deploy/upgrade with a single transaction from the hardware wallet.
solana program deploy --buffer <buffer-keypair> --program-id <program-keypair> --keypair <hardware-wallet-keypair>
The program used for Devnet Bet is currently deployed @ {"programId":"R2y9ip6mxmWUj4pt54jP2hz2dgvMozy9VTSwMWE7evs"}
- Make sure you're on solana CLI >= 1.8.0
solana-install init v1.8.1
- Build the program
cargo build-bpf --manifest-path options/Cargo.toml
- Set the target network
solana config set --url https://api.devnet.solana.com
- Deploy the program
solana program deploy --program-id $PWD/options/deployed_programs/psyoptions-devnet-beta-3-keypair.json $PWD/options/target/deploy/psyoptions.so
- Sign into mithraics npm account via cli
- build the new package
cd packages/psyoptions-ts
yarn build:package
- publish to npm
npm publish --access public
cd options && cargo publish --features "no-entrypoint"
Please report to [email protected]. Include which part of the protocol(s)/code it impacts and the severity.
A more formal bug bounty will be posted soon