Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

IMilkman

Git Source

Interface for the Milkman contract that handles async swaps via CoW Protocol

https://github.com/cowdao-grants/milkman/blob/3b02b80a512b30194efc1debe5fcf0747de6b561/src/Milkman.sol

Functions

requestSwapExactTokensForTokens

Request an async swap of exact tokens for tokens

function requestSwapExactTokensForTokens(
    uint256 amountIn,
    IERC20 fromToken,
    IERC20 toToken,
    address to,
    bytes32 appData,
    address priceChecker,
    bytes calldata priceCheckerData
)
    external;

Parameters

NameTypeDescription
amountInuint256The amount of input tokens to swap
fromTokenIERC20The token to swap from
toTokenIERC20The token to swap to
toaddressThe recipient of the output tokens
appDatabytes32The app data to be used in the CoW Protocol order
priceCheckeraddressThe price checker contract to validate the swap
priceCheckerDatabytesData to pass to the price checker

cancelSwap

Cancel a requested swap

function cancelSwap(
    uint256 amountIn,
    IERC20 fromToken,
    IERC20 toToken,
    address to,
    bytes32 appData,
    address priceChecker,
    bytes calldata priceCheckerData
)
    external;

Parameters

NameTypeDescription
amountInuint256The amount that was to be swapped
fromTokenIERC20The from token
toTokenIERC20The to token
toaddressThe recipient
appDatabytes32
priceCheckeraddressThe price checker that was used
priceCheckerDatabytesThe price checker data that was used

Events

SwapRequested

Event emitted when a swap is requested

event SwapRequested(
    address orderContract,
    address orderCreator,
    uint256 amountIn,
    address fromToken,
    address toToken,
    address to,
    bytes32 appData,
    address priceChecker,
    bytes priceCheckerData
);