Skip to content

nahmii/amm-contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NiiFi exchange smart contracts

This repository contains both the NiiFi v1-core and v1-periphery repositories. Changes versus the original repositories are:

  • Compatibility with the Nahmii Virtual Machine (NVM).
  • Updated Waffle from V2 to V3.
  • Updated tests to work with Waffle V3.
  • Generalized test configuration. (less duplication)
  • Compiler options for both the EVM and the NVM.
  • Updated WETH9 smart contract to work with the NVM.
  • Hardhat integration.
  • Deploy scripts for the Nahmii Testnet network.
  • Updated pair parameters.
  • Updated error strings.

Requirements

Tested with:

  • Nodejs v16.5.0
  • Ubuntu 20.04

Architecture

This repository contains 2 different solidity projects with two different compiler versions:

  • niifi-v1-core -> Solidity 0.5.16
  • niifi-v1-periphery -> Solidity 0.6.12

The core project contains the main file to be deployed, the NiiFiV1Factory contract. The periphery project contains the NiiFiV1Router02 contract, which is required for routing swaps and liquidity actions between pairs.

The NiiFiV1Library contract depends on the hash of the NiiFiV1Pair contract. This hash can be different based on the Solidity version and number of optimization runs used. To generate a new hash code for your specific target, compile the contracts and run the generate-init-code-hash script that can be found in the core contracts scripts folder.

Deployed contracts

Nahmii Testnet

Nahmii Mainnet

Verify contracts

To verify the validity of our contracts against the live versions procede with the following steps:

  • Compile the contracts for the NVM compiler target.
  • Retrieve the bytecode from the contract you want to test against by finding said contracts JSON in the artifacts-nvm folder.
  • Navigate to one of the above mentioned addresses on our block explorer and copy the bytecode.
  • Compare the bytecode either by replacement or using a diffing tool.