Skip to content

Commit

Permalink
Merge pull request #25 from luca992/instantiate-admin
Browse files Browse the repository at this point in the history
Add admin to WasmMsg::Instantiate
  • Loading branch information
assafmo authored Oct 4, 2023
2 parents 81ba47b + dcca91a commit ed247c8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/std/src/results/cosmos_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ pub enum WasmMsg {
/// This is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61).
/// `sender` is automatically filled with the current contract's address.
Instantiate {
admin: Option<String>,
code_id: u64,
/// code_hash is the hex encoded hash of the code. This is used by Secret Network to harden against replaying the contract
/// It is used to bind the request to a destination contract in a stronger way than just the contract address which can be faked
Expand Down Expand Up @@ -215,7 +216,10 @@ pub enum VoteOption {
NoWithVeto,
}


/// Shortcut helper as the construction of WasmMsg::Instantiate can be quite verbose in contract code.
///
/// When using this, `admin` is always unset. If you need more flexibility, create the message directly.
pub fn wasm_instantiate(
code_id: u64,
code_hash: impl Into<String>,
Expand All @@ -225,6 +229,7 @@ pub fn wasm_instantiate(
) -> StdResult<WasmMsg> {
let payload = to_binary(msg)?;
Ok(WasmMsg::Instantiate {
admin: None,
code_id,
code_hash: code_hash.into(),
msg: payload,
Expand Down

0 comments on commit ed247c8

Please sign in to comment.