— An AMM orders engine

Pine Finance 🌲
Aug 31 · 3 min read

We are thrilled to announce Pine finance, UniswapEx’s evolution to a simpler yet more powerful new system.

Image for post
Image for post

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.

Image for post
Image for post

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.

Image for post
Image for post

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).

However, thanks to The Graph protocol, we can index each order created immediately in the Pine Graph.

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.

Image for post
Image for post

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.

We have created two ready and easy-to-use handlers as examples: UniswapV1Handler.sol and UniswapV2Handler.sol — But we expect to see better ones around, using cross dexes and complex paths.

Our project is fully open-source and can be reviewed by anyone. The core contracts haven’t been audited by a reputable third party yet, and we advise everyone to proceed with caution.

That’s all! give it a try at

Given the trustless nature of UniswapEx, orders have to be migrated manually to The interface for accessing previous orders can be found on

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store