Decentralized Finance

Page 1

DecentralizedFinance

a ,... b ,... c d e

abcde a b c d e

Abstract

DeFi,short,forDecentralizedFinancerepresentsasystemthatharnessesthepowerofblockchaintechnology.Iteliminatesthe involvementofintermediaries.Allowsforlending,borrowingandassettransfersontheblockchain.Thisstudycentersarounda DeFiplatformthatsimplifiescryptotokensstakingandborrowingprocesses.Usershavetheopportunitytojoinabankingsystem wheretheycanearninterestbylendingtheirassetsandloansusingcollateral.Toensurefairnessandautomatecalculationsthis platformutilizescontractsremovingtheinfluenceofauthorities.ItoperatesontheEthereumblockchainensuringassettransfers andfacilitatingpeertopeertransactions.InconclusionDeFirevolutionizeshowweaccessservicesbymakingthemtransparent, efficientandaccessible,toall.ThisresearchdelvesintoaDeFiplatformaimingtoenhancethesequalitiescontributingtothe evolutionofDeFislandscape.

Keywords

Blockchain,Smartcontract,Oracle,DecentralizedExchange,LiquidityPool

1.Introduction

Thefinanciallandscapewasrevolutionizedbytheintroduction oftechnologystartingwithBitcoinin2009[1].Blockchainis aledgerthatcannotbealteredandisvisible,toallnetwork participantswhilebeingtamperproof.Itoffersadvantages, includingsecurityduetotheextensivecomputationalresources requiredtomodifythechaintransparenttransactionhistories accessibletoeveryoneanduseranonymityprotectedbyprivate andpublickeys.Byoperatinginamannerblockchaineliminates theneed,foranauthorityandautomatesfinancialprocesses reducinghumaninvolvement.

Theissueliesinfinancesystemswherebanksandinstitutions exertcontrolandimposefeesontransactionserodingcontrol overassets.The2008financialcrisisdemonstratedthedangers ofthissystemasgreedandmismanagementcontributedtoan economicdownturn.Whilelargecorporationsthrivedordinary citizenssuffered,revealingtheunfairnessofthesystem.

Thisresearchaimstointroduceamodelofmanagingassetsusing automatedsystemsandcomputeralgorithms.Theobjectiveis toestablishafinanceplatformbasedonEthereumthatallows userstoearninterestbystakingassetsandborrowcurrency withcollateralfromanindependentliquiditypoolgovernedby smartcontracts.Thisprojectseekstoempowerindividualsby providingthemwithsecureandtransparentoptionsthataddress theshortcomingsofcentralizedfinance.

2.BackgroundandRelatedWorks

2.1 DecentralizedFinance

Decentralizedfinance[2]isarelativelynewtechnological advancementthathasgainedsignificantpopularityoverthepast decade.SeveralDeFiplatformshaveemergedovertheyears thathavebeenabletobringbillionsofdollarsworthofcapital intothedecentralizedmarket.Thetotalmarketcapitalization hasalreadycrossed90billiondollarsandisincreasingsteadily.

Amongmanyavailableplatformsoftransactions,morethanhalf ofthecapitalizationvalueisaccountedforbythetopfiveDeFi projects[3].TheseexistingDeFiprojectsarethemostvaluable literatureforustocompletethisproject.

2.2 RelatedWork

CurveFinance(2020)andCompound(2018)aretwoofthe biggestdecentralizedexchangeplatformsthatareinoperation atpresent.Bothofthesemoneymarketprotocolsarebased onEthereumandallowsuper-efficientstablecointrading.The liquidityinCurve[4]issplitacrossseven‘curvepools’where eachpoolmintsitsparticularERC-20tokentoliquidityproviders whichcanthenbeexchangedformanydifferentassets.Itis knownforallowinguserstotradewithverylittleslippageand lowfees.Compound[5],ontheotherhand,isfamousforallowing userstotakeoutovercollateralizedloans.Inthisplatform,users canborrowupto75percentoftheinitialcollateralamount.The intereststartstoaccrueimmediatelyandcontinuesthroughout theloanduration;thenthename‘Compound’.Theassetsinthis protocolarerepresentedintermsofC-tokens.

3.Methodology

3.1 BlockDiagram

