Skip to content
/ gensol Public

Simple proof-of-concept to generative art on KodaEVM :)

License

Notifications You must be signed in to change notification settings

kodadot/gensol

Repository files navigation

GenSOL

GenSOL is a ERC-721 contract for generative art. Written in Solidity, it is designed to be used with the Foundry framework.

Features

  • On-chain metadata (base64 encoded JSON)
  • Ability to set maximum supply
  • Art is generated from account + token ID + block number
  • Contract URI

Contracts

  • Generative.sol - The main contract
  • BaseGen.sol - The base contract for generative art
  • BaseTokenGen.sol - The base contract but payable with ERC-20 tokens

How does it work?

In case of BaseGen.sol we need to define a set of parameters (see script/BaseGen.s.sol)

  address initialOwner = vm.addr(deployerPrivateKey);
  string memory name = "Koda.";
  string memory symbol = "KODA";
  string memory contractURI = "ipfs://bafkreige4zmihk32by3n5aeoq7svlqeyhoaapt4l7hoyspsnr2hm7ljjgq";
  string memory baseURI = "https://dyndata.deno.dev/base/content/"; 
  uint256 maxSupply = 64;
  address receiver = 0xE844b2a0a6453250c920BD2b4B7741946aB16C08;

  BaseGen nft = new BaseGen(initialOwner, name, symbol, contractURI, baseURI, maxSupply, receiver);

As you may know from other NFT Galleries

Important

The receiver address is a recipient of 5% royalties Function safeMint is payable - you need to send 0.0015 ETH to mint a token

Development

Tip

Last time I wrote a smart contract was in 2019. I am still learning new things in Solidity and code looks like a mess. I am open to any suggestions and improvements.

Prerequisites

Libraries

We use OpenZeppelin contracts for the ERC-721 implementation.

forge install OpenZeppelin/[email protected] --no-commit

Testing the contract

forge test

Deploying the contract

You can simulate a deployment by running the script:

forge script script/Generative.s.sol

To deploy fully with a verification

source .env;
forge script script/BaseGen.s.sol:MyScript --rpc-url $RPC_URL --broadcast --verify -vvvv

alternatively use just

just deploy

Important

You need to have a .env file with the RPC_URL variable set. Do not forget to obtain ehterscan or basescan API key and set it in the .env file.

See Solidity scripting guide for more information.

Reading and resources

Reading

About

Simple proof-of-concept to generative art on KodaEVM :)

Resources

License

Stars

Watchers

Forks

Packages

No packages published