Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions contracts/credit-manager/src/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ pub fn create_trigger_order(
}
);

// Ensure that the trigger order does not contain any illegal actions
// Initially, this is limited to just execute_perp_order, lend and close_perp_position
// Ensure that the trigger order only contains whitelisted actions.
let contains_legal_actions = actions.iter().all(|action| {
matches!(
action,
Action::ExecutePerpOrder { .. } | Action::Lend(..) | Action::ClosePerpPosition { .. }
Action::ExecutePerpOrder { .. }
| Action::Lend(..)
| Action::ClosePerpPosition { .. }
| Action::SwapExactIn { .. }
)
});
ensure!(contains_legal_actions, ContractError::IllegalTriggerAction);
Expand Down
Loading
Loading