This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.
Try running some of the following tasks:
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts
This repository contains smart contracts for the IntoTheVerse-Contracts project deployed on the CELO network. The project includes the following smart contracts:
- TreeContract: An NFT contract that represents trees. Trees can be watered, and they have levels and a decay rate.
- GreenDonation: A staking contract that allows nurturing of trees by staking authorized ERC20 tokens.
- Marketplace: A marketplace contract for auctioning and bidding of trees (To be implemented).
- SwapRouter: A swapping router for tokens, supporting both Uniswap V3 and Ubeswap V2.
This contract is an NFT (Non-Fungible Token) representing a tree. Each tree has a level
and a lastWatered
timestamp. It uses ERC721A standard from OpenZeppelin and has the following functionalities:
- Mint: Allows users to mint new trees.
- Watering: Trees can be watered to increase their levels.
- Decay: If a tree is not watered within a specified period, its level decreases.
This is a staking contract where users can stake authorized ERC20 tokens to nurture a tree (NFT). The staking or 'nurturing' increases the level of the tree and provides a daily yield to the staker. Key features include:
- Nurture Tree: Stake tokens to water a tree.
- Yield: Daily yield based on the level of the tree.
- Claim Rewards: Users can claim their yield.
This contract (to be implemented) will handle the auctioning, bidding, and trading of trees. It will have functionalities like:
- Auction: List a tree for auction.
- Bid: Place bids on listed trees.
- Offer: Make an offer for a tree.
A router contract that allows users to perform token swaps. It supports Uniswap V3 and Ubeswap V2 and will also integrate MENTO protocol. Features are:
- Token Swap: Swap tokens based on the user's choice of DEX.
- Fee Calculation: Calculates the optimal fee tier for Uniswap V3 swaps.
Setting up the development environment to deploy and interact with the smart contracts involves a few steps. Below is a step-by-step guide to get you up and running:
-
Clone the Repository: Clone the IntoTheVerse-Contracts repository to your local machine.
git clone <repository_url>
-
Navigate to Project Folder: Open a terminal and navigate to the project folder.
cd IntoTheVerse-Contracts
-
Install Node.js Packages: Use npm to install the required Node.js packages.
npm install
-
Install Hardhat:
npm install --save-dev hardhat
-
Compile Smart Contracts:
npx hardhat compile
-
Deploy Contracts:
npx hardhat run scripts/deploy.js --network <network_name>
-
Interact with Contracts: Use Hardhat tasks or scripts to interact with the deployed contracts.
- Replace
<repository_url>
with the actual repository URL. - Replace
<network_name>
with the desired blockchain network (e.g.,mainnet
,ropsten
,alfajores
for CELO).
For more specific instructions related to each smart contract, refer to the Usage section.
The project is under active development, and the following features are slated for implementation:
- Auction Functionality: Users will be able to auction their trees.
- Bid Functionality: Users will be able to place bids on trees.
- Offer Functionality: Trees can be offered for a fixed price.
- List Functionality: Listing trees for sale or auction.
- Accept Offer Functionality: Sellers can accept offers made on their trees.
- Toucan Protocol Integration: 10% of the yield will be sent to the Toucan Protocol.
- MENTO Protocol Integration: Allow swaps using the MENTO protocol.
The GreenDonation contract is designed to integrate with the Toucan Protocol. More details can be found here.