Skip to content

Commit

Permalink
merge origin/master
Browse files Browse the repository at this point in the history
  • Loading branch information
zjb0807 committed Apr 24, 2024
2 parents 4456f88 + f54c3ee commit 76e3fec
Show file tree
Hide file tree
Showing 61 changed files with 46,763 additions and 24,576 deletions.
7 changes: 4 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion evm-tests
14 changes: 9 additions & 5 deletions modules/asset-registry/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ use frame_support::{
traits::{ConstU128, ConstU32, ConstU64},
};
use frame_system::EnsureSignedBy;
use module_support::{mocks::MockAddressMapping, AddressMapping};
use module_support::{
mocks::{MockAddressMapping, TestRandomness},
AddressMapping,
};
use primitives::{
evm::convert_decimals_to_evm, evm::EvmAddress, AccountId, Balance, CurrencyId, ReserveIdentifier, TokenSymbol,
};
Expand Down Expand Up @@ -98,6 +101,7 @@ impl module_evm::Config for Runtime {

type Runner = module_evm::runner::stack::Runner<Self>;
type FindAuthor = ();
type Randomness = TestRandomness<Self>;
type Task = ();
type IdleScheduler = ();
type WeightInfo = ();
Expand Down Expand Up @@ -182,8 +186,8 @@ pub fn deploy_contracts() {
H256::from_slice(&buf).as_bytes().to_vec()
},
}],
used_gas: 1235455,
used_storage: 5131,
used_gas: 1215220,
used_storage: 4996,
}));
}

Expand Down Expand Up @@ -218,8 +222,8 @@ pub fn deploy_contracts_same_prefix() {
H256::from_slice(&buf).as_bytes().to_vec()
},
}],
used_gas: 1235455,
used_storage: 5131,
used_gas: 1215220,
used_storage: 4996,
}));
}

Expand Down
6 changes: 5 additions & 1 deletion modules/cdp-engine/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ use frame_support::{
PalletId,
};
use frame_system::EnsureSignedBy;
use module_support::{mocks::MockStableAsset, AuctionManager, EmergencyShutdown, SpecificJointsSwap};
use module_support::{
mocks::{MockStableAsset, TestRandomness},
AuctionManager, EmergencyShutdown, SpecificJointsSwap,
};
use orml_traits::parameter_type_with_key;
use primitives::{evm::convert_decimals_to_evm, DexShare, Moment, ReserveIdentifier, TokenSymbol, TradingPair};
use sp_core::crypto::AccountId32;
Expand Down Expand Up @@ -295,6 +298,7 @@ impl module_evm::Config for Runtime {

type Runner = module_evm::runner::stack::Runner<Self>;
type FindAuthor = ();
type Randomness = TestRandomness<Self>;
type Task = ();
type IdleScheduler = ();
type WeightInfo = ();
Expand Down
10 changes: 7 additions & 3 deletions modules/currencies/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ use frame_support::{
PalletId,
};
use frame_system::EnsureSignedBy;
use module_support::{mocks::MockAddressMapping, AddressMapping};
use module_support::{
mocks::{MockAddressMapping, TestRandomness},
AddressMapping,
};
use orml_traits::{currency::MutationHooks, parameter_type_with_key};
use primitives::{evm::convert_decimals_to_evm, CurrencyId, ReserveIdentifier, TokenSymbol};
use sp_core::H256;
Expand Down Expand Up @@ -174,6 +177,7 @@ impl module_evm::Config for Runtime {

type Runner = module_evm::runner::stack::Runner<Self>;
type FindAuthor = ();
type Randomness = TestRandomness<Self>;
type Task = ();
type IdleScheduler = ();
type WeightInfo = ();
Expand Down Expand Up @@ -285,8 +289,8 @@ pub fn deploy_contracts() {
H256::from_slice(&buf).as_bytes().to_vec()
},
}],
used_gas: 1235455,
used_storage: 5131,
used_gas: 1215220,
used_storage: 4996,
}));
}

