Git Product home page Git Product logo

scripts's Introduction

Voting scripts

python ~3.10 poetry 1.5.0 eth_brownie 1.19.3 AVotesParser 0.5.4 Ganache ~7.6.0 license MIT pre-commit Code style: black

Lido DAO Aragon omnibus voting scripts.

🏁 Getting started

  • This project uses Brownie development framework. Learn more about Brownie.
  • Poetry dependency and packaging manager is used to bootstrap environment and keep the repo sane.

Prerequisites

  • Python >= 3.10, <3.11
  • Pip >= 20.0
  • Node >= 16.0
  • yarn >= 1.22

Step 1. Install Poetry

Use the following command to install poetry:

pip install --user poetry==1.5.0

alternatively, you could proceed with pipx:

pipx install poetry==1.5.0

Step 2. Setup dependencies with poetry

Ensure that poetry bin path is added to your $PATH env variable. Usually it's $HOME/.local/bin for most Unix-like systems.

poetry install

Step 3. Install Ganache locally

Simply run the following command from the project's directory

yarn

Step 4. Import network config to connect brownie with local Ganache

poetry run brownie networks import network-config.yaml True

Step 5. Activate virtual environment

πŸ“ While previous steps needed only once to init the environment from scratch, the current step is used regularly to activate the environment every time you need it.

poetry shell

βš—οΈ Workflow

Network setup

By default, you should start composing new scripts and test using forked networks. You have two forked networks to work with:

  • mainnet-fork
  • goerli-fork

To start new voting on the live networks you could proceed with:

  • mainnet
  • goerli

Note: you can't run tests on the live networks.

In a typical weekly omnibus workflow, you need only mainnet-fork and mainnet networks. In case of large test campaign on Lido upgrades, it also could be useful to go with goerli and goerli-fork testnets first.

Environment variables setup

Despite the chosen network you always need to set the following var:

export WEB3_INFURA_PROJECT_ID=<infura_api_key>

To start a new vote please provide the DEPLOYER brownie account name (wallet):

export DEPLOYER=<brownie_wallet_name>

To run tests with a contract name resolution guided by the Etherscan you should provide the etherscan API token:

export ETHERSCAN_TOKEN=<etherscan_api_key>

Test run

To run all the test on mainnet-fork execute

brownie test

You can pass network name explicitly with --network {network-name} brownie command-line argument.

To reveal a full test output pass the -s flag

See here to learn more about tests

Notes on running tests in a forked mode

  • To forcibly bypass etherscan contract and event names decoding set the OMNIBUS_BYPASS_EVENTS_DECODING environment variable to 1. It could be useful in case of etherscan downtimes or usage of some unverified contracts (especially, on the GΓΆrli Testnet).
  • To re-use the already created vote_id you can pass the OMNIBUS_VOTE_IDS environment variable (e.g. OMNIBUS_VOTE_IDS=104).
  • To re-use multiple created votes list the ids comma-separated (e.g. OMNIBUS_VOTE_IDS=104,105)
  • To force the large CI runner usage, please name your branch with the large-vote_ prefix.

Code style

Please, use the shared pre-commit hooks to maintain code style:

poetry run pre-commit install

Repository housekeeping

Please move your outdated scripts into archive/scripts and outdated tests into archive/tests directories.

Use cases and scripts examples

Troubleshooting

Invalid hashes (step 2)

If you have encountered Invalid hashes errors while trying to run previous command, please remove poetry's cache:

  • GNU/Linux
rm -rf ~/.cache/pypoetry/cache/
rm -rf ~/.cache/pypoetry/artifacts/
  • MAC OS:
rm -rf ~/Library/Caches/pypoetry/cache
rm -rf ~/Library/Caches/pypoetry/artifacts

scripts's People

Contributors

arwer13 avatar bulbozaur avatar dgusakov avatar diraiks avatar dmitiv avatar folkyatina avatar jeday avatar kadmil avatar loga4 avatar madlabman avatar manneredboor avatar mymphe avatar psirex avatar rkolpakov avatar skhomuti avatar skozin avatar thedzhon avatar ujenjt avatar zuzueeka avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.