project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5

Apeful

Creating user incentives on Uniswap V4 pools by automatically generating AI-based NFTs when the user does specific action with ApeCoins, everything completely onchain.

Apeful

Created At

ETHGlobal London

Winner of

Uniswap Foundation - Hooks & External Integrations

Hyperlane - Most Creative use of Hyperlane

Galadriel - Most unique on-chain AI application built on Galadriel 3rd place

Project Description

Apeful gives Token Communities like ApeCoin the possibility to create complete new token incentive mechanics, to drive their trading volume and have fun with the owners. With a combination of different technologies, we are able to let different chains work together, to create AI-generated NFTs completely automatic and onchain.

How it works

An user wants to buy ApeCoin on Uniswap V4. To do this, he is able to use our v4 pool. When he is executing the swap, our v4 hook evaluations different details of the swap. With a predefined ruleset, the hook decides if the user is getting a special rewards NFT distributed to his wallet.

When this happens, the whole onchain-toolchain works completely autonomous and automatically. Through Hyperlane, the hook is sending a message to the Galadriel AI-Blockchain to use their build-in image generation to generate the next NFT. When the new NFT is minted, and automated hook on this side sends the NFT instantly back to the origin chain.

For the Hackathon, I added the following rules:

  • user buys exactly 1 ApeCoin -> generate an image with a poor ape king
  • user buys exactly 1337 ApeCoin -> generate an image with a cyberpunk ape king
  • user buys more than 500 ApeCoin -> generate an image with a ape king in a wooden house
  • user buys more than 5.000 ApeCoin -> generate an image with a ape king in a silver house
  • user buys more than 50.000 ApeCoin -> generate an image with a ape king in a golden house

Of course, this is only a tiny set of possibilites you could add as rules to hand out new NFTs. Aggregated trading volume, amount of swap of a given size or targeting swaps of more community-related amounts is just one possibility.

In further iterations it is also possible to add completely new features, the communities could use to target more specific user. I.e. Holders of Bored Apes get a special golden NFT, when they do a swap worth >100k ApeCoin. The possibilities are endless, we can facilitate the whole blockchain world for cool and funny incentive programs.

How it's Made

Technical flow:

  • The user buys ApeCoin on Uniswap V4
  • The Hook is fetching the user and some additional swap specific data
  • The hook dispatches a message through the hyperlane mailbox, to the galadriel chain
  • On the galadriel chain, a special NFT contract is receiving the message
  • The NFT Contract is calling the oracle to generate an image with a given prompt
  • When the image is generated, the oracle is calling a callback in the NFT
  • The callback initializes the transfer of the NFT from the Galadriel chain back to the original chain

Hyperlane was not available on the galadriel chain. Now it is.

The most hacky part is the question of the ownership/allowance of the created NFT. To make everything as automatic as possible, the owner of the newly generated NFT is the NFT contract itself. To let the hyperlane contract send the NFT to the target chain, I needed to let the contract instatiate himself, to be able to set the correct allowance for the contracts.

Deployments:

Sepolia Uniswap V4 Hook: https://sepolia.etherscan.io/address/0x1643ebA8D98Ca7408a755795E9bba09649762133 Sepolia Hyperlane Mailbox: https://sepolia.etherscan.io/address/0xfFAEF09B3cd11D9b20d1a19bECca54EEC2884766

Galadriel Hyperlane token router: https://explorer.galadriel.com/contract/0x7a94a4a7e618c8389a159401B514737aa2DdED2A Galadriel Apeful NFT: https://explorer.galadriel.com/contract/0x5002670D02ed7740F9a307124fc5c39191cFe7c7

the script at erc721/scripts/testrun.ts is starting the whole chain of transactions and is standing by, fetch the actual state of processing.

background image mobile

Join the mailing list

Get the latest news and updates