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

Ergo & Spectrum docs #386

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions docs/chains/ergo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# `ergo`

`ergo` is a [Chain](/chains) connector in Hummingbot Gateway that helps users connect to DEXs on various networks on the ergo blockchain.

## 📁 Connector Info

- Folder: [/gateway/src/chains/ergo](https://github.com/hummingbot/gateway/tree/main/src/chains/ergo)
- Configs: [/gateway/src/templates/ergo.yml](https://github.com/hummingbot/gateway/tree/main/src/templates/ergo.yml)

## ℹ️ Chain Info

- Website: https://ergoplatform.org/
- Block Explorer: https://explorer.ergoplatform.com/
- CoinMarketCap: https://coinmarketcap.com/currencies/ergo/
- CoinGecko: https://www.coingecko.com/en/coins/ergo

## 🕸️ Supported Networks

| Network | ChainId | Type |
| --------- | --------- | ------- |
| `mainnet` | `mainnet` | mainnet |
| `testnet` | `testnet` | testnet |
84 changes: 84 additions & 0 deletions docs/exchanges/spectrum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
## 🛠 Connector Info

- **Exchange Type**: Decentralized Exchange (DEX)
- **Market Type**: Automatic Market Maker (AMM)

| Component | Status | Notes |
| ------------------------------------------------ | --------- | ----- |
| [2️⃣ AMM Connector](#2-amm-connector) | ✅ |
| [3️⃣ Range AMM Connector](#3-range-amm-connector) | Not built |
| [🕯 AMM Data Feed](#amm-data-feed) | ✅ |

## ℹ️ Exchange Info

- **Website**: <https://spectrum.fi/>
- **CoinMarketCap**: <https://coinmarketcap.com/exchanges/spectrum-finance/>
- **CoinGecko**: <https://www.coingecko.com/en/exchanges/spectrum-finance>

## 🔑 How to Connect

add following environment variables to the hummingBot project before starting:

```
COINGECKO_URL=https://pro-api.coingecko.com/api/v3

COINGECKO_API_KEY=YOUR_API_KEY
```

Create a wallet on one of the supported networks below:

| Chain | Networks |
| ------ | --------- |
| `ergo` | `mainnet` |
| `ergo` | `testnet` |

From inside the Hummingbot client, run `gateway connect spectrum` in order to connect your wallet:

```
Which chain do you want spectrum to connect to? (ergo) >>>
Which network do you want spectrum to connect to? (mainnet) >>>
Do you want to continue to use node url 'http://213.239.193.208:9053/' for ergo-mainnet? (Yes/No) >>>
Enter your ergo-mainnet private key >>>
```

If connection is successful:

```
The spectrum connector now uses wallet [pubKey] on ergo-mainnet
```

## 2️⃣ AMM Connector

_Integration to this DEX's swap pricing and execution endpoints_

- **ID**: `spectrum`
- **Connection Type**: REST via [Gateway](/gateway)
- **Folder**: <https://github.com/hummingbot/gateway/tree/main/src/connectors/spectrum>
- **Default Configs**: <https://github.com/hummingbot/gateway/blob/main/src/templates/spectrum.yml>

### Endpoints

- `/amm/price`
- `/amm/trade`
- `/amm/estimateGas`

For more info, run Gateway and go to <https:localhost:8080> in your browser to see detailed documentation for each endpoint.

## 🕯 AMM Data Feed

_Data feed of this exchange's real-time prices_

- **ID**: `spectrum_[CHAIN]_[NETWORK]`
- **Connection Type**: REST via [Gateway](/gateway)
- **Folder**: <https://github.com/hummingbot/hummingbot/blob/master/hummingbot/data_feed/amm_gateway_data_feed.py>

### Usage

```python
from hummingbot.data_feed.amm_gateway_data_feed import AmmGatewayDataFeed
prices = AmmGatewayDataFeed(
connector_chain_network="spectrum_ergo_mainnet",
trading_pairs={"ERG-USDT", "ERG-SigUSD"},
order_amount_in_base=Decimal("1"),
)
```