From a9ecb8e2771eee155abe8cd4f7fe3a8c7530c663 Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Thu, 14 Dec 2023 20:03:49 +0800 Subject: [PATCH] use origin token to find token pair --- apollo/src/base/TransferServiceT2.ts | 1 + apollo/src/xtoken/transfer.service.ts | 2 ++ apollo/src/xtoken/xtoken.service.ts | 6 +++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apollo/src/base/TransferServiceT2.ts b/apollo/src/base/TransferServiceT2.ts index 7b3a9cd4..73a3d057 100644 --- a/apollo/src/base/TransferServiceT2.ts +++ b/apollo/src/base/TransferServiceT2.ts @@ -32,6 +32,7 @@ export interface BridgeBaseConfigure { } export interface PartnerSymbol { + originalSymbol: string; symbol: string; address: string; protocolFee: number; diff --git a/apollo/src/xtoken/transfer.service.ts b/apollo/src/xtoken/transfer.service.ts index e78b4008..7b13882a 100644 --- a/apollo/src/xtoken/transfer.service.ts +++ b/apollo/src/xtoken/transfer.service.ts @@ -19,6 +19,7 @@ export class TransferService extends BaseTransferServiceT2 { bridge: 'xtokenbridge', symbols: [ { + originalSymbol: 'CRAB', symbol: 'CRAB', address: '0x0000000000000000000000000000000000000000', protocolFee: 0, @@ -33,6 +34,7 @@ export class TransferService extends BaseTransferServiceT2 { bridge: 'xtokenbridge', symbols: [ { + originalSymbol: 'CRAB', symbol: 'xCRAB', address: '0xe8835bB0735fbfD5ECAC1e20835D5B7C39622ba3', protocolFee: 0, diff --git a/apollo/src/xtoken/xtoken.service.ts b/apollo/src/xtoken/xtoken.service.ts index 1e2b07de..c657de1b 100644 --- a/apollo/src/xtoken/xtoken.service.ts +++ b/apollo/src/xtoken/xtoken.service.ts @@ -81,7 +81,7 @@ export class xTokenService implements OnModuleInit { return ( chain.symbols.find( (item) => - item.symbol === symbolOrAddress || + item.originalSymbol === symbolOrAddress || symbolOrAddress.toLowerCase() === item.address.toLowerCase() ) ?? null ); @@ -122,10 +122,10 @@ export class xTokenService implements OnModuleInit { if (record.direction === 'lock') { sendTokenInfo = this.getToken(transfer, record.token); - recvTokenInfo = this.getToken(toChain, 'x' + sendTokenInfo.symbol); + recvTokenInfo = this.getToken(toChain, sendTokenInfo.originalSymbol); } else { recvTokenInfo = this.getToken(toChain, record.token); - sendTokenInfo = this.getToken(transfer, 'x' + recvTokenInfo.symbol); + sendTokenInfo = this.getToken(transfer, recvTokenInfo.originalSymbol); } if (sendTokenInfo == null) {