Skip to content

Repository files navigation

Quest-Into-The-Polyverse-Phase-1 : Cross-chain Raffle Proof System

Team Members

@sturec5 - Lead Developer

@yavuzkocca - Developer

Description

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.

Resources used

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

Steps

After cloning the repo, install dependencies:

just install

And 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 RaffleNFT

Compile Contracts:

just compile

Deployment and Creating channels

Then 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 false

then 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-channel

This updates frontend contract

node update_frontend.js
cd frontend
yarn
yarn dev

Open browser and enter http://localhost:3000/

Enter Raffle then End Raffle with the wallet which the contracts deployed.

Then send packet.

Sending a packet

Now with an existing channel in the config run:

just send-packet optimism false

You'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.

Proof of Testnet Interaction

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:

Contract Creation

Create Channel

Enter Raffle

Send Packet

RecvTx

Ack

Challenges Faced

Debugging was a bit tricky when the sendPacket part worked fine on the contract, but there was a problem later with the packet.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages