public BSCInterop(TokenSwapper swapper, EthAPI ethAPI, PBigInteger interopBlockHeight, string[] contracts, uint confirmations) : base(swapper, BSCWallet.BSCPlatform) { string lastBlockHeight = OracleReader.GetCurrentHeight(BSCWallet.BSCPlatform, BSCWallet.BSCPlatform); if (string.IsNullOrEmpty(lastBlockHeight)) { OracleReader.SetCurrentHeight(BSCWallet.BSCPlatform, BSCWallet.BSCPlatform, new BigInteger(interopBlockHeight.ToSignedByteArray()).ToString()); } Logger.Message($"interopHeight: {OracleReader.GetCurrentHeight(BSCWallet.BSCPlatform, BSCWallet.BSCPlatform)}"); Console.WriteLine("encoded bsc: " + BSCWallet.EncodeAddress("0x44E8743A6CAC3E59594C19DD462863A5AA5E06BB")); Console.WriteLine("encoded eth: " + EthereumWallet.EncodeAddress("0x44E8743A6CAC3E59594C19DD462863A5AA5E06BB")); Console.WriteLine("from encoded bsc: " + BSCWallet.EncodeAddress("0xA89a34c37Da826085E458c17067DA2F38b6e4763")); Console.WriteLine("from encoded eth: " + EthereumWallet.EncodeAddress("0xA89a34c37Da826085E458c17067DA2F38b6e4763")); this.contracts = contracts.ToList(); // add local swap address to contracts this.contracts.Add(LocalAddress); this.confirmations = confirmations; this.ethAPI = ethAPI; }
protected ChainSwapper(TokenSwapper swapper, string platformName) { Swapper = swapper; this.WIF = swapper.Settings.GetInteropWif(swapper.Nexus, swapper.SwapKeys, platformName); this.PlatformName = platformName; this.LocalAddress = swapper.FindAddress(platformName); // for testing with mainnet swap address //this.LocalAddress = "AbFdbvacCeBrncvwYnPEtfKqyr5KU9SWAU"; //swapper.FindAddress(platformName); if (string.IsNullOrEmpty(LocalAddress)) { throw new SwapException($"Invalid address for {platformName} swaps"); } var localKeys = GetAvailableAddress(this.WIF); if (localKeys == LocalAddress) { Swapper.Logger.Message($"Listening for {platformName} swaps at address {LocalAddress.ToLower()}"); } else { Swapper.Logger.Error($"Expected {platformName} keys to {LocalAddress}, instead got keys to {localKeys}"); } }
public NeoInterop(TokenSwapper swapper, NeoAPI neoAPI, PBigInteger interopBlockHeight, bool quickSync) : base(swapper, NeoWallet.NeoPlatform) { string lastBlockHeight = OracleReader.GetCurrentHeight("neo", "neo"); if (string.IsNullOrEmpty(lastBlockHeight)) { OracleReader.SetCurrentHeight("neo", "neo", new BigInteger(interopBlockHeight.ToUnsignedByteArray()).ToString()); } this.quickSync = quickSync; Logger.Message($"interopHeight: {OracleReader.GetCurrentHeight("neo", "neo")}"); this.neoAPI = neoAPI; this.lastScan = DateTime.UtcNow.AddYears(-1);; }
public EthereumInterop(TokenSwapper swapper, EthAPI ethAPI, PBigInteger interopBlockHeight, string[] contracts, uint confirmations) : base(swapper, EthereumWallet.EthereumPlatform) { string lastBlockHeight = OracleReader.GetCurrentHeight(EthereumWallet.EthereumPlatform, EthereumWallet.EthereumPlatform); if (string.IsNullOrEmpty(lastBlockHeight)) { OracleReader.SetCurrentHeight(EthereumWallet.EthereumPlatform, EthereumWallet.EthereumPlatform, new BigInteger(interopBlockHeight.ToSignedByteArray()).ToString()); } Logger.Message($"interopHeight: {OracleReader.GetCurrentHeight(EthereumWallet.EthereumPlatform, EthereumWallet.EthereumPlatform)}"); this.contracts = contracts.ToList(); // add local swap address to contracts this.contracts.Add(LocalAddress); this.confirmations = confirmations; this.ethAPI = ethAPI; }