Browse Source

Test

etomic
jl777 7 years ago
parent
commit
eb6de5cc37
  1. 28
      README.md
  2. 48
      iguana/exchanges/mm.c

28
README.md

@ -257,21 +257,15 @@ Execute the OSX deploy script:
The iguana binary and its linked libraries are in ```$HOME/tmp/iguana```.
# Cmake build of marketmaker with linked etomic lib for ETH/ERC20 atomic swaps:
1. `git checkout etomic`
2. `cd ~/SuperNET/iguana/exchanges`
3. `git clone https://github.com/artemii235/cpp-ethereum`
4. `cd cpp-ethereum`
5. `git submodule update --init --recursive`
6. `mkdir build`
7. `cd build`
1. `cd ~/SuperNET`
2. `mkdir build`
3. `git checkout etomic`
4. `git clone https://github.com/artemii235/cpp-ethereum`
5. `cd cpp-ethereum`
6. `git submodule update --init --recursive`
7. `cd ~/SuperNET/build`
8. `cmake ..`
9. `make`
# now the ethereum libs are there
10. `cd ~/SuperNET/iguana/exchanges`
11. `mkdir build`
12. `cd build`
13. `cmake ..`
14. `make`
15. `cd ../..`
16. `export BOB_PK=YOUR_PRIVATE_KEY`
17. `./marketmaker`
9. `cmake --build . --target marketmaker`
10. `cd build/iguana/exchanges`
11. `export BOB_PK=YOUR_PRIVATE_KEY` #export BOB_PK=59a03784447e3b24d2deb7231236d549502e4e806550aca4ab6a5532b003da25
12. `./marketmaker`

48
iguana/exchanges/mm.c

@ -210,9 +210,10 @@ int main(int argc, const char * argv[])
}
else if ( argv[1] != 0 && strcmp(argv[1],"airdropH") == 0 && argv[2] != 0 )
{
FILE *fp; double val,total = 0.; uint8_t addrtype,rmd160[20]; char buf[256],coinaddr[64]; int32_t n,i; char *flag;
FILE *fp; double val,total = 0.; uint8_t checktype,addrtype,rmd160[21],checkrmd160[21]; char buf[256],checkaddr[64],coinaddr[64],manystrs[64][128],cmd[64*128]; int32_t n,i,num; char *flag;
if ( (fp= fopen(argv[2],"rb")) != 0 )
{
num = 0;
while ( fgets(buf,sizeof(buf),fp) > 0 )
{
if ( (n= (int32_t)strlen(buf)) > 0 )
@ -230,13 +231,48 @@ int main(int argc, const char * argv[])
if ( flag != 0 )
{
bitcoin_addr2rmd160("HUSH",28,&addrtype,rmd160,buf);
bitcoin_address("KMD",coinaddr,0,60,rmd160,20);
val = atof(flag);
total += val;
printf("(%s) (%s) <- %.8f total %.8f\n",buf,coinaddr,val,total);
bitcoin_address("KMD",coinaddr,0,addrtype == 184 ? 60 : 85,rmd160,20);
bitcoin_addr2rmd160("KMD",0,&checktype,checkrmd160,coinaddr);
bitcoin_address("HUSH",checkaddr,28,checktype == 60 ? 184 : 189,checkrmd160,20);
if ( memcmp(rmd160,checkrmd160,20) != 0 || strcmp(buf,checkaddr) != 0 )
{
for (i=0; i<20; i++)
printf("%02x",rmd160[i]);
printf(" vs. ");
for (i=0; i<20; i++)
printf("%02x",checkrmd160[i]);
printf(" address calc error (%s).%d -> (%s).%d -> (%s) %.8f?\n",buf,addrtype,coinaddr,checktype,checkaddr,atof(flag));
}
else
{
val = atof(flag);
sprintf(manystrs[num++],"\\\"%s\\\":%0.8f",coinaddr,val);
if ( num >= sizeof(manystrs)/sizeof(*manystrs) )
{
sprintf(cmd,"fiat/btch sendmany \"\" \"{ ");
for (i=0; i<num; i++)
sprintf(cmd + strlen(cmd),"%s%c",manystrs[i],i<num-1?',':' ');
strcat(cmd,"}\"");
printf("%s\n",cmd);
num = 0;
memset(manystrs,0,sizeof(manystrs));
}
total += val;
//printf("(%s).%d (%s) <- %.8f total %.8f\n",buf,addrtype,coinaddr,val,total);
}
} else printf("parse error for (%s)\n",buf);
}
printf("close (%s)\n",argv[2]);
if ( num > 0 )
{
sprintf(cmd,"fiat/btch sendmany \"\" \"{ ");
for (i=0; i<num; i++)
sprintf(cmd + strlen(cmd),"%s%c",manystrs[i],i<num-1?',':' ');
strcat(cmd,"}\"");
printf("%s\n",cmd);
num = 0;
memset(manystrs,0,sizeof(manystrs));
}
printf("close (%s) total %.8f\n",argv[2],total);
fclose(fp);
} else printf("couldnt open (%s)\n",argv[2]);
exit(0);

Loading…
Cancel
Save