-
Notifications
You must be signed in to change notification settings - Fork 39
cli: Properly support token-2022 mints #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Script to setup a stake pool from scratch. Please modify the parameters to | ||
| # create a stake pool to your liking! | ||
|
|
||
| cd "$(dirname "$0")" || exit | ||
| command_args=() | ||
| sol_amount=$1 | ||
|
|
||
| ################################################### | ||
| ### MODIFY PARAMETERS BELOW THIS LINE FOR YOUR POOL | ||
| ################################################### | ||
|
|
||
| # Epoch fee, assessed as a percentage of rewards earned by the pool every epoch, | ||
| # represented as `numerator / denominator` | ||
| command_args+=( --epoch-fee-numerator 1 ) | ||
| command_args+=( --epoch-fee-denominator 100 ) | ||
|
|
||
| # Withdrawal fee for SOL and stake accounts, represented as `numerator / denominator` | ||
| command_args+=( --withdrawal-fee-numerator 2 ) | ||
| command_args+=( --withdrawal-fee-denominator 100 ) | ||
|
|
||
| # Deposit fee for SOL and stake accounts, represented as `numerator / denominator` | ||
| command_args+=( --deposit-fee-numerator 3 ) | ||
| command_args+=( --deposit-fee-denominator 100 ) | ||
|
|
||
| command_args+=( --referral-fee 0 ) # Percentage of deposit fee that goes towards the referrer (a number between 0 and 100, inclusive) | ||
|
|
||
| command_args+=( --max-validators 2350 ) # Maximum number of validators in the stake pool, 2350 is the current maximum possible | ||
|
|
||
| # (Optional) Deposit authority, required to sign all deposits into the pool. | ||
| # Setting this variable makes the pool "private" or "restricted". | ||
| # Uncomment and set to a valid keypair if you want the pool to be restricted. | ||
| #command_args+=( --deposit-authority keys/authority.json ) | ||
|
|
||
| ################################################### | ||
| ### MODIFY PARAMETERS ABOVE THIS LINE FOR YOUR POOL | ||
| ################################################### | ||
|
|
||
| keys_dir=keys | ||
| spl_stake_pool=spl-stake-pool | ||
| # Uncomment to use a local build | ||
| spl_stake_pool=../../../target/debug/spl-stake-pool | ||
|
|
||
| mkdir -p $keys_dir | ||
|
|
||
| create_keypair () { | ||
| if test ! -f "$1" | ||
| then | ||
| solana-keygen new --no-passphrase -s -o "$1" | ||
| fi | ||
| } | ||
|
|
||
| echo "Creating pool" | ||
| stake_pool_keyfile=$keys_dir/stake-pool.json | ||
| validator_list_keyfile=$keys_dir/validator-list.json | ||
| mint_keyfile=$keys_dir/mint.json | ||
| reserve_keyfile=$keys_dir/reserve.json | ||
| create_keypair $stake_pool_keyfile | ||
| create_keypair $validator_list_keyfile | ||
| create_keypair $mint_keyfile | ||
| create_keypair $reserve_keyfile | ||
|
|
||
| spl-token create-token --program-2022 "$mint_keyfile" | ||
|
|
||
| set -ex | ||
| $spl_stake_pool \ | ||
| create-pool \ | ||
| "${command_args[@]}" \ | ||
| --pool-keypair "$stake_pool_keyfile" \ | ||
| --validator-list-keypair "$validator_list_keyfile" \ | ||
| --mint-keypair "$mint_keyfile" \ | ||
| --reserve-keypair "$reserve_keyfile" | ||
|
|
||
| set +ex | ||
| stake_pool_pubkey=$(solana-keygen pubkey "$stake_pool_keyfile") | ||
| set -ex | ||
|
|
||
| echo "Depositing SOL into stake pool" | ||
| $spl_stake_pool deposit-sol "$stake_pool_pubkey" "$sol_amount" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this ux and the corresponding "fall back to tokenkeg" rather than adding a cli flag is clever