Kolektivo Docs
  • 🏁Getting Started
  • 🌱Introduction
    • The Kolektivo Framework
    • The Kolektivo Network
    • Kolektivo Curaçao
  • 🛠️Tools
    • Live Tools
      • Wallet
      • Reserve
      • Community Currency
    • Upcoming Tools
      • Treasury
      • BADGER Governance Tools
      • Ecological Tools
        • Geospatial Non-Fungible Token
        • The Impact Map
    • Framework Tokens
      • Network Token
      • Treasury Token
      • Reserve Token
      • Community Currency
      • Geospatial Non-Fungible Token
      • Ecological Tokens
  • 💻Advanced
    • Smart Contracts
      • Monetary System
        • Reserve
        • Mento
        • Treasury
        • Liquidity Pools
      • BADGER Governance System
    • Wallet Code
    • Developer Guides
    • Deployment Addresses
  • 📑Resources
  • 🔖Glossary
Powered by GitBook
On this page
  • Summary
  • Module Details
  • Mento
  • Exchange
  • Registry
  • Mento Reserve
  • Stable Token
  • kCUR Oracle
  • Back-End Services
  • Mento Arbitrage Service
  • Mento SortedOracle Service
  • Failure Modes

Was this helpful?

  1. Advanced
  2. Smart Contracts
  3. Monetary System

Mento

PreviousReserveNextTreasury

Last updated 2 years ago

Was this helpful?

This section describes the state of the contracts as of April 2023.

  • Module Name: Mento Module

  • Contract Sources:

    • Oracles

Table of Contents

Summary

Module Details

Our deployment of the Mento module has 4 core components consisting of the original Exchange.sol, Registry.sol, and Reserve.solcontracts from the Celo Mento Protocol, as well as the KolektivoGuilder.sol contract, which is our interpretation of the StableToken.sol contract from the Celo Mento Protocol. On top of this, oracles update the contracts with crucial data, and a back-end service is being run.

Mento

Exchange

Registry

Mento Reserve

Stable Token

kCUR Oracle

Back-End Services

As of April 2023, Kolektivo deployed a number of off-chain backend services that will observe specific contracts and APIs, execute transactions and reports asset data on-chain.

Mento Arbitrage Service

Summary

For the Mento Module, we need a Mento Exchange Arbitrage Service as back-end service to make sure that the kCUR-kG ratio remains close to what it has been set at, and that kG remains pegged to ANG. For that, the service queries the price of kCUR, ANG, as well as the kCUR-kG ratio, and is able to conduct buy or sell orders to balance the kCUR-kG ratio so that kG stays pegged to ANG.

Functions

  • The service queries the price of kCUR from the kCUR oracle periodically.

  • The service queries the price of ANG denominated in dollar from a public API periodically.

  • The service queries the current kCUR-kG ratio from the MentoExchange.sol contract.

  • The service is able to evaluate the ratio of kG to kCUR, based on the price of kCUR and ANG.

  • The service is able to decide to buy or sell to balance the ratio of kCUR-kG so that kG stays pegged to the Guilder.

  • The service is able to buy and sell, to and from, the Symmetric kCUR pool.

  • The service is able to buy and sell, to and from, the Symmetric kG pool.

Mento SortedOracle Service

Summary

This back-end service is to be differentiated from the Reserve Oracles. It enables to convey the kG to kCUR exchange rate to the Mento system — rather than a token USD price. The kG to kCUR exchange rate conveys how many kGs are needed to buy a single kCUR — e.g. if the exchange rate is expressed as 1.33, that means it costs 1.33 kG to get 1 kCUR.

Assuming that the USD price of kG is $0.5586592178770949, the exchange rate is computed as:

rate = 1 / (0.5586592178770949 / kCurPrice)

Since we only care about buying one kCur, there is nothing to multiply, the amount of required kG is the rate. This rate is what is then reported to the Mento Oracle.

Functions

  • The service is able to get the address of the SortedOracles contract.

  • The service is able to compute the exchange rate as given above.

  • The service is able to call report on the address of the SortedOracles contract.

