linkedin logogithub logo
left arrow
SEE ALL POST

Terrae #11 Swap in the DEX

Swap in the DEX, trade tokens and NFTs, rise your empire and fight in battles to earn crypto!
Key Points

DEXs (Decentralized Exchanges) are online platforms where cryptoactive exchanges can be carried out without the participation of intermediaries.

Terrae’s DEX

These can be funded only with crypto assets. There, the operations are Peer-to-Peer, that is, from person to person. It does not require an account or any type of verification to operate. The only condition is to have a wallet that is linked to the DEX in question.

DEXs offer various trading and investment modalities. They work with smart contracts programmed in advance so that users can carry out operations without any inconvenience.

Terrae DEX implements Uniswap V2 contracts. It consists of an automatic liquidity protocol, which determines prices using a constant product formula and implemented in a set of non-updatable smart contracts. This eliminates the need for trust relationships, providing decentralization, security, and censorship resistance.

Pairs of ERC20 tokens can be defined on Terrae DEX. Each pair manages a liquidity pool based on reserves of the two tokens. Through these pairs, one token can be exchanged for another. Tokens can also be exchanged through the creation of routes between tokens, however defining direct liquidity pairs reduces exchange costs.

Anyone can become a liquidity provider, adding an equivalent value of each corresponding token to the pair. Furthermore, each pair acts as a market maker, receiving an amount of one token and delivering the equivalent of the other token, always respecting the constant product formula.

The formula can be expressed as x * y = k. This formula states that transactions must not change the product k of the reserve balances of the pair x and y.

A commission of 0.3% is applied for each transaction, which is added to the reserves and used as payment to the liquidity providers at the moment they withdraw their tokens from the liquidity pool and as rewards to game winners.

Terrae DEX implements the Pair, Factory and Router contracts.

Pair: It implements the exchange protocol and keeps track of the balance available in the pool.

Factory: Deploy a Pair contract for each pair of ERC20 tokens.

Router: Provides token swap functionality and liquidity management (add/remove liquidity) securely. It natively supports the exchange of tokens through routes (TokenA to TokenB to TokenC), useful in case there is no TokenA/TokenC pair.

In the v0 (initial version) users will be able to swap between MATIC and DENI. There, they will be able to obtain their DENI to introduce them in the Liquidity Pool if they wish, which is also included in the v0.

Denaris ($DENI) is an ERC20 token, the main currency of Terrae. In genesis 50M tokens are minted, and not a single coin will ever be produced. On the contrary, in burning events tokens will be destroyed, which generates a deflationary economy. The amount of tokens burned depends on the trading activity in the swap pools.

Denaris, the coin minted by common agreement among free peoples.

The liquidity providers in the swap pools will be able to stake LP tokens in House Farms where returns in $DENI can be obtained.

While $DENI will initially be a financial speculative element, over time it will take on utilitarian value as the Terrae game develops.

$DENI main uses cases will be:

  • to acquire lands.
  • to acquiere NFTs (knights, heroes, wizards) in presales.
  • to trade on the P2P marketplace.
  • to swap resources (gold, stone, wood, others) in pools.
  • to inject liquidity in pair pools and earn yield on LPs.
  • to lend/borrow from Bank.
  • as a governance token.
Vault full of DENI coins held by the Reserve of the Free Peoples.

Swap $DENI in the pools, inject liquidity, and get return on farms by staking your LP positions.

Macarena López Morillo
Head of People
Get the Full Picture
For an in-depth understanding of this topic, don't miss out. Learn more here and elevate your knowledge.
right arrow

Meet the author

Priscila Malnero
Marketing @ Rather Labs

Web3 —
Blockchain Technical Partners

Uncover our Web3 creations and discover how we're redefining tomorrow.
Learn More
left arrow
SEE ALL POST

Blog posts you might like