0.0.4 • Published 2 years ago

@tracer-protocol/trs-keepers v0.0.4

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

TRS-Keepers

Setup

Install and Build

yarn
yarn run build

Watcher Specific Variables.

These variables are specific to the Watcher. If you don't set them, defaults are in place.

WATCHER_STALE_THRESHOLD = Time in seconds before the Median price is considered stale in the watcher. Default = 5s
WATCHER_PRICE_DIFF_THRESHOLD = Percent (in 10^18 units) deviation that is acceptable between the median price and keeper price. Default = 5% (0.05×10^18)

Docker

Make sure you have docker installed on your machine or environment. You can check you have docker by running docker -v in your terminal of choice.

Create a trs-keepers docker image with npm run docker:build-keepers or yarn docker:build-keepers. This images starts a PriceKeeper and PositionKeeper. Create a watcher docker image with npm run docker:build-watcher or yarn docker:build-watcher.

The created image does not include the required env variables OR any of the optional watcher variables.

  • RPC_URL - Network RPC (required)
  • SIGNING_PRIVATE_KEY - permissioned account to call updatePrices (required)
  • PRICE_FEED - price feed contract address (required)
  • POSITION_ROUTER - position router contract address (required only for trs-keepers)

Run the image

Start running the PriceKeeper and PositionKeeper

  • on Arbitrum docker run -p 9111:9111 -e ARBITRUM_RPC="https://arb1.arbitrum.io/rpc" -e SIGNING_PRIVATE_KEY="A_PERMISSIONED_PRIVATE_KEY" -e PRICE_FEED="priceFeed address" -e POSITION_ROUTER="positionRouter address" trs-keepers
  • on Arbitrum rinkeby docker run -p 9111:9111 -e ARBITRUM_TESTNET_RPC="https://rinkeby.arbitrum.io/rpc" -e SIGNING_PRIVATE_KEY="A_PERMISSIONED_PRIVATE_KEY" -e PRICE_FEED="priceFeed address" POSITION_ROUTER="positionRouter address" trs-keepers

Start running the Watcher

  • on Arbitrum docker run -e NETWORK="42161" -e ARBITRUM_RPC="https://arb1.arbitrum.io/rpc" -e SIGNING_PRIVATE_KEY="<A_PERMISSIONED_PRIVATE_KEY>" trs-watcher
  • on Arbitrum rinkeby docker run -e NETWORK="421611" -e ARBITRUM_TESTNET_RPC="https://rinkeby.arbitrum.io/rpc" -e SIGNING_PRIVATE_KEY="<A_PERMISSIONED_PRIVATE_KEY>" trs-watcher

There is also the option of using a custom/private RPC in place of the public ones used here.