|
@ -45,15 +45,21 @@ uint32_t basilisk_quoteid(struct basilisk_request *rp) |
|
|
int32_t basilisk_rwDEXquote(int32_t rwflag,uint8_t *serialized,struct basilisk_request *rp) |
|
|
int32_t basilisk_rwDEXquote(int32_t rwflag,uint8_t *serialized,struct basilisk_request *rp) |
|
|
{ |
|
|
{ |
|
|
int32_t len = 0; |
|
|
int32_t len = 0; |
|
|
if ( rwflag != 0 ) |
|
|
|
|
|
memset(serialized,0,sizeof(*rp)); |
|
|
|
|
|
len += iguana_rwnum(rwflag,&serialized[len],sizeof(rp->requestid),&rp->requestid); |
|
|
len += iguana_rwnum(rwflag,&serialized[len],sizeof(rp->requestid),&rp->requestid); |
|
|
len += iguana_rwnum(rwflag,&serialized[len],sizeof(rp->timestamp),&rp->timestamp); // must be 2nd
|
|
|
len += iguana_rwnum(rwflag,&serialized[len],sizeof(rp->timestamp),&rp->timestamp); // must be 2nd
|
|
|
len += iguana_rwnum(rwflag,&serialized[len],sizeof(rp->quoteid),&rp->quoteid); |
|
|
len += iguana_rwnum(rwflag,&serialized[len],sizeof(rp->quoteid),&rp->quoteid); |
|
|
len += iguana_rwnum(rwflag,&serialized[len],sizeof(rp->srcamount),&rp->srcamount); |
|
|
len += iguana_rwnum(rwflag,&serialized[len],sizeof(rp->srcamount),&rp->srcamount); |
|
|
len += iguana_rwbignum(rwflag,&serialized[len],sizeof(rp->hash),rp->hash.bytes); |
|
|
len += iguana_rwbignum(rwflag,&serialized[len],sizeof(rp->hash),rp->hash.bytes); |
|
|
len += iguana_rwvarstr(rwflag,&serialized[len],sizeof(rp->src)-1,rp->src); |
|
|
if ( rwflag != 0 ) |
|
|
len += iguana_rwvarstr(rwflag,&serialized[len],sizeof(rp->dest)-1,rp->dest); |
|
|
{ |
|
|
|
|
|
memcpy(&serialized[len],rp->src,sizeof(rp->src)), len += sizeof(rp->src); |
|
|
|
|
|
memcpy(&serialized[len],rp->dest,sizeof(rp->dest)), len += sizeof(rp->dest); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
memcpy(rp->src,&serialized[len],sizeof(rp->src)), len += sizeof(rp->src); |
|
|
|
|
|
memcpy(rp->dest,&serialized[len],sizeof(rp->dest)), len += sizeof(rp->dest); |
|
|
|
|
|
} |
|
|
len += iguana_rwbignum(rwflag,&serialized[len],sizeof(rp->desthash),rp->desthash.bytes); |
|
|
len += iguana_rwbignum(rwflag,&serialized[len],sizeof(rp->desthash),rp->desthash.bytes); |
|
|
len += iguana_rwnum(rwflag,&serialized[len],sizeof(rp->destamount),&rp->destamount); |
|
|
len += iguana_rwnum(rwflag,&serialized[len],sizeof(rp->destamount),&rp->destamount); |
|
|
len += iguana_rwvarstr(rwflag,&serialized[len],sizeof(rp->message)-1,rp->message); |
|
|
len += iguana_rwvarstr(rwflag,&serialized[len],sizeof(rp->message)-1,rp->message); |
|
|