Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
INSERT INTO pair_config
VALUES ('btc_usdt', 'btc', 'usdt', 0.000001, 0.01, 55000),
('eth_usdt', 'eth', 'usdt', 0.00001, 0.01, 3800),
('btc_irt', 'btc', 'irt', 0.000001, 0.01, 55000),
('eth_irt', 'eth', 'irt', 0.00001, 0.01, 3800),
('bsc_irt', 'bsc', 'irt', 0.00001, 0.01, 3800),
('bsc_usdt', 'bsc', 'usdt', 0.00001, 0.01, 3800),
('busd_irt', 'busd', 'irt', 0.00001, 0.01, 3800),
('nln_usdt', 'nln', 'usdt', 1.0, 0.01, 0.01),
('nln_btc', 'nln', 'btc', 1.0, 0.000001, 1 / 5500000),
('nln_eth', 'nln', 'eth', 1.0, 0.000001, 1 / 550000)
Expand All @@ -25,21 +30,31 @@ VALUES (1, 'btc_usdt', 'ASK', '*', 0.01, 0.01),
(7, 'eth_usdt', 'ASK', '*', 0.01, 0.01),
(8, 'eth_usdt', 'BID', '*', 0.01, 0.01),
(9, 'nln_eth', 'ASK', '*', 0.01, 0.01),
(10, 'nln_eth', 'BID', '*', 0.01, 0.01)
(10, 'nln_eth', 'BID', '*', 0.01, 0.01),
(11, 'btc_irt', 'ASK', '*', 0.01, 0.01),
(12, 'btc_irt', 'BID', '*', 0.01, 0.01),
(13, 'eth_irt', 'ASK', '*', 0.01, 0.01),
(14, 'eth_irt', 'BID', '*', 0.01, 0.01),
(15, 'bsc_irt', 'ASK', '*', 0.01, 0.01),
(16, 'bsc_irt', 'BID', '*', 0.01, 0.01),
(17, 'bsc_usdt', 'ASK', '*', 0.01, 0.01),
(18, 'bsc_usdt', 'BID', '*', 0.01, 0.01),
(19, 'busd_irt', 'ASK', '*', 0.01, 0.01),
(20, 'busd_irt', 'BID', '*', 0.01, 0.01)
ON CONFLICT DO NOTHING;

-- Test pair configs
INSERT INTO pair_fee_config
VALUES (11, 'tbtc_tusdt', 'ASK', '*', 0.01, 0.01),
(12, 'tbtc_tusdt', 'BID', '*', 0.01, 0.01),
(13, 'nln_tusdt', 'ASK', '*', 0.01, 0.01),
(14, 'nln_tusdt', 'BID', '*', 0.01, 0.01),
(15, 'nln_tbtc', 'ASK', '*', 0.01, 0.01),
(16, 'nln_tbtc', 'BID', '*', 0.01, 0.01),
(17, 'teth_tusdt', 'ASK', '*', 0.01, 0.01),
(18, 'teth_tusdt', 'BID', '*', 0.01, 0.01),
(19, 'nln_teth', 'ASK', '*', 0.01, 0.01),
(20, 'nln_teth', 'BID', '*', 0.01, 0.01)
VALUES (21, 'tbtc_tusdt', 'ASK', '*', 0.01, 0.01),
(22, 'tbtc_tusdt', 'BID', '*', 0.01, 0.01),
(23, 'nln_tusdt', 'ASK', '*', 0.01, 0.01),
(24, 'nln_tusdt', 'BID', '*', 0.01, 0.01),
(25, 'nln_tbtc', 'ASK', '*', 0.01, 0.01),
(26, 'nln_tbtc', 'BID', '*', 0.01, 0.01),
(27, 'teth_tusdt', 'ASK', '*', 0.01, 0.01),
(28, 'teth_tusdt', 'BID', '*', 0.01, 0.01),
(29, 'nln_teth', 'ASK', '*', 0.01, 0.01),
(30, 'nln_teth', 'BID', '*', 0.01, 0.01)
ON CONFLICT DO NOTHING;

SELECT setval(pg_get_serial_sequence('pair_fee_config', 'id'), (SELECT MAX(id) FROM pair_fee_config));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
INSERT INTO symbol_maps(symbol, value)
VALUES ('btc_usdt', 'BTCUSDT'),
('eth_usdt', 'ETHUSDT'),
('bsc_usdt', 'BSCUSDT'),
('eth_btc', 'ETHBTC'),
('nln_usdt', 'NLNUSDT'),
('nln_btc', 'NLNBTC')
('nln_btc', 'NLNBTC'),
('btc_irt', 'BTCIRT'),
('eth_irt', 'ETHIRT'),
('bsc_irt', 'BSCIRT'),
('busd_irt', 'BUSDIRT')
ON CONFLICT DO NOTHING;

-- Test symbol mapper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
INSERT INTO currency
VALUES ('BTC', 'Bitcoin'),
('ETH', 'Ethereum'),
('USDT', 'Tether')
('USDT', 'Tether'),
('IRT', 'Toman'),
('BSC', 'Binance Smart Chain'),
('BUSD', 'Binance USD')
ON CONFLICT DO NOTHING;

-- Test currency
Expand All @@ -20,8 +23,7 @@ ON CONFLICT DO NOTHING;
-- Test chains
INSERT INTO chains
VALUES ('test-bitcoin'),
('test-ethereum'),
('test-bsc')
('test-ethereum')
ON CONFLICT DO NOTHING;

INSERT INTO address_types(id, address_type, address_regex)
Expand All @@ -41,8 +43,7 @@ ON CONFLICT DO NOTHING;
-- Test chain address types
INSERT INTO chain_address_types(chain_name, addr_type_id)
VALUES ('test-bitcoin', 3),
('test-ethereum', 2),
('test-bsc', 2)
('test-ethereum', 2)
ON CONFLICT DO NOTHING;

INSERT INTO currency_implementations(id,
Expand All @@ -57,7 +58,9 @@ INSERT INTO currency_implementations(id,
decimal)
VALUES (1, 'BTC', 'bitcoin', false, null, null, true, 0.0001, 0.0001, 0),
(2, 'ETH', 'ethereum', false, null, null, true, 0.00001, 0.000001, 18),
(3, 'USDT', 'ethereum', true, '0xdac17f958d2ee523a2206206994597c13d831ec7', 'USDT', true, 0.01, 0.01, 6)
(3, 'USDT', 'ethereum', true, '0xdac17f958d2ee523a2206206994597c13d831ec7', 'USDT', true, 0.01, 0.01, 6),
(4, 'BSC', 'bsc', false, null, null, true, 0.0001, 0.0001, 0),
(5, 'BUSD', 'bsc', true, '0xe9e7cea3dedca5984780bafc599bd69add087d56', 'BUSD', true, 0.01, 0.01, 6)
ON CONFLICT DO NOTHING;

-- Test currency implementation
Expand All @@ -71,9 +74,9 @@ INSERT INTO currency_implementations(id,
withdraw_fee,
withdraw_min,
decimal)
VALUES (4, 'TBTC', 'test-bitcoin', false, null, null, true, 0.0001, 0.0001, 0),
(5, 'TETH', 'test-ethereum', false, null, null, true, 0.00001, 0.000001, 18),
(6, 'TUSDT', 'test-ethereum', true, '0x110a13fc3efe6a245b50102d2d79b3e76125ae83', 'TUSDT', true, 0.01, 0.01, 6)
VALUES (6, 'TBTC', 'test-bitcoin', false, null, null, true, 0.0001, 0.0001, 0),
(7, 'TETH', 'test-ethereum', false, null, null, true, 0.00001, 0.000001, 18),
(8, 'TUSDT', 'test-ethereum', true, '0x110a13fc3efe6a245b50102d2d79b3e76125ae83', 'TUSDT', true, 0.01, 0.01, 6)
ON CONFLICT DO NOTHING;

SELECT setval(pg_get_serial_sequence('currency_implementations', 'id'), (SELECT MAX(id) FROM currency_implementations));
Expand All @@ -87,8 +90,7 @@ ON CONFLICT DO NOTHING;
-- Test chain endpoints
INSERT INTO chain_endpoints(id, chain_name, endpoint_url)
VALUES (4, 'test-bitcoin', 'lb://chain-scan-gateway/test-bitcoin/transfers'),
(5, 'test-ethereum', 'lb://chain-scan-gateway/test-eth/transfers'),
(6, 'test-bsc', 'lb://chain-scan-gateway/test-bsc/transfers')
(5, 'test-ethereum', 'lb://chain-scan-gateway/test-eth/transfers')
ON CONFLICT DO NOTHING;

SELECT setval(pg_get_serial_sequence('chain_endpoints', 'id'), (SELECT MAX(id) FROM chain_endpoints));
Expand All @@ -102,8 +104,7 @@ ON CONFLICT DO NOTHING;
-- Test chain scan schedules
INSERT INTO chain_sync_schedules
VALUES ('test-bitcoin', CURRENT_DATE, 600, 60),
('test-ethereum', CURRENT_DATE, 90, 60),
('test-bsc', CURRENT_DATE, 90, 60)
('test-ethereum', CURRENT_DATE, 90, 60)
ON CONFLICT DO NOTHING;

INSERT INTO wallet_sync_schedules
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ services:
- kafka-3
vault:
image: ghcr.io/opexdev/vault-opex
build: docker-images/vault
volumes:
- vault-data:/vault/file
environment:
Expand Down Expand Up @@ -143,6 +144,7 @@ services:
condition: on-failure
postgres-accountant:
image: ghcr.io/opexdev/postgres-opex
build: docker-images/postgres
environment:
- POSTGRES_USER=${DB_USER:-opex}
- POSTGRES_PASSWORD=${DB_PASS:-hiopex}
Expand All @@ -155,6 +157,7 @@ services:
- default
postgres-eventlog:
image: ghcr.io/opexdev/postgres-opex
build: docker-images/postgres
environment:
- POSTGRES_USER=${DB_USER:-opex}
- POSTGRES_PASSWORD=${DB_PASS:-hiopex}
Expand All @@ -167,6 +170,7 @@ services:
- default
postgres-auth:
image: ghcr.io/opexdev/postgres-opex
build: docker-images/postgres
environment:
- POSTGRES_USER=${DB_USER:-opex}
- POSTGRES_PASSWORD=${DB_PASS:-hiopex}
Expand All @@ -182,6 +186,7 @@ services:
condition: on-failure
postgres-wallet:
image: ghcr.io/opexdev/postgres-opex
build: docker-images/postgres
environment:
- POSTGRES_USER=${DB_USER:-opex}
- POSTGRES_PASSWORD=${DB_PASS:-hiopex}
Expand All @@ -197,6 +202,7 @@ services:
condition: on-failure
postgres-api:
image: ghcr.io/opexdev/postgres-opex
build: docker-images/postgres
environment:
- POSTGRES_USER=${DB_USER:-opex}
- POSTGRES_PASSWORD=${DB_PASS:-hiopex}
Expand All @@ -212,6 +218,7 @@ services:
condition: on-failure
postgres-bc-gateway:
image: ghcr.io/opexdev/postgres-opex
build: docker-images/postgres
environment:
- POSTGRES_USER=${DB_USER:-opex}
- POSTGRES_PASSWORD=${DB_PASS:-hiopex}
Expand All @@ -227,6 +234,7 @@ services:
condition: on-failure
postgres-referral:
image: ghcr.io/opexdev/postgres-opex
build: docker-images/postgres
environment:
- POSTGRES_USER=${DB_USER:-opex}
- POSTGRES_PASSWORD=${DB_PASS:-hiopex}
Expand All @@ -240,6 +248,7 @@ services:
condition: on-failure
accountant:
image: ghcr.io/opexdev/accountant
build: accountant/accountant-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- SPRING_PROFILES_ACTIVE=scheduled
Expand All @@ -261,6 +270,7 @@ services:
- postgres-accountant
eventlog:
image: ghcr.io/opexdev/eventlog
build: eventlog/eventlog-app
environment:
- JAVA_OPTS=-Xmx256m
- KAFKA_IP_PORT=kafka-1:29092,kafka-2:29092,kafka-3:29092
Expand All @@ -279,6 +289,7 @@ services:
- postgres-eventlog
matching-engine:
image: ghcr.io/opexdev/matching-engine
build: matching-engine/matching-engine-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- KAFKA_IP_PORT=kafka-1:29092,kafka-2:29092,kafka-3:29092
Expand All @@ -292,6 +303,7 @@ services:
- redis
matching-gateway:
image: ghcr.io/opexdev/matching-gateway
build: bc-gateway/bc-gateway-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- KAFKA_IP_PORT=kafka-1:29092,kafka-2:29092,kafka-3:29092
Expand All @@ -307,6 +319,7 @@ services:
- matching-engine
auth:
image: ghcr.io/opexdev/auth
build: user-management/keycloak-gateway
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- KAFKA_IP_PORT=kafka-1:29092,kafka-2:29092,kafka-3:29092
Expand Down Expand Up @@ -334,6 +347,7 @@ services:
condition: on-failure
wallet:
image: ghcr.io/opexdev/wallet
build: wallet/wallet-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- KAFKA_IP_PORT=kafka-1:29092,kafka-2:29092,kafka-3:29092
Expand All @@ -357,6 +371,7 @@ services:
condition: on-failure
api:
image: ghcr.io/opexdev/api
build: api/api-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- KAFKA_IP_PORT=kafka-1:29092,kafka-2:29092,kafka-3:29092
Expand Down Expand Up @@ -385,6 +400,7 @@ services:
condition: on-failure
websocket:
image: ghcr.io/opexdev/websocket
build: websocket/websocket-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- KAFKA_IP_PORT=kafka-1:29092,kafka-2:29092,kafka-3:29092
Expand All @@ -407,6 +423,7 @@ services:
condition: on-failure
bc-gateway:
image: ghcr.io/opexdev/bc-gateway
build: bc-gateway/bc-gateway-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- SPRING_PROFILES_DEFAULT=scheduled
Expand All @@ -432,6 +449,7 @@ services:
condition: on-failure
storage:
image: ghcr.io/opexdev/storage
build: storage/storage-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- CONSUL_HOST=consul
Expand All @@ -449,6 +467,7 @@ services:
condition: on-failure
referral:
image: ghcr.io/opexdev/referral
build: referral/referral-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044
- CONSUL_HOST=consul
Expand All @@ -471,6 +490,7 @@ services:
condition: on-failure
captcha:
image: ghcr.io/opexdev/captcha
build: captcha/captcha-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044
- CONSUL_HOST=consul
Expand All @@ -482,6 +502,7 @@ services:
condition: on-failure
admin:
image: ghcr.io/opexdev/admin
build: admin/admin-app
environment:
- JAVA_OPTS=-Xmx256m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
- KAFKA_IP_PORT=kafka-1:29092,kafka-2:29092,kafka-3:29092
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ spring:
host: ${REDIS_HOST:localhost}
port: 6379
app:
symbols: btc_usdt,eth_usdt,eth_btc,tbtc_tusdt,teth_tusdt,teth_tbtc
symbols: btc_usdt,eth_usdt,eth_btc,tbtc_tusdt,teth_tusdt,teth_tbtc,btc_irt,eth_irt,bsc_irt,bsc_usdt,busd_irt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ INSERT INTO currency(name, symbol, precision)
VALUES ('btc', 'btc', 0.000001),
('eth', 'eth', 0.00001),
('usdt', 'usdt', 0.01),
('bsc', 'bsc', 0.01),
('busd', 'busd', 0.01),
('nln', 'nln', 1),
('IRT', 'IRT', 1)
('irt', 'irt', 1)
ON CONFLICT DO NOTHING;

-- Test currency
Expand All @@ -23,15 +25,20 @@ INSERT INTO currency_rate(id, source_currency, dest_currency, rate)
VALUES (1, 'btc', 'nln', 5500000),
(2, 'usdt', 'nln', 100),
(3, 'btc', 'usdt', 55000),
(4, 'eth', 'usdt', 3800)
(4, 'eth', 'usdt', 3800),
(5, 'btc', 'irt', 3800),
(6, 'eth', 'irt', 3800),
(7, 'bsc', 'irt', 3800),
(8, 'bsc', 'usdt', 3800),
(9, 'busd', 'usdt', 3800)
ON CONFLICT DO NOTHING;

-- Test currency rate
INSERT INTO currency_rate(id, source_currency, dest_currency, rate)
VALUES (5, 'tbtc', 'nln', 5500000),
(6, 'tusdt', 'nln', 100),
(7, 'tbtc', 'tusdt', 55000),
(8, 'teth', 'tusdt', 3800)
VALUES (10, 'tbtc', 'nln', 5500000),
(11, 'tusdt', 'nln', 100),
(12, 'tbtc', 'tusdt', 55000),
(13, 'teth', 'tusdt', 3800)
ON CONFLICT DO NOTHING;

SELECT setval(pg_get_serial_sequence('currency_rate', 'id'), (SELECT MAX(id) FROM currency_rate));
Expand All @@ -45,18 +52,22 @@ VALUES (1, 1, 'main', 'btc', 10),
(6, 1, 'exchange', 'nln', 0),
(7, 1, 'main', 'eth', 10000),
(8, 1, 'exchange', 'eth', 0),
(9, 1, 'main', 'IRT', 100000000),
(10, 1, 'exchange', 'IRT', 0)
(9, 1, 'main', 'irt', 100000000),
(10, 1, 'exchange', 'irt', 0),
(11, 1, 'main', 'bsc', 100000000),
(12, 1, 'exchange', 'bsc', 0),
(13, 1, 'main', 'busd', 100000000),
(14, 1, 'exchange', 'busd', 0)
ON CONFLICT DO NOTHING;

-- Test wallet
INSERT INTO wallet(id, owner, wallet_type, currency, balance)
VALUES (11, 1, 'main', 'tbtc', 10),
(12, 1, 'exchange', 'tbtc', 0),
(13, 1, 'main', 'tusdt', 550000),
(14, 1, 'exchange', 'tusdt', 0),
(17, 1, 'main', 'teth', 10000),
(18, 1, 'exchange', 'teth', 0)
VALUES (15, 1, 'main', 'tbtc', 10),
(16, 1, 'exchange', 'tbtc', 0),
(17, 1, 'main', 'tusdt', 550000),
(18, 1, 'exchange', 'tusdt', 0),
(19, 1, 'main', 'teth', 10000),
(20, 1, 'exchange', 'teth', 0)
ON CONFLICT DO NOTHING;

SELECT setval(pg_get_serial_sequence('wallet', 'id'), (SELECT MAX(id) FROM wallet));
Expand Down