Skip to content

Commit

Permalink
Add support for Moonbeam and Klaytn in the tx-tracker service (#422)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
agodnic authored Jun 20, 2023
1 parent b490be0 commit 50c1d47
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
8 changes: 8 additions & 0 deletions deploy/tx-tracker-backfiller/tx-tracker-backfiller-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions deploy/tx-tracker/tx-tracker-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 15 additions & 1 deletion tx-tracker/chains/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}{}

Expand All @@ -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))
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tx-tracker/config/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 50c1d47

Please sign in to comment.