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

@fibswap-dex/fibswap-contracts

v0.1.8

Published

## System Overview

Downloads

16

Readme

Fibswap Contracts

System Overview

TLDR

Development

Building

First, install and build all the packages from the root:

fibswap$ yarn && yarn build:all

Then, if you are only making updates to the contracts package, rebuild by running:

fibswap$ yarn workspace @fibswap-dex/fibswap-contracts build

Running the tests

This repository uses foundry for unit tests and hardhat for integration tests.

To run the contract tests, run the appropriate command:

$ yarn workspace @fibswap-dex/fibswap-contracts test:forge # runs unit tests
$ yarn workspace @fibswap-dex/fibswap-contracts test:hardhat # runs integration tests
$ yarn workspace @fibswap-dex/fibswap-contracts test # runs both tests

Running the hardhat tests will output the gas estimates for the integration tests. You can generate a coverage output as well, but as it is not supported by foundry it is not considered to be accurate.

To run the coverage tests, run the following from the root directory:

fibswap$ yarn workspace @fibswap-dex/fibswap-contracts coverage

Contract Deployment

Contracts are deployed via the hardhat deploy. Before deploying any contracts, make sure the deploy script used is up to date with the contracts you will need deployed.

To deploy the contracts:

  1. Obtain a funded mnemonic and provider url (if there is no URL in the default hardhat config) for the network(s) you would like to deploy the contracts to. The mnemonic chosen will be a system admin, who can remove or add routers and assets so make sure to keep it handy. You may also add an api key for etherscan if you plan to verify the contracts:
export MNEMONIC="<YOUR_MNEMONIC_HERE>"
export ETH_PROVIDER_URL="<YOUR_PROVIDER_URL_HERE>"
export ETHERSCAN_API_KEY="<ETHERSCAN_API_KEY_HERE>" # optional, but highly recommended

You can also add a .env to the packages/contracts dir with the above env vars.

  1. Once the proper environment variables are added to your environment, you can begin the contract deployments by running the following from the root directory:
yarn workspace @fibswap-dex/fibswap-contracts hardhat deploy --network \<NETWORK_NAME\> # e.g. yarn workspace @fibswap-dex/fibswap-contracts deploy --network goerli

You should use the NETWORK_NAME that corresponds to the correct network within the hardhat.config.ts file.

NOTE: You will have to run the enroll-remote task if deploying custom bridge routers.

  1. After the contracts are deployed, you must enroll the remote handlers. This is done so the handlers know to accept messages from each other across chains:
yarn workspace @fibswap-dex/fibswap-contracts hardhat enroll-handler --handler \<REMOTE_HANDLER_ADDR\> --chain \<REMOTE_CHAIN_ID\> --network \<NETWORK_NAME\>

NOTE: This step should be removed from the process once the router responsibility is handed to the nomad team.

  1. (optional) To verify the contracts (works with Etherscan-based networks):
yarn workspace @fibswap-dex/fibswap-contracts hardhat etherscan-verify --solc-input --network \<NETWORK_NAME\>
  1. Once the contracts have been deployed, export them using:
yarn workspace @fibswap-dex/fibswap-contracts export

Congratulations! You have deployed the contracts. To configure them properly, see the Amarok Tasks below.

NOTE: Once you have deployed the contracts, you will then need to update (if necessary) and redeploy the subgraphs. See here for details.

Helper Tasks

There are helper tasks defined in the ./src/tasks directory. These can be run using the following example command structure:

yarn workspace @fibswap-dex/fibswap-contracts hardhat add-liquidity --network goerli --amount 2500000000000000000000000 --router 0xDc150c5Db2cD1d1d8e505F824aBd90aEF887caC6 --asset-id 0x8a1Cad3703E0beAe0e0237369B4fcD04228d1682
  • Deploy Router Factory
yarn workspace @fibswap-dex/fibswap-contracts hardhat deploy-router-factory --network <Network-Name> --signer <Router Signer> --recipient <Router Recipient>
  • Create Router Contract
yarn workspace @fibswap-dex/fibswap-contracts hardhat create-router --network <Network-Name> --signer <Router Signer> --recipient <Router Recipient>
  • whitelist command for multiple networks
yarn workspace @fibswap-dex/fibswap-contracts whitelist <router-address>
  • create-router for RouterContract multiple network in one-step
yarn workspace @fibswap-dex/fibswap-contracts create-router <signer-address> <recipient-address>