Failure Modes

Please note that this experimental MVP software is provided on an "as is" and "as available" basis. As this module is an first attempt, be aware that different failures may occur. We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.

This module is the deployment of the single collateral from Celo, where the reserve token is presumably used as the backing token for a community currency (e.g. kCUR for kGuilder). A good explanation of the behavior of the Mento stability algorithm can be found in . A good overall intro to the mechanism behind this can be found in this . The contracts themselves are , which already contains some elements of .

The MentoExchange.sol contract that Kolektivo deployed takes root in the from Mento. The language has been updated to the latest version of Solidity — i.e. from Solidity 0.5.13 to 0.8.10. In the context of the Kolektivo MVP, this contract serves as a trading interface between the Kolektivo Guilder (kG) and the Kolektivo Reserve Token (kCUR) using a Constant Product Market Maker Model. In this sense, it is easily comparable to a pool.

The MentoRegistry.sol contract that Kolektivo deployed takes root in the original from Mento. The language has been updated to the latest version of Solidity — i.e. from Solidity 0.5.13 to 0.8.10. This contract is fundamental for the good functioning of the Mento Module as it registers and stores addresses, and associates them with identifiers.

The MentoReserve.sol contract that Kolektivo deployed takes root in the original contract from Mento. The language has been updated to the latest version of Solidity — i.e. from Solidity 0.5.13 to 0.8.10. This contract stores and manages assets, and ensures the price stability of the stable tokens with respect to their pegs. This contract also introduces parametrizable economic parameters, such as a Tobin Tax (tobinTax), or daily spending limits (spendingRatio).

The KolektivoGuilder.sol contract that Kolektivo deployed takes root in the original contract from Mento. The language has been updated to the latest version of Solidity — i.e. from Solidity 0.5.13 to 0.8.10. In Celo Mento, StableToken implements ERC-20 tokens and Celo-specific features for stable assets. Each stable asset has its own contract, with StableToken.sol for the Celo Dollar, StableTokenEUR.sol for the Celo Euro, and so forth for new stable assets. TheKolektivoGuilder.sol is the Kolektivo Guilder (kG): An ERC-20 with a parametrizable notion of inflation and freezing options. The contract is ownable and in the context of the Kolektivo Minimum Viable Product (MVP), managed by the Kolektivo multi-sig.

On top of being extensively used in the Reserve module, the kCUR oracle is also fundamental in the context of the Mento module. A kCUR Data Provider regularly pushes reports about the state of kCUR's price in the kCUR Symmetric pool to the kCUR oracle. The MentoExchange.sol contract queries the kCUR oracle to be updated about the state of kCUR's price. This protects the Mento Exchange from arbitrage opportunities that could occcur in the case of wrong token price reporting.

You can find the audits for the Mento Protocol v1.0.0 , and the audits for the Mento Protocol v2.0.0 .

💻
Mento system
this paper
article
on Github
Granda Mento
Exchange.sol
UsingRegistryV2.sol
Reserve.sol
StableToken.sol
here
here
Summary
Module Details
Mento
Exchange
Registry
Reserve
Stable Token
kCUR Oracle
Back-End Services
Mento Arbitrage Service
Mento SortedOracle Service
back-end service
MentoExchange.sol
MentoRegistry.sol
MentoReserve.sol
KolektivoGuilder.sol
celo-monorepo/packages/protocol/contracts/stability at master · celo-org/celo-monorepoGitHub
You can consult the original Mento contracts on the Celo GitHub
https://github.com/Kolektivo/kolektivo-monetary-contracts/blob/development/src/mento/MentoExchange.solgithub.com
https://github.com/Kolektivo/kolektivo-monetary-contracts/blob/development/src/mento/MentoRegistry.solgithub.com
https://github.com/Kolektivo/kolektivo-monetary-contracts/blob/development/src/mento/MentoReserve.solgithub.com
https://github.com/Kolektivo/kolektivo-monetary-contracts/blob/development/src/mento/StableTokenKG.solgithub.com
Logo
Zoom in the Mento Module.