Intent-like decision tree is on Uniswap and it is enabled by the Uniswap V4 hooks!
In IFTTT or Zapier, users can write different integrations between different IoT components or APIs. I added a function on Uniswap that supports conditional liquidity flow that allows users stake in one LP contract, then when certain price trigger is met, the smart contract helps user exit an LP position and enter a new one.
For example, if I want to:
This is useful because now one can specify a condition to exit a position, and immediately deploys the capital into a different LP pair.
I used Foundry to manage the Solidity development, and used ERC-1155 to track ownership. The project can automatically exit user's position from an LP whenever anyone calls the swap function.
The buy and sell direction is determined by remembering the previous ticks inside the smart contract. And the liquidity chain is expressed as the following:
${price}->${poolId a.k.a. LP contract address in V4}:${amount}${price}->${poolId}:${amount}:${price}
Each time it gets passed down to another LP pool, the chain gets shorter. The expectaton is that all the pools in the "chain" will have this hook enabled.