Lenderscontributetheirassetstoasharedpoolofliquidity whichhelpscreateconnections,betweenpeoplewhowantto depositmoneyandthosewhoneedtoborrowit.Lendersearn interestontheassetstheyprovideuntiltheychoosetowithdraw them.Borrowersonthehandoffertheircryptocurrencyassetsas collateral,whichdetermineshowmuchtheycanborrow—less thanthetotalvalueoftheircollateralinthemarket.Thesystems algorithmstakeintoaccountexchangeratestocalculatetheloan amountatthecurrentinterestrate.Borrowersareresponsiblefor payinginterest.Theratesareadjustedautomaticallytomaintain abalancebetweensupplyanddemand.TheDeFiprotocol overseesalltransactionsensuringautomatedlendingand

IOEGraduateConference [Placeholderfor Publication Information]
Pages:1–5

3.2 StakingFunction

Thestakingfeature,inaDeFiprotocolallowsuserstolend theirassetstoaliquiditypoolinexchangeforearninginterest. Theinterestratesvarydependingonthesupplyanddemand dynamics.Eachindividualwhoparticipatesinstakingisassigned anidentificationnumber.Hasaspecificwalletaddressassociated withthem.Thesedetailsincludetheamounttheyhavestakedand theinteresttheyhaveearnedfar.Whenuserslendtheirassetsit contributestothepool,whichisthenutilizedforprovidingloans. Interestisperiodicallyaddedtothepool.UnlikebanksDeFirates areflexible.Donotautomaticallycompoundduetoshortterm lendingarrangements.Toensureaccuracyincalculatinginterest redundancyisprevented.Usershavetheoptiontowithdraw theirassetseitherinjusttheaccruedinterest,withthewithdrawn assetsbeingsenttotheirdesignatedwalletaddress.Anyunused structuresrelatedtostakerscanbe.Cleanedduringsystem updates.

3.3 BorrowingFunction

TheborrowingfeatureoftheDeFiprotocolenablesusersto borrowUSDCfromtheliquiditypoolwithinterestrates comparedtowhatstakersreceive.Tobeeligible,forborrowing usersneedtoprovidecollateralinEthereumorETHassets.The maximumamountthatcanbeborroweddependsonthe”Rateof ETH”whichreflectsthevalueofEthereuminrelationtoUSDC intheexchangemarket.Weobtainreal-timeEthereumprice datafromtheChainlink[6]Oracle,ensuringaccurateand up-to-dateinformationforourDeFiprotocol.Thisensuresthat thereiscollateralthantheamountborrowed.Borrowersare assignedIDsorkeyssimilartostakerscontaininginformation liketheborrowedamount,timestamp,totalinterestdueand collateraldepositedforloansecurity.Incaseaborrowerdefaults ontheirloanoriftherearemarketfluctuationstheircollateral

canbeliquidated.Theborrowermayinitiatethisprocess.Itmay happenautomaticallyduetomarketconditions.Measuresarein placetopreventanyredundancyandensuretrackingof borrowinghistory.Loanscanberepaidtoreleasethecollateral. Ifaloanisconsideredbaditwilltriggertheliquidationprocess asexplainedfurtherinthereportwhichdiscussesits implications,forbothborrowersandtheprotocol.

3.4 UsecaseDiagram

UseCasediagramshowstheusers,admin,theDeFiprotocol andtheblockchainasthevariousactorsthatcontributeinthe operationoftheoverallsystembypassingthefunctionalrequests andprocessingthemtoobtainthedesiredresults.

3.5 LiquidityPool

TheliquiditypoolactsastheelementoftheDeFiprotocol.It servesasarepository,forUSDCassets.Providesfundsfor lendingtoborrowers.Thinkofitasarepresentationoftheassets atanygiventime.ThepoolgrowswhenstakersdepositUSDC expandingthefundsandshrinkswhenborrowerswithdraw USDCinexchangeforEthereumcollateralreducingtheassets. Likewisewhenborrowersrepaytheirloanstheyreturnthe borrowedUSDCtothepoolincreasingthetokens.Stakershave theoptiontowithdrawtheirassetswhenevertheywantwhich decreasestheamountinthepool.It’simportanttonotethatthese fundmovementsdon’trequireactions.Borrowersarenot

DecentralizedFinance borrowingprocesses,foritsusers.
2

