LogoLogo
  • Entangle
    • Overview
    • Security Audits
  • Universal Interoperability Protocol
    • Overview
    • Architecture
      • Scalability and Network Stability
        • L2 Utility Blockchains
        • Transmitter Groups
      • Security and Consensus Mechanism
      • Finality
      • Execution Latency
      • Compatibility and Interoperability
    • Developer Guides
      • Getting Started
      • Solidity
        • Simple Abstract Messenger Example
        • Deploying Your Custom EVM Protocol
        • Bridging Tokens with UIP
        • Become an EVM Transmitter
      • Solana
        • Simple Abstract Messenger Example
        • Deploying Your Custom Solana Protocol
        • Become a Solana Transmitter
      • Calculate Cross-Chain Transaction Cost
      • Customizable Message Transmission Options
      • How to Debug Sent Messages
      • SDK Setup
      • Revenue Sharing for Transmitters
      • How to Become a Super Transmitter
    • Endpoints
  • Universal Data Feeds
    • Overview
    • Architecture
      • Data Delivery Methods
        • Pull Model
        • Push Model
      • Oracle Contract & User Interaction
    • Developer Guides
      • Custom Data Feeds
      • Fetch Data via Pull Model (PAYG)
        • EVM Smart Contracts
        • Solana Smart Contracts
      • Fetch Data via Pull Model (Subscriptions)
        • EVM Smart Contracts
        • Solana Smart Contracts
      • Fetch Data via Push Model
        • EVM Smart Contracts
        • Solana Smart Contracts
    • User Guides
      • Accessing Feeds
      • Subscribe to a Data Feed
      • Check Subscription
      • Manage Subscription
      • Renew Subscription
    • Data Endpoints
  • Universal Token Standard
    • Overview
    • Architecture
      • Fee Components
    • Developer Guides
      • Manual Deploy
        • Token Deployment Types
        • Create a Custom Token
        • Factory Blueprint Deployment
        • Examples
          • Initial Setup
          • UTS Connector
            • Mint & Burn Connector Scheme
            • Lock & Unlock Connector Scheme
            • Connector Over Native Currency
          • UTS Token
            • Simple Token
            • Token with Messages
      • Bridge SDK
      • Token Verification
      • Fees Calculation & Gas Estimation Logic
      • Estimations
    • User Guides
      • Launch Universal Token
      • Create a Liquidity Pool
      • Expand Existing Token
      • Transfer Liquidity to Connector
      • Bridging
    • Contract Addresses
  • Entangle Interoperable Blockchain
    • Overview
    • Architecture
    • Developer Guides
      • Set up a Validator Node
      • Delegating to Validators
      • Undelegating from Validators
      • Supported Accounts
  • More
    • Media Kit
    • FAQ
    • Report an Issue
    • Become a Partner
Powered by GitBook
On this page
  • Prerequisites
  • Environment Setup
  • Deploying Contracts
  • Setting Origins
  • Sending Tokens via Bridge
  • Verifying Transactions
  • Summary

Was this helpful?

Export as PDF
  1. Universal Interoperability Protocol
  2. Developer Guides
  3. Solidity

Bridging Tokens with UIP

This guide walks you through building a simple dApp that utilizes UIP to bridge tokens across different EVM-based blockchains. We will deploy an ExampleToken smart contract and use a Hardhat task to transfer tokens between chains.

Prerequisites

Before you begin, ensure you have the following:

  • Familiarity with Solidity and Hardhat.

  • Node.js and npm installed.

  • Native coins.

Environment Setup

First, clone the repository and install dependencies:

git clone https://github.com/Entangle-Protocol/UIP-examples.git
cd UIP-examples/Token/FT/EVM
npm install

Next, configure your environment by updating the `hardhat.config.ts` file with your mnemonic phrase and RPCs:

Note: In this guide, we deploy the ExampleToken on Ethereum Sepolia and Polygon Amoy for demonstration purposes only. You can choose any networks that best suit your requirements.

ethereum_sepolia: {
    url: "your_rpc",
    accounts: { mnemonic: "your mnemonic here", },
    chainId: 11155111
}
polygon_amoy: { 
    url: "your_rpc",
    accounts: { mnemonic: "your mnemonic here", },
    chainId: 80002
}

Deploying Contracts

Once your environment is set up, deploy the ExampleToken to Ethereum Sepolia and Polygon Amoy:

npx hardhat run scripts/deployExampleToken.ts --network ethereum_sepolia
npx hardhat run scripts/deployExampleToken.ts --network polygon_amoy

Setting Origins

Before sending tokens, you need to set the token contract from another chain as an origin.

Run the following Hardhat task to set an origin:

npx hardhat setOrigin --destnetwork <other_network_name_as_per_hardhat_config> --network <current_network>

You need to run this task for both networks.

Sending Tokens via Bridge

To transfer tokens from Ethereum Sepolia to Polygon Amoy, use the Hardhat task:

npx hardhat sendTokens --tochainid 80002 --to <receiver_address_on_Polygon_Amoy> --amount 100 --network ethereum_sepolia

This task:

  • Fetches the ExampleToken contract.

  • Sets the origin address if not already set.

  • Calls the `bridge` function to send tokens.

Keep in mind that token has 18 decimals.

Verifying Transactions

Check the logs to ensure the transaction is successful. You should see an output similar to:

100 tokens sent to chain 80002 to address 0xRecipient from chain 11155111 from address 0xSender

To verify the received tokens, check the destination chain’s block explorer.

Summary

This guide demonstrated how to deploy and interact with a cross-chain token bridging contract using UIP. With this setup, you can seamlessly transfer assets across different EVM-compatible blockchains.

PreviousDeploying Your Custom EVM ProtocolNextBecome an EVM Transmitter

Last updated 26 days ago

Was this helpful?