Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit fa438bb

Browse files
authored
stake-pool: Add / remove validators from the reserve (#3714)
* stake-pool: Create validator stake accounts from reserve * Update accounting to take minimum into account * Refactor withdraw tests * Add ability to remove validators during withdraw stake * Add seed to validator stake account address derivation * Update CLI with new instruction formats * Update documentation and helper scripts for new funding * Update Python bindings * Try to fix flakey test * Support token-2022 * Condense tests for CI * Reduce huge pool limit post-rebase * Avoid draining the whole reserve * Restrict account extensions on allow-list * Update comments to say "lamports" * Fixup code comments and variable names * Fix clippy in tests
1 parent 3c4267b commit fa438bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3131
-1814
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/stake-pool/cli.md

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ In order to accommodate large numbers of user deposits into the stake pool, the
261261
stake pool only manages one stake account per validator. To add a new validator
262262
to the stake pool, the staker must use the `add-validator` command.
263263

264-
Let's add some random validators to the stake pool.
264+
The SOL used to add validators to the pool comes from the stake pool's reserve
265+
account. If there is insufficient SOL in the reserve, the command will fail.
266+
Be sure to use the `deposit-sol` command to move some SOL into the pool.
267+
268+
With 10 SOL in the pool, let's add some random validators to the stake pool.
265269

266270
```console
267271
$ spl-stake-pool add-validator Zg5YBPAk8RqBR9kaLLSoN5C8Uv7nErBz1WC63HTsCPR 38DYMkwYCvsj8TC6cNaEvFHHVDYeWDp1qUgMgyjNqZXk
@@ -285,18 +289,18 @@ We can see the status of a stake account using the Solana command-line utility.
285289

286290
```console
287291
$ solana stake-account 5AaobwjccyHnXhFCd24uiX6VqPjXE3Ry4o92fJjqqjAr
288-
Balance: 0.00328288 SOL
292+
Balance: 1.00228288 SOL
289293
Rent Exempt Reserve: 0.00228288 SOL
290-
Delegated Stake: 0.001 SOL
294+
Delegated Stake: 1 SOL
291295
Active Stake: 0 SOL
292-
Activating Stake: 0.001 SOL
296+
Activating Stake: 1 SOL
293297
Stake activates starting from epoch: 5
294298
Delegated Vote Account Address: J3xu64PWShcMen99kU3igxtwbke2Nwfo8pkZNRgrq66H
295299
Stake Authority: DS3AyFN9dF1ruNBcSeo8XXQR8UyVMhcCPcnjU5GnY18S
296300
Withdraw Authority: DS3AyFN9dF1ruNBcSeo8XXQR8UyVMhcCPcnjU5GnY18S
297301
```
298302

299-
The stake pool creates these special staking accounts with 0.001 SOL as the required
303+
The stake pool creates these special staking accounts with 1 SOL as the required
300304
minimum delegation amount. The stake and withdraw authorities are the stake pool
301305
withdraw authority, program addresses derived from the stake pool's address.
302306

@@ -312,29 +316,28 @@ Stake Deposit Fee: none
312316
SOL Deposit Fee: none
313317
SOL Deposit Referral Fee: none
314318
Stake Deposit Referral Fee: none
315-
Reserve Account: EN4px2h4gFkYtsQUi4yeCYBrdRM4DoRxCVJyavMXEAm5 Available Balance: ◎0.000000000
316-
Vote Account: EhRbKi4Vhm1oUCGWHiLEMYZqDrHwEd7Jgzgi26QJKvfQ Balance: ◎0.000000000 Last Update Epoch: 4
317-
Vote Account: J3xu64PWShcMen99kU3igxtwbke2Nwfo8pkZNRgrq66H Balance: ◎0.000000000 Last Update Epoch: 4
318-
Vote Account: 38DYMkwYCvsj8TC6cNaEvFHHVDYeWDp1qUgMgyjNqZXk Balance: ◎0.000000000 Last Update Epoch: 4
319-
Total Pool Stake: ◎0.000000000
320-
Total Pool Tokens: 0.00000000
319+
Reserve Account: EN4px2h4gFkYtsQUi4yeCYBrdRM4DoRxCVJyavMXEAm5 Available Balance: ◎6.99315136
320+
Vote Account: EhRbKi4Vhm1oUCGWHiLEMYZqDrHwEd7Jgzgi26QJKvfQ Balance: ◎1.002282880 Last Update Epoch: 4
321+
Vote Account: J3xu64PWShcMen99kU3igxtwbke2Nwfo8pkZNRgrq66H Balance: ◎1.002282880 Last Update Epoch: 4
322+
Vote Account: 38DYMkwYCvsj8TC6cNaEvFHHVDYeWDp1qUgMgyjNqZXk Balance: ◎1.002282880 Last Update Epoch: 4
323+
Total Pool Stake: ◎10.000000000
324+
Total Pool Tokens: 10.00000000
321325
Current Number of Validators: 3
322326
Max Number of Validators: 1000
323327
```
324328

325329
To make reading easier, the tool will not show balances that cannot be touched by
326-
the stake pool. The stake account `5AaobwjccyHnXhFCd24uiX6VqPjXE3Ry4o92fJjqqjAr`,
327-
delegated to `J3xu64PWShcMen99kU3igxtwbke2Nwfo8pkZNRgrq66H`, actually has a balance
328-
of 0.00328288 SOL, but since this is the minimum required amount, it is
329-
not shown by the CLI.
330+
the stake pool. The reserve stake account `EN4px2h4gFkYtsQUi4yeCYBrdRM4DoRxCVJyavMXEAm5`
331+
actually has an additional balance of 0.002282881 SOL, but since this is the minimum
332+
required amount, it is not shown by the CLI.
330333

331334
### Remove validator stake account
332335

333336
If the stake pool staker wants to stop delegating to a vote account, they can
334337
totally remove the validator stake account from the stake pool.
335338

336339
As with adding a validator, the validator stake account must have exactly
337-
0.00328288 SOL (0.001 SOL delegated, 0.00228288 SOL for rent exemption) to be removed.
340+
1.00228288 SOL (1 SOL delegated, 0.00228288 SOL for rent exemption) to be removed.
338341

339342
If that is not the case, the staker must first decrease the stake to that minimum amount.
340343
Let's assume that the validator stake account delegated to
@@ -356,29 +359,18 @@ Creating account to receive stake nHEEyey8KkgHuVRAUDzkH5Q4PkA4veSHuTxgG6C8L2G
356359
Signature: 4XprnR768Ch6LUvqUVLTjMCiqdYvtjNfECh4izErqwbsASTGjUBz7NtLZHAiraTqhs7b9PoSAazetdsgXa6J4wVu
357360
```
358361

359-
Unlike a normal withdrawal, the validator stake account is totally moved from
360-
the stake pool and into a new account belonging to the administrator.
361-
362-
Note: since removal is only possible when the validator stake is at the minimum
363-
amount of 0.00328288, the administrator does not get any control of user funds,
364-
and only recovers the amount contributed during `add-validator`.
365-
366-
The authority for the withdrawn stake account can also be specified using the
367-
`--new-authority` flag:
368-
369-
```console
370-
$ spl-stake-pool remove-validator Zg5YBPAk8RqBR9kaLLSoN5C8Uv7nErBz1WC63HTsCPR J3xu64PWShcMen99kU3igxtwbke2Nwfo8pkZNRgrq66H --new-authority 4SnSuUtJGKvk2GYpBwmEsWG53zTurVM8yXGsoiZQyMJn
371-
Signature: 5rrQ3xhDWyiPkUTAQkNAeq31n6sMf1xsg2x9hVY8Vj1NonwBnhxuTv87nADLkwC8Xzc4CGTNCTX2Vph9esWnXk2d
372-
```
362+
Unlike a normal withdrawal, the validator stake account is deactivated, and then
363+
merged into the reserve during the next epoch.
373364

374-
We can check the removed stake account:
365+
We can check the deactivating stake account:
375366

376367
```console
377368
$ solana stake-account nHEEyey8KkgHuVRAUDzkH5Q4PkA4veSHuTxgG6C8L2G
378-
Balance: 0.003282880 SOL
379-
Rent Exempt Reserve: 0.00328288 SOL
380-
Delegated Stake: 0.001000000 SOL
381-
Active Stake: 0.001000000 SOL
369+
Balance: 1.002282880 SOL
370+
Rent Exempt Reserve: 0.00228288 SOL
371+
Delegated Stake: 1.000000000 SOL
372+
Active Stake: 1.000000000 SOL
373+
Stake deactivates starting from epoch: 10
382374
Delegated Vote Account Address: J3xu64PWShcMen99kU3igxtwbke2Nwfo8pkZNRgrq66H
383375
Stake Authority: 4SnSuUtJGKvk2GYpBwmEsWG53zTurVM8yXGsoiZQyMJn
384376
Withdraw Authority: 4SnSuUtJGKvk2GYpBwmEsWG53zTurVM8yXGsoiZQyMJn
@@ -812,11 +804,28 @@ be able to withdraw their funds.
812804

813805
To get around this case, it is also possible to withdraw from the stake pool's
814806
reserve, but only if all of the validator stake accounts are at the minimum amount of
815-
`0.001 SOL + stake account rent exemption`.
807+
`1 SOL + stake account rent exemption`.
816808

817809
```console
818810
$ spl-stake-pool withdraw-stake Zg5YBPAk8RqBR9kaLLSoN5C8Uv7nErBz1WC63HTsCPR 5 --use-reserve
819811
Withdrawing ◎5.000000000, or 5 pool tokens, from stake account J5XB7mWpeaUZxZ6ogXT57qSCobczx27vLZYSgfSbZoBB
820812
Creating account to receive stake 51XdXiBSsVzeuY79xJwWAGZgeKzzgFKWajkwvWyrRiNE
821813
Signature: yQH9n7Go6iCMEYXqWef38ZYBPwXDmbwKAJFJ4EHD6TusBpusKsfNuT3TV9TL8FmxR2N9ExZTZwbD9Njc3rMvUcf
822814
```
815+
816+
#### Special case: removing validator from the pool
817+
818+
Since the funds used to add validators to the pool come from outside deposits,
819+
it's possible for a delinquent or malicious staker to make it impossible for
820+
users to reclaim their SOL by keeping everything at the minimum amount.
821+
822+
To get around this case, it is also possible to remove a validator from the stake pool
823+
but only if all of the validator stake accounts are at the minimum amount of
824+
`1 SOL + stake account rent exemption`.
825+
826+
```console
827+
$ spl-stake-pool withdraw-stake Zg5YBPAk8RqBR9kaLLSoN5C8Uv7nErBz1WC63HTsCPR 1.00228288 SOL
828+
Withdrawing ◎1.00228288 or 1.00228288 pool tokens, from stake account J5XB7mWpeaUZxZ6ogXT57qSCobczx27vLZYSgfSbZoBB
829+
Creating account to receive stake 51XdXiBSsVzeuY79xJwWAGZgeKzzgFKWajkwvWyrRiNE
830+
Signature: yQH9n7Go6iCMEYXqWef38ZYBPwXDmbwKAJFJ4EHD6TusBpusKsfNuT3TV9TL8FmxR2N9ExZTZwbD9Njc3rMvUcf
831+
```

docs/src/stake-pool/overview.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This document is intended for the main actors of the stake pool system:
3232

3333
* manager: creates and manages the stake pool, earns fees, can update the fee, staker, and manager
3434
* staker: adds and removes validators to the pool, rebalances stake among validators
35-
* user: provides staked SOL into an existing stake pool
35+
* user: provides liquid or staked SOL into an existing stake pool
3636

3737
In its current iteration, the stake pool accepts active stakes or SOL, so
3838
deposits may come from either an active stake or SOL wallet. Withdrawals
@@ -56,17 +56,16 @@ providers for direct SOL deposits.
5656

5757
## Operation
5858

59-
A stake pool manager creates a stake pool, and the staker includes validators that will
60-
receive delegations from the pool by adding "validator stake accounts" to the pool
61-
using the `add-validator` instruction. In this command, the stake pool creates
62-
a new stake account and delegates it to the desired validator.
59+
A stake pool manager creates a stake pool. At this point, users can immediately
60+
participate with SOL deposits with the `deposit-sol` instruction, moving funds
61+
into the reserve in exchange for pool tokens.
6362

64-
At this point, users can participate with deposits. They can directly deposit
65-
SOL into the stake pool using the `deposit-sol` instruction. Within this instruction,
66-
the stake pool will move SOL into the pool's reserve account, to be redistributed
67-
by the staker.
63+
Using those SOL deposits, the staker includes validators that will receive
64+
delegations from the pool by adding "validator stake accounts" to the pool
65+
using the `add-validator` instruction. In this command, the stake pool uses
66+
reserve funds to create a new stake account and delegate it to the desired validator.
6867

69-
Alternatively, users can deposit a stake account into the pool. To do this,
68+
At this point, users can also deposit a stake account into the pool. To do this,
7069
they must delegate a stake account to the one of the validators in the stake pool.
7170
If the stake pool has a preferred deposit validator, the user must delegate their
7271
stake to that validator's vote account.
@@ -101,10 +100,8 @@ The stake pool staker can add and remove validators, or rebalance the pool by
101100
decreasing the stake on a validator, waiting an epoch to move it into the stake
102101
pool's reserve account, then increasing the stake on another validator.
103102

104-
The staker operation to add a new validator requires 0.00328288 SOL to create
105-
the stake account on a validator, so the stake pool staker will need liquidity
106-
on hand to fully manage the pool stakes. The SOL used to add a new validator
107-
is recovered when removing the validator.
103+
The staker operation to add a new validator requires 1.00228288 SOL to create
104+
the stake account on a validator, so the stake pool reserve needs liquidity.
108105

109106
### Funding restrictions
110107

@@ -153,6 +150,7 @@ When processing withdrawals, the order of priority goes:
153150
* validator stake accounts
154151
* transient stake accounts
155152
* reserve stake account
153+
* removing validator stake accounts entirely
156154

157155
If there is preferred withdraw validator, and that validator stake account has
158156
any SOL, a user must withdraw from that account.
@@ -165,7 +163,7 @@ staker decreases the stake on all validators at once, then the user must withdra
165163
from any transient stake account.
166164

167165
If all transient stake accounts are empty, then the user must withdraw from the
168-
reserve.
166+
reserve or completely remove a validator stake account.
169167

170168
In this way, a user's funds are never at risk, and always redeemable.
171169

docs/src/stake-pool/quickstart.md

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -117,28 +117,50 @@ Carefully read through the [Fees](fees.md) for more information about fees and
117117
best practices.
118118

119119
In our example, we will use fees of 0.3%, a referral fee of 50%, opt to *not*
120-
set a deposit authority, and have the maximum number of validators (2,950). Next,
121-
run the script:
120+
set a deposit authority, and have the maximum number of validators (2,350). Next,
121+
run the script with the amount of SOL to deposit. We'll use 15 SOL:
122122

123123
```bash
124-
$ ./setup-stake-pool.sh
124+
$ ./setup-stake-pool.sh 15
125125
Creating pool
126-
+ spl-stake-pool create-pool --epoch-fee-numerator 3 --epoch-fee-denominator 1000 --withdrawal-fee-numerator 3 --withdrawal-fee-denominator 1000 --deposit-fee-numerator 3 --deposit-fee-denominator 1000 --referral-fee 50 --max-validators 2950 --pool-keypair keys/stake-pool.json --validator-list-keypair keys/validator-list.json --mint-keypair keys/mint.json --reserve-keypair keys/reserve.json
126+
+ spl-stake-pool create-pool --epoch-fee-numerator 3 --epoch-fee-denominator 1000 --withdrawal-fee-numerator 3 --withdrawal-fee-denominator 1000 --deposit-fee-numerator 3 --deposit-fee-denominator 1000 --referral-fee 50 --max-validators 2350 --pool-keypair keys/stake-pool.json --validator-list-keypair keys/validator-list.json --mint-keypair keys/mint.json --reserve-keypair keys/reserve.json
127127
Creating reserve stake 4tvTkLB4X7ahUYZ2NaTohkG3mud4UBBvu9ZEGD4Wk9mt
128128
Creating mint BoNneHKDrX9BHjjvSpPfnQyRjsnc9WFH71v8wrgCd7LB
129129
Creating associated token account DgyZrAq88bnG1TNRxpgDQzWXpzEurCvfY2ukKFWBvADQ to receive stake pool tokens of mint BoNneHKDrX9BHjjvSpPfnQyRjsnc9WFH71v8wrgCd7LB, owned by 4SnSuUtJGKvk2GYpBwmEsWG53zTurVM8yXGsoiZQyMJn
130130
Creating pool fee collection account DgyZrAq88bnG1TNRxpgDQzWXpzEurCvfY2ukKFWBvADQ
131131
Signature: 51yf2J6dSGAx42KPs2oTMTV4ufEm1ncAHyLPQ6PNf4sbeMHGqno7BGn2tHkUnrd7PRXiWBbGzCWpJNevYjmoLgn2
132132
Creating stake pool Zg5YBPAk8RqBR9kaLLSoN5C8Uv7nErBz1WC63HTsCPR with validator list 86VZZCuqiz7sDJpFKjQy9c9dZQN9vwDKbYgY8pcwHuaF
133133
Signature: 47QHcWMEa5Syg13C3SQRA4n88Y8iLx1f39wJXQAStRUxpt2VD5t6pYgAdruNRHUQt1ZBY8QwbvEC1LX9j3nPrAzn
134+
Depositing SOL into stake pool
135+
Update not required
136+
Using existing associated token account DgyZrAq88bnG1TNRxpgDQzWXpzEurCvfY2ukKFWBvADQ to receive stake pool tokens of mint BoNneHKDrX9BHjjvSpPfnQyRjsnc9WFH71v8wrgCd7LB, owned by 4SnSuUtJGKvk2GYpBwmEsWG53zTurVM8yXGsoiZQyMJn
137+
Signature: 4jnS368HcofZ1rUpsGZtmSK9kVxFzJRndSX5VS7eMV3kVgzyg9efA4mcgd2C6BoSNksTmTonRGXTVM1WMywFpiKq
134138
```
135139

136140
Your stake pool now exists! For the largest number of validators, the cost for
137-
this phase is ~2.02 SOL.
141+
this phase is ~2.02 SOL, plus 15 SOL deposited into the pool in exchange for
142+
pool tokens.
143+
144+
## Step 2: Deposit SOL into the pool
145+
146+
Now that the pool exists, let's deposit some SOL in exchange for some pool tokens.
147+
148+
SOL will likely be the most attractive form of deposit, since it's the easiest
149+
for everyone to use. Normally, this will likely be done from a DeFi app or
150+
wallet, but in our example, we'll do it straight from the command line.
151+
152+
We already deposited 15 SOL during creation of the pool, but let's deposit
153+
another 10 SOL into the pool:
154+
155+
```
156+
$ spl-stake-pool deposit-sol Zg5YBPAk8RqBR9kaLLSoN5C8Uv7nErBz1WC63HTsCPR 10
157+
Using existing associated token account DgyZrAq88bnG1TNRxpgDQzWXpzEurCvfY2ukKFWBvADQ to receive stake pool tokens of mint BoNneHKDrX9BHjjvSpPfnQyRjsnc9WFH71v8wrgCd7LB, owned by 4SnSuUtJGKvk2GYpBwmEsWG53zTurVM8yXGsoiZQyMJn
158+
Signature: 4AJv6hSznYoMGnaQvjWXSBjKqtjYpjBx2MLezmRRjWRDa8vUaBLQfPNGd3kamZNs1JeWSvnzczwtzsMD5WkgKamA
159+
```
138160

139-
## Step 2: Add validators to the pool
161+
## Step 3: Add validators to the pool
140162

141-
Now that the pool exists, we need to add validators to it.
163+
Now that the pool has some SOL, we need to add validators to it.
142164

143165
Using `add-validators.sh`, we'll add each of the validators created during step 0
144166
to the stake pool. If you are running on another network, you can create your own
@@ -153,34 +175,17 @@ Signature: 3XtmYu9msqnMeKJs9BopYjn5QTc5hENMXXiBwvEw6HYzU5w6z1HUkGwNW24io4Vu9WRKF
153175
... (something similar repeated 9 more times)
154176
```
155177

156-
This operation costs 0.00328288 SOL per validator. This amount is totally recoverable
157-
by removing the validator from the stake pool.
178+
This operation moves 1.00228288 SOL from the reserve to a stake account on a given
179+
validator. This means you'll need over 1 SOL for each validator that you want to add.
158180

159-
## Step 3: Deposit into the pool
181+
## Step 4: Deposit stakes into the pool
160182

161-
Now that your pool has validators, it needs some SOL or stake accounts for you
183+
Now that your pool has validators, it can accept stake accounts for you
162184
to manage. There are two possible sources of deposits: SOL or stake accounts.
185+
In step 2, we deposited SOL directly, so now we'll deposit stake accounts.
163186

164-
### a) Depositing SOL
165-
166-
This will likely be the most attractive form of deposit, since it's the easiest
167-
for everyone to use. Normally, this will likely be done from a DeFi app or
168-
wallet, but in our example, we'll do it straight from the command line. Let's
169-
deposit 10 SOL into our pool:
170-
171-
```
172-
$ spl-stake-pool deposit-sol Zg5YBPAk8RqBR9kaLLSoN5C8Uv7nErBz1WC63HTsCPR 100
173-
Using existing associated token account DgyZrAq88bnG1TNRxpgDQzWXpzEurCvfY2ukKFWBvADQ to receive stake pool tokens of mint BoNneHKDrX9BHjjvSpPfnQyRjsnc9WFH71v8wrgCd7LB, owned by 4SnSuUtJGKvk2GYpBwmEsWG53zTurVM8yXGsoiZQyMJn
174-
Signature: 4AJv6hSznYoMGnaQvjWXSBjKqtjYpjBx2MLezmRRjWRDa8vUaBLQfPNGd3kamZNs1JeWSvnzczwtzsMD5WkgKamA
175-
```
176-
177-
Now there will be some SOL for us to work with.
178-
179-
### b) Depositing stake accounts
180-
181-
Alternatively, users can deposit stake accounts into the pool. This option is
182-
particularly attractive for users that already have a stake account, and either
183-
want stake pool tokens in return, or to diversify their stake more.
187+
This option is particularly attractive for users that already have a stake
188+
account, and either want stake pool tokens in return, or to diversify their stake more.
184189

185190
The `deposit.sh` script gives an idea of how this works with the CLI.
186191

@@ -194,7 +199,7 @@ $ ./deposit.sh keys/stake-pool.json local_validators.txt 10
194199
Note: This is a bit more finnicky on a local network because of the short epochs, and
195200
may fail. No problem, you simply need to retry.
196201

197-
## Step 4: Rebalance stake in the pool
202+
## Step 5: Rebalance stake in the pool
198203

199204
Over time, as people deposit SOL into the reserve, or as validator performance
200205
varies, you will want to move stake around. The best way to do this will be
@@ -216,7 +221,7 @@ to make sure that this is valid.
216221
$ ./rebalance.sh keys/stake-pool.json local_validators.txt 1
217222
```
218223

219-
## Step 5: Withdraw from the stake pool
224+
## Step 6: Withdraw from the stake pool
220225

221226
Finally, if a user wants to withdraw from the stake pool, they can choose to
222227
withdraw SOL from the reserve if it has enough SOL, or to withdraw from one of

stake-pool/cli/scripts/deposit.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,3 @@ echo "If you are running on localnet with 32 slots per epoch, wait 12 seconds...
6969
sleep 12
7070
echo "Depositing stakes into stake pool"
7171
deposit_stakes "$stake_pool_pubkey" "$validator_list" $authority
72-
echo "Depositing SOL into stake pool"
73-
$spl_stake_pool deposit-sol "$stake_pool_pubkey" "$sol_amount"

stake-pool/cli/scripts/setup-stake-pool.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,28 @@
55

66
cd "$(dirname "$0")" || exit
77
command_args=()
8+
sol_amount=$1
89

910
###################################################
1011
### MODIFY PARAMETERS BELOW THIS LINE FOR YOUR POOL
1112
###################################################
1213

1314
# Epoch fee, assessed as a percentage of rewards earned by the pool every epoch,
1415
# represented as `numerator / denominator`
15-
command_args+=( --epoch-fee-numerator 0 )
16-
command_args+=( --epoch-fee-denominator 0 )
16+
command_args+=( --epoch-fee-numerator 1 )
17+
command_args+=( --epoch-fee-denominator 100 )
1718

1819
# Withdrawal fee for SOL and stake accounts, represented as `numerator / denominator`
19-
command_args+=( --withdrawal-fee-numerator 0 )
20-
command_args+=( --withdrawal-fee-denominator 0 )
20+
command_args+=( --withdrawal-fee-numerator 2 )
21+
command_args+=( --withdrawal-fee-denominator 100 )
2122

2223
# Deposit fee for SOL and stake accounts, represented as `numerator / denominator`
23-
command_args+=( --deposit-fee-numerator 0 )
24-
command_args+=( --deposit-fee-denominator 0 )
24+
command_args+=( --deposit-fee-numerator 3 )
25+
command_args+=( --deposit-fee-denominator 100 )
2526

2627
command_args+=( --referral-fee 0 ) # Percentage of deposit fee that goes towards the referrer (a number between 0 and 100, inclusive)
2728

28-
command_args+=( --max-validators 2950 ) # Maximum number of validators in the stake pool, 2950 is the current maximum possible
29+
command_args+=( --max-validators 2350 ) # Maximum number of validators in the stake pool, 2350 is the current maximum possible
2930

3031
# (Optional) Deposit authority, required to sign all deposits into the pool.
3132
# Setting this variable makes the pool "private" or "restricted".
@@ -68,3 +69,9 @@ $spl_stake_pool \
6869
--validator-list-keypair "$validator_list_keyfile" \
6970
--mint-keypair "$mint_keyfile" \
7071
--reserve-keypair "$reserve_keyfile"
72+
73+
set +ex
74+
echo "Depositing SOL into stake pool"
75+
stake_pool_pubkey=$(solana-keygen pubkey "$stake_pool_keyfile")
76+
set -ex
77+
$spl_stake_pool deposit-sol "$stake_pool_pubkey" "$sol_amount"

0 commit comments

Comments
 (0)