-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BAL Hookathon - Serene Hook #104
base: main
Are you sure you want to change the base?
Conversation
…the desired system
@Kogaroshi is attempting to deploy a commit to the Matt Pereira's projects Team on Vercel. A member of the Team first needs to authorize it. |
* @param pool The pool from which the fees were taken | ||
* @param steps The swap steps to convert the fees to the incentive token | ||
*/ | ||
function createQuest(address pool, IBatchRouter.SwapPathStep[][] calldata steps) public nonReentrant { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not safe to have the steps be provided since this is a permissionless function. Someone could create a malicious pool that captures 99% of the fees.
Serene Hook
Demo video : Serene Hook Demo
What the hook does
Abstract
The Serene Hook provide a simple and easy way to incentive in a substainable manner the pools that use this hook. It takes a portion of the trading fees generated by the pools and create Paladin's Quests to reward the liquidity provisioners with BAL emissions to the associoted pools's gauges. This enable bigger APYs for the liquidity providers and a better capital efficiency for the pools as it uses the balancer flywheel.
Components
SereneHook
: The main contract that will be used by the pools to use the trading fees to incentive the liquidity providers. It implements theonComputeDynamicSwapFeePercentage
function to keep a portion of the initial pool swap fee, and then theafterSwap
function to take the remaininder of the initial swap fees. The last core function of the SereneHook is thecreateQuest
function that will create a quest inside the Paladin's Quests contract in a permissionless way. The quests are created by swapping the fees tokens to a defined incentive token (ex WETH).SereneVeBalDiscountHook
: The same hook asSereneHook
but with a discount on the protocol swap fees for veBAL holders. The discount is applied by theonComputeDynamicSwapFeePercentage
function, and also only impacts the fees taken after the swap by the Hook.QuestSettingsRegistry
: A utility contract to store specific settings for the quest creation that will be fetched by theSereneHook
contract. These settings are stored in a permissioned way with one settings per incentive token (ex WETH).QuestBoard
: The external contract from Paladin's Quest product used to create incentive for veBAL voters to vote for the pool(s gauges.)GaugeRegistry
: A mock contract used mainly to store the gauges of the pools while the balancer v3 gauge registry is being worked on.First the users make some swaps in the pool, generating some trading fees. Then any user can call the createQuest function to create a quest in the Paladin's Quests contract. The quest will be created with the trading fees tokens swapped to the incentive token (ex WETH) and the liquidity providers of the pool will be rewarded with BAL emissions to the pool's gauge.
Example use case
An example use case of the Serene Hook is the following:
A protocol decides to create a balancer V3 pool, he wants to attract liquidity providers to deposit into his pool. He decides to use the Serene Hook when creating his pool. To make it works, he deploy a gauge to his pool and get approved by governance. Then over the time The liquidity providers of the pool will be rewarded with BAL emissions to the pool's gauge by using the swap fees.
Feedback about DevX
In our experience developping the Serene Hook, we found the DevX to be pretty good overall with a decent documentation and a good community support.
The cherry on top was the scaffold repository already had base tests for the hooks, which made the development process much faster and easier.
The pain points were: