public IEnumerable <(DateTime timeStamp, decimal ethPrice)> GetEthBtc() { return(_apiClient.GetLogs(ethBtcContract, _lastBlock, _lastBlock + _delta, topic0: LogMedianPriceEvent).result.Select(log => { var timeStamp = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(ulong.Parse(log.data.Substring(120), System.Globalization.NumberStyles.HexNumber)); var value = (decimal)System.Numerics.BigInteger.Parse(log.data.Substring(34, 32), System.Globalization.NumberStyles.HexNumber) / 1000000000000000000M; return (timeStamp, value); })); }
public IList <Etherscan.Log> GetNextLogs() { var logs = apiClient.GetLogs(address, fromBlock, maxBlock).result; if (logs.Count == limit) { fromBlock = logs.Max(o => o.BlockNumber); } else { Finished = true; fromBlock = (logs.Count > 0 ? logs.Max(o => o.BlockNumber) : maxBlock) + 1; } return(logs); }