1.1.31 • Published 4 years ago

open-oracle-poster v1.1.31

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

The Open Price Feed Poster

The poster is a simple application to pull prices from a set of source feeds and post them to the blockchain. The posters main job is to make sure that the requested source data is posted to the Ethereum blockchain, and thus is concerned about nonces, gas prices, etc.

Installation

The Open Price Feed poster can be run as a standalone process or as a module for configuration. To install as a global process:

yarn global add open-oracle-poster
# npm install -g open-oracle-poster

Or, if you plan on customizing the poster, you can install in a project:

yarn add open-oracle-poster
# npm install open-oracle-poster

Command-Line Interface

The poster is a simple CLI to post prices. The following options are available:

OptionDescription
--sources, -ssources to pull price messages from, a list of https endpoints created by open oracle reporters serving open oracle payloads as json. For complex sources, such as Coinbase, this can be JSON-encoded. Note: specify multiple times to specify multiple sources.
--poster-key, -kPrivate key holding enough gas to post (try: file:<file> or env:<env>)
--view-function, -fFunction signature for the view (e.g. postPrices(bytes[],bytes[]))
--web3-providerWeb3 provider
--view-addressAddress of open oracle view to post through
--timeout, -thow many seconds to wait before retrying with more gas, defaults to 180
--asset, -aList of assets to post prices for. Pass multiple times to specify multiple assets.

Sources

A source can simply be a URL, e.g. http://localhost:3000/prices.json or you can pass a JSON-encoded structure for complex sources. Specifically, for the Coinbase API, you can use the following structure:

"{\"source\": \"coinbase\", \"endpoint\": \"https://api.pro.coinbase.com/oracle\", \"api_key_id\": \"<your api key>\", \"api_secret\": \"<your api secret>\", \"api_passphrase\": \"<your api passphrase>\"}"

Examples

To run as standalone from this project's root, simply invoke the start script.

 yarn run start --view-address=0xViewAddress --poster-key=0xWalletWithGas --sources=http://localhost:3000/prices.json

Here's an example for the Kovan testnet:

 yarn prepare && yarn run start --web3-provider=https://kovan-eth.compound.finance/ --view-address=0x60F1FFB2FE2bFE6CFFA0A66e258B623f06E1949F --poster-key="$(cat ~/.ethereum/kovan)" --sources="{\"source\": \"coinbase\", \"endpoint\": \"https://api.pro.coinbase.com/oracle\", \"api_key_id\": \"$COINBASE_API_KEY\", \"api_secret\": \"$COINBASE_API_SECRET\", \"api_passphrase\": \"$COINBASE_API_PASSPHRASE\"}"

Running in JavaScript

You can include the Open Price Feed poster in an app for configuration:

import poster from 'open-oracle-poster';
import Web3 from 'web3';

// sample arguments, fill these in with real data :)
let sources: string[] = /* [list of sources, possibly JSON-encoded] */;
let posterKey: string = /* ...a key to a wallet holding eth for gas */;
let viewAddress: string = /* "0xDelfiPriceView" */;
let viewFunction: string = 'postPrices(bytes[],bytes[],string[])' /* ...view function signature */;
let provider = new Web3();

await poster.main(sources, posterKey, viewAddress, viewFunction, provider);

Testing

To run tests, simply run:

yarn test

To run a single test run:

yarn test tests/poster_test.ts

Contributing

For all contributions, please open an issue or pull request to discuss. Ensure that all test cases are passing and that top-level (integration) tests also pass (see the open-oracle root project). See top-level README for license notice and contribution agreement.

1.1.31

4 years ago

1.1.30

4 years ago

1.1.29

4 years ago

1.1.28

4 years ago

1.1.27

4 years ago

1.1.26

4 years ago

1.1.25

4 years ago

1.1.24

4 years ago

1.1.23

4 years ago

1.1.22

4 years ago

1.1.21

4 years ago

1.1.20

4 years ago

1.1.19

4 years ago

1.1.18

4 years ago

1.1.17

4 years ago

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.22

4 years ago

1.0.19

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.18

4 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago