Skip to content

Commit

Permalink
Merge branch 'master' into xiaoch05-support-xtoken
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Feb 28, 2024
2 parents ac97473 + 355544f commit 4f25213
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 11 deletions.
1 change: 1 addition & 0 deletions apollo/.env.prod
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ 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

XTOKEN_DARWINIA=https://thegraph.darwinia.network/helix/subgraphs/name/xtokentransfer/darwinia
XTOKEN_CRAB=https://thegraph.darwinia.network/helix/subgraphs/name/xtokentransfer/crab
Expand Down
2 changes: 1 addition & 1 deletion apollo/src/aggregation/aggregation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,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;
}
}
8 changes: 4 additions & 4 deletions apollo/src/lnbridgev20/transfer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ export class TransferService extends BaseTransferServiceT3 {
protocolFee: 10000000000000000000,
decimals: 18,
bridgeType: 'default',
channel: 'sub2sub',
channel: 'msgline',
},
],
},
Expand All @@ -418,7 +418,7 @@ export class TransferService extends BaseTransferServiceT3 {
protocolFee: 100000000000000000000,
decimals: 18,
bridgeType: 'default',
channel: 'sub2sub',
channel: 'msgline',
},
],
},
Expand All @@ -442,7 +442,7 @@ export class TransferService extends BaseTransferServiceT3 {
protocolFee: 100000000000000000000,
decimals: 18,
bridgeType: 'default',
channel: 'sub2sub',
channel: 'msgline',
},
],
},
Expand All @@ -458,7 +458,7 @@ export class TransferService extends BaseTransferServiceT3 {
protocolFee: 10000000000000000000,
decimals: 18,
bridgeType: 'default',
channel: 'sub2sub',
channel: 'msgline',
},
],
},
Expand Down
11 changes: 5 additions & 6 deletions apollo/src/lnv3/lnv3.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
);
}
}
}
Expand Down
40 changes: 40 additions & 0 deletions apollo/src/lnv3/transfer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class TransferService extends BaseTransferServiceT2 {
private readonly gnosisEndpoint = this.configService.get<string>('GNOSIS_LNV3_ENDPOINT');
private readonly mantleEndpoint = this.configService.get<string>('MANTLE_LNV3_ENDPOINT');
private readonly scrollEndpoint = this.configService.get<string>('SCROLL_LNV3_ENDPOINT');
private readonly darwiniaEndpoint = this.configService.get<string>('DARWINIA_LNV3_ENDPOINT');

formalChainTransfers: PartnerT2[] = [
{
Expand Down Expand Up @@ -88,6 +89,13 @@ export class TransferService extends BaseTransferServiceT2 {
address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
protocolFee: 100000,
decimals: 6,
},
{
key: 'ETH',
symbol: 'ETH',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 10000000000000,
decimals: 18,
}
],
channels: [
Expand Down Expand Up @@ -118,6 +126,10 @@ export class TransferService extends BaseTransferServiceT2 {
{
chain: 'scroll',
channel: 'layerzero',
},
{
chain: 'darwinia-dvm',
channel: 'msgline',
}
]
},
Expand Down Expand Up @@ -178,6 +190,13 @@ export class TransferService extends BaseTransferServiceT2 {
address: '0xA219439258ca9da29E9Cc4cE5596924745e12B93',
protocolFee: 100000,
decimals: 6,
},
{
key: 'ETH',
symbol: 'ETH',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 10000000000000,
decimals: 18,
}
],
channels: [
Expand Down Expand Up @@ -390,6 +409,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',
},
]
}
];

Expand Down

0 comments on commit 4f25213

Please sign in to comment.