Skip to content

Commit

Permalink
fix: contract interface was missing reply
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Nov 12, 2024
1 parent 391afbf commit cc904de
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ test: unit-test integration-test
# Optional env vars:
# DEPLOYMENT_KERNEL_ADDRESS - For updating kernel address
# SLACK_WEBHOOK_URL - For Slack notifications
deploy: build attach-contract-versions
deploy: build make-version-map
@echo "Deploying OS..."
@test -n "$$DEPLOYMENT_CHAIN" || (echo "Error: DEPLOYMENT_CHAIN is required" && exit 1)
@test -n "$$TEST_MNEMONIC" || (echo "Error: TEST_MNEMONIC is required" && exit 1)
Expand Down
13 changes: 12 additions & 1 deletion contracts/data-storage/andromeda-counter/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
attr, ensure, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Response, Storage,
attr, ensure, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, Storage,
};

use andromeda_data_storage::counter::{CounterRestriction, ExecuteMsg, InstantiateMsg, QueryMsg};
Expand Down Expand Up @@ -300,3 +300,14 @@ pub fn has_permission(storage: &dyn Storage, addr: &Addr) -> Result<bool, Contra
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
ADOContract::default().migrate(deps, CONTRACT_NAME, CONTRACT_VERSION)
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, ContractError> {
if msg.result.is_err() {
return Err(ContractError::Std(StdError::generic_err(
msg.result.unwrap_err(),
)));
}

Ok(Response::default())
}
13 changes: 12 additions & 1 deletion contracts/data-storage/andromeda-primitive/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{Binary, Deps, DepsMut, Env, MessageInfo, Response};
use cosmwasm_std::{Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError};

use andromeda_data_storage::primitive::{ExecuteMsg, InstantiateMsg, QueryMsg};
use andromeda_std::{
Expand Down Expand Up @@ -75,3 +75,14 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result<Binary, ContractErro
_ => ADOContract::default().query(deps, env, msg),
}
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, ContractError> {
if msg.result.is_err() {
return Err(ContractError::Std(StdError::generic_err(
msg.result.unwrap_err(),
)));
}

Ok(Response::default())
}
14 changes: 13 additions & 1 deletion contracts/finance/andromeda-timelock/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use andromeda_std::{
};
use andromeda_std::{ado_contract::ADOContract, common::context::ExecuteContext};
use cosmwasm_std::{
attr, ensure, entry_point, Binary, Deps, DepsMut, Env, MessageInfo, Response, SubMsg,
attr, ensure, entry_point, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError,
SubMsg,
};

