A console application for automating interactions with the Ajna decentralized lending protocol.
- Each instance of the keeper connects to exactly one chain using a single RPC endpoint. The same keeper instance may interact with multiple pools on that chain.
- Pool addresses must be configured. Allowing them to be configured via token name (via subgraph) introduces risk, as a bad actor could create a pool using fake tokens with the same name.
- Each instance of the keeper may unlock only a single wallet using a JSON keystore file. As such, if running multiple keepers on the same chain, different accounts should be used for each keeper to avoid nonce conflicts.
- For simplicity, price sources are configured per-pool, not separately for each action. This means if you will
kick
andarbtake
the same pool, both actions must be based upon the same configured price.
For each desired chain:
- A JSON-RPC endpoint is needed to query pool data and submit transactions.
- A subgraph connection is needed to iterate through buckets/borrowers/liquidations within a configured pool.
- Funds used to pay gas on that chain.
- Funds (quote token) to post liquidation bonds in each pool configured to kick.
Starts a liquidation when a loan's threshold price exceeds the lowest utilized price in the pool by a configurable percentage.
When auction price drops a configurable percentage below the highest price bucket, exchanges quote token in that bucket for collateral, earning a share of that bucket.
You'll need node
and related tools (npm
, yarn
). This was developed with node v18.20.x but should work with later versions.
yarn --frozen-lockfile
- coingecko - using their simple price API
- fixed - hardcoded number, useful for stable pools
- pool - can use lup or htp
If the price source only has quote token priced in collateral, you may add "invert": true
to price
config to invert the configured price.
yarn start --config my-config.json
In one terminal run:
npx hardhat node
In a second terminal run:
npx hardhat test
User assumes all risk of data presented and transactions placed by this keeper.