Browse Source

Test

etomic
jl777 8 years ago
parent
commit
4137dcd634
  1. 18
      basilisk/smartaddress.c
  2. 2
      iguana/tests/smartadd

18
basilisk/smartaddress.c

@ -81,13 +81,17 @@ cJSON *smartaddress_json(struct smartaddress *ap)
void smartaddress_symboladd(struct smartaddress *ap,char *symbol,double maxbid,double minask)
{
struct smartaddress_symbol *sp;
ap->symbols = realloc(ap->symbols,(ap->numsymbols+1) * sizeof(*ap->symbols));
sp = &ap->symbols[ap->numsymbols++];
memset(sp,0,sizeof(*sp));
safecopy(sp->symbol,symbol,sizeof(sp->symbol));
sp->maxbid = maxbid;
sp->minask = minask;
char tmp[64]; struct smartaddress_symbol *sp;
strcpy(tmp,ap->typestr), touppercase(tmp);
if ( strcmp(tmp,symbol) != 0 )
{
ap->symbols = realloc(ap->symbols,(ap->numsymbols+1) * sizeof(*ap->symbols));
sp = &ap->symbols[ap->numsymbols++];
memset(sp,0,sizeof(*sp));
safecopy(sp->symbol,symbol,sizeof(sp->symbol));
sp->maxbid = maxbid;
sp->minask = minask;
}
}
int32_t _smartaddress_add(struct supernet_info *myinfo,bits256 privkey,char *symbol,double maxbid,double minask)

2
iguana/tests/smartadd

@ -1,3 +1,3 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"smartaddress\",\"type\":\"usd\",\"symbol\":\"USD\"}" # first time
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"smartaddress\",\"type\":\"usd\",\"symbol\":\"LTC\",\"maxbid\":10,\"minask\":10}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"smartaddress\",\"type\":\"usd\",\"symbol\":\"REVS\",\"maxbid\":0.20,\"minask\":0.10}"

Loading…
Cancel
Save