Skip to content

Commit f530fdc

Browse files
committed
ref: finance
1 parent 96ff49e commit f530fdc

File tree

19 files changed

+259
-200
lines changed

19 files changed

+259
-200
lines changed

contracts/finance/andromeda-conditional-splitter/src/testing/mock_querier.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use andromeda_std::ado_base::InstantiateMsg;
22
use andromeda_std::ado_contract::ADOContract;
33
use andromeda_std::testing::mock_querier::MockAndromedaQuerier;
44
use cosmwasm_std::testing::message_info;
5-
use cosmwasm_std::QuerierWrapper;
65
use cosmwasm_std::{
76
from_json,
87
testing::{mock_env, MockApi, MockQuerier, MockStorage, MOCK_CONTRACT_ADDR},
98
Coin, OwnedDeps, Querier, QuerierResult, QueryRequest, SystemError, SystemResult,
109
};
10+
use cosmwasm_std::{Addr, QuerierWrapper};
1111

1212
pub use andromeda_std::testing::mock_querier::MOCK_KERNEL_CONTRACT;
1313

contracts/finance/andromeda-conditional-splitter/src/testing/tests.rs

+64-51
Large diffs are not rendered by default.

contracts/finance/andromeda-fixed-amount-splitter/src/testing/mock_querier.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use andromeda_std::ado_base::InstantiateMsg;
22
use andromeda_std::ado_contract::ADOContract;
33
use andromeda_std::testing::mock_querier::MockAndromedaQuerier;
44
use cosmwasm_std::testing::message_info;
5-
use cosmwasm_std::QuerierWrapper;
65
use cosmwasm_std::{
76
from_json,
87
testing::{mock_env, MockApi, MockQuerier, MockStorage, MOCK_CONTRACT_ADDR},
98
Coin, OwnedDeps, Querier, QuerierResult, QueryRequest, SystemError, SystemResult, WasmQuery,
109
};
10+
use cosmwasm_std::{Addr, QuerierWrapper};
1111

1212
pub use andromeda_std::testing::mock_querier::MOCK_KERNEL_CONTRACT;
1313

contracts/finance/andromeda-fixed-amount-splitter/src/testing/tests.rs

+53-35
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use andromeda_std::{
99
use cosmwasm_std::{
1010
attr, coin, coins, from_json,
1111
testing::{message_info, mock_env, MOCK_CONTRACT_ADDR},
12-
to_json_binary, BankMsg, Coin, CosmosMsg, DepsMut, Response, SubMsg,
12+
to_json_binary, Addr, BankMsg, Coin, CosmosMsg, DepsMut, Response, SubMsg,
1313
};
1414
pub const OWNER: &str = "creator";
1515

@@ -72,7 +72,7 @@ fn test_execute_update_lock() {
7272
lock_time: Expiry::FromNow(lock_time),
7373
};
7474

75-
let info = message_info(OWNER, &[]);
75+
let info = message_info(&Addr::unchecked(OWNER), &[]);
7676
let res = execute(deps.as_mut(), env.clone(), info, msg).unwrap();
7777
let new_lock = lock_time
7878
.plus_seconds(current_time)
@@ -120,7 +120,7 @@ fn test_execute_update_recipients() {
120120
recipients: duplicate_recipients,
121121
};
122122

123-
let info = message_info(OWNER, &[]);
123+
let info = message_info(&Addr::unchecked(OWNER), &[]);
124124
let res = execute(deps.as_mut(), env.clone(), info, msg);
125125
assert_eq!(ContractError::DuplicateRecipient {}, res.unwrap_err());
126126

@@ -138,11 +138,11 @@ fn test_execute_update_recipients() {
138138
recipients: recipients.clone(),
139139
};
140140

141-
let info = message_info("incorrect_owner", &[]);
141+
let info = message_info(&Addr::unchecked("incorrect_owner"), &[]);
142142
let res = execute(deps.as_mut(), env.clone(), info, msg.clone());
143143
assert_eq!(ContractError::Unauthorized {}, res.unwrap_err());
144144

145-
let info = message_info(OWNER, &[]);
145+
let info = message_info(&Addr::unchecked(OWNER), &[]);
146146
let res = execute(deps.as_mut(), env, info, msg).unwrap();
147147
assert_eq!(
148148
Response::default().add_attributes(vec![attr("action", "update_recipients")]),
@@ -163,7 +163,7 @@ fn test_execute_send() {
163163
let sender_funds_amount = 10000u128;
164164

165165
let info = message_info(
166-
OWNER,
166+
&Addr::unchecked(OWNER),
167167
&[
168168
Coin::new(sender_funds_amount, "uandr"),
169169
Coin::new(50_u128, "usdc"),
@@ -196,17 +196,17 @@ fn test_execute_send() {
196196
let msg = ExecuteMsg::Send { config: None };
197197

198198
let amp_msg_1 = recip1
199-
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(1, "uandr")]))
199+
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(1_u128, "uandr")]))
200200
.unwrap();
201201
let amp_msg_2 = recip2
202-
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(1, "uandr")]))
202+
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(1_u128, "uandr")]))
203203
.unwrap();
204204

