1.0.1 • Published 7 months ago

octo-defi-nft v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

CryptoOcto Solidity Smart Contract

A NFT Collection designed by DAOcean Labs

This Solidity smart contract, named CryptoOcto, facilitates the creation and breeding of unique digital octopus (Octo) tokens using ERC721 standards. These tokens can be bred together to generate new ones, reflecting generations and specific cooldown periods.

Overview

The CryptoOcto contract manages the minting, breeding, and properties of Octo tokens. Each Octo has a generation, cooldown period, and breeding cost associated with it.

Features

Roles

  • Minter Role: Responsible for minting new Octo tokens.

Constants

  • MAX_TOKEN_SUPPLY: Defines the maximum number of Octo tokens that can be minted (set at 1000).
  • BASE_COOLDOWN, COOLDOWN_MULTIPLIER, COOLDOWN_FACTOR: Parameters determining cooldown periods for breeding.
  • BASE_BREED_COST: Base cost for breeding two Octos.

Functions

  • Minting: Allows the safe creation of new Octo tokens, assigned to specific addresses.
  • Breeding: Combines two tokens to create a new one, inheriting characteristics and incurring a breeding cost.
  • Token Information Retrieval: Provides access to token details, such as generation, cooldown, and breeding cost.

Contract Structure

State Variables

  • MINTER_ROLE: Role identifier for the minter.
  • BASE_URI: Base URI for token metadata stored on IPFS.
  • MAX_TOKEN_SUPPLY: Maximum supply limit for Octo tokens.
  • Cooldown and breeding cost parameters.

Events

  • Breed: Triggered when two Octos breed to create a new token.
  • Cooldown: Signals a change in the cooldown period for a specific Octo token.

Functions

External / Public Functions

  • safeMint: Safely mints new Octo tokens.
  • breed: Breeds two Octos to create a new token.

Internal Functions

  • Functions handling token initialization, URI generation, cooldown setting, and validation checks.

Public View / Pure Functions

  • supportsInterface: Checks supported interfaces for the contract.
  • Functions for retrieving Octo information, token URIs, breeding costs, and receiver address.

Usage

  1. Minting: Only designated minters can create new Octo tokens.
  2. Breeding: Owners of two Octos can breed them together to generate a new token with combined traits.
  3. Token Information: Users can retrieve details about specific Octo tokens, including their generation, cooldown, and associated metadata.

Note

  • Ensure designated roles are assigned for minting.
  • Check token cooldowns before attempting breeding.
  • Validate sufficient funds for breeding costs.

Disclaimer

This README serves as documentation for the CryptoOcto smart contract. It's essential to review and understand the contract's functionality and potential implications before usage.

License

This smart contract is licensed under the MIT License (SPDX-License-Identifier: MIT).

Getting Started

  • Use Foundry:
forge install
forge test
  • Use Hardhat:
npm install
npx hardhat test

Features

  • Write / run tests with either Hardhat or Foundry:
forge test
# or
npx hardhat test
  • Use Hardhat's task framework
npx hardhat example
  • Install libraries with Foundry which work with Hardhat.
forge install rari-capital/solmate # Already in this repo, just an example

Notes

1.0.1

7 months ago

1.0.0

7 months ago

0.0.9

7 months ago