Skip to main content

encode_eth_flow_create_order

Function encode_eth_flow_create_order 

Source
pub fn encode_eth_flow_create_order(order: &EthFlowOrderData) -> Vec<u8> 
Expand description

Encode the EthFlow.createOrder(order, quoteId) calldata.

Function signature: createOrder((address,address,uint256,uint256,bytes32,uint256,uint32,bool,int64))

Total payload: selector (4) + 9 × 32-byte words = 292 bytes.

§Parameters

§Returns

A 292-byte Vec<u8> containing the ABI-encoded calldata.

§Example

use alloy_primitives::{Address, B256, U256};
use cow_ethflow::{EthFlowOrderData, encode_eth_flow_create_order};

let order = EthFlowOrderData {
    buy_token: Address::ZERO,
    receiver: Address::ZERO,
    sell_amount: U256::from(1_000_000_u64),
    buy_amount: U256::from(500_000_u64),
    app_data: B256::ZERO,
    fee_amount: U256::ZERO,
    valid_to: 9_999_999_u32,
    partially_fillable: false,
    quote_id: 42,
};
let cd = encode_eth_flow_create_order(&order);
assert_eq!(cd.len(), 292);