Cover Router
Computes the optimal capacity allocation in order to get the best price on cover purchases.
Table of Contents
Setup
git clone git@github.com:NexusMutual/cover-router.git
cd cover-router && npm ci
cp .env.sample .env
- Set environment variables in .env:
- CONCURRENCY_NUMBER= number of concurrent products to process for faster startup
- PROVIDER_URL - use either Infura or Alchemy
- PORT= port number for the server
- To run the server
npm run start
Note: if running the server in nodemon(dev), change the destination of persisted data so the server wouldn't
restart constantly
Usage
Quote Route
- URL:
/v2/quote
- Method:
GET
- OpenAPI: v2/api/docs/#/Quote/get_v2_quote
- Description: The quote route uses a product id, a period and the cover amount for a given cover asset to return premium and the
best available combination of pools for the premium.
- Quote Engine: Calculation is based on batching the current capacities and mapping them with the
price per pool, then the cheapest capacity is selected, and remapped if the whole cover amount is not covered by the
cheapest capacity.
Capacity Route
- URL:
/v2/capacity
- Method:
GET
- OpenAPI: v2/api/docs/#/Capacity/get_v2capacity
- Description: Returns the current capacity for all products for a period of 30 days if no period query param is specified.
Capacity Route for a specific product