MANTRA Dex

MANTRA DEX is based on White Whale V2. The protocol is built around singleton contracts, which makes it easier to manage and integrate with other protocols.

The following is the architecture of MANTRA DEX, and a general description of each contract:

The direction of the arrows represents the dependencies between the contracts.

Pool Manager

The Pool Manager is the contract that manages the pools in the DEX. It is responsible for creating pool and handling swaps. Pool creation is permisionless, meaning anyone can create a pool if the fee is paid. The Pool Manager depends on the Farm Manager and the Fee Collector.

Farm Manager

The Farm Manager is the contract that manages the farms in the protocol. It is responsible for creating and distributing farms on pools. Farm creation is permissionless, meaning anyone can create a farm if the fee is paid. The Farm Manager depends on the Epoch Manager, as farm rewards are distributed based on epochs.

Fee Collector

The Fee Collector collects the fees accrued by the protocol. Whenever a pool or a farm is created, a fee is sent to the Fee Collector. As of now, the Fee Collector does not have any other function.

Epoch Manager

The Epoch Manager is the contract that manages the epochs in the protocol. Its single responsibility is to create the epochs, which are used by the Farm Manager for distributing farm rewards.

Instantiation

Based on the dependencies between the contracts, the instantiation of the contracts follows the following order:

  • Epoch Manager

  • Fee Collector

  • Farm Manager

  • Pool Manager

Note: Do not forget to add the Farm Manager as a hook on the Epoch Manager once created.

Last updated