Skip to content

Commit

Permalink
Update tdex to v1.0.0 (#754)
Browse files Browse the repository at this point in the history
Co-authored-by: nmfretz <[email protected]>
  • Loading branch information
altafan and nmfretz authored Sep 18, 2024
1 parent 6089066 commit 67a8d8c
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tdex/caddy-data/Caddyfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:8080 {
handle_path /api/* {
reverse_proxy tdex_tdexd_1:9090
reverse_proxy tdex_tdexd_1:9092
}
reverse_proxy tdex_dashboard_1:8080
}
27 changes: 23 additions & 4 deletions tdex/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,50 @@ services:
APP_HOST: tdex_caddy_1
APP_PORT: 8080

oceand:
image: ghcr.io/vulpemventures/oceand:v0.1.17@sha256:37b813b43b068e32d918b9f42539c33287308cc81d00909c742b7164dfefc0c4
tty: true
restart: on-failure
stop_grace_period: 1m
volumes:
- ${APP_DATA_DIR}/ocean-data:/home/ocean/.oceand
environment:
OCEAN_LOG_LEVEL: 5
OCEAN_DB_TYPE: "badger"
OCEAN_NO_TLS: "true"
OCEAN_NO_PROFILER: "true"
OCEAN_UTXO_EXPIRY_DURATION_IN_SECONDS: 240

tdexd:
image: ghcr.io/tdex-network/tdexd:v0.9.1@sha256:5078897b9a505fc3dfac5b3d51537150941c075f5279ae81de1c6b1c21112544
image: ghcr.io/tdex-network/tdexd:v1.0.1@sha256:eef1f31e98208e9a35ddf308317bc1df71065e189fa0915c769c7a01394ef79a
tty: true
restart: on-failure
depends_on:
- oceand
stop_grace_period: 1m
volumes:
- ${APP_DATA_DIR}/tdex-data:/home/tdex/.tdex-daemon
- ${APP_DATA_DIR}/tdexd:/home/tdex/.tdex-daemon
ports:
- ${APP_TDEX_PORT}:${APP_TDEX_PORT}
environment:
TDEX_LOG_LEVEL: 5
TDEX_OPERATOR_LISTENING_PORT: "${APP_TDEX_PORT}"
TDEX_TRADE_LISTENING_PORT: "${APP_TDEX_PORT}"
TDEX_NO_OPERATOR_TLS: "true"
TDEX_WALLET_ADDR: oceand:18000
# these vars are used to generate the connect URL
# we assume to always show the external endpoint
# reachable remotely by other dashboards via Tor
TDEX_CONNECT_ADDR: "${APP_TDEX_DAEMON_HIDDEN_SERVICE}"
TDEX_CONNECT_PROTO: http

dashboard:
image: ghcr.io/tdex-network/dashboard:v0.1.55@sha256:dfa7cdb75117c97e671285fc9754a6cabafc7f74760c314e6625c33067509beb
image: ghcr.io/tdex-network/dashboard:v1.0.2@sha256:71d598afb0d5ec9966306f4ef0d5f6839a9d7dc50726a935f3d0bb38f1925d78
restart: on-failure
environment:
USE_PROXY: "false"
IS_PACKAGED: "true"
TRADER_HIDDEN_SERVICE: "${APP_TDEX_DAEMON_HIDDEN_SERVICE}"
TRADER_HIDDEN_SERVICE: "${APP_TDEX_DAEMON_HIDDEN_SERVICE}"

caddy:
image: caddy:2.6.4-alpine@sha256:4dfec6c3b22c36b63ea4a3633c7cdbdaa9926d1324c27db2b0e2b70ef9cd105a
Expand Down
2 changes: 1 addition & 1 deletion tdex/exports.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export APP_TDEX_PORT="9090"
export APP_TDEX_PORT="9092"

daemon_hidden_service_file="${EXPORTS_TOR_DATA_DIR}/app-${EXPORTS_APP_ID}-daemon/hostname"
export APP_TDEX_DAEMON_HIDDEN_SERVICE="$(cat "${daemon_hidden_service_file}" 2>/dev/null || echo "daemon_not_yet_set.onion")"
Expand Down
21 changes: 20 additions & 1 deletion tdex/hooks/pre-start
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
#!/usr/bin/env bash

set -euo pipefail

APP_DATA_DIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"

# Update the Caddyfile with newer tdexd port
CADDYFILE_PATH="${APP_DATA_DIR}/caddy-data/Caddyfile"
sed -i 's/tdex_tdexd_1:9090/tdex_tdexd_1:9092/g' "${CADDYFILE_PATH}"

# Ensure the ocean-data directory exists for apps updating from the old version that didn't have it
OCEAN_DATA_DIR="${APP_DATA_DIR}/ocean-data"

[ ! -d "${OCEAN_DATA_DIR}" ] && mkdir -p "${OCEAN_DATA_DIR}" && chown 1000:1000 "${OCEAN_DATA_DIR}"

# Ensure the new tdexd directory exists for apps that are updating from the old tdex-data directory structure
TDEXD_DATA_DIR="${APP_DATA_DIR}/tdexd"

[ ! -d "${TDEXD_DATA_DIR}" ] && mkdir -p "${TDEXD_DATA_DIR}" && chown 1000:1000 "${TDEXD_DATA_DIR}"

# Delay booting TDEX until the Tor Hidden Service is ready
HIDDEN_SERVICE_FILE="${TOR_DATA_DIR}/app-${APP_ID}-daemon/hostname"
if [[ -f "${HIDDEN_SERVICE_FILE}" ]]; then
exit
fi

"${UMBREL_ROOT}/scripts/app" compose "${APP_ID}" up --detach tdexd
"${UMBREL_ROOT}/scripts/app" compose "${APP_ID}" up --detach tor
"${UMBREL_ROOT}/scripts/app" compose "${APP_ID}" up --detach oceand
"${UMBREL_ROOT}/scripts/app" compose "${APP_ID}" up --detach tdexd

echo "App: ${APP_ID} - Generating Tor Hidden Service..."
for attempt in $(seq 1 100); do
Expand Down
File renamed without changes.
Empty file added tdex/tdexd/.gitkeep
Empty file.
22 changes: 19 additions & 3 deletions tdex/umbrel-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ manifestVersion: 1.1
id: tdex
category: bitcoin
name: TDEX Provider
version: "0.9.1"
version: "1.0.1"
tagline: Provide liquidity on the TDEX Network, an open protocol to trade Liquid Network assets
description: >-
A liquidity provider holds Liquid reserves of both a BASE_ASSET-QUOTE_ASSET in his non-custodial Liquid hot-wallet,
Expand All @@ -16,6 +16,23 @@ description: >-
by the trader, without the need to connect to an external price feed. The default strategy of the alpha daemond is the
constant product market-making. In short, this model generates a full order-book based on an initial price for the market.
Every transaction that occurs on this market will adjust the prices of the market accordingly.
releaseNotes: >-
🚨 IMPORTANT: Please ensure you have your 24-word recovery phrase written down BEFORE updating.
This update will require you to restore your wallet from the 24-word recovery phrase.
This is a major update of the TDEX daemon that contains several changes, including:
- Update to TDEXv2: the daemon's Trade interface implements the specs of the new TDEX v2 protocol. With this update the daemon makes
use of PSETv2 as a way for describing and build transactions (instead of the old PSETv0), and, also, exposes some new endpoint according
to the spec.
- Wallet detachment: the daemon now requires a connection to an Ocean wallet that is fully responsible of deriving new key pairs
and scan the chain for them. The wallet produces events consumed by the daemon for confirmed/unconfirmed txs and utxos.
This drastically improves the overall perfomances of the service.
You don't need to manually claim the funds deposited to the dameon anymore.
- Embedded price feeder: the daemon allows you to set up price feeds for your pluggable-strategy markets to keep their price always up-to-date.
dependencies: []
developer: TDEX Network
website: https://dev.tdex.network
Expand All @@ -31,5 +48,4 @@ gallery:
- 3.jpg
path: ""
defaultUsername: ""
defaultPassword: ""
releaseNotes: ""
defaultPassword: ""

0 comments on commit 67a8d8c

Please sign in to comment.