This repository contains examples of ERC-20, ERC-721, and ERC-1155 smart contracts designed for the Epix blockchain. All contracts are compatible with Solidity 0.8.18, as Epix does not support Solidity 0.8.20 and above.
- YogiToken (ERC-20): 0xA84D7bfC3Be1b5B709d4a564933B4A6080D5b583
- YogiNFTCollection (ERC-721): 0x5434b91C0a104319B68e66399C1f4d53CEFc0Aa3
- YogiMultiToken (ERC-1155): 0xE04461FD106aA44fB55980C97BAc3f07b9c1286d
All tokens have custom metadata with Yogi-themed images. The metadata is hosted on GitHub and can be accessed at:
- ERC-721 NFT: https://github.com/ghraw/EpixZone/contract_examples/main/metadata/1.json
- ERC-1155 Tokens:
- Yogi Coin: https://github.com/ghraw/EpixZone/contract_examples/main/metadata/yogi_coin.json
- Yogi Common: https://github.com/ghraw/EpixZone/contract_examples/main/metadata/yogi_common.json
- Yogi Rare: https://github.com/ghraw/EpixZone/contract_examples/main/metadata/yogi_rare.json
- Yogi Epic: https://github.com/ghraw/EpixZone/contract_examples/main/metadata/yogi_epic.json
- Yogi Legendary: https://github.com/ghraw/EpixZone/contract_examples/main/metadata/yogi_legendary.json
- Yogi Unique: https://github.com/ghraw/EpixZone/contract_examples/main/metadata/yogi_unique.json
- Yogi Special Edition: https://github.com/ghraw/EpixZone/contract_examples/main/metadata/yogi_special.json
A standard ERC-20 token with the following features:
- Name: Yogi Token
- Symbol: YOGI
- Decimals: 18
- Max Supply: 1,000,000,000 tokens
- Initial Supply: 10% of max supply minted to the deployer
- Burning capability
- Minting capability (owner only)
An NFT collection with the following features:
- Name: Yogi NFT Collection
- Symbol: YOGINFT
- Max Supply: 1,000 NFTs
- Metadata: Customizable base URI
- Minting: Owner can mint for free, public can mint with payment
- Enumerable: Tokens can be enumerated
- Withdrawable: Owner can withdraw funds from the contract
A multi-token contract showcasing ERC-1155 capabilities that ERC-721 doesn't have:
- Multiple token types in a single contract
- Batch transfers
- Semi-fungible tokens
- Gas efficiency for multiple NFTs
Predefined token types:
- YOGI_COIN (ID: 0): Fungible token (like ERC-20)
- YOGI_COMMON (ID: 1): Common collectible (semi-fungible)
- YOGI_RARE (ID: 2): Rare collectible (semi-fungible)
- YOGI_EPIC (ID: 3): Epic collectible (semi-fungible)
- YOGI_LEGENDARY (ID: 4): Legendary collectible (semi-fungible)
- YOGI_UNIQUE (ID: 5): Unique item (like ERC-721)
- Node.js (v14+)
- npm or yarn
-
Clone this repository:
git clone https://github.com/yourusername/contract_examples.git cd contract_examples -
Install dependencies:
npm install
-
Create a
.envfile with your private key:cp .env.example .env
Edit the
.envfile and add your private key:PRIVATE_KEY=your_private_key_here
For YogiToken (ERC-20):
npx hardhat run scripts/deploy_yogi_token.js --network epixTestnetFor YogiNFTCollection (ERC-721):
npx hardhat run scripts/deploy_yogi_nft.js --network epixTestnetFor YogiMultiToken (ERC-1155):
npx hardhat run scripts/deploy_yogi_multi_token.js --network epixTestnetReplace epixTestnet with epixMainnet in the above commands.
The deployment scripts include automatic verification on the Epix block explorer. If verification fails, you can manually verify using:
npx hardhat verify --network epixTestnet CONTRACT_ADDRESS [CONSTRUCTOR_ARGS]Examples:
# Verify YogiToken
npx hardhat verify --network epixTestnet 0xA84D7bfC3Be1b5B709d4a564933B4A6080D5b583
# Verify YogiNFTCollection
npx hardhat verify --network epixTestnet 0x5434b91C0a104319B68e66399C1f4d53CEFc0Aa3
# Verify YogiMultiToken
npx hardhat verify --network epixTestnet 0xE04461FD106aA44fB55980C97BAc3f07b9c1286d "https://ipfs.io/ipfs/QmYogi/"Run tests locally:
npx hardhat testRun specific test:
npx hardhat test test/YogiToken.test.js
npx hardhat test test/YogiNFTCollection.test.js
npx hardhat test test/YogiMultiToken.test.js// Mint 1000 tokens to an address
await yogiToken.mint("0xRecipientAddress", ethers.utils.parseEther("1000"));// Transfer 100 tokens to another address
await yogiToken.transfer("0xRecipientAddress", ethers.utils.parseEther("100"));// Burn 50 tokens from your balance
await yogiToken.burn(ethers.utils.parseEther("50"));// Mint an NFT to an address with a specific token URI
await yogiNFT.safeMint("0xRecipientAddress", "ipfs://QmYourCID/1.json");// Mint an NFT by paying the mint price
await yogiNFT.publicMint("ipfs://QmYourCID/1.json", { value: ethers.utils.parseEther("0.01") });// Set the base URI for all tokens
await yogiNFT.setBaseURI("ipfs://QmYourCID/");// Mint 100 YOGI_COIN tokens to an address
await yogiMultiToken.mint("0xRecipientAddress", 0, 100, "0x");
// Mint 5 YOGI_RARE tokens to an address
await yogiMultiToken.mint("0xRecipientAddress", 2, 5, "0x");// Mint multiple token types at once
await yogiMultiToken.mintBatch(
"0xRecipientAddress",
[0, 1, 2], // Token IDs
[100, 10, 5], // Amounts
"0x" // Data
);// Transfer multiple token types at once
await yogiMultiToken.batchTransferDemo(
"0xSenderAddress",
"0xRecipientAddress",
[0, 1], // Token IDs
[50, 5] // Amounts
);This project is licensed under the MIT License - see the LICENSE file for details.