obligatedtowithdrawloansafterstakingthem.Stakersdonot havetowaitforborrowerstorepaybeforewithdrawingtheir assets.Althoughstakersandborrowersimpacttheliquiditypool theiractionsarenotdependentoneachother;theycanmake choicesindependentlybasedontheirpreferences.Thepoolplays aroleinmaintainingabalance,betweenthesupplyanddemand ofUSDCtokenswithintheprotocol.Thisequilibriumhelps establishinterestratesandpreventssituationscausedby excessiveactivityfromeitherstakersorborrowers.

3.6 IntrestMechanism

Thefunctionalityrelatedtointerestplaysarole,intheoperation oftheliquiditypool.Borrowersareresponsibleforpaying interestintoasharedpool(interestpool)whilestakersreceive theirinterestfromthepool.Thisinterestpoolhelpsmaintain balanceintheliquiditypool.Whenmoreborrowersjoinit increasestheinterestmakingstakingmoreattractive.Onthe handifthereisaninfluxofstakersitreducesindividualinterest earnings.Theinterestratesforbothstakersandborrowersare notfixedandcanvarybasedonmarketconditionschangesin supplyanddemandandotherfactors.Stakersinterestis determinedbytheratesofferedtoexistingstakers.Isdistributed atintervalsalignedwithblockchainblockcreation.Thismethod helpsstabilizefluctuationsininterestrates.Mayresultin patternswithoutanyintervention.Borrowersexperienceinterest ratesovertimeensuringconsistencyintheirloanpayments. Howeverstakersinterestearningsareproportionaltotheirshare ofassetsbeingstaked.Thisallowsfordistributionofearnings, amongallstakeholders.Helpsmaintainabalancedsupply demandratiowithintheprotocol.

3.7 Assetsliquidation

Liquidationisasafetymeasure,withintheDeFiprotocol.Itis triggeredunderconditions,oneofwhich’swhenaborrowerfails torepaytheirloanorinterestontime.Thishelpsprotectlenders andensuresthatthefundsarerecovered.Anothersituationthat mayleadtoliquidationisifthevalueoftheassetsfallsbelowthe

valueoftheborrowedassetsduetomarketchanges.Thishelps managerisks.Theprocessinvolvessomeautomation,where administratorsinitiateliquidation.Thesystemautomatically identifiesaccountsthatqualifyforitbasedonfactorslikeinterest. Duringliquidationthecollateralassetsaresoldatmarketprices throughUniswap[7].AnyobtainedUSDCisaddedbacktothe liquiditypooltorecoverlossesincurredbyborrowers.This proactiveapproachalongwithusingassetslikeEthereumand USDCenhancesstabilitywithintheprotocol.Reducesrisks associatedwithassetvaluefluctuations,inthedynamiccrypto market.

4.ExperimentsandResult

Thissectiondescribesthedetailedprocedureofdeployingand testingthesmartcontractandthewebapplicationdesignedfor transactionsofUSDCandGoreliETHusingMetamask.

4.1 SmartContractdeploymentandtesting

OnesmartcontractwasdevelopedontheEthereumtestnetand followingunittestswereconductedtoensureitsproper implementation.

4.1.1 ConnectiontotheWallet(MetaMask)

Thetestincludedestablishingasecureconnectionwiththe MetaMasknetworkbyencouragingtheuserstoinputtheir credentialsinordertomakeuseoftheservicesaccessible throughthewebapplication.

4.1.2 Transferoffunds

VariousformsoftransactioninvolvingtheGoreliETHandthe USDCassetswereverifiedtobeaccurateandsecure.These transactionsinvolvedtheusersandthesmartcontract’sliquidity poolsastheinteractingparties.

4.1.3 Calculations

Severalcalculationsthatneededtobeperformedbythesmart contractfortheproperfunctioningofthesystemwereevaluated andverifiedtobeconsistentwiththeexpectedresults.These testsverifiedtheaccuracyoftheinterestratecalculation,interest amountcalculations,andalsoevaluationsofconditionsthatwere subjecttotriggeringliquidationclauses.

4.2 BorrowingofUSDCassets

TheborrowingtransactioninvolvedthetransferofGoreliETH fromtheEthereumwalletoftheborrowertotheliquiditypoolof thesmartcontractandinreturntransferofUSDCassetsfrom theliquiditypooltotheEthereumwalletoftheborrowingparty. ThistransactionsuppliedthecollateralEthereumtothefinance protocolwhilealsogeneratingameansfortheusageofthe USDCassetsstakedbythelenders.

IOEGraduateConference
3

4.4 InterestRateCalculation

