Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions developers/mento-core/smart-contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ The Mento protocol consists of a set of smart contracts, which are deployed on t

### Smart Contracts

****[**Broker**](broker/) is the entry point for interacting with the protocol. It is responsible for managing reserve assets and is the only contract with spender rights of the reserve as well as minting and burning rights over stable assets. For pricing trades, it relies on exchange providers like BiPoolManager.sol. When executing swaps, it enforces trading limits. The Broker also exposes a burn function for burning stable tokens without being subject to trading limits or regular exchange operations.
[**Broker**](broker/) is the entry point for interacting with the protocol. It is responsible for managing reserve assets and is the only contract with spender rights of the reserve as well as minting and burning rights over stable assets. For pricing trades, it relies on exchange providers like BiPoolManager.sol. When executing swaps, it enforces trading limits. The Broker also exposes a burn function for burning stable tokens without being subject to trading limits or regular exchange operations.

****[**BiPoolManager**](iexchangeprovider/bipoolmanager/) **** is the first implementation of an IExchangeProvider which manages virtual asset pools that consist of two assets. With its state information on assets and bucket sizes, it prices trades using a pricing module. It also checks if trading is allowed or suspended as decided by the on-chain circuit breaker BreakerBox.sol. It can price trades with constant-product or constant-sum as specified in the respective pricing modules.
[**BiPoolManager**](iexchangeprovider/bipoolmanager/) is the first implementation of an IExchangeProvider which manages virtual asset pools that consist of two assets. With its state information on assets and bucket sizes, it prices trades using a pricing module. It also checks if trading is allowed or suspended as decided by the on-chain circuit breaker BreakerBox.sol. It can price trades with constant-product or constant-sum as specified in the respective pricing modules.

****[**TradingLimits**](broker/tradinglimits.md) is a library that implements trading limits, used by the Broker. Limits are configurable for 5-minute and 1-day intervals and a total global limit. It is called by the Broker when requesting swaps. The limits exist to protect the protocol against possible economic exploits or smart contract hacks.
[**TradingLimits**](broker/tradinglimits.md) is a library that implements trading limits, used by the Broker. Limits are configurable for 5-minute and 1-day intervals and a total global limit. It is called by the Broker when requesting swaps. The limits exist to protect the protocol against possible economic exploits or smart contract hacks.

****[**BreakerBox**](breakerbox/)****[ ](breakerbox/)is an on-chain circuit breaker for oracles. It maintains a state for each price feed, whether trading is allowed or suspended. It is modular by design and allows for flexible addition and deletion of price feeds and individual breaking logic. Its conditions are checked and breakers are triggered if necessary by newly added rates in SortedOracles.sol. For each requested swap, BiPoolManager.sol checks against this contract whether trading a specific pair is currently allowed or suspended.
[**BreakerBox**](breakerbox/)is an on-chain circuit breaker for oracles. It maintains a state for each price feed, whether trading is allowed or suspended. It is modular by design and allows for flexible addition and deletion of price feeds and individual breaking logic. Its conditions are checked and breakers are triggered if necessary by newly added rates in SortedOracles.sol. For each requested swap, BiPoolManager.sol checks against this contract whether trading a specific pair is currently allowed or suspended.

****[**MedianDeltaBreaker**](breakerbox/mediandeltabreaker.md) is a circuit breaker that trips if the median oracle report changes by a configured threshold.
[**MedianDeltaBreaker**](breakerbox/mediandeltabreaker.md) is a circuit breaker that trips if the median oracle report changes by a configured threshold.

****[**SortedOracles**](sortedoracles.md) stores and maintains the state of oracle reports. Oracle clients insert their rates into a sorted linked list and the contract checks newly inserted rates against the on-chain circuit breaker BreakerBox.sol. If valid, the rate can be used by the protocol to price swaps, otherwise, trading will be halted.
[**SortedOracles**](sortedoracles.md) stores and maintains the state of oracle reports. Oracle clients insert their rates into a sorted linked list and the contract checks newly inserted rates against the on-chain circuit breaker BreakerBox.sol. If valid, the rate can be used by the protocol to price swaps, otherwise, trading will be halted.

