Skip to content

ValentineCodes/thebridge

Repository files navigation

theBridge

The Bridge

theBridge serves as a bridge between layer-1 and layer-2 native tokens.

Video Demo

How It Works

To deposit, token is transferred to the vault contract, a 1% fee is extracted and an event is emitted with the deposit params. The token is then minted on the other chain as an ERC20 token To withdraw, token is burned and an event is emitted with the params. The token is then transferred from the vault to the owner's account on the other chain

Local Development

Install dependencies

  yarn

Deploy contracts

Deploy sepolia vault

  yarn deploy --tags NativeTokenBridge --network sepolia

Deploy polygonMumbai vault

  yarn deploy --tags NativeTokenBridge --network polygonMumbai

Deploy sepoliaETH Clone. First change the name and symbol in packages/hardhat/deploy/01_deploy_nativetokenclone.ts

  yarn deploy --tags NativeTokenClone --network polygonMumbai

Deploy MATIC Clone. First change the name and symbol in packages/hardhat/deploy/01_deploy_nativetokenclone.ts

  yarn deploy --tags NativeTokenClone --network sepolia

Update frontend

Replace addresses in packages/nextjs/components/forms/BridgeForm.tsx and packages/nextjs/components/forms/WithdrawForm.tsx with the deployed contract addresses for the vaults and clones

Update backend

Replace the addresses in packages/backend/contracts with the deployed contract addresses for the vaults and clones. Create a .env file with params from the .env.example file

Run backend

  yarn backend:start

Run frontend:

yarn start

Acknowledgements

About

Bridge tokens between layer-1 and layer-2 networks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published