Skip to content

Instantly share code, notes, and snippets.

View veridelisi's full-sized avatar
💭
Parayı Kim Yaratır?

veridelisi veridelisi

💭
Parayı Kim Yaratır?
View GitHub Profile
@farzaa
farzaa / MyEpicNFT.sol
Last active December 27, 2022 18:23
End of Section #1 Code
pragma solidity 0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "hardhat/console.sol";
contract MyEpicNFT is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
@cameel
cameel / solidity-enums-with-data.md
Last active December 16, 2023 12:59
Enums with data in Solidity

Use cases

  • Optional/nullable data types.
  • Variant data types.
  • Flag with extra information needed only in some cases (or different in different cases).
  • Modeling states in a state machine where each state can have some data associated with it.
  • List of operations for batch processing, where each operation can have its own arguments.
  • Alternative to function overloading that allows avoiding combinatorial explosion when there are multiple parameters that need variants.
  • Nested data structures with heterogenous nodes.

Syntax and semantics