{"id":21429751,"url":"https://github.com/limechain/hashport-contracts","last_synced_at":"2025-07-01T23:06:22.207Z","repository":{"id":41667861,"uuid":"318114559","full_name":"LimeChain/hashport-contracts","owner":"LimeChain","description":"The EVM Smart Contracts of Hashport","archived":false,"fork":false,"pushed_at":"2024-08-12T11:59:36.000Z","size":1158,"stargazers_count":6,"open_issues_count":2,"forks_count":6,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-08T07:13:13.698Z","etag":null,"topics":["bridge","ethereum","smart-contracts","solidity"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LimeChain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-03T07:44:04.000Z","updated_at":"2024-04-05T05:49:58.000Z","dependencies_parsed_at":"2023-01-23T17:46:01.498Z","dependency_job_id":"0faa53d6-52eb-4009-aaf9-3d000be6c355","html_url":"https://github.com/LimeChain/hashport-contracts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LimeChain/hashport-contracts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fhashport-contracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fhashport-contracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fhashport-contracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fhashport-contracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LimeChain","download_url":"https://codeload.github.com/LimeChain/hashport-contracts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LimeChain%2Fhashport-contracts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263047677,"owners_count":23405280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bridge","ethereum","smart-contracts","solidity"],"created_at":"2024-11-22T22:19:03.234Z","updated_at":"2025-07-01T23:06:22.135Z","avatar_url":"https://github.com/LimeChain.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Hashport Contracts\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Compile](https://github.com/LimeChain/hedera-eth-bridge-contracts/actions/workflows/compile.yml/badge.svg?branch=main)](https://github.com/LimeChain/hedera-eth-bridge-contracts/actions/workflows/compile.yml)\n[![Test](https://github.com/LimeChain/hedera-eth-bridge-contracts/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/LimeChain/hedera-eth-bridge-contracts/actions/workflows/test.yml)\n\n\u003c/div\u003e\n\nThis repository contains the smart contracts for the [Hedera \u003c-\u003e EVM Bridge](https://github.com/LimeChain/hedera-evm-bridge-validator).\n\n- [Overview](#overview)\n- [Contract Addresses \u0026 ABI](#contract-addresses--abi)\n- [Development](#development)\n    - [Prerequisites](#prerequisites)\n    - [Compilation](#compilation)\n    - [Scripts](#scripts)\n        - [Router deployment](#router-deployment)\n        - [Wrapped token Deployment](#wrapped-token-deployment-through-router)\n    - [Tests](#tests)\n        - [Unit Tests](#unit-tests)\n        - [Coverage](#coverage)\n- [Gas Usages](#gas-usages)\n\n## Overview\nCore functionality of [Hedera \u003c-\u003e EVM Bridge](https://github.com/LimeChain/hedera-evm-bridge-validator).\n\nIn essence, the business logic behind the smart contracts is to allow the possibility to transfer a token from one network to another.\nOf course, you cannot directly transfer the token to the network, so in order this to be possible it has to have a representation of that token, a so-called `wrapped` version of the original `native` token.\nIn our terms, a `wrapped` token on a given network is a representation of a `native` token on another network. A `native` token can have `wrapped` representations on more than one `EVM` network.\n\nUsers operate with the following functionality:\n* `lock` - lock a specific amount of native tokens, specifying the receiver and target network.\n* `unlock` - unlock a previously locked amount of native tokens by providing an array of signatures. Signatures are verified that they are signed by the `members`.\n* `mint` - mint a specific amount of wrapped tokens by providing an array of signatures, verified that they are signed by the `members`.\n* `burn` - burn a specific amount of wrapped tokens.\n\n\nEVM `native` tokens have to be explicitly added as supported native tokens in the smart contracts. \nEach `native` token has a service fee percentage, which will be left for the smart contract `members` upon locking/unlocking `native` tokens.\n`Members` are entities, which will serve as governance whenever a user wants to get `wrapped` tokens from `native tokens` and vice versa.\nFees for `native` tokens accumulate equally between members.\n`Members` need to explicitly claim (transfer) their accumulated fees for a given `native` token. \n\nYou can read more [here](https://github.com/LimeChain/hedera-evm-bridge-validator/blob/main/docs/overview.md).\n\nSmart Contracts use [EIP-2535](https://eips.ethereum.org/EIPS/eip-2535).\n\n## Contract Addresses \u0026 ABI\n\n### [Mainnet deployed contract addresses](Deployment.md)\n\n### ABIs\n\nFacet ABIs are available under `./abi` directory.\n\n\n## Development\n### Prerequisites\n[node.js](https://nodejs.org/en/) \u003e= v14.17.0\n\n[hardhat](https://hardhat.org/) - framework used for the development and testing of the contracts\n\nAfter cloning, run:\n```\ncd hedera-eth-bridge-contracts\nnpm install\n```\n\n### Compilation\nBefore you deploy the contracts, you will need to compile them using:\n\n```\nnpx hardhat compile\n```\n\n### Scripts\nBefore running any `npx hardhat` scripts, you need to set the following environment variables \nin [hardhat config](./hardhat.config.js) or export them:\n\n```\nexport ALCHEMY_PROJECT_ID=\u003cPROJECT ID of ALCHEMY\u003e\nexport DEPLOYER_PRIVATE_KEY=\u003cprivate key to use for deployments for the specified network\u003e\n```\n\n#### Router deployment\n* Deploys all the facets\n* Deploys the Router Diamond with all the facets as diamond cuts\n* Initializes `GovernanceFacet` with the provided list of members, governance percentage, and governance precision\n* Initializes `RouterFacet`\n* Initializes `FeeCalculatorFacet` with the provided fee precision. \n* As a second step - the script will update the router as follows:\n    * Add `PaymentFacet`\n    * Add `ERC721PortalFacet`\n    * Replace `GovernanceFacet` with `GovernanceV2Facet`\n\n```bash\nnpx hardhat deploy-router \\\n    --network \u003cnetwork name\u003e \\\n    --owner \u003cowner address\u003e \\\n    --governance-percentage \u003cgovernance percentage\u003e \\\n    --governance-precision \u003cgovernance precision\u003e \\\n    --fee-calculator-precision \u003cfee calculator precision\u003e \\\n    --members \u003clist of members, split by `,`\u003e \\\n    --members-admins \u003clist of members admins, split by `,`\u003e\n```\n\n#### Wrapped ERC-20 token deployment through Router\nDeploys a wrapped token through Router for a corresponding token on another chain: \n```bash\nnpx hardhat deploy-router-wrapped-token \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the router diamond contract\u003e \\\n    --source \u003cid of the source chain, to which the native token is deployed\u003e \\\n    --native \u003cthe unique identifier of the native token\u003e \\\n    --name \u003cname of the wrapped token\u003e \\\n    --symbol \u003csymbol of the wrapped token\u003e \\\n    --decimals \u003cdecimals of the wrapped token\u003e\n```\n\n#### Wrapped ERC-20 token deployment\nDeploys an instance of a [Wrapped Token](./contracts/WrappedToken.sol) contract, used for testing purposes.\n```bash\nnpx hardhat deploy-wrapped-token \\\n    --network \u003cnetwork name\u003e \\\n    --name \u003cname of the token\u003e \\\n    --symbol \u003csymbol of the token\u003e \\\n    --decimals \u003cdecimals of the token\u003e\n```\n\n#### Wrapped ERC-721 token deployment and Transfer Ownership to Diamond Router\nDeploys a wrapped ERC-721 and transfers ownership to Diamond Router\n```bash\nnpx hardhat deploy-wrapped-erc721-transfer-ownership \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the router diamond contract\u003e \\\n    --name \u003cname of the ERC-721\u003e \\\n    --symbol \u003csymbol of the ERC-721\u003e\n```\n\n#### Wrapped ERC-721Pausable token deployment and Transfer Ownership to Diamond Router\nDeploys a wrapped ERC-721Pausable and transfers ownership to Diamond Router\n```bash\nnpx hardhat deploy-wrapped-erc721-pausable-transfer-ownership \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the router diamond contract\u003e \\\n    --name \u003cname of the ERC-721\u003e \\\n    --symbol \u003csymbol of the ERC-721\u003e\n```\n\n#### Token deployment\nDeploys an instance of a [Token](./contracts/mocks/Token.sol) contract, used for testing purposes.\n```bash\nnpx hardhat deploy-token \\\n    --network \u003cnetwork name\u003e \\\n    --name \u003cname of the token\u003e \\\n    --symbol \u003csymbol of the token\u003e \\\n    --decimals \u003cdecimals of the token\u003e\n```\n\n#### Update Native Token to Router\nUpdates a native token to the Router contract:\n```bash\nnpx hardhat update-native-token \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the router diamond contract\u003e \\\n    --native-token \u003caddress of the native token\u003e \\\n    --fee-percentage \u003cfee percetange for the given token\u003e \\\n    --status \u003ctrue|false (default true)\u003e\n```\n\n#### Upgrade diamond to support ERC-721\nUpgrades the diamond to support ERC-721:\n```bash\nnpx hardhat upgrade-erc721-support \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the Router Diamond contract\u003e\n```\n\n#### Set Payment Token\nRequires Router Diamond Contract to be upgraded with PaymentFacet support\n\n```bash\nnpx hardhat set-payment-token \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the Router Diamond contract\u003e \\\n    --payment-token \u003caddress of ERC-20 payment token contract\u003e \\\n    --status \u003ctrue|false (default true)\u003e\n```\n\n#### Set ERC-721 Payment\nRequires Router Diamond Contract to be upgraded with ERC721PortalFacet \u0026 PaymentFacet support\n```bash\nnpx hardhat set-erc721-payment \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the Router Diamond contract\u003e \\\n    --erc721 \u003caddress of the ERC-721 contract\u003e \\\n    --payment-token \u003caddress of the ERC-20 payment token contract\u003e \\\n    --fee \u003crequired Payment Token fee upon burnERC721 wrapped transfers\u003e\n```\n\n#### Mint Wrapped ERC-721\nRequires Router Diamond Contract to support ERC721PortalFacet\nMints Wrapped ERC-721 tokenID to the corresponding network\n```bash\nnpx hardhat mint-erc721 \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the Router Diamond contract\u003e \\\n    --source-chain-id \u003cThe chain id of the source chain\u003e \\\n    --target-chain-id \u003cThe chain id of the target chain\u003e \\\n    --transaction-id \u003cThe target transaction id\u003e \\\n    --wrapped-asset \u003cThe address of the wrapped ERC-721 token\u003e \\\n    --token-id \u003cThe target token ID to be minted\u003e \\\n    --metadata \u003cThe token ID metadata\u003e \\\n    --receiver \u003cThe address of the receiver\u003e \\\n    --signatures \u003cAn array of signatures, split by `,`\u003e\n```\n\n#### Burn Wrapped ERC-721\nBurns Wrapped ERC-721 tokenId to the corresponding network\n```bash\nnpx hardhat burn-erc721 \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the Router Diamond contract\u003e \\\n    --target-chain-id \u003cThe chain id of the target chain\u003e \\\n    --wrapped-asset \u003cThe address of the wrapped ERC-721 token\u003e \\\n    --token-id \u003cThe token id to be burned\u003e \\\n    --receiver \u003cThe address/AccountID of the receiver\u003e\n```\n\n#### Mint Wrapped ERC-20\nMints Wrapped ERC-20 amount to the corresponding network\n```bash\nnpx hardhat mint-erc20 \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the Router Diamond contract\u003e \\\n    --source-chain-id \u003cThe chain id of the source chain\u003e \\\n    --target-chain-id \u003cThe chain id of the target chain\u003e \\\n    --transaction-id \u003cThe target transaction id\u003e \\\n    --wrapped-asset \u003cThe address of the wrapped ERC-20 token\u003e \\\n    --receiver \u003cThe address of the receiver\u003e \\\n    --amount \u003cThe amount to be minted\u003e \\\n    --signatures \u003cAn array of signatures, split by `,`\u003e\n```\n\n#### Burn Wrapped ERC-20\nApproves \u0026 Burns Wrapped ERC-20 amount to the corresponding network\n```bash\nnpx hardhat burn-erc20 \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the Router Diamond contract\u003e \\\n    --target-chain-id \u003cThe chain id of the target chain\u003e \\\n    --wrapped-asset \u003cThe address of the wrapped ERC-20 token\u003e \\\n    --amount \u003cThe target amount\u003e \\\n    --receiver \u003cThe address/AccountID of the receiver on the target network\u003e\n```\n\n#### Lock Native ERC-20\nLocks Native ERC-20 amount to the corresponding network\n```bash\nnpx hardhat lock-erc20 \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the Router Diamond contract\u003e \\\n    --target-chain-id \u003cThe chain id of the target chain\u003e \\\n    --native-asset \u003cThe address of the native ERC-20 token\u003e \\\n    --amount \u003cThe amount to be locked\u003e \\\n    --receiver \u003cThe address/AccountID of the receiver\u003e\n```\n\n#### Unlock Native ERC-20\nUnlocks Native ERC-20 amount to the corresponding network\n```bash\nnpx hardhat unlock-erc20 \\\n    --network \u003cnetwork name\u003e \\\n    --router \u003caddress of the Router Diamond contract\u003e \\\n    --source-chain-id \u003cThe chain id of the source chain\u003e \\\n    --target-chain-id \u003cThe chain id of the target chain\u003e \\\n    --transaction-id \u003cThe target transaction id\u003e \\\n    --native-asset \u003cThe address of the native ERC-20 token\u003e \\\n    --receiver \u003cThe address of the receiver\u003e \\\n    --amount \u003cThe amount to be minted\u003e \\\n    --signatures \u003cAn array of signatures, split by `,`\u003e\n```\n\n#### Transfer Ownership of a Contract\nTransfers Ownership of a Contract to specified new owner.\n```bash\nnpx hardhat transfer-ownership \\\n    --network \u003cnetwork name\u003e \\\n    --contract \u003caddress of the contract\u003e \\\n    --new-owner \u003caddress of the new owner\u003e\n```\n\n### Tests\n#### Unit Tests\n```bash\nnpx hardhat test\n```\n\n#### Coverage\n```bash\nnpx hardhat coverage\n```\n\n## Gas Usages\n\n* `lockWithPermit` \n    * Whole balance ~ 70 000 gas\n    * ~ 82 000 gas\n\n* `unlock`\n    * 3 signatures ~ 118 132 gas\n    * ~ 8500 gas per signature\n  \n* `mint`\n    * 3 signatures ~ 140 223 gas\n    * ~ 8500 gas per signature\n\n* `burnWithPermit`\n    * Whole balance ~ 45 127 gas\n    * ~70 322 gas\n\n* `updateMember`\n    * Addition\n        * 3 tokens ~ 180 000 gas (if fees for tokens have been accrued at least once)\n        * ~ 35 000 gas per Token \n    * Removal\n        * 3 tokens ~ 140 000 gas\n        * ~ 37 000 gas per Token\n\n`NB!` Running Unit Tests includes a gas reporter, providing metrics for method calls and deployments.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimechain%2Fhashport-contracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimechain%2Fhashport-contracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimechain%2Fhashport-contracts/lists"}