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

作者:MichaelEgorov,CurveFinance

编译:JamesX,iZUMiResearch

Overview

Thedesignofthestablecoinhasfewconcepts:lending-liquidatingammalgorithm(LLAMMA),PegKeeper,MonetaryPolicyarethemostimportantones.ButthemainideaisinLLAMMA:replacingliquidationswithaspecial-purposeAMM.

这个稳定币的设计中有几个概念是最重要的:借贷-清算AMM算法,PegKeeper,货币政策。但主要的设计点是在LLAMMA:用一个特殊用途的AMM代替传统超额抵押借贷的清算流程。

Figure2:Dependenceofthelossonthepriceshiftrelativetotheliquidationthreshold.Timewindowfortheobservationis3days

图2:损失对相对于清算阈值的价格变动的依赖性。观察的时间窗口为3天

Inthisdesign,ifsomeoneborrowsagainstcollateral,evenatliquidationthreshold,andthepriceofcollateraldipsandbounces-nosignificantlosshappen.Forexample,accordingtosimulationsusinghistoricdataforETH/USDsinceSep2017,ifoneleavestheCDPunattendedfor3daysandduringthistimethepricedropof10%belowtheliquidationthresholdhappened-only1%ofcollateralgetslost.

在这种设计中,如果有人用抵押品借款,即使是在清算阈值,抵押品的价格下跌后反弹--也不会发生明显的损失。例如,根据自2017年9月以来使用ETH/USD的历史数据进行的模拟,如果放着CDP无人看管3天,在此期间,价格下跌至低于清算价格10%的情况发生的话,也只有1%的抵押品被损失。

AMMforcontinuousliquidation/deliquidation(LLAMMA)

持续清算/无需清算的AMM

ThecoreideaofthestablecoindesignisLending-LiquidatingAMMAlgorithm.Theideaisthatitconvertsbetweencollateral(forexample,ETH)andthestablecoin(let’scallitUSDhere).Ifthepriceofcollateralishigh-auserhasdepositsallinETH,butasitgoeslower,itconvertstoUSD.ThisisverydifferentfromtraditionalAMMdesignswhereonehasUSDontopandETHonthebottominstead.

稳定币设计的核心思想是Lending-LiquidatingAMM算法。这个想法是,它在抵押品和稳定币之间进行转换。如果抵押品的价格很高--用户的存款都是ETH,但当价格降低时,它就会转换为USD稳定币。这与传统的AMM设计有很大不同,传统的AMM设计是将USD稳定币放在上面,ETH放在下面。

Thebelowdescriptiondoesn’tserveasfullyself-consistentrigorousproofs.Alotofthat(especiallytheinvariant)areobtainedfromdimensionalconsiderations.Moreresearchmightberequiredtohaveafullmathematicaldescription,howeverthebelowisbelievedtobeenoughtoimplementinpractice.

Curve创始人通过OTC卖出750万CRV,目前持有8260万美元的贷款:金色财经报道,Lookonchain监测数据显示,Curve创始人Michael Egorov刚刚通过OTC又卖出了750 万CRV,并在Aave上偿还了300万美元 USDT。他目前持有8260万美元的贷款,分别为:Aave上 5124万 USDT;Abracadabra上 1200万 MIM;Fraxlend 上 919万 FRAX;Inverse 940万 DOLA;Silo上有 74万 XAI。[2023/8/3 16:14:40]

下面的描述并不能作为一个完全自洽的严谨证明。很多东西都是从各种维度考虑得到的。要有一个完整的数学描述,可能需要更多的研究,然而下面的描述被认为足以支持在智能合约中实施。

Thisisonlypossiblewithanexternalpriceoracle.Inanutshell,ifonemakesatypicalAMM(forexamplewithabondingcurvebeingapieceofhyperbola)andrampsits“centerprice”from(forexample)downtoup,thetokenswilladiabaticallyconvertfrom(forexample)USDtoETHwhileprovingliquidityinbothwaysontheway(Fig.3).Itissomewhatsimilartoavoidedcrossing(alsocalledLandau-Zenertransition)inquantumphysics(thoughonlyasanidea:mathematicaldescriptionoftheprocesscouldbeverydifferent).Therangewheretheliquidityisconcentratediscalledbandhere,attheconstantpobandhasliquidityfrompcdtopcu.Weseekforpcd(po)andpcu(po)beingfunctionsofpoonly,functionsbeingmoresteepthanlinearand,hence,growingfasterthanpo(Fig.4).Inaddition,let’sdefifinepricesp↓andp↑beingpriceswherep↓(po)=po,andp↑(po)=po,definingendsofbandsinadiabaticlimit(e.g.p=po).

