File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ PYTH=./pyth
4
+ SOLANA=../../solana/target/release/solana
5
+ SOL_OPT=" -u localhost --commitment finalized"
6
+ RPC=" -r localhost"
7
+ FINAL=" -c finalized"
8
+
9
+ check ()
10
+ {
11
+ CMD=$1
12
+ echo " $CMD "
13
+ eval $CMD
14
+ RC=$?
15
+ if [ $RC -ne 0 ]; then
16
+ echo " unexpected error executing rc= $RC "
17
+ exit 1
18
+ fi
19
+ }
20
+
21
+ setup_admin ()
22
+ {
23
+ DIR=$1
24
+ OPT=" -k $DIR $RPC $FINAL "
25
+ chmod 0700 $DIR
26
+
27
+ # create publisher key and fund it
28
+ check " $PYTH init_key $OPT "
29
+ check " $SOLANA airdrop 10 -k $DIR /publish_key_pair.json $SOL_OPT "
30
+
31
+ # create program key
32
+ check " $PYTH init_program $OPT "
33
+
34
+ # setup program key and deploy
35
+ check " $SOLANA program deploy ../target/oracle.so -k $DIR /publish_key_pair.json --program-id $DIR /program_key_pair.json $SOL_OPT "
36
+
37
+ # setup mapping account
38
+ check " $PYTH init_mapping $OPT "
39
+ }
40
+
41
+ # create key_store directory and initialize key, program and mapping
42
+ # accounts assuming you have a local build of solana and are running
43
+ # both a solana-validator and solana-faucet on localhost
44
+ # run from build/ directory
45
+ KDIR=$1
46
+ if [ -z " $KDIR " ] ; then
47
+ echo " set_local.sh <key_store_directory>"
48
+ exit 1
49
+ fi
50
+ setup_admin $KDIR
You can’t perform that action at this time.
0 commit comments