-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add URL to all scripts
- Loading branch information
Showing
9 changed files
with
183 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,28 +1,81 @@ | ||
All this scripts support `$URL` variable for set another rpc end-point (default is api.mainnet-beta.solana.com). | ||
|
||
Examples: | ||
``` | ||
URL=https://localhost:8899/ ./rebalance-sol.sh 0.1 | ||
URL=https://free.rpcpool.com/ ./rebalance-sol.sh 0.1 | ||
URL=https://solana-api.projectserum.com/ ./rebalance-sol.sh 0.1 | ||
``` | ||
|
||
# Raydium scripts | ||
|
||
For possible values for POOL use `../raydium ido --help` | ||
|
||
## stake.sh | ||
|
||
``` | ||
./stake.sh <POOL> | ||
``` | ||
For possible values for POOL use `../raydium ido --help` | ||
|
||
--- | ||
## claim.sh | ||
|
||
``` | ||
./claim.sh <POOL> | ||
``` | ||
For possible values for POOL use `../raydium ido --help` | ||
|
||
Claim is smart. It try to do all possible actions and doesn't do not needed actions. Though if you want the transactions looks like as the official site make it you could use optional flags for this. `../raydium ido claim --help` helps you. | ||
|
||
--- | ||
# Keypairs scripts | ||
|
||
## keygen.sh | ||
|
||
Restore your 100500 wallets from Phantom: | ||
``` | ||
./keygen.sh | ||
``` | ||
Restore your 100500 wallets from Phantom. | ||
|
||
The results will be saved as `keys/[prefix]_[index]-[address].json` | ||
|
||
You need to use `solana` v9. This doesn't work with 10th version. | ||
|
||
# Balance management scripts | ||
|
||
## rebalance-sol.sh | ||
|
||
``` | ||
./rebalance-sol.sh <AIM> <VAULT> | ||
``` | ||
|
||
`AIM` - the target value in SOLs in `keys/*.json` keypairs | ||
|
||
`VAULT` - path to vault keypair | ||
|
||
## rebalance-token.sh | ||
|
||
``` | ||
./rebalance-token.sh <TOKEN> <AIM> <VAULT> | ||
``` | ||
|
||
`TOKEN` - token mint address | ||
|
||
`AIM` - the target value in Tokens in `keys/*.json` wallets | ||
|
||
`VAULT` - path to vault keypair | ||
|
||
## rebalance-token-usdc.sh | ||
|
||
Just a helper for USDC rebalancing. | ||
|
||
``` | ||
./rebalance-token-usdc.sh <AIM> <VAULT> | ||
``` | ||
|
||
`AIM` - the target value in Tokens in `keys/*.json` wallets | ||
|
||
`VAULT` - path to vault keypair | ||
|
||
## balance-*.sh | ||
|
||
They are like rebalance-* but only to show your accounts balances. `AIM` and `VAULT` aren't needed. | ||
|
This file contains 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,13 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z ${URL} ]]; then | ||
URL=mainnet-beta | ||
fi | ||
|
||
fmt="%-45s%s\n" | ||
for keypair in keys/*.json | ||
do | ||
address=$(solana address -k $keypair) | ||
balance=$(solana -u $URL balance -k $keypair | grep -o '[0-9.]*') | ||
printf "$fmt" $address $balance | ||
done |
This file contains 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,5 @@ | ||
#!/bin/bash | ||
|
||
TOKEN=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v | ||
|
||
./balance-token.sh $TOKEN |
This file contains 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,15 @@ | ||
#!/bin/bash | ||
|
||
TOKEN=$1 | ||
|
||
if [[ -z ${URL} ]]; then | ||
URL=mainnet-beta | ||
fi | ||
|
||
fmt="%-45s%s\n" | ||
for keypair in keys/*.json | ||
do | ||
address=$(solana address -k $keypair) | ||
balance=$(spl-token -u $URL balance $TOKEN --owner $keypair) | ||
printf "$fmt" $address $balance | ||
done |
This file contains 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 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,37 @@ | ||
#!/bin/bash | ||
|
||
AIM=$1 | ||
VAULT=$2 | ||
|
||
if [[ -z ${URL} ]]; then | ||
URL=mainnet-beta | ||
fi | ||
|
||
for keypair in keys/*.json | ||
do | ||
address=$(solana address -k $keypair) | ||
balance=$(solana -u $URL balance -k $keypair | grep -o '[0-9.]*') | ||
if (( $(echo "$balance < $AIM" | bc -l) )); then | ||
amount=$(echo "$AIM - $balance" | bc -l) | ||
from=$VAULT | ||
to=$keypair | ||
job=Funding | ||
elif (( $(echo "$balance > $AIM" | bc -l) )); then | ||
amount=$(echo "$balance - $AIM" | bc -l) | ||
from=$keypair | ||
to=$VAULT | ||
job=Refunding | ||
else | ||
amount=0 | ||
job="Nothing to do" | ||
fi | ||
if [[ "$amount" == .* ]]; then | ||
amount="0$amount" | ||
fi | ||
if [[ "$amount" == 0 ]]; then | ||
echo $address: $balance SOL. $job | ||
continue | ||
fi | ||
echo $address: $balance SOL. $job $amount SOL... | ||
solana -u $URL transfer -k $from $to $amount --fee-payer $VAULT --allow-unfunded-recipient | ||
done |
This file contains 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,7 @@ | ||
#!/bin/bash | ||
|
||
TOKEN=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v | ||
AIM=$1 | ||
VAULT=$2 | ||
|
||
./rebalance-token.sh $TOKEN $AIM $VAULT |
This file contains 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,38 @@ | ||
#!/bin/bash | ||
|
||
TOKEN=$1 | ||
AIM=$2 | ||
VAULT=$3 | ||
|
||
if [[ -z ${URL} ]]; then | ||
URL=mainnet-beta | ||
fi | ||
|
||
for keypair in keys/*.json | ||
do | ||
address=$(solana address -k $keypair) | ||
balance=$(spl-token -u $URL balance $TOKEN --owner $keypair) | ||
if (( $(echo "$balance < $AIM" | bc -l) )); then | ||
amount=$(echo "$AIM - $balance" | bc -l) | ||
from=$VAULT | ||
to=$keypair | ||
job=Funding | ||
elif (( $(echo "$balance > $AIM" | bc -l) )); then | ||
amount=$(echo "$balance - $AIM" | bc -l) | ||
from=$keypair | ||
to=$VAULT | ||
job=Refunding | ||
else | ||
amount=0 | ||
job="Nothing to do" | ||
fi | ||
if [[ "$amount" == .* ]]; then | ||
amount="0$amount" | ||
fi | ||
if [[ "$amount" == 0 ]]; then | ||
echo $address: $balance Tokens. $job | ||
continue | ||
fi | ||
echo $address: $balance Tokens. $job $amount Tokens... | ||
spl-token -u $URL transfer $TOKEN $amount $to --owner $from --fee-payer $VAULT --allow-unfunded-recipient --fund-recipient | ||
done |
This file contains 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