1. 首页 > 知趣科技

Curve稳定币设计白皮书(中英文参照版本)

Figure 2: Dependence of the loss on the price shift relative to the liquidation threshold. Time window for the observation is 3 days

In this design, if someone borrows against collateral, even at liquidation threshold, and the price of collateral dips and bounces – no significant loss happen. For example, according to simulations using historic data for /USD since Sep 2017, if one leaves the CDP unattended for 3 days and during this time the price drop of 10% below the liquidation threshold happened – only 1% of collateral gets lost.

在这种设计中,假定有人用抵押品借款,即使是在清算阈值,抵押品的价钱下跌后反弹–也不会发生清楚的丧失。例如,依据自2017年9月以来运用ETH/USD的历史数据中止的模拟,假定放着CDP无人看守3天,在此时期,价钱下跌至低于清算价钱10%的状况发生的话, 也只需1%的抵押品被丧失。

AMM for continuous liquidation/deliquidation (LLAMMA) 继续清算/无需清算的AMM(LLAMMA)

The core idea of the stablecoin design is Lending-Liquidating AMM Algorithm. The idea is that it converts between collateral (for example, ETH) and the stablecoin (let’s call it USD here). If the price of collateral is high – a user has deposits all in ETH, but as it goes lower, it converts to USD. This is very different from traditional AMM designs where one has USD on top and ETH on the bottom instead.

波动币设计的中心思想是Lending-Liquidating AMM算法。这个想法是,它在抵押品(例如ETH)和稳定币(这里权且称之为USD)之间中止转换。假定抵押品的价钱很高–用户的放款都是ETH,但当价钱降低时,它就会转换为USD稳定币。这与激进的AMM设计有很大不同,保守的AMM设计是将USD稳定币放在下面(AMM曲线上半截),ETH放在下面(AMM曲线下半截)。

The below description doesn’t serve as fully self-consistent rigorous proofs. A lot of that (especially the invariant) are obtained from dimensional considerations. More research might be required to have a full mathematical description, however the below is believed to be enough to implement in practice.

下面的描画并不能作为一个完整自洽的松散证明。很多东西(特地是不变量)都是从各种维度思索取得的。要有一个完整的数学描画,可以需求更多的研讨,但是上面的描画被以为足以支持在中实施。

This is only possible with an external price oracle. In a nutshell, if one makes a typical AMM (for example with a bonding curve being a piece of hyperbola) and ramps its “center price” from (for example) down to up, the tokens will adiabatically convert from (for example) USD to ETH while proving liquidity in both ways on the way (Fig. 3). It is somewhat similar to avoided crossing (also called Landau-Zener transition) in quantum physics (though only as an idea: mathematical description of the process could be very different). The range where the liquidity is concentrated is called band here, at the constant po band has liquidity from pcd to pcu. We seek for pcd(po) and pcu(po) being functions of po only, functions being more steep than linear and, hence, growing faster than po(Fig. 4). In addition, let’s defifine prices p↓and p↑ being prices where p↓(po) = po, and p↑(po) = po, defining ends of bands in adiabatic limit (e.g. p = po).

这只需经过外部喂价才干完成。简而言之,假设一团体做了一个典型的AMM(例如,粘合曲线是一块双曲线),并将其 "中心价钱 "从(例如)下降到下降,代币将从(例如)USD“绝热”地转换为ETH,同时在进程中提供两种方式的活动性(图3)。这有点相似于量子物理学中的“规避交叉”(也称为Landau-Zener跃迁)(固然只是一个概念:对该进程的数学描画可以十分不同)。

活动性集合的范围在这里被称为“波段”(Band),在恒定的po波段有从pcd到pcu的活动性。我们寻求pcd(po)和pcu(po)只作为po的函数,函数比线性更峻峭,因此,增减速度比po快(图4)。此外,让我们把价格p↓和p↑定义为p↓(po)=po和p↑(po)=po的价格,定义为绝热极限中的波段两端(例如p=po)。

Figure 3: Behavior of an “AMM with an external price source”. External price pcenter determines a price around which liquidity is formed. AMM supports liquidity concentrated from prices pcd to pcu, pcd < pcenter < pcu. When current price p is out of range between pcd and pcu, AMM is either fully in stablecoin (when at pcu) or fully in collateral (when at pcd). When pcd ≤ p ≤ pcu, AMM price is equal to the current price p.

