public async Task <string> CancelDealAsBuyer(string ContractAddress, string Notes, string PublicKey) { //deny the contract /cancel the contract sent by seller DappAccount account = DappAccountController.openWith[PublicKey]; SmartContractService deployedContract = new SmartContractService(account, ContractAddress); double beforeBalanceETH = await DappAccountController.get_ETH_Balance(PublicKey, PublicKey); double beforeBalanceILS = await DappAccountController.get_ILS_Balance(PublicKey, PublicKey); double exchangeRate = DappAccountController.getExchangeRate_ETH_To_ILS(); double afterBalanceETH; double afterBalanceILS; double feeETH; double feeILS; bool isDenied = false; isDenied = await deployedContract.denyDeal(); if (isDenied == true) { afterBalanceETH = await DappAccountController.get_ETH_Balance(PublicKey, PublicKey); afterBalanceILS = await DappAccountController.get_ILS_Balance(PublicKey, PublicKey); feeETH = beforeBalanceETH - afterBalanceETH; feeILS = beforeBalanceILS - afterBalanceILS; ConfirmationRecipt recipt = new ConfirmationRecipt(); recipt.ContractAddress = ContractAddress; recipt.feeETH = feeETH; feeILS = Math.Truncate(feeILS * 100) / 100; //make the double number to be with 3 digits after dot recipt.feeILS = feeILS; var ReciptJson = Newtonsoft.Json.JsonConvert.SerializeObject(recipt); updateOfferToDenied(ContractAddress, Notes); return(ReciptJson); } return("Fail"); }