Expand Down
36 changes: 18 additions & 18 deletions modules/currencies/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1299,11 +1299,11 @@ fn fungible_inspect_trait_should_work() {
// Test for Inspect::balance and Inspect::total_balance
assert_eq!(
<Currencies as fungibles::Inspect<_>>::balance(NATIVE_CURRENCY_ID, &alice()),
148690
150040
);
assert_eq!(
<Currencies as fungibles::Inspect<_>>::total_balance(NATIVE_CURRENCY_ID, &alice()),
148690
150040
);
assert_eq!(
<Currencies as fungibles::Inspect<_>>::balance(X_TOKEN_ID, &alice()),
Expand All @@ -1313,10 +1313,10 @@ fn fungible_inspect_trait_should_work() {
<Currencies as fungibles::Inspect<_>>::balance(CurrencyId::Erc20(erc20_address()), &alice()),
ALICE_BALANCE
);
assert_eq!(<NativeCurrency as fungible::Inspect<_>>::balance(&alice()), 148690);
assert_eq!(<NativeCurrency as fungible::Inspect<_>>::balance(&alice()), 150040);
assert_eq!(
<AdaptedBasicCurrency as fungible::Inspect<_>>::balance(&alice()),
148690
150040
);

// Test for Inspect::reducible_balance. No locks or reserves
Expand All @@ -1328,23 +1328,23 @@ fn fungible_inspect_trait_should_work() {
Preservation::Preserve,
Fortitude::Polite
),
148688
150038
);
assert_eq!(
<NativeCurrency as fungible::Inspect<_>>::reducible_balance(
&alice(),
Preservation::Preserve,
Fortitude::Polite
),
148688
150038
);
assert_eq!(
<AdaptedBasicCurrency as fungible::Inspect<_>>::reducible_balance(
&alice(),
Preservation::Preserve,
Fortitude::Polite
),
148688
150038
);
assert_eq!(
<Currencies as fungibles::Inspect<_>>::reducible_balance(
Expand Down Expand Up @@ -1374,7 +1374,7 @@ fn fungible_inspect_trait_should_work() {
Preservation::Expendable,
Fortitude::Polite
),
148690
150040
);
assert_eq!(
<Currencies as fungibles::Inspect<_>>::reducible_balance(
Expand All @@ -1400,15 +1400,15 @@ fn fungible_inspect_trait_should_work() {
Preservation::Expendable,
Fortitude::Polite
),
148690
150040
);
assert_eq!(
<AdaptedBasicCurrency as fungible::Inspect<_>>::reducible_balance(
&alice(),
Preservation::Expendable,
Fortitude::Polite
),
148690
150040
);

// Set some locks
Expand All @@ -1423,7 +1423,7 @@ fn fungible_inspect_trait_should_work() {
Preservation::Preserve,
Fortitude::Polite
),
147690
149040
);
assert_eq!(
<Currencies as fungibles::Inspect<_>>::reducible_balance(
Expand All @@ -1449,15 +1449,15 @@ fn fungible_inspect_trait_should_work() {
Preservation::Preserve,
Fortitude::Polite
),
147690
149040
);
assert_eq!(
<AdaptedBasicCurrency as fungible::Inspect<_>>::reducible_balance(
&alice(),
Preservation::Preserve,
Fortitude::Polite
),
147690
149040
);

assert_eq!(
Expand All @@ -1467,7 +1467,7 @@ fn fungible_inspect_trait_should_work() {
Preservation::Expendable,
Fortitude::Polite
),
147690
149040
);
assert_eq!(
<Currencies as fungibles::Inspect<_>>::reducible_balance(
Expand All @@ -1493,15 +1493,15 @@ fn fungible_inspect_trait_should_work() {
Preservation::Expendable,
Fortitude::Polite
),
147690
149040
);
assert_eq!(
<AdaptedBasicCurrency as fungible::Inspect<_>>::reducible_balance(
&alice(),
Preservation::Expendable,
Fortitude::Polite
),
147690
149040
);

// Test for Inspect::can_deposit
Expand Down Expand Up @@ -1626,11 +1626,11 @@ fn fungible_inspect_trait_should_work() {
);

assert_eq!(
<Currencies as fungibles::Inspect<_>>::can_withdraw(NATIVE_CURRENCY_ID, &alice(), 147690 + 1),
<Currencies as fungibles::Inspect<_>>::can_withdraw(NATIVE_CURRENCY_ID, &alice(), 149040 + 1),
WithdrawConsequence::Frozen
);
assert_eq!(
<AdaptedBasicCurrency as fungible::Inspect<_>>::can_withdraw(&alice(), 147690 + 1),
<AdaptedBasicCurrency as fungible::Inspect<_>>::can_withdraw(&alice(), 149040 + 1),
WithdrawConsequence::Frozen
);
assert_eq!(
Expand Down
18 changes: 11 additions & 7 deletions modules/evm-bridge/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ use frame_support::{
traits::{ConstU128, ConstU32, ConstU64},
};
use frame_system::EnsureSignedBy;
use module_support::{mocks::MockAddressMapping, AddressMapping};
use module_support::{
mocks::{MockAddressMapping, TestRandomness},
AddressMapping,
};
use primitives::{evm::convert_decimals_to_evm, evm::EvmAddress, ReserveIdentifier};
use sp_core::{crypto::AccountId32, H256};
use sp_runtime::{traits::IdentityLookup, BuildStorage};
Expand Down Expand Up @@ -103,6 +106,7 @@ impl module_evm::Config for Runtime {

type Runner = module_evm::runner::stack::Runner<Self>;
type FindAuthor = ();
type Randomness = TestRandomness<Self>;
type Task = ();
type IdleScheduler = ();
type WeightInfo = ();
Expand Down Expand Up @@ -184,8 +188,8 @@ pub fn deploy_contracts() {
H256::from_slice(&buf).as_bytes().to_vec()
},
}],
used_gas: 1235455,
used_storage: 5131,
used_gas: 1215220,
used_storage: 4996,
}));
}

Expand All @@ -206,8 +210,8 @@ pub fn deploy_liquidation_ok_contracts() {
from: alice_evm_addr(),
contract: erc20_address(),
logs: vec![],
used_gas: 235330,
used_storage: 844,
used_gas: 234056,
used_storage: 837,
}));
}

Expand All @@ -228,8 +232,8 @@ pub fn deploy_liquidation_err_contracts() {
from: alice_evm_addr(),
contract: erc20_address(),
logs: vec![],
used_gas: 228338,
used_storage: 818,
used_gas: 226860,
used_storage: 810,
}));
}

Expand Down
Loading

0 comments on commit 76e3fec

Please sign in to comment.