这只有通过外部预言机喂价才能实现。简而言之,如果一个人做了一个典型的AMM,并将其"中心价格"从下降到上升,代币将从USD“绝热”地转换为ETH,同时在过程中提供两种方式的流动性。这有点类似于量子物理学中的“回避交叉”。

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

Figure3:Behaviorofan“AMMwithanexternalpricesource”.Externalpricepcenterdeterminesapricearoundwhichliquidityisformed.AMMsupportsliquidityconcentratedfrompricespcdtopcu,pcd<pcenter<pcu.Whencurrentpricepisoutofrangebetweenpcdandpcu,AMMiseitherfullyinstablecoin(whenatpcu)orfullyincollateral(whenatpcd).Whenpcd≤p≤pcu,AMMpriceisequaltothecurrentpricep.

Curve原生稳定币crvUSD铸造数量突破1.1亿枚:7月20日消息,Curve原生稳定币crvUSD铸造数量突破1.1亿枚。其中基于wstETH的铸造数量为5767万枚,基于WBTC的铸造数量约为2337万枚,基于sfrxETH的铸造数量为979万枚,基于ETH的铸造数量为343万枚。[2023/7/20 11:06:31]

Figure4:AMMwhichwesearchfor.WeseektoconstructanAMMwherepcdandpcuaresuchfunctionsofpothatwhenpogrows,theygrowevenfaster.Inthiscase,thisAMMwillbeallinETHwhenETHisexpensive,andallinUSDwhenETHischeap.

Westartfromanumberofbandswhere,similarlytoUniswap3,hyperbolicshapeofthebondingcurveispreservedbyaddingvirtualbalances.Letsay,theamountofUSDisx,andtheamountofETHisy,thereforethe“amplifified”constant-productinvariantwouldbe:

我们从一些波段开始,与Uniswap3类似,通过增加“虚拟余额”,保留了粘合曲线的双曲形状。比方说,USD的数量是x,ETH的数量是y,因此"增强的"常数-产品不变性将是:

Wealsocandenotex0≡x?+?fandy0≡y+gsothattheinvariantcanbewrittenasafamiliarI=?x0y0.However,fandgdonotstayconstant:theychangewiththeexternalpriceoracle(andsodoestheinvariantI,soitisonlytheinvariantwhiletheoraclepricepoisunchanged).Atagivenpo,fandgareconstantacrosstheband.Asmentionedbefore,wedenotep↑asthetoppriceofthebandandp↓asthebottompriceoftheband.WedefifineA(ameasureofconcentrationofliquidity)insuchawaythat:

我们也可以表示x0≡x+f和y0≡y+g,这样不变式就可以写成熟悉的I=x0y0。然而,f和g并不是保持不变的:它们随着外部预言机价格的变化而变化。在给定的po下,f和g在整个波段内是不变的。如前所述,我们把p↑表示为波段的顶部价格,p↓表示为波段的底部价格。我们对A的定义是这样的:

Thepropertywearelookingforissuchthathigherpriceposhouldleadtoevenhigherpriceatthesamebalances,sothatthecurrentmarketprice(whichwill,onaverage,followpo)islowerthanthat,andthebandwilltradetowardsbeingallinETH(andtheoppositeisalsotruefortheotherdirection).Itispossibletofindmanywaystosatisfythatbutweneedone:

我们正在寻找的属性是这样的:更高的价格po应该导致在相同的余额下更高的价格,因此,当前的市场价格低于这个价格,并且波段将朝着全部为ETH的方向交易。可以找到很多方法来满足,但我们需要这样一个:

wherey0isap0-dependentmeasureofdepositsinthecurrentband,denominatedinETH,defifinedinsuchawaythatwhencurrentpricep,p↑andpoareequaltoeachother,theny=y0andx=0(seethepointatpo=p↑onFig.4).Thenifwesubstituteyatthatmoment:

Optimism社区发起向Curve流动池分配100万枚OP代币的提案:7月25日消息,以太坊二层扩容网络Optimism社区成员发起提案,计划向Curve的sUSD、sETH、sBTC池按比例分配100万枚OP代币,其中每周5万枚,共分发20周。据悉,在每周分配的5万枚OP中,25,000OP用于sUSD池,15,000OP用于sETH池,10,000OP用于sBTC池。[2022/7/25 2:35:28]

