public async Task <string> DeployContract(ContractOffer offer) { //deploy (=create) the contract, save it in the blockahin and in the DB table - AssetInContracts double beforeBalanceETH = await DappAccountController.get_ETH_Balance(offer.SellerPublicKey, offer.SellerPublicKey); double beforeBalanceILS = await DappAccountController.get_ILS_Balance(offer.SellerPublicKey, offer.SellerPublicKey); double exchangeRate = DappAccountController.getExchangeRate_ETH_To_ILS(); double afterBalanceETH; double afterBalanceILS; double feeETH; double feeILS; try { InsertAssetInContractToDB(offer, "Busy"); var account = DappAccountController.openWith[offer.SellerPublicKey.ToLower()]; var ContractAddress = await SmartContractService.Deploy(account, offer); afterBalanceETH = await DappAccountController.get_ETH_Balance(offer.SellerPublicKey, offer.SellerPublicKey); afterBalanceILS = await DappAccountController.get_ILS_Balance(offer.SellerPublicKey, offer.SellerPublicKey); feeETH = beforeBalanceETH - afterBalanceETH; feeILS = beforeBalanceILS - afterBalanceILS; InsertAssetInContractToDB(offer, ContractAddress); RemoveBusyAssetInContractFromDB(offer); DeploymentRecipt recipt = new DeploymentRecipt(); 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); return(ReciptJson); } catch (Exception e) { RemoveBusyAssetInContractFromDB(offer); return("Error"); } }