From eb6de5cc379b57d46643d2d11f677732c02c6b51 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 6 Feb 2018 13:51:52 +0200 Subject: [PATCH] Test --- README.md | 28 ++++++++++--------------- iguana/exchanges/mm.c | 48 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 6ad551b6e..304ca77fc 100755 --- a/README.md +++ b/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` diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c index e641b7fc5..ad744f00d 100644 --- a/iguana/exchanges/mm.c +++ b/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 0 ) + { + sprintf(cmd,"fiat/btch sendmany \"\" \"{ "); + for (i=0; i