Esempio n. 1
0
        private void ProcessTransaction(DataNode entry, List <PendingSwap> result)
        {
            var destinationAddress = entry.GetString("address_to");

            if (destinationAddress != this.LocalAddress)
            {
                return;
            }

            var asset = entry.GetString("asset");
            var hash  = entry.GetString("txid");

            var token = Swapper.FindTokenByHash(asset, "neo");

            if (token == null)
            {
                logger.Warning("Someone tried to swap unsupported asset: " + asset);
                return;
            }

            var reader    = Swapper.Nexus.CreateOracleReader();
            var interopTx = reader.ReadTransaction("neo", "neo", Hash.Parse(hash));

            if (interopTx.Transfers.Length != 1)
            {
                throw new OracleException("neo transfers with multiple sources or tokens not supported yet");
            }

            var transfer = interopTx.Transfers[0];

            var destAddress   = transfer.interopAddress;
            var sourceAddress = transfer.sourceAddress;

            var swap = new PendingSwap(this.PlatformName, Hash.Parse(hash), sourceAddress, destAddress);

            result.Add(swap);
        }