This commit is contained in:
jl777
2016-11-25 12:52:00 -03:00
parent 700606cc2b
commit 1db587b509
3 changed files with 39 additions and 34 deletions

View File

@@ -27,7 +27,7 @@ int32_t pax_fiatstatus(uint64_t *deposited,uint64_t *issued,uint64_t *withdrawn,
*withdrawn = sp->withdrawn; *withdrawn = sp->withdrawn;
*approved = sp->approved; *approved = sp->approved;
*redeemed = sp->redeemed; *redeemed = sp->redeemed;
printf("%p %s %.8f %.8f %.8f %.8f %.8f\n",sp,base,dstr(*deposited),dstr(*issued),dstr(*withdrawn),dstr(*approved),dstr(*redeemed)); //printf("%p %s %.8f %.8f %.8f %.8f %.8f\n",sp,base,dstr(*deposited),dstr(*issued),dstr(*withdrawn),dstr(*approved),dstr(*redeemed));
return(0); return(0);
} else printf("pax_fiatstatus cant get basesp.%s\n",base); } else printf("pax_fiatstatus cant get basesp.%s\n",base);
} else printf("pax_fiatstatus illegal base.%s\n",base); } else printf("pax_fiatstatus illegal base.%s\n",base);
@@ -105,39 +105,44 @@ void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t
pax->height = height; pax->height = height;
if ( otherheight != 0 ) if ( otherheight != 0 )
pax->otherheight = otherheight; pax->otherheight = otherheight;
if ( pax->didstats == 0 && fiatoshis == 0 )
{
if ( (pax->approved= approved) != 0 )
{
if ( (basesp= komodo_stateptrget(symbol)) != 0 )
{
basesp->approved += fiatoshis;
printf("########### %p approved %s += %.8f\n",basesp,symbol,dstr(fiatoshis));
}
}
else
{
if ( ASSETCHAINS_SYMBOL[0] == 0 )
{
if ( (basesp= komodo_stateptrget(source)) != 0 )
{
basesp->withdrawn += fiatoshis;
printf("########### %p withdrawn %s += %.8f\n",basesp,source,dstr(fiatoshis));
}
}
else
{
if ( (basesp= komodo_stateptrget(symbol)) != 0 )
{
basesp->deposited += fiatoshis;
printf("########### %p deposited %s += %.8f\n",basesp,symbol,dstr(fiatoshis));
}
}
}
pax->didstats = 1;
}
if ( pax->marked == 0 ) if ( pax->marked == 0 )
{ {
if ( addflag != 0 ) if ( addflag != 0 )
{ {
if ( (pax->approved= approved) != 0 ) if ( (pax->approved= approved) != 0 )
{
s = (char *)"APPROVED"; s = (char *)"APPROVED";
if ( (basesp= komodo_stateptrget(symbol)) != 0 ) else s = (char *)((ASSETCHAINS_SYMBOL[0] == 0) ? "WITHDRAW" : "DEPOSIT");
{
basesp->approved += fiatoshis;
printf("########### %p approved %s += %.8f\n",basesp,symbol,dstr(fiatoshis));
}
}
else
{
s = (char *)((ASSETCHAINS_SYMBOL[0] == 0) ? "WITHDRAW" : "DEPOSIT");
if ( ASSETCHAINS_SYMBOL[0] == 0 )
{
if ( (basesp= komodo_stateptrget(source)) != 0 )
{
basesp->withdrawn += fiatoshis;
printf("########### %p withdrawn %s += %.8f\n",basesp,source,dstr(fiatoshis));
}
}
else
{
if ( (basesp= komodo_stateptrget(symbol)) != 0 )
{
basesp->deposited += fiatoshis;
printf("########### %p deposited %s += %.8f\n",basesp,symbol,dstr(fiatoshis));
}
}
}
printf("[%s] addflag.%d ADD %s/%s %s %.8f -> %s TO PAX ht.%d otherht.%d total %.8f\n",ASSETCHAINS_SYMBOL,addflag,s,symbol,source,dstr(ASSETCHAINS_SYMBOL[0]==0?pax->komodoshis:pax->fiatoshis),pax->coinaddr,pax->height,pax->otherheight,dstr(komodo_paxtotal())); printf("[%s] addflag.%d ADD %s/%s %s %.8f -> %s TO PAX ht.%d otherht.%d total %.8f\n",ASSETCHAINS_SYMBOL,addflag,s,symbol,source,dstr(ASSETCHAINS_SYMBOL[0]==0?pax->komodoshis:pax->fiatoshis),pax->coinaddr,pax->height,pax->otherheight,dstr(komodo_paxtotal()));
} }
} }

View File

@@ -57,7 +57,7 @@ struct pax_transaction
UT_hash_handle hh; UT_hash_handle hh;
uint256 txid; uint256 txid;
uint64_t komodoshis,fiatoshis,validated; uint64_t komodoshis,fiatoshis,validated;
int32_t marked,height,otherheight,approved; int32_t marked,height,otherheight,approved,didstats;
uint16_t vout; uint16_t vout;
char symbol[16],source[16],coinaddr[64]; uint8_t rmd160[20],shortflag; char symbol[16],source[16],coinaddr[64]; uint8_t rmd160[20],shortflag;
}; };

View File

@@ -500,11 +500,11 @@ Value paxpending(const Array& params, bool fHelp)
{ {
if ( deposited != 0 || issued != 0 || withdrawn != 0 || approved != 0 || redeemed != 0 ) if ( deposited != 0 || issued != 0 || withdrawn != 0 || approved != 0 || redeemed != 0 )
{ {
item.push_back(Pair("deposited", deposited)); item.push_back(Pair("deposited", ValueFromAmount(deposited)));
item.push_back(Pair("issued", issued)); item.push_back(Pair("issued", ValueFromAmount(issued)));
item.push_back(Pair("withdrawn", withdrawn)); item.push_back(Pair("withdrawn", ValueFromAmount(withdrawn)));
item.push_back(Pair("approved", approved)); item.push_back(Pair("approved", ValueFromAmount(approved)));
item.push_back(Pair("redeemed", redeemed)); item.push_back(Pair("redeemed", ValueFromAmount(redeemed)));
obj.push_back(Pair(CURRENCIES[baseid],item)); obj.push_back(Pair(CURRENCIES[baseid],item));
a.push_back(obj); a.push_back(obj);
} }