(&self, order: PreOrderData)
| 654 | impl 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 | /// |
no test coverage detected