Pine is the next version of UniswapEx, a hackathon project born at ETH Berlin 2019 as a protocol for automated and decentralized limit orders on Uniswap.
The first project was primarily built solely to execute limit orders using Uniswap v1; Now, Pine has expanded to new horizons supporting any order type on any dex, enabling trades that harness the power of the whole ecosystem.
We want to start simple, that’s why we are launching Pine with initial support for limit orders using Uniswap v2 and v1.
Additional sources of liquidity such as 1inch, 0x, Balancer, Kyber, AAVE, etc will be added in the near future, alongside new order types like stop-loss orders, market orders, and more.
One of the most exciting things is that every token combination is available, without limits on what you can select for buying and selling. All token pairs exist, and all pairs have liquidity.
How does it work?
Pine has two main participants: Traders and Relayers.
As a trader, an order can be created by sending some tokens to a specific deterministic address or calling the Pine contract directly.
One of the biggest challenges when working with ERC20 tokens is dealing with the approval and transfer pattern; it confuses users and makes transacting more expensive.
This pattern is often combined with “unlimited” authorizations, forcing users to trust the contract with all their funds for an undefined amount of time.
We have improved this pattern, and now traders just need to send the tokens to what we call vault contracts. Every order is stored in its own vault contract keeping the funds safe.
The relayers have the task of monitoring the network looking for Pine orders, and executing them when the trade conditions can be fulfilled.
Because of how we encode the transaction data, there is no easy way to detect new token orders (they look like any other token transfer).
Relayer competition dynamics
Relayers use handler contracts to execute the orders. Those contracts are free to complete the order in any way as long as the conditions defined by the user get fulfilled.
Allowing relayers to decide the strategy to execute orders opens a new game. They need to be fast and efficient, looking for different paths of tokens and exchanges to find which one(s) meets the executing conditions.
A crucial part of this new way of handling relayers is that now relayers determine the fee they want to receive for executing the orders.
That fee is taken from the arbitrage opportunity during the order execution; this replaces the fixed-style fee from v1 with a dynamic auction-style fee. This new mechanism allows orders to be executed even when gas prices are higher than usual.