Skip to content

Commit

Permalink
Add scripts to perform swaps via docker-compose for Jenkins.
Browse files Browse the repository at this point in the history
  • Loading branch information
artemii235 committed Apr 13, 2018
1 parent 7d01a4d commit 13a4518
Show file tree
Hide file tree
Showing 22 changed files with 112 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
.vscode
cmake-build-debug
7 changes: 7 additions & 0 deletions Dockerfile.clientnode
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:17.10
USER root
RUN apt-get update && apt-get install -y rinetd curl libcurl3-gnutls
RUN echo "0.0.0.0 10271 10.100.0.1 10271" >> /etc/rinetd.conf
RUN echo "0.0.0.0 8923 10.100.0.1 8923" >> /etc/rinetd.conf
WORKDIR /usr/mm/etomic_build/client
CMD /usr/sbin/rinetd && rm -rf DB && ./client
7 changes: 7 additions & 0 deletions Dockerfile.seednode
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:17.10
USER root
RUN apt-get update && apt-get install -y rinetd curl libcurl3-gnutls
RUN echo "0.0.0.0 10271 10.100.0.1 10271" >> /etc/rinetd.conf
RUN echo "0.0.0.0 8923 10.100.0.1 8923" >> /etc/rinetd.conf
WORKDIR /usr/mm/etomic_build/seed
CMD /usr/sbin/rinetd && rm -rf DB && ./run
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: '2'
services:
seednode:
build:
context: ./
dockerfile: Dockerfile.seednode
volumes:
- ~/.zcash-params:/root/.zcash-params
- ~/.komodo:/root/.komodo
- .:/usr/mm
tty: true
networks:
default:
ipv4_address: 10.100.0.2

clientnode:
build:
context: ./
dockerfile: Dockerfile.clientnode
volumes:
- ~/.zcash-params:/root/.zcash-params
- ~/.komodo:/root/.komodo
- .:/usr/mm
links:
- seednode
tty: true
networks:
default:
ipv4_address: 10.100.0.3

networks:
default:
driver: bridge
ipam:
config:
- subnet: 10.100.0.0/16
gateway: 10.100.0.1
5 changes: 0 additions & 5 deletions etomic_build/client

This file was deleted.

4 changes: 4 additions & 0 deletions etomic_build/client1/buy_BEER_ETH
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"setprice\",\"base\":\"ETH\",\"rel\":\"BEER\",\"price\":1}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"sell\",\"base\":\"ETH\",\"rel\":\"BEER\",\"basevolume\":0.1,\"price\":1}"
4 changes: 4 additions & 0 deletions etomic_build/client1/client
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
source passphrase
source ../coins
../../build/iguana/exchanges/marketmaker-testnet "{\"netid\":9999,\"seednode\":\"10.100.0.2\",\"gui\":\"nogui\",\"client\":1, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}"
6 changes: 6 additions & 0 deletions etomic_build/client1/enable
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETH\"}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"KMD\"}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETOMIC\"}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"BEER\"}"
1 change: 1 addition & 0 deletions etomic_build/client1/passphrase
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export passphrase="$PASSPHRASE"
4 changes: 4 additions & 0 deletions etomic_build/client1/setpassphrase
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
source userpass
source passphrase
curl --url "http://127.0.0.1:7783" --data "{\"netid\":9999,\"seednode\":\"10.100.0.2\",\"userpass\":\"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f\",\"method\":\"passphrase\",\"passphrase\":\"$passphrase\",\"gui\":\"nogui\"}"
2 changes: 2 additions & 0 deletions etomic_build/client1/userpass
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#export userpass="<put the userpass value from the first API call here>"
export userpass="$USERPASS"
1 change: 0 additions & 1 deletion etomic_build/passphrase

This file was deleted.

5 changes: 0 additions & 5 deletions etomic_build/run

This file was deleted.

6 changes: 6 additions & 0 deletions etomic_build/seed/enable
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETH\"}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"KMD\"}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ETOMIC\"}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"BEER\"}"
1 change: 1 addition & 0 deletions etomic_build/seed/myipaddr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.100.0.2
1 change: 1 addition & 0 deletions etomic_build/seed/passphrase
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export passphrase="$PASSPHRASE"
4 changes: 4 additions & 0 deletions etomic_build/seed/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
source passphrase
source ../coins
../../build/iguana/exchanges/marketmaker-testnet "{\"netid\":9999,\"gui\":\"nogui\", \"profitmargin\":0.01, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}"
4 changes: 4 additions & 0 deletions etomic_build/seed/sell_BEER_ETH
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"setprice\",\"base\":\"BEER\",\"rel\":\"ETH\",\"price\":0.9}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"sell\",\"base\":\"BEER\",\"rel\":\"ETH\",\"basevolume\":0.1,\"price\":0.9}"
4 changes: 4 additions & 0 deletions etomic_build/seed/setpassphrase
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
source userpass
source passphrase
curl --url "http://127.0.0.1:7783" --data "{\"netid\":9999,\"seednode\":\"5.9.253.204\",\"userpass\":\"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f\",\"method\":\"passphrase\",\"passphrase\":\"$passphrase\",\"gui\":\"nogui\"}"
2 changes: 2 additions & 0 deletions etomic_build/seed/userpass
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#export userpass="<put the userpass value from the first API call here>"
export userpass="$USERPASS"
6 changes: 3 additions & 3 deletions iguana/exchanges/LP_nativeDEX.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,10 +1381,10 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
myipaddr = clonestr("127.0.0.1");
#ifndef _WIN32
#ifndef FROM_JS
if ( system("curl -s4 checkip.amazonaws.com > myipaddr") == 0 )
char ipfname[64];
strcpy(ipfname,"myipaddr");
if ( access( ipfname, F_OK ) != -1 || system("curl -s4 checkip.amazonaws.com > myipaddr") == 0 )
{
char ipfname[64];
strcpy(ipfname,"myipaddr");
if ( (myipaddr= OS_filestr(&filesize,ipfname)) != 0 && myipaddr[0] != 0 )
{
n = strlen(myipaddr);
Expand Down
12 changes: 12 additions & 0 deletions start_BEER_ETH_trade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
docker-compose exec clientnode ./setpassphrase
sleep 1
docker-compose exec clientnode ./enable
sleep 1
docker-compose exec seednode ./setpassphrase
sleep 1
docker-compose exec seednode ./enable
sleep 1
docker-compose exec seednode ./sell_BEER_ETH
sleep 3
docker-compose exec clientnode ./buy_BEER_ETH

0 comments on commit 13a4518

Please sign in to comment.