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

@nayms/contracts-next

v1.0.2

Published

Nayms V3 smart contract repository.

Downloads

4

Readme

contracts-playground

Nayms V3 smart contract repository.

Get Started

Install Foundry

curl -L https://foundry.paradigm.xyz | bash

Update Foundry

foundryup

Install Forge dependencies

forge update

Update Rust, Foundry, and Forge dependencies

make update

Build Project

In order to test the Nayms platform, first build the platforms that Nayms composes with, such as Uniswap v3:

make buniswap
make build

Formatter and Linter

Run yarn to install package.json which includes our formatter and linter. We will switch over to Foundry's sol formatter and linter once released.

Set your environment variables

Check .env.example to see some of the environment variables you should have set in .env in order to run some of the commands.

Current Directory Structure

.
├── contracts
│  ├── diamonds
│  │  ├── nayms
│  │  │  ├── facets
│  │  │  ├── interfaces
│  │  │  └── libs
│  │  └── shared
│  │     ├── facets
│  │     ├── interfaces
│  │     └── libs
│  ├── ERC20
│  └── utils
├── docs
│  └── adr
|── lib
├── scripts
├── src
│  └── test
│     └── utils
│        └── users
└── test

Solidity Scripting

You can now write scripts with Solidity.

forge script <name of script in script folder>

Give a valid Alchemy Eth mainnet API key in .env ALCHEMY_ETH_MAINNET_API_KEY, then try running:

make swap

Nayms Deployment Flow

  1. Create3 Nayms system deployment contract
  2. Deploy all facets
  3. Deploy Nayms Diamond using create3 Nayms system deployment contract
  4. Call the method diamondCut() from the Nayms Diamond and cut in facets. Also, in the same call with the 2nd and 3rd parameter on the diamondCut() method, pass in the InitDiamond contract address with a signed transaction calling the initialization() method in InitDiamond.sol. See this being done in, for example, ./script/DeployNayms.s.sol.

Deploy a specific contract:

make deploy-<NETWORK_NAME> contract=<CONTRACT_NAME>

NETWORK_NAME can be:

mainnet

goerli

anvil

Development Flow

Run tests using Forge

make test

We test with mainnet forking.

We have test defaults in ./test/defaults/. Defaults follow a hierarchy:

D00: Global configuration

D01: Nayms protocol deployment

D02: Testing defaults such as deploying test tokens and giving addresses starting balances

D03: Protocol level defaults such as setting Nayms internal IDs

Tests follow a hierarchy:

T01: Test defaults, deployment

T02: RBAC, Admin functions

T03: Token transfer level

T03SystemFacet - test creating entities

T04: Business functions

Tests should be fixed in order of the hierarchy (T01 first).

Output, compare gas snapshots

make gas

Build Troubleshooting Tips

In case you run into an issue of forge not being able to find a compatible version of solidity compiler for one of your contracts/scripts, you may want to install the solidity version manager svm. To be able to do so, you will need to have Rust installed on your system and with it the acompanying package manager cargo. Once that is done, to install svm run the following command:

cargo install svm-rs

To list the available versions of solidity compiler run:

svm list

Make sure the version you need is in this list, or choose the closest one and install it:

svm install "0.7.6"

Staging for Production Deployment Flow

Run integration tests with mainnet forking.

Ensure "initialization" of entire system.

Use deterministic deployment.

Monitor all events, Nayms Diamond transactions, mempool.

Production Flow

Helpful Links

Louper Diamond Inspector - Etherscan for Diamonds

Acknowledgements

Ramesh Nair @hiddentao

Foundry

Nick Mudge