use crate::state::{escrows, get_key, get_keys_for_recipient};
Expand Down Expand Up @@ -249,3 +250,14 @@ fn query_held_funds(
let hold_funds = escrows().may_load(deps.storage, get_key(&owner, &recipient))?;
Ok(GetLockedFundsResponse { funds: hold_funds })
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, ContractError> {
if msg.result.is_err() {
return Err(ContractError::Std(StdError::generic_err(
msg.result.unwrap_err(),
)));
}

Ok(Response::default())
}
15 changes: 13 additions & 2 deletions contracts/finance/andromeda-vesting/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use andromeda_std::{
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
ensure, Binary, Coin, Decimal, Deps, DepsMut, Env, MessageInfo, QuerierWrapper, Response,
Uint128,
ensure, Binary, Coin, Decimal, Deps, DepsMut, Env, MessageInfo, QuerierWrapper, Reply,
Response, StdError, Uint128,
};
use cw_asset::AssetInfo;
use cw_utils::nonpayable;
Expand Down Expand Up @@ -438,3 +438,14 @@ fn get_batch_response(

Ok(res)
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, ContractError> {
if msg.result.is_err() {
return Err(ContractError::Std(StdError::generic_err(
msg.result.unwrap_err(),
)));
}

Ok(Response::default())
}
14 changes: 13 additions & 1 deletion contracts/fungible-tokens/andromeda-cw20-staking/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use andromeda_std::{
error::ContractError,
};
use cosmwasm_std::{
attr, entry_point, Attribute, BlockInfo, Decimal, Decimal256, Order, QuerierWrapper, Uint256,
attr, entry_point, Attribute, BlockInfo, Decimal, Decimal256, Order, QuerierWrapper, Reply,
StdError, Uint256,
};
use cosmwasm_std::{
ensure, from_json, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, Storage,
Expand Down Expand Up @@ -885,3 +886,14 @@ fn query_stakers(
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
ADOContract::default().migrate(deps, CONTRACT_NAME, CONTRACT_VERSION)
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, ContractError> {
if msg.result.is_err() {
return Err(ContractError::Std(StdError::generic_err(
msg.result.unwrap_err(),
)));
}

Ok(Response::default())
}
13 changes: 12 additions & 1 deletion contracts/fungible-tokens/andromeda-cw20/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use andromeda_std::{
common::{actions::call_action, context::ExecuteContext, encode_binary, Funds},
error::ContractError,
};
use cosmwasm_std::entry_point;
use cosmwasm_std::{entry_point, Reply, StdError};
use cosmwasm_std::{
from_json, to_json_binary, Addr, Api, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo,
Response, StdResult, Storage, SubMsg, Uint128, WasmMsg,
Expand Down Expand Up @@ -401,3 +401,14 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result<Binary, ContractErro
_ => Ok(cw20_query(deps, env, msg.into())?),
}
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, ContractError> {
if msg.result.is_err() {
return Err(ContractError::Std(StdError::generic_err(
msg.result.unwrap_err(),
)));
}

Ok(Response::default())
}
14 changes: 13 additions & 1 deletion contracts/non-fungible-tokens/andromeda-cw721/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
use cosmwasm_std::entry_point;
use cosmwasm_std::{
attr, ensure, from_json, has_coins, to_json_binary, Addr, Api, BankMsg, Binary, Coin,
CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, QuerierWrapper, Response, SubMsg, Uint128,
CosmosMsg, Deps, DepsMut, Empty, Env, MessageInfo, QuerierWrapper, Reply, Response, StdError,
SubMsg, Uint128,
};

use crate::state::{is_archived, ANDR_MINTER, ARCHIVED, TRANSFER_AGREEMENTS};
Expand Down Expand Up @@ -508,3 +509,14 @@ pub fn query_minter(deps: Deps) -> Result<Addr, ContractError> {
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
ADOContract::default().migrate(deps, CONTRACT_NAME, CONTRACT_VERSION)
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, ContractError> {
if msg.result.is_err() {
return Err(ContractError::Std(StdError::generic_err(
msg.result.unwrap_err(),
)));
}

Ok(Response::default())
}
14 changes: 13 additions & 1 deletion contracts/os/andromeda-ibc-registry/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ use andromeda_std::{
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
attr, ensure, Binary, Deps, DepsMut, Env, MessageInfo, Order, Response, StdError, Storage,
attr, ensure, Binary, Deps, DepsMut, Env, MessageInfo, Order, Reply, Response, StdError,
Storage,
};
use cw_storage_plus::Bound;
use std::collections::HashSet;
Expand Down Expand Up @@ -192,3 +193,14 @@ pub fn get_all_denom_info(
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
ADOContract::default().migrate(deps, CONTRACT_NAME, CONTRACT_VERSION)
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, ContractError> {
if msg.result.is_err() {
return Err(ContractError::Std(StdError::generic_err(
msg.result.unwrap_err(),
)));
}

Ok(Response::default())
}
34 changes: 31 additions & 3 deletions contracts/os/andromeda-kernel/src/interface.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,38 @@
use andromeda_std::{
ado_base::MigrateMsg,
contract_interface,
deploy::ADOMetadata,
os::kernel::{ExecuteMsg, InstantiateMsg, QueryMsg},
};
use cw_orch::{interface, prelude::*};

pub const CONTRACT_ID: &str = "kernel";

contract_interface!(KernelContract, CONTRACT_ID, "andromeda_kernel.wasm");
#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, MigrateMsg, id = CONTRACT_ID)]
pub struct KernelContract;

impl<Chain> Uploadable for KernelContract<Chain> {
fn wrapper() -> Box<dyn MockContract<Empty>> {
Box::new(
ContractWrapper::new_with_empty(
crate::contract::execute,
crate::contract::instantiate,
crate::contract::query,
)
.with_reply(crate::contract::reply)
.with_migrate(crate::contract::migrate)
.with_ibc(
crate::ibc::ibc_channel_open,
crate::ibc::ibc_channel_connect,
crate::ibc::ibc_channel_close,
crate::ibc::ibc_packet_receive,
crate::ibc::ibc_packet_ack,
crate::ibc::ibc_packet_timeout,
),
)
}

fn wasm(_chain: &ChainInfoOwned) -> WasmPath {
artifacts_dir_from_workspace!()
.find_wasm_path("andromeda_kernel.wasm")
.unwrap()
}
}
1 change: 1 addition & 0 deletions packages/std/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ macro_rules! contract_interface {
crate::contract::instantiate,
crate::contract::query,
)
.with_reply(crate::contract::reply)
.with_migrate(crate::contract::migrate),
)
}
Expand Down

0 comments on commit cc904de

Please sign in to comment.