CoFiX is the Future of On-Chain Market Making and AMM Evolution

Victor Zhang
CoFiX
Published in
7 min readOct 7, 2020

Background:

Several companies and individuals have been working together on this secret project, CoFiX, for the past seven months. We are grateful and excited that the leading exchanges in the East and the West and top VC in DeFi have supported this project. It is time to introduce this project to more people.

CoFiX is a community-driven DeFi project that was founded in March this year. The founding members of CoFiX include the open-source wallet project AlphaWallet, blockchain security team SECBIT, financial product expert and the CoFiX white paper author Zaugust, and 11 other Individual members. We are very excited to have the opportunity to work with leading financial model researchers, contract developers, and many volunteers in the community to realize the concept of ‘on-chain computable finance,’ launch the first generation of CoFi product.

Summary of CoFiX:

  • Risk-free market-making (no permanent or impermanent loss, but need to do hedging to maintain your asset proportion).
  • Simple hedging.
  • No permission required.
  • High capital efficiency.
  • Suitable for any trading pairs, including mean-reverting pairs, correlated pairs, uncorrelated pairs, and inversely correlated pairs.
  • Trading with the lowest price spread.

CoFiX Protocol Basics

CoFiX is an advanced automated market-making protocol. It obtains market prices from a decentralized price oracle. In addition, it has comprehensive risk control mechanisms. The design principles are as follows.

  1. Computability and Algorithm-based risk control. Everything in CoFiX is computable. This translates to more accurate prices and better risk controls for market makers and traders.
  2. No system-level arbitrage opportunities. In most AMMs, the trader and market maker bear the costs incurred by arbitrageurs. CoFiX can operate without involving arbitrageurs. This means better prices for traders and more profit for market makers.

What is the arbitrageurs’ scope of responsibilities in other AMMs?

Price discovery and verification

Whenever the market price changes, AMMs need arbitrageurs to trade the mismatch and return the prices of the AMMs to the standard market price. Whenever this occurs, market makers are forced to sell their liquidity at a discount.

Whenever a trader trades against a liquidity pool, an AMM cannot reflect on real market prices. Instead, they revert to a constant formula. This means that every single trade creates an arbitrage opportunity. Arbitrageurs are getting paid by traders and market makers to verify the difference between the trading price of the AMMs, and the actual market price.

Asset pool position rebalancing

This is a task related to market price discovery. Since other AMMs cannot execute trades based on actual market prices, position hedging is very difficult for market makers. The “easiest and effective” solution for this issue is to maintain the asset pool positions so that they are consistently congruent with

  • the ratio based on the asset market price rate; or
  • a fixed ratio.

For “a”, the rebalance is performed together with price discovery and verification. The costs of this rebalancing are paid by traders and market makers.

For “b”, the rebalance is performed through adding an additional trading fee or offering a discount on certain assets. This encourages arbitrageurs to trade in the opposite direction. The cost of this rebalancing is mainly paid by traders — they are trading with a much larger spread in this case.

How does CoFiX remove system-level arbitrage?

By using a decentralized price oracle, all trades are executed based on the market price. Market makers always sell their assets at the market price plus a computable compensation, because in so doing, they can be accurately compensated for the risks they take. Traders always trade at market prices, with a spread given to the market maker for risks that they have taken. Since the market prices come from an oracle, neither arbitrageurs nor their “services” are needed.

As all trades are executed based on the market price, market makers are able to perfectly hedge their position to lock in profits from the price spread. When a market maker deposits liquidity into a pool, they are able to know their share of the pool and mirror the trades proportionally on a third-party service. The amount to hedge is in proportion to the market makers’ share of the pool. For example, if the total pool size is 1,000 ETH, and the market maker owns 10% of that pool, they simply need to mirror 10% of the volume of the trades that occur. This is achievable via a simple programmable script. Arbitrageurs are no longer necessary to rebalance the pool, and there is no impermanent loss.

Additional benefits

