If the stake pool gives over the validator stake account to the staker,
they may keep it and make it impossible to re-add that validator in the
future.
Split the whole amount into a new stake account on removal.
* fix
* add check if new manager fee is spl token program
* Convert manager fee info check to fail only inside `Result` box
* update also checks validity of manager fee info
* clippy
* deny set preferred validator if validator is about to be removed, add tests
* fix copy paste error
* only allow Active validators to be set to preferred validator
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
* 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>
* Update all dependencies to 1.7.3, fix issues
* Remove esm from mocha
* Fix missed token test
* Also update rust version
* token-swap: update tolerance on sim test
* Run `cargo clippy --fix` for needless_borrow errors
* Rerun cargo fmt
* stake-pool: Add ability to withdraw from transient stakes
It's possible for a very malicious pool staker to constantly increase /
decrease the stake on validators, making it impossible for people to get
their SOL out.
Update the accounting to know how much of the stake is active and how
much is transient and allow users to withdraw from transient accounts,
but only if there's no more active stake.
* Remove mut ickiness
The stake pool expects pool tokens to be delegated to the withdraw
authority before performing a withdrawal. If a user delegates too many
tokens to the withdraw authority, anyone else can take the rest of their
tokens by doing their own withdrawal.
Delegate pool tokens to an ephemeral keypair and sign with that.