Skip to content

Commit

Permalink
make max_retrieve work on converter contract
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 committed Jul 9, 2024
1 parent 3d0c602 commit 1f9b907
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion contracts/consumer/converter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ fake-custom = [ "mesh-simple-price-feed/fake-custom" ]
mesh-apis = { workspace = true }
mesh-bindings = { workspace = true }
mesh-sync = { workspace = true }
mesh-virtual-staking = { workspace = true }

sylvia = { workspace = true }
cosmwasm-schema = { workspace = true }
Expand All @@ -39,7 +40,7 @@ thiserror = { workspace = true }
[dev-dependencies]
mesh-burn = { workspace = true }
mesh-simple-price-feed = { workspace = true, features = ["mt"] }

mesh-virtual-staking = { workspace = true, features = ["mt"] }
cw-multi-test = { workspace = true }
test-case = { workspace = true }
derivative = { workspace = true }
Expand Down
10 changes: 7 additions & 3 deletions contracts/consumer/converter/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ impl ConverterContract<'_> {
remote_denom: String,
virtual_staking_code_id: u64,
admin: Option<String>,
max_retrieve: u16,
) -> Result<custom::Response, ContractError> {
nonpayable(&ctx.info)?;
// validate args
Expand All @@ -97,11 +98,14 @@ impl ConverterContract<'_> {
ctx.deps.api.addr_validate(admin)?;
}

let msg = to_json_binary(&mesh_virtual_staking::contract::sv::InstantiateMsg{
max_retrieve
})?;
// Instantiate virtual staking contract
let init_msg = WasmMsg::Instantiate {
admin,
code_id: virtual_staking_code_id,
msg: b"{}".into(),
msg,
funds: vec![],
label: format!("Virtual Staking: {}", &config.remote_denom),
};
Expand Down Expand Up @@ -151,7 +155,7 @@ impl ConverterContract<'_> {
}
#[cfg(not(any(test, feature = "mt")))]
{
let _ = (ctx, validator, stake);
let _ = (ctx, delegator, validator, stake);
Err(ContractError::Unauthorized)
}
}
Expand All @@ -173,7 +177,7 @@ impl ConverterContract<'_> {
}
#[cfg(not(any(test, feature = "mt")))]
{
let _ = (ctx, validator, unstake);
let _ = (ctx, delegator, validator, unstake);
Err(ContractError::Unauthorized)
}
}
Expand Down
1 change: 1 addition & 0 deletions contracts/consumer/converter/src/multitest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ fn setup<'a>(app: &'a App<MtApp>, args: SetupArgs<'a>) -> SetupResponse<'a> {
JUNO.to_owned(),
virtual_staking_code.code_id(),
Some(admin.to_owned()),
50
)
.with_label("Juno Converter")
.with_admin(admin)
Expand Down
1 change: 1 addition & 0 deletions contracts/consumer/virtual-staking/src/multitest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ fn setup<'a>(app: &'a App, args: SetupArgs<'a>) -> SetupResponse<'a> {
JUNO.to_owned(),
virtual_staking_code.code_id(),
Some(admin.to_owned()),
50,
)
.with_label("Juno Converter")
.with_admin(admin)
Expand Down
3 changes: 2 additions & 1 deletion contracts/provider/vault/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_std::{
coin, ensure, Addr, BankMsg, Binary, Coin, Decimal, DepsMut, Fraction, Order, Reply, Response, StdError, StdResult, Storage, SubMsg, SubMsgResponse, Uint128, WasmMsg
coin, ensure, Addr, BankMsg, Binary, Coin, Decimal, DepsMut, Fraction, Order, Reply, Response, StdResult, Storage, SubMsg, SubMsgResponse, Uint128, WasmMsg
};
use cw2::set_contract_version;
use cw_storage_plus::{Bounder, Item, Map};
Expand All @@ -13,6 +13,7 @@ use mesh_apis::local_staking_api::{
use mesh_apis::vault_api::{self, SlashInfo, VaultApi};
use mesh_sync::Tx::InFlightStaking;
use mesh_sync::{max_range, ValueRange};

use sylvia::types::{ExecCtx, InstantiateCtx, QueryCtx, ReplyCtx};
use sylvia::{contract, schemars};

Expand Down

0 comments on commit 1f9b907

Please sign in to comment.