hNFT BridgehFT BridgeToken BridgeRefuel

Domains

"optimism":10,
"celo":42220,
"avalanche":43114,
"polygon zkevm":1101,
"binance smart chain":56,
"moonbeam":1284,
"gnosis":100,
"arbitrum":42161,
"polygon":137,
"base":8453,
"linea":59144,
"viction":88,
"scroll":534352,
"ethereum":1,
"manta pacific":169,
"fraxtal":252,
"mode":34443,
"blast":81457,
"ancient8":888888888,
"zetachain":7000,
"redstone":690,
"sei":1329,

Addresses

"optimism":"0x2a5c54c625220cb2166C94DD9329be1F8785977D",
"celo":"0x7f4CFDf669d7a5d4Adb05917081634875E21Df47",
"avalanche":"0x7daC480d20f322D2ef108A59A465CCb5749371c4",
"polygon zkevm":"0x7daC480d20f322D2ef108A59A465CCb5749371c4",
"binance smart chain":"0xf3D41b377c93fA5C3b0071966f1811c5063fAD40",
"moonbeam":"0x7daC480d20f322D2ef108A59A465CCb5749371c4",
"gnosis":"0x7dac480d20f322d2ef108a59a465ccb5749371c4",
"arbitrum":"0x7daC480d20f322D2ef108A59A465CCb5749371c4",
"polygon":"0x7daC480d20f322D2ef108A59A465CCb5749371c4",
"base":"0x7dac480d20f322d2ef108a59a465ccb5749371c4",
"linea":"0xC6EDe374Df7763ad70166C4d85d8066A8fb8D272",
"viction":"0x80Abe17c3Ca312f63a96D31DdE1F829e90Ee05b7",
"scroll":"0x7daC480d20f322D2ef108A59A465CCb5749371c4",
"ethereum":"0x7daC480d20f322D2ef108A59A465CCb5749371c4",
"manta pacific":"0xc7a66e3A9d1a84dC60f8a630C3eC3D84aCFBE5EC",
"fraxtal":"0x49e6d51a220acab3b44d325edcab0f164cf48111",
"mode":"0x814490128eB60e6FCB56a38B46FC9FC37726414a",
"blast":"0xDc09f06D11dFC7703BF8f3049E2CcF4507bEA1ab",
"ancient8":"0x6E55472109E6aBE4054a8E8b8d9EdFfCb31032C5",
"zetachain":"0x6Ca118bdF9BD900Da5D3d85094D92C5B3b9c0DA5",
"redstone":"0x6f6aE8851a460406bBB3c929a415d2Df9305AcD5",
"sei":"0x4b56f191b7F396dec4268b836845C3F63F5e2121",

Human readable ABI

[
"function fee() external view returns (uint256 fee)",
"function mint(uint256 amount) external payable",
"function quoteBridge(uint32 _destination) external view returns (uint nativeFee)",
"function bridgeNFT(uint32 _destination, uint256 _Id) external payable virtual returns (bytes32 messageId)",
]

JSON ABI

[
  {
    "type": "function",
    "name": "fee",
    "constant": true,
    "stateMutability": "view",
    "payable": false,
    "inputs": [],
    "outputs": [
      {
        "type": "uint256",
        "name": "fee"
      }
    ]
  },
  {
    "type": "function",
    "name": "mint",
    "constant": false,
    "stateMutability": "payable",
    "payable": true,
    "inputs": [
      {
        "type": "uint256",
        "name": "amount"
      }
    ],
    "outputs": []
  },
  {
    "type": "function",
    "name": "quoteBridge",
    "constant": true,
    "stateMutability": "view",
    "payable": false,
    "inputs": [
      {
        "type": "uint32",
        "name": "_destination"
      }
    ],
    "outputs": [
      {
        "type": "uint256",
        "name": "nativeFee"
      }
    ]
  },
  {
    "type": "function",
    "name": "bridgeNFT",
    "constant": false,
    "stateMutability": "payable",
    "payable": true,
    "inputs": [
      {
        "type": "uint32",
        "name": "_destination"
      },
      {
        "type": "uint256",
        "name": "_Id"
      }
    ],
    "outputs": [
      {
        "type": "bytes32",
        "name": "messageId"
      }
    ]
  }
]