205205
let amp_msg_3 = recip1
206-
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(30, "usdc")]))
206+
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(30_u128, "usdc")]))
207207
.unwrap();
208208
let amp_msg_4 = recip2
209-
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(20, "usdc")]))
209+
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(20_u128, "usdc")]))
210210
.unwrap();
211211

212212
let amp_pkt = AMPPkt::new(
@@ -218,10 +218,10 @@ fn test_execute_send() {
218218
.to_sub_msg(
219219
MOCK_KERNEL_CONTRACT,
220220
Some(vec![
221-
Coin::new(1, "uandr"),
222-
Coin::new(1, "uandr"),
223-
Coin::new(30, "usdc"),
224-
Coin::new(20, "usdc"),
221+
Coin::new(1_u128, "uandr"),
222+
Coin::new(1_u128, "uandr"),
223+
Coin::new(30_u128, "usdc"),
224+
Coin::new(20_u128, "usdc"),
225225
]),
226226
1,
227227
)
@@ -243,7 +243,7 @@ fn test_execute_send() {
243243
// refunds remainder to sender
244244
CosmosMsg::Bank(BankMsg::Send {
245245
to_address: OWNER.to_string(),
246-
amount: vec![Coin::new(9998, "uandr")],
246+
amount: vec![Coin::new(9998_u128, "uandr")],
247247
}),
248248
),
249249
amp_msg,
@@ -258,11 +258,11 @@ fn test_execute_send() {
258258
};
259259

260260
let amp_msg_1 = recip3
261-
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(1, "uandr")]))
261+
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(1_u128, "uandr")]))
262262
.unwrap();
263263

264264
let amp_msg_2 = recip3
265-
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(30, "usdc")]))
265+
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(30_u128, "usdc")]))
266266
.unwrap();
267267

