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

Method partial_validate

crates/shared/src/order_validation.rs:656–703  ·  view source on GitHub ↗
(&self, order: PreOrderData)

Source from the content-addressed store, hash-verified

654impl OrderValidating for OrderValidator {
655 #[instrument(skip_all)]
656 async fn partial_validate(&self, order: PreOrderData) -> Result<(), PartialValidationError> {
657 if !self
658 .banned_users
659 .banned([order.receiver, order.owner])
660 .await
661 .is_empty()
662 {
663 return Err(PartialValidationError::Forbidden);
664 }
665
666 if order.class == OrderClass::Market && order.partially_fillable {
667 return Err(PartialValidationError::UnsupportedOrderType);
668 }
669
670 if order.buy_token_balance != BuyTokenDestination::Erc20 {
671 return Err(PartialValidationError::UnsupportedBuyTokenDestination(
672 order.buy_token_balance,
673 ));
674 }
675
676 if order.sell_token_balance != SellTokenSource::Erc20 {
677 return Err(PartialValidationError::UnsupportedSellTokenSource(
678 order.sell_token_balance,
679 ));
680 }
681
682 self.validity_configuration.validate_period(&order)?;
683 validate_same_sell_and_buy_token(
684 &self.same_tokens_policy,
685 &order,
686 self.native_token.address(),
687 )?;
688
689 if order.sell_token == BUY_ETH_ADDRESS {
690 return Err(PartialValidationError::InvalidNativeSellToken);
691 }
692
693 for token in &[order.sell_token, order.buy_token] {
694 if self.deny_listed_tokens.contains(token) {
695 return Err(PartialValidationError::UnsupportedToken {
696 token: *token,
697 reason: "token is deny listed".to_string(),
698 });
699 }
700 }
701
702 Ok(())
703 }
704
705 /// Validates the provided app data, returning an [`OrderAppData`] if valid.
706 ///

Callers 3

pre_validate_errFunction · 0.80
build_quote_paramsMethod · 0.80

Calls 7

bannedMethod · 0.80
validate_periodMethod · 0.80
to_stringMethod · 0.80
is_emptyMethod · 0.45
addressMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected