MCPcopy Create free account
hub / github.com/cowprotocol/services / custom_interactions

Method custom_interactions

crates/shared/src/order_validation.rs:496–528  ·  view source on GitHub ↗

Converts the provided pre and post [`Hooks`] into pre and post [`Interactions`], respectively. This is done by returning the [`HooksTrampoline`] `execute` calldata with the (pre/post) hooks calldata as the parameter.

(&self, hooks: &Hooks)

Source from the content-addressed store, hash-verified

494 /// This is done by returning the [`HooksTrampoline`] `execute` calldata
495 /// with the (pre/post) hooks calldata as the parameter.
496 pub fn custom_interactions(&self, hooks: &Hooks) -> Interactions {
497 let to_interactions = |hooks: &[Hook]| -> Vec<InteractionData> {
498 if hooks.is_empty() {
499 vec![]
500 } else {
501 vec![InteractionData {
502 target: *self.hooks.address(),
503 value: alloy::primitives::U256::ZERO,
504 call_data: self
505 .hooks
506 .execute(
507 hooks
508 .iter()
509 .map(|hook| HooksTrampoline::HooksTrampoline::Hook {
510 target: hook.target,
511 callData: alloy::primitives::Bytes::from(
512 hook.call_data.clone(),
513 ),
514 gasLimit: alloy::primitives::U256::from(hook.gas_limit),
515 })
516 .collect(),
517 )
518 .calldata()
519 .to_vec(),
520 }]
521 }
522 };
523
524 Interactions {
525 pre: to_interactions(&hooks.pre),
526 post: to_interactions(&hooks.post),
527 }
528 }
529
530 async fn simulate_token_transfer(
531 &self,

Callers 1

validate_app_dataMethod · 0.80

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected