4444use crate :: { DiscoveryError , DiscoveryInterface } ;
4545use alloy_primitives:: { Address , Bytes , U256 } ;
4646use alloy_provider:: RootProvider ;
47- use alloy_sol_types:: sol ;
47+ use alloy_sol_types:: SolType ;
4848use alloy_transport_http:: Http ;
4949use async_trait:: async_trait;
5050use axum:: {
@@ -59,7 +59,10 @@ use serde::{Deserialize, Serialize};
5959use serde_json;
6060use solver_types:: {
6161 bytes32_to_address, current_timestamp, normalize_bytes32_address,
62- standards:: eip7683:: { GasLimitOverrides , LockType , MandateOutput } ,
62+ standards:: eip7683:: {
63+ interfaces:: { IInputSettlerCompact , IInputSettlerEscrow , SolMandateOutput , StandardOrder } ,
64+ GasLimitOverrides , LockType , MandateOutput ,
65+ } ,
6366 with_0x_prefix, ConfigSchema , Eip7683OrderData , Field , FieldType , ImplementationRegistry ,
6467 Intent , IntentMetadata , NetworksConfig , Schema ,
6568} ;
@@ -70,44 +73,6 @@ use std::sync::Arc;
7073use tokio:: sync:: { mpsc, Mutex } ;
7174use tower_http:: cors:: CorsLayer ;
7275
73- // Import the Solidity types for the OIF contracts
74- sol ! {
75- #[ sol( rpc) ]
76- interface IInputSettlerEscrow {
77- function orderIdentifier( bytes calldata order) external view returns ( bytes32) ;
78- function openFor( bytes calldata order, address sponsor, bytes calldata signature) external;
79- }
80-
81- #[ sol( rpc) ]
82- interface IInputSettlerCompact {
83- function orderIdentifier( StandardOrder calldata order) external view returns ( bytes32) ;
84- }
85-
86- #[ derive( Debug ) ]
87- struct StandardOrder {
88- address user;
89- uint256 nonce;
90- uint256 originChainId;
91- uint32 expires;
92- uint32 fillDeadline;
93- address inputOracle;
94- uint256[ 2 ] [ ] inputs;
95- SolMandateOutput [ ] outputs;
96- }
97-
98- #[ derive( Debug ) ]
99- struct SolMandateOutput {
100- bytes32 oracle;
101- bytes32 settler;
102- uint256 chainId;
103- bytes32 token;
104- uint256 amount;
105- bytes32 recipient;
106- bytes call;
107- bytes context;
108- }
109- }
110-
11176/// API representation of StandardOrder for JSON deserialization.
11277///
11378/// This struct represents the order format for the OIF contracts.
@@ -471,10 +436,8 @@ impl Eip7683OffchainDiscovery {
471436 ///
472437 /// Returns `DiscoveryError::ParseError` if the order data cannot be decoded.
473438 fn parse_standard_order ( order_bytes : & Bytes ) -> Result < StandardOrder , DiscoveryError > {
474- use alloy_sol_types:: SolValue ;
475-
476439 // Decode the StandardOrder struct from the order data
477- let order = StandardOrder :: abi_decode ( order_bytes, true ) . map_err ( |e| {
440+ let order = < StandardOrder as SolType > :: abi_decode ( order_bytes, true ) . map_err ( |e| {
478441 DiscoveryError :: ParseError ( format ! ( "Failed to decode StandardOrder: {}" , e) )
479442 } ) ?;
480443
@@ -707,14 +670,13 @@ impl Eip7683OffchainDiscovery {
707670 settler_address : Address ,
708671 lock_type : LockType ,
709672 ) -> Result < [ u8 ; 32 ] , DiscoveryError > {
710- use alloy_sol_types:: SolValue ;
711-
712673 match lock_type {
713674 LockType :: ResourceLock => {
714675 // Resource Lock (TheCompact) - use IInputSettlerCompact
715- let std_order = StandardOrder :: abi_decode ( order_bytes, true ) . map_err ( |e| {
716- DiscoveryError :: ParseError ( format ! ( "Failed to decode StandardOrder: {}" , e) )
717- } ) ?;
676+ let std_order =
677+ <StandardOrder as SolType >:: abi_decode ( order_bytes, true ) . map_err ( |e| {
678+ DiscoveryError :: ParseError ( format ! ( "Failed to decode StandardOrder: {}" , e) )
679+ } ) ?;
718680 let compact = IInputSettlerCompact :: new ( settler_address, provider) ;
719681 let resp = compact
720682 . orderIdentifier ( std_order)
@@ -806,7 +768,6 @@ impl Eip7683OffchainDiscovery {
806768 Ok ( ( ) )
807769 }
808770}
809-
810771/// Handles intent submission requests.
811772///
812773/// This is the main request handler for the POST /intent endpoint.
0 commit comments