@sturec5 - Lead Developer
@yavuzkocca - Developer
This application enables a user to enter a Raffle on a contract on OP Sepolia. After the raffle is completed, the winner gets a ERC-721 NFT for free on Base Sepolia even though the users entered via OP Sepolia.
Features:
Uses Polymer x IBC as the cross-chain format
Commits to the spirit of application specific chains/rollups where entering the raffle function can be specialized on one chain, NFT distribution to the winner of the raffle on another and both can form composable applications through interoperability.
The repo uses the ibc-app-solidity-template as starting point and adds custom contracts Raffle and RaffleNFT that implement the custom logic.
It changes the send-packet.js script slightly to adjust to the custom logic.
Additional resources used:
Hardhat
Blockscout
After cloning the repo, install dependencies:
just installAnd add your private key to the .env file (rename it from .env.example).
Then make sure that the config has the right contracts:
just set-contracts optimism Raffle && \
just set-contracts base RaffleNFTCompile Contracts:
just compileThen you can deploy the contract if you want to have a custom version, but you can use the provided contract addresses that are prefilled in the config. If you want to deploy your own, run:
just deploy optimism base falsethen verify contracts:
npx hardhat --network optimism verify <ContractAddress> "0x58f1863f75c9db1c7266dc3d7b43832b58f35e83"npx hardhat --network base verify <ContractAddress> "0xfc1d3e02e00e0077628e8cc9edb6812f95db05dc" "https://i.ibb.co/3y0SGCH/winner-nft.webp"and create a channel:
just create-channelThis updates frontend contract
node update_frontend.jscd frontendyarnyarn devOpen browser and enter http://localhost:3000/
Enter Raffle then End Raffle with the wallet which the contracts deployed.
Then send packet.
Now with an existing channel in the config run:
just send-packet optimism falseYou'll see an active waiting poll in the terminal and will be informed if the packet was sent successfully.
You can check the Nft from Base Sepolia Explorer.
After following the steps above you should have interacted with the testnet. You can check this at the IBC Explorer.
Here's the data of our application:
Raffle (OP Sepolia) : 0xA6269f45B3223277046e11f728AAF7354b3a6c93
RaffleNFT (Base Sepolia): 0x3240b3b4dC1E0a542505D688A4A834c40B14C4bc
Channel (OP Sepolia): channel-2126
Channel (Base Sepolia): channel-2127
Proof of Testnet interaction:
Debugging was a bit tricky when the sendPacket part worked fine on the contract, but there was a problem later with the packet.