This project contains the smart contracts for ioID v2, a system for creating and managing NFTs for devices. It uses the Foundry framework for development, testing, and deployment.
The core of this project is a factory pattern for creating DeviceNFT
contracts. Each DeviceNFT
contract is an ERC721 token that represents a unique device.
src/deviceNFT/DeviceNFTFactory.sol
: This is the main factory contract. It has acreateDeviceNFT
function that deploys a newDeviceNFT
contract (clone) for a user.src/deviceNFT/DeviceNFTTemplate.sol
: This is the template contract for theDeviceNFT
. It's an upgradeable ERC721 contract with minting controlled by an owner and an operator.
- Clone the repository:
git clone <repository-url> cd ioID-v2-contracts
- Install dependencies:
forge install
To build the contracts, run:
forge build
To run the tests, run:
forge test
The project includes a deployment script in script/DeployDeviceNFT.s.sol
. To deploy the contracts, you can use the following command:
forge script script/DeployDeviceNFT.s.sol:DeployDeviceNFT --rpc-url <your_rpc_url> --private-key <your_private_key>
Make sure to replace <your_rpc_url>
and <your_private_key>
with your actual RPC URL and private key.
This project uses the following libraries:
- forge-std: Standard library for Foundry projects.
- openzeppelin-contracts: A library for secure smart contract development.
- openzeppelin-contracts-upgradeable: Upgradeable versions of OpenZeppelin Contracts.
These dependencies are managed using git submodules
and are located in the lib/
directory.