solana-program-library/stake-pool/cli
jon-chuang 87d88bd078
Stake pool/liquid deposits (rebased on new master) (#2141)
* rename staking instructions

* modify DepositStake te to include manager fees and referrer, continue _stake refactor, referral fees WIP

* initialize with fees, fee application, checks

* inline functions

* temporarily substitute u8 for bool until borsh gets it's * straight

* set deposit fee

* apply deposit and referral fee to liquid deposit_sol too

* add set-deposit-fee, unify cli interface

* set-referral-fee

* full feature set for liquid deposits (?)

* add tests/set_referral_fee.rs

* fix missing serialization in process_set_referral_fee

* remove duplicated test case in tests/set_withdrawal_fee.rs

* tests WIP, numbers dont add up after non-zero deposit fee

* fix error, fix tests

* deposit_sol tests. Requires additional changes to work properly

* simplify deposit_sol tests, add referral fee tests for deposit and deposit_sol

* add `sol_deposit_authority`.

* split deposit_sol() & deposit_sol_with_authority(), cli sol_deposit --from, minor cleanup

* cli deposit-sol from argument should take keypair instead

* commands: set-sol-deposit-authority, show

* cli: pretty print stake pool struct

* chore: comments/naming

* fmt, clippy

* add args for `create-pool`

* mistake in the cli

* `system_prog` is `read_only`, require sig from `stake_deposit_auth`

* change deposit-sol-authority arg to optional acount, rename instruction::withdraw->withdraw_stake, remove unnecesary sys_prog arg for withdraw_stake

* resolve simple nits and suggestions

* cli: change default referrer to user's token receiver account instead of pool manager

* cli: remove show command, add fees to list command, rename pool -> epoch

* update tests for removed unnecessary referral fee account owner check and deposit sol

* cli changes: create ephemeral account for deposit_sol

* specify pool token type for account info name

* add check for manager fee acc in deposit_sol

* Apply suggestions from code review

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>

* fix non-rebased bug

* SetDepositStakeAuthority

* refactor + tests + cli

* fmt

* clippy

* remove unnecessary comment

* ASK keyword

* unset deposit auth

* combine set fee instructions

* clippy

* applying suggestions

* apply out-of-date check only for FeeTypes that need it

* add fee + user = new tokens check

* Fix test

* Unify `SetDepositAuthority` instruction

* fmt

Co-authored-by: dhy1996 <dhy1996@live.com.sg>
Co-authored-by: Jesse Y. Cho <f8122dac91@gmail.com>
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2021-08-11 00:15:45 -04:00
..
scripts Stake pool/liquid deposits (rebased on new master) (#2141) 2021-08-11 00:15:45 -04:00
src Stake pool/liquid deposits (rebased on new master) (#2141) 2021-08-11 00:15:45 -04:00
Cargo.toml build(deps): bump serde_json from 1.0.65 to 1.0.66 (#2187) 2021-07-30 11:13:27 +00:00
README.md stake-pool: Add helper scripts for setting up a pool (#1994) 2021-06-29 23:11:08 +02:00

README.md

SPL Stake Pool program command-line utility

A basic command-line for creating and using SPL Stake Pools. See https://spl.solana.com/stake-pool for more details.

Scripts for setting up a stake pool

Under ./scripts, this repo also contains some bash scripts that are useful for setting up your own stake pool. These scripts require the Solana CLI tool suite, which can be downloaded by following the instructions at (https://docs.solana.com/cli/install-solana-cli-tools). Additionally, you must have a usable keypair, created at the default location using solana-keygen new.

setup-local.sh

Builds the stake pool program and sets up a solana-test-validator with some new validator vote accounts.

The only input it accepts is a number, for the number of vote accounts to create, e.g.:

$ ./setup-local.sh 100

Important notes on local network

If you are using epochs of 32 slots, there is a good chance that you will pass an epoch while using one of the stake pool commands, causing it to fail with: Custom program error: 0x11. This is totally normal, and will not happen on a normal network.

Since there is no voting activity on the test validator network, you will need to use the --force flag with solana delegate-stake, ie:

$ solana delegate-stake --force stake.json CzDy6uxLTko5Jjcdm46AozMmrARY6R2aDBagdemiBuiT

setup-stake-pool.sh

Creates a new stake pool with the parameters hardcoded in the script:

  • fee numerator
  • fee denominator
  • maximum number of validators
  • list of validator vote accounts
$ ./setup-stake-pool.sh 100 validator_list.txt

deposit-withdraw.sh

Creates new stakes to deposit into each of the stake accounts in the pool, given the stake pool, mint, and validator list.

$ ./deposit-withdraw.sh keys/stake-pool.json validator_list.txt