VulpeFI Docs
  • Whitepaper
  • VulpeFI Overview
  • Wallet VulpeFI
    • Wallet auto-connect
  • Aggregation Protocol
    • Introduction
    • Guide
      • Quick start
    • API
      • Swagger
        • Binance Smart Chain
        • Ethereum Network
        • BASE
        • Arbitrum
        • Polygon
      • Swap params
      • Quote params
    • Smart contracts
      • Aggregation VulpeFI
      • ClipperRouter
      • LimitOrderProtocol
      • UnoswapRouter
    • Limit order protocol
      • Introduction
      • Limit vs. RFQ Orders
      • Smart contracts
        • LimitOrderProtocol
        • LimitOrderProtocolPro
        • OrderLib
        • OrderMixin
        • OrderRFQMixin
        • helpers
          • AmountCalculator
          • ChainlinkCalculator
          • ERC1155Proxy
          • ERC721Proxy
          • ERC721ProxySafe
          • ImmutableOwner
          • NonceManager
          • PredicateHelper
          • SeriesNonceManager
          • WethUnwrapper
        • Interfaces
          • IDaiLikePermit
          • IWithdrawable
          • Interaction
          • PostInteraction
          • PreInteraction
      • Liquidity Source and API
        • Ethereum Network
        • Binance Smart Chain
        • Polygon
        • Avalanche
        • Gnosis Chain
    • Spot Price aggregator
      • Examples
      • Spot Price Aggregator
Powered by GitBook
On this page
  • Derives​
  • Functions​
  • remaining​
  • remainingRaw​
  • remainingsRaw​
  • simulateCalls​
  • cancelOrder​
  • fillOrder​
  • fillOrderToWithPermit​
  • fillOrderTo​
  • checkPredicate​
  • hashOrder​
  • Events​
  • OrderFilled​
  • OrderCanceled​
  1. Aggregation Protocol
  2. Limit order protocol
  3. Smart contracts

OrderMixin

PreviousOrderLibNextOrderRFQMixin

Last updated 4 months ago

Regular Limit Order mixin

Derives

  • Permitable

Functions

remaining

function remaining(
  bytes32 orderHash
) external returns (uint256)

Returns unfilled amount for order. Throws if order does not exist

Parameters:

Name
Type
Description

orderHash

bytes32

function remainingRaw(
  bytes32 orderHash
) external returns (uint256)

Returns unfilled amount for order

Name
Type
Description

orderHash

bytes32

Name
Type
Description

Result

uint256

Unfilled amount of order plus one if order exists. Otherwise 0

function remainingsRaw(
  bytes32[] orderHashes
) external returns (uint256[])

Same as remainingRaw but for multiple orders

Name
Type
Description

orderHashes

bytes32[]

function simulateCalls(
  address[] targets,
  bytes[] data
) external

Calls every target with corresponding data. Then reverts with CALL_RESULTS_0101011 where zeroes and ones denote failure or success of the corresponding call

Name
Type
Description

targets

address[]

Array of addresses that will be called

data

bytes[]

Array of data that will be passed to each call

function cancelOrder(
  struct OrderLib.Order order
) external

Cancels order by setting remaining amount to zero

Name
Type
Description

order

struct OrderLib.Order

function fillOrder(
  struct OrderLib.Order order,
  bytes signature,
  bytes interaction,
  uint256 makingAmount,
  uint256 takingAmount,
  uint256 thresholdAmount
) external returns (uint256, uint256)

Fills an order. If one doesn't exist (first fill) it will be created using order.makerAssetData

Name
Type
Description

order

struct OrderLib.Order

Order quote to fill

signature

bytes

Signature to confirm quote ownership

interaction

bytes

Making amount

makingAmount

uint256

Taking amount

takingAmount

uint256

Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies minimum allowed makingAmount

thresholdAmount

uint256

function fillOrderToWithPermit(
  struct OrderLib.Order order,
  bytes signature,
  bytes interaction,
  uint256 makingAmount,
  uint256 takingAmount,
  uint256 thresholdAmount,
  address target,
  bytes permit
) external returns (uint256, uint256)

Same as fillOrder but calls permit first, allowing to approve token spending and make a swap in one transaction. Also allows to specify funds destination instead of msg.sender

See tests for examples

Name
Type
Description

order

struct OrderLib.Order

Order quote to fill

signature

bytes

Signature to confirm quote ownership

interaction

bytes

Making amount

makingAmount

uint256

Taking amount

takingAmount

uint256

Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies minimum allowed makingAmount

thresholdAmount

uint256

Address that will receive swap funds

target

address

Should consist of abiencoded token address and encoded IERC20Permit.permit call.

permit

bytes

function fillOrderTo(
  struct OrderLib.Order order_,
  bytes signature,
  bytes interaction,
  uint256 makingAmount,
  uint256 takingAmount,
  uint256 thresholdAmount,
  address target
) public returns (uint256, uint256)

Same as fillOrder but allows to specify funds destination instead of msg.sender

Name
Type
Description

order_

struct OrderLib.Order

Order quote to fill

signature

bytes

Signature to confirm quote ownership

interaction

bytes

Making amount

makingAmount

uint256

Taking amount

takingAmount

uint256

Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies minimum allowed makingAmount

thresholdAmount

uint256

Address that will receive swap funds

target

address

function checkPredicate(
  struct OrderLib.Order order
) public returns (bool)

Checks order predicate

Name
Type
Description

order

struct OrderLib.Order

function hashOrder(
  struct OrderLib.Order order
) public returns (bytes32)
Name
Type
Description

order

struct OrderLib.Order

event OrderFilled(
  address maker,
  bytes32 orderHash,
  uint256 remaining
)

Emitted every time order gets filled, including partial fills

Name
Type
Description

maker

address

orderHash

bytes32

remaining

uint256

event OrderCanceled(
  address maker,
  bytes32 orderHash,
  uint256 remainingRaw
)

Emitted when order gets cancelled

Name
Type
Description

maker

address

orderHash

bytes32

remainingRaw

uint256

remainingRaw

Parameters:

Return Values:

remainingsRaw

Parameters:

simulateCalls

Parameters:

cancelOrder

Parameters:

fillOrder

Parameters:

fillOrderToWithPermit

Parameters:

fillOrderTo

Parameters:

checkPredicate

Parameters:

hashOrder

Parameters:

Events

OrderFilled

Parameters:

OrderCanceled

Parameters:

​
PredicateHelper
NonceManager
ChainlinkCalculator
AmountCalculator
EIP712
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​