Thecalculationofinterestrateofferedtothestakingusersis dynamicallycalculatedusingreal-timeassetvaluationdata accessedfromtheinterestpool.Thesmartcontractperiodically performsthecalculationswiththeuseofthelatestdatafromthe interestpooltoupdatetheinterestratetobeusedtoperform transactionswithborrowersandstakers.

4.5 InterestAmountCalculation

Thecalculationoftheinterestamounthappensintwodistinct, yetinterrelatedportions:

• InterestAmountchargedfromtheborrowers

Thesmartcontractcalculatestheinterestamountto bechargedtoeachoftheborrowersusingthedynamic interestrateobtainedfromtheinterestpooldata.The interestamountthuspaidbytheborrowersisaddedtothe interestpool,alsomaintainedbythesamesmartcontract, whichthenbecomesthesourceofinterestamounttobe paidtothestakingusers.

4.3 StakingUSDCassets

Thestakingfunctionallowstheusersofthewebapplicationto lendtheirUSDCassetstotheliquiditypooltoearnacertain amountofinterestinreturnforthelentassets.Thisfeature allowstheprotocoltocollecttherequiredUSDCassetsto populatetheliquiditypoolandinitiatetransactionswiththe stakers.

• InterestAmountpaidtothelenders

ThesmartcontractcalculatestheratioofUSDC assetsskatedbyeachstakingusertothetotalUSDC assetsstakedintheplatform.Then,thecalculationof interestearnedbyeachlenderisperformedusingtheratio sameratio.Thesmartcontractpaysoutthecalculated amountofinteresttothelendersusingtheassetscollected intheInterestPool.

4.6 Withdrawalofassets

Theusers,eitherlendersorborrowers,canwithdrawtheirassets fromtheliquiditypoolbyinitiatingvariouseventsintheprotocol. Thelenderscansimplychoosetowithdrawtheirdueinterestor thewholeprincipalsumatanytime.Theborrowers,ontheother hand,canwithdrawtheircollateralassetsbyrepayingthetotal sumofUSDCborrowedplusthedueinterestamount.

4.7 Liquidationofassets

Liquidationofassetsisamajorfeatureofthesmartcontractto ensurethefiscalsecurityofthelendersaswellasthestabilityof theplatformitself.Thesmartcontractisdesignedtoundertake

DecentralizedFinance
4

theliquidationfunctionsautomaticallybyperiodicallyevaluating theconditionsstipulatedinthesmartcontract.Thisliquidation canbeperformedontwoseparateoccasions:

• Iftheamountofoutstandingdueinterestforaspecific borrowerexceedsthethresholdpercentage(50)ofthe borrowedamount.

• Ifthenetvalueoftheborrowedassetdepreciatesinthe globalmarketcausingittoapproachathresholdlevel thatcouldcauselosstotheplatformevenuponitsfull repayment.

5.Conclusion

Aninteractivewebapplicationprovidesaplatformforcrypto ownerstoaccesstheservicesofthesmartcontractincluding transferoffunds,stakingandborrowingofcryptoassets.The deploymentofthesmartcontractandthewebapplication,theuse oftheMetaMaskwalletandtheimplementationofthecontract intheEthereumblockchainprovidedasecureplatformforusers totradetheirassetsovertheinternet.Afullytransparentand automatedsystemtodynamicallycalculatetheinterestratesand

thedistributionofinterestestablishedatrustworthysystemfor thecryptoownerstouseandearnfromtheirassets.Integrating awidervarietyofcryptoassetsintheplatformandenabling theirtransactionscanfurtherenhancethissystembyattracting moreusersandincreasingthetransactionvolumethroughthe application.

References

[1] CalebSilver.Over10yearslater,lessonsfromthefinancial crisis.

[2] AntierSolutions.Understandingthebusinessscopefordefi, Dec2020.

[3] MilkoTrajcevski.Top5defiprojectsbymarket capitalization,Mar2021.

[4] PYMNTS.com.Pymntsdefiseries:Whatarethetopdefi platforms?,Dec2021.

[5] RobertLeshnerandGeoffreyHayes.Compound:Themoney marketprotocol,Feb2019.

[6] Chainlink.Howchainlinkpricefeedssecurethedefi ecosystem,April2022.

[7] HaydenAdams,NoahZinsmeister,andDanRobinson. Uniswapv2core,Mar2020.

IOEGraduateConference
5

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.