Skip to content

Commit

Permalink
add zksync & native token
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Oct 10, 2023
1 parent daca11c commit 438ed20
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 79 deletions.
1 change: 1 addition & 0 deletions apollo/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ LN_MANTLE_DEFAULT_ENDPOINT = https://thegraph-g2.darwinia.network/helix/subgraph
LN_MANTLE_OPPOSITE_ENDPOINT = https://thegraph-g2.darwinia.network/helix/subgraphs/name/lnopposite/mantlegoerli
LN_ARBITRUM_DEFAULT_ENDPOINT = https://thegraph-g2.darwinia.network/helix/subgraphs/name/lndefault/arbigoerli
LN_ARBITRUM_OPPOSITE_ENDPOINT = https://thegraph-g2.darwinia.network/helix/subgraphs/name/lnopposite/arbigoerli
LN_ZKSYNC_DEFAULT_ENDPOINT = https://thegraph-g2.darwinia.network/helix/subgraphs/name/lndefault/zkgoerli

99 changes: 91 additions & 8 deletions apollo/src/lnbridgev20/transfer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export class TransferService extends BaseTransferServiceT2 {
private readonly lnArbitrumOppositeEndpoint = this.configService.get<string>(
'LN_ARBITRUM_OPPOSITE_ENDPOINT'
);
private readonly lnZkSyncDefaultEndpoint = this.configService.get<string>(
'LN_ZKSYNC_DEFAULT_ENDPOINT'
);

formalChainTransfers: PartnerT2[] = [];

Expand All @@ -49,6 +52,12 @@ export class TransferService extends BaseTransferServiceT2 {
symbol: 'USDT',
address: '0x2303e4d55BF16a897Cb5Ab71c6225399509d9314',
protocolFee: 100000000000000000000,
decimals: 6,
},
{
symbol: 'ETH',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 1000000000000000,
decimals: 18,
},
],
Expand All @@ -69,6 +78,18 @@ export class TransferService extends BaseTransferServiceT2 {
symbol: 'USDT',
address: '0x2303e4d55BF16a897Cb5Ab71c6225399509d9314',
protocolFee: 100000000000000000000,
decimals: 6,
},
{
symbol: 'ETH',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 1000000000000000,
decimals: 18,
},
{
symbol: 'MNT',
address: '0xc1dc2d65a2243c22344e725677a3e3bebd26e604',
protocolFee: 1000000000000000,
decimals: 18,
},
],
Expand All @@ -83,14 +104,20 @@ export class TransferService extends BaseTransferServiceT2 {
symbol: 'USDC',
address: '0x39de82e1d9b8f62e11022fc3fc127a82f93fe47e',
protocolFee: 100000000,
decimals: 6,
decimals: 18,
},
{
symbol: 'USDT',
address: '0x6d828718c1097a4c573bc25c638cc05bf10dfeaf',
protocolFee: 100000000000000000000,
decimals: 18,
},
{
symbol: 'ETH',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 1000000000000000,
decimals: 18,
},
],
},
{
Expand All @@ -103,14 +130,20 @@ export class TransferService extends BaseTransferServiceT2 {
symbol: 'USDC',
address: '0x39de82e1d9b8f62e11022fc3fc127a82f93fe47e',
protocolFee: 100000000,
decimals: 6,
decimals: 18,
},
{
symbol: 'USDT',
address: '0x6d828718c1097a4c573bc25c638cc05bf10dfeaf',
protocolFee: 100000000000000000000,
decimals: 18,
},
{
symbol: 'ETH',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 1000000000000000,
decimals: 18,
},
],
},
{
Expand All @@ -123,14 +156,20 @@ export class TransferService extends BaseTransferServiceT2 {
symbol: 'USDC',
address: '0x0258eb547bfed540ed17843658c018569fe1e328',
protocolFee: 100000000,
decimals: 6,
decimals: 18,
},
{
symbol: 'USDT',
address: '0x5f8d4232367759bce5d9488d3ade77fcff6b9b6b',
protocolFee: 100000000000000000000,
decimals: 18,
},
{
symbol: 'MNT',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 1000000000000000,
decimals: 18,
},
],
},
{
Expand All @@ -143,14 +182,20 @@ export class TransferService extends BaseTransferServiceT2 {
symbol: 'USDC',
address: '0x0258eb547bfed540ed17843658c018569fe1e328',
protocolFee: 100000000,
decimals: 6,
decimals: 18,
},
{
symbol: 'USDT',
address: '0x5f8d4232367759bce5d9488d3ade77fcff6b9b6b',
protocolFee: 100000000000000000000,
decimals: 18,
},
{
symbol: 'MNT',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 1000000000000000,
decimals: 18,
},
],
},
{
Expand All @@ -163,13 +208,19 @@ export class TransferService extends BaseTransferServiceT2 {
symbol: 'USDC',
address: '0xb5e028f980df5533cb0e8f04530b76637383d993',
protocolFee: 100000000,
decimals: 6,
decimals: 18,
},
{
symbol: 'USDT',
address: '0xbc1a2f123dc9cd2ec8d3ce42ef16c28f3c9ba686',
protocolFee: 100000000,
decimals: 6,
decimals: 18,
},
{
symbol: 'ETH',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 1000000000000000,
decimals: 18,
},
],
},
Expand All @@ -183,13 +234,45 @@ export class TransferService extends BaseTransferServiceT2 {
symbol: 'USDC',
address: '0xb5e028f980df5533cb0e8f04530b76637383d993',
protocolFee: 100000000,
decimals: 6,
decimals: 18,
},
{
symbol: 'USDT',
address: '0xbc1a2f123dc9cd2ec8d3ce42ef16c28f3c9ba686',
protocolFee: 100000000,
decimals: 6,
decimals: 18,
},
{
symbol: 'ETH',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 1000000000000000,
decimals: 18,
},
],
},
{
chainId: 280,
chain: 'zksync-goerli',
url: this.lnZkSyncDefaultEndpoint,
bridge: 'default',
symbols: [
{
symbol: 'USDC',
address: '0xae60e005c560e869a2bad271e38e3c9d78381aff',
protocolFee: 100000000,
decimals: 18,
},
{
symbol: 'USDT',
address: '0xb5372ed3bb2cba63e7908066ac10ee94d30ea839',
protocolFee: 100000000,
decimals: 18,
},
{
symbol: 'ETH',
address: '0x0000000000000000000000000000000000000000',
protocolFee: 1000000000000000,
decimals: 18,
},
],
},
Expand Down
98 changes: 37 additions & 61 deletions subgraph/ln-default-bridge/abis/LnDefaultBridge.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,67 +283,6 @@
"name": "TokenLocked",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "remoteChainId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "transferId",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "address",
"name": "provider",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "sourceToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "targetToken",
"type": "address"
},
{
"indexed": false,
"internalType": "uint112",
"name": "amount",
"type": "uint112"
},
{
"indexed": false,
"internalType": "uint112",
"name": "fee",
"type": "uint112"
},
{
"indexed": false,
"internalType": "uint32",
"name": "timestamp",
"type": "uint64"
},
{
"indexed": false,
"internalType": "address",
"name": "receiver",
"type": "address"
}
],
"name": "TokenLocked",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -407,6 +346,43 @@
"name": "WithdrawMarginRequest",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "appAddress",
"type": "address"
},
{
"internalType": "bool",
"name": "enable",
"type": "bool"
}
],
"name": "authoriseAppCaller",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "callerWhiteList",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "dao",
Expand Down
2 changes: 0 additions & 2 deletions subgraph/ln-default-bridge/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ dataSources:
eventHandlers:
- event: TokenLocked(uint256,bytes32,address,address,address,uint112,uint112,uint32,address)
handler: handleTokenLocked
- event: TokenLocked(uint256,bytes32,address,address,address,uint112,uint112,uint64,address)
handler: handleTokenLocked
- event: LnProviderUpdated(uint256,address,address,address,uint112,uint8)
handler: handleLnProviderUpdated
- event: TransferFilled(bytes32,address)
Expand Down
9 changes: 5 additions & 4 deletions subgraph/ln-default-bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"scripts": {
"codegen": "graph codegen",
"build": "graph build",
"build-goerli": "sh generate.sh goerli 0x54cc9716905ba8ebdD01E6364125cA338Cd0054E 9658728 && graph codegen && graph build",
"build-arbitrum": "sh generate.sh arbigoerli 0x54cc9716905ba8ebdD01E6364125cA338Cd0054E 40151409 && graph codegen && graph build",
"build-linea": "sh generate.sh lineagoerli 0x54cc9716905ba8ebdD01E6364125cA338Cd0054E 1494962 && graph codegen && graph build",
"build-mantle": "sh generate.sh mantlegoerli 0x54cc9716905ba8ebdD01E6364125cA338Cd0054E 19685918 && graph codegen && graph build",
"build-goerli": "sh generate.sh goerli 0x258F81A0B59e0fD84604E3e9fc1b70718927c239 9840927 && graph codegen && graph build",
"build-arbitrum": "sh generate.sh arbigoerli 0x258F81A0B59e0fD84604E3e9fc1b70718927c239 46729061 && graph codegen && graph build",
"build-linea": "sh generate.sh lineagoerli 0x258F81A0B59e0fD84604E3e9fc1b70718927c239 1693292 && graph codegen && graph build",
"build-mantle": "sh generate.sh mantlegoerli 0x258F81A0B59e0fD84604E3e9fc1b70718927c239 23288903 && graph codegen && graph build",
"build-zkgoerli": "sh generate.sh zkgoerli 0x77300647Ac7D751fc1b5B5F8ffA9f63337F2D264 12510285 && graph codegen && graph build",
"create-remote": "graph create --access-token ${KEY} --node https://thegraph-g2.darwinia.network/helix/deploy/ lndefault/${NETWORK}",
"deploy-remote": "graph deploy --access-token $KEY --node https://thegraph-g2.darwinia.network/helix/deploy/ --ipfs http://g2.generic.darwinia.network:5001/ lndefault/$NETWORK"
},
Expand Down
37 changes: 37 additions & 0 deletions subgraph/ln-opposite-bridge/abis/LnOppositeBridge.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,43 @@
"name": "WithdrawMarginRequest",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "appAddress",
"type": "address"
},
{
"internalType": "bool",
"name": "enable",
"type": "bool"
}
],
"name": "authoriseAppCaller",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "callerWhiteList",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "dao",
Expand Down
Loading

0 comments on commit 438ed20

Please sign in to comment.