project screenshot 1
project screenshot 2
project screenshot 3

Royalty Swap

A Uniswap V4 Hook with an Axiom ZK integration to enable VIP swap fees for high volume swappers

Royalty Swap

Created At

ETHGlobal London

Project Description

We developed an innovative hook for Uniswap v4 that integrates Axiom's zero-knowledge (zk) co-processing technology, enabling the creation of dynamic fee tiers for users engaged in token swaps. This mechanism rewards users with reduced trading fees based on their monthly swap volume, fostering more active participation on the platform. Our system currently supports two distinct fee tiers, leveraging the Axiom zk co-processor to accurately calculate each user's ZK-verified fee rebate and rebate expiry (the date when the rebate is no longer in effect and a user could query again to re-assess VIP tier eligibility). Following this calculation, the co-processor communicates with our hook to set the user's fee tier accordingly, and include an expiration date for their fee rebate to incentivize continuous volume trading to keep their VIP fee tier over many months.

How it's Made

We started from the Uniswap V4 template for building hooks, as our basis for our RoyaltyHook contract. We also integrated AxiomV2Client into the same contract, in order to enable the contract to be called back by the Axiom V2 query contract to pass ZK-verified outputs back to the hook to set a user's fee rebate and rebate expiry. We wrote the ZK circuit using Axiom's ZK circuit development SDK (in axiom/volume.circuit.ts). And we leveraged NextJS and Axiom's JS library to integrate the compiled circuit into the UI. One of the challenges we faced in our project was the fact that Uniswap V4 contracts are not in a state to be deployed to a testnet other than Anvil, due to contract size limitations. Another was the fact that Axiom is only deployed to Sepolia and Ethereum mainnet, which made it difficult to bring pieces together.

background image mobile

Join the mailing list

Get the latest news and updates