diff --git a/src/cc/dapps/oracle_dapp.sh b/src/cc/dapps/oracle_dapp.sh new file mode 100755 index 000000000..ff10f2c3f --- /dev/null +++ b/src/cc/dapps/oracle_dapp.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Set ORACLETXID +read -p "Enter your oracle TXID (Oracle should have L data type) : " oracletxid +sed -i "/#define ORACLETXID */c\#define ORACLETXID \"$oracletxid\"" oraclefeed.c +# SET PUBKEY +read -p "Enter your pubkey : " pubkey +sed -i "/#define MYPUBKEY */c\#define MYPUBKEY \"$pubkey\"" oraclefeed.c +# SET AC +read -p "Enter AC name you use : " acname +sed -i "/#define ACNAME */c\#define ACNAME \"$acname\"" oraclefeed.c +# COMPILATION +echo "Great, compiling !" +gcc oraclefeed.c -lm -o oracle_dapp +mv oracle_dapp ../../oracle_dapp +echo "Oracle is ready to use !" +while true; do + read -p "Would you like to run BTCUSD oracle app? [Y/N]" yn + case $yn in + [Yy]* ) cd ../..; ./oracle_dapp; break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done diff --git a/src/cc/dapps/oraclefeed.c b/src/cc/dapps/oraclefeed.c index e2a7c6830..f32ef3f73 100644 --- a/src/cc/dapps/oraclefeed.c +++ b/src/cc/dapps/oraclefeed.c @@ -392,6 +392,7 @@ oraclesdata 17a841a919c284cea8a676f34e793da002e606f19a9258a3190bed12d5aaa3ff 034 #define ORACLETXID "4895f631316a649e216153aee7a574bd281686265dc4e8d37597f72353facac3" #define MYPUBKEY "02ebc786cb83de8dc3922ab83c21f3f8a2f3216940c3bf9da43ce39e2a3a882c92" +#define ACNAME "ORCL" int32_t main(int32_t argc,char **argv) { @@ -400,7 +401,7 @@ int32_t main(int32_t argc,char **argv) while ( 1 ) { retstr = 0; - if ( (price= get_btcusd()) != 0 && (clijson= get_komodocli(&retstr,"AT5","oraclesinfo",ORACLETXID,"","")) != 0 ) + if ( (price= get_btcusd()) != 0 && (clijson= get_komodocli(&retstr,ACNAME,"oraclesinfo",ORACLETXID,"","")) != 0 ) { if ( (regjson= jarray(&n,clijson,"registered")) != 0 ) { @@ -412,10 +413,10 @@ int32_t main(int32_t argc,char **argv) for (j=0; j<8; j++) sprintf(&hexstr[j*2],"%02x",(uint8_t)((price >> (j*8)) & 0xff)); hexstr[16] = 0; - if ( (clijson2= get_komodocli(&retstr2,"AT5","oraclesdata",ORACLETXID,hexstr,"")) != 0 ) + if ( (clijson2= get_komodocli(&retstr2,ACNAME,"oraclesdata",ORACLETXID,hexstr,"")) != 0 ) { //printf("data.(%s)\n",jprint(clijson2,0)); - komodobroadcast("AT5",clijson2); + komodobroadcast(ACNAME,clijson2); free_json(clijson2); } else if ( retstr2 != 0 )