Market makers can provide liquidity for a single asset, e.g. ETH or USDT. This allows them to limit their risk exposure to a single asset. CoFiX can even support inversely correlated asset pairs, such as TRUMP vs. BIDEN for President Tokens, given the price oracle. An AMM like Uniswap cannot support such a pair because the outcome will result in one token being rendered worthless. This turn of events enables the arbitrageur to take the market maker to the proverbial cleaner. As the trading price is based on market price, there is no Partial Price Impact, so the liquidity can be used at 100%.

Not magic, just math!

How is risk managed in other AMMs?

Most AMMs are aware of the risks attached to market makers. None of them can accurately compensate the market maker for those risks, however. This is why AMMs like Uniswap have a fixed fee of 0.3%, whereas other AMMs have a fixed percentage or number with different names (fees, risk parameters, liquidity factors etc.). These are all estimations based on the risks the market maker takes. In fact, percentages or numbers can only be estimations — as such, they cannot accurately compensate the market maker for their risks. These guesses are attempting to:

  1. Provide some form of compensation to account for market makers’ risks; and
  2. Integrate additional fees.

None of these AMMs can explain why they chose this number. Because it is a fixed number based on a rough estimate, it is impossible for it to be 100% accurate. These types of estimates will always result in one of two circumstances unfolding:

  1. Market makers subsidize the traders or arbitrageurs; or
  2. Traders subsidize the marker makers or arbitrageurs.

Since these numbers are not accurate, the traders are either overcompensating the market maker at the trader’s expense, or they are undercompensating the market maker. (Most AMMs strive for the former.) Bear in mind, however, that neither of these circumstances can remain in the long term — it takes a single, big inaccuracy for market makers to lose all their margins. Secondly, an on-chain trading system that is consistently biased towards one side, will eventually fail to compete with other, fairer on-chain trading systems. Note, some of the AMMs are even worse, as they are falling in “Market makers subsidize the traders or arbitrageurs” circumstance, where the asset pools are consistently losing money.

This explains why professional market makers still tend to keep their distance from AMMs.

Why do other AMMs have poor risk management?

Suppose all AMMs have a proper understanding of financial risks, and want to provide effective risk management solutions within their system. What stops them from doing so?

  • AMMs which do not use a price oracle can only use a fixed formula for price discovery. The means by which they discover and verify price illustrate that the risk is not computable — they are attempting to use a ‘P’ formula to solve an ‘NP’ question.
  • For AMMs using a price oracle, the problem is that the price oracle being used cannot provide a way in which to calculate their own pricing risks. An ideal price oracle must be:
  1. Fully decentralized with no counterparty risk (which are incalculable in any event). The cost to attack such an oracle must be greater than or equal to the total asset value transacting with the price.
  2. Fully computable. The oracle needs to provide mathematical proofs for their price risk and a way to accurately compute them. This means that for every price you are using, you have a corresponding quantifiable risk factor.

How is the risk managed in CoFiX?

CoFiX uses the NEST Protocol as its price oracle. NEST is a truly decentralized oracle with an extremely high attack cost. This cost can be as high as 50% of the total value of ether, plus all tokens 😄. It also provides a full set of mathematical proofs for pricing risk.

Based on this information, we are able to design a fully computable on-chain market-making protocol with all the system-level risks accounted for in each trade. This makes CoFiX the safest and most efficient on-chain market-making protocol available. There are also additional risk management mechanisms to further protect maker makers and traders in black swan events.

One more time: not magic, just math!

We are launching soon!

Currently, we are working on one more round of third-party security audits. We will only launch a product that we can comfortably repose confidence in, especially when the product relates to finance. We believe that, when it comes to finances and money, no one should ever be treated as a guinea pig.

The source code for CoFiX’s smart contracts may be found here.

All are welcome

CoFiX is a 100% community-based project. Individuals, companies, and organizations have been working together for the past 7 months to design and implement this protocol. With that said, you are welcome to join us.

One more thing

YES, there are tokens. YES, there is liquidity mining. AND there will be more of both in the future. Stay tuned! 😄

Follow us on Twitter: https://twitter.com/CoFiXProtocol

Chat with us on telegram: https://t.me/CoFiXProtocol

--

--