Skip to content

Commit

Permalink
feat/CLI tool for monitoring warp route balances (#3231)
Browse files Browse the repository at this point in the history
### Description

Replay #3204 on
main

Co-authored-by: -f <[email protected]>
  • Loading branch information
yorhodes and aroralanuk authored Feb 6, 2024
1 parent fa058a0 commit 54aeb64
Show file tree
Hide file tree
Showing 12 changed files with 213 additions and 172 deletions.
6 changes: 6 additions & 0 deletions .changeset/six-planets-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/infra': minor
'@hyperlane-xyz/sdk': minor
---

Added warp route artifacts type adopting registry schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Configs and artifacts for the deployment of Hyperlane Warp Routes
# Between injective and inevm
description: Hyperlane Warp Route artifacts
timestamp: '2024-01-31T16:00:00.000Z'
deployer: Abacus Works (Hyperlane)
data:
config:
injective:
protocolType: cosmos
type: native
hypAddress: inj1mv9tjvkaw7x8w8y9vds8pkfq46g2vcfkjehc6k
name: Injective Coin
symbol: INJ
decimals: 18
ibcDenom: inj
inevm:
protocolType: ethereum
type: native
hypAddress: '0x26f32245fCF5Ad53159E875d5Cae62aEcf19c2d4'
name: Injective coin
symbol: INJ
decimals: 18
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Configs and artifacts for the deployment of Hyperlane Warp Routes
# Between nautilus and bsc, solana
description: Hyperlane Warp Route artifacts
timestamp: '2023-09-23T16:00:00.000Z'
deployer: Abacus Works (Hyperlane)
data:
config:
bsc:
protocolType: ethereum
type: collateral
hypAddress: '0xC27980812E2E66491FD457D488509b7E04144b98'
tokenAddress: '0x37a56cdcD83Dce2868f721De58cB3830C44C6303'
name: Zebec
symbol: ZBC
decimals: 9
nautilus:
protocolType: ethereum
type: native
hypAddress: '0x4501bBE6e731A4bC5c60C03A77435b2f6d5e9Fe7'
name: Zebec
symbol: ZBC
decimals: 18
solana:
protocolType: sealevel
type: collateral
tokenAddress: 'wzbcJyhGhQDLTV1S99apZiiBdE4jmYfbw99saMMdP59'
hypAddress: 'EJqwFjvVJSAxH8Ur2PYuMfdvoJeutjmH6GkoEFQ4MdSa'
name: Zebec
symbol: ZBC
decimals: 9
isSpl2022: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Configs and artifacts for the deployment of Hyperlane Warp Routes
# Between neutron and mantapacific
description: Hyperlane Warp Route artifacts
timestamp: '2023-09-23T16:00:00.000Z'
deployer: Abacus Works (Hyperlane)
data:
config:
neutron:
protocolType: cosmos
type: collateral
hypAddress: neutron1ch7x3xgpnj62weyes8vfada35zff6z59kt2psqhnx9gjnt2ttqdqtva3pa
tokenAddress: ibc/773B4D0A3CD667B2275D5A4A7A2F0909C0BA0F4059C0B9181E680DDF4965DCC7
name: Celestia
symbol: TIA
decimals: 6
mantapacific:
protocolType: ethereum
type: synthetic
hypAddress: '0x6Fae4D9935E2fcb11fC79a64e917fb2BF14DaFaa'
name: Celestia
symbol: TIA
decimals: 6
6 changes: 3 additions & 3 deletions typescript/infra/helm/warp-routes/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ The warp-routes container
command:
- ./node_modules/.bin/ts-node
- ./typescript/infra/scripts/warp-routes/monitor-warp-routes-balances.ts
- -l
- -v
- "10000"
- -c
- {{ .Values.config }}
- -f
- {{ .Values.configFilePath }}
{{- end }}
14 changes: 13 additions & 1 deletion typescript/infra/scripts/warp-routes/deploy-warp-monitor.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import yargs from 'yargs';

import { HelmCommand } from '../../src/utils/helm';

import { runWarpRouteHelmCommand } from './helm';

async function main() {
const { filePath } = await yargs(process.argv.slice(2))
.alias('f', 'filePath')
.describe(
'filePath',
'indicate the filepatch to the warp route yaml file relative to typescript/infra',
)
.demandOption('filePath')
.string('filePath')
.parse();

await runWarpRouteHelmCommand(
HelmCommand.InstallOrUpgrade,
'mainnet3',
'neutron',
filePath,
);
}

Expand Down
22 changes: 11 additions & 11 deletions typescript/infra/scripts/warp-routes/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ import { assertCorrectKubeContext, getEnvironmentConfig } from '../utils';
export async function runWarpRouteHelmCommand(
helmCommand: HelmCommand,
runEnv: DeployEnvironment,
config: string,
configFilePath: string,
) {
const envConfig = getEnvironmentConfig(runEnv);
await assertCorrectKubeContext(envConfig);
const values = getWarpRoutesHelmValues(config);

const values = getWarpRoutesHelmValues(configFilePath);
const releaseName = getHelmReleaseName(configFilePath);
return execCmd(
`helm ${helmCommand} ${getHelmReleaseName(
config,
)} ./helm/warp-routes --namespace ${runEnv} ${values.join(
`helm ${helmCommand} ${releaseName} ./helm/warp-routes --namespace ${runEnv} ${values.join(
' ',
)} --set fullnameOverride="${getHelmReleaseName(config)}"`,
)} --set fullnameOverride="${releaseName}"`,
);
}

function getHelmReleaseName(route: string): string {
return `hyperlane-warp-route-${route}`;
const match = route.match(/\/([^/]+)-deployments\.yaml$/);
const name = match ? match[1] : route;
return `hyperlane-warp-route-${name}`;
}

function getWarpRoutesHelmValues(config: string) {
function getWarpRoutesHelmValues(configFilePath: string) {
const values = {
image: {
repository: 'gcr.io/abacus-labs-dev/hyperlane-monorepo',
tag: 'ae8ce44-20231101-012032',
tag: 'a84e439-20240131-224743',
},
config: config, // nautilus or neutron
configFilePath: configFilePath,
};
return helmifyValues(values);
}
Loading

0 comments on commit 54aeb64

Please sign in to comment.