Technical
introduction to Uniswap v4, focused on the Singleton architecture and
the use of Hooks for developers seeking extensibility.(long video:25 mnts) Unlike
previous versions, v4 consolidates all pools into a single contract
(PoolManager), drastically reducing gas costs for multi-hop swaps and
the creation of new pools, which become mere state updates. For
developers, the major innovation is Hooks: external contracts that
allow injecting custom logic at 14 different points in the lifecycle of
an operation (such as beforeSwap, afterAddLiquidity, etc.). The
workshop emphasizes that it is not necessary to implement all 14
functions, but rather to focus on those that define the desired
behavior, such as dynamic rates or custom oracles. The concept of Flash
Accounting is introduced, which optimizes asset movement by processing
only the net balance at the end of a transaction. The speaker suggests
using the OpenZeppelin hooks library to accelerate development and
avoid writing everything from scratch. Use cases focused on public
goods are highlighted, such as redirecting a portion of fees to impact
funds or creating discounts for verified donors. The v4 architecture
utilizes the ERC-6909 standard to efficiently manage tokens within the
Singleton. The development workflow is facilitated by templates and
support from the Uniswap Foundation for projects that demonstrate
innovation in concentrated liquidity. The ultimate goal is to transform
the DEX into a modular platform where any developer can build their own
permissionless and efficient market logic.
Brevis
Workshop at the Uniswap v4 hooks incubator, focused on how developers
can create data-driven hooks using ZK coprocessors.(long video:01:00
hrs) Brevis
allows contracts to access the entire on-chain history trustlessly,
overcoming the prohibitive cost limitation of reading historical data
directly from the EVM. For developers, the flow consists of three
steps: reading data (transactions, events, or states), computing (using
map-reduce APIs), and sending the result via ZK proof to the contract.
The SDK abstracts the complexity of ZK circuits, allowing the focus to
be on business logic, such as fee discounts for VIP trading volume.
Highlighted use cases include LVR compensation based on historical
volatility and retrospective liquidity rewards. The system is highly
scalable, proving thousands of transactions in seconds with minimal
cost compared to protocol revenues. In the code, the developer
implements the handleProofResult interface to receive the verified
output and apply actions to the hook. The integration with Uniswap v4
focuses on dynamic rate hooks (beforeSwap) that query off-chain
generated user profile tables. There is also mention of a grant program
to support developers creating active liquidity solutions and intent
automation. The architecture ensures that, even when using indexer
data, validity is guaranteed by the mathematical proof of the
originating blockchain. In short, the tool transforms "dumb" contracts
into smart contracts by providing access to a verifiable historical
database.
Introduction to UniSwap v4 Hooks. Creating your first UniSwap v4 hook deep dive. (long video: 52mnts) vide details The
Uniswap v4 architecture uses a Singleton Pattern (PoolManager), where
hooks are external contracts triggered by callbacks at specific points
in the pool's lifecycle.
For developers, implementation requires the use of Solidity 8.25+ and
network configuration for the Cancun version, enabling the efficient
use of Transient Storage (EIP-1153).
The contract must inherit from BaseHook and implement the
getHookPermissions function, which returns a bitmap indicating which
callbacks (e.g., beforeSwap, afterAddLiquidity) the hook will execute.
The hook contract's addressing is not arbitrary; it must have a
specific prefix (address mining) that corresponds to the declared
permissions to be accepted by the PoolManager.
Unlike v3, the msg.sender in the hook context is often the PoolManager
or the Router; to identify the end user, it is necessary to decode data
via the hookData parameter.
Transient Storage logic (tstore and tload) is the standard tool for
maintaining states between different callbacks of the same transaction
without the prohibitive gas cost of persistent storage.
When implementing reward systems (such as the points system in the
video), the afterSwap hook is the ideal place to capture the exact
traded volume and update balances.
v4 introduces native support for Native ETH, and hook developers should
use the Currency library to ensure compatibility between ERC-20 tokens
and native Ether.
The Foundry testing environment is indispensable, using the v4-core
library to simulate swaps and liquidity injections that validate the
behavior of callbacks.
Security is critical: hooks that manage assets must ensure that only
the PoolManager has the authority to call sensitive functions,
protecting the integrity of the pool funds.
Technical
summary focused on Dynamic's infrastructure for developers working with
Hooks V4 and Account Abstraction (AA).(18:00 mnts)
Dynamic acts as an identity orchestration layer that allows injecting
custom hooks at each stage of the authentication lifecycle. For hook
developers, the platform offers lifecycle events that trigger specific
logic when a wallet is linked or a transaction is signed. Integration
with Scaffold Eth Hacker Edition facilitates the use of native React
hooks to interact with smart accounts (Safe) and L2 networks such as
Base and Arbitrum. The "Embedded Wallets" system allows developers to
create programmatic transaction flows, where hooks can validate
conditions before authorizing gas spending. The architecture supports
the definition of hooks for Silent Signing, allowing the application to
execute transactions in the background without interrupting the user
flow (invisible UX). It is possible to configure "Gradual Onboarding"
hooks to capture data via API or social network metadata
(Farcaster/Lens) at the exact moment of conversion. The platform
simplifies the use of Paymasters (such as Pimlico), allowing hooks to
dynamically decide whether or not the dApp should sponsor the gas for a
specific transaction. Developers can utilize multi-chain hooks to
synchronize states between EVM, Solana, and Bitcoin, unifying the
experience in a single provider interface. The boilerplate includes
support for cross-chain transfer hooks via Chainlink CCIP, automating
asset bridging during interaction with smart contracts.
AI Trading,
Uniswap V4 Hooks, and the Future of Permissionless Liquidity
long video : 56 mnts Steer
Protocol and the Future of Decentralized Liquidity
In this episode of the Ungovernable podcast, Derek, founder of Steer
Protocol, details Steer's complex journey, from its founding to its
establishment as a cutting-edge liquidity infrastructure, focused on AI
integration, operating on over 30 blockchains and 50 DEXs.
Steer Protocol aims to simplify liquidity provision (LP) in Automated
Market Makers (AMMs), a notoriously complex task. Derek points out that
the difficulty in defining price ranges and allocating liquidity drives
many users away. Steer's solution abstracts this complexity by offering
predefined risk profiles and corresponding APRs, allowing users to
deposit their assets while Steer automatically manages liquidity. This
is a fundamental technical aspect, as it involves rebalancing and
capital optimization algorithms. Technical innovations include:
Smart Launch: A tool for the automated creation of liquidity pools for
token launches. This feature allows the selection of pre-configured LP
strategies with various risk profiles and incorporates dynamic fees to
mitigate bot and sniper activity, a common technical challenge in token
launches.
Automated Liquidity Strategies: Steer offers approximately 20
ready-to-use strategies. The channel multiplier, for example, allows
users to define the width of the price band in a simplified way, which
is an important optimization for capital efficiency.
AI Integration in Liquidity Management: Steer collaborates with teams
such as Allora and Bit Tensor to incorporate AI data feeds, enabling
the development of predictive pricing and liquidity rebalancing
algorithms. This aims to generate market-beating strategies and
accumulate underlying assets, a significant advancement in the
automation and intelligence of liquidity provision.
Uniswap V4 Hooks - Steer has developed three hooks for Uniswap V4.
These include the ability to create KYC/AML pools for institutional
clients and the ability to utilize idle liquidity in other markets,
such as lending or bridges, demonstrating the platform's
interoperability and scalability.
Derek also discusses the criticism of dynamic fees, arguing that they
do not always benefit liquidity providers due to impermanent loss. He
advocates for strategies that minimize impermanent loss and more
sustainable incentive models, such as "smart bonds," which allow
protocols to acquire their own liquidity.
Steer Protocol's vision for the future is ambitious: to act as the
foundational liquidity layer that co
Verified Hooks:
Security, Debugging, and Formal Verification for Uniswap v4
long video : 52 mnts This
video provides an in-depth discussion of Security, Debugging, and
Formal Verification for Uniswap v4 Hooks: Paulina, CTO of Runtime
Verification, discusses key aspects of ensuring code correctness and
security.
Formal Verification Overview
Paulina explains formal verification as a mathematical technique for
proving that code behaves as expected, ensuring its correctness against
specifications or properties.
Security Concerns in Hooks
She highlights security concerns specific to hooks, such as pool
counting (whether a hook can be used by different pools), handling
native Ether, and the importance of access control to prevent
unauthorized calls.
Security Assurance Approaches
Paulina discusses several approaches to ensuring code security,
classifying them by confidence level:
Manual Review: Essential for identifying issues, but can be
inconsistent and time-consuming, especially with code changes. Static
Analysis: Tools like Slither are fast, but they can generate many false
positives and only detect predefined patterns.
Unit Testing and Fuzzing with Foundry: Paulina demonstrates how to use
Foundry to write unit tests in Solidity, allowing you to test specific
execution paths. She also explains fuzzing, which repeatedly runs tests
with different input values to cover more paths and identify edge cases.
Formal Verification with Control: Paulina presents Control, a
Foundry-compatible formal verification tool that mathematically proves
code correctness for all possible input values, covering all execution
paths. She demonstrates how Control can identify vulnerabilities that
fuzzing might miss, such as deadline issues in liquidity-adding
functions.
Tools and Resources
Control: A free and open-source formal verification tool compatible
with Foundry that can run on CI. *Symbolic:* An EVM debugger available
as a VS Code extension, which allows you to debug code line by line and
inspect the execution state.
*Cast:* A free hosted solution for running Foundry and Control tests in
the cloud, which generates formal verification reports.
Paulina emphasizes that while formal verification is powerful, it's
important to be precise with the scope of what's being verified due to
scalability challenges, such as handling loops and complex branches.
She recommends focusing on critical security properties, such as access
control and arithmetic correctness, and on standalone math libraries.