Skip to content

Commit

Permalink
Add Action Support (#146)
Browse files Browse the repository at this point in the history
* add execute action

* add action and recover logic

* add cw20 logic

* update schema

* add tests for execute action
  • Loading branch information
NotJeremyLiu authored Nov 4, 2024
1 parent e27c8ef commit e422e48
Show file tree
Hide file tree
Showing 7 changed files with 1,030 additions and 61 deletions.
39 changes: 37 additions & 2 deletions contracts/entry-point/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::{
error::{ContractError, ContractResult},
execute::{
execute_post_swap_action, execute_swap_and_action, execute_swap_and_action_with_recover,
execute_user_swap, receive_cw20,
execute_action, execute_action_with_recover, execute_post_swap_action,
execute_swap_and_action, execute_swap_and_action_with_recover, execute_user_swap,
receive_cw20,
},
query::{query_ibc_transfer_adapter_contract, query_swap_venue_adapter_contract},
reply::{reply_swap_and_action_with_recover, RECOVER_REPLY_ID},
Expand Down Expand Up @@ -174,6 +175,40 @@ pub fn execute(
post_swap_action,
exact_out,
),
ExecuteMsg::Action {
sent_asset,
timeout_timestamp,
action,
exact_out,
min_asset,
} => execute_action(
deps,
env,
info,
sent_asset,
timeout_timestamp,
action,
exact_out,
min_asset,
),
ExecuteMsg::ActionWithRecover {
sent_asset,
timeout_timestamp,
action,
exact_out,
min_asset,
recovery_addr,
} => execute_action_with_recover(
deps,
env,
info,
sent_asset,
timeout_timestamp,
action,
exact_out,
min_asset,
recovery_addr,
),
}
}

Expand Down
13 changes: 13 additions & 0 deletions contracts/entry-point/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,17 @@ pub enum ContractError {

#[error("Reply id: {0} not valid")]
ReplyIdError(u64),

//////////////////
/// ACTION ///
//////////////////

#[error("No Minimum Asset Provided with Exact Out Action")]
NoMinAssetProvided,

#[error("Sent Asset and Min Asset Denoms Do Not Match with Exact Out Action")]
ActionDenomMismatch,

#[error("Remaining Asset Less Than Min Asset with Exact Out Action")]
RemainingAssetLessThanMinAsset,
}
Loading

0 comments on commit e422e48

Please sign in to comment.