Browse Source

fundnotaries

etomic
jl777 8 years ago
parent
commit
8be6b10c5e
  1. 22
      iguana/iguana_notary.c
  2. 2
      iguana/tests/fundnotaries
  3. 2
      includes/iguana_apideclares.h

22
iguana/iguana_notary.c

@ -425,29 +425,33 @@ STRING_ARG(iguana,addnotary,ipaddr)
return(clonestr("{\"result\":\"notary node added\"}")); return(clonestr("{\"result\":\"notary node added\"}"));
} }
STRING_ARG(dpow,active,maskhex) STRING_ARG(dpow,fundnotaries,symbol)
{
uint8_t data[8],revdata[8]; int32_t i,len; uint64_t mask; cJSON *retjson,*array = cJSON_CreateArray();
//return(clonestr("{\"error\":\"dpow active is deprecated for now\"}"));
if ( 0 )
{ {
int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height); int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height);
char CURRENCIES[][16] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies char CURRENCIES[][16] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies
"CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK",
"REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "SHARK", "BOTS", "MGW" }; "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "SHARK", "BOTS", "MGW" };
uint8_t pubkeys[64][33]; char coinaddr[64]; int32_t i,j; double val = 0.01; uint8_t pubkeys[64][33]; char coinaddr[64],cmd[1024]; int32_t i,j; double val = 0.01;
int32_t n = komodo_notaries("KMD",pubkeys,114000); int32_t n = komodo_notaries("KMD",pubkeys,114000);
//#include "notaries.h"
for (i=0; i<sizeof(CURRENCIES)/sizeof(*CURRENCIES); i++) for (i=0; i<sizeof(CURRENCIES)/sizeof(*CURRENCIES); i++)
{
if ( symbol == 0 || symbol[0] == 0 || strcmp(symbol,CURRENCIES[i]) == 0 )
{ {
for (j=0; j<n; j++) for (j=0; j<n; j++)
{ {
//decode_hex(pubkeys[j],33,Notaries[j][1]);
bitcoin_address(coinaddr,60,pubkeys[j],33); bitcoin_address(coinaddr,60,pubkeys[j],33);
printf("./komodo-cli -ac_name=%s sendtoaddress %s %f\n",CURRENCIES[i],coinaddr,val); sprintf(cmd,"./komodo-cli -ac_name=%s sendtoaddress %s %f\n",CURRENCIES[i],coinaddr,val);
if ( system(cmd) != 0 )
printf("ERROR with (%s)\n",cmd);
}
} }
} }
return(clonestr("{\"result\":\"success\"}"));
} }
STRING_ARG(dpow,active,maskhex)
{
uint8_t data[8],revdata[8]; int32_t i,len; uint64_t mask; cJSON *retjson,*array = cJSON_CreateArray();
if ( maskhex == 0 || maskhex[0] == 0 ) if ( maskhex == 0 || maskhex[0] == 0 )
{ {
mask = myinfo->DPOWS[0].lastrecvmask; mask = myinfo->DPOWS[0].lastrecvmask;

2
iguana/tests/fundnotaries

@ -0,0 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dpow\",\"method\":\"fundnotaries\",\"symbol\":\"$1\"}"

2
includes/iguana_apideclares.h

@ -20,6 +20,8 @@ TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified);
ZERO_ARGS(dpow,cancelratify); ZERO_ARGS(dpow,cancelratify);
THREE_STRINGS(iguana,passthru,asset,function,hex); THREE_STRINGS(iguana,passthru,asset,function,hex);
STRING_ARG(dpow,bindaddr,ipaddr); STRING_ARG(dpow,bindaddr,ipaddr);
STRING_ARG(dpow,fundnotaries,symbol);
TWO_STRINGS(dex,send,hex,handler); TWO_STRINGS(dex,send,hex,handler);
HASH_AND_STRING(dex,gettransaction,txid,symbol); HASH_AND_STRING(dex,gettransaction,txid,symbol);
STRING_ARG(dex,getinfo,symbol); STRING_ARG(dex,getinfo,symbol);

Loading…
Cancel
Save