diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..e05baaa --- /dev/null +++ b/.env.template @@ -0,0 +1,4 @@ +MAESTRO_API_KEY=aBcDefghijoXj3v0LB3txySofSPrP3Vf2 +COLLATERAL_UTXO=d235edd34566a425668a4751233dfc2c1cs23b11287340b202c35093433491df#0 +SEED_PHRASE=["road", "road", "road", "road", "road", "anger", "anger", "anger", "anger", "anger", "antenna", "antenna", "antenna", "antenna", "token", "token", "token", "cart", "cart", "cart", "cart", "cart", "cart", "cart"] +STAKE_ADDRESS=stake1uhpdg7r5hjw5u2c59vtdgn3hmcjttlf8hdr5lx7ca5ut6rscues4h diff --git a/.gitignore b/.gitignore index 9aad285..f658902 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,4 @@ cabal.project.local~ var/ .envrc secrets/ - +.env diff --git a/Makefile b/Makefile index 830a579..69219db 100644 --- a/Makefile +++ b/Makefile @@ -36,3 +36,6 @@ lint_check: requires_nix_shell requires_nix_shell: @ [ "$(IN_NIX_SHELL)" ] || echo "The $(MAKECMDGOALS) target must be run from inside a nix shell" @ [ "$(IN_NIX_SHELL)" ] || (echo " run 'nix develop' first" && false) + +build: + docker build -t ghcr.io/geniusyield/market-maker:latest . diff --git a/README.md b/README.md index 011c02a..1265d6f 100644 --- a/README.md +++ b/README.md @@ -66,23 +66,29 @@ After cloning the repository only a few environment variables must be set. As s # Clone the repository: git clone git@github.com:geniusyield/market-maker.git cd market-maker -# TODO: update the following values with your own configuration. -export MAESTRO_API_KEY=aBcDefghijoXj3v0LB3txySofSPrP3Vf2 -export PAYMENT_SIGNING_KEY='{ "type": "PaymentSigningKeyShelley_ed25519", "description": "Payment Signing Key", "cborHex": "4210268dsb870d08s83a4cf6a4408240248ea551a35bb22bf443586c233ae56bc340" }' -export COLLATERAL_UTXO=d235edd34566a425668a4751233dfc2c1cs23b11287340b202c35093433491df#0 +cp ./.env.template ./.env + +# Update the .env files with your own values (including seed phrase and other configuration values): +nano .env + # Update the docker images: docker compose pull # Start the MM bot with your config: -docker compose up +docker compose up -d +# Check the logs: +docker compose logs mm ``` -As in the example above; the following environment variables must be specified before calling `docker compose up`: +The variables must be specified in the `.env` file before calling `docker compose up -d`: - `MAESTRO_API_KEY`: The MAINNET API key to be used for accessing the Maestro services. -- `PAYMENT_SIGNING_KEY`: The payment signing key to be used. Please see the [signing key generator](https://github.com/geniusyield/signing-key-generator) for details. -- `COLLATERAL_UTXO`: A suitable UTxO with 5 ADA to be used as collateral UTxO. +- `SEED_PHASE`: The seed phrase to be used. +- `COLLATERAL_UTXO`: A suitable UTxO with 5 ADA to be used as collateral UTxO. (e.g.: `d235edd34566a425668a4751233dfc2c1cs23b11287340b202c35093433491df#0) +- `STAKE_ADDRESS`: The stake address to be used. (e.g.: `stake1uhpdg7r5hjw5u2c59vtdgn3hmcjttlf8hdr5lx7ca5ut6rscues4h) + +For example values plase see the `.env.template` file. The configuration values used for these environment variables in the example above are just placeholders. These must be replaced by your own -configuration values. A MAINNET Maestro API key is needed, a payment signing key must be generated and a collateral UTxO must be provided after +configuration values. A MAINNET Maestro API key, a seed phrase and aa collateral UTxO must be provided after sending funds to the address given by the payment signing key and the (optional) stake address. In order to determine this address, you could use `cardano-cli address build`, but you can also just run the market maker - the address will be printed as the first log of "Info" severity: diff --git a/docker-compose.yml b/docker-compose.yml index c116691..9daf405 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,6 @@ services: environment: # Supported modes: MM for market making and CANCEL for canceling ALL the orders. MODE: ${MODE:-MM} - PAYMENT_SIGNING_KEY: ${PAYMENT_SIGNING_KEY} PROVIDER_CONFIG: | { "coreProvider": { @@ -27,8 +26,13 @@ services: MARKET_MAKER_CONFIG: | { "mbc_user": { - "ur_s_key_path": "/root/payment-signing-key.skey", - "ur_coll": "${COLLATERAL_UTXO}" + "ur_mnemonic": { + "mnemonic": ${SEED_PHRASE}, + "acc_ix": 0, + "addr_ix": 0 + }, + "ur_coll": "${COLLATERAL_UTXO}", + "ur_stake_address": "${STAKE_ADDRESS}" }, "mbc_delay": 120000000, "mbc_price_config": { diff --git a/start.sh b/start.sh index b31031b..ba14dff 100644 --- a/start.sh +++ b/start.sh @@ -1,11 +1,19 @@ #!/bin/bash +echo "Initializing market maker..." echo $PROVIDER_CONFIG >> ~/config.json echo $MARKET_MAKER_CONFIG >> ~/market-maker-config.json -echo $PAYMENT_SIGNING_KEY >> ~/payment-signing-key.skey + +if [[ -n "$PAYMENT_SIGNING_KEY" ]]; then + echo " -> Storing payment signing key..." + echo $PAYMENT_SIGNING_KEY >> ~/payment-signing-key.skey +fi + if [[ "${MODE:=MM}" == "CANCEL" ]]; then echo "Canceling all the orders..." + set -x cabal run geniusyield-market-maker-exe -- Cancel ~/config.json ~/market-maker-config.json else echo "Starting market maker..." + set -x cabal run geniusyield-market-maker-exe -- Run ~/config.json ~/market-maker-config.json fi