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

@uma/scripts

v1.32.3

Published

UMA Core Peripheral Scripts

Downloads

82

Readme

Core peripheral scripts

This folder contains scripts that either fetch or modify state from the core UMA contracts.

Before you start

Before starting, you will need to install dependencies and build the entire repository. You can do this by running the following command from the top level directory protocol/:

yarn && yarn build

If you run into any problems with the examples below, the first thing you should do is try clearing the local build artifacts and packages and reinstalling by running the following commands from the top level directory protocol/:

yarn clean-packages && rm -rf packages/core/artifacts packages/core/cache && yarn && yarn build

Mainnet fork

The caller might find it useful to run these scripts against a local (hardhat) Mainnet fork in order to test that the contract state is modified as expected. The local node should be set to run on port 9545.

Scripts can then be run as node scripts connected to the local node by passing in the --network mainnet-fork flag.

After the developer has tested against the local Mainnet fork, they can use the same script connected to a public network. Usually this would involve passing a network name like mainnet_mnemonic or mainnet_gckms to the --network flag to the script and other supporting flags like --keys.

How to run

All scripts are designed to be framework-agnostic (i.e. not wed to hardhat or truffle) and run as node scripts.

For testing locally against a mainnet fork, we first might need to impersonate accounts on the local fork. We can do so via the helper script ./setupFork.sh. setupFork.sh should also run other fork node pre-test setup.

Test scripts can be run by passing in the --network mainnet-fork flag.

For running scripts in production, simply point the --network flag to a public network like mainnet_gckms like so: node ... --network mainnet_gckms --keys deployer.

Example: starting a local fork of Ethereum Mainnet and impersonating accounts

  1. Open a terminal window and start a mainnet fork node locally:
yarn hardhat node --fork https://mainnet.infura.io/v3/YOUR-INFURA-KEY --no-deploy --port 9545
  1. Request to impersonate accounts we'll need to propose and vote on admin proposals:
./packages/scripts/setupFork.sh
  1. Run your script against the local mainnet fork
node YOUR_FILE.js --network mainnet-fork

Testing the Voter Dapp

Start a local hardhat node:

yarn hardhat node --no-deploy --port 9545

Run the base contract deployment:

yarn hardhat deploy --network localhost

Run the fixture script to set up the contracts:

HARDHAT_NETWORK=localhost ./src/utils/Deploy.js

To request a typical price (that you can vote on in the dapp):

HARDHAT_NETWORK=localhost ./src/local/RequestOraclePrice.js --identifier SOME_ID --time 1636667039

To trigger a sample governance vote (that you can vote on in the dapp):

HARDHAT_NETWORK=localhost ./src/mainnet/ProposeAdmin.js --prod

To move to the next phase of voting:

HARDHAT_NETWORK=localhost ./src/local/AdvanceToNextVotingPhase.js