npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mycelium-ethereum/swaps-keepers

v2.0.1-alpha.0

Published

A collection of keeper bots for Tracer's Total Return Swaps

Downloads

30

Readme

Swaps-Keepers

Setting up the Environment

To setup the environment, copy the env.example file to .env and set the variables.

| Variable Name | Description | |--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| | RPC_URL | A url to make RPC requests. Can either be wss or https | | FALLBACK_RPC_URL | A fallback url to make RPC requests. Can be either wss or https | | PRIVATE_KEY | The private key of the liquidator wallet. This will need to be set in the PositionManager.sol contract. This can be checked by calling the isLiquidator method. | | VAULT_PRICE_FEED | Address for the VaultPriceFeed.sol contract | | POSITION_ROUTER | Address for the PositionRouter.sol contract | | MAX_EXECUTION_RETRY | The max amount of times the PositionKeeper will try and execute positions. This is reset each time a new order comes in and is to prevent infinite retries. Defaults to 5 | | MAX_EXECUTABLE_CHUNK | The max amount of orders included in an execution chunk. Since execution is unbounded there were network errors when executing to many orders and receivung to many event logs in return. Defaults to 25 | | POSITION_KEEPER_INTERVAL_MS | Interval for the keeper to check if there are any outstanding orders. Defaults to 20 seconds | | MAX_EXECUTION_RETRY | The max amount of times the PositionKeeper will try and execute positions. This is reset each time a new order comes in and is to prevent infinite retries. Defaults to 5 | | MAX_EXECUTABLE_CHUNK | The max amount of orders included in an execution chunk. Since execution is unbounded there were network errors when executing to many orders and receivung to many event logs in return. Defaults to 25 | | PRICE_KEEPER_FORCE_UDPATE_INTERVAL_MS | If there are no price updates and this interval is reached it will force and update. Defaults to 5 minutes | | PRICE_KEEPER_INTERVAL_MS | Interval for the keeper to check if there are any outstanding orders. Defaults to 20 seconds |

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 swaps-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 swaps-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" swaps-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" swaps-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>" swaps-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>" swaps-watcher

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

Push New GCP Image

  • npm run docker:build-keepers
  • docker tag swaps-keepers gcr.io/avian-direction-235610/swaps-keepers:version
  • `docker push gcr.io/avian-direction-235610/swaps-keepers:version