0.1.0-rc-0 • Published 2 years ago
psystake v0.1.0-rc-0
Program Deployments
Program | Devnet | Mainnet Beta |
---|---|---|
PsyStake | 5LrZkBFgDkFiKEePeT2N9VuKfd2k8Rrad9PG6mKGbCRk | pSystkitWgLkzprdAvraP8DSBiXwee715wiSXGJe8yr |
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
Setup
Setup Submodules:
Using HTTPS (recommended):
- Allow HTTPS cloning from private repository by caching your Github credentials in Git. Git Credentials Manager sets up well on M1 Macbook.
- Add PsyFi Euros as a git submodule in
deps/
withgit submodule add https://github.com/mithraiclabs/psyfi-euros.git deps/psyfi-euros
. - Update dependencies of submodule with
git submodule update --init --recursive
. - Build the dependency by running
anchor build
indeps/psyfi-euros
. - Run
yarn install
in the node dependencies, includingdeps/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
- 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. - Build program with
anchor build -- --features devnet
. - Fund your deployment wallet with
solana airdrop 2 <pubkey> --url https://api.devnet.solana.com
. - Generate a new program keypair with
solana-keygen new -o <destination_filepath>
. - 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>
.