WARNING: This is the only hook you will ever need for stablecoin-to-stablecoin pools.
This is a hook for Uniswap V4 that allows LPs to liquidize their liquidity deposited into stablecoin-to-stablecoin pools. These liquid tokens are called "Uniliquids". The objective of this hook is to provide a way for LPs to provide liquidity to stablecoin-to-stablecoin pools, earning the yield, without losing the access to their liquidity.
Example: if a user deposits 1000 USDC into the pool, the hook will mint a uniliquid USDC (1000 ulUSDC
) token to this user.
Uniliquids are ERC20 tokens that are pegged to the stablecoin in the pool, thus essentially preserving LPs' liquidity. The price of the uniliquid token is determined by the price of the stablecoin in the pool.
Uniliquids are minted in the ratio of 1:1 with the stablecoin in the pool.
Deployment artifacts:
- Hook:
0xa1bda7ca8b5b9c08c4942e0b43ccf26a70206a88
(Explorer) - Mock USDC:
0xdba72418a27113bb4f2f351b9341f8d650ffa08a
(Explorer) - Mock USDT:
0x65a546448393872bb56aa74931afef34ded45514
(Explorer) - Uniliquid USDC / USDC (see
tokens
section): Explorer - Swap Example: Explorer
A more detailed artifacts can be found in the broadcast-sepolia
folder.
Example wallet with Uniliquids:
To run the tests, run the following command:
make test
To deploy the hook, run the following commands:
- Set the required
.env
variables. The list can be found in theexample.env
file. - (Optional) Deploy the mock tokens with
make deploy-mock-tokens
. Set the contract addresses of the deployed tokens in thescript/base/Config.sol
file. - (Optional) Set the contract addresses for the
PoolManager
andPositionManager
in thescript/base/Constants.sol
file. - Deploy the hook with
make deploy-hook
. - Set the contract address of the deployed hook in the
script/base/Config.sol
file.
To fund the sender with testnet USDC and USDT on Unichain Sepolia, run the following command:
make fund-me
To create the pool with initial liquidity, run the following command:
make deploy-pool-with-initial-liquidity
To add even more liquidity to the pool, run the following commands:
make add-liquidity
To perform a basic swap, run the following command:
make swap
This will perform a swap of 1 USDC to USDT. If you wish to configure the swap amount, you can do so by changing the amountSpecified
value in the script/03_Swap.s.sol
file.
- Add support for exact out swaps.
- Add support for single-asset deposits/redemptions.
- Thoroughly test the logic for different decimals stablecoins.