Git Product home page Git Product logo

psyoptions's Introduction

Solana Options

Exploring architectures for options trading on Serum

Development

Dependencies

  1. Docker

Running Unit tests

  1. cargo test --features program --lib --manifest-path options/Cargo.toml

Running Integration tests

  1. Make sure the local test net is running solana-test-validator
  2. Build and test the options program cargo test-bpf --manifest-path options/Cargo.toml

Debugging with lldb

  1. Run tests and have them fail
  2. Identifier the file that was running (see “Running **”)
  3. in terminal run rust-lldb +nightly FILE_PATH
  4. set a break point (for example b instruction.rs:157)
  5. Run tests with run —test

Deploying and creating a market locally

  1. Run local Solana cluster yarn localnet:up
  2. Build program cargo build-bpf --manifest-path options/Cargo.toml
  3. 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
  4. Run the script to build an options market npx babel-node scripts/buildAndInitMarket.js YOUR_PROGRAM_ADDRESS

Potential Improvements (V1)

  • Integration Tests
    • Wrap the load_bpf_program method and cache the program id so it's not being loaded on each test

Deploying the program

Mainnet

  1. Build with anchor anchor build -p psy_american --verifiable
  2. Use an insecure computer to run solana program write-buffer <target-path> --buffer <buffer-keypair>
  3. change authority solana program set-buffer-authority <buffer-address> --new-buffer-authority <hardware-wallet-address>
  4. Verify the buffer binary is correct anchor verify -p <lib-name> <buffer-address> --provider.cluster mainnet
  5. Switch to hardeware wallet.
  6. Deploy/upgrade with a single transaction from the hardware wallet. solana program deploy --buffer <buffer-keypair> --program-id <program-keypair> --keypair <hardware-wallet-keypair>

Dev Net

The program used for Devnet Bet is currently deployed @ {"programId":"R2y9ip6mxmWUj4pt54jP2hz2dgvMozy9VTSwMWE7evs"}

  1. Make sure you're on solana CLI >= 1.8.0 solana-install init v1.8.1
  2. Build the program cargo build-bpf --manifest-path options/Cargo.toml
  3. Set the target network solana config set --url https://api.devnet.solana.com
  4. Deploy the program solana program deploy --program-id $PWD/options/deployed_programs/psyoptions-devnet-beta-3-keypair.json $PWD/options/target/deploy/psyoptions.so

Deploying the bindings to NPM

  1. Sign into mithraics npm account via cli
  2. build the new package cd packages/psyoptions-ts yarn build:package
  3. publish to npm npm publish --access public

Publishing the crate

cd options && cargo publish --features "no-entrypoint"

Found a bug??

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

psyoptions's People

Contributors

tomjohn1028 avatar taylor123 avatar evanpipta avatar u32luke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.