Skip to content

Commit

Permalink
feat: Improved macros and execution flow for AMP (#741)
Browse files Browse the repository at this point in the history
Co-authored-by: Joe Monem <[email protected]>
  • Loading branch information
crnbarr93 and joemonem authored Jan 22, 2025
1 parent 438e30d commit 334874a
Show file tree
Hide file tree
Showing 176 changed files with 2,847 additions and 3,240 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- feat: Improved macros and execution flow for AMP [(#741)](https://github.com/andromedaprotocol/andromeda-core/pull/741)

### Fixed

## Release 4
Expand Down
138 changes: 64 additions & 74 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ members = [
"contracts/math/*",

#Internal
"tests-integration",
"e2e-tests",
"ibc-tests",
]
resolver = "2"
Expand All @@ -34,7 +34,7 @@ strip = true
andromeda-std = { path = "./packages/std", default-features = false, features = [
"deploy",
] }
andromeda-macros = { path = "./packages/std/macros", default-features = false, version = "1.0.0" }
andromeda-macros = { path = "./packages/std/macros", default-features = false }
andromeda-non-fungible-tokens = { path = "./packages/andromeda-non-fungible-tokens", version = "1.0.0" }
andromeda-fungible-tokens = { path = "./packages/andromeda-fungible-tokens", version = "1.0.0" }
andromeda-finance = { path = "./packages/andromeda-finance", version = "1.0.0" }
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ unit-test:
@echo "Unit tests complete! \033[0;32m\xE2\x9C\x94\033[0m"

# Runs integration tests
integration-test:
e2e-test:
@echo "Running integration tests..."
@cargo test -p tests-integration --quiet
@cargo test -p e2e-tests --quiet
@echo "Integration tests complete! \033[0;32m\xE2\x9C\x94\033[0m"

# Runs all tests
test: unit-test integration-test
test: unit-test e2e-test
@echo "All tests complete! \033[0;32m\xE2\x9C\x94\033[0m"

# Deploys OS to specified blockchain
Expand Down
32 changes: 18 additions & 14 deletions contracts/accounts/andromeda-fixed-multisig/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ use andromeda_accounts::fixed_multisig::{ExecuteMsg, InstantiateMsg, QueryMsg};
use andromeda_std::{
ado_base::{InstantiateMsg as BaseInstantiateMsg, MigrateMsg},
ado_contract::ADOContract,
common::{context::ExecuteContext, encode_binary},
andr_execute_fn,
common::encode_binary,
error::ContractError,
};
use cw2::set_contract_version;

use crate::execute::handle_execute;
use crate::execute::{execute_close, execute_execute, execute_propose, execute_vote};
use crate::query::{
list_proposals, list_voters, list_votes, query_proposal, query_threshold, query_vote,
query_voter, reverse_proposals,
Expand Down Expand Up @@ -87,19 +88,22 @@ pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, Contract
Ok(Response::default())
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn execute(
deps: DepsMut,
env: Env,
info: MessageInfo,
msg: ExecuteMsg,
) -> Result<Response, ContractError> {
let ctx = ExecuteContext::new(deps, info, env);
// This contains functionality derived from the cw3-fixed-multisig contract.
// Source: https://github.com/CosmWasm/cw-plus/blob/main/contracts/cw3-fixed-multisig
// License: Apache-2.0
#[andr_execute_fn]
pub fn execute(ctx: ExecuteContext, msg: ExecuteMsg) -> Result<Response, ContractError> {
match msg {
ExecuteMsg::AMPReceive(pkt) => {
ADOContract::default().execute_amp_receive(ctx, pkt, handle_execute)
}
_ => handle_execute(ctx, msg),
ExecuteMsg::Propose {
title,
description,
msgs,
latest,
} => execute_propose(ctx, title, description, msgs, latest),
ExecuteMsg::Vote { proposal_id, vote } => execute_vote(ctx, proposal_id, vote),
ExecuteMsg::Execute { proposal_id } => execute_execute(ctx, proposal_id),
ExecuteMsg::Close { proposal_id } => execute_close(ctx, proposal_id),
_ => ADOContract::default().execute(ctx, msg),
}
}

Expand Down
Loading

0 comments on commit 334874a

Please sign in to comment.