Skip to content

DeltaVerseDAO/multi-token-DAO

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Token-DAO-Smart-Contract

What is DAO ?

DAO stands for Decentralized Autonomous Organization an open-source Blockchain protocol governed by a set of rules, created by its members, which automatically execute certain actions without the need for intermediaries. DAO is a community-led entity with no central authority. It is fully autonomous and transparent.

In MultiToken DAO either you can vote with Token or NFT.

There are five Contract.

  • Nappy Token (ERC20Token)
  • NappyNFT (ERC721Token)
  • TimeLock
  • Governance
  • Treasury

Nappy Token

  • Token Name: Nappy Token
  • Token Symbol: NPY
  • Nappy Token will use to mint token and transfer to voter for use in voting.
  • First owner will mint the token. There is no fixed supply to mint the token.
  • This contract will also use for delegate the tokens. User will have to call delegate() function for voting power.
  • Voting power is depend on decimal of Token.

NappyNFT

  • Token Name: NappyNFT
  • NFT Symbol: NPY
  • NappyNFt will use to mint NFT and transfer to voter for use in voting.
  • First owner will mint the NFT. There is no fixed supply to mint the NFT.
  • This contract will also use for delegate the NFT. User will have to call delegate() function for voting power.
  • Voting power of one NFT is one.

TimeLock

  • This contract will set as owner of the Treasury contract.

  • It will decide how many block's to wait to execute proposal.

Governance

  • This contract will create the proposal and vote for the same.
  • In this contact user can create the proposal, vote, cancel.
  • There are several stages for proposal.

Stages

Sr No Stages
0 Pending
1 Active
2 Cancelled
3 Defeated
4 Succeeded
5 Queued
6 Expired
7 Executed
  • First of all we will deploy the contract. We will get contract address of all deploy contract.
  npx hardhat run scripts/deploy.js --network mumbai
  • Nappy Token : 0xb1E2d34eE670F4B91C8015547D4E1F1f89a61f92

  • NappyNFT : 0x0c85214E55324d86395A8148Fe4FB395f185Ae02

  • TimeLock : 0xf43d582A34BfD50395CB8A96150E54a89D507BE3

  • Governance : 0x4dDe5bc62a29DE1e7aE84902E8D0ddA7Fb0D03fE

  • Treasury : 0x7dfBd09387E7b903edb40db98515bAF8c3158722

  • After this we will call createProposal scripts.

  npx hardhat run scripts/createProposal.js --network mumbai
  • After this function we will get proposal Id.

  • Proposal Id : 63443021524830328481685862710718740376614608430634741687791276264061360147468

  • Now we will check state of the DAO.

  • Before check the state we have to wait for to mine 20 Blocks to mine.

  npx hardhat run scripts/checkState.js --network mumbai
  • It will give state 1 means our proposal is Active.

  • Now everyone will vote using castVote function.

  • Some will vote with NFT & some will vote with Tokens.

  npx hardhat run scripts/voteOnProposal.js --network mumbai
  • Now we will check state of the DAO.
  npx hardhat run scripts/state.js --network mumbai
  • It will give state 4 means our proposal is Succeeded.

  • The voting is Succeeded.

  • Now we will call the queue function our proposal is pass.

  npx hardhat run scripts/queueProposal.js --network mumbai
  • It will give state 5 means our proposal is Succeeded.

  • Now our proposal is in Queue.

  • Now we will Execute the proposal.

  npx hardhat run scripts/executeProposal.js --network mumbai
  • It will give state 7 means our proposal is Executed.

  • Our proposal is successfully executed.

Get item

Treasury

  • You have to send some ether or any ERC20Token or ERC721 to Treasury.
  • This contract will store the ether. Anyone can send the ether to this contract.
  • Only owner(timelock) can withdraw the funds.
  • It transfer ownership to TimeLock Contract using transferOwnership function.

Important Step

create .env file in root directory.
    API_URL = "https://polygonscan.com/myapikey"
    PRIVATE_KEY = "YOUR-METAMASK-MNEMONICS"
    POLYGON_SCAN_API_KEY = "YOUR-POLYGON_SCAN_API_KEY"

-Get Your API Key

-Get Your Matic Mumbai Faucet

NPM Packages

Tech Stack

Run Locally

Clone the project

  git clone https://github.com/karangorania/multi-token-DAO

Go to the project directory

  cd multi-token-DAO

Install dependencies

  npm install

Compile

  npx hardhat compile

Test

  npx hardhat test

Deploy

  node scripts/deploy.js

Deploy on Mumbai

  npx hardhat run scripts/deploy.js --network mumbai

Verify Contract

npx hardhat verify --network mumbai <YOUR_CONTRACT_ADDRESS>

Help

  npx hardhat help

Check on Mumbai Explorer

Deploy Contract

Transaction

Proposal ID

About

You can vote using NFT or ERC20 token.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 73.2%
  • JavaScript 26.8%