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

@godsflaw/crucible

v1.0.14

Published

a decentralized commitment contract

Downloads

4

Readme

Codefresh build status

crucible

A crucible is a decentralized commitment contract designed to encourage self-improvement through the use of economic and phycological incentives like loss aversion, accountability, and peer pressure.

This project is the core of the Crucible smart contract that lives on the ethereum blockchain. Included in this repo is:

  • the Foundry contract for initiating and registering instances of new Crucibles
  • the Crucible contract code
  • extensive tests for all the above

Getting Started (development)

This contract is very low level. This repo contains everything one needs to make changes, test, and deploy those underlying contracts. You can see how to interact with it from the tests, however, this is not ideal. To interact with this contract directly, we recommend using one of the following client libraries:

development environment

npm install -g [email protected]
npm install -g ganache-cli
npm install -g zos
git clone [email protected]:godsflaw/crucible.git
cd crucible
npm install

to compile, deploy, and test contracts

npm run deploy && npm test

spin up in docker container

docker build -t godsflaw/crucible:<BRANCH> .
docker run -p 8545:8545 godsflaw/crucible:<BRANCH>

version bump before PR is merged to dev

You need to update the version in package.json, then run the following:

./scripts/version_bump

Make sure you verify the diff, commit, and push all changes to your PR.

hopping between environments easily

If you have the vault containers built with the instructions from VAULT.md then you can deploy and test code on any testnet/staging/production right from your development environment. The staging and production vault containers are only available to those with privledged access to the wallet keys.

npm run deploy will automatically spin them up.

Once you have the production and development vault containers, you can simply run npm run deploy and npm test with the correct environment.

NOTE: only works in (bash):

# staging
./scripts/plumb-env
. ./env-staging
export VAULT_ADDR=http://localhost:8200
npm run deploy && npm test

# kovan
./scripts/plumb-env
. ./env-kovan
export VAULT_ADDR=http://localhost:8200
npm run deploy && npm test

# ropsten
./scripts/plumb-env
. ./env-ropsten
export VAULT_ADDR=http://localhost:8200
npm run deploy && npm test

# production (you might need to kill the staging vault)
./scripts/plumb-env
. ./env-production
export VAULT_ADDR=http://localhost:8200
npm run deploy && npm test

Flipping back to the development environment is easy with:

./scripts/plumb-env
. ./env-development

deploying

Deploys are handled through github triggers.

development

First, all changes must start with github issues in the form CRUCIBLE-N where N is a unique monotomically increasing id. Code changes come in on github PRs with branches named CRUCIBLE-N where CRUCIBLE-N is the corresponding issue. When a PR is made, and for every commit pushed against that PR, a continuous integration run is fired off on codefresh. This run builds a docker container and runs the unit tests against that PR's code.

When the PR has been reviewed, all items of review have been addressed, the PR passes CI tests, and a code owner has approved it for merge, it can then be squashed and merged right from the github interface.

NOTE: Please use squash+merge so that the entire change commits as one chunk. This makes rollbacks considerably easier.

staging

Deploying these contracts to staging (rinkeby) or other tests networks happens when that PR is merged. Any commit that lands on the dev branch is automatically built, deployed, tested, and run in staging. Sometimes this step can cause a migration to be recommitted, if this happens, you must wait for the next dev test run to complete.

NOTE: Many PRs can be on dev at once, for this reason, the unit tests run again to make sure all that code works. In addition to unit tests, a set of integration tests runs in staging to make sure the contracts perform correctly in the wild.

production

Once staging looks good by passing all tests with everyone's code working together, then the entire thing can be deployed to production with the following git command:

git push origin dev:master

Again, this will build, deploy, test, and run the contract code. Please be very carful to follow all the earlier steps looking for errors. Any mistakes here can have extreme consiqunces including loss of funds from the contract owners to users.

NOTE: Since the nature of a crucible is to spawn off a new contract to handle that event, there is some protection against mistakes here. Existing crucibles should not be impacted by broken code. Nevertheless, we must take care not to break the Foundry, or new Crucibles created after code is launched. Also, be careful not to introduce any changes that could lead to all the funds in our main hot wallet being depleated.