Skip to content

Commit

Permalink
Merge pull request #141 from Magport/main-develop
Browse files Browse the repository at this point in the history
Main develop
  • Loading branch information
sulijia authored Aug 2, 2024
2 parents 9857cea + f33f187 commit f497371
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod xcms;

use codec::{Decode, Encode, MaxEncodedLen};
use core::ops::Div;
use pallet_evm::AddressMapping;

use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
Expand Down Expand Up @@ -362,7 +363,7 @@ pub const GRAND: Balance = QUID * 1_000;
pub const MILLICENTS: Balance = CENTS / 1_000;

/// The existential deposit. Set to 1/10 of the Connected Relay Chain.
pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT;
pub const EXISTENTIAL_DEPOSIT: Balance = 1;

/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is
/// used to limit the maximal weight of a single extrinsic.
Expand Down Expand Up @@ -1416,7 +1417,17 @@ impl_runtime_apis! {
}

fn account_basic(address: H160) -> EVMAccount {
let (account, _) = pallet_evm::Pallet::<Runtime>::account_basic(&address);
let account_id = <Runtime as pallet_evm::Config>::AddressMapping::into_account_id(address);
let nonce = frame_system::Pallet::<Runtime>::account_nonce(&account_id);
let balance_free =
<Runtime as pallet_evm::Config>::Currency::free_balance(account_id.clone());
let balance_reserved =
<Runtime as pallet_evm::Config>::Currency::reserved_balance(account_id);
let balance = balance_free.saturating_add(balance_reserved);
let account = EVMAccount {
nonce: U256::from(UniqueSaturatedInto::<u128>::unique_saturated_into(nonce)),
balance: U256::from(UniqueSaturatedInto::<u128>::unique_saturated_into(balance)),
};
account
}

Expand Down

0 comments on commit f497371

Please sign in to comment.