Polymer ERC20 token
- @Jayce - Developer
I attempted to create a cross-chain bridge between Optimism and Base using the official library, and then created the same ERC20 token on both chains, allowing users to perform cross-chain operations on each chain respectively.
Features:
- Uses Polymer x IBC as the cross-chain format
- Deploy an ERC20 token across multiple chains, where the total quantity issued on all chains combined equals the total quantity to be issued on the blockchain. The token can be sent from any one chain to another.
The repo uses the demo-dapps as starting point and adds custom contracts SrcChainTokenBridge and DstChainTokenBridge that implement the custom logic.
It added an erc20-demo and vue-demo projects as token and frontend projects, modifying files such as arguments.
Additional resources used:
- Hardhat
- Blockscout
- Vue.js
- bignumber.js
- web3.js
- @open-ibc/vibc-core-smart-contracts
- deploy ERC20 contract Go to erc20-demo, config your hardhat.config.js, add your private key, then install deps, compile source code, deploy bytecode
cd erc20-demo
npm install
npx hardhat compile
npx hardhat run scripts/deploy.js --network optimism
npx hardhat run scripts/deploy.js --network base
then you will get two erc20 token contract address (op: 0x6297f7bAACdf1746613D884466e7E644c884aaCD) (base: 0x7F9C7F1Dc2D0Ac49C9728Bc4A3Ba4654c2D76a5D)
-
deploy bridge contract And add your private key to the .env file (rename it from .env.example).
cd ..
just install
just compile
just deploy optimism base
- You will get 2 contract addresses as port address (op: 0x27f34EF4b824884F63f69b6E59948C1E599CdA5B) (base: 0x6297f7bAACdf1746613D884466e7E644c884aaCD)
- Set the port address as the administrator:
node scripts/auth.js op
node scripts/auth.js base
- run frontend page
cd vue-demo
npm install && npm run serve
See http://localhost:8080/ 6. Add erc20 token to op and base with metamask op: 0x6297f7bAACdf1746613D884466e7E644c884aaCD base: 0x7F9C7F1Dc2D0Ac49C9728Bc4A3Ba4654c2D76a5D
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:
-
SrcChainTokenBridge (OP Sepolia) : 0x27f34EF4b824884F63f69b6E59948C1E599CdA5B
-
DstChainTokenBridge (Base Sepolia): 0x6297f7bAACdf1746613D884466e7E644c884aaCD
-
Channel (OP Sepolia): channel-10
-
Channel (Base Sepolia): channel-11
-
Proof of Testnet interaction:
- I am not in the same time zone as the core developers; when encountering issues and seeking solutions in the community, timely responses are not received.
How to make the first dApp using Polymer.
- I will refactor the smart contract code
- remove unnecessary demo code
- integrate the bridge and ERC20 into one contract
- improve the UI.