Skip to content

Latest commit

 

History

History
87 lines (48 loc) · 2.79 KB

README.md

File metadata and controls

87 lines (48 loc) · 2.79 KB

CETF - Decentralized Exchange Traded Funds

Welcome to the CETF's smart contracts repository!

Contract is deployed to the following account on the EOS mainnet (tested on mainnet on consortiumtt account):

  • cet.f


Contract - cet.f

Code contains functions that enable to create and manage ETF consisting of eosio tokens (ETF itself is also based on standard eosio token contract).

Let's dive deeper into how the CREATION and MANAGEMENT exactly works. All the functions can be found in 7 different cpp files.


  1. CREATION

In order to create ETF user has to send to cet.f tokens that are currently in the ETF (which tokens are in the fund could be seen in rebalon table, scope contract name - cet.f). The amount of tokens that are sent in, have to be EXACTLY in correct proportions in relation to each other.

Example, let's assume to create one ETF we need to send in three tokens:


100.0000 DAPP

25.0000 VIG

10.0000 EMT

To check whether the amounts are correct, we read the current ratios (proportions between tokens) in the rebalon table.

Ratios are calculated in the following way:

  1. From all the current ETF tokens, one base token is chosen.
  2. All the other tokens are divided by the base token.

Let's take EMT as base token and calculate the ratios.


100 DAPP / 10 EMT = 10

25 VIG / 10 EMT = 2.5

10 EMT / 10 EMT = 1

If incoming tokens to cet.f do not produce those ratios, no ETF will be created/issued.


Example, if user sends in:

99.0000 DAPP

25.0000 VIG

10.0000 EMT


99 DAPP / 10 EMT = 9.9 -> INCORRECT has to be 10

25 VIG / 10 EMT = 2.5 -> CORRECT

10 EMT / 10 EMT = 1 -> CORRECT

No ETF is issued.


  1. MANAGEMENT

Currently cet.f msiggers can whitelist fund managers.

Fund managers are able to use 100 credits (100%). To vote and pick which tokens should be in the ETF.

When 2/3 fund managers have voted, anybody can trigger rebalancing function.

rebalance function triggers sell/buy orders through Defibox, based on how fund managers collectively voted.

Rebalance function calculates new ratios mentioned in the previous 1.CREATION section.

Fund can be rebalanced as many times as fund managers wish, as long as 2/3 have voted.


  1. TOKENOMICS

Currently code contains functions enabling to claim ETF creation fees.


Functions:


getdiv - claims the fees generated


stakecetf - stakes CETF token to be eligible to claim ETF fees


unstkcetf - unstakes CETF