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

@snapshot-labs/sx-core

v0.1.0-beta.2

Published

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/snapshot-labs/sx-core/master/LICENSE)

Downloads

2

Readme

GitHub license

Snapshot X

Programmable governance on StarkNet. Refer to the documentation for more information.

Contracts Blueprint

contracts
├─ starknet
│   ├─ Authenticators
│   │  ├─ EthTx.cairo — "Authenticate user via an Ethereum transaction"
│   │  ├─ EthSig.cairo — "Authenticate user via an Ethereum signature"
│   │  ├─ EthSigSessionKey.cairo — "Authenticate user via a Session key which has been authorized with an Ethereum signature"
│   │  ├─ EthTxSessionKey.cairo — "Authenticate user via a Session key which has been authorized with an Ethereum transaction"
│   │  ├─ StarkTx.cairo — "Authenticate user via a StarkNet transaction"
│   │  ├─ StarkSig.cairo — "Authenticate user via a Starknet signature"
│   │  └─ Vanilla.cairo — "Dummy authentication"
│   ├─ VotingStrategies
│   │  ├─ EthBalanceOf.cairo — "Voting power found from Ethereum token balances"
│   │  ├─ Vanilla.cairo — "Voting power of 1 for every user"
│   │  └─ Whitelist.cairo — "Predetermined voting power for members in a whitelist, otherwise zero"
│   ├─ ExecutionStrategies
│   │  ├─ Vanilla.cairo — "Dummy execution"
│   │  └─ EthRelayer.cairo — "Strategy to execute proposal transactions on Ethereum"
│   ├─ Interfaces
│   │  ├─ IExecutionStrategy.cairo — "Interface for all execution strategies"
│   │  ├─ IVotingStrategy.cairo — "Interface for all voting strategies"
│   │  ├─ ISpaceAccount.cairo — "Interface for the space contract"
│   │  └─ ISpaceFactory.cairo — "Interface for the space factory"
│   ├─ lib
│   │  ├─ array_utils.cairo — "A library containing various array utilities"
│   │  ├─ choice.cairo — "The set of choices one can make for a vote"
│   │  ├─ eip712.cairo — "Library for Ethereum typed data signature verification"
│   │  ├─ eth_tx.cairo — "Libary for authenticating users via an Ethereum transaction"
│   │  ├─ execute.cairo — "contract call wrapper"
│   │  ├─ general_address.cairo — "Generic address type"
│   │  ├─ math_utils.cairo — "A library containing various math utilities"
│   │  ├─ proposal.cairo — "Proposal metadata type"
│   │  ├─ proposal_info.cairo — "Proposal vote data type"
│   │  ├─ proposal_outcome.cairo — "The set of proposal outcomes"
│   │  ├─ slot_key.cairo — "Library for finding EVM slot keys"
│   │  ├─ voting.cairo — "Core library that implements the logic for the space contract"
│   │  ├─ vote.cairo — "User vote data type"
│   │  ├─ session_key.cairo — "Library to handle session key logic"
│   │  ├─ stark_eip191.cairo — "Library for Starknet typed data signature verification"
│   │  ├─ single_slot_proof.cairo — "Library to enable values from the Ethereum state to be used for voting power"
│   │  └─ timestamp - "Library to handle timestamp to block number conversions within the single slot proof library"
│   ├─ SpaceAccount.cairo - "The base contract for each Snapshot X space"
│   └─ SpaceFactory.cairo - "Handles the deployment and tracking of Space contracts"
└─ ethereum 
    ├─ Interfaces
    │  └─ IStarknetCore.sol — "Interface of the StarkNet core contract"
    ├─ StarkNetCommit
    │  └─ StarknetCommit.sol — "Bridge contract to enable Ethereum transaction authentication"
    └─ ZodiacModule
       ├─ ProposalRelayer.sol — "Provides functionality for recieving proposal data from StarkNet"
       └─ SnapshotXL1Executor.sol — "Execute proposal transactions using a Gnosis Safe"

Usage

Clone repository:

git clone https://github.com/snapshot-labs/sx-core.git
git submodule update --init --recursive

Note: The submodule included in the repo is the Fossil Storage Verifier

Install Python and Yarn requirements:

python3.9 -m venv ~/cairo_venv
source ~/cairo_venv/bin/activate
pip3 install -r requirements.txt
yarn

Compile all contracts:

yarn compile
# You can also use yarn compile:l1 to just compile solidity contracts
# or yarn compile:l2 to just compile cairo contracts

Deploy to Alpha Goerli:

yarn deploy:goerli

Will deploy an example space contract and a set of authenticators, voting strategies and execution strategies to the alpha goerli testnet.

Testing

Tests are separated into three categories:

  • Ethereum tests in tests/ethereum: Tests for our solidity contracts
  • Starknet tests in tests/starknet: Tests for our cairo contracts
  • Cross chain tests in tests/crosschain: Tests that will cover interaction between solidity and cairo contracts.

To run these tests locally:

Install and run StarkNet Devnet (In a separate terminal):

yarn chain:l2

Run an ethereum hardhat node (In a separate terminal)

yarn chain:l1

Run tests:

yarn test:l1
yarn test:l2 
yarn test:crosschain

DISCLAIMER: STILL IN DEVELOPMENT

This project is still under heavy development. Feel free to contact us on Discord!

License

Snapshot X contracts are open-source software licensed under the © MIT license.