public async Task <string> CancelContractAsRegulator(string ContractAddress, string DenyNotes) { //cancel the contract and return the money to the buyer DappAccount account = RegulatorController._regulator; await DappAccountController.RefreshAccountData(account.publicKey); SmartContractService deployedContract = new SmartContractService(account, ContractAddress); double beforeBalanceETH = await DappAccountController.get_ETH_Balance(account.publicKey, account.publicKey); double beforeBalanceILS = await DappAccountController.get_ILS_Balance(account.publicKey, account.publicKey); double exchangeRate = DappAccountController.getExchangeRate_ETH_To_ILS(); double afterBalanceETH; double feeETH; double feeILS; var ReciptJson = ""; var isCanceled = await deployedContract.cancelDeal(); if (isCanceled == true) { afterBalanceETH = await DappAccountController.get_ETH_Balance(account.publicKey, account.publicKey); feeETH = beforeBalanceETH - afterBalanceETH; feeILS = feeETH * exchangeRate; feeILS = Math.Truncate(feeILS * 100) / 100; //make the double number to be with 3 digits after dot RegulatorConfirmationRecipt recipt = new RegulatorConfirmationRecipt(); recipt.ContractAddress = ContractAddress; recipt.feeETH = feeETH; recipt.feeILS = feeILS; ReciptJson = Newtonsoft.Json.JsonConvert.SerializeObject(recipt); UpdateContractToDeniedAsRegulatorInDB(ContractAddress, DenyNotes); return(ReciptJson); } else { throw new Exception("No money the sign the transaction"); } }