Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync gateway / gateway staging -> main for Hummingbot gateway version 1.17.0 #137

Merged
merged 38 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3fb1544
update workflow
david-hummingbot May 25, 2023
91fdb28
Merge pull request #114 from hummingbot/docker-build-dev
cardosofede May 25, 2023
fc635a6
addd EUROC token to token list
vic-en May 31, 2023
90ab6fc
(fix) fix broken links in README.md
VPashkov May 31, 2023
d3f6892
Merge pull request #118 from CoinAlpha/feat/add_EUROC_to_tokenlist
cardosofede Jun 1, 2023
58274ab
(fix) Rename avanlanche_tokens.json to avalanche_tokens.json
nikspz Jun 2, 2023
ad17b50
(fix) rename Changing src/templates
nikspz Jun 2, 2023
e2ebba3
(feat) move eth lists and modify gateway setup
fengtality Jun 2, 2023
08023fe
(fix) polygon default gas to 400
fengtality Jun 6, 2023
aa2f59f
Merge pull request #125 from hummingbot/fix-typo-in-Avalanche
fengtality Jun 6, 2023
0d84154
Merge branch 'main' into fix/polygon-gasd
fengtality Jun 6, 2023
7f75fa7
Merge branch 'development' into fix/polygon-gasd
fengtality Jun 6, 2023
bc32710
Merge pull request #127 from hummingbot/fix/polygon-gasd
fengtality Jun 6, 2023
799a672
Merge branch 'development' into fix/broken_links_in_readme
fengtality Jun 6, 2023
784c65e
Merge branch 'development' into feat/move-list
rapcmia Jun 6, 2023
03dace3
Merge pull request #120 from VPashkov/fix/broken_links_in_readme
fengtality Jun 6, 2023
3239f5e
Merge branch 'development' into feat/move-list
nikspz Jun 6, 2023
6339128
(wip) add lists to docker image
fengtality Jun 8, 2023
8956316
Merge branch 'feat/move-list' of github.com:hummingbot/gateway into f…
fengtality Jun 8, 2023
563f798
changes
fengtality Jun 8, 2023
6c7416a
upgrade traderjoe
vic-en Jun 8, 2023
143fa04
redo docker setup
fengtality Jun 9, 2023
dfce457
(fix) change sed to perl and update lists
fengtality Jun 10, 2023
8ebb28b
Merge branch 'development' into feat/traderjoe_upgrade_to_v2
petioptrv Jun 13, 2023
77ac9f3
Merge pull request #126 from hummingbot/feat/move-list
fengtality Jun 13, 2023
39b0c9f
(fix) move lists for all chains to make them editable in docker
fengtality Jun 14, 2023
76660cc
Merge pull request #132 from hummingbot/feat/move-all-lists
nikspz Jun 14, 2023
4cdc5a6
Merge branch 'development' into feat/traderjoe_upgrade_to_v2
fengtality Jun 14, 2023
8cec685
Merge pull request #131 from CoinAlpha/feat/traderjoe_upgrade_to_v2
fengtality Jun 16, 2023
3782ab8
(fix)-update-arbitrum-usdc.e
nikspz Jun 19, 2023
e284d38
Merge pull request #133 from hummingbot/fix-update-arbitrum-usdc.e
fengtality Jun 19, 2023
d46286e
(fix) add -r to fix workflow
fengtality Jun 19, 2023
76864f8
(docs) remove old docker scripts and update readme
fengtality Jun 19, 2023
d7897f1
(docs) update readme
fengtality Jun 19, 2023
6d6e3e3
Merge pull request #135 from hummingbot/doc/remove-old-docker
fengtality Jun 19, 2023
596ff26
Merge pull request #134 from hummingbot/development
nikspz Jun 20, 2023
814c792
fix/ update package.json on staging
nikspz Jun 26, 2023
2dd3a99
Merge pull request #140 from hummingbot/fix/-update-package.json-on-s…
nikspz Jun 26, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
- name: Replace testnet nodeURL for local hardhat node
run: |
mkdir conf db
cp src/templates/* conf
cp -r src/templates/* conf
sed -i 's/https:\/\/rpc.ankr.com\/eth_goerli/http:\/\/127.0.0.1:8545\//g' ./conf/ethereum.yml
sed -i 's/https:\/\/arbitrum-rinkeby.infura.io\/v3/http:\/\/127.0.0.1:8545\//g' ./conf/ethereum.yml
sed -i 's/https:\/\/rpc.ankr.com\/optimism/http:\/\/127.0.0.1:8545\//g' ./conf/ethereum.yml
Expand Down
49 changes: 19 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# Set the base image
FROM node:18.10.0

# Set labels
LABEL application="gateway-v2"
# WORKDIR /usr/src/app/
WORKDIR /home/gateway

# Copy files
COPY . .

# Dockerfile author / maintainer
LABEL maintainer="Michael Feng <mike@hummingbot.org>"

# Build arguments
LABEL branch=${BRANCH}
LABEL commit=${COMMIT}
LABEL date=${BUILD_DATE}
Expand All @@ -10,37 +19,17 @@ LABEL date=${BUILD_DATE}
ENV COMMIT_BRANCH=${BRANCH}
ENV COMMIT_SHA=${COMMIT}
ENV BUILD_DATE=${DATE}
ENV INSTALLATION_TYPE=docker

# Add hummingbot user and group
RUN groupadd -g 8211 hummingbot && \
useradd -m -s /bin/bash -u 8211 -g 8211 hummingbot
# Create mount points
RUN mkdir -p /home/gateway/conf /home/gateway/logs /home/gateway/db /home/gateway/certs

# Install gosu
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y gosu && \
rm -rf /var/lib/apt/lists/*

# app directory
WORKDIR /usr/src/app/

# copy pwd file to container
COPY . .

RUN ln -s /conf /usr/src/app/conf && \
ln -s /logs /usr/src/app/logs && \
ln -s /certs /usr/src/app/certs

# create app writable directory for db files
RUN mkdir -p /var/lib/gateway /certs /conf /logs /usr/src/app/gateway.level /usr/src/app/transactions.level \
/usr/src/app/db
RUN chown -R hummingbot:hummingbot /var/lib/gateway /usr/src/app/logs /usr/src/app/conf /usr/src/app/certs \
/usr/src/app/gateway.level /usr/src/app/transactions.level /usr/src/app/db /usr/src/app/conf/

# install dependencies
# Install dependencies and compile
RUN yarn install --frozen-lockfile
RUN yarn build

# Expose port 15888 - note that docs port is 8080
EXPOSE 15888

RUN yarn build

CMD ["gosu", "hummingbot:hummingbot", "yarn", "run", "start"]
# Set the default command to run when starting the container
CMD yarn run start
37 changes: 13 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ Hummingbot Gateway is a REST API that exposes connections to various blockchains

Gateway may be used alongside the main [Hummingbot client](https://github.com/hummingbot/hummingbot) to enable trading on DEXs, or as a standalone module by external developers.

## Installation
## Installation via Docker

### Generate certificates
If you are installing Gateway alongside Hummingbot, check out the [Deploy Examples](https://github.com/hummingbot/deploy-examples) repository that helps you deploy various types of Hummingbot and Gateway configurations. For most new users, we recommend following the [Hummingbot Gateway Compose](https://github.com/hummingbot/deploy-examples/tree/main/hummingbot_gateway_compose) deployment.

To run Gateway in `https` (default):
* **CERTS_PATH**: path to folder where Hummingbot generated and saved self-signed SSL certificates
* **PASSPHRASE**: passphrase used to generate the certificates above
The repo also contains [Bash Scripts](https://github.com/hummingbot/deploy-examples/tree/main/bash_scripts#gateway) that help you install the Gateway Docker image on a standalone basis.

### Run Gateway from source
## Installation from source

Dependencies:
* NodeJS (16.0.0 or higher)
Expand All @@ -35,18 +33,7 @@ $ ./gateway-setup.sh
$ yarn start --passphrase=<PASSPHRASE>
```

### Run Gateway using Docker

Dependencies:
* [Docker](https://docker.com)

See the [`/docker`](./docker) folder for Docker installation scripts and instructions on how to use them.


### Build Gateway Docker Image locally

Dependencies:
* [Docker](https://docker.com)
### Build Docker image

To build the gateway docker image locally execute the below make command:

Expand Down Expand Up @@ -84,29 +71,31 @@ There are a number of ways to contribute to gateway.

### Configuration

- Edit `certs_path` in [conf/server.yml](./conf/server.yml) and enter the absolute path to the folder where Hummingbot stored the certificates it created with `gateway generate-certs`. You can also edit this config inside the Hummingbot client by running the command: `gateway config server.certs_path`.

- If you want to turn off `https`, set `unsafeDevModeWithHTTP` to `true` in [conf/server.yml](./conf/server.yml).

- If you want Gateway to log to standard out, set `logToStdOut` to `true` in [conf/server.yml](./conf/server.yml).

- The format of configuration files are dictated by [src/services/config-manager-v2.ts](./src/services/config-manager-v2.ts) and the corresponding schema files in [src/services/schema](./src/services/schema).

- If you want to turn off `https`, set `unsafeDevModeWithHTTP` to `true` in [conf/server.yml](./conf/server.yml).

- For each supported chain, token lists that translate address to symbols for each chain are stored in `/conf/lists`. You can add tokens here to make them available to Gateway.


### Architecture

Here are some files we recommend you look at in order to get familiar with the Gateway codebase:

- [src/services/ethereum-base.ts](./src/services/ethereum-base.ts): base class for EVM chains.
- [src/services/ethereum-base.ts](./src/chains/ethereum/ethereum-base.ts): base class for EVM chains.

- [src/connectors/uniswap/uniswap.ts](./src/connectors/uniswap/uniswap.ts): functionality for interacting with Uniswap.

- [src/services/validator.ts](./src/services/validator.ts): defines functions for validating request payloads.
- [src/services/validators.ts](./src/services/validators.ts): defines functions for validating request payloads.


### Testing

For a pull request merged into the codebase, it has to pass unit test coverage requirements. Take a look at [Workflow](../.github/workflows/workflow.yml) for more details.
For a pull request merged into the codebase, it has to pass unit test coverage requirements. Take a look at [Workflow](./.github/workflows/workflow.yml) for more details.

#### Unit tests

Expand All @@ -126,7 +115,7 @@ yarn jest test/<folder>/<file>

#### Manual tests

We have found it is useful to test individual endpoints with `curl` commands. We have a collection of prepared curl calls. POST bodies are stored in JSON files. Take a look at the [curl calls for gateway](./manual-tests/curl.sh). Note that some environment variables are expected.
We have found it is useful to test individual endpoints with `curl` commands. We have a collection of prepared curl calls. POST bodies are stored in JSON files. Take a look at the [curl calls for gateway](./test-helpers/curl/curl.sh). Note that some environment variables are expected.

## Linting

Expand Down
68 changes: 0 additions & 68 deletions docker/README.md

This file was deleted.

89 changes: 0 additions & 89 deletions docker/gateway-copy-certs.sh

This file was deleted.

Loading