Skip to content

Commit

Permalink
switch to sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Jan 11, 2024
1 parent 3275a8e commit 8fd49d1
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 121 deletions.
4 changes: 2 additions & 2 deletions apollo/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ LN_ARBITRUM_OPPOSITE_ENDPOINT = https://thegraph-g2.darwinia.network/helix/subgr
LN_ZKSYNC_DEFAULT_ENDPOINT = https://thegraph-g2.darwinia.network/helix/subgraphs/name/lndefault/zkgoerli
LN_BASE_DEFAULT_ENDPOINT = https://thegraph-g2.darwinia.network/helix/subgraphs/name/lndefault/basegoerli

ETHEREUM_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/61328/lnv3-goerli/version/latest
ZKSYNC_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/61328/lnv3-zkgoerli/version/latest
ETHEREUM_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/61328/lnv3-sepolia/version/latest
ARBITRUM_LNV3_ENDPOINT=https://api.studio.thegraph.com/query/61328/lnv3-arbitrum-sepolia/version/latest
6 changes: 3 additions & 3 deletions apollo/src/lnv3/lnv3.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class Lnv3Service implements OnModuleInit {
latestNonce = firstRecord ? Number(firstRecord.nonce) : 0;
}

const query = `query { lnv3TransferRecords(first: 10, orderBy: nonce, orderDirection: asc, skip: ${latestNonce}) { id, nonce, messageNonce, remoteChainId, provider, sourceToken, targetToken, sourceAmount, targetAmount, sender, receiver, timestamp, transactionHash, fee, transferId, idWithTimestamp } }`;
const query = `query { lnv3TransferRecords(first: 10, orderBy: nonce, orderDirection: asc, skip: ${latestNonce}) { id, nonce, messageNonce, remoteChainId, provider, sourceToken, targetToken, sourceAmount, targetAmount, sender, receiver, timestamp, transactionHash, fee, transferId } }`;
const records = await axios
.post(transfer.url, {
query: query,
Expand Down Expand Up @@ -329,11 +329,11 @@ export class Lnv3Service implements OnModuleInit {
latestNonce += 1;
this.fetchCache[index].latestRelayerInfoNonce = latestNonce;
this.logger.log(
`update lnv3 relay info, id ${id}, type ${record.updateType}, margin ${record.penalty}, basefee ${record.baseFee}, liquidityFee ${record.liquidityFeeRate}`
`update lnv3 relayer info, id ${id}, type ${record.updateType}, margin ${record.penalty}, basefee ${record.baseFee}, liquidityFee ${record.liquidityFeeRate}`
);
}
} catch (error) {
this.logger.warn(`fetch lnv3bridge relay records failed, error ${error}`);
this.logger.warn(`fetch lnv3bridge relayer records failed, error ${error}`);
}
}
}
38 changes: 19 additions & 19 deletions apollo/src/lnv3/transfer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ import { AddressTokenMap } from '../base/AddressToken';
@Injectable()
export class TransferService extends BaseTransferServiceT2 {
private readonly ethereumEndpoint = this.configService.get<string>('ETHEREUM_LNV3_ENDPOINT');
private readonly zkSyncEndpoint = this.configService.get<string>('ZKSYNC_LNV3_ENDPOINT');
private readonly arbitrumEndpoint = this.configService.get<string>('ARBITRUM_LNV3_ENDPOINT');

formalChainTransfers: PartnerT2[] = [];

testChainTransfers: PartnerT2[] = [
{
chainId: 5,
chain: 'goerli',
chainId: 11155111,
chain: 'sepolia',
url: this.ethereumEndpoint,
bridge: 'lnv3',
symbols: [
{
key: 'USDC',
symbol: 'USDC',
address: '0xe9784E0d9A939dbe966b021DE3cd877284DB1B99',
protocolFee: 100000000,
decimals: 6,
address: '0x0ac58Df0cc3542beC4cDa71B16D06C3cCc39f405',
protocolFee: 100000000000000000000,
decimals: 18,
},
{
key: 'USDT',
symbol: 'USDT',
address: '0xa39cffE89567eBfb5c306a07dfb6e5B3ba41F358',
protocolFee: 100000000,
decimals: 6,
address: '0x876A4f6eCF13EEb101F9E75FCeF58f19Ff383eEB',
protocolFee: 100000000000000000000,
decimals: 18,
},
{
key: 'ETH',
Expand All @@ -41,30 +41,30 @@ export class TransferService extends BaseTransferServiceT2 {
],
channels: [
{
chain: 'zksync-goerli',
chain: 'arbitrum-sepolia',
channel: 'layerzero',
},
],
},
{
chainId: 280,
chain: 'zksync-goerli',
url: this.zkSyncEndpoint,
chainId: 421614,
chain: 'arbitrum-sepolia',
url: this.arbitrumEndpoint,
bridge: 'lnv3',
symbols: [
{
key: 'USDC',
symbol: 'USDC',
address: '0xAe60e005C560E869a2bad271e38e3C9D78381aFF',
protocolFee: 100000000,
address: '0x8A87497488073307E1a17e8A12475a94Afcb413f',
protocolFee: 100000000000000000000,
decimals: 18,
},
{
key: 'USDT',
symbol: 'USDT',
address: '0xb5372ed3bb2CbA63e7908066ac10ee94d30eA839',
protocolFee: 100000000,
decimals: 6,
address: '0x3b8Bb7348D4F581e67E2498574F73e4B9Fc51855',
protocolFee: 100000000000000000000,
decimals: 18,
},
{
key: 'ETH',
Expand All @@ -76,7 +76,7 @@ export class TransferService extends BaseTransferServiceT2 {
],
channels: [
{
chain: 'goerli',
chain: 'sepolia',
channel: 'layerzero',
},
],
Expand Down
116 changes: 25 additions & 91 deletions subgraph/lnv3/abis/HelixLnBridgeV3.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "transferId",
"type": "bytes32"
"internalType": "bytes32[]",
"name": "transferIds",
"type": "bytes32[]"
},
{
"indexed": false,
Expand All @@ -54,9 +54,9 @@
},
{
"indexed": false,
"internalType": "uint112",
"internalType": "uint256",
"name": "amount",
"type": "uint112"
"type": "uint256"
}
],
"name": "LiquidityWithdrawn",
Expand Down Expand Up @@ -308,7 +308,7 @@
},
{
"internalType": "uint256",
"name": "nonce",
"name": "timestamp",
"type": "uint256"
}
],
Expand All @@ -323,12 +323,6 @@
"name": "transferId",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "idWithTimestamp",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint112",
Expand All @@ -340,12 +334,6 @@
"internalType": "uint112",
"name": "fee",
"type": "uint112"
},
{
"indexed": false,
"internalType": "uint64",
"name": "timestamp",
"type": "uint64"
}
],
"name": "TokenLocked",
Expand Down Expand Up @@ -517,7 +505,7 @@
},
{
"inputs": [],
"name": "MAX_TRANSFER_AMOUNT",
"name": "LOCK_TIME_DISTANCE",
"outputs": [
{
"internalType": "uint256",
Expand All @@ -530,7 +518,7 @@
},
{
"inputs": [],
"name": "SLASH_EXPIRE_TIME",
"name": "MAX_TRANSFER_AMOUNT",
"outputs": [
{
"internalType": "uint256",
Expand All @@ -543,48 +531,24 @@
},
{
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"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",
"name": "SLASH_EXPIRE_TIME",
"outputs": [
{
"internalType": "bool",
"internalType": "uint256",
"name": "",
"type": "bool"
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -804,7 +768,7 @@
},
{
"internalType": "uint256",
"name": "nonce",
"name": "timestamp",
"type": "uint256"
}
],
Expand Down Expand Up @@ -883,7 +847,7 @@
},
{
"internalType": "uint256",
"name": "nonce",
"name": "timestamp",
"type": "uint256"
}
],
Expand Down Expand Up @@ -912,11 +876,6 @@
"name": "amountWithFeeAndPenalty",
"type": "uint112"
},
{
"internalType": "uint64",
"name": "timestamp",
"type": "uint64"
},
{
"internalType": "uint32",
"name": "tokenIndex",
Expand Down Expand Up @@ -1193,7 +1152,7 @@
},
{
"internalType": "uint256",
"name": "nonce",
"name": "timestamp",
"type": "uint256"
}
],
Expand Down Expand Up @@ -1258,28 +1217,23 @@
},
{
"internalType": "uint256",
"name": "nonce",
"name": "timestamp",
"type": "uint256"
}
],
"internalType": "struct LnBridgeTargetV3.RelayParams",
"name": "_params",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "_timestamp",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "_expectedTransferId",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "_expectedIdWithTimestamp",
"type": "bytes32"
"internalType": "uint256",
"name": "_feePrepaid",
"type": "uint256"
},
{
"internalType": "bytes",
Expand Down Expand Up @@ -1409,21 +1363,11 @@
"name": "_transferId",
"type": "bytes32"
},
{
"internalType": "uint112",
"name": "_sourceAmount",
"type": "uint112"
},
{
"internalType": "address",
"name": "_lnProvider",
"type": "address"
},
{
"internalType": "uint64",
"name": "_timestamp",
"type": "uint64"
},
{
"internalType": "address",
"name": "_slasher",
Expand All @@ -1450,16 +1394,6 @@
"name": "remoteChainId",
"type": "uint256"
},
{
"internalType": "uint64",
"name": "lockTimestamp",
"type": "uint64"
},
{
"internalType": "uint112",
"name": "sourceAmount",
"type": "uint112"
},
{
"internalType": "address",
"name": "slasher",
Expand Down
2 changes: 1 addition & 1 deletion subgraph/lnv3/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dataSources:
- name: HelixLnBridgeV3
file: ./abis/HelixLnBridgeV3.json
eventHandlers:
- event: TokenLocked((uint256,address,address,address,uint112,uint112,address,uint256),bytes32,bytes32,uint112,uint112,uint64)
- event: TokenLocked((uint256,address,address,address,uint112,uint112,address,uint256),bytes32,uint112,uint112)
handler: handleTokenLocked
- event: LnProviderUpdated(uint256,address,address,address,uint112,uint16,uint112)
handler: handleLnProviderUpdated
Expand Down
4 changes: 2 additions & 2 deletions subgraph/lnv3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"scripts": {
"codegen": "graph codegen",
"build": "graph build",
"build-goerli": "sh generate.sh goerli 0xb0Ce2498C2526cceA1D7792e4B62C3066Eb5529B 10282900 && graph codegen && graph build",
"build-zkgoerli": "sh generate.sh zksync-era-testnet 0xab38D0030cC28e413C4DD2B7D0ac2b6984e6d3f0 15242066 && graph codegen && graph build",
"build-sepolia": "sh generate.sh sepolia 0x38627Cb033De66a1E07e73f5D0a7a7adFB6741fa 5060070 && graph codegen && graph build",
"build-arbitrum-sepolia": "sh generate.sh arbitrum-sepolia 0x38627Cb033De66a1E07e73f5D0a7a7adFB6741fa 6126325 && graph codegen && graph build",
"create-remote-dev": "graph create --access-token ${KEY} --node https://thegraph-g2.darwinia.network/helix/deploy/ lnv3/${NETWORK}",
"deploy-remote-dev": "graph deploy --access-token $KEY --node https://thegraph-g2.darwinia.network/helix/deploy/ --ipfs https://ipfs.network.thegraph.com lnv3/$NETWORK",
"create-remote-pro": "graph create --access-token ${KEY} --node https://thegraph.darwinia.network/helix/deploy/ lnv3/${NETWORK}",
Expand Down
Loading

0 comments on commit 8fd49d1

Please sign in to comment.