solana-flux-aggregator/README.md

97 lines
2.1 KiB
Markdown
Raw Normal View History

2020-11-26 14:21:05 -08:00
# solana-flux-aggregator
2020-12-09 03:41:15 -08:00
2020-11-27 01:38:49 -08:00
Solnana Flux Aggregator
2020-12-08 18:39:39 -08:00
## Install
2020-12-09 03:41:15 -08:00
```
yarn install
```
## Admin Wallet Setup
Setup a wallet for the flux aggregator admin:
```
yarn generate-wallet
address: 7YMUUCzZir7AAuoy4CtZih9JFBqYwtQiCxjA5dtqwRxU
mnemonic: wine vault fancy enhance trade dolphin hard traffic social butter client pave
```
```
yarn solink airdrop 7YMUUCzZir7AAuoy4CtZih9JFBqYwtQiCxjA5dtqwRxU
```
Create `.env` configuration file for the deploy script.
```
NETWORK=dev
DEPLOY_FILE=deploy.json
ADMIN_MNEMONIC="wine vault fancy enhance trade dolphin hard traffic social butter client pave"
```
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
## Aggregator Setup
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
Build and deploy the flux aggregator:
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
```
yarn build:program
```
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
```
yarn solink deploy-program
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
deployed aggregator program. program id: 9KXbVqUrMgtti7Jx4rrV1NqXjQNxWaKgtYCEwJ8AESS5
```
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
Create the `btc:usd` feed (that accepts max and min u64 as valid submission values):
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
```
yarn solink add-aggregator \
--feedName btc:usd \
--submitInterval 6 \
--minSubmissionValue 0 \
--maxSubmissionValue 18446744073709551615
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
feed initialized, pubkey: AUK9X6QLgauAUvEA3Ajc91fZytb9ccA7qVR72ErDFNg2
```
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
## Adding an oracle
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
Next, we create a separate wallet to control oracles:
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
```
yarn generate-wallet
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
address: FosLwbttPgkEDv36VJLU3wwXcBSSoUGkh7dyZPsXNtT4
mnemonic: amount smoke bar coil current trial toward minimum model pass moral liberty
```
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
```
yarn solink airdrop FosLwbttPgkEDv36VJLU3wwXcBSSoUGkh7dyZPsXNtT4
```
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
Add this wallet to `.env`:
2020-12-08 23:52:28 -08:00
2020-12-09 03:41:15 -08:00
```
ORACLE_MNEMONIC="amount smoke bar coil current trial toward minimum model pass moral liberty"
```
2020-12-08 23:52:28 -08:00
2020-12-09 03:41:15 -08:00
Next we create a new oracle to the feed we've created previously, and set its owner to be the new oracle wallet that we've generated:
2020-12-08 23:52:28 -08:00
2020-12-09 03:41:15 -08:00
```
yarn solink add-oracle \
--feedAddress AUK9X6QLgauAUvEA3Ajc91fZytb9ccA7qVR72ErDFNg2 \
--oracleName solink-test \
--oracleOwner FosLwbttPgkEDv36VJLU3wwXcBSSoUGkh7dyZPsXNtT4
2020-12-08 23:52:28 -08:00
2020-12-09 03:41:15 -08:00
added oracle. pubkey: 4vH5L2jSNXGfcCx42N4sqPiMzEbp1PaQjQ6XngDBu8zR
```
2020-12-08 18:39:39 -08:00
2020-12-09 03:41:15 -08:00
```
yarn solink feed \
--feedAddress AUK9X6QLgauAUvEA3Ajc91fZytb9ccA7qVR72ErDFNg2 \
--oracleAddress 4vH5L2jSNXGfcCx42N4sqPiMzEbp1PaQjQ6XngDBu8zR
```