An on-chain component that retrieves price data from the sidecar with each block, forwards these prices to the blockchain through vote extensions, and compiles prices from all validators involved.
A sidecar process dedicated to polling price information from various providers and delivering this data to the on-chain component.
1. Clone the Repository and build binaries
# Clone repository
cd $HOME
rm -rf slinky
git clone https://github.com/skip-mev/slinky.git
cd slinky
git checkout v0.4.3
# Build binaries
make build
# Move binary to local bin
mv build/slinky /usr/local/bin/
rm -rf build
Upon launching the oracle, you should observe successful price retrieval from the provider sources. Additionally, you have the option to execute the test client script available in the Slinky repository by using the command:
make run-oracle-client
4. Enable Oracle Vote Extension
In order to utilize the Slinky oracle data in the Initia node, the Oracle setting should be enabled in the config/app.toml file.
###############################################################################
### Oracle ###
###############################################################################
[oracle]
# Enabled indicates whether the oracle is enabled.
enabled = "true"
# Oracle Address is the URL of the out of process oracle sidecar. This is used to
# connect to the oracle sidecar when the application boots up. Note that the address
# can be modified at any point, but will only take effect after the application is
# restarted. This can be the address of an oracle container running on the same
# machine or a remote machine.
oracle_address = "127.0.0.1:8080"
# Client Timeout is the time that the client is willing to wait for responses from
# the oracle before timing out.
client_timeout = "500ms"
# MetricsEnabled determines whether oracle metrics are enabled. Specifically
# this enables instrumentation of the oracle client and the interaction between
# the oracle and the app.
metrics_enabled = "false"
5. Check the service logs
journalctl -fu slinky --no-hostname
Example Output
Jun 09 16:28:32 slinky[594]: {"level":"info","ts":"2024-06-09T16:28:32.242+0800","caller":"oracle/oracle.go:163","msg":"oracle updated prices","pid":594,"process":"oracle","last_sync":"2024-06-09T08:28:32.242Z","num_prices":65}
Jun 09 16:28:32 slinky[594]: {"level":"info","ts":"2024-06-09T16:28:32.487+0800","caller":"oracle/oracle.go:163","msg":"oracle updated prices","pid":594,"process":"oracle","last_sync":"2024-06-09T08:28:32.487Z","num_prices":65}
Jun 09 16:28:32 slinky[594]: {"level":"info","ts":"2024-06-09T16:28:32.736+0800","caller":"oracle/oracle.go:163","msg":"oracle updated prices","pid":594,"process":"oracle","last_sync":"2024-06-09T08:28:32.736Z","num_prices":65}
Jun 09 16:28:32 slinky[594]: {"level":"info","ts":"2024-06-09T16:28:32.985+0800","caller":"marketmap/fetcher.go:116","msg":"successfully fetched market map data from module; checking if market map has changed","pid":594,"process":"provider_orchestrator"}
Jun 09 16:28:32 slinky[594]: {"level":"info","ts":"2024-06-09T16:28:32.987+0800","caller":"oracle/oracle.go:163","msg":"oracle updated prices","pid":594,"process":"oracle","last_sync":"2024-06-09T08:28:32.987Z","num_prices":65}
Jun 09 16:28:33 slinky[594]: {"level":"info","ts":"2024-06-09T16:28:33.236+0800","caller":"oracle/oracle.go:163","msg":"oracle updated prices","pid":594,"process":"oracle","last_sync":"2024-06-09T08:28:33.236Z","num_prices":65}