An ERC-721 collection where squids are bred, not just minted. Two parent squids combine their DNA on-chain to produce a child with mixed traits, a higher generation number, and a breeding cooldown.
Originally written in ink! (Rust, for Polkadot/Substrate), then ported to Solidity so the NFTs work on EVM chains and marketplaces like OpenSea.
- Mint —
createSquid(dna)creates a generation-0 squid for a flatMINT_FEE. - Breed —
breed(momId, dadId)mixes the parents' DNA (mom's top digits + dad's bottom digits, plus a small mutation), sets the child's generation tomax(parents) + 1, and puts both parents on a 60-second cooldown. Caller must own both parents. - Ownership & transfers — handled by ERC-721 itself (
ownerOf,transferFrom). - Metadata —
tokenURIreturns fully on-chain base64-encoded JSON with DNA and generation traits. No external hosting, no IPFS pinning.
The DNA mutation uses block.timestamp for entropy, which is predictable by validators. That's fine for a learning project, but it is not secure randomness — don't reuse this pattern where the outcome has real value at stake.
Built with Foundry.
forge build
forge testexport POLYGON_RPC_URL="<your mainnet RPC endpoint>"
forge script script/DeploySquidBreeding.s.sol \
--rpc-url polygon \
--private-key <your-key> \
--broadcast \
--legacy \
--with-gas-price 25000000000Swap --rpc-url polygon for polygon_amoy (and set POLYGON_AMOY_RPC_URL) to deploy to the Amoy testnet first.
Note that some public Polygon RPC endpoints enforce a minimum gas price — 25 gwei worked at time of writing. --with-gas-price is what actually sets the broadcast price; the plain --gas-price flag only configures the local simulation.
| Network | Address |
|---|---|
| Polygon Amoy (testnet) | 0x49a621d513f7e772dde9ebbcc22900da8405ce3d |
MIT