Skip to content

Commit 8086cd0

Browse files
Post-rebase fixes
1 parent 627544f commit 8086cd0

File tree

7 files changed

+90
-71
lines changed

7 files changed

+90
-71
lines changed

Cargo.lock

Lines changed: 1 addition & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/core/src/contract.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use cosmwasm_std::{
22
attr, ensure, ensure_eq, ensure_ne, to_json_binary, Addr, Attribute, BankQuery, Binary, Coin,
3-
CosmosMsg, CustomQuery, Decimal, Deps, DepsMut, Env, GrpcQuery, MessageInfo, Order,
4-
QueryRequest, Response, StdError, StdResult, Uint128, Uint64, WasmMsg,
3+
CosmosMsg, CustomQuery, Decimal, Deps, DepsMut, Env, MessageInfo, Order, QueryRequest,
4+
Response, StdError, StdResult, Uint128, Uint64, WasmMsg,
55
};
66
use cw_storage_plus::{Bound, Item};
77
use drop_helpers::answer::response;

contracts/core/src/tests.rs

Lines changed: 59 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,16 @@ fn test_update_config() {
6868
let mut deps = mock_dependencies(&[]);
6969
let api = deps.api;
7070

71-
deps.querier.add_wasm_query_response(api.addr_make("token_contract").as_str(), |_| {
72-
cosmwasm_std::ContractResult::Ok(
73-
to_json_binary(&drop_staking_base::msg::token::ConfigResponse {
74-
factory_contract: api.addr_make("factory_contract").to_string(),
75-
denom: "ld_denom".to_string(),
76-
})
77-
.unwrap(),
78-
)
79-
});
71+
deps.querier
72+
.add_wasm_query_response(api.addr_make("token_contract").as_str(), move |_| {
73+
cosmwasm_std::ContractResult::Ok(
74+
to_json_binary(&drop_staking_base::msg::token::ConfigResponse {
75+
factory_contract: api.addr_make("factory_contract").to_string(),
76+
denom: "ld_denom".to_string(),
77+
})
78+
.unwrap(),
79+
)
80+
});
8081
deps.querier
8182
.add_wasm_query_response("old_token_contract", |_| {
8283
cosmwasm_std::ContractResult::Ok(
@@ -331,9 +332,10 @@ fn test_add_remove_bond_provider() {
331332
to_json_binary::<Vec<(Addr, bool)>>(&vec![]).unwrap()
332333
);
333334

334-
deps.querier.add_wasm_query_response(bond_provider_address.as_str(), |_| {
335-
cosmwasm_std::ContractResult::Ok(to_json_binary(&true).unwrap())
336-
});
335+
deps.querier
336+
.add_wasm_query_response(bond_provider_address.as_str(), |_| {
337+
cosmwasm_std::ContractResult::Ok(to_json_binary(&true).unwrap())
338+
});
337339

338340
let res = execute(
339341
deps.as_mut(),
@@ -540,12 +542,13 @@ fn test_tick_idle_claim_wo_unbond() {
540542
.unwrap(),
541543
)
542544
});
543-
deps.querier
544-
.add_wasm_query_response(api.addr_make("validators_set_contract").as_str(), |_| {
545+
deps.querier.add_wasm_query_response(
546+
api.addr_make("validators_set_contract").as_str(),
547+
move |_| {
545548
cosmwasm_std::ContractResult::Ok(
546549
to_json_binary(&vec![
547550
drop_staking_base::state::validatorset::ValidatorInfo {
548-
valoper_address: "valoper_address".to_string(),
551+
valoper_address: api.addr_make("valoper_address").to_string(),
549552
weight: 1,
550553
on_top: Uint128::zero(),
551554
last_processed_remote_height: None,
@@ -562,15 +565,16 @@ fn test_tick_idle_claim_wo_unbond() {
562565
])
563566
.unwrap(),
564567
)
565-
});
568+
},
569+
);
566570
deps.querier
567-
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), |_| {
571+
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), move |_| {
568572
cosmwasm_std::ContractResult::Ok(
569573
to_json_binary(&DelegationsResponse {
570574
delegations: Delegations {
571575
delegations: vec![DropDelegation {
572-
delegator: Addr::unchecked("ica_address"),
573-
validator: "valoper_address".to_string(),
576+
delegator: api.addr_make("ica_address"),
577+
validator: api.addr_make("valoper_address").to_string(),
574578
amount: Coin {
575579
denom: "remote_denom".to_string(),
576580
amount: Uint128::new(100_000),
@@ -711,12 +715,13 @@ fn test_tick_idle_claim_with_unbond_transfer() {
711715
.unwrap(),
712716
)
713717
});
714-
deps.querier
715-
.add_wasm_query_response(api.addr_make("validators_set_contract").as_str(), |_| {
718+
deps.querier.add_wasm_query_response(
719+
api.addr_make("validators_set_contract").as_str(),
720+
move |_| {
716721
cosmwasm_std::ContractResult::Ok(
717722
to_json_binary(&vec![
718723
drop_staking_base::state::validatorset::ValidatorInfo {
719-
valoper_address: "valoper_address".to_string(),
724+
valoper_address: api.addr_make("valoper_address").to_string(),
720725
weight: 1,
721726
on_top: Uint128::zero(),
722727
last_processed_remote_height: None,
@@ -733,15 +738,16 @@ fn test_tick_idle_claim_with_unbond_transfer() {
733738
])
734739
.unwrap(),
735740
)
736-
});
741+
},
742+
);
737743
deps.querier
738-
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), |_| {
744+
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), move |_| {
739745
cosmwasm_std::ContractResult::Ok(
740746
to_json_binary(&DelegationsResponse {
741747
delegations: Delegations {
742748
delegations: vec![DropDelegation {
743-
delegator: Addr::unchecked("ica_address"),
744-
validator: "valoper_address".to_string(),
749+
delegator: api.addr_make("ica_address"),
750+
validator: api.addr_make("valoper_address").to_string(),
745751
amount: Coin {
746752
denom: "remote_denom".to_string(),
747753
amount: Uint128::new(100_000),
@@ -950,7 +956,11 @@ fn test_tick_claiming_error_wo_transfer() {
950956
let q: StrategyQueryMsg = from_json(msg).unwrap();
951957
match q {
952958
StrategyQueryMsg::CalcDeposit { deposit } => cosmwasm_std::ContractResult::Ok(
953-
to_json_binary(&vec![(api.addr_make("valoper_address").to_string(), deposit)]).unwrap(),
959+
to_json_binary(&vec![(
960+
api.addr_make("valoper_address").to_string(),
961+
deposit,
962+
)])
963+
.unwrap(),
954964
),
955965
_ => unimplemented!(),
956966
}
@@ -1070,7 +1080,11 @@ fn test_tick_claiming_error_with_transfer() {
10701080
let q: StrategyQueryMsg = from_json(msg).unwrap();
10711081
match q {
10721082
StrategyQueryMsg::CalcDeposit { deposit } => cosmwasm_std::ContractResult::Ok(
1073-
to_json_binary(&vec![(api.addr_make("valoper_address").to_string(), deposit)]).unwrap(),
1083+
to_json_binary(&vec![(
1084+
api.addr_make("valoper_address").to_string(),
1085+
deposit,
1086+
)])
1087+
.unwrap(),
10741088
),
10751089
_ => unimplemented!(),
10761090
}
@@ -1241,7 +1255,11 @@ fn test_tick_claiming_wo_transfer_unbonding() {
12411255
let q: StrategyQueryMsg = from_json(msg).unwrap();
12421256
match q {
12431257
StrategyQueryMsg::CalcWithdraw { withdraw } => cosmwasm_std::ContractResult::Ok(
1244-
to_json_binary(&vec![(api.addr_make("valoper_address").to_string(), withdraw)]).unwrap(),
1258+
to_json_binary(&vec![(
1259+
api.addr_make("valoper_address").to_string(),
1260+
withdraw,
1261+
)])
1262+
.unwrap(),
12451263
),
12461264
_ => unimplemented!(),
12471265
}
@@ -1426,7 +1444,11 @@ fn test_tick_claiming_wo_idle() {
14261444
let q: StrategyQueryMsg = from_json(msg).unwrap();
14271445
match q {
14281446
StrategyQueryMsg::CalcWithdraw { withdraw } => cosmwasm_std::ContractResult::Ok(
1429-
to_json_binary(&vec![(api.addr_make("valoper_address").to_string(), withdraw)]).unwrap(),
1447+
to_json_binary(&vec![(
1448+
api.addr_make("valoper_address").to_string(),
1449+
withdraw,
1450+
)])
1451+
.unwrap(),
14301452
),
14311453
_ => unimplemented!(),
14321454
}
@@ -1965,7 +1987,7 @@ fn test_bond_lsm_share_increase_exchange_rate() {
19651987
BOND_PROVIDERS.init(deps.as_mut().storage).unwrap();
19661988

19671989
deps.querier
1968-
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), |_| {
1990+
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), move |_| {
19691991
cosmwasm_std::ContractResult::Ok(
19701992
to_json_binary(&DelegationsResponse {
19711993
delegations: Delegations {
@@ -1984,7 +2006,7 @@ fn test_bond_lsm_share_increase_exchange_rate() {
19842006
)
19852007
});
19862008
deps.querier
1987-
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), |_| {
2009+
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), move |_| {
19882010
cosmwasm_std::ContractResult::Ok(
19892011
to_json_binary(&DelegationsResponse {
19902012
delegations: Delegations {
@@ -2090,11 +2112,14 @@ fn test_unbond() {
20902112
let mut env = mock_env();
20912113

20922114
deps.querier
2093-
.add_wasm_query_response("factory_contract", |_| {
2115+
.add_wasm_query_response("factory_contract", move |_| {
20942116
cosmwasm_std::ContractResult::Ok(
20952117
to_json_binary(&HashMap::from([
20962118
("token_contract", api.addr_make("token_contract").as_str()),
2097-
("withdrawal_voucher_contract", api.addr_make("withdrawal_voucher_contract").as_str()),
2119+
(
2120+
"withdrawal_voucher_contract",
2121+
api.addr_make("withdrawal_voucher_contract").as_str(),
2122+
),
20982123
]))
20992124
.unwrap(),
21002125
)

contracts/factory/src/tests.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,28 +1283,33 @@ fn test_query_state() {
12831283
fn test_query_pause_info() {
12841284
let mut deps = mock_dependencies(&[]);
12851285
let api = deps.api;
1286-
deps.querier.add_wasm_query_response(api.addr_make("core_contract").as_str(), |_| {
1287-
cosmwasm_std::ContractResult::Ok(
1288-
to_json_binary(&CorePause {
1289-
tick: true,
1290-
bond: false,
1291-
unbond: false,
1292-
})
1293-
.unwrap(),
1294-
)
1295-
});
12961286
deps.querier
1297-
.add_wasm_query_response(api.addr_make("withdrawal_manager_contract").as_str(), |_| {
1287+
.add_wasm_query_response(api.addr_make("core_contract").as_str(), |_| {
12981288
cosmwasm_std::ContractResult::Ok(
1299-
to_json_binary(&drop_helpers::pause::PauseInfoResponse::Unpaused {}).unwrap(),
1289+
to_json_binary(&CorePause {
1290+
tick: true,
1291+
bond: false,
1292+
unbond: false,
1293+
})
1294+
.unwrap(),
13001295
)
13011296
});
1302-
deps.querier
1303-
.add_wasm_query_response(api.addr_make("rewards_manager_contract").as_str(), |_| {
1297+
deps.querier.add_wasm_query_response(
1298+
api.addr_make("withdrawal_manager_contract").as_str(),
1299+
|_| {
1300+
cosmwasm_std::ContractResult::Ok(
1301+
to_json_binary(&drop_helpers::pause::PauseInfoResponse::Unpaused {}).unwrap(),
1302+
)
1303+
},
1304+
);
1305+
deps.querier.add_wasm_query_response(
1306+
api.addr_make("rewards_manager_contract").as_str(),
1307+
|_| {
13041308
cosmwasm_std::ContractResult::Ok(
13051309
to_json_binary(&drop_helpers::pause::PauseInfoResponse::Paused {}).unwrap(),
13061310
)
1307-
});
1311+
},
1312+
);
13081313
set_default_factory_state(deps.as_mut(), api);
13091314
let query_res: drop_staking_base::state::factory::PauseInfoResponse =
13101315
from_json(query(deps.as_ref(), mock_env(), QueryMsg::PauseInfo {}).unwrap()).unwrap();

contracts/lsm-share-bond-provider/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn lsm_denom_query_config(
140140
);
141141

142142
deps.querier
143-
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), |_| {
143+
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), move |_| {
144144
cosmwasm_std::ContractResult::Ok(
145145
to_json_binary(&DelegationsResponse {
146146
delegations: Delegations {
@@ -451,7 +451,7 @@ fn test_process_on_idle_supported() {
451451
});
452452

453453
deps.querier
454-
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), |_| {
454+
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), move |_| {
455455
cosmwasm_std::ContractResult::Ok(
456456
to_json_binary(&IcaState::Registered {
457457
ica_address: api.addr_make("ica_address").to_string(),

contracts/native-bond-provider/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ fn process_on_idle_delegation() {
673673
.unwrap();
674674

675675
deps.querier
676-
.add_wasm_query_response("strategy_contract", |_| {
676+
.add_wasm_query_response(api.addr_make("strategy_contract").as_str(), move |_| {
677677
cosmwasm_std::ContractResult::Ok(
678678
to_json_binary(&vec![(
679679
api.addr_make("valoper_address").to_string(),
@@ -752,7 +752,7 @@ fn process_on_idle_ibc_transfer() {
752752
});
753753

754754
deps.querier
755-
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), |_| {
755+
.add_wasm_query_response(api.addr_make("puppeteer_contract").as_str(), move |_| {
756756
cosmwasm_std::ContractResult::Ok(
757757
to_json_binary(&IcaState::Registered {
758758
ica_address: api.addr_make("ica_address").to_string(),

contracts/val-ref/src/tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ fn execute_bond_hook_known_validator() {
280280
let req = from_json::<CoreQueryMsg>(req).unwrap();
281281
assert_eq!(req, CoreQueryMsg::ExchangeRate {});
282282

283-
cosmwasm_std::ContractResult::Ok(
284-
to_json_binary(&Decimal::from_ratio(3u128, 2u128)).unwrap(),
285-
)
286-
});
283+
cosmwasm_std::ContractResult::Ok(
284+
to_json_binary(&Decimal::from_ratio(3u128, 2u128)).unwrap(),
285+
)
286+
});
287287

288288
let response = contract::execute(
289289
deps.as_mut(),

0 commit comments

Comments
 (0)