-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
mod test_exchange; | ||
mod test_exchange_derivative; | ||
mod test_oracle; | ||
mod test_staking; | ||
mod test_token_factory; |
39 changes: 39 additions & 0 deletions
39
contracts/injective-cosmwasm-mock/src/testing/test_staking.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use crate::msg::QueryMsg; | ||
use crate::utils::{ExchangeType, Setup, BASE_DENOM}; | ||
use injective_cosmwasm::exchange::response::StakedAmountResponse; | ||
use injective_std::types::cosmos::base::v1beta1::Coin; | ||
use injective_std::types::cosmos::staking::v1beta1::MsgDelegate; | ||
use injective_test_tube::{Account, Module, Staking, Wasm}; | ||
|
||
#[test] | ||
#[cfg_attr(not(feature = "integration"), ignore)] | ||
fn test_query_staked_amount() { | ||
let env = Setup::new(ExchangeType::None); | ||
let wasm = Wasm::new(&env.app); | ||
let staking = Staking::new(&env.app); | ||
|
||
let validator = env.app.get_first_validator_signing_account(BASE_DENOM.to_string(), 1.2f64).unwrap(); | ||
|
||
staking | ||
.delegate( | ||
MsgDelegate { | ||
delegator_address: env.owner.address(), | ||
validator_address: validator.address(), | ||
amount: Some(Coin { | ||
amount: "10".to_string(), | ||
denom: BASE_DENOM.to_string(), | ||
}), | ||
}, | ||
&env.owner, | ||
) | ||
.unwrap(); | ||
|
||
let query_msg = QueryMsg::TestQueryStakedAmount { | ||
delegator_address: validator.address(), | ||
max_delegations: 100, | ||
}; | ||
|
||
let res: StakedAmountResponse = wasm.query(&env.contract_address, &query_msg).unwrap(); | ||
print!("{:?}", res); | ||
assert_eq!(1, 2); | ||
} |