****[**StableToken**](stabletoken.md) 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.
[**StableToken**](stabletoken.md) 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.

****[**Reserve**](reserve.md) **** stores and manages any ERC-20 Mento reserve asset on the Celo blockchain. Assets can be accessed and controlled only by Broker.sol as well as a MultiSig, guarded by trading limits from TradingLimits.sol.
[**Reserve**](reserve.md) stores and manages any ERC-20 Mento reserve asset on the Celo blockchain. Assets can be accessed and controlled only by Broker.sol as well as a MultiSig, guarded by trading limits from TradingLimits.sol.

****[**ConstantProductPricingModule**](iexchangeprovider/bipoolmanager/constantproductpricingmodule.md) is a stateless contract that implements a constant-product pricing formula for a two-asset pool.
[**ConstantProductPricingModule**](iexchangeprovider/bipoolmanager/constantproductpricingmodule.md) is a stateless contract that implements a constant-product pricing formula for a two-asset pool.

****[**ConstantSumPricingModule**](iexchangeprovider/bipoolmanager/constantsumpricingmodule.md) is a stateless contract that implements a constant-sum pricing formula for a two-asset pool.
[**ConstantSumPricingModule**](iexchangeprovider/bipoolmanager/constantsumpricingmodule.md) is a stateless contract that implements a constant-sum pricing formula for a two-asset pool.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function shouldReset(address rateFeedID) external returns (bool resetBreaker)

Check if the criteria to automatically reset the breaker have been met.

_Allows the definition of additional critera to check before reset. If no additional criteria is needed set to !shouldTrigger();_
_Allows the definition of additional criteria to check before reset. If no additional criteria is needed set to !shouldTrigger();_

### Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Check if the current median report rate for a rate feed change, relative to the
function shouldReset(address rateFeedID) external returns (bool resetBreaker)
```

Checks whether or not the conditions have been met for the specifed rate feed to be reset.
Checks whether or not the conditions have been met for the specified rate feed to be reset.

### Return Values

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ _Reverts if the limits are exceeded._
function reset(struct TradingLimits.State self, struct TradingLimits.Config config) internal pure returns (struct TradingLimits.State)
```

Reset an existing state with a new config. It keps netflows of enabled limits and resets when disabled. It resets all timestamp checkpoints to reset time-window limits on next swap.
Reset an existing state with a new config. It keeps netflows of enabled limits and resets when disabled. It resets all timestamp checkpoints to reset time-window limits on next swap.

### Parameters

Expand Down
4 changes: 2 additions & 2 deletions developers/running-an-oracle.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Running an Oracle

Oracles on Celo for Mento are an essential part of the stability mechanism. As of December 2022, there are 10 oracle clients, of which Mento Labs manages 8. There are[ ongoing decentralization efforts to add partners, community members, and validators](https://forum.celo.org/t/decentralized-oracles/3610). As of December 2022, one oracle is operated by a community member, and one by T-Systems MMS, a subsidiary of Deutsche Telekom.
Oracles on Celo for Mento are an essential part of the stability mechanism. As of December 2022, there are 10 oracle clients, of which Mento Labs manages 8. There are[ongoing decentralization efforts to add partners, community members, and validators](https://forum.celo.org/t/decentralized-oracles/3610). As of December 2022, one oracle is operated by a community member, and one by T-Systems MMS, a subsidiary of Deutsche Telekom.

The plan is to move these oracles to different entities, ecosystem projects, and potentially even validators of the Celo Protocol, to have community members run the majority of oracles.

Expand All @@ -12,7 +12,7 @@ In order to run an oracle, you can not have any conflicts of interest and have t

## Oracle client code

The public repository for the oracle client, including technical documentation, can be found[ here](https://github.com/celo-org/celo-oracle) on GitHub.
The public repository for the oracle client, including technical documentation, can be found[here](https://github.com/celo-org/celo-oracle) on GitHub.

## How to get added as an oracle provider

Expand Down