Add support for Moonbeam and Klaytn in the `tx-tracker` service (#422)

### Description

This pull request modifies the `tx-tracker` service to support the Moonbeam and Klaytn blockchains.

In particular, this will make sender addresses for these particular blockchains available for the Wormhole Scan UI.
This commit is contained in:
agodnic 2023-06-20 09:37:06 -03:00 committed by GitHub
parent b490be0f5d
commit 50c1d479a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 1 deletions

View File

@ -59,6 +59,14 @@ spec:
value: {{ .FANTOM_BASE_URL }}
- name: FANTOM_REQUESTS_PER_MINUTE
value: "{{ .FANTOM_REQUESTS_PER_MINUTE }}"
- name: KLAYTN_BASE_URL
value: {{ .KLAYTN_BASE_URL }}
- name: KLAYTN_REQUESTS_PER_MINUTE
value: "{{ .KLAYTN_REQUESTS_PER_MINUTE }}"
- name: MOONBEAM_BASE_URL
value: {{ .MOONBEAM_BASE_URL }}
- name: MOONBEAM_REQUESTS_PER_MINUTE
value: "{{ .MOONBEAM_REQUESTS_PER_MINUTE }}"
- name: OPTIMISM_BASE_URL
value: {{ .OPTIMISM_BASE_URL }}
- name: OPTIMISM_REQUESTS_PER_MINUTE

View File

@ -85,6 +85,14 @@ spec:
value: {{ .FANTOM_BASE_URL }}
- name: FANTOM_REQUESTS_PER_MINUTE
value: "{{ .FANTOM_REQUESTS_PER_MINUTE }}"
- name: KLAYTN_BASE_URL
value: {{ .KLAYTN_BASE_URL }}
- name: KLAYTN_REQUESTS_PER_MINUTE
value: "{{ .KLAYTN_REQUESTS_PER_MINUTE }}"
- name: MOONBEAM_BASE_URL
value: {{ .MOONBEAM_BASE_URL }}
- name: MOONBEAM_REQUESTS_PER_MINUTE
value: "{{ .MOONBEAM_REQUESTS_PER_MINUTE }}"
- name: OPTIMISM_BASE_URL
value: {{ .OPTIMISM_BASE_URL }}
- name: OPTIMISM_REQUESTS_PER_MINUTE

View File

@ -32,16 +32,18 @@ type TxDetail struct {
}
var tickers = struct {
aptos *time.Ticker
arbitrum *time.Ticker
avalanche *time.Ticker
bsc *time.Ticker
celo *time.Ticker
ethereum *time.Ticker
fantom *time.Ticker
klaytn *time.Ticker
moonbeam *time.Ticker
optimism *time.Ticker
polygon *time.Ticker
solana *time.Ticker
aptos *time.Ticker
sui *time.Ticker
}{}
@ -67,6 +69,8 @@ func Initialize(cfg *config.RpcProviderSettings) {
tickers.celo = time.NewTicker(f(cfg.CeloRequestsPerMinute / 2))
tickers.ethereum = time.NewTicker(f(cfg.EthereumRequestsPerMinute / 2))
tickers.fantom = time.NewTicker(f(cfg.FantomRequestsPerMinute / 2))
tickers.klaytn = time.NewTicker(f(cfg.KlaytnRequestsPerMinute / 2))
tickers.moonbeam = time.NewTicker(f(cfg.MoonbeamRequestsPerMinute / 2))
tickers.optimism = time.NewTicker(f(cfg.OptimismRequestsPerMinute / 2))
tickers.polygon = time.NewTicker(f(cfg.PolygonRequestsPerMinute / 2))
tickers.solana = time.NewTicker(f(cfg.SolanaRequestsPerMinute / 2))
@ -112,6 +116,11 @@ func FetchTx(
return fetchEthTx(ctx, txHash, cfg.FantomBaseUrl)
}
rateLimiter = *tickers.fantom
case vaa.ChainIDKlaytn:
fetchFunc = func(ctx context.Context, cfg *config.RpcProviderSettings, txHash string) (*TxDetail, error) {
return fetchEthTx(ctx, txHash, cfg.KlaytnBaseUrl)
}
rateLimiter = *tickers.fantom
case vaa.ChainIDArbitrum:
fetchFunc = func(ctx context.Context, cfg *config.RpcProviderSettings, txHash string) (*TxDetail, error) {
return fetchEthTx(ctx, txHash, cfg.ArbitrumBaseUrl)
@ -127,6 +136,11 @@ func FetchTx(
return fetchEthTx(ctx, txHash, cfg.AvalancheBaseUrl)
}
rateLimiter = *tickers.avalanche
case vaa.ChainIDMoonbeam:
fetchFunc = func(ctx context.Context, cfg *config.RpcProviderSettings, txHash string) (*TxDetail, error) {
return fetchEthTx(ctx, txHash, cfg.MoonbeamBaseUrl)
}
rateLimiter = *tickers.avalanche
case vaa.ChainIDAptos:
fetchFunc = fetchAptosTx
rateLimiter = *tickers.aptos

View File

@ -73,6 +73,10 @@ type RpcProviderSettings struct {
EthereumRequestsPerMinute uint16 `split_words:"true" required:"true"`
FantomBaseUrl string `split_words:"true" required:"true"`
FantomRequestsPerMinute uint16 `split_words:"true" required:"true"`
KlaytnBaseUrl string `split_words:"true" required:"true"`
KlaytnRequestsPerMinute uint16 `split_words:"true" required:"true"`
MoonbeamBaseUrl string `split_words:"true" required:"true"`
MoonbeamRequestsPerMinute uint16 `split_words:"true" required:"true"`
OptimismBaseUrl string `split_words:"true" required:"true"`
OptimismRequestsPerMinute uint16 `split_words:"true" required:"true"`
PolygonBaseUrl string `split_words:"true" required:"true"`