@@ -22,12 +22,23 @@ This approach is useful for protocols that already depend on regular push update
22
22
The price pusher service monitors both the off-chain and on-chain Pyth price for a configured set of price feeds.
23
23
It then pushes a price update to an on-chain Pyth contract if any of the following conditions are met:
24
24
25
- - Time difference: The on-chain price is older than ` time-difference ` seconds
25
+ - Time difference: The on-chain price is older than ` time_difference ` seconds
26
26
from the latest Pyth price.
27
- - Price deviation: The latest Pyth price feed has changed more than ` price-deviation ` percent
27
+ - Price deviation: The latest Pyth price feed has changed more than ` price_deviation ` percent
28
28
from the on-chain price feed price.
29
29
- Confidence ratio: The latest Pyth price feed has confidence to price ratio of more than
30
- ` confidence-ratio ` .
30
+ ` confidence_ratio ` .
31
+
32
+ The parameters above are configured per price feed in a price configuration YAML file. The structure looks like this:
33
+
34
+ ``` yaml
35
+ - alias : A/USD # Arbitrary alias for the price feed. It is used in enhance logging.
36
+ id : 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef # id of a price feed, a 32-byte hex string.
37
+ time_difference : 60 # Time difference threshold (in seconds) to push a newer price feed.
38
+ price_deviation : 0.5 # The price deviation (%) threshold to push a newer price feed.
39
+ confidence_ratio : 1 # The confidence/price (%) threshold to push a newer price feed.
40
+ - ...
41
+ ` ` `
31
42
32
43
To run the price pusher, please run the following commands, replacing the command line arguments as necessary:
33
44
@@ -36,8 +47,7 @@ npm install # Only run it the first time
36
47
37
48
npm run start -- --evm-endpoint wss://example-rpc.com --mnemonic-file "path/to/mnemonic.txt" \
38
49
--pyth-contract example_network --price-endpoint https://example-pyth-price.com \
39
- --time-difference 60 --price-deviation 0.5 --confidence-ratio 5 \
40
- --price-ids " abcd..." " efgh..." " ..." \
50
+ --price-config-file "path/to/price-config-file.yaml" \
41
51
[--cooldown-duration 10] \
42
52
[--evm-polling-frequency 5]
43
53
```
@@ -50,7 +60,7 @@ The program accepts the following command line arguments:
50
60
the price pusher will use event subscriptions to read the current EVM price. If you provide a normal
51
61
HTTP endpoint, the pusher will periodically poll for updates. The polling interval is configurable via
52
62
the ` evm-polling-frequency ` command-line argument (described below).
53
- - ` mnemonic-file ` : Payer mnemonic (private key) file.
63
+ - ` mnemonic-file ` : Path to payer mnemonic (private key) file.
54
64
- ` pyth-contract ` : The Pyth contract address. Provide the network name on which Pyth is deployed
55
65
or the Pyth contract address if you use a local network.
56
66
You can find the networks on which pyth is live and their corresponding names
@@ -59,11 +69,7 @@ The program accepts the following command line arguments:
59
69
` https://prices.testnet.pyth.network ` for testnet and
60
70
` https://prices.mainnet.pyth.network ` for mainnet. It is recommended
61
71
to run a standalone price service for more resiliency.
62
- - ` price-ids ` : Space separated price feed ids (in hex) to push. List of available
63
- price feeds is available in the [ price feed ids page] [ ] .
64
- - ` time-difference ` : Time difference threshold (in seconds) to push a newer price feed.
65
- - ` price-deviation ` : The price deviation (%) threshold to push a newer price feed.
66
- - ` confidence-ratio ` : The confidence/price (%) threshold to push a newer price feed.
72
+ - ` price-config-file ` : Path to price configuration YAML file.
67
73
- ` cooldown-duration ` (Optional): The amount of time (in seconds) to wait between pushing
68
74
price updates. It should be greater than the block time of the network, so this
69
75
program confirms the price is updated and does not push it twice. Default: 10 seconds.
@@ -80,6 +86,8 @@ For example, to push `BTC/USD` and `BNB/USD` prices on BNB testnet, run the foll
80
86
``` sh
81
87
npm run start -- --evm-endpoint " https://data-seed-prebsc-1-s1.binance.org:8545" --mnemonic-file " path/to/mnemonic.txt" \
82
88
--pyth-contract bnb_testnet --price-endpoint https://prices.testnet.pyth.network \
83
- --price-ids " f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b" " ecf553770d9b10965f8fb64771e93f5690a182edc32be4a3236e0caaa6e0581a" \
84
- --time-difference 60 --price-deviation 0.5 --confidence-ratio 1
89
+ --price-config-file " price-config.testnet.sample.yaml"
85
90
```
91
+
92
+ [ ` price-config.testnet.sample.yaml ` ] ( ./price-config.testnet.sample.yaml ) contains configuration for ` BTC/USD `
93
+ and ` BNB/USD ` price feeds on Pyth testnet.
0 commit comments