The UniBrain
hook is designed to automatically trigger onchain actions using an automated Dutch Auction via a Uniswap V4 Pool
Imagine you want to automatically trigger an onchain action. How do you automate that? You pay a third-party to automatically trigger that function call – onchain or offchain.
The UniBrain hook turns UniswapV4 into a hub for triggering onchain function calls.
Instead of paying an offchain third-party or bootstrapping a new decentralized network, the UniBrain hook uses a Dutch Action to incentivize an existing network (i.e. block builders and searchers) to automatically trigger any onchain function by executing a profitable trade via the UniswapV4 protocol.
There are many legitimate reasons for needing to automatically trigger an onchain function call. And it's up to the person/team setting up the UniBrain hook for Uniswap V4.
The UniBrain hook is designed to automate any onchain action at a predetermind time by using an automated Dutch Auction to incentive "rational economic actors" to periodally swap via the pool and automatically triggering on onchain function call.
For example let's imagine we have a UniswapV4 DAI/USDC pool with a $1,000 worth of liquidity. And we want an onchain function to be called every 30 minutes.
There is a cost to executing the onchain transaction.
Let's assume it costs $0.03 to execute the onchain transaction.
The UniBrain hook will automatically start a Dutch Auction every 30 minutes. And during this period the cost of purchasing USDC with DAI will decrease by $0.01 every 10 seconds.
At a certain point in time it becomes profitable to execute a swap via the DAI/USDC pool.
In-turn automatically executing the onchain function call at a competitive price.
A win/win for everyone.
Searchers gets a small profit and an onchain service/protocol relying on that automation can sleep easily at night knowing their infrastructure will continue to run smoothly.
There are two primary smart contracts:
The UniBrain hook automatically starts a Dutch Auction at a designated time interval i.e. every 30 minutes. Changing the price curve between the two assets and incentivizing a swap to occur in the pool.
Every swap will trigger a function call to the UniBrainHub.
The UniBrainHub upon receiving a "ping" from the UniBrain hook will execute a sequential transaction call to an external contract - the function call can be set to anything.