1.0.2 • Public • Published


Nayms V3 smart contract repository.

Get Started

Install Foundry

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

Update Foundry


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>





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


Ramesh Nair @hiddentao


Nick Mudge




npm i @nayms/contracts-next

DownloadsWeekly Downloads






Unpacked Size

35.8 MB

Total Files


Last publish


  • hiddentao
  • havokzz
  • nayms_engineering