IOrderController

Git Source

Functions

deposit

Allows a user to deposit tokens and create a DEPOSIT order. It doesn't gurantee deposit

The order can be executed if there's a matching withdrawal request. The caller should approve tokens prior to calling this function.

function deposit(uint256 tokenAmount, uint256 iterationLimit) external;

Parameters

NameTypeDescription
tokenAmountuint256The amount of tokens to deposit.
iterationLimituint256The maximum number of orders to process in a single call.

withdraw

Allows a user to withdraw tranches and create a WITHDRAW order.

The order can be executed if there's a matching deposit request. The caller should approve tranches prior to calling this function.

function withdraw(uint256 trancheAmount, uint256 iterationLimit) external;

Parameters

NameTypeDescription
trancheAmountuint256The amount of tranches to withdraw.
iterationLimituint256The maximum number of orders to process in a single call.

cancelOrder

Allows a user to cancel their pending order.

This can be called by the user who placed the order only.

function cancelOrder() external;

cancelDustOrder

Allows any users to cancel dust order.

function cancelDustOrder(uint256 orderId) external;

Parameters

NameTypeDescription
orderIduint256The order id to cancel.

expectedTokenAmount

Calculate the expected token amount for a given tranche amount.

function expectedTokenAmount(uint256 trancheAmount) external view returns (uint256);

Parameters

NameTypeDescription
trancheAmountuint256The amount of tranches to convert.

Returns

NameTypeDescription
<none>uint256The expected token amount.

expectedTrancheAmount

Calculate the expected tranche amount for a given token amount.

function expectedTrancheAmount(uint256 tokenAmount) external view returns (uint256);

Parameters

NameTypeDescription
tokenAmountuint256The amount of tokens to convert.

Returns

NameTypeDescription
<none>uint256The expected tranche amount.

currentOrderType

Return the type of the current order in the linked list of orders

function currentOrderType() external view returns (OrderType);

getValidOrderCount

Return the count of valid orders and the current order type.

function getValidOrderCount() external view returns (uint256 count, OrderType orderType);

Returns

NameTypeDescription
countuint256The count of valid orders.
orderTypeOrderTypeThe type of the current order.

getValidOrders

Return the valid orders and the current order type.

function getValidOrders() external view returns (Order[] memory, OrderType);

Returns

NameTypeDescription
<none>Order[]orders The valid orders.
<none>OrderTypeorderType The type of the order.

getOrderCount

Return the count of all orders.

function getOrderCount() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The count of all orders.

getOrders

Return all orders.

function getOrders() external view returns (Order[] memory);

Returns

NameTypeDescription
<none>Order[]The orders.

getUserOrder

Return the order of the given user.

function getUserOrder(address user) external view returns (Order memory);

Parameters

NameTypeDescription
useraddressThe user address.

Returns

NameTypeDescription
<none>OrderThe order.

dust

Return the min amount of an order.

function dust() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The minimum value.

Events

DustUpdated

event DustUpdated(uint256 newDust);

Errors

InvalidAmount

error InvalidAmount();

InvalidOrderType

error InvalidOrderType();

InvalidOrderId

error InvalidOrderId();

InsufficientBalance

error InsufficientBalance();

InsufficientAllowance

error InsufficientAllowance();

PortfolioClosed

error PortfolioClosed();