Skip to content

Commit

Permalink
modify StorageDepositPerByte
Browse files Browse the repository at this point in the history
  • Loading branch information
zjb0807 committed Feb 23, 2022
1 parent d42d853 commit affa3a9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
5 changes: 3 additions & 2 deletions runtime/acala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub use sp_runtime::BuildStorage;
pub use authority::AuthorityConfigImpl;
pub use constants::{fee::*, time::*};
pub use primitives::{
convert_decimals_to_evm, define_combined_task,
define_combined_task,
evm::{AccessListItem, EstimateResourcesRequest},
task::TaskResult,
AccountId, AccountIndex, Address, Amount, AuctionId, AuthoritysOriginId, Balance, BlockNumber, CurrencyId,
Expand Down Expand Up @@ -1361,7 +1361,8 @@ pub struct StorageDepositPerByte;
impl<I: From<Balance>> frame_support::traits::Get<I> for StorageDepositPerByte {
fn get() -> I {
// NOTE: ACA decimals is 12, convert to 18.
I::from(convert_decimals_to_evm(deposit(0, 1)))
// 30 * millicent(ACA) * 10^6
I::from(300_000_000_000_000)
}
}

Expand Down
16 changes: 8 additions & 8 deletions runtime/integration-tests/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ fn test_evm_module() {
#[cfg(feature = "with-mandala-runtime")]
assert_eq!(Balances::free_balance(alice()), 998_963_300_000_000);
#[cfg(feature = "with-karura-runtime")]
assert_eq!(Balances::free_balance(alice()), 996_889_900_000_000);
assert_eq!(Balances::free_balance(alice()), 998_963_300_000_000);
#[cfg(feature = "with-acala-runtime")]
assert_eq!(Balances::free_balance(alice()), 993_779_800_000_000);
assert_eq!(Balances::free_balance(alice()), 996_889_900_000_000);
assert_eq!(Balances::free_balance(bob()), 1_000 * dollar(NATIVE_CURRENCY));
let to = EvmAccounts::eth_address(&alice_key());
assert_ok!(Currencies::transfer(
Expand All @@ -376,9 +376,9 @@ fn test_evm_module() {
#[cfg(feature = "with-mandala-runtime")]
assert_eq!(Balances::free_balance(alice()), 1_008_963_300_000_000);
#[cfg(feature = "with-karura-runtime")]
assert_eq!(Balances::free_balance(alice()), 1_006_889_900_000_000);
assert_eq!(Balances::free_balance(alice()), 1_008_963_300_000_000);
#[cfg(feature = "with-acala-runtime")]
assert_eq!(Balances::free_balance(alice()), 1_003_779_800_000_000);
assert_eq!(Balances::free_balance(alice()), 1_006_889_900_000_000);
assert_eq!(
Balances::free_balance(bob()),
1_000 * dollar(NATIVE_CURRENCY) - 10 * dollar(NATIVE_CURRENCY)
Expand Down Expand Up @@ -577,9 +577,9 @@ fn should_not_kill_contract_on_transfer_all() {
#[cfg(all(not(feature = "with-ethereum-compatibility"), feature = "with-mandala-runtime"))]
assert_eq!(Balances::free_balance(alice()), 1_996_993_800_000_000);
#[cfg(feature = "with-karura-runtime")]
assert_eq!(Balances::free_balance(alice()), 1_994_981_400_000_000);
assert_eq!(Balances::free_balance(alice()), 1_996_993_800_000_000);
#[cfg(feature = "with-acala-runtime")]
assert_eq!(Balances::free_balance(alice()), 1_991_962_800_000_000);
assert_eq!(Balances::free_balance(alice()), 1_994_981_400_000_000);

assert_ok!(Currencies::transfer(
Origin::signed(EvmAddressMapping::<Runtime>::get_account_id(&contract)),
Expand All @@ -595,9 +595,9 @@ fn should_not_kill_contract_on_transfer_all() {
#[cfg(all(not(feature = "with-ethereum-compatibility"), feature = "with-mandala-runtime"))]
assert_eq!(Balances::free_balance(alice()), 1_998_993_800_000_000);
#[cfg(feature = "with-karura-runtime")]
assert_eq!(Balances::free_balance(alice()), 1_996_981_400_000_000);
assert_eq!(Balances::free_balance(alice()), 1_998_993_800_000_000);
#[cfg(feature = "with-acala-runtime")]
assert_eq!(Balances::free_balance(alice()), 1_993_962_800_000_000);
assert_eq!(Balances::free_balance(alice()), 1_996_981_400_000_000);

// assert the contract account is not purged
assert!(EVM::accounts(contract).is_some());
Expand Down
5 changes: 3 additions & 2 deletions runtime/karura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub use sp_runtime::BuildStorage;
pub use authority::AuthorityConfigImpl;
pub use constants::{fee::*, parachains, time::*};
pub use primitives::{
convert_decimals_to_evm, define_combined_task,
define_combined_task,
evm::{AccessListItem, EstimateResourcesRequest},
task::TaskResult,
AccountId, AccountIndex, Address, Amount, AuctionId, AuthoritysOriginId, Balance, BlockNumber, CurrencyId,
Expand Down Expand Up @@ -1371,7 +1371,8 @@ pub struct StorageDepositPerByte;
impl<I: From<Balance>> frame_support::traits::Get<I> for StorageDepositPerByte {
fn get() -> I {
// NOTE: KAR decimals is 12, convert to 18.
I::from(convert_decimals_to_evm(deposit(0, 1)))
// 10 * millicent(KCA) * 10^6
I::from(100_000_000_000_000)
}
}

Expand Down
5 changes: 3 additions & 2 deletions runtime/mandala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use orml_traits::{
};
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
use primitives::{
convert_decimals_to_evm, define_combined_task,
define_combined_task,
evm::{AccessListItem, EthereumTransactionMessage},
task::TaskResult,
unchecked_extrinsic::AcalaUncheckedExtrinsic,
Expand Down Expand Up @@ -1509,7 +1509,8 @@ impl<I: From<Balance>> frame_support::traits::Get<I> for StorageDepositPerByte {
fn get() -> I {
#[cfg(not(feature = "with-ethereum-compatibility"))]
// NOTE: ACA decimals is 12, convert to 18.
return I::from(convert_decimals_to_evm(deposit(0, 1)));
// 10 * millicent(ACA) * 10^6
return I::from(100_000_000_000_000);
#[cfg(feature = "with-ethereum-compatibility")]
return I::from(0);
}
Expand Down

0 comments on commit affa3a9

Please sign in to comment.