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 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.
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:
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.
Technical flow:
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.