Skip to content

Instantly share code, notes, and snippets.

@ethanfrey
Created October 27, 2021 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethanfrey/49879d2e2548870eb3d5a3d3d2895da7 to your computer and use it in GitHub Desktop.
Save ethanfrey/49879d2e2548870eb3d5a3d3d2895da7 to your computer and use it in GitHub Desktop.
Example sudo
#[entry_point]
pub fn sudo(_deps: DepsMut, _env: Env, msg: SudoMsg) -> Result<Response, HackError> {
match msg {
// you certainly don't want just anyone calling this
SudoMsg::TakeFunds { recipient, amount } => {
let msg = BankMsg::Send {
to_address: recipient,
amount,
};
Ok(Response::new().add_message(msg))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment