From 7901543f42ae0bea8b8788c2fc6f9a30c56a39ac Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Wed, 16 Aug 2023 22:16:01 +0200 Subject: [PATCH] wip --- .../contracts/gateway/src/contract/execute.rs | 3 ++- .../xcvm/cosmwasm/contracts/pingpong/src/contract.rs | 2 +- code/xcvm/lib/core/src/gateway/mod.rs | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/code/xcvm/cosmwasm/contracts/gateway/src/contract/execute.rs b/code/xcvm/cosmwasm/contracts/gateway/src/contract/execute.rs index 7091cf34031..bb3b6ad6c4c 100644 --- a/code/xcvm/cosmwasm/contracts/gateway/src/contract/execute.rs +++ b/code/xcvm/cosmwasm/contracts/gateway/src/contract/execute.rs @@ -149,9 +149,10 @@ pub(crate) fn handle_execute_program( env: Env, info: MessageInfo, execute_program: msg::ExecuteProgramMsg, - tip: Addr, + tip: String, ) -> Result { let this = msg::Gateway::new(env.contract.address); + let tip = deps.api.addr_validate(&tip)?; let call_origin = CallOrigin::Local { user: info.sender.clone() }; let transfers = transfer_from_user( &deps, diff --git a/code/xcvm/cosmwasm/contracts/pingpong/src/contract.rs b/code/xcvm/cosmwasm/contracts/pingpong/src/contract.rs index 7911e284c93..1683dd39d86 100644 --- a/code/xcvm/cosmwasm/contracts/pingpong/src/contract.rs +++ b/code/xcvm/cosmwasm/contracts/pingpong/src/contract.rs @@ -80,7 +80,7 @@ pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> R }; Ok(Response::default().add_message(wasm_execute( gateway, - &xc_core::gateway::ExecuteMsg::ExecuteProgram { execute_program, tip: info.sender }, + &xc_core::gateway::ExecuteMsg::ExecuteProgram { execute_program, tip: info.sender.into() }, Default::default(), )?)) } diff --git a/code/xcvm/lib/core/src/gateway/mod.rs b/code/xcvm/lib/core/src/gateway/mod.rs index faa7f312e90..21be8033a69 100644 --- a/code/xcvm/lib/core/src/gateway/mod.rs +++ b/code/xcvm/lib/core/src/gateway/mod.rs @@ -26,7 +26,7 @@ pub enum ExecuteMsg { ExecuteProgram { /// Program to execute. execute_program: ExecuteProgramMsg, - tip: Addr, + tip: String, }, /// Request to execute a program on behalf of given user. @@ -243,7 +243,7 @@ mod tests { program: XcProgram { tag: b"noop".to_vec(), instructions: [].into() }, assets: <_>::default(), }, - tip: Addr::unchecked("centauri12smx2wdlyttvyzvzg54y2vnqwq2qjatescq89n"), + tip: String::from("centauri12smx2wdlyttvyzvzg54y2vnqwq2qjatescq89n"), }; let program = serde_json_wasm::to_string(&program).expect("serde"); let expected = serde_json_wasm::to_string( @@ -279,7 +279,7 @@ mod tests { program: XcProgram { tag: b"noop_with_asset".to_vec(), instructions: [].into() }, assets: vec![(pica_on_centauri, 1_000_000_000u128)].into(), }, - tip: Addr::unchecked("centauri12smx2wdlyttvyzvzg54y2vnqwq2qjatescq89n"), + tip: String::from("centauri12smx2wdlyttvyzvzg54y2vnqwq2qjatescq89n"), }; let program = serde_json_wasm::to_string(&program).expect("serde"); @@ -332,7 +332,7 @@ mod tests { }, assets: vec![(pica_on_centauri, 1_000_000_000u128)].into(), }, - tip: Addr::unchecked("centauri12smx2wdlyttvyzvzg54y2vnqwq2qjatescq89n"), + tip: String::from("centauri12smx2wdlyttvyzvzg54y2vnqwq2qjatescq89n"), }; let program = serde_json_wasm::to_string(&program).expect("serde"); @@ -420,7 +420,7 @@ mod tests { }, assets: vec![(pica_on_centauri, 1_000_000_000u128)].into(), }, - tip: Addr::unchecked("centauri12smx2wdlyttvyzvzg54y2vnqwq2qjatescq89n"), + tip: String::from("centauri12smx2wdlyttvyzvzg54y2vnqwq2qjatescq89n"), }; //pica_on_osmosis @@ -520,7 +520,7 @@ mod tests { }, assets: vec![(osmo_on_osmosis, 1_000_000_000u128)].into(), }, - tip: Addr::unchecked("osmo12smx2wdlyttvyzvzg54y2vnqwq2qjatescq89n"), + tip: String::from("osmo12smx2wdlyttvyzvzg54y2vnqwq2qjatescq89n"), }; let program = serde_json_wasm::to_string(&program).expect("serde");