From 1b13f5861e338c2febdb44e859b651ee5514f875 Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Wed, 7 Feb 2024 17:31:35 +0800 Subject: [PATCH 1/6] support darwinia<>arbitrum lnv3 --- apollo/.env.prod | 1 + apollo/src/lnv3/transfer.service.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/apollo/.env.prod b/apollo/.env.prod index 2b30d8a8..4fc11bb2 100644 --- a/apollo/.env.prod +++ b/apollo/.env.prod @@ -33,5 +33,6 @@ OP_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/59403/lnv3-op/v1.0.0 GNOSIS_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/59403/lnv3-gnosis/v1.0.0 MANTLE_LNV3_ENDPOINT=https://thegraph-g1.darwinia.network/helix/subgraphs/name/lnv3/mantle SCROLL_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/59403/lnv3-scroll/v1.0.0 +DARWINIA_LNV3_ENDPOINT=https://thegraph-g1.darwinia.network/helix/subgraphs/name/lnv3/darwinia CHAIN_TYPE=formal diff --git a/apollo/src/lnv3/transfer.service.ts b/apollo/src/lnv3/transfer.service.ts index 220e9338..96fd09a9 100644 --- a/apollo/src/lnv3/transfer.service.ts +++ b/apollo/src/lnv3/transfer.service.ts @@ -15,6 +15,7 @@ export class TransferService extends BaseTransferServiceT2 { private readonly gnosisEndpoint = this.configService.get('GNOSIS_LNV3_ENDPOINT'); private readonly mantleEndpoint = this.configService.get('MANTLE_LNV3_ENDPOINT'); private readonly scrollEndpoint = this.configService.get('SCROLL_LNV3_ENDPOINT'); + private readonly darwiniaEndpoint = this.configService.get('DARWINIA_LNV3_ENDPOINT'); formalChainTransfers: PartnerT2[] = [ { @@ -118,6 +119,10 @@ export class TransferService extends BaseTransferServiceT2 { { chain: 'scroll', channel: 'layerzero', + }, + { + chain: 'darwinia-dvm', + channel: 'msgline', } ] }, @@ -390,6 +395,27 @@ export class TransferService extends BaseTransferServiceT2 { channel: 'layerzero', } ] + }, + { + chainId: 46, + chain: 'darwinia-dvm', + url: this.darwiniaEndpoint, + bridge: 'lnv3', + symbols: [ + { + key: 'RING', + symbol: 'RING', + address: '0x0000000000000000000000000000000000000000', + protocolFee: 30000000000000000000, + decimals: 18, + } + ], + channels: [ + { + chain: 'arbitrum', + channel: 'msgline', + }, + ] } ]; From c99a8c67fcf31ff6a54bb32e4a65e061bc7fd7a2 Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Thu, 8 Feb 2024 15:45:50 +0800 Subject: [PATCH 2/6] update channel for darwinia<>crab --- apollo/src/lnbridgev20/transfer.service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apollo/src/lnbridgev20/transfer.service.ts b/apollo/src/lnbridgev20/transfer.service.ts index bfc6ff60..ca253851 100644 --- a/apollo/src/lnbridgev20/transfer.service.ts +++ b/apollo/src/lnbridgev20/transfer.service.ts @@ -402,7 +402,7 @@ export class TransferService extends BaseTransferServiceT3 { protocolFee: 10000000000000000000, decimals: 18, bridgeType: 'default', - channel: 'sub2sub', + channel: 'msgline', }, ], }, @@ -418,7 +418,7 @@ export class TransferService extends BaseTransferServiceT3 { protocolFee: 100000000000000000000, decimals: 18, bridgeType: 'default', - channel: 'sub2sub', + channel: 'msgline', }, ], }, @@ -442,7 +442,7 @@ export class TransferService extends BaseTransferServiceT3 { protocolFee: 100000000000000000000, decimals: 18, bridgeType: 'default', - channel: 'sub2sub', + channel: 'msgline', }, ], }, @@ -458,7 +458,7 @@ export class TransferService extends BaseTransferServiceT3 { protocolFee: 10000000000000000000, decimals: 18, bridgeType: 'default', - channel: 'sub2sub', + channel: 'msgline', }, ], }, From 5d54a9a54b44459ba29eeb2b24f786742c404aea Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Sun, 18 Feb 2024 15:16:02 +0800 Subject: [PATCH 3/6] lnv3: add request withdraw liquidity time --- apollo/src/lnv3/lnv3.service.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apollo/src/lnv3/lnv3.service.ts b/apollo/src/lnv3/lnv3.service.ts index 5cccd675..12263846 100644 --- a/apollo/src/lnv3/lnv3.service.ts +++ b/apollo/src/lnv3/lnv3.service.ts @@ -259,19 +259,18 @@ export class Lnv3Service implements OnModuleInit { variables: null, }) .then((res) => res.data?.data?.lnv3TransferRecord); - if (transferRecord) { + if (transferRecord && (transferRecord.hasWithdrawn || record.lastRequestWithdraw < requestWithdrawTimestamp)) { await this.aggregationService.updateHistoryRecord({ where: { id: record.id }, data: { needWithdrawLiquidity: !transferRecord.hasWithdrawn, endTxHash: transferRecord.responseTxHash, + lastRequestWithdraw: requestWithdrawTimestamp, }, }); - if (transferRecord.hasWithdrawn) { - this.logger.log( - `lnv3 [${transfer.chain}->${toChain.chain}] tx withdrawn id: ${record.id}` - ); - } + this.logger.log( + `lnv3 [${transfer.chain}->${toChain.chain}] tx withdrawn id: ${record.id}, time: ${requestWithdrawTimestamp}, done: ${transferRecord.hasWithdrawn}` + ); } } } From 44cdd2a119ec2d4971a4c653d86b07dbb578093b Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Tue, 20 Feb 2024 21:45:33 +0800 Subject: [PATCH 4/6] bugfix: point too small to be zero --- apollo/src/aggregation/aggregation.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apollo/src/aggregation/aggregation.service.ts b/apollo/src/aggregation/aggregation.service.ts index 0897b133..f3ef1583 100644 --- a/apollo/src/aggregation/aggregation.service.ts +++ b/apollo/src/aggregation/aggregation.service.ts @@ -341,6 +341,6 @@ export class AggregationService extends PrismaClient implements OnModuleInit { (BigInt(relayerInfo.liquidityFeeRate) * amount) / BigInt(100000); const R = relayerInfo.slashCount; const w = 1 + R * 0.1; - return Number(F / BigInt(10 ** decimals)) * w; + return Number(F) * w; } } From 672360ecd619206946e8fb1d66b4377a3e8b34f7 Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Wed, 21 Feb 2024 09:33:58 +0800 Subject: [PATCH 5/6] register token ETH arbitrum<>linea --- apollo/src/lnv3/transfer.service.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apollo/src/lnv3/transfer.service.ts b/apollo/src/lnv3/transfer.service.ts index 96fd09a9..aa4d3de8 100644 --- a/apollo/src/lnv3/transfer.service.ts +++ b/apollo/src/lnv3/transfer.service.ts @@ -89,6 +89,13 @@ export class TransferService extends BaseTransferServiceT2 { address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', protocolFee: 100000, decimals: 6, + }, + { + key: 'ETH', + symbol: 'ETH', + address: '0x0000000000000000000000000000000000000000', + protocolFee: 1000000000000000, + decimals: 18, } ], channels: [ @@ -183,6 +190,13 @@ export class TransferService extends BaseTransferServiceT2 { address: '0xA219439258ca9da29E9Cc4cE5596924745e12B93', protocolFee: 100000, decimals: 6, + }, + { + key: 'ETH', + symbol: 'ETH', + address: '0x0000000000000000000000000000000000000000', + protocolFee: 1000000000000000, + decimals: 18, } ], channels: [ From 355544f7588458b36c69562d46a03be813122331 Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Sat, 24 Feb 2024 21:05:43 +0800 Subject: [PATCH 6/6] update protocol fee for eth --- apollo/src/lnv3/transfer.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apollo/src/lnv3/transfer.service.ts b/apollo/src/lnv3/transfer.service.ts index aa4d3de8..64d4fee2 100644 --- a/apollo/src/lnv3/transfer.service.ts +++ b/apollo/src/lnv3/transfer.service.ts @@ -94,7 +94,7 @@ export class TransferService extends BaseTransferServiceT2 { key: 'ETH', symbol: 'ETH', address: '0x0000000000000000000000000000000000000000', - protocolFee: 1000000000000000, + protocolFee: 10000000000000, decimals: 18, } ], @@ -195,7 +195,7 @@ export class TransferService extends BaseTransferServiceT2 { key: 'ETH', symbol: 'ETH', address: '0x0000000000000000000000000000000000000000', - protocolFee: 1000000000000000, + protocolFee: 10000000000000, decimals: 18, } ],