This repository contains the Solidity smart contract of Enso, a detailed list of features and deployment instructions.

Overview

Enso NFT Smart Contract

This repository contains the Solidity smart contract of Enso, a detailed list of features and deployment instructions.

We strongly believe in giving back to the community and the NFT space as a whole. Advancements in smart contracts can only be made through open collaboration.

When we started our journey with Enso, there was no single comprehensive resource for building all the features that have made it into this smart contract. We hope that this repository can serve as a building block and guideline for future projects.

Enso

Don´t close the circle.

Features

This smart contract is based on the ERC721 token standard and it includes the ERC721Enumerable, ERC721Royalty and ERC721Burnable extensions. The contract governance is implemented via the Ownable policy.
For more information about these standards visit the Openzeppelin documentation.

Additionally, we have implemented the following features:

  • Withdrawal
    The contract owner can withdraw the mint revenue to any address.
  • Whitelist
    The whitelist is customizable with a discounted price, separate launch and an arbitrary amount of spots per address.
  • Free Mint List
    Similar to the whitelist, one can assign an arbitrary amount of free mint spots to certain addresses. The free mint launch is aligned with the whitelist launch.
  • Batch Functions
    A variety of batch functions are included for the mint types and for other purposes like setting the whitelist.
  • Token Enumeration
    The ERC721Enumerable extension provides methods to build further enumeration utilities like listing all token Ids and tokens held by any address. The implementation is inspired by BCG's contract.
  • Lowering of Maximum Collectible Supply
    One can lower the maximum collectible supply, but not increase it.
  • Adjustment of Whitelist and Public Mint Price
    As long as the mint has not concluded, the whitelist price and the public price may be adjusted.
  • Metadata Change & Lock
    One can change various metadata items in the contract after launch. These include the name, symbol, baseURI and contractURI. This functionality may be irreversibly locked. Please read the disclaimer below on usage and risk.

All of these features are extensively tested in the included test suite with around 1300 lines of code.

Disclaimer: Note that some of the features are very powerful in what they grant to the contract owner. Notably, the ability to change the metadata has proven to be a big risk factor in other projects and to their community members. The use of each and every functionality must be openly communicated.

For example, the metadata can be changed, but one should only do so before any minting is made publicly available. To secure the metadata from further tampering during and after the mint, there is a metadata lock which irrevocably locks it to its state. The engagement of the metadata lock can be proven via the blockchain transactions.

Getting Started

Make sure to install and use node version 16.14.2.

Install the Dependencies

npm i

Run the Test Suite

npx hardhat test

Deploy the Smart Contract

Create a .env file in the root of the repository with the following structure.

SCAN_API_KEY="<SCAN_API_KEY>"         # Fantomscan / Etherscan or similar api key
PRIVATE_KEY="<PRIVATE_KEY>"           # Private key of contract owner

Fill in the blanks and be careful not to leak them. The .env file is present in .gitignore. If you are uncomfortable in having these values in the repository you may also provide them via environment variables.

Check the hardhat.config.ts file that your desired networks are defined. For Enso these are Fantom related.

Next, adjust the deployment script variables in scripts/test-deploy.ts to your liking. The contract variables provided are designed for test networks, but can easily be adjusted for production networks. Ideally, one would create a separate script called scripts/prod-deploy.ts.

Finally, the deployment can be made via:

npx hardhat run --network "<YOUR_DESIRED_NETWORK>" "scripts/<YOUR_DESIRED_SCRIPT>"

Verify the Smart Contract

After deploying the smart contract it is important to verify it. This discloses and links the source code of the deployed smart contract. The verification guarantees to any third party that nothing malicious is going on.

For this, we provide a script scripts/test-verify.ts which is pre-filled with the constructor variables of scripts/test-deploy.ts. Adjust as necessary and provide the deployed contract address.

Further Improvements

The smart contract itself could be further improved by separating the functions into individual abstract contracts. Initial steps have been made by providing internally callable functions as private variable wrappers.

The provided testing suite is not fully orthogonal, that is some tests overlap in their testing responsibility. Such tests should be further modularized.

License

This repository is licensed under the MIT License and a copy is included.

You might also like...

This is a Blockchain contract app built with solidity, ethersjs, nodejs, and the hardhart library. Connects to metamask as well.

This is a Blockchain contract app built with solidity, ethersjs, nodejs, and the hardhart library. Connects to metamask as well.

Dribble - Hardtjs, Etherjs, Metamask Project About Dribble is my first blockchain, web 3.0 application that you could use to deposit ethereum into a w

May 9, 2022

Basic Implementation of a Contract Wallet in Solidity. The owner can transfer Ether/ERC20 and execute transactions via low-level calls.

Contract Wallet Basic Implementation of a Contract Wallet in Solidity. The owner can transfer Ether/ERC20 and execute transactions via low-level calls

