# Meta.one Whitepaper – [meta.one](https://meta.one)
*Anton Bukov k06aaa@gmail.com*
*Denis Bukov zzomrot.ne@gmail.com*
*Mikhail Melnik by.zumzoom@gmail.com*
## Abstract
*Meta.one* company introduces sevearal crypto-solutions for everyday use: *Meta.Stacks* protocol, *Meta.Liquidity* protocol, *Meta.Bridge* protocol.
Dealing with crypto portfolio of multiple crypto assets may be difficult, especially rebalancing it to the desired proportions. *Meta.Stacks* protocol provides an *ERC20* token abstraction over multiple *ERC20* subtokens, that allows you to easily manage desired asset proportions and keeps it balanced automagically. Your ownership of the tokens becomes indirect (via stacks smart contract) but stays as secure and trustless as direct tokens ownership. Funds are able to launch their own strategy in the form of new token, which value is insured by nested tokens. Thus token price will be driven by fund's secret strategy.
Storing tokens in automatically rebalancing stacks allows *Meta.one* to introduce *Meta.Liquidity* protocol. Which uses *META* token stored on stack to define probability of stack to be chosen for the concrete change operation.
A lot of users wondering if they will be able to use *Meta.Stacks* protocol with coins in another blockchains, and we are honored to introduce you *Meta.Bridge Protocol* – technology allowing any other coins to be trustless mapped to the *Ethereum* blockchain without needance to trust anyone. It will also allow us to bridge out META token to other blockchains supporting smart-contract, to expand *Meta.Stacks* and *Meta.Liquidity* protocols to other blockchains.
## 1. Meta.Stacks Protocol
### 1.1. ERC1133 Specification
*Meta.one* developers proposed [ERC1133](https://github.com/ethereum/EIPs/issues/1133) specification to allow 3rd-party software to expose inner properties and even manipulate *Meta.Stacks*.
### 1.2. Token Aggregation
Ethereum tokens aggreagation is already discovered and implemented by a few projects: getbskt.com[^1] and tokensets.com[^2]. Their implementations did not cover all possible cases.
Stack capitalization consists of subtokens valuations and at any time is fully secured by the tokens. Anyone is possible to mint/burn stack buy providing/extracting subtokens in some proportion.
An implementation should take into account the following possible cases:
- Some tokens may become untransferable (paused/locked/freezed)
- Some tokens may be upgraded (token smart contract address changed)
- Some new tokens may be AirDropped to Meta.Stack smart contract
To fulfill all requirements and resolve all possible issues we developed smart contract interface with the following methods:
```solidity
function mint(uint256 _value) public;
function burn(uint256 _value) public;
function burnSome(uint256 _value, ERC20[] someTokens) public;
```
Method `mint` allows deposit tokens to issue stack until at least one of it's tokens becomes untransferable. Method `burnSome` allows to withdraw upgraded tokens with AirDropped tokens.
### 1.3. Portfolio Rebalancing
The idea of two tokens rebalancing on a single smart contract by arbitragers was initially proposed by Vitalik Buterin[^3][^4][^5] and currently is used in several exchange projects: [Bancor.network](bancor.network)[^6], [Kyber.network](kyber.network/swap)[^7] and [Uniswap.io](uniswap.io)[^8]. The smart contract just holds two tokens and allows to exchange one for another and computes return value based on superposition principle: it supposes portfolio is already balanced. And every arbitrage opportunity allows to equilibrate token value proportions with a small reward for arbitrager. Initially formula looks this way:
$$b_X (1 + p_X) = \frac{b_y}{(1 + p_x)}, p_x = \frac{a_x}{b_x}, \\
\begin{align} \\
\text{where } & \text{$b_T$ – balance of token $T$ on smart contract}, \\
& \text{$a_T$ – amount of token $T$ to be exchanged}.
\end{align}$$
As Martin Köppelmann from Gnosis (link?) metioned that after some simplifications formula can be represented in another way:
$$b_X b_Y = k, \\
\begin{align}
\text{where } & \text{$b_T$ – balance of token $T$}, \\
& \text{$k$ – some invariant value}.
\end{align}$$
Adding different weights of token shares to this formula gives:
$$\begin{cases}
\frac{b_X}{s_X} \frac{b_Y}{s_Y} = k, \\
(\frac{b_X}{s_X} + a_X)(\frac{b_Y}{s_Y} - a_Y) = k, \\
\end{cases} \\
\begin{align} \\
\text{where } & \text{$b_T$ – balance of token $T$}, \\
& \text{$a_T$ – amount of token $T$ being exchanged}, \\
& \text{$s_T$ – share of token $T$}, \\
& \text{$k$ – some invariant value}.
\end{align}$$
When arbiter sends $a_X$ volume of fallen token $X$ to recieve some amount $a_Y$ of risen token $Y$, returning amount will be calculated with the following formula:
$$a_Y = \frac{a_X b_Y s_X}{s_Y(a_X s_X + b_X)}$$$$
\begin{align}
\text{where } & \text{$b_T$ – balance of token $T$ on smart contract}, \\
& \text{$s_T$ – share of token $T$ on Meta.Stack balance}, \\
& \text{$a_T$ – amount of token $T$ to be exchanged}.
\end{align}$$
Arbitrageurs will like the following formula, which founds best $a_X$ value to maximize profit $a_X p_X - a_Y p_Y$ for known token prices $p_T$:
$$a_X = \sqrt{\frac{b_X b_Y p_Y (1-f)}{p_X s_X s_Y}} - \frac{b_X}{s_X}$$$$
\begin{align}
\text{where } & \text{$b_T$ – balance of token $T$ on smart contract}, \\
& \text{$s_T$ – share of token $T$}, \\
& \text{$p_T$ – price of token $T$}, \\
& \text{$a_T$ – amount of token $T$ to be exchanged}. \\
& \text{$f$ – MultiToken exchange fee}. \\
\end{align}$$
We expanded this idea to store multiple tokens ($N$) and allowed to setup desired proportions/shares $s_T$ on smart contract creation:
$$
\frac{s_{T_i}}{\sum_{j=1}^{N} {s_{T_j}}} =
\frac{b_{T_i}p_{T_i}}{\sum_{j=1}^{N} {b_{T_j}p_{T_j}}},
\begin{cases}
i \in 1\dots N \Rightarrow T_i \in \mathbb T; \\
\forall (r,s) \in 1\dots N, r \neq s \Rightarrow T_r \neq T_s;
\end{cases} \\
\\
\Rightarrow \\
\\
\frac{s_{T_i}}{b_{T_i}p_{T_i}} = \frac{s_{T_j}}{b_{T_j}p_{T_j}},
\begin{cases}
i,j \in 1\dots N \Rightarrow T_i, T_j \in \mathbb T;
\end{cases}$$$$
\\
\begin{align}
\text{where } & \text{$b_T$ – balance of token $T$ on smart contract}, \\
& \text{$s_T$ – share of token $T$ on Meta.Stack balance}, \\
& \text{$p_T$ – price of token $T$ in reference currency}, \\
& \text{$\mathbb T$ – set of N possible tokens}.
\end{align}
$$
While price $p_T$ remains unknown to smart contract, it just supposes it is always balanced in desired proportions $s_T$.
### 1.4. Strategy Copying
//TODO: Safe proportions change
## 2. Meta.Exchange Protocol
### 2.1. Liquidity providers reward
*Meta.Stacks* can be used as an exchange by calling exactly the same method `change` the arbitragers use to rebalance stacks. The more liquidity stacks have - the more beneficial exchange rate will be provided. This means stack holders should receive additional reward as liquidity providers.
*Bancor Network* allows liquidity providers to store liquidity on Token Relays and give them XXXBNT tokens as their shares. But holding XXXBNT tokens means having auto-rebalancing portfolio of XXX and BNT. Multi-token holders are free to store any tokens on multi-tokens to earn additional profit.
### 2.2. Tokenomics
But choosing one of the stacks for the concrete exchange operation is a challenge and we decided to issue our own token *META* to solve this problem. Storing this token on multi-token defines probability for operation to happen on this smart contract. For example if two stacks contains *META* and one contains two times more *META* tokens than another – this will leads for first to have 2 times more operations and receive 2 times more fees. Multi-token $i$ of $N$ selection probability $p_i$ can be computed with the following formula:
$$p_i = \frac{f_i r_i}{\sum_{j=1}^N{f_j r_j}},\{i \in 1\dots N;$$$$
\begin{align}
\text{where } & \text{$r_i$ – return amount by exchange $i$}, \\
& \text{$f_i$ – META token balance of exchange $i$}.
\end{align}
$$
## 3. Meta.Bridge Protocol
### 3.1. Inter-chain trustless communication
//TODO: BTCRelay
### 3.2. Inter-chain trusted communication
//TODO: Multisig bridge validators
## Team
//TODO: Team members
## References
[^1]: Bskt: a smart contract for creating decentralized token portfolios. https://github.com/cryptofinlabs/bskt-whitepaper/
[^2]: {Set} Protocol: A Specification for Token Abstraction. https://setprotocol.com/pdf/set_protocol_whitepaper.pdf
[^3]: Let's run on-chain decentralized exchanges the way we run prediction markets. https://www.reddit.com/r/ethereum/comments/55m04x/lets_run_onchain_decentralized_exchanges_the_way/
[^4]: On Path Independence. https://vitalik.ca/general/2017/06/22/marketmakers.html
[^5]: Improving front running resistance of x*y=k market makers. https://ethresear.ch/t/improving-front-running-resistance-of-x-y-k-market-makers/1281
[^6]: Bancor Protocol. Continuous Liquidity for Cryptographic Tokens through their Smart Contracts. https://storage.googleapis.com/website-bancor/2018/04/01ba8253-bancor_protocol_whitepaper_en.pdf
[^7]: Kyber Network. https://kyber.network/about/company
[^8]: Uniswap Whitepaper. https://hackmd.io/C-DvwDSfSxuh-Gd4WKE_ig