The number of attacks and accidents leading to significant losses of
crypto-assets is growing. According to Chainalysis, in 2021, approx. 14billionhasbeenlostduetovariousincidents,andthisnumberisdominatedbyDecentralizedFinance(DeFi)applications.Inordertoaddresstheseissues,onecanuseacollectionoftoolsrangingfromauditingtoformalmethods.WeuseformalverificationandprovidethefirstformalisationofaDeFicontractinafoundationalproofassistantcapturingcontractinteractions.WefocusonDexter2,adecentralized,non−custodialexchangefortheTezosnetworksimilartoUniswaponEthereum.TheDexterimplementationconsistsofseveralsmartcontracts.Thisposesuniquechallengesforformalisationduetothecomplexcontractinteractions.OurformalisationincludesproofsoffunctionalcorrectnesswithrespecttoaninformalspecificationforthecontractsinvolvedinDexter′simplementation.Moreover,ourformalisationisthefirsttofeatureproofsofsafetypropertiesoftheinteractingsmartcontractsofadecentralizedexchange.WehaveextractedourcontractfromCoqintoCameLIGOcode,soitcanbedeployedontheTezosblockchain.UniswapandDexterareparadigmaticforacollectionofsimilarcontracts.OurmethodologythusallowsustoimplementandverifyDeFiapplicationsfeaturingsimilarinteractionpatterns.