Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support npm i ava-labs/teleporter #313

Open
hsk81 opened this issue Mar 4, 2024 · 1 comment
Open

Support npm i ava-labs/teleporter #313

hsk81 opened this issue Mar 4, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@hsk81
Copy link

hsk81 commented Mar 4, 2024

..to allow installing the Teleporter dependencies via the NPM registry (to use for example in a Hardhat project).

@hsk81 hsk81 added the enhancement New feature or request label Mar 4, 2024
@samthompsonkennedy
Copy link

samthompsonkennedy commented Mar 16, 2024

If you're using Hardhat, you can use hard-foundry in your Hardhat project.

1. Install hardhat-foundry

Install hardhat-foundry

pnpm i -D @nomicfoundation/hardhat-foundry

Add hardhat-foundry to your hardhat.config.js

import "@nomicfoundation/hardhat-foundry";

2. Install Teleporter with Forge

forge install https://github.com/ava-labs/teleporter

3. Ensure all dependancies have recursively installed

git submodule update --init --recursive
forge install

4. Add remappings.txt for Teleporter

This should be at the root, alongside your hardhat.config.ts

# remappings.txt

@teleporter/=lib/teleporter/contracts/src/Teleporter
@avalabs/subnet-evm-contracts@1.2.0/=lib/teleporter/contracts/lib/subnet-evm/contracts/
@openzeppelin/contracts@4.8.1=lib/teleporter/contracts/lib/openzeppelin-contracts/contracts/
@mocks/=lib/teleporter/contracts/src/Mocks/

5. You can now add Teleported to your contracts!

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.18;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ITeleporterReceiver} from "@teleporter/ITeleporterReceiver.sol";
import {ITeleporterMessenger, TeleporterMessageInput, TeleporterFeeInfo} from "@teleporter/ITeleporterMessenger.sol";
import {ITeleporterConfigEvents} from "./interfaces/ITeleporterConfigEvents.sol";
import {TeleporterOwnerUpgradeable} from "@teleporter/upgrades/TeleporterOwnerUpgradeable.sol";

abstract contract MyTeleporter is Ownable, TeleporterOwnerUpgradeable {
    ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog 🗄️
Development

No branches or pull requests

2 participants