This repository is created to enter the PIT phase 1 challenge # 22.
- @tmsdkeys - Lead Developer
- @dshiell - Developer
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.
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
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
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
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.
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:
- 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.
How to make the first dApp using Polymer.
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