其中y0是一个与p0相关的衡量当前波段存款的指标,以ETH为单位,其定义是:当当前价格p、p↑和po相互相等时,则y=y0,x=0。那么,如果我们把那一刻的y替换掉:

Priceisequaltodx0/dy0whichthenforaconstant-productinvariantis:

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

Onecansubstitutesituationswherepo=p↑orpo=p↓withx=0ory=0correspndinglytoverifythattheaboveformulasareself-consistent.

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

Typicallyforaband,weknowp↑and,hence,p↓,po,constantA,andalsoxandy(currentdepositsintheband).Tocalculateeverything,weneedtofindyo.Itcanbefoundbysolvingthequadraticequationfortheinvariant:

通常对于一个波段,我们知道p↑,因此也知道p↓、po、常数A,还有x和y。为了计算剩下的一切,我们需要找到yo。它可以通过解决不变量的二次方程来找到:

whichturnsintothequadraticequationagainstyo:

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

Inthesmartcontract,wesolvethisquadraticequationinget_y0function.

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

Whileoraclepricepostaysconstant,theAMMworksinanormalway,e.g.sellsETHwhengoingup/buysETHwhengoingdown.Bysimplysubstitutingx=0forthe“currentdown”pricepcdory=0forthe“currentup”pricepcuvaluesintotheequationoftheinvariantrespectively,itispossibletoshowthatAMMpricesatthecurrentvalueofpoandthecurrentvalueofp↑are:

在预言机价格po保持不变的情况下,AMM以正常的方式工作,例如,上涨时卖出ETH/下跌时买入ETH。通过简单地将x=0替换为"当前下跌"的价格pcd或y=0替换为"当前上涨"的价格pcu值分别代入不变量方程,就可以说明在po的当前值和p↑的当前值下的AMM价格是:

Anotherpracticallyimportantquestionis:ifpricechangesupordownsoslowlythattheoraclepricepoisfullycapabletofollowitadiabatically,whatamounty↑ofETH(ifthepricegoesup)orx↓ofUSD(ifthepricegoesdown)willthebandendupwith,givencurrentvaluesxandyandthatwestartalsoatp=po.Whileit’snotanimmediatelytrivialmathematicalproblemtosolve,numericcomputationsshowedaprettysimpleanswer:

Curve将发行首个原生稳定币:金色财经报道,加密交易流动性池Curve正在寻求推出首个原生稳定币,该公司首席执行官迈克尔·埃戈罗夫(Michael Egorov)透露,该稳定币将被超额抵押并拥有超过已发行稳定币数量的加密货币代币或其他资产储备,但迈克尔·埃戈罗夫没有详细说明将作为新产品储备的具体资产,也没有具体说明发布日期。(Blockworks)[2022/7/22 2:30:31]

另一个重要的实际问题是:如果价格的变化如此缓慢,以至于预言机价格po完全能够”绝热地”跟随它,那么在给定当前值x和y,并且我们也从p=po开始的情况下,这个波段最终会得到多少y↑的ETH或x↓的USD。虽然这不是一个立即可以解决的数学问题,但数字计算显示了一个相当简单的答案:

WewillusetheseresultswhenevaluatingsafetyoftheloanaswellasthepotentiallossesoftheAMM.

在评估借贷的安全性以及AMM的潜在损失时,我们将使用这些结果。

Nowwehaveadescriptionofoneband.Wesplitallthepricespaceintobandswhichtoucheachotherwithpricesp↓andp↑sothatifwesetabasepricepbaseandhaveabandnumbern:

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

ItispossibletoprovethatthesolutionofEq.7andEq.5foranybandgives:

对于任何一个波段,可以证明公式7和公式5的解都可以得到:

whichshowsthattherearenogapsbetweenthebands.

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

TradesoccurwhilepreservingtheinvariantfromEq.1,howeverthecurrentpriceinsidetheAMMshiftswhenthepricepo:itgoesupwhenpogoesdownandviceversacubically,ascanbeseenfromEq.8.

交易发生的同时保留了公式1的不变性,然而,当价格为po时,AMM内部的当前价格会发生变化:当po下降时,它就会上升,反之亦然,从公式8可以看出。

LLAMMAvsStablecoin

StablecoinisaCDPwhereoneborrowsstablecoinagainstavolatilecollateral(cryptocurrency,forexample,againstETH).ThecollateralisloadedintoLLAMMAinsuchapricerange(suchbands)thatifpriceofcollateralgoesdownrelativelyslowly,theETHgetsconvertedintoenoughstablecointocoverclosingtheCDP(whichcanhappenviaaself-liquidation,orviaanexternalliquidationifthecoverageistooclosetodangerouslimits,ornotcloseatallwhilewaitingforthepricebounce).

