Skip to content

Commit 8b15387

Browse files
committed
chore: update README and unused codes
1 parent 92a82df commit 8b15387

File tree

7 files changed

+27
-48
lines changed

7 files changed

+27
-48
lines changed

README.md

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@ This solution has 2 components:
3636
2. `curl -o docker-compose.yml https://raw.githubusercontent.com/classic-terra/oracle-feeder/main/docker-compose.yml`
3737

3838
3. Review the docker-compose.yml service oracle-feeder and change ENV accordingly
39-
* ORACLE_FEEDER_PASSWORD=password (Optional) (Oracle feeder keyring password)
40-
* ORACLE_FEEDER_MNENOMIC="mnemonic" (Mandatory) (Oracle feeder mnemonic, this address will be responsible for updating price)
41-
* ORACLE_FEEDER_VALIDATORS=terravaloper1xxx (Mandatory) (Oracle feeder validator that feeder address is bount to) [How to bound?](feeder/README.md#make-a-new-key-for-oracle-votes) (**REMEMBER TO BOUND YOUR VOTER TO VALIDATOR BEFORE RUNNING**)
42-
* ORACLE_FEEDER_LCD_ADDRESS=https://terra-classic-lcd.publicnode.com,https://lcd.terraclassic.community (Optional)
43-
* ORACLE_FEEDER_CHAIN_ID=columbus-5 (Optional)
44-
* ORACLE_FEEDER_ADDR_PREFIX=terra (Optional)
4539

40+
* ORACLE_FEEDER_PASSWORD=password (required) Oracle feeder keyring password
41+
* ORACLE_FEEDER_MNENOMIC=word1 word2... (required) (Oracle feeder mnemonic, this address will be responsible for updating price)
42+
* ORACLE_FEEDER_VALIDATORS=terravaloper1xxx (required) (Oracle feeder validator that feeder address is bount to) [How to bound?](feeder/README.md#make-a-new-key-for-oracle-votes) (**REMEMBER TO BOUND YOUR VOTER TO VALIDATOR BEFORE RUNNING**)
43+
* ORACLE_FEEDER_LCD_ADDRESS=https://terra-classic-lcd.publicnode.com,https://lcd.terraclassic.community (optional)
44+
* ORACLE_FEEDER_CHAIN_ID=columbus-5 (optional)
4645

4746
4. Bring up your stack by running
4847

@@ -52,16 +51,7 @@ This solution has 2 components:
5251

5352
## Manual deployment instructions
5453

55-
1. Install nodejs v18.x [Node.js version 18 or greater](https://nodejs.org/)
56-
57-
```sh
58-
curl -sL https://deb.nodesource.com/setup_18.x -o /tmp/nodesource_setup.sh
59-
chmod +x /tmp/nodesource_setup.sh
60-
sudo /tmp/nodesource_setup.sh
61-
sudo apt-get install nodejs -y
62-
node --version
63-
> v18.15.0
64-
```
54+
1. Install Node.js (https://nodejs.org/)
6555

6656
2. Clone this repository
6757

@@ -95,14 +85,14 @@ npm install
9585
# configure to use feeder account
9686
npm start add-key
9787

98-
# start voting
88+
# start voting (note: multiple lcd-url and validators can be specified)
9989
$ npm start vote -- \
100-
-d http://localhost:8532/latest \
90+
--data-source-url http://localhost:8532/latest \
10191
--lcd-url https://terra-classic-lcd.publicnode.com \
92+
--lcd-url https://lcd.terraclassic.community \
10293
--chain-id columbus-5 \
103-
--validators terravaloper1xx \
104-
--validators terravaloper1yy \
105-
--password "<password>"
94+
--validators <terravaloper address> \
95+
--password <password>
10696
```
10797

10898
### Cheat Sheet:

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ services:
1515
environment:
1616
- ORACLE_FEEDER_DATA_SOURCE_URL=http://oracle-price-server:8532/latest
1717
- ORACLE_FEEDER_PASSWORD=password
18-
- ORACLE_FEEDER_MNENOMIC=mnemonic
19-
- ORACLE_FEEDER_VALIDATORS=terravaloper1xxx
18+
- ORACLE_FEEDER_MNENOMIC=word1 word2...
19+
- ORACLE_FEEDER_VALIDATORS=terravaloper1...
2020
restart: always
2121
networks:
2222
- terra-classic
2323

2424
networks:
2525
terra-classic:
26-
driver: bridge
26+
driver: bridge

feeder/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ENV ORACLE_FEEDER_CHAIN_ID=columbus-5
88
ENV ORACLE_FEEDER_KEY_NAME=voter
99
ENV ORACLE_FEEDER_KEY_PATH=voter.json
1010
ENV ORACLE_FEEDER_COIN_TYPE=330
11-
ENV ORACLE_FEEDER_ADDR_PREFIX="terra"
11+
ENV ORACLE_FEEDER_ADDR_PREFIX=terra
1212

1313
WORKDIR /app
1414

feeder/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ You can start feeder with arguments or env.
5959
-d http://localhost:8532/latest \
6060
--lcd-url https://lcd.terraclassic.community \
6161
--chain-id colmbus-5 \
62-
--validators anrvaloper1xx \
63-
--validators anrvaloper1yy \
64-
--password "<password>"
62+
--validators terravaloper1xx \
63+
--validators terravaloper1yy \
64+
--password <password>
6565
```
6666

6767
* Env
@@ -77,9 +77,9 @@ You can start feeder with arguments or env.
7777
| `data-source-url` | `ORACLE_FEEDER_DATA_SOURCE_URL` | Price server URL. | http://localhost:8532/latest |
7878
| `lcd-url` | `ORACLE_FEEDER_LCD_ADDRESS` | LCD server URL (can be multiple) | https://lcd.terraclassic.community |
7979
| `chain-id` | `ORACLE_FEEDER_CHAIN_ID` | Chain ID. | `colmbus-5 ` |
80-
| `validators` | `ORACLE_FEEDER_VALIDATORS` | Validator to submit prices for (can be multiple) | `anrvaloper1xx...` |
80+
| `validators` | `ORACLE_FEEDER_VALIDATORS` | Validator to submit prices for (can be multiple) | `terravaloper1xx...` |
8181
| `key-name` | `ORACLE_FEEDER_KEY_NAME` | name to be given to the key that will be encrypted in file| `voter` |
82-
| `coin-type` | `ORACLE_FEEDER_COIN_TYPE` | coin type used to derive the public address (default 118) | `118` |
82+
| `coin-type` | `ORACLE_FEEDER_COIN_TYPE` | coin type used to derive the public address (default 330) | `330` |
8383
| `key-path` | `ORACLE_FEEDER_KEY_PATH` | signing key store path (default voter.json) | `voter.json` |
84-
| Unsupported | `ORACLE_FEEDER_ADDR_PREFIX` | | `` |
84+
| Unsupported | `ORACLE_FEEDER_ADDR_PREFIX` | | `terra` |
8585
| Unsupported | `ORACLE_FEEDER_IV_SALT` | salt used in IV vector | `myHashedIV` |

feeder/src/addKey.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as keystore from './keystore'
22
import * as promptly from 'promptly'
33

4-
export async function addKey(filePath: string, coinType: string, keyName: string, prefix: string): Promise<void> {
4+
export async function addKey(filePath: string, coinType: string, keyName: string): Promise<void> {
55
let password = process.env.ORACLE_FEEDER_PASSWORD || ''
66
let mnemonic = process.env.ORACLE_FEEDER_MNENOMIC || ''
77

@@ -34,10 +34,6 @@ export async function addKey(filePath: string, coinType: string, keyName: string
3434
return
3535
}
3636

37-
if (!prefix) {
38-
prefix = await promptly.prompt(`\nEnter the address prefix: `)
39-
}
40-
41-
await keystore.save(filePath, keyName, password, mnemonic, coinType, prefix)
37+
await keystore.save(filePath, keyName, password, mnemonic, coinType)
4238
console.info(`saved!`)
4339
}

feeder/src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function registerCommands(parser: ArgumentParser): void {
3232
required: false,
3333
})
3434

35-
voteCommand.addArgument([`--validators`], {
35+
voteCommand.addArgument([`-v`, `--validators`], {
3636
action: `append`,
3737
help: `validators address (e.g. terravaloper1...), can have multiple`,
3838
dest: `validators`,
@@ -96,9 +96,8 @@ async function main(): Promise<void> {
9696
registerCommands(parser)
9797
const args = parser.parseArgs()
9898

99-
args.prefix = args.prefix || process.env.ORACLE_FEEDER_ADDR_PREFIX || process.env.ADDR_PREFIX
100-
10199
if (args.subparser_name === `vote`) {
100+
args.prefix = args.prefix || process.env.ORACLE_FEEDER_ADDR_PREFIX
102101
args.lcdUrl =
103102
args.lcdUrl || (process.env.ORACLE_FEEDER_LCD_ADDRESS && process.env.ORACLE_FEEDER_LCD_ADDRESS.split(',')) || []
104103

@@ -126,7 +125,7 @@ async function main(): Promise<void> {
126125

127126
await vote(args)
128127
} else if (args.subparser_name === `add-key`) {
129-
await addKey(args.keyPath, args.coinType, args.keyName, args.prefix)
128+
await addKey(args.keyPath, args.coinType, args.keyName)
130129
}
131130
}
132131

feeder/src/keystore.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ interface Entity {
1313

1414
interface PlainEntity {
1515
privateKey: string
16-
publicKey: string
17-
terraAddress: string
18-
terraValAddress: string
1916
}
2017

2118
const ivSalt = process.env.ORACLE_FEEDER_IV_SALT || 'myHashedIV'
@@ -60,8 +57,7 @@ export async function save(
6057
name: string,
6158
password: string,
6259
mnemonic: string,
63-
coinType: string,
64-
prefix: string
60+
coinType: string
6561
): Promise<void> {
6662
if (!fs.existsSync(filePath)) {
6763
fs.writeFileSync(filePath, '')
@@ -78,8 +74,6 @@ export async function save(
7874
const ciphertext = encrypt(
7975
JSON.stringify({
8076
privateKey: mnemonicKey.privateKey.toString(`hex`),
81-
terraAddress: mnemonicKey.accAddress,
82-
terraValAddress: mnemonicKey.valAddress,
8377
}),
8478
password
8579
)

0 commit comments

Comments
 (0)