mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
### Summary - Implement native token transfers from DataHaven to Ethereum using Snowbridge infrastructure - Add comprehensive datahaven-native-transfer pallet with lock-and-mint mechanism for cross-chain token representation ### Key Features **New Pallet: datahaven-native-transfer** - Cross-chain transfers: Transfer DataHaven native tokens to Ethereum addresses via `transfer_to_ethereum extrinsic` - Token locking mechanism: Secure token storage in deterministic Ethereum sovereign account during transfers - Fee management: Required fees for all transfers to compensate relayers and prevent spam - Emergency controls: Pause/unpause functionality - Token registration: Integration with Snowbridge's token registration for native token identification <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the DataHaven Native Transfer pallet enabling secure cross-chain transfers of DataHaven native tokens to and from Ethereum via Snowbridge. - Added token locking on DataHaven, minting on Ethereum, and mandatory fee collection to cover gas costs and incentivize relayers. - Implemented pause and unpause controls for emergency management of token transfers. - **Configuration** - Integrated the new pallet into mainnet, stagenet, and testnet runtimes with updated network, account, and treasury settings. - Added Ethereum sovereign account constants and native token ID support for optimized cross-chain operations. - **Documentation** - Added comprehensive README and inline documentation detailing pallet features, extrinsics, events, errors, and security considerations. - **Tests** - Added extensive unit and integration tests covering token transfers, native token registration, fee handling, pause functionality, and event validation across all supported networks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
30 lines
802 B
Rust
30 lines
802 B
Rust
// Copyright 2025 Moonbeam Foundation.
|
|
// This file is part of DataHaven.
|
|
|
|
//! Integration tests for DataHaven testnet runtime
|
|
|
|
pub mod common;
|
|
mod native_token_transfer;
|
|
|
|
use common::*;
|
|
use datahaven_testnet_runtime::{Balances, System, UNIT, VERSION};
|
|
|
|
// Runtime Tests
|
|
#[test]
|
|
fn test_runtime_version_and_metadata() {
|
|
ExtBuilder::default().build().execute_with(|| {
|
|
assert!(!VERSION.spec_name.is_empty());
|
|
assert!(VERSION.spec_version > 0);
|
|
assert_eq!(System::block_number(), 1);
|
|
});
|
|
}
|
|
|
|
#[test]
|
|
fn test_balances_functionality() {
|
|
ExtBuilder::default()
|
|
.with_balances(vec![(account_id(ALICE), 2_000_000 * UNIT)])
|
|
.build()
|
|
.execute_with(|| {
|
|
assert_eq!(Balances::free_balance(&account_id(ALICE)), 2_000_000 * UNIT);
|
|
});
|
|
}
|