Skip to content

Commit

Permalink
feat(law-stone): prevent contract execution with funds
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux committed Jun 4, 2024
1 parent 8f16457 commit 116ff78
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions contracts/axone-law-stone/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use cosmwasm_std::{
WasmMsg,
};
use cw2::set_contract_version;
use cw_utils::nonpayable;

use crate::error::ContractError;
use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
Expand Down Expand Up @@ -57,6 +58,7 @@ pub fn execute(
info: MessageInfo,
msg: ExecuteMsg,
) -> Result<Response, ContractError> {
nonpayable(&info)?;
match msg {
ExecuteMsg::BreakStone => execute::break_stone(deps, env, info),
}
Expand Down Expand Up @@ -291,9 +293,9 @@ mod tests {
Order, OwnedDeps, SubMsgResponse, SubMsgResult, SystemError, SystemResult, WasmQuery,
};
use cw_utils::ParseReplyError::SubMsgFailure;
use cw_utils::PaymentError;
use std::collections::VecDeque;
use std::marker::PhantomData;
use cw_utils::PaymentError;

fn custom_logic_handler_with_dependencies(
dependencies: Vec<String>,
Expand Down Expand Up @@ -867,7 +869,10 @@ mod tests {
ExecuteMsg::BreakStone,
);
assert!(result.is_err());
assert_eq!(result.unwrap_err(), ContractError::Payment(PaymentError::NonPayable {}));
assert_eq!(
result.unwrap_err(),
ContractError::Payment(PaymentError::NonPayable {})
);
}

#[test]
Expand Down

0 comments on commit 116ff78

Please sign in to comment.