Ref Finance User Guide

Ref Finance User Guide

How Ref Finance Works

Ref Finance is an open-source software.

Inspired by Uniswap v2 and Curve Finance, Ref Finance is an automated liquidity protocol powered by two constant product functions:

  • Swap function: x * y = k
  • StableSwap function: χDn−1 * ∑ xi + ∏ xi = χDn + ( D / n )n

For more information, please refer to:

Ref Finance is implemented on the NEAR blockchain. The platform is fully permissionless and removes the need for trusted intermediaries, prioritising decentralisation and censorship resistance. Anyone can trade and/or become a liquidity provider (LP) for a pool by depositing an equivalent value of each underlying token in return for pool tokens (LP tokens). These tokens track pro-rata LP shares of the total reserves, and can be redeemed for the underlying assets at any time.

Unlike Uniswap, Ref Finance smart contract (v2.ref-finance.near), which manages the automated market maker functions; swap and provide liquidity, contains all pairs or liquidity pools, made of reserves of two or three NEP-141 tokens (ERC-20 equivalent on NEAR).

When a LP creates a new pool, the pool fee is customisable. Every pool has the same fee structure, as shown below.

Ecosystem Participants

The Ref Finance ecosystem is primarily comprised of four types of users: traders, liquidity providers, stakers and developers.

  • Traders can swap NEP-141 tokens
  • Liquidity providers are incentivised to provide these tokens to liquidity pools
  • Stakers are receiving pro-rata shares of the shared protocol revenue
  • Developers can integrate directly with Ref Finance smart contracts to empower users in their interactions with tokens, trading interfaces, trading strategies, and more

Traders

There are different types of traders interacting with the protocol:

  • Speculators can use a wide range of strategies from fundamental to technical analysis, to 'ape' approach (process of buying a token shortly after the token project launch without conducting thorough research)
  • Hig-frequency bots can cover different strategies, such as market-neutral arbitrage or long/short strategies
  • Dapp users buy tokens for use in other applications on NEAR, for example, buying PixelDapp tokens to play games
  • Smart contracts that execute trades by implementing swap functionality, from products like DEX aggregators to custom scripts
  • Legal entities (can be for-profit or not-for-profit organisations) and/or DAOs (can be a smart contract) that execute trades to manage their affairs, such as the settlement of an invoice in a differrent currency/token

Traders are all subject to the same fee for trading on the platform

Liquidity Providers

Liquidity providers, or LPs, are a fragmented group, mainly made of:

  • Passive LPs are token holders who passively invest to accumulate trading fees, they generally do not actively monitore their positions and divergence loss
  • Sophisticated LPs are focused on market making as their primary strategy, they usually develop custom tools and monitore actively their positions and divergence loss
  • Token projects sometimes choose to become LPs to 'initiate' liquidity, by creating a liquid pool for their token

Stakers

Stakers can have different objectives and belong to specific subgroups:

  • Long-term stakers are usually interested in a more predictable source of revenue, deriving from the protocol revenue, while holding the protocol token and participating in the governance (Under Development)
  • Short-term or intra-strategy stakers are staking for a limited period of time, with the objective to optimise their returns, generally until the underlying token (REF) needs to be sold or used for a different purpose (i.e., liquidity provision)
  • Voting-only stakers can be identified as users that stake only to vote the associated proposal(s), they are generally interested in participating/influencing the future of the protocol by voting on specific proposals

Developers

There are many ways Ref Finance can be used by developers, some examples include:

Ref Finance Team and Community

Finally, the Ref Finance team along with the DAO (ref-finance.sputnik-dao.near) and the broader community drives development of the protocol and its ecosystem.

Trading

The Swap and StableSwap tabs, are where you can trade one token for another. It is a user-friendly swap interface, just select the two tokens you wish to exchange.

How To Trade/Swap?

Auto Router

Auto Router, also known as Smart Routing, can be defined as the ability to find better prices for traders on Ref Finance. This includes splitting the trade across multiple pools at once.

The Auto Router delivers a unique value proposition. Value that will be accumulated over time by Ref's users, in the form of better prices and liquidity utilisation.

Read More

Pooling

Ref Finance charges a customisable fee for all trades. The fee depends on the pool fee, which is defined at the creation of the pool, and cannot be modified once the pool is created. The pool fee usually varies from 0.05% to 0.3%.

A liquidity pool is a pool of two or three tokens, e.g. NEAR and REF tokens. This pool is what allows users to trade the two tokens. Contrary to the Stableswap pool or Tri-Pool (three tokens, cf. Stableswap function), only liquidity pools with two tokens are fully permissionless. Anyone can create a two-token liquidity pool on Ref Finance.

Users can earn a share of the trading fees by depositing tokens into the pool (also known as "adding liquidity"). Users will receive LP tokens, representing their share of the pool.

How To Add Liquidity To A Pool?

Farming

Farming or Yield Farming is defined as the process of staking your LP tokens into a farm, to earn additional rewards, on top of your existing liquidity position(s) swap fee revenue.

Like pools, all farms are contained in one single contract (v2.ref-farming.near). Plus, a farm can support up to 16 different reward tokens.

Liquidity incentives are usually used by projects' owners to attract liquidity and to facilitate trading.

How To Farm?

Staking

xREF is the main staking contract (xtoken.ref-finance.near) on the platform. When you stake your REF, you effectively exchange your REF for xREF. Over time, you will always earn more REF by holding xREF tokens.

How To Stake?