solana-program-library/stake-pool/cli
jon-chuang e9e4d36211
Stake pool/withdrawal fee (#2107)
* stake-pool: Add new fee fields for liquid staking and arbitrage

* incorporate withdrawal fee to withdrawal instruction, refactor calculating fees into Fee method

* update withdraw instruction to take manager fee account, revert divide by 0 edge-case removal

* initialize with withdrawal fee, modify integration tests to incorporate withdrawal fee

* extra safety check, prevent divide by 0

* patch Initialize for other tests

* decrease HUGE_POOL_SIZE to fit compute budget

* set_withdrawal_fee, initialize conditions

* Handle current withdrawal fee = 0 case

* add tests for withdrawal fees

* baseline fee increase is explicit constant

* withdrawal_fee for cli for initialize

* fmt, fix cli

* obey clippy

* clean up cli, add increase from 0 tests.

* add cli: set-withdraw-fee

* apply suggestions for code review

* remove 1_000_000 denom limit

* remove denom limit tests, inline, checked muls

* apply suggestions for code review

* referral fee

* tests: use local copy to calculate_withdrawal_fee instead of fetching from chain

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
Co-authored-by: dhy1996 <dhy1996@live.com.sg>
2021-07-25 20:08:16 -04:00
..
scripts Stake pool/withdrawal fee (#2107) 2021-07-25 20:08:16 -04:00
src Stake pool/withdrawal fee (#2107) 2021-07-25 20:08:16 -04:00
Cargo.toml Bump solana crates (#2139) 2021-07-23 16:47:06 +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