Skip to content

Commit

Permalink
fix: warp core sealevel native (#4522)
Browse files Browse the repository at this point in the history
### Description

- **Modify native adapter collateral balance check**

### Drive-by changes

- None

### Related issues

- Opens #4558

### Backward compatibility

Yes

### Testing

Manual in warp UI, released as a beta build  5.2.1-beta0
  • Loading branch information
yorhodes committed Sep 23, 2024
1 parent 7835c2a commit eb47aae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-baboons-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': patch
---

Use collateral account for sealevel native warp route balance
6 changes: 6 additions & 0 deletions typescript/sdk/src/token/adapters/SealevelTokenAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,12 @@ export class SealevelHypNativeAdapter extends SealevelHypTokenAdapter {
}

override async getBalance(owner: Address): Promise<bigint> {
if (eqAddress(owner, this.addresses.warpRouter)) {
const collateralAccount = this.deriveNativeTokenCollateralAccount();
const balance = await this.getProvider().getBalance(collateralAccount);
// TODO: account for rent in https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/4558
return BigInt(balance.toString());
}
return this.wrappedNative.getBalance(owner);
}

Expand Down

0 comments on commit eb47aae

Please sign in to comment.