feat: add warp route monitoring for new Eclipse deploys (#4573)

### Description

- Updates the monitoring script to support native balance getting and
synthetic total supply getting
- Drive-by to update `tokenProgramPubKey` -> `tokenMintPubKey`, which is
more accurate (the mint isn't a program)

### Drive-by changes

<!--
Are there any minor or drive-by changes also included?
-->

### Related issues

<!--
- Fixes #[issue number here]
-->

### Backward compatibility

<!--
Are these changes backward compatible? Are there any infrastructure
implications, e.g. changes that would prohibit deploying older commits
using this infra tooling?

Yes/No
-->

### Testing

<!--
What kind of testing have these changes undergone?

None/Manual/Unit Tests
-->
pull/4584/head
Trevor Porter 1 month ago committed by GitHub
parent 9f5a17b7a4
commit 471002bd1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      typescript/infra/config/environments/mainnet3/warp/eclipse-SOL-deployments.yaml
  2. 33
      typescript/infra/config/environments/mainnet3/warp/eclipse-USDC-deployments.yaml
  3. 24
      typescript/infra/config/environments/mainnet3/warp/eclipse-WIF-deployments.yaml
  4. 24
      typescript/infra/config/environments/mainnet3/warp/eclipse-tETH-deployments.yaml
  5. 47
      typescript/infra/scripts/warp-routes/monitor-warp-routes-balances.ts
  6. 2
      typescript/infra/src/warp/helm.ts
  7. 15
      typescript/sdk/src/token/adapters/SealevelTokenAdapter.ts

@ -0,0 +1,23 @@
# Configs and artifacts for the deployment of Hyperlane Warp Routes
# Between injective and inevm
description: Hyperlane Warp Route artifacts
timestamp: '2024-09-19T16:00:00.000Z'
deployer: Abacus Works (Hyperlane)
data:
config:
solanamainnet:
protocolType: sealevel
type: native
hypAddress: '8DtAGQpcMuD5sG3KdxDy49ydqXUggR1LQtebh2TECbAc'
name: Solana
symbol: SOL
decimals: 9
eclipsemainnet:
protocolType: sealevel
type: synthetic
hypAddress: 'FJu4E1BDYKVg7aTWdwATZRUvytJZ8ZZ2gQuvPfMWAz9y'
tokenAddress: 'BeRUj3h7BqkbdfFU7FBNYbodgf8GCHodzKvF9aVjNNfL'
isSpl2022: true
name: Solana
symbol: SOL
decimals: 9

@ -0,0 +1,33 @@
# Configs and artifacts for the deployment of Hyperlane Warp Routes
# Between injective and inevm
description: Hyperlane Warp Route artifacts
timestamp: '2024-09-19T16:00:00.000Z'
deployer: Abacus Works (Hyperlane)
data:
config:
ethereum:
protocolType: ethereum
type: collateral
hypAddress: '0xe1De9910fe71cC216490AC7FCF019e13a34481D7'
tokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' # USDC
name: USDC
symbol: USDC
decimals: 6
solanamainnet:
protocolType: sealevel
type: collateral
hypAddress: '3EpVCPUgyjq2MfGeCttyey6bs5zya5wjYZ2BE6yDg6bm'
tokenAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
isSpl2022: false
name: USDC
symbol: USDC
decimals: 6
eclipsemainnet:
protocolType: sealevel
type: synthetic
hypAddress: 'EqRSt9aUDMKYKhzd1DGMderr3KNp29VZH3x5P7LFTC8m'
tokenAddress: 'AKEWE7Bgh87GPp171b4cJPSSZfmZwQ3KaqYqXoKLNAEE'
isSpl2022: true
name: USDC
symbol: USDC
decimals: 6

@ -0,0 +1,24 @@
# Configs and artifacts for the deployment of Hyperlane Warp Routes
# Between injective and inevm
description: Hyperlane Warp Route artifacts
timestamp: '2024-09-19T16:00:00.000Z'
deployer: Abacus Works (Hyperlane)
data:
config:
solanamainnet:
protocolType: sealevel
type: collateral
hypAddress: 'CuQmsT4eSF4dYiiGUGYYQxJ7c58pUAD5ADE3BbFGzQKx'
tokenAddress: 'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm'
name: dogwifhat
symbol: WIF
decimals: 9
eclipsemainnet:
protocolType: sealevel
type: synthetic
hypAddress: '6tBGmKNxirxBYnm9khkaTtcr2fhJ9YviCgRm1RWM8NJv'
tokenAddress: '841P4tebEgNux2jaWSjCoi9LhrVr9eHGjLc758Va3RPH'
isSpl2022: false
name: dogwifhat
symbol: WIF
decimals: 9

@ -0,0 +1,24 @@
# Configs and artifacts for the deployment of Hyperlane Warp Routes
# Between injective and inevm
description: Hyperlane Warp Route artifacts
timestamp: '2024-09-19T16:00:00.000Z'
deployer: Abacus Works (Hyperlane)
data:
config:
ethereum:
protocolType: ethereum
type: collateral
hypAddress: '0xc2495f3183F043627CAECD56dAaa726e3B2D9c09'
tokenAddress: '0x19e099B7aEd41FA52718D780dDA74678113C0b32'
name: Turbo Eth
symbol: tETH
decimals: 18
eclipsemainnet:
protocolType: sealevel
type: synthetic
hypAddress: '6GM7hy6M6LjhadG1xuKXPQ3jPC1eieEszR8DforoRzUp'
tokenAddress: 'GU7NS9xCwgNPiAdJ69iusFrRfawjDDPjeMBovhV1d4kn'
isSpl2022: false
name: Turbo Eth
symbol: tETH
decimals: 9

@ -17,6 +17,8 @@ import {
CwNativeTokenAdapter,
MultiProtocolProvider,
SealevelHypCollateralAdapter,
SealevelHypNativeAdapter,
SealevelHypSyntheticAdapter,
TokenType,
WarpRouteConfig,
WarpRouteConfigSchema,
@ -135,8 +137,24 @@ async function checkBalance(
);
}
case ProtocolType.Sealevel:
// TODO - solana native
return 0;
const adapter = new SealevelHypNativeAdapter(
chain,
multiProtocolProvider,
{
token: token.tokenAddress,
warpRouter: token.hypAddress,
// Mailbox only required for transfers, using system as placeholder
mailbox: SystemProgram.programId.toBase58(),
},
// Not used for native tokens, but required for the adapter
token?.isSpl2022 ?? false,
);
const balance = ethers.BigNumber.from(
await adapter.getBalance(token.hypAddress),
);
return parseFloat(
ethers.utils.formatUnits(balance, token.decimals),
);
case ProtocolType.Cosmos: {
if (!token.ibcDenom)
throw new Error('IBC denom missing for native token');
@ -174,7 +192,7 @@ async function checkBalance(
}
case ProtocolType.Sealevel: {
if (!token.tokenAddress)
throw new Error('Token address missing for synthetic token');
throw new Error('Token address missing for collateral token');
const adapter = new SealevelHypCollateralAdapter(
chain,
multiProtocolProvider,
@ -228,10 +246,27 @@ async function checkBalance(
);
}
case ProtocolType.Sealevel:
// TODO - solana native
return 0;
if (!token.tokenAddress)
throw new Error('Token address missing for synthetic token');
const adapter = new SealevelHypSyntheticAdapter(
chain,
multiProtocolProvider,
{
token: token.tokenAddress,
warpRouter: token.hypAddress,
// Mailbox only required for transfers, using system as placeholder
mailbox: SystemProgram.programId.toBase58(),
},
token?.isSpl2022 ?? false,
);
const syntheticBalance = ethers.BigNumber.from(
await adapter.getTotalSupply(),
);
return parseFloat(
ethers.utils.formatUnits(syntheticBalance, token.decimals),
);
case ProtocolType.Cosmos:
// TODO - cosmos native
// TODO - cosmos synthetic
return 0;
}
break;

@ -27,7 +27,7 @@ export class WarpRouteMonitorHelmManager extends HelmManager {
return {
image: {
repository: 'gcr.io/abacus-labs-dev/hyperlane-monorepo',
tag: 'fce6adf-20240905-094435',
tag: 'd4d5501-20240925-222735',
},
configFilePath: pathRelativeToMonorepoRoot,
fullnameOverride: this.helmReleaseName,

@ -119,7 +119,7 @@ export class SealevelTokenAdapter
extends BaseSealevelAdapter
implements ITokenAdapter<Transaction>
{
public readonly tokenProgramPubKey: PublicKey;
public readonly tokenMintPubKey: PublicKey;
constructor(
public readonly chainName: ChainName,
@ -128,7 +128,7 @@ export class SealevelTokenAdapter
public readonly isSpl2022: boolean = false,
) {
super(chainName, multiProvider, addresses);
this.tokenProgramPubKey = new PublicKey(addresses.token);
this.tokenMintPubKey = new PublicKey(addresses.token);
}
async getBalance(owner: Address): Promise<bigint> {
@ -183,7 +183,7 @@ export class SealevelTokenAdapter
deriveAssociatedTokenAccount(owner: PublicKey): PublicKey {
return getAssociatedTokenAddressSync(
this.tokenProgramPubKey,
this.tokenMintPubKey,
owner,
true,
this.getTokenProgramId(),
@ -639,7 +639,7 @@ export class SealevelHypCollateralAdapter extends SealevelHypTokenAdapter {
/// 9. [executable] The SPL token program for the mint.
{ pubkey: this.getTokenProgramId(), isSigner: false, isWritable: false },
/// 10. [writeable] The mint.
{ pubkey: this.tokenProgramPubKey, isSigner: false, isWritable: true },
{ pubkey: this.tokenMintPubKey, isSigner: false, isWritable: true },
/// 11. [writeable] The token sender's associated token account, from which tokens will be sent.
{
pubkey: this.deriveAssociatedTokenAccount(params.sender),
@ -696,6 +696,13 @@ export class SealevelHypSyntheticAdapter extends SealevelHypTokenAdapter {
}
}
async getTotalSupply(): Promise<bigint> {
const response = await this.getProvider().getTokenSupply(
this.tokenMintPubKey,
);
return BigInt(response.value.amount);
}
deriveMintAuthorityAccount(): PublicKey {
return super.derivePda(
['hyperlane_token', '-', 'mint'],

Loading…
Cancel
Save