private static WithdrawInfo GetTransferInfo(string coinType, string txid, JArray jValue, JToken tx) { var address = ZoroHelper.GetJsonAddress((JObject)jValue[1]); var amount = ZoroHelper.GetJsonDecimal((JObject)jValue[3], 8); if (((JArray)tx["attributes"]).Count > 0) { JObject attribute = (JObject)tx["attributes"][0]; string usage = (string)attribute["usage"]; string data = Encoding.UTF8.GetString(ZoroHelper.HexString2Bytes((string)attribute["data"])); if (usage != "Remark1") { return(null); } WithdrawInfo withdrawInfo = new WithdrawInfo(); withdrawInfo.Method = "withdraw"; withdrawInfo.FromAddress = address; withdrawInfo.ReceiveAddress = data; withdrawInfo.Value = amount; withdrawInfo.CoinType = coinType; Logger.Info("Zoro destroy: Address:" + withdrawInfo.FromAddress + ", CoinType:" + withdrawInfo.CoinType + " , Value:" + withdrawInfo.Value + ", Txid: " + txid); return(withdrawInfo); } return(null); }
private static dynamic DepositResult(JArray jValue) { dynamic depositLog = new ExpandoObject(); depositLog.Address = ZoroHelper.GetJsonAddress((JObject)jValue[1]); depositLog.AssetId = ZoroHelper.GetJsonHash((JObject)jValue[2]); depositLog.Amount = ZoroHelper.GetJsonDecimal((JObject)jValue[3], 8); return(depositLog); }
private static dynamic CancelOffer(JArray notifications) { dynamic cancelOfferLog = new ExpandoObject(); cancelOfferLog.OfferAddress = ZoroHelper.GetJsonAddress((JObject)notifications[1]); cancelOfferLog.OfferHash = notifications[2]["value"].ToString(); cancelOfferLog.NftHash = ZoroHelper.GetJsonHash((JObject)notifications[3]); cancelOfferLog.TokenId = notifications[4]["value"].ToString(); cancelOfferLog.OfferFeeAssetId = ZoroHelper.GetJsonHash((JObject)notifications[5]); cancelOfferLog.FeeReturnAmount = ZoroHelper.GetJsonDecimal((JObject)notifications[6], 8); cancelOfferLog.DeductFee = ZoroHelper.GetJsonDecimal((JObject)notifications[7], 8); return(cancelOfferLog); }
private static dynamic MakeOfferResult(JArray notifications) { dynamic makeOfferLog = new ExpandoObject(); makeOfferLog.Address = ZoroHelper.GetJsonAddress((JObject)notifications[1]); makeOfferLog.OfferHash = notifications[2]["value"].ToString(); makeOfferLog.NftContractHash = ZoroHelper.GetJsonHash((JObject)notifications[3]); makeOfferLog.TokenId = notifications[4]["value"].ToString(); makeOfferLog.AcceptAssetId = ZoroHelper.GetJsonHash((JObject)notifications[5]); makeOfferLog.Price = ZoroHelper.GetJsonDecimal((JObject)notifications[6], 8); makeOfferLog.FeeAssetId = ZoroHelper.GetJsonHash((JObject)notifications[7]); makeOfferLog.FeeAmount = ZoroHelper.GetJsonDecimal((JObject)notifications[8], 8); return(makeOfferLog); }
private static dynamic FillOfferResult(JArray notifications) { dynamic fillOfferLog = new ExpandoObject(); fillOfferLog.FillAddress = ZoroHelper.GetJsonAddress((JObject)notifications[1]); fillOfferLog.OfferHash = notifications[2]["value"].ToString(); fillOfferLog.OfferAddress = ZoroHelper.GetJsonAddress((JObject)notifications[3]); fillOfferLog.FillAssetId = ZoroHelper.GetJsonHash((JObject)notifications[4]); fillOfferLog.FillAmount = ZoroHelper.GetJsonDecimal((JObject)notifications[5], 8); fillOfferLog.NftHash = ZoroHelper.GetJsonHash((JObject)notifications[6]); fillOfferLog.TokenId = notifications[7]["value"].ToString(); fillOfferLog.FillFeeAssetId = ZoroHelper.GetJsonHash((JObject)notifications[8]); fillOfferLog.FillFeeAmount = ZoroHelper.GetJsonDecimal((JObject)notifications[9], 8); fillOfferLog.OfferFeeAssetId = ZoroHelper.GetJsonHash((JObject)notifications[10]); fillOfferLog.OfferFeeAmount = ZoroHelper.GetJsonDecimal((JObject)notifications[11], 8); return(fillOfferLog); }
private static void SendGameIssueResult(ulong currentHeight, ulong blockTime, string txid, string coinType, JArray jValue, string method) { dynamic transferInfo = new ExpandoObject(); var address = ZoroHelper.GetJsonAddress((JObject)jValue[2]); var amount = ZoroHelper.GetJsonDecimal((JObject)jValue[3], 8); transferInfo.height = currentHeight; transferInfo.blockTime = blockTime; transferInfo.txid = txid; transferInfo.coinType = coinType; transferInfo.method = method; transferInfo.from = Config._gameConfig.IssueAddress; transferInfo.to = address; transferInfo.value = amount; Logger.Info("Zoro shgame send;Height:" + currentHeight + ", Address:" + address + ", CoinType:" + coinType + " , Value:" + amount + ", Txid: " + txid); string url = Config._gameConfig.GameUrl + "/sysGame/transConfirm"; string jsonData = JsonConvert.SerializeObject(transferInfo); SendTransTimer(jsonData, url); }