pub trait Permit2Ext: Sync {
// Required methods
fn sufficient_balance(
&self,
token: Address,
user: Address,
amount: U256,
) -> impl Future<Output = Result<(), PreflightError>> + Send;
fn token_approved(
&self,
token: Address,
user: Address,
amount: U256,
) -> impl Future<Output = Result<(), PreflightError>> + Send;
fn nonce_available(
&self,
user: Address,
nonce: U256,
) -> impl Future<Output = Result<(), PreflightError>> + Send;
// Provided methods
fn check_signed_order(
&self,
order: &SignedOrder,
) -> impl Future<Output = Result<(), PreflightError>> + Send { ... }
fn check_unsigned_order(
&self,
order: &UnsignedOrder<'_>,
user: Address,
) -> impl Future<Output = Result<(), PreflightError>> + Send { ... }
fn check_orders_and_fills(
&self,
orders_and_fills: &OrdersAndFills,
) -> impl Future<Output = Result<(), PreflightError>> + Send { ... }
}Expand description
Extension trait that adds Permit2 preflight validation to any Provider.
Provides low-level checks (sufficient_balance, token_approved,
nonce_available) and high-level order validation methods.
§Example
use signet_orders::Permit2Ext;
provider.check_signed_order(&signed_order).await?;Required Methods§
Sourcefn sufficient_balance(
&self,
token: Address,
user: Address,
amount: U256,
) -> impl Future<Output = Result<(), PreflightError>> + Send
fn sufficient_balance( &self, token: Address, user: Address, amount: U256, ) -> impl Future<Output = Result<(), PreflightError>> + Send
Check if user has at least amount of token.
Sourcefn token_approved(
&self,
token: Address,
user: Address,
amount: U256,
) -> impl Future<Output = Result<(), PreflightError>> + Send
fn token_approved( &self, token: Address, user: Address, amount: U256, ) -> impl Future<Output = Result<(), PreflightError>> + Send
Check if user has approved at least amount of token to Permit2.
Sourcefn nonce_available(
&self,
user: Address,
nonce: U256,
) -> impl Future<Output = Result<(), PreflightError>> + Send
fn nonce_available( &self, user: Address, nonce: U256, ) -> impl Future<Output = Result<(), PreflightError>> + Send
Check if a Permit2 nonce is still available (not yet consumed).
Provided Methods§
Sourcefn check_signed_order(
&self,
order: &SignedOrder,
) -> impl Future<Output = Result<(), PreflightError>> + Send
fn check_signed_order( &self, order: &SignedOrder, ) -> impl Future<Output = Result<(), PreflightError>> + Send
Validate all preflight conditions for a SignedOrder.
Checks token balances, ERC20 approvals, and Permit2 nonce for each permitted token. Runs all checks concurrently.
Sourcefn check_unsigned_order(
&self,
order: &UnsignedOrder<'_>,
user: Address,
) -> impl Future<Output = Result<(), PreflightError>> + Send
fn check_unsigned_order( &self, order: &UnsignedOrder<'_>, user: Address, ) -> impl Future<Output = Result<(), PreflightError>> + Send
Validate preflight conditions for an UnsignedOrder.
Checks token balances and ERC20 approvals for each input token. Nonce check is skipped since unsigned orders lack a finalized nonce.
Sourcefn check_orders_and_fills(
&self,
orders_and_fills: &OrdersAndFills,
) -> impl Future<Output = Result<(), PreflightError>> + Send
fn check_orders_and_fills( &self, orders_and_fills: &OrdersAndFills, ) -> impl Future<Output = Result<(), PreflightError>> + Send
Validate preflight conditions for all orders in an OrdersAndFills.
Runs check_signed_order for every order concurrently.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.