稳定币是一种CDP,人们以不稳定的抵押品来借入稳定币。抵押品被加载到LLAMMA的价格范围内,如果抵押品的价格下降相对缓慢,ETH被转换成足够的稳定币来覆盖关闭CDP。

Digital Currency Group将总部搬至康涅狄格州斯坦福德:11月30日消息,加密集团Digital Currency Group将总部从纽约市搬至康涅狄格州斯坦福德,根据康涅狄格州州长Ned Lamont办公室的一份声明,DCG预计将在未来五年内在该州创造300多个新工作岗位。(彭博社)[2021/11/30 12:40:56]

Whenauserdepositscollateralandborrowsastablecoin,theLLAMMAsmartcontractcalculatesthebandswheretolocatethecollateral.?Whenthepriceofthecollateralchanges,itstartsgettingconvertedtothestablecoin.Whenthesystemis“underwater”,useralreadyhasenoughUSDtocovertheloan.Theamountofstablecoinswhichcanbeobtainedcanbecalculatedusingapublicget_x_downmethod.Ifitgivesvaluestooclosetotheliquidationthresholds-anexternalliquidatorcanbeinvolved(typicallyshouldn’thappenwithinafewdaysorevenweeksafterthecollateralpricewentdownandsideways,orevenwillnothappeneverifcollateralpricenevergoesuporgoesbackuprelativelyquickly).Ahealthmethodreturnsaratioofget_x_downtodebtplusthevalueincreaseincollateralwhenthepriceiswellabove“liquidation”.

当用户存入抵押品并借入一个稳定币时,LLAMMA智能合约会计算出抵押品所在的波段。当抵押品的价格变化时,它开始被转换为稳定币。当系统处于"水下"时,用户已经有足够的USD来支付贷款。可以获得的稳定币数量可以通过一个公共的get_x_down方法来计算。如果它给出的数值过于接近清算阈值--外部清算人可以参与进来。当价格远高于"清算"时,一个健康的方法会返回get_x_down与债务的比率,再加上抵押品的价值增加。

Whenastablecoinchargesinterest,thisshouldbereflectedintheAMM,too.Thisisdonebyadjustingallthegridofprices.So,whenastablecoinchargesinterestrater,allthegridofpricesintheAMMshiftsupwardswiththesameraterwhichisdoneviaabase_pricemultiplier.So,themultipliergoesupovertimeaslongasthechargedrateispositive.

当一个稳定币收取利息时,这应该反映在AMM中。也要反映出来。这是通过调整价格的所有网格来实现的。因此,当一个稳定币收取利率r时,AMM中的所有价格格都会向上移动,与相同的利率r,这是通过一个基础价格乘数完成的。所以,只要收取的利率是正的,乘数会随着时间的推移而上升。

Whenwecalculateget_x_downorget_y_up,wearefirstlookingfortheamountsofstablecoinandcollateralx?andy?ifcurrentpricemovestothecurrentpricepo.Thenwelookathowmuchstablecoinorcollateralwegetifpoadiabaticallychangestoeitherthelowestpriceofthelowestband,orthehighestpriceofthehighestbandrespectively.Thisway,wecangetameasureofhowmuchstablecoinwewillwhichisnotdependentonthecurrentinstantaneousprice,whichisimportantforsandwichattackresistance.

当我们计算get_x_down或get_y_up时,我们首先要找的是如果当前价格移动到当前价格po的稳定币和抵押品x?和y?的数量。然后我们看一下,如果po绝热地变化到最低区间的最低价格,或最高区间的最高价格,我们分别得到多少稳定币或抵押品。这样,我们就可以得到一个衡量我们将获得多少稳定币的标准,它不依赖于当前的瞬时价格,这对夹层攻击的阻力很重要。****

ItisimportanttopointoutthattheLLAMMAusespodefinedasETH/USDpriceasapricesource,andourstablecoincouldbetradedunderthepeg(ps<1)oroverpeg(ps>1).Ifps<1,thenpriceintheLLAMMAisp>po.

需要指出的是,LLAMMA使用定义为ETH/USD价格的po作为价格来源,我们的稳定币可以在挂钩之下或超过挂钩进行交易。如果ps<1,那么LLAMMA中的价格就是p>po。

Inadiabaticapproximation,p=po/ps,andallthecollateral<>stablecoinconversionwouldhappenatahigheroracleprice/asiforaclepricewaslowerandequalto:

