Skip to content

payxn-io/payxn-bridgepay

Repository files navigation

Bridgepay

Enables payment of USDC on one chain to another. 

Bridgepay-demo

To do list

  • Create a fresh new dapp using Scaffold ETH 2 as a base
  • Update package and use viem to deploy scripts
  • Create contracts directory and build BridgeableToken.sol
  • Add .env, hardhatconfig.ts, tsconfig.json
  • Create scripts directory
  • Create DeployBridgeableToken.ts, MintTokens.ts, BridgeTokens.ts scripts, etc
  • Deploy token to Sepolia testnets
  • Mint tokens on Sepolia testnets
  • Check token status
  • Watch for bridges on Sepolia testnets
  • Bridge tokens from Sepolia
  • Add frontend to show tokens in Sepolia
  • Add frontend to bridge tokens from Sepolia
  • Deploy

Getting started

  • Compile the contract first
cd payxn-bridgepay
npx hardhat compile

𝘵𝘩𝘪𝘴 𝘸𝘪𝘭𝘭 𝘨𝘦𝘯𝘦𝘳𝘢𝘵𝘦 𝘵𝘩𝘦 𝘢𝘳𝘵𝘪𝘧𝘢𝘤𝘵𝘴 𝘧𝘰𝘭𝘥𝘦𝘳 𝘵𝘩𝘢𝘵 𝘺𝘰𝘶 𝘤𝘢𝘯 𝘤𝘢𝘭𝘭 𝘪𝘯 𝘺𝘰𝘶𝘳 𝘴𝘤𝘳𝘪𝘱𝘵𝘴 𝘪𝘦: import { abi } from "../../artifacts/contracts/BridgeableToken.sol/BridgeableToken.json";

  • Modify hardhat.config.ts and add etherscan api and sourcify
  • Add arguments.js to verify contract
npx hardhat verify --constructor-args arguments.js --network sepolia TOKEN_ADDRESS
npx hardhat verify --constructor-args arguments.js --network sepolia 0xa18f2e81f10a1a89151e99433434dd5a0a09f759
  • Run watch for bridges scripts
npx ts-node --files ./scripts/WatchForBridges.ts SOURCE_NETWORK SOURCE_TOKEN_ADDRESS DESTINATION_NETWORK DESTINATION_TOKEN_ADDRESS

npx ts-node --files ./scripts/WatchForBridges.ts sepolia 0xa18f2e81f10a1a89151e99433434dd5a0a09f759 base 0xdda5a1fcd29b7a765a3d8d4fc8cf4ee4fb0ec5be

npx ts-node --files ./scripts/WatchForBridges.ts base 0xdda5a1fcd29b7a765a3d8d4fc8cf4ee4fb0ec5be sepolia 0xa18f2e81f10a1a89151e99433434dd5a0a09f759 
  • Deploy scaffold on localhost:3000
cd payxn-bridgepay
yarn install
yarn start

Deployed contracts

Screenshot 2024-11-02 at 10 20 09 PM Screenshot 2024-11-03 at 2 21 40 AM

Listening for Bridges

Screenshot 2024-11-03 at 3 13 24 AM Screenshot 2024-11-03 at 3 12 23 AM

Executing BridgeTokens

Screenshot 2024-11-03 at 3 45 38 AM

BridgePay Diagram

370933310-688283fc-356f-40ed-b019-2901be061740

Requirements

Before you begin, you need to install the following tools:

Quickstart

To get started with Scaffold-ETH 2, follow the steps below:

  1. Clone this repo & install dependencies
git clone https://github.com/scaffold-eth/scaffold-eth-2.git
cd scaffold-eth-2
yarn install
  1. Run a local network in the first terminal:
yarn chain

This command starts a local Ethereum network using Hardhat. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in hardhat.config.ts.

  1. On a second terminal, deploy the test contract:
yarn deploy

This command deploys a test smart contract to the local network. The contract is located in packages/hardhat/contracts and can be modified to suit your needs. The yarn deploy command uses the deploy script located in packages/hardhat/deploy to deploy the contract to the network. You can also customize the deploy script.

  1. On a third terminal, start your NextJS app:
yarn start

Visit your app on: http://localhost:3000. You can interact with your smart contract using the Debug Contracts page. You can tweak the app config in packages/nextjs/scaffold.config.ts.

What's next:

  • Edit your smart contract YourContract.sol in packages/hardhat/contracts
  • Edit your frontend homepage at packages/nextjs/app/page.tsx. For guidance on routing and configuring pages/layouts checkout the Next.js documentation.
  • Edit your deployment scripts in packages/hardhat/deploy
  • Edit your smart contract test in: packages/hardhat/test. To run test use yarn hardhat:test
  • You can add your Alchemy API Key in scaffold.config.ts if you want more reliability in your RPC requests.

Documentation

Visit our docs to learn how to start building with Scaffold-ETH 2.

To know more about its features, check out our website.

Contributing to Scaffold-ETH 2

We welcome contributions to Scaffold-ETH 2!

Please see CONTRIBUTING.MD for more information and guidelines for contributing to Scaffold-ETH 2.