Jun 18, 2022

Solidity framework for extending any contract with counterfactual revocable-delegation

Delegatable Solidity framework for extending any contract with counterfactual revocable-delegation Deployment These contracts can be deployed to a net

Nov 21, 2022

The repository contains the list of awesome✨ & cool web development beginner-friendly✌️ projects!

The repository contains the list of awesome✨ & cool web development beginner-friendly✌️ projects!

Web-dev-mini-projects The repository contains the list of awesome ✨ & cool web development beginner-friendly ✌️ projects! Web-dev-mini-projects ADD AN

Jan 3, 2023

Using a Decentralized Application (DApp) to Sell artwork on the Ethereum blockchain with smart contracts written in Solidity.

Decentralized Applications For Selling Limited Time Artwork This repository houses the Solidity, JavaScript, and HTML code for a Decentralized Applica

Mar 20, 2023

Uptime monitoring RESTful API server that allows authenticated users to monitor URLs, and get detailed uptime reports about their availability, average response time, and total uptime/downtime.

Uptime Monitoring API Uptime monitoring RESTful API server that allows authenticated users to monitor URLs, and get detailed uptime reports about thei

Jun 14, 2022

Web3-citizens-app - React application based on smart contract using web3 and MetaMask extention.

Web3-citizens-app - React application based on smart contract using web3 and MetaMask extention.

Citizens App (web3-react-redux) React application based on smart contract using web3 and MetaMask extention. Start the applicarion Recomend to install

Aug 25, 2022

Ethereum smart contract gas cost waste pattern detection and patching tool

Ethereum smart contract gas cost waste pattern detection and patching tool

Ethereum smart contract gas cost waste pattern detection and patching tool

Mar 23, 2022
A professional truffle solidity template with all necessary libraries that support developer to develop, debug, test, deploy solidity smart contract

solidity-truffle-template A professional truffle solidity template with necessary libraries that support to develop, compile, test, deploy, upgrade, v

ChimGoKien 6 Nov 4, 2022
Solidity Quickstart is an extensive solidity guide for the solidity newbies out there.

?? Solidity Quickstart Solidity Quickstart is an extensive solidity guide for the solidity newbies out there. ?? How does it work? All the guides rela

Kira 8 Aug 6, 2022
Blockchain, Smart Contract, Ganache, Remix, Web3, Solidity, Java Script, MQTT, ESP32, RFID, DHT11,

Blockchain, Smart Contract, Ganache, Remix, Web3, Solidity, Java Script, MQTT, ESP32, RFID, DHT11,

Hajar OUAAROUCH 5 May 24, 2022
This repo contains instructions on how to create your NFT in Solana(using Metaplex and Candy Machine) and mint it using your custom front-end Dapp

Solana-NFT minting Dapp Create your own NFT's on Solana, and mint them from your custom front-end Dapp. Tools used Metaplex -> Metaplex is the NFT sta

Udit Sankhadasariya 12 Nov 2, 2022
In this repository, I try to perform a mainnet fork and then simulate popular smart contract exploits on various DEFI Protocols using Hardhat Framework.

defiHacks_via_Hardhat 1. Alchemix Access Control Bug Any user could have called setWhitelist() to give an attacker the ability to call the harvest fun

null 34 Dec 27, 2022
This project contains a leader board for a game which contains players name and list and store them on API build with HTML, CSS, JS and API

Leaderboard This App is a Game Leaderboard app Which is created by JavaScript and the big picture of this application is using API. Build With ??‍?? .

Sahar Saba Amiri 5 Dec 15, 2022
Use pulsar to make custom trading strategy that uses Flashloans at low cost. No contract deployment required.

PULSAR Pulsar is a contract that will let you execute custom call on the blockchain and let you make use of the Flasloans in your trading sequences. Y

idecentralize.finance 9 Jun 6, 2022
🦠🔬 Forta agent that detect deployment of smart contracts containing an exploit function

Attack Simulation Bot Description The agent detects deployment of smart contracts containing an exploit function. Using a simulation-based approach, t

Artem Kovalchuk 29 Dec 26, 2022
Solidity NFT whitelist contract example using MerkleTree.js for constructing merkle root and merkle proofs.

MerkleTree.js Solidity NFT Whitelist example Allow NFT minting only to whitelisted accounts by verifying merkle proof in Solidity contract. Merkle roo

Miguel Mota 65 Dec 29, 2022
This is a Blockchain contract app built with solidity, ethersjs, nodejs, and the hardhart library. Connects to metamask as well.

Dribble - Hardtjs, Etherjs, Metamask Project About Dribble is my first blockchain, web 3.0 application that you could use to deposit ethereum into a w

Gerald Maduabuchi 9 Jun 17, 2022