在绝热近似中,p=po/ps,所有抵押品<>稳定币的转换将发生在较高的预言机价格上/就像预言机价格较低且等于:

Atthisprice,theamountofstablecoinsobtainedatconversionishigherbyfactorof1/ps(ifps<1).

在这个价格下,转换时获得的稳定币的数量要高出1/ps的系数。

Itislessdesirabletohaveps>1forprolongedtimes,andforthatwewillusethestabilizer(seenext)

在长时间内,ps>1是不太理想的,为此我们将使用稳定器。

AutomaticStabilizerandMonetaryPolicy

自动稳定器和货币政策

Whenps>1(forexample,becauseoftheincreaseddemandforstablecoin),thereispeg-keepingreserveformedbyanasymmetricdepositintoastableswapCurvepoolbetweenthestablecoinandaredeemablereferencecoinorLPtoken.Onceps>1,thePegKeepercontractisallowedtomintuncollateralizedstablecoinand(only!)depositittothestableswappoolsingle-sidedinsuchawaythatthefinalpriceafterthisisstillnolessthan1.Whenps<1,thePegKeeperisallowedtowithdraw(asymmetrically)andburnthestablecoin.

当ps>1时,就会有锚定的储备,由稳定币和可赎回的参考币或LP代币之间的不对称存款到stableswapCurve池形成。一旦ps>1,PegKeeper合约被允许铸造无抵押的稳定币,并且只将其单边存入stableswap池,这样做之后的最终价格仍然不低于1。当ps<1时,PegKeeper被允许提取并烧毁稳定币。

Theseactionscausepricepstoquicklydepreciatewhenit’shigherthan1andappreciateiflowerthan1becauseasymmetricdepositsandwithdrawalschangetheprice.Eventhoughthemintisuncollateralized,thestablecoinappearstobeimplicitlycollateralizedbyliquidityinthestablecoinpool.Thewholemint/burncycleappears,attheend,tobeprofitablewhileprovidingstability.

这些行为导致价格ps高于1时迅速贬值,低于1时升值,因为不对称的存款和提款改变了价格。即使这部分“铸币”是没有抵押的,但稳定币似乎是由稳定币池中的流动性隐性抵押支持的。整个铸币/燃烧周期在最后似乎是有利可图的,同时提供了稳定性。

Let’sdenotetheamountofstablecoinmintedtothestabilizer(debt)asdstandthefunctionwhichcalculatesnecessaryamountofredeemableUSDtobuythestablecoininastableswapAMMget_dxasfdx().Then,inordertokeepreservesnotverylarge,weusethe“slow”mechanismofstabilizationviavaryingtheborrowr:

让我们把铸造给稳定器的稳定币数量表示为dst,把计算在stableswapAMMget_dx中购买稳定币所需的可赎回USD数量的函数表示为fdx。然后,为了保持“储备”不是非常大,我们通过改变借款r来使用"缓慢"的稳定机制。

wherehisthechangeinpsatwhichtheraterchangesbyfactorof2(higherpsleadstolowerr).Theamountofstabilizerdebtdstwillequilibrateatdifferentvaluedependingontherateatps=1r0.Therefore,wecan(insteadofsettingmanually)bereducingr0whiledst/supplyislargerthansometargetnumber(forexample,5%)(therebyincentivizingborrowerstoborrow-and-dumpthestablecoin,decreasingitspriceandforcingthesystemtoburnthedst)orincreasingifit’slower(therebyincentivizingborrowerstoreturnloansandpushingpsup,forcingthesystemtoincreasethedebtdstandthestabilizerdeposits).

其中h是ps的变化,速率r的变化为2倍。稳定器债务dst的数量将根据ps=1r0的速率在不同的值上平衡。因此,我们可以在dst/supply大于某个目标数字时减少r0,或者在它较低时增加。

Conclusion/总结

Thepresentedmechanismscan,hopefully,solvetheriskinessofliquidationsforstablecoin-makingandborrowingpurposes.Inaddition,stabilizerandautomaticmonetarypolicymechanismscanhelpwithpeg-keepingwithouttheneedofkeepingoverlybigPSMs.

希望所提出的机制能够解决为制造稳定币和借贷目的而进行清算的风险性。此外,稳定器和自动货币政策机制可以帮助保持价格锚定,而不需要保持过大的PSM。

郑重声明: 本文版权归原作者所有, 转载文章仅为传播更多信息之目的, 如作者信息标记有误, 请第一时间联系我们修改或删除, 多谢。

链链资讯

[0:15ms0-6:904ms