datahaven/test/utils
Ahmad Kaouk 3acbc06c74
test: Native token transfer e2e tests (#120)
### Summary
- **Add** `test/suites/native-token-transfer.test.ts` focused on the
HAVE native token lifecycle via Snowbridge v2.
- **Validate** registration, DataHaven → Ethereum mints, Ethereum →
DataHaven unlocks, event emission, and 1:1 backing invariant.

### Tests added
- should register DataHaven native token on Ethereum
- should transfer tokens from DataHaven to Ethereum
- should maintain 1:1 backing ratio
- should emit transfer events
- should transfer tokens from Ethereum to DataHaven (Snowbridge v2)

### What the suite covers
- **Registration**: Sudo-registers the native token; confirms
`ForeignTokenRegistered` on the Gateway; verifies ERC-20 metadata
(`HAVE`/`wHAVE`, 18 decimals).
- **DataHaven → Ethereum**: Executes `transfer_to_ethereum`; asserts
Substrate events (`TokensLocked`, `TokensTransferredToEthereum`);
observes Ethereum `Transfer` mint (from zero address); validates sender
balance delta, sovereign account increase, and ERC-20 recipient credit.
- **Backing invariant**: Ensures sovereign account balance ≥ ERC-20
total supply.
- **Event emission**: Confirms key Substrate events without polling
delays.
- **Ethereum → DataHaven**: Approves and calls `Gateway.sendToken`; if
unsupported locally, the test skips; otherwise asserts burn on Ethereum
and unlock on DataHaven with corresponding balance deltas.

---------

Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-08-22 18:27:14 +02:00
..
blockscout.ts test: Add E2E Tests (#36) 2025-04-14 16:22:43 -03:00
constants.ts fix: 🔌 CLI connection issues (#119) 2025-07-21 15:02:25 +02:00
contracts.ts feat: Datahaven contracts deployment on public testnet (#123) 2025-08-21 10:02:31 +00:00
docker.ts test: 🏗️ Setup e2e testing framework (#104) 2025-07-16 18:51:07 +02:00
events.ts test: Native token transfer e2e tests (#120) 2025-08-22 18:27:14 +02:00
index.ts test: wait for event utils (#121) 2025-08-01 20:56:46 +02:00
input.ts fix: 🚨 Add error in TS for missing awaits (#81) 2025-05-19 22:28:43 +00:00
kurtosis.ts feat: 🚀 Add deploy command to CLI (#87) 2025-06-12 10:24:03 +02:00
logger.ts feat: Add Polkadot API support to CLI and e2e testing infra (#68) 2025-05-13 03:03:21 +00:00
papi.ts fix: 🚨 Add error in TS for missing awaits (#81) 2025-05-19 22:28:43 +00:00
parameters.ts test: 🏗️ Setup e2e testing framework (#104) 2025-07-16 18:51:07 +02:00
parser.ts feat: Deployment improvements & environmental overrides (#103) 2025-06-26 13:48:33 +02:00
rpc.ts test: Add E2E Tests (#36) 2025-04-14 16:22:43 -03:00
shell.ts test: 🏗️ Setup e2e testing framework (#104) 2025-07-16 18:51:07 +02:00
types.ts feat: set rewards info as parameters in runtime (#99) 2025-06-16 12:20:18 +02:00
viem.ts fix: 🚨 Add error in TS for missing awaits (#81) 2025-05-19 22:28:43 +00:00
waits.ts feat: 🚀 Add deploy command to CLI (#87) 2025-06-12 10:24:03 +02:00