0.1.0-rc-0 • Published 2 years ago

psystake v0.1.0-rc-0

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
2 years ago

Program Deployments

ProgramDevnetMainnet Beta
PsyStake5LrZkBFgDkFiKEePeT2N9VuKfd2k8Rrad9PG6mKGbCRkpSystkitWgLkzprdAvraP8DSBiXwee715wiSXGJe8yr

Introduction

PsyStake is a on-chain program designed to allow the operation of a staking or liquidiy mining program for any SPL Token, with built-in support for cross-program invokations by the PsyFi Euros program to enable a seamless staking process.

Folder Structure

.
├── ...
├── deps                            # Dependencies
|   ├── psyfi-euros                 # PsyFinance European Options Strategies Vault program.
├── programs                        # Anchor Program
│   ├── psy-stake                   # PsyStake Program
|   │   ├── src
|   |   |   ├── instructions        # Directory containing program instructions.
|   |   |   |   ├── permisionless   # Subdirectory containing instructions to be run permissionless by cranks.
|   |   |   |   ├── staker          # Subdirectory containing instructions invoked by users staking with the program.
|   |   |   |   ├── vault           # Subdirectory containing instructions invoked by the PsyFi Euros program.
|   |   │   ├── account.rs          # Contains Account struct definitions.
|   |   │   ├── constants.rs        # Contains program constants.
|   |   │   ├── errors.rs           # Contains ErrorCode Enum definitions.
|   |   │   ├── lib.rs              # Contains handlers for program entry.
|   |   │   ├── utils.rs            # Contains utility functions.
│   └── tests                       # Integration tests
└── ...

Program Architecture

Read Here

Setup

Setup Submodules:

Using HTTPS (recommended):

  1. Allow HTTPS cloning from private repository by caching your Github credentials in Git. Git Credentials Manager sets up well on M1 Macbook.
  2. Add PsyFi Euros as a git submodule in deps/ with git submodule add https://github.com/mithraiclabs/psyfi-euros.git deps/psyfi-euros.
  3. Update dependencies of submodule with git submodule update --init --recursive.
  4. Build the dependency by running anchor build in deps/psyfi-euros.
  5. Run yarn install in the node dependencies, including deps/psyfi-euros/packages/psyfi-euros, deps/psyfi-euros.

Testing:

Local Testing

Unit Tests: Run cargo test --lib
Integration Tests: Run anchor test -- --features localnet.

Deployment

Devnet

  1. As of writing, you will have to install Solana v1.8.14 to deploy the program to Devnet: sh -c "$(curl -sSfL https://release.solana.com/v1.8.14/install)". Newer versions of Solana will fail to deploy with an invalid blockhash error.
  2. Build program with anchor build -- --features devnet.
  3. Fund your deployment wallet with solana airdrop 2 <pubkey> --url https://api.devnet.solana.com.
  4. Generate a new program keypair with solana-keygen new -o <destination_filepath>.
  5. Run solana program deploy <path_to_repo/psyfi-euros/target/deploy/psyfi_euros.so --url https://api.devnet.solana.com --verbose --program-id <path_to_new_program_keypair> --keypair <path_to_deployment_wallet>.