-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from helix-bridge/xiaoch05-support-xtoken
support xtoken
- Loading branch information
Showing
25 changed files
with
12,883 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { ConfigService } from '@nestjs/config'; | ||
import { BaseTransferServiceT2, PartnerT2 } from '../base/TransferServiceT2'; | ||
import { AddressTokenMap } from '../base/AddressToken'; | ||
|
||
@Injectable() | ||
export class TransferService extends BaseTransferServiceT2 { | ||
private readonly darwainiaUrl = this.configService.get<string>('XTOKEN_DARWINIA'); | ||
private readonly crabUrl = this.configService.get<string>('XTOKEN_CRAB'); | ||
private readonly ethereumUrl = this.configService.get<string>('XTOKEN_ETHEREUM'); | ||
private readonly darwiniaDispatchSubgraph = this.configService.get<string>('XTOKEN_DISPATCH_DARWINIA'); | ||
private readonly crabDispatchSubgraph = this.configService.get<string>('XTOKEN_DISPATCH_CRAB'); | ||
private readonly ethereumDispatchSubgraph = this.configService.get<string>('XTOKEN_DISPATCH_ETHEREUM'); | ||
|
||
formalChainTransfers: PartnerT2[] = [ | ||
{ | ||
chainId: 46, | ||
chain: 'darwinia-dvm', | ||
url: this.darwainiaUrl, | ||
bridge: 'xtokenbridge', | ||
symbols: [ | ||
{ | ||
key: 'RING', | ||
symbol: 'RING', | ||
address: '0x0000000000000000000000000000000000000000', | ||
protocolFee: 0, | ||
decimals: 18, | ||
}, | ||
{ | ||
key: 'CRAB', | ||
symbol: 'xWCRAB', | ||
address: '0x656567Eb75b765FC320783cc6EDd86bD854b2305', | ||
protocolFee: 0, | ||
decimals: 18, | ||
} | ||
], | ||
channels: [ | ||
{ | ||
chain: 'crab-dvm', | ||
channel: 'msgport' | ||
} | ||
] | ||
}, | ||
{ | ||
chainId: 44, | ||
chain: 'crab-dvm', | ||
url: this.crabUrl, | ||
bridge: 'xtokenbridge', | ||
symbols: [ | ||
{ | ||
key: 'RING', | ||
symbol: 'xWRING', | ||
address: '0x273131F7CB50ac002BDd08cA721988731F7e1092', | ||
protocolFee: 0, | ||
decimals: 18, | ||
}, | ||
{ | ||
key: 'CRAB', | ||
symbol: 'CRAB', | ||
address: '0x0000000000000000000000000000000000000000', | ||
protocolFee: 0, | ||
decimals: 18, | ||
} | ||
], | ||
channels: [ | ||
{ | ||
chain: 'darwinia-dvm', | ||
channel: 'msgport' | ||
} | ||
] | ||
|
||
} | ||
]; | ||
|
||
testChainTransfers: PartnerT2[] = [ | ||
{ | ||
chainId: 43, | ||
chain: 'pangolin-dvm', | ||
url: this.darwainiaUrl, | ||
bridge: 'xtokenbridge', | ||
symbols: [ | ||
{ | ||
key: 'PRING', | ||
symbol: 'PRING', | ||
address: '0x0000000000000000000000000000000000000000', | ||
protocolFee: 0, | ||
decimals: 18, | ||
}, | ||
], | ||
channels: [ | ||
{ | ||
chain: 'sepolia', | ||
channel: 'msgport' | ||
} | ||
] | ||
}, | ||
{ | ||
chainId: 11155111, | ||
chain: 'sepolia', | ||
url: this.ethereumUrl, | ||
bridge: 'xtokenbridge', | ||
symbols: [ | ||
{ | ||
key: 'PRING', | ||
symbol: 'xPRING', | ||
address: '0xBC43cb6175FcC8E577a0846256eA699b87eFcEE5', | ||
protocolFee: 0, | ||
decimals: 18, | ||
}, | ||
], | ||
channels: [ | ||
{ | ||
chain: 'pangolin-dvm', | ||
channel: 'msgport' | ||
} | ||
] | ||
}, | ||
]; | ||
|
||
dispatchEndPoints = { | ||
'pangolin-dvm': this.darwiniaDispatchSubgraph, | ||
sepolia: this.ethereumDispatchSubgraph, | ||
'darwinia-dvm': this.darwiniaDispatchSubgraph, | ||
ethereum: this.ethereumDispatchSubgraph, | ||
'crab-dvm': this.crabDispatchSubgraph, | ||
}; | ||
addressToTokenInfo: { [key: string]: AddressTokenMap } = {}; | ||
|
||
constructor(public configService: ConfigService) { | ||
super(configService); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { xTokenService } from './xtoken.service'; | ||
import { AggregationModule } from '../aggregation/aggregation.module'; | ||
import { TasksModule } from '../tasks/tasks.module'; | ||
import { TransferService } from './transfer.service'; | ||
|
||
@Module({ | ||
imports: [AggregationModule, TasksModule], | ||
providers: [xTokenService, TransferService], | ||
}) | ||
export class xTokenModule {} |
Oops, something went wrong.