Skip to content

tmsdkeys/pit-submission

Repository files navigation

PIT Phase 1 repo project: Cross-chain Proof of NFT

This repository is created to enter the PIT phase 1 challenge # 22.

Team Members

  • @tmsdkeys - Lead Developer
  • @dshiell - Developer

Description

This application enables a user to submit a vote a ballot on a contract on OP Sepolia. The information about this vote subsequently gets sent to an ERC721 NFT contract on Base Sepolia to mint an NFT related to the vote.

Features:

  • Uses Polymer x IBC as the cross-chain format
  • Commits to the spirit of application specific chains/rollups where voting functionality could be specialized on one chain, NFT marketplace 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 XBallot and XProofOfVoteNFT that implement the custom logic.

It changes the send-packet.js script slightly to adjust to the custom logic.

The expected behaviour from the template should still work but nevertheless we quickly review the steps for the user to test the application... Run just --list for a full overview of the just commands.

Additional resources used:

  • Hardhat
  • Blockscout
  • Tenderly

Steps to reproduce

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 XBallot && \
just set-contracts base XProofOfVoteNFT

Note: The order matters here! Make sure to have the exact configuration

Check if the contracts compile:

just compile

Deployment and creating channels (optional)

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 using the default, you can skip to the step to send packets.

If you want to deploy your own, run:

just deploy optimism base false

and create a channel:

just create-channel

Sending a packet

Now with an existing channel in the config (your own or the default), 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.

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:

  • XBallot (OP Sepolia) : 0xB604C9F99Dc3Ebff9E12b71690141c7939fA0266

  • XProofOfVoteNFT (Base Sepolia): 0x33e23218a21bF730CFb07822CDCDfb2B11e962A5

  • Channel (OP Sepolia): channel-20

  • Channel (Base Sepolia): channel-21

  • Proof of Testnet interaction:

Challenges Faced

  • Debugging used to be tricky when the sendPacket on the contract was successfully submitted but there was an error further down the packet lifecycle. What helped was to verify the contracts and use Tenderly for step-by-step debugging to see what the relayers submitted to the dispatcher etc.

What we learned

How to make the first dApp using Polymer.

Future improvements

Basic functionality was implemented, but the following things can be improved:

  • More tests
  • More input validation
  • Add event listeners related to important IBC lifecycle steps

Licence

Apache 2.0

About

Submission example for PIT phase 1

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published