Skip to content

Commit

Permalink
Feature/usdt (#225)
Browse files Browse the repository at this point in the history
* dd usdt

* code clean

* USDT in supported tokens

* switch bot to USDT

* switch price orachle to usdt

* switch e2e test to USDT

* trying to fix e2e

* Fix docker compose watch

---------

Co-authored-by: Luke Rogerson <[email protected]>
  • Loading branch information
uv-orbs and Luke-Rogerson authored Jun 18, 2024
1 parent 63dcd61 commit 86a5b73
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- name: Wait for services to be ready
run: |
sleep 10
sleep 30
- name: Set up Market Maker User
run: |
Expand Down
2 changes: 0 additions & 2 deletions cmd/order-book/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ func setup() {
panic(fmt.Errorf("failed to parse redis URL: %v", err))
}

//log.Printf("Redis address: %s", opt.Addr)
fmt.Println("Redis address:\t", opt.Addr)

port, found := os.LookupEnv("PORT")
if !found {
port = "8080"
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ services:
develop:
watch:
- action: rebuild
path: .
files:
- ./**/*.go
- ./go.mod
Expand Down Expand Up @@ -49,6 +50,7 @@ services:
develop:
watch:
- action: rebuild
path: .
files:
- ./**/*.go
- ./go.mod
Expand Down
6 changes: 3 additions & 3 deletions e2e/maker/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"PRIVATE_KEY", "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
)
TICKER_URL = os.environ.get(
"TICKER_URL", "https://www.binance.com/api/v3/ticker/price?symbol=MATICUSDC"
"TICKER_URL", "https://www.binance.com/api/v3/ticker/price?symbol=MATICUSDT"
)
TICKER_SYMBOL = os.environ.get("TICKER_SYMBOL", "MATIC-USDC")
TICKER_SYMBOL = os.environ.get("TICKER_SYMBOL", "MATIC-USDT")
DEPTH_SIZE = os.environ.get("DEPTH_SIZE", "5")
SLEEP_TIME = os.environ.get("SLEEP_TIME", "10")
ORDER_SIZE_SCALE = os.environ.get("ORDER_SIZE_SCALE", "10")
Expand Down Expand Up @@ -132,7 +132,7 @@ def on_tick(self, url):

ticker_data = response.json()
ticker = Ticker(ticker_data["price"], ticker_data["symbol"])
print(f"ETH-USD Price: {ticker.price}")

return ticker

def _round(self, value):
Expand Down
18 changes: 10 additions & 8 deletions e2e/tests/maker_endpoints_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
A local Orderbook instance is required to run the tests.
"""

PAIR = "MATIC-USDT"

import pytest
from orbs_orderbook import (
CreateMultipleOrdersInput,
Expand All @@ -21,7 +23,7 @@ def test_create_order_success(ob_client, ob_signer):
order_input = CreateOrderInput(
price="0.86500000",
size="40",
symbol="MATIC-USDC",
symbol=PAIR,
side="sell",
client_order_id=CLIENT_OID,
)
Expand All @@ -43,7 +45,7 @@ def test_create_order_fails_with_same_clientoid(
order_input = CreateOrderInput(
price="0.86500000",
size="40",
symbol="MATIC-USDC",
symbol=PAIR,
side="sell",
client_order_id=CLIENT_OID,
)
Expand Down Expand Up @@ -157,7 +159,7 @@ def test_create_multiple_orders_successfully(ob_client, ob_signer):
order_one = CreateOrderInput(
price="0.86500000",
size="40",
symbol="MATIC-USDC",
symbol=PAIR,
side="buy",
client_order_id="550e8400-e29b-41d4-a716-446655440000",
)
Expand All @@ -166,14 +168,14 @@ def test_create_multiple_orders_successfully(ob_client, ob_signer):
order_two = CreateOrderInput(
price="0.87",
size="40",
symbol="MATIC-USDC",
symbol=PAIR,
side="sell",
client_order_id="650e8400-e29b-41d4-a716-446655440001",
)
order_two_sig, order_two_msg = ob_signer.prepare_and_sign_order(order_two)

create_orders_input = CreateMultipleOrdersInput(
symbol="MATIC-USDC",
symbol=PAIR,
orders=[
OrderWithSignature(
order=order_one,
Expand Down Expand Up @@ -205,7 +207,7 @@ def test_create_multiple_orders_rejects_order_with_same_client_oid(
order_one = CreateOrderInput(
price="0.86500000",
size="40",
symbol="MATIC-USDC",
symbol=PAIR,
side="buy",
client_order_id=same_client_oid,
)
Expand All @@ -214,14 +216,14 @@ def test_create_multiple_orders_rejects_order_with_same_client_oid(
order_two = CreateOrderInput(
price="0.87",
size="40",
symbol="MATIC-USDC",
symbol=PAIR,
side="sell",
client_order_id=same_client_oid,
)
order_two_sig, order_two_msg = ob_signer.prepare_and_sign_order(order_two)

create_orders_input = CreateMultipleOrdersInput(
symbol="MATIC-USDC",
symbol=PAIR,
orders=[
OrderWithSignature(
order=order_one,
Expand Down
1 change: 1 addition & 0 deletions models/symbol.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Symbol string
var (
symbolsMap = map[string]Symbol{
"MATIC-USDC": "MATIC-USDC",
"MATIC-USDT": "MATIC-USDT",
}

ErrInvalidSymbol = errors.New("invalid symbol")
Expand Down
13 changes: 9 additions & 4 deletions supportedTokens.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"USDC-OLD": {
"desc": "first usdc we used",
"USDC": {
"desc": "Circle USDC polygon",
"address": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"decimals": 6
},
"USDC": {
"desc": "USDC.e most popular stablecoin March24",
"USDCE": {
"desc": "Circle USDC.e polygon",
"address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
"decimals": 6
},
"USDT": {
"desc": "USDT on polygon",
"address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
"decimals": 6
},
"MATIC": {
"desc": "erc-20 address of WMATIC wrapped",
"address": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
Expand Down

0 comments on commit 86a5b73

Please sign in to comment.