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

@waveshq/state-relayer-bot

v0.0.3

Published

A project comprising of smart contracts and scripts to port certain information from DeFiChain to DeFiMetaChain

Downloads

18

Readme

DeFiChain <-> DeFiMetaChain State Relayer

A project comprising of smart contracts and scripts to port certain information from DeFiChain to DeFiMetaChain

Directory Structure

├── bot // <-- Logic for the bot + integration test
├── contracts // <- The smart contracts + example solidity usage
├── scripts // <- Deployment scripts + gas estimation
├── tests // <- Smart contract tests
├── containers // <- Containers for integration tests

How to use the package to update information on DeFiMetaChain

import {handler} from "@waveshq/state-relayer-bot";
import { EnvironmentNetwork } from "@waveshq/walletkit-core"

handler({
    testGasCost: false,
    urlNetwork: "https://ocean.defichain.com/",
    envNetwork: EnvironmentNetwork.MainNet,
    contractAddress: /* YOUR STATE RELAYER PROXY ADDRESS */,
    signer: /* signer object */,
    gasUpdateDEX: /* gas limit for dex update transaction */,
    gasUpdateMaster: /* gas limit for master node update transaction */,
    gasUpdateVault: /* gas limit for vault update transaction */
})

Instruction to consume the smart contract information

Examples on how to consume the information exposed by the smart contract is showcased via this folder and this folder

How to deploy your smart contract on DMCTestnet

Install the dependencies and compile smart contracts:

npm ci
npx hardhat compile
  1. If you use .env file, just execute this:
npx hardhat run --network DMCTestnet scripts/deployment.ts
  1. If you want to use Ledger, comment the accounts line and uncomment the ledgerAccounts line under DMCTestnet section. Execute this command:
npx hardhat run --network DMCTestnet scripts/deployment.ts

How to manage permission for smart contracts via Metamask

There are three main functions related to this: grantRole(bytes32,address), revokeRole(bytes32,address) and renounceRole(bytes32,address)

Clone the repo.

git checkout v0.0.1, (the version that the smart contract is deployed from)

Install dependencies and compile smart contract:

npm ci
npx hardhat compile

Copy file scripts/utils/generateEncodedData.ts from main onto this branch (v0.0.1) and then generate encoded data by executing this command line:

npx ts-node scripts/utils/generateEncodedData

After this, enable metamask to be able to show hex data.

Then when creating a transaction to send, enter the smart contract address as the recipient, then paste the generated encoded data into the "Hex data" field.

A similar flow is showcased in video/MetamaskInstruction.mov

Smart contract addresses deployed by BirthdayResearch team

MetaChain Mainnet

StateRelayerProxy: 0xa075dC93D00ac14f4a7416C03cAbec4728586760

StateRelayer: 0x970F740feB2D14926881d51873Eb81E9183E7B18

MetaChain Testnet

StateRelayerProxy: 0xA6A853DDbfB6C85d3584E33313628555BA85753B

StateRelayer: 0x45f94FFE3fE1b1076e145285E11D5E7Cdf7d6f5e