We start from a number of bands where, similarly to Uniswap3, hyperbolic shape of the bonding curve is preserved by adding virtual balances. Let say, the amount of USD is x, and the amount of ETH is y, therefore the “amplifified” constant-product invariant would be:

我们从一些波段末尾,与Uniswap3相似,经过增加“虚拟余额”,保管了粘合曲线的双曲外形。比如说,USD的数量是x,ETH的数量是y,因此 "增强的 "常数-产品不变性将是:

We also can denote x0 ≡ x + f and y0 ≡ y + g so that the invariant can be written as a familiar I = x0 y0. However, f and g do not stay constant: they change with the external price oracle (and so does the invariant I, so it is only the invariant while the oracle price po is unchanged). At a given po, f and g are constant across the band. As mentioned before, we denote p↑ as the top price of the band and p↓as the bottom price of the band. We defifine A (a measure of concentration of liquidity) in such a way that:

我们也可以表示x0≡x+f和y0≡y+g,这样不变式就能够写干练习的I=x0 y0。但是,f和g并不是坚持不变的:它们随着外部预言机价格的变化而变化(不变量I也是如此,所以它只是在预言机价格po不变时的不变量)。在给定的po下,f和g在整个波段内是不变的。如前所述,我们把p↑表示为波段的顶部价格,p↓表示为波段的底部价格。我们对A(权衡活动性集合度的手段)的定义是这样的:

The property we are looking for is such that higher price po should lead to even higher price at the same balances, so that the current market price (which will, on average, follow po) is lower than that, and the band will trade towards being all in ETH (and the opposite is also true for the other direction). It is possible to find many ways to satisfy that but we need one:

我们正在寻觅的属性是这样的:更高的价格po应当招致在相同的余额下更高的价格,因此,以后的市场价格(平均来说,将跟随po)低于这个价格,并且波段将朝着局部为ETH的方向买卖(而另一个方向也是如此)。能够找到很多方法来满意,但我们需求这样一个:

where y0 is a p0-dependent measure of deposits in the current band, denominated in ETH, defifined in such a way that when current price p, p↑ and po are equal to each other, then y = y0 and x = 0 (see the point at po = p↑ on Fig. 4). Then if we substitute y at that moment:

其中y0是一个与p0相关的权衡以后波段放款的手段,以ETH为单位,其定义是:当以后价格p、p↑和po相互相等时,则y=y0,x=0(见图4上po=p↑的点)。那么,假设我们把那一刻的y交流掉:

Price is equal to dx0 /dy0 which then for a constant-product invariant is:

价格等于dx0 /dy0,那么关于一个恒定的产品不变量来说,就是:

One can substitute situations where po = p↑ or po = p↓ with x = 0 or y = 0 correspndingly to verify that the above formulas are self-consistent.

我们能够用x=0或y=0来替代po=p↑或po=p↓的状况,以考证上述公式是自洽的。

Typically for a band, we know p↑ and, hence, p↓, po, constant A, and also x and y (current deposits in the band). To calculate everything, we need to find yo. It can be found by solving the quadratic equation for the invariant:

一般关于一个波段,我们知道p↑,因此也知道p↓、po、常数A,还有x和y(波段中的当前放款)。为了计算剩下的一切,我们需求找到yo。它可以经过处置不变量的二次方程来找到:

which turns into the quadratic equation against yo:

这就变成了针对yo的二次方程:

In the smart contract, we solve this quadratic equation in get_y0 function.

在智能合约中,我们在get_y0函数中处置这个二次方程。

While oracle price po stays constant, the AMM works in a normal way, e.g. sells ETH when going up / buys ETH when going down. By simply substituting x = 0 for the “current down” price pcd or y = 0 for the “current up” price pcu values into the equation of the invariant respectively, it is possible to show that AMM prices at the current value of po and the current value of p↑ are:

在预言机价格po坚持不变的状况下,AMM以一般的方式义务,例如,下跌时卖出ETH/下跌时买入ETH。经过冗杂地将x=0交流为 "当前下跌 "的价格pcd或y=0交流为 "当前下跌 "的价格pcu值区分代入不变量方程,就可以说明在po的当前值和p↑的当前值下的AMM价格是:

