Nineties Pop Music


    3.2.0 • Public • Published

    Nayms Smart Contracts v3

    lint test coverage status license npm version

    This repository contains Nayms V3 smart contracts.

    Get Started

    Install Foundry

    curl -L | bash

    Update Foundry


    Install Forge dependencies

    forge update

    Update Rust, Foundry, and Forge dependencies

    make update

    Generate Interfaces

    make gen-i

    Prepare the build

    make prep-build

    Build Project

    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

    ├── cli-tools
    ├── script
    │   ├── deployment
    │   └── utils
    ├── src
    │   ├── diamonds
    │   │   ├── nayms
    │   │   │   ├── facets
    │   │   │   ├── interfaces
    │   │   │   └── libs
    │   │   └── shared
    │   │       ├── facets
    │   │       ├── interfaces
    │   │       └── libs
    │   ├── erc20
    │   └── utils
    └── test
        ├── defaults
        ├── fixtures
        └── utils
            └── users

    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

    Current deployment flow, 2022-09-21:

    Simulate the deployment:

    make deploy-sim newDiamond=<bool> initNewDiamond=<bool> facetAction=<enum> facetsToCutIn=<string[]>
    true Deploy a new Nayms diamond
    false Read the address from deployedAddresses.json
    true Deploy a new InitDiamond and call initialize() when calling diamondCut()
    false Does not call initialize() when calling diamondCut()
    facetAction See FacetDeploymentAction enum
    0 DeployAllFacets
    1 UpgradeFacetsWithChangesOnly
    2 UpgradeFacetsListedOnly
    facetsToCutIn Requires facetAction=2
    ["Facet1","Facet2",...] List of facets to cut into the diamond. For example, facetsToCutIn="["ACL", "System"]" will cut in the ACLFacet and SystemFacet. Note: It will remove facet methods that do not exist in the "current" facet, replace methods that exist in both the "current" and "previous" facet, and add methods that only exist in the "current" facet. "Current" is referring to the facet in the current repository.

    Below are several examples on how you would use the smart deploy scripts.

    For a fresh new deployment of the entire project, execute this command:

    make deploy-sim newDiamond=true initNewDiamond=true facetAction=0

    To upgrade the facets that have been changed since the last deployment, run the following:

    make deploy-sim newDiamond=false initNewDiamond=false facetAction=1

    To upgrade specific set of facets, run command like this one:

    make deploy-sim newDiamond=false initNewDiamond=false facetAction=2 facetsToCutIn="["Market","Entity"]"

    ⚠️ Examples above are dry-run probes, to actually do a deploy remove the -sim sufix from the target name

    Running a Local Node

    For development purposes, you can run a node locally using foundry's anvil. It's a simple way to bring up a local node exposing a JSON-RPC endpoint at Make sure to start anvil in one of your terminal windows and in another one run a make target to deploy the Nayms' contracts to it.

    Run the local node seeding it with Nayms' shared wallet:

    make anvil

    You can also run it in debug mode to get verbose log output:

    make anvil-debug

    To do a full deployment run the following command:

    make anvil-deploy newDiamond=true initNewDiamond=true facetAction=0

    You will most likelly need to deploy a dummy ERC20 token for testing purposes. You can do that by running:

    make anvil-gtoken

    ⚠️ Anvil state is not preserved between restarts. Everytime you bring it up, it starts fresh. You need to do the deployment and setup all over again!

    Development Flow

    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"

    Fork testing

    Convenience targets are provided in the Makefile for running a specific test against a forked network.

    To run a test against a Goerli fork us the following command passing in the test matching expression i.e. testStartTokenSale

    make test-goerli MT=testStartTokenSale

    Similarly a Mainnet fork test can be executed via:

    make test-mainnet MT=testStartTokenSale

    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


    Ramesh Nair @hiddentao


    Nick Mudge




    npm i @nayms/contracts

    DownloadsWeekly Downloads






    Unpacked Size

    67.3 MB

    Total Files


    Last publish


    • hiddentao
    • havokzz
    • nayms_engineering