Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix runtimeorigin
  • Loading branch information
mclyk committed Nov 25, 2022
commit a57df0d23e1ea08020ef8cb2043a2bbbc235a6e3
60 changes: 17 additions & 43 deletions pallets/amm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,108 +210,82 @@ pub fn new_test_ext() -> sp_io::TestExternalities {

let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| {
Assets::force_create(RuntimeRuntimeOrigin::root(), tokens::DOT, ALICE, true, 1).unwrap();
Assets::force_create(RuntimeRuntimeOrigin::root(), tokens::SDOT, ALICE, true, 1).unwrap();
Assets::force_create(RuntimeRuntimeOrigin::root(), tokens::KSM, ALICE, true, 1).unwrap();
Assets::force_create(
RuntimeRuntimeOrigin::root(),
SAMPLE_LP_TOKEN,
ALICE,
true,
1,
)
.unwrap();
Assets::force_create(
RuntimeRuntimeOrigin::root(),
SAMPLE_LP_TOKEN_2,
ALICE,
true,
1,
)
.unwrap();
Assets::force_create(RuntimeOrigin::root(), tokens::DOT, ALICE, true, 1).unwrap();
Assets::force_create(RuntimeOrigin::root(), tokens::SDOT, ALICE, true, 1).unwrap();
Assets::force_create(RuntimeOrigin::root(), tokens::KSM, ALICE, true, 1).unwrap();
Assets::force_create(RuntimeOrigin::root(), SAMPLE_LP_TOKEN, ALICE, true, 1).unwrap();
Assets::force_create(RuntimeOrigin::root(), SAMPLE_LP_TOKEN_2, ALICE, true, 1).unwrap();

Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::DOT,
ALICE,
100_000_000,
)
.unwrap();

Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::DOT,
BOB,
100_000_000_000_000_000_000,
)
.unwrap();
Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::DOT,
CHARLIE,
1000_000_000,
)
.unwrap();
Assets::mint(RuntimeOrigin::signed(ALICE), tokens::DOT, EVE, 1000_000_000).unwrap();
Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
tokens::DOT,
EVE,
1000_000_000,
)
.unwrap();
Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::DOT,
FRANK,
100_000_000_000_000_000_000,
)
.unwrap();

Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::SDOT,
ALICE,
100_000_000,
)
.unwrap();
Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::SDOT,
BOB,
100_000_000_000_000_000_000,
)
.unwrap();
Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::SDOT,
CHARLIE,
1000_000_000,
)
.unwrap();
Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::SDOT,
EVE,
1000_000_000,
)
.unwrap();

Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::KSM,
ALICE,
100_000_000,
)
.unwrap();
Assets::mint(RuntimeOrigin::signed(ALICE), tokens::KSM, BOB, 100_000_000).unwrap();
Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
tokens::KSM,
BOB,
100_000_000,
)
.unwrap();
Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::KSM,
FRANK,
100_000_000_000_000_000_000,
Expand Down
18 changes: 9 additions & 9 deletions pallets/amm/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ fn update_protocol_fee_should_work() {
assert!(AMM::protocol_fee().is_zero());

assert_ok!(AMM::update_protocol_fee(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
Ratio::from_percent(20)
));

Expand All @@ -1123,7 +1123,7 @@ fn update_protocol_fee_receiver_should_work() {
assert!(AMM::protolcol_fee_receiver().is_err());

assert_ok!(AMM::update_protocol_fee_receiver(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
PROTOCOL_FEE_RECEIVER
));

Expand All @@ -1148,12 +1148,12 @@ fn handling_fees_should_work() {
));

assert_ok!(AMM::update_protocol_fee(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
Ratio::from_percent(20)
));

assert_ok!(AMM::update_protocol_fee_receiver(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
PROTOCOL_FEE_RECEIVER
));

Expand Down Expand Up @@ -1276,18 +1276,18 @@ fn quote_should_not_overflow() {
#[test]
fn glmr_add_liquidity_should_work() {
new_test_ext().execute_with(|| {
Assets::force_create(RuntimeRuntimeOrigin::root(), tokens::GLMR, ALICE, true, 1).unwrap();
Assets::force_create(RuntimeRuntimeOrigin::root(), tokens::PARA, ALICE, true, 1).unwrap();
Assets::force_create(RuntimeOrigin::root(), tokens::GLMR, ALICE, true, 1).unwrap();
Assets::force_create(RuntimeOrigin::root(), tokens::PARA, ALICE, true, 1).unwrap();

Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::GLMR,
ALICE,
1000000000000000000000000,
)
.unwrap();
Assets::mint(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
tokens::PARA,
ALICE,
200000000000000000000,
Expand All @@ -1304,7 +1304,7 @@ fn glmr_add_liquidity_should_work() {
.unwrap();

assert_ok!(AMM::add_liquidity(
RuntimeRuntimeOrigin::signed(ALICE),
RuntimeOrigin::signed(ALICE),
(tokens::GLMR, tokens::PARA),
(15000000000000000000000, 251621563685000000),
(14925000000000000000000, 250363455866575000),
Expand Down
Loading