Minting Merkly Hyperlane NFT

const fee = await contract.fee();
const amount = 1;
const tx = await contract.mint(amount, { value: fee.mul(amount) });
const receipt = await tx.wait();

let mintIDHex;
if (network == "Polygon")
mintIDHex = receipt.logs[1].topics[3]
if (receipt.logs.length === 1)
mintIDHex = receipt.logs[0].topics[3]
else
mintIDHex = receipt.logs[2].topics[3]

const mintID = parseInt(mintIDHex, 16);

Quote & Bridge hNFT

const domain = 10; // Optimism 
const quote = await contract.quoteBridge(domain);
const tx = await contract.bridgeNFT(domain, mintID, { value: quote });

Addresses

"optimism":"0x32F05f390217990404392a4DdAF39D31Db4aFf77",
"celo":"0xad8676147360dBc010504aB69C7f1b1877109527",
"avalanche":"0x904550e0D182cd4aEe0D305891c666a212EC8F01",
"polygon zkevm":"0x46B4eDaA761eF8d2934e9F7AAf32B5Bf2C9C9F67",
"binance smart chain":"0x7b4f475d32f9c65de1834A578859F9823bE3c5Cf",
"moonbeam":"0xf3D41b377c93fA5C3b0071966f1811c5063fAD40",
"gnosis":"0xFD34afDFbaC1E47aFC539235420e4bE4A206f26D",
"arbitrum":"0xFD34afDFbaC1E47aFC539235420e4bE4A206f26D",
"polygon":"0x574E69C50e7D13B3d1B364BF0D48285A5aE2dF56",
"base":"0x5454cF5584939f7f884e95DBA33FECd6D40B8fE2",
"linea":"0xc92A74918Ebb35CA91d7029b7528e0b49fA60B47",
"viction":"0xb00300fCe618E049d284eb92E57582A5d15295F4",
"scroll":"0x904550e0D182cd4aEe0D305891c666a212EC8F01",
"ethereum":"0xf3D41b377c93fA5C3b0071966f1811c5063fAD40",
"manta pacific":"0xb1d2B9446A9d1550e8d409C0F9745c5A2f10D332",
"fraxtal":"0xDE5E2bf75005422dc408ea96F22467E02cBA8c93",
"mode":"0xfD7c029D1F1198826302F5F6c9CD482c06F0D72f",
"blast":"0xd9371FFFd58D57bfC65e897e18DAF88C88ec273E",
"ancient8":"0xAFa5f9313F1F2b599173f24807a882F498Be118c",
"zetachain":"0x4fc0D96f3d70b4D9b75671Ab92e7Be01CaBE3863",
"redstone":"0xc072c3EbAf165955C5aAd2DbB4293f771de6dbd3",
"sei":"0x47470579B0f2fD91a6Ed1b13bBAd0d723Eec7512",

Human readable ABI (hFT)

[
"function fee() external view returns (uint256 fee)",
"function mint(address _to, uint256 _amount) external payable",
"function quoteBridge(uint32 _destination) external view returns (uint nativeFee)",
"function bridgeHFT(uint32 _destination, uint256 _amount) external payable virtual returns (bytes32 messageId)",
]

JSON ABI

[
  {
    "type": "function",
    "name": "fee",
    "constant": true,
    "stateMutability": "view",
    "payable": false,
    "inputs": [],
    "outputs": [
      {
        "type": "uint256",
        "name": "fee"
      }
    ]
  },
  {
    "type": "function",
    "name": "mint",
    "constant": false,
    "stateMutability": "payable",
    "payable": true,
    "inputs": [
      {
        "type": "address",
        "name": "_to"
      },
      {
        "type": "uint256",
        "name": "_amount"
      }
    ],
    "outputs": []
  },
  {
    "type": "function",
    "name": "quoteBridge",
    "constant": true,
    "stateMutability": "view",
    "payable": false,
    "inputs": [
      {
        "type": "uint32",
        "name": "_destination"
      }
    ],
    "outputs": [
      {
        "type": "uint256",
        "name": "nativeFee"
      }
    ]
  },
  {
    "type": "function",
    "name": "bridgeHFT",
    "constant": false,
    "stateMutability": "payable",
    "payable": true,
    "inputs": [
      {
        "type": "uint32",
        "name": "_destination"
      },
      {
        "type": "uint256",
        "name": "_amount"
      }
    ],
    "outputs": [
      {
        "type": "bytes32",
        "name": "messageId"
      }
    ]
  }
]

