Skip to content

Commit

Permalink
feat(dataverse): 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 de64ea7 commit b25ca2a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions contracts/axone-dataverse/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use cosmwasm_std::{
MessageInfo, Response, StdError, StdResult, WasmMsg,
};
use cw2::set_contract_version;
use cw_utils::nonpayable;

use crate::error::ContractError;
use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
Expand Down Expand Up @@ -70,6 +71,7 @@ pub fn execute(
info: MessageInfo,
msg: ExecuteMsg,
) -> Result<Response, ContractError> {
nonpayable(&info)?;
match msg {
ExecuteMsg::SubmitClaims {
metadata,
Expand Down Expand Up @@ -143,9 +145,12 @@ mod tests {
WhereCondition, IRI,
};
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info};
use cosmwasm_std::{from_json, Addr, Attribute, ContractResult, CosmosMsg, HexBinary, SubMsg, SystemError, SystemResult, Uint128, Uint64, WasmQuery, coins};
use std::collections::BTreeMap;
use cosmwasm_std::{
coins, from_json, Addr, Attribute, ContractResult, CosmosMsg, HexBinary, SubMsg,
SystemError, SystemResult, Uint128, Uint64, WasmQuery,
};
use cw_utils::PaymentError;
use std::collections::BTreeMap;

#[test]
fn proper_instantiate() {
Expand Down Expand Up @@ -248,7 +253,10 @@ mod tests {

let result = execute(deps.as_mut(), env, info, msg);
assert!(result.is_err());
assert!(matches!(result.unwrap_err(), ContractError::Payment(PaymentError::NonPayable {})));
assert!(matches!(
result.unwrap_err(),
ContractError::Payment(PaymentError::NonPayable {})
));
}

#[test]
Expand Down

0 comments on commit b25ca2a

Please sign in to comment.