Smol Ask create a practical, intent-centric experience based on the Lens protocol.
- Users can express their needs with pre-set actions on Lens V2.
- These intents are visible to friends and the community, who can help promote them.
- Anyone can easily fill in the order.
- And off-chain intent pool ranks these orders and finds the best solution based on condition checks.
We use a combination of on-chain smrat contract and offchain components to build the intent system. More specifically:
- A customized Lens Protocol v2 Open Action module to allow the user to create an intent (the wish to swap some token), and attach it to a Lens post
- A frontend plugin to Lenster (a popular Lens Web UI) to allow users to create the swap intent, and see the available intents in the post feed, and interact with the intent with Lens Open Action
- Use of Phat Contract (a decentralized confidential preserving compute protocol) to host the intent pool and run the auction to determine the best offer from the fillers, and submit the filling to the user
The lifecycle of the intent is described as below:
- A user (seller) create a Lens post with the swap intent attached
- The user's fund get locked into the intent manager contract
- The buyers see the post and the attached the intent, and they can interact with the post to create a filling offer. At this stage, the filling offer is just a signed message (MetaTx)
- One ore more signed offer get submitted to the intent pool. An auction run to determine the best offer for the intent owner.
- Once the intent reaches the deadline set by the seller, the auction ends. The intent pool then submits the winning offer as an Lens Open Action to the blockchain to settle.
- The action module facilite the transfer of the buy's and seller's token. Then a swap is finished.
In additional, since the resolving of the intent happens on the off-chain world, we allow the swap happens on the blockchains beyond Polygon (where Lens v2 is deployed).
Used technologies:
- Intent Pool & offchain auction
- Lens Protocol v2 & Open Action to enable intent resolving with social awareness
- Phala Network for building the privacy preserving offchain auction with cross-chain capability
- Meta transaction, EIP712
- Tech stack: Foundry, Solidity, Javascript / Typescript, Infura & Alchemy for RPC
- Used chains: Polygon Mumbai, Polygon zkEVM, Linea, Scroll
Hacky:
- Lens v2 was just published a week ago. It only has partial UI support. We need to apply a lot of walkaround.
- Ideally it's possible to integrate Uniswap v4 with the Open Action, but it requires some non-trivial modification to Account Abstraction frameowork. Therefore we can only leave it as a future work.