Minting Merkly Hyperlane FT

const fee = await contract.fee();
const amount = 1;
const tx = await contract.mint(address, amount, { value: fee.mul(amount) });
const receipt = await tx.wait();

Quote & Bridge hFT

const domain = 10; // Optimism 
const quote = await contract.quoteBridge(domain);
const tx = await contract.bridgeNFT(domain, amount.mul(BigNumber.from(10).pow(18)), { value: quote });

Addresses

"optimism":"0xc110e7faa95680c79937ccaca3d1cab7902be25e",
"binance smart chain":"0xae4789D7C596fdED0e135Bca007152c87a0756f5",
"gnosis":"0x98Ee7E8f0A0D18F393805cf99A56ce6B33ea1B21",
"arbitrum":"0x233888F5Dc1d3C0360b559aBc029675290DAFa70",
"polygon":"0x0cb0354E9C51960a7875724343dfC37B93d32609",
"base":"0x0cb0354E9C51960a7875724343dfC37B93d32609",
"linea":"0x8F2161c83F46B46628cb591358dE4a89A63eEABf",
"scroll":"0xc0faBF14f8ad908b2dCE4C8aA2e7c1a6bD069957",
"ethereum":"0x64D9b639aE85a1e436c1752889c5C40699f3887C",
"manta pacific":"0x75DAa6Eb3748C33b5fB3716465DAD9658BE42A8D",
"mode":"0x9970cB23f10dBd95B8A3E643f3A6A6ABB6f3cB9b",
"ancient8":"0x7dFb5E7808B5eb4fB8b9e7169537575f6fF1a218",
"zetachain":"0xe35030B407C96C037190B63646AC1Eb34F43Cc2b",
"redstone":"0x49bF21531991742b0c1797230758992769771CcD",
"sei":"0x97aa7b7501FA0fe66649DE7394b9794fa40aEF02",

Human readable ABI

[
"function quoteBridge(uint32 _destination, uint amount) external view returns (uint fee)",
"function bridgeETH(uint32 _destination, uint amount) public payable returns (bytes32 messageId)",
"function bridgeWETH(uint32 _destination, uint amount) public payable returns (bytes32 messageId)",
]

JSON ABI

[
  {
    "type": "function",
    "name": "quoteBridge",
    "constant": true,
    "stateMutability": "view",
    "payable": false,
    "inputs": [
      {
        "type": "uint32",
        "name": "_destination"
      },
      {
        "type": "uint256",
        "name": "amount"
      }
    ],
    "outputs": [
      {
        "type": "uint256",
        "name": "fee"
      }
    ]
  },
  {
    "type": "function",
    "name": "bridgeETH",
    "constant": false,
    "stateMutability": "payable",
    "payable": true,
    "inputs": [
      {
        "type": "uint32",
        "name": "_destination"
      },
      {
        "type": "uint256",
        "name": "amount"
      }
    ],
    "outputs": [
      {
        "type": "bytes32",
        "name": "messageId"
      }
    ]
  },
  {
    "type": "function",
    "name": "bridgeWETH",
    "constant": false,
    "stateMutability": "payable",
    "payable": true,
    "inputs": [
      {
        "type": "uint32",
        "name": "_destination"
      },
      {
        "type": "uint256",
        "name": "amount"
      }
    ],
    "outputs": [
      {
        "type": "bytes32",
        "name": "messageId"
      }
    ]
  }
]

Quote & Bridge ETH

const domain = 10; // Optimism 
const amount = ethers.utils.parseEther("0.01"); // Will bridge 0.01 ETH
const quote = await contract.quoteBridge(domain, amount);
// only for L2s (have eth as native token)
const tx = await contract.bridgeETH(domain, amount, { value: amount.add(quote) });
// only for alt L1s (bsc, polygon, etc.)
// TODO: ensure bridge contract is approved to spend WETH
const tx = await contract.bridgeWETH(domain, amount, { value: quote });