9M ERC721 (mint, renew) NFT smart contract
This smart contract is what powers https://9m.ai/ A decentralized store for obtaining virtual machines to run modded servers on.
The following are promises this ERC721 smart contract aims to accomplish:
- Allows users to mint a unique NFT that can be transferred that represents a virtual machine classification
- Each NFT represents a virtual machine abstract and allows token holder authorization to control it
- Virtual machine NFT representations have a set expiration date
- Allows users to renew virtual machines using NFT ownership, days and hardware classification determines price in wei
- Allows smart contract owner to set price in wei (ether / 1e18) per virtual machine hardware classification
ERC-721 certificate contract — This is a standard ERC-721 contract implemented using the 0xcert template with additional functions:
-
create(uint256 vm_classifier, uint256 days_) external payable returns (uint)
— Allows anybody to create a certificate (NFT) payable in wei based on a virtual machine hardware classification identifier and number of days it is valid for. -
renewVM(uint256 token_id, uint256 days_) external payable
— Allows anybody to renew a existing virtual machine based on its token identifier and number of days to add from current date. -
setBaseURI(string calldata baseURI_) external onlyOwner
— Allows the smart contract owner to set a base domain prefix for thetokenURI
function. -
setMintingPrice(uint vm_classifier, uint vm_price) onlyOwner
— Allows the smart contract owner to set a price rate in wei (ether / 1e18) for cost of virtual machine hardware identifier to be rented for a single day.
tokenURI(uint256 tokenId) view
— Returns a URL that contains additional metadata about the virtual machine.getVMType(uint token_id) view
— Returns an existing virtual machine hardware identifier.getExpiry(uint token_id) view
— Returns an existing virtual machine expiration timestamp.mintingPrice(uint vm_classifier, uint256 days_) view
— Returns the price in wei (ether / 1e18) based on the number of days and virtual machine hardware classification to mint, same value should be used increate
function viamsg.value
.
The following contract addresses can be found on the Ethereum mainnet
- 9M-ERC721: 0x4C3968d642427831301E88B4ae5AaEe247223ed0
Install MetaMask and visit https://9m.ai/ to create an account and interact with the smart contract.
Clone this repository and use remix to compile and deploy both .sol source files.
Smart contract additional functions by twit:@037 / git:@649
This section is a list of tasks that are pending. You're more than free to help and contribute to this project by creating a pull request.
- Proxy smart contract that offers discounts on VM listings by considering number of hours previously rented
- Proxy smart contract relay that pays for gas fees