Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yang committed Feb 24, 2024
1 parent 146a622 commit f2da33a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

<img src="./repo-banner.png">

The `pricefeeder` is a tool developed for Nibiru's [Oracle Module consensus](https://nibiru.fi/docs/ecosystem/oracle/) that runs a process to pull data from various external sources and then broadcasts transactions to vote on exchange rates.
The `pricefeeder` is a tool developed for Nibiru's [Oracle Module consensus](https://nibiru.fi/docs/ecosystem/oracle/) that runs a process to pull data from various external sources and then broadcasts transactions to vote on exchange rates.

- [NibiruChain/pricefeeder for the Oracle Module](#nibiruchainpricefeeder-for-the-oracle-module)
- [Quick Start - Local Development](#quick-start---local-development)
- [Configuration for the `.env`](#configuration-for-the-env)
- [Run](#run)
- [Or, to run the tool as a daemon](#or-to-run-the-tool-as-a-daemon)
- [Hacking](#hacking)
- [Build](#build)
- [Delegating "feeder" consent](#delegating-feeder-consent)
- [Enabling TLS](#enabling-tls)
- [Configuring specific exchanges](#configuring-specific-exchanges)
- [CoinGecko](#coingecko)
- [Glossary](#glossary)

## Quick Start - Local Development

Expand Down Expand Up @@ -40,18 +43,21 @@ make localnet
### Run

With your environment set to a live network, you can now run the price feeder:

```sh
make run
```

#### Or, to run the tool as a daemon:
#### Or, to run the tool as a daemon

1. Build a docker image for use with docker compose.

1. Build a docker image for use with docker compose.
```bash
make build-docker
```

2. Run the 'price_feeder' service defined in the `docker-compose.yaml`.

```bash
make docker-compose up -d price_feeder
```
Expand All @@ -62,7 +68,7 @@ Connecters for data sources like Binance and Bitfinex are defined in the `feeder

### Build

Builds the binary for the package:
Builds the binary for the package:

```sh
make build
Expand All @@ -79,11 +85,12 @@ In order to be able to delegate consent to post prices, you need to set the
VALIDATOR_ADDRESS="nibivaloper1..."
```

To delegate consent from a validator node to some `feeder` address, you must execute a `MsgDelegateFeedConsent` message:
To delegate consent from a validator node to some `feeder` address, you must execute a `MsgDelegateFeedConsent` message:

```go
type MsgDelegateFeedConsent struct {
Operator string
Delegate string
Operator string
Delegate string
}
```

Expand All @@ -101,7 +108,6 @@ To enable TLS, you need to set the following env vars:
TLS_ENABLED="true"
```


### Configuring specific exchanges

#### CoinGecko
Expand All @@ -113,3 +119,9 @@ you need to set env var:
DATASOURCE_CONFIG_MAP='{"coingecko": {"api_key": "0123456789"}}'
```

## Glossary

- **Data source**: A data source is an external service that provides data. For example, Binance is a data source that provides the price of various assets.
- **Symbol**: A symbol is a string that represents a pair of assets on an external data source. For example, `tBTCUSD` is a symbol on Bitfinex that represents the price of Bitcoin in US Dollars.
- **Ticker**: Synonymous with **Symbol**. Exchanges generally use the term "ticker" to refer to a symbol.
- **Pair**: A pair is a combination of two assets recognized by Nibiru Chain. For example, `ubtc:uusd` is a pair that represents Bitcoin and USD.
3 changes: 1 addition & 2 deletions feeder/priceprovider/priceprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,9 @@ func (p *PriceProvider) Close() {
<-p.done
}

// symbolsFromPairToSymbolMapping returns the symbols list
// symbolsFromPairToSymbolMapping returns the symbols set
// given the map which maps nibiru chain pairs to exchange symbols.
func symbolsFromPairToSymbolMapping(m map[asset.Pair]types.Symbol) set.Set[types.Symbol] {
// s := make(set.Set[types.Symbol], 0, len(m))
s := set.New[types.Symbol]()
for _, v := range m {
s.Add(v)
Expand Down

0 comments on commit f2da33a

Please sign in to comment.