Leonicorn Architecture And Design

Leonicorn DEX platform comprizes of the following software components:

  • 1.Leonicorn-frontend
  • 2.Leonicorn-uikit
  • 3.Leonicorn-sdk
  • 4.Leonicorn-farming
  • 5.Leonicorn-swap
  • 6.Leonicorn-lottery

Following block diagram shows basic interactions of the above components.


Leonicorn-farming is the main componenet of the DEX which comprizes of major modules for farming/meat and pools/caves. Following are the components of this module.

  • 1.LeonToken contract
  • 2.MasterHunter contract

LeonToken contract creates LEON BEP-20 token. LEON token is the native token of Leonicorn DEX. It is used as the token for most of the transactions on Leonicorn.

MasterHunter is the main contract for farms and pools. It allows to farm and stake LP tokens and single tokens like LEON and LEOS. LEON tokens are given as rewards for farming and staking.

MasterHunter creates a default pool for LEON single staking on its initialization and exposes interfaces to create more pools and farms. It also exposes APIs for user to deposit LP tokens and single tokens into farms and pools. APIs allow users to withdraw from framing/staking any time.


Leonicorn-swap component contains contracts for DEX’s token swap feature. It is based on UniswapV2 contract modules. It compizes of following contract modules.

  • *Leonicorn-core
  • *Leonicorn-periphery

Leonicorn-core contains contracts that deal with main token swapping functonality. LeonicornFactory is a simple contract to launch a token swap pair contract LeonicornPair. LeonicornFactory uses ethereum ‘create2’ opcode to launch a swap pair contract at fixed, predictable address, hence the contract address is calcualted easily.

LeonicornPairV2 contract contains core swap functionality. A new LeonicornPairV2 contract is luanched per each pair of tokens. It exposes APIs for swapping, getting reserves of the pair pool and APIs for miniting and burning LP tokens when liquidity is added. On each swap a small percentage of transaction fee is applied on the input token which will be distributed for liquidity providers.

Leonicorn-periphery contract is the fronend contract for any swap functions. UI/users interace with this contract directly for any swapping instead of LeonicornPairV2 contract. It exposes functions like addLiquidity, removeLiquidity, different swap variants, getAmountsOut, getAmountsIn etc. Leonicorn-frontend calls these API for any user interactions with swap components. There are two more contracts, LeonicornLibrary and LeonicornHelper, which provide some utility functions for Leonicorn-periphery.


Leonicorn-lottery component contains contracts for Leonicorn lottery feature. Users enter into the lottery by staking LEON tokens. Users choose a six-digit random number as the winning number. Leonicorn-lottery contracts generates a six-digit random number, using Chainlink VRF random number oracle contracts, at the lottery withdraw time. Based the generated numbers winner are chosen and LEON tokens will be rewarded to the winners.

Leonicorn Single Staking

Leonicorn single staking is used to lock LEOS token for prescribed time duration like 30 Days, 60 Days, 90 Days, 180 Days and 365 Days and users will get respective rewards based on their locked duration. This staking is different from DEX staking as this staking will be locked for respective time and users can’t unlock in the middle of duration. Rewards will be in LEOS.