Skip to content

Commit eb777e0

Browse files
committed
fix test for external staking
1 parent e1d7efa commit eb777e0

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

contracts/provider/external-staking/src/contract.rs

+21-20
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,7 @@ pub mod cross_staking {
15541554
mod tests {
15551555
use super::*;
15561556
use cosmwasm_std::{Attribute, Decimal, DepsMut};
1557+
use cw_multi_test::IntoBech32;
15571558

15581559
use crate::crdt::State;
15591560
use crate::msg::{AuthorizedEndpoint, ReceiveVirtualStake, ValidatorState};
@@ -1570,14 +1571,14 @@ mod tests {
15701571
let mut ctx = InstantiateCtx::from((
15711572
deps,
15721573
mock_env(),
1573-
message_info(&Addr::unchecked(CREATOR), &[]),
1574+
message_info(&CREATOR.into_bech32(), &[]),
15741575
));
15751576
contract
15761577
.instantiate(
15771578
ctx.branch(),
15781579
OSMO.to_owned(),
15791580
"ujuno".to_string(),
1580-
"vault_addr".to_string(),
1581+
"vault_addr".into_bech32().to_string(),
15811582
100,
15821583
AuthorizedEndpoint {
15831584
connection_id: "connection_id_1".to_string(),
@@ -1592,7 +1593,7 @@ mod tests {
15921593
let exec_ctx = ExecCtx::from((
15931594
ctx.deps,
15941595
ctx.env,
1595-
message_info(&Addr::unchecked(OWNER), &[]),
1596+
message_info(&OWNER.into_bech32(), &[]),
15961597
));
15971598
(exec_ctx, contract)
15981599
}
@@ -1711,12 +1712,12 @@ mod tests {
17111712

17121713
// Cross stake with bob
17131714
let mut stake_deps = ctx.deps.branch();
1714-
let vault_info = message_info(&Addr::unchecked("vault_addr"), &[]);
1715+
let vault_info = message_info(&"vault_addr".into_bech32(), &[]);
17151716
let stake_ctx = ExecCtx::from((stake_deps.branch(), mock_env(), vault_info));
17161717
contract
17171718
.receive_virtual_stake(
17181719
stake_ctx,
1719-
OWNER.to_string(),
1720+
OWNER.into_bech32().to_string(),
17201721
coin(100, "uosmo"),
17211722
1,
17221723
to_json_binary(&ReceiveVirtualStake {
@@ -1768,10 +1769,10 @@ mod tests {
17681769
assert_eq!(
17691770
msgs[0],
17701771
WasmMsg::Execute {
1771-
contract_addr: "vault_addr".to_string(),
1772+
contract_addr: "vault_addr".into_bech32().to_string(),
17721773
msg: to_json_binary(&CrossSlash {
17731774
slashes: vec![SlashInfo {
1774-
user: OWNER.to_string(),
1775+
user: OWNER.into_bech32().to_string(),
17751776
slash: Uint128::new(10),
17761777
}],
17771778
validator: "bob".to_string(),
@@ -1835,12 +1836,12 @@ mod tests {
18351836

18361837
// Cross stake with bob
18371838
let mut stake_deps = ctx.deps.branch();
1838-
let vault_info = message_info(&Addr::unchecked("vault_addr"), &[]);
1839+
let vault_info = message_info(&"vault_addr".into_bech32(), &[]);
18391840
let stake_ctx = ExecCtx::from((stake_deps.branch(), mock_env(), vault_info));
18401841
contract
18411842
.receive_virtual_stake(
18421843
stake_ctx,
1843-
OWNER.to_string(),
1844+
OWNER.into_bech32().to_string(),
18441845
coin(100, "uosmo"),
18451846
1,
18461847
to_json_binary(&ReceiveVirtualStake {
@@ -1891,10 +1892,10 @@ mod tests {
18911892
assert_eq!(
18921893
msgs[0],
18931894
WasmMsg::Execute {
1894-
contract_addr: "vault_addr".to_string(),
1895+
contract_addr: "vault_addr".into_bech32().to_string(),
18951896
msg: to_json_binary(&CrossSlash {
18961897
slashes: vec![SlashInfo {
1897-
user: OWNER.to_string(),
1898+
user: OWNER.into_bech32().to_string(),
18981899
slash: Uint128::new(10),
18991900
}],
19001901
validator: "bob".to_string(),
@@ -1958,12 +1959,12 @@ mod tests {
19581959

19591960
// Cross stake with bob
19601961
let mut stake_deps = ctx.deps.branch();
1961-
let vault_info = message_info(&Addr::unchecked("vault_addr"), &[]);
1962+
let vault_info = message_info(&"vault_addr".into_bech32(), &[]);
19621963
let stake_ctx = ExecCtx::from((stake_deps.branch(), mock_env(), vault_info));
19631964
contract
19641965
.receive_virtual_stake(
19651966
stake_ctx,
1966-
OWNER.to_string(),
1967+
OWNER.into_bech32().to_string(),
19671968
coin(100, "uosmo"),
19681969
1,
19691970
to_json_binary(&ReceiveVirtualStake {
@@ -1977,7 +1978,7 @@ mod tests {
19771978

19781979
// OWNER then cross-unstakes half of the stake
19791980
let mut stake_deps = ctx.deps.branch();
1980-
let owner_info = message_info(&Addr::unchecked(OWNER), &[]);
1981+
let owner_info = message_info(&OWNER.into_bech32(), &[]);
19811982
let stake_ctx = ExecCtx::from((stake_deps.branch(), mock_env(), owner_info));
19821983
contract
19831984
.unstake(stake_ctx, "bob".to_string(), coin(50, "uosmo"))
@@ -2024,10 +2025,10 @@ mod tests {
20242025
assert_eq!(
20252026
msgs[0],
20262027
WasmMsg::Execute {
2027-
contract_addr: "vault_addr".to_string(),
2028+
contract_addr: "vault_addr".into_bech32().to_string(),
20282029
msg: to_json_binary(&CrossSlash {
20292030
slashes: vec![SlashInfo {
2030-
user: OWNER.to_string(),
2031+
user: OWNER.into_bech32().to_string(),
20312032
slash: Uint128::new(10), // Owner is slashed over the full stake, including pending
20322033
}],
20332034
validator: "bob".to_string(),
@@ -2352,12 +2353,12 @@ mod tests {
23522353

23532354
// Cross stake with bob
23542355
let mut stake_deps = ctx.deps.branch();
2355-
let vault_info = message_info(&Addr::unchecked("vault_addr"), &[]);
2356+
let vault_info = message_info(&"vault_addr".into_bech32(), &[]);
23562357
let stake_ctx = ExecCtx::from((stake_deps.branch(), mock_env(), vault_info));
23572358
contract
23582359
.receive_virtual_stake(
23592360
stake_ctx,
2360-
OWNER.to_string(),
2361+
OWNER.into_bech32().to_string(),
23612362
coin(100, "uosmo"),
23622363
1,
23632364
to_json_binary(&ReceiveVirtualStake {
@@ -2409,10 +2410,10 @@ mod tests {
24092410
assert_eq!(
24102411
msgs[0],
24112412
WasmMsg::Execute {
2412-
contract_addr: "vault_addr".to_string(),
2413+
contract_addr: "vault_addr".into_bech32().to_string(),
24132414
msg: to_json_binary(&CrossSlash {
24142415
slashes: vec![SlashInfo {
2415-
user: OWNER.to_string(),
2416+
user: OWNER.into_bech32().to_string(),
24162417
slash: Uint128::new(10),
24172418
}],
24182419
validator: "bob".to_string(),

0 commit comments

Comments
 (0)