npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@routerprotocol/asset-forwarder

v1.0.5

Published

The Cross Chain Asset Forwarder Solidity Contracts

Downloads

6

Readme

Asset Forwarder

Asset Forwarder is a Solidity smart contract that enables trustless cross-chain token transfers. Users can deposit ERC20 tokens on the source chain, which are then forwarded to the destination chain by the forwarder.

Installation and Setup

Requirements

Please install the following:

  • Git

    • You'll know you've done it right if you can run git --version
  • Foundry / Foundryup

    • This will install forge, cast, and anvil
    • You can test you've installed them right by running forge --version and get an output like: forge 0.2.0 (f016135 2022-07-04T00:15:02.930499Z)
    • To get the latest of each, just run foundryup
  •  yarn install
  • git submodule update --init --recursive

Compile

forge compile

Compile For Tron Using Tronbox

yarn compile:tron

Testing

forge test

Deploy and Verify

╰─ forge create --rpc-url <your_rpc_url> --constructor-args "_wrappedNativeTokenAddress" "_gatewayContract" "_usdcAddress" "_tokenMessenger" "_routerMiddlewareBase" "_chainId" "_minGasThreshhold" \ --private-key <your_private_key> src/AssetForwarder.sol:AssetForwarder \ --etherscan-api-key <your_etherscan_api_key> \ --verify

e.g: ╰─ forge create --rpc-url "https://rpc.ankr.com/avalanche_fuji" --private-key "<Private Key>" src/AssetForwarder.sol:AssetForwarder --constructor-args "0xd00ae08403b9bbb9124bb305c09058e32c39a48c" "0x76b71BDC9f179d57E34a03740c62F2e88b7AA6A8" "0x5425890298aed601595a70AB815c96711a31Bc65" "0xeb08f243e5d3fcff26a9e38ae5520a669f4019d0" "0x726f757465723134686a32746176713866706573647778786375343472747933686839307668756a7276636d73746c347a723374786d667677397330307a74766b" "43113" 50000 --etherscan-api-key "95W6I9FT4DRDB45WMHKDXQCK8J4BX2JV62" --verify

Deployment On Tron Network

╰─ ts-node ./scripts/deployTron.ts --args _wrappedNativeTokenAddress,_gatewayContract,_usdcAddress,_tokenMessenger,_routerMiddlewareBase,_chainId,_minGasThreshhold

e.g: ╰─ ts-node ./scripts/deployTron.ts --net "shasta" --env "testnet" --args TMaytdK1v1D1Z2kYh2oXVsRzd7JA75Lx33,TJsFXzriKEuZKhajSVaZn2X37SgtiuUMbg,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x726f757465723134686a32746176713866706573647778786375343472747933686839307668756a7276636d73746c347a723374786d667677397330307a74766b,2494104990,50000

Generate ABIs, BIN and GO bindings

cd evm
yarn install
sh scripts/createBinding.sh

Contract Overview

Roles

  • DEFAULT_ADMIN_ROLE: This role has full administrative control over the contract. It is granted to the contract deployer.
  • RESOURCE_SETTER: Addresses with this role can update certain contract parameters, such as gatewayContract and routerMiddlewareBase.
  • PAUSER: Addresses with this role can pause and unpause the contract.

Asset Forwarder Entry Points

iSend : Initiates token deposits on the source chain, forwarder will take care afterwards

function iSend(
    uint256 partnerId,
    bytes32 destChainIdBytes,
    bytes calldata recipient,
    address srcToken,
    uint256 amount,
    uint256 destAmount
) external payable

iRelay : Forwarder will transfer funds to recipient which was deposited at src chain

function iRelay(RelayData memory relayData) external payable

iReceive : Middleware contract sends forwarder amount release to src chain once forwarder claims funda, called via gateway

function iReceive(string calldata requestSender, bytes memory packet, string calldata) external returns (bytes memory)