Comparing to the low yield and possible upcoming inflation, DeFi has become increasingly attractive as an alternative to traditional finance. Compliance is a key component to make that possible. As one of the most important innovation in DeFi, Uniswap has democratize the access for allowing anyone to become a liquidity provider with its AMM. We have created "HeroSwap" as a showcase how compliance could be implemented with Uniswap. We forked Uniswap V2 and added a middleware to provide whitelisting capability for this hackathon. The whitelisting feature is implemented using Molecule Protocol--another EthGlobal Hackathon submitted in 2020 ( uses NFT tokens as proof of KYC (Know-Your-Custom, a.k.a. identity verification) and other legal requirements issued as a NFT token by trusted service providers. This part is completed and shown in the video demo. Molecule proxy smart contracts are used to allow only approved senders and recipients to participate in swaps or become liquidity providers. We also need to restrict transfers of LP tokens to non-compliant recipients, and this can be done by deferring the transfer to Claimable and only allow approved recipients to receive LP tokens or yields. The Claimable project ( was designed originally for handling token vesting, but it can be modified to handle deferred token transfer. This part has not been completed within the hackathon.

HeroSwap: Compliant Uniswap with Molecule showcase

How it's made

We forked Uniswap V2 and modified the smart contract to check both sender and recipient to make sure they are whitelisted. Both sender and recipient are checked using the whitelisting middleware for swaps, and liquidity transactions. It is implemented with NodeJS backend, ReactJS frontend, with Solidity and it is deployed to Skynet. We have enabled a customisation to the uniswap-v2-router smart contract with integrating it with the molecule proxy smart contract. The molecule proxy smart contract checks the existence of NFT minted to the whitelist addresses from the Molecule NFT smart contract.