Another practically important question is: if price changes up or down so slowly that the oracle price po is fully capable to follow it adiabatically, what amount y↑ of ETH (if the price goes up) or x↓ of USD (if the price goes down) will the band end up with, given current values x and y and that we start also at p = po. While it’s not an immediately trivial mathematical problem to solve, numeric computations showed a pretty simple answer:

另一个主要的实际效果是:假设价格的变化如此缓慢,致使于预言机价格po完好能够”绝热地”(在一个波段内)跟随它,那么在给定当前值x和y,并且我们也从p=po末尾的状况下,这个波段最终会取得几y↑的ETH(假设价格下跌)或x↓的USD(假如价格下跌)。固然这不是一个立刻可以处置的数学效果,但数字计算显现了一个相当冗杂的答案:

We will use these results when evaluating safety of the loan as well as the potential losses of the AMM.

在评价借贷的性以及AMM的潜在丧失时,我们将运用这些结果。

Now we have a description of one band. We split all the price space into bands which touch each other with prices p↓ and p↑ so that if we set a base price pbase and have a band number n:

往常我们有了对一个波段的描绘。我们把一切的价格空间分红若干波段,这些波段的价格p↓和p↑相互接触,因此,如果我们设定一个基础价格pbase,并有一个波段号n:

It is possible to prove that the solution of Eq. 7 and Eq. 5 for any band gives:

关于任何一个波段,可以证明公式7和公式5的解都可以失掉:

which shows that there are no gaps between the bands.

这标明波段之间没有空隙。

Trades occur while preserving the invariant from Eq. 1, however the current price inside the AMM shifts when the price po: it goes up when po goes down and vice versa cubically, as can be seen from Eq. 8.

买卖发生的同时保管了公式1的不变性,但是,当价格为po时,AMM外部的当前价格会发生变化:当po下降时,它就会下降,反之亦然(立方系数),从公式8可以看出。

LLAMMA vs Stablecoin

Stablecoin is a CDP where one borrows stablecoin against a volatile collateral (cryptocurrency, for example, against ETH). The collateral is loaded into LLAMMA in such a price range (such bands) that if price of collateral goes down relatively slowly, the ETH gets converted into enough stablecoin to cover closing the CDP (which can happen via a self-liquidation, or via an external liquidation if the coverage is too close to dangerous limits, or not close at all while waiting for the price bounce).

稳定币是一种CDP,人们以不稳定的抵押品(加密货币,例如ETH)来借入稳定币。抵押品被加载到LLAMMA的价格范围内(这样的波段),如果抵押品的价格下降相对缓慢,ETH被转换成足够的稳定币来掩盖封锁CDP(这可以经过自我清算发生,大约经过外部清算,如果抵押率太接近风险的限制,大约基本不封锁,同时等候价格反弹)。

When a user deposits collateral and borrows a stablecoin, the LLAMMA smart contract calculates the bands where to locate the collateral. When the price of the collateral changes, it starts getting converted to the stablecoin. When the system is “underwater”, user already has enough USD to cover the loan. The amount of stablecoins which can be obtained can be calculated using a public get_x_down method. If it gives values too close to the liquidation thresholds – an external liquidator can be involved (typically shouldn’t happen within a few days or even weeks after the collateral price went down and sideways, or even will not happen ever if collateral price never goes up or goes back up relatively quickly). A health method returns a ratio of get_x_down to debt plus the value increase in collateral when the price is well above “liquidation”.

当用户取出抵押品并借入一个稳定币时,LLAMMA智能合约会计算出抵押品所在的波段。当抵押品的价格变化时,它末尾被转换为稳定币。当系统处于 "水下 "时,用户曾经有足够的USD来支付放款。可以取得的稳定币数量可以通过一个公共的get_x_down方法来计算。如果它给出的数值过于接近清算阈值–外部清算人可以参与进来(一般不应当在抵押品价格下跌和横盘后的几天甚至几周内发生,甚至如果抵押品价格从未下跌或相对较快公开降,则永世不会发生)。当价格远高于 "清算 "时,一个安康的方法会前往get_x_down与债务的比率,再加上抵押品的价值增加。

本文采摘于网络,不代表本站立场,转载联系作者并注明出处:http://www.fjxmta.com/zqkj/3613.html

联系我们

在线咨询:点击这里给我发消息

微信号:wx123456