Hu-Fi / Mr.Market

Mr. Market is the exchange oracle of HuFi, and a CeFi crypto bot on Mixin Messenger
https://mr-market-one.vercel.app
GNU Affero General Public License v3.0
1 stars 6 forks source link

bThis is highly alpha code. Do not use it or you will lose all your money. We'd like to thank Little creatures for being the first company to test Mr. Market and for helping with QA.

Playwright Tests Unit Tests Unit Tests Lint Railway Deployment Status Vercel Deployment Status Deploy with Vercel Deploy on Railway

Vercel deployment Deploy to Render

Introduction

What is Mr.Market

Mr Market is a CeFi crypto bot and the reference exchange oracle for Hu Fi. Mr Market has three main functions

Development

Getting Started

Prerequisites

Install dependencies

make install

Run DB server

If you don't have Postgres installed, run it simply with docker.

make start-server-db

Run development servers

make start

Tests

Client

Install dependencies

npx playwright install

Running tests

Unit testing

yarn test:unit

E2E testing

yarn test:e2e

Server

Running tests

Unit testing

yarn test

Deployment Guide

This guide will walk you through the process of deploying a server on Railway and an interface on Vercel for our application. By the end of these steps, you will have a fully functional server and interface setup.

Preparations

First, ensure you have the following environment variables ready. These are crucial for the configuration of the server and interface.

Server Environment Variables (/server/.env)

Variable Description Source
ADMIN_PASSWORD Admin page password User-defined
JWT_SECRET JWT secret key (32 bit) User-defined
COINGECKO_API_KEY Coingecko API key Coingecko
MIXIN_APP_ID Mixin App ID Mixin Developer Dashboard
MIXIN_SESSION_ID Mixin Session ID Mixin Developer Dashboard
MIXIN_SERVER_PUBLIC_KEY Mixin Server Public key Mixin Developer Dashboard
MIXIN_SESSION_PRIVATE_KEY Mixin Session Private key Mixin Developer Dashboard
MIXIN_SPEND_PRIVATE_KEY Mixin Spend Private key Mixin Developer Dashboard
MIXIN_OAUTH_SECRET Mixin Oauth Secret Mixin Developer Dashboard

Interface Environment Variables (/interface/.env)

Variable Description Source
PUBLIC_BOT_ID Mixin App ID Mixin Developer Dashboard
PUBLIC_HUFI_SOCKET_URL Server deployment URL Railway Deployment
PUBLIC_HUFI_BACKEND_URL Server deployment URL Railway Deployment

Variables starting with MIXIN are obtained from the Mixin bot keystore, accessible on the Mixin developer dashboard by creating a new bot.

Deployment Steps

  1. Deploy Server on Railway
    Click the below button to start deployment on Railway. Fill in the environment variables as prompted. Note that the Trial Plan on Railway might not suffice due to memory constraints; consider upgrading if necessary.
    Deploy on Railway

  2. Deploy Interface on Vercel
    Use the following button to deploy the interface on Vercel. Ensure you fill in the environment variables as required.
    Deploy with Vercel

Troubleshooting

If you encounter issues during the deployment, check the following:

Built With

License

This project is licensed under the GNU Affero General Public License - see the LICENSE.md file for details

Free Data provided by

"Data provided by CoinGecko",