268268
let amp_pkt = AMPPkt::new(
@@ -273,7 +273,7 @@ fn test_execute_send() {
273273
let amp_msg = amp_pkt
274274
.to_sub_msg(
275275
MOCK_KERNEL_CONTRACT,
276-
Some(vec![Coin::new(1, "uandr"), Coin::new(30, "usdc")]),
276+
Some(vec![Coin::new(1_u128, "uandr"), Coin::new(30_u128, "usdc")]),
277277
1,
278278
)
279279
.unwrap();
@@ -284,14 +284,14 @@ fn test_execute_send() {
284284
// refunds remainder to sender
285285
CosmosMsg::Bank(BankMsg::Send {
286286
to_address: OWNER.to_string(),
287-
amount: vec![Coin::new(9999, "uandr")],
287+
amount: vec![Coin::new(9999_u128, "uandr")],
288288
}),
289289
),
290290
SubMsg::new(
291291
// refunds remainder to sender
292292
CosmosMsg::Bank(BankMsg::Send {
293293
to_address: OWNER.to_string(),
294-
amount: vec![Coin::new(20, "usdc")],
294+
amount: vec![Coin::new(20_u128, "usdc")],
295295
}),
296296
),
297297
amp_msg,
@@ -309,7 +309,10 @@ fn test_execute_send_ado_recipient() {
309309
let _res: Response = init(deps.as_mut());
310310

311311
let sender_funds_amount = 10_000u128;
312-
let info = message_info(OWNER, &[Coin::new(sender_funds_amount, "uandr")]);
312+
let info = message_info(
313+
&Addr::unchecked(OWNER),
314+
&[Coin::new(sender_funds_amount, "uandr")],
315+
);
313316

314317
let recip_address1 = "address1".to_string();
315318

@@ -331,10 +334,10 @@ fn test_execute_send_ado_recipient() {
331334
let msg = ExecuteMsg::Send { config: None };
332335

333336
let amp_msg_1 = recip1
334-
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(1, "uandr")]))
337+
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(1_u128, "uandr")]))
335338
.unwrap();
336339
let amp_msg_2 = recip2
337-
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(1, "uandr")]))
340+
.generate_amp_msg(&deps.as_ref(), Some(vec![Coin::new(1_u128, "uandr")]))
338341
.unwrap();
339342
let amp_pkt = AMPPkt::new(
340343
MOCK_CONTRACT_ADDR.to_string(),
@@ -344,7 +347,7 @@ fn test_execute_send_ado_recipient() {
344347
let amp_msg = amp_pkt
345348
.to_sub_msg(
346349
MOCK_KERNEL_CONTRACT,
347-
Some(vec![Coin::new(1, "uandr"), Coin::new(1, "uandr")]),
350+
Some(vec![Coin::new(1_u128, "uandr"), Coin::new(1_u128, "uandr")]),
348351
1,
349352
)
350353
.unwrap();
@@ -365,7 +368,7 @@ fn test_execute_send_ado_recipient() {
365368
// refunds remainder to sender
366369
CosmosMsg::Bank(BankMsg::Send {
367370
to_address: info.sender.to_string(),
368-
amount: vec![Coin::new(9_998, "uandr")],
371+
amount: vec![Coin::new(9_998_u128, "uandr")],
369372
}),
370373
),
371374
amp_msg,
@@ -383,7 +386,10 @@ fn test_handle_packet_exit_with_error_true() {
383386
let _res: Response = init(deps.as_mut());
384387

385388
let sender_funds_amount = 0u128;
386-
let info = message_info(OWNER, &[Coin::new(sender_funds_amount, "uandr")]);
389+
let info = message_info(
390+
&Addr::unchecked(OWNER),
391+
&[Coin::new(sender_funds_amount, "uandr")],
392+
);
387393

388394
let recip_address1 = "address1".to_string();
389395

@@ -403,7 +409,7 @@ fn test_handle_packet_exit_with_error_true() {
403409
vec![AMPMsg::new(
404410
recip_address1,
405411
to_json_binary(&ExecuteMsg::Send { config: None }).unwrap(),
406-
Some(vec![Coin::new(0, "uandr")]),
412+
Some(vec![Coin::new(0_u128, "uandr")]),
407413
)],
408414
);
409415
let msg = ExecuteMsg::AMPReceive(pkt);
@@ -455,7 +461,7 @@ fn test_execute_send_error() {
455461
let sender_funds_amount = 10000u128;
456462
let owner = "creator";
457463
let info = message_info(
458-
owner,
464+
&Addr::unchecked(owner),
459465
&vec![
460466
Coin::new(sender_funds_amount, "uandr"),
461467
Coin::new(sender_funds_amount, "uandr"),
@@ -499,7 +505,7 @@ fn test_execute_send_error() {
499505
assert_eq!(res, expected_res);
500506

501507
// Insufficient funds
502-
let info = message_info(owner, &[Coin::new(1_u128, "uandr")]);
508+
let info = message_info(&Addr::unchecked(owner), &[Coin::new(1_u128, "uandr")]);
503509

504510
let res = execute(deps.as_mut(), env, info, msg).unwrap_err();
505511

@@ -513,7 +519,7 @@ fn test_update_app_contract() {
513519
let mut deps = mock_dependencies_custom(&[]);
514520
let _res: Response = init(deps.as_mut());
515521

516-
let info = message_info(OWNER, &[]);
522+
let info = message_info(&Addr::unchecked(OWNER), &[]);
517523

518524
let msg = ExecuteMsg::UpdateAppContract {
519525
address: "app_contract".to_string(),
@@ -534,7 +540,7 @@ fn test_update_app_contract_invalid_recipient() {
534540
let mut deps = mock_dependencies_custom(&[]);
535541
let _res: Response = init(deps.as_mut());
536542

537-
let info = message_info(OWNER, &[]);
543+
let info = message_info(&Addr::unchecked(OWNER), &[]);
538544

539545
let msg = ExecuteMsg::UpdateAppContract {
540546
address: "z".to_string(),
@@ -609,7 +615,10 @@ fn test_send_with_config_locked(locked_splitter: (DepsMut<'static>, Splitter)) {
609615
config: Some(config),
610616
};
611617

612-
let info = message_info(&Addr::unchecked("owner"), &[Coin::new(10000, "uluna")]);
618+
let info = message_info(
619+
&Addr::unchecked("owner"),
620+
&[Coin::new(10000u128_u128, "uluna")],
621+
);
613622
let res = execute(deps, mock_env(), info, msg);
614623

615624
assert_eq!(
@@ -633,7 +642,10 @@ fn test_send_with_config_unlocked(unlocked_splitter: (DepsMut<'static>, Splitter
633642
config: Some(config),
634643
};
635644

636-
let info = message_info(&Addr::unchecked("owner"), &[Coin::new(10000, "uluna")]);
645+
let info = message_info(
646+
&Addr::unchecked("owner"),
647+
&[Coin::new(10000u128_u128, "uluna")],
648+
);
637649
let res = execute(deps, mock_env(), info, msg).unwrap();
638650

639651
// Verify response contains expected submessages and refund
@@ -647,7 +659,10 @@ fn test_send_without_config_locked(locked_splitter: (DepsMut<'static>, Splitter)
647659

648660
let msg = ExecuteMsg::Send { config: None };
649661

650-
let info = message_info(&Addr::unchecked("owner"), &[Coin::new(10000, "uluna")]);
662+
let info = message_info(
663+
&Addr::unchecked("owner"),
664+
&[Coin::new(10000u128_u128, "uluna")],
665+
);
651666
let res = execute(deps, mock_env(), info, msg).unwrap();
652667

653668
// Verify response contains expected submessages and refund
@@ -661,7 +676,10 @@ fn test_send_without_config_unlocked(unlocked_splitter: (DepsMut<'static>, Split
661676

662677
let msg = ExecuteMsg::Send { config: None };
663678

664-
let info = message_info(&Addr::unchecked("owner"), &[Coin::new(10000, "uluna")]);
679+
let info = message_info(
680+
&Addr::unchecked("owner"),
681+
&[Coin::new(10000u128_u128, "uluna")],
682+
);
665683
let res = execute(deps, mock_env(), info, msg).unwrap();
666684

667685
// Verify response contains expected submessages and refund

contracts/finance/andromeda-rate-limiting-withdrawals/src/testing/mock_querier.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use andromeda_std::ado_base::InstantiateMsg;
22
use andromeda_std::ado_contract::ADOContract;
33
use andromeda_std::testing::mock_querier::MockAndromedaQuerier;
44
use cosmwasm_std::testing::message_info;
5-
use cosmwasm_std::QuerierWrapper;
65
use cosmwasm_std::{
76
from_json,
87
testing::{mock_env, MockApi, MockQuerier, MockStorage, MOCK_CONTRACT_ADDR},
98
Coin, OwnedDeps, Querier, QuerierResult, QueryRequest, SystemError, SystemResult, WasmQuery,
109
};
10+
use cosmwasm_std::{Addr, QuerierWrapper};
1111

1212
pub use andromeda_std::testing::mock_querier::MOCK_KERNEL_CONTRACT;
1313

0 commit comments

Comments
 (0)