Skip to content

Latest commit

 

History

History
128 lines (92 loc) · 4.38 KB

File metadata and controls

128 lines (92 loc) · 4.38 KB

【GovernorAlpha with Proof of Voting NFT】

【Introduction of the GovernorAlpha with Proof of Voting NFT】

  • This is the smart contract that incentivize voters (of compound) by using the proof of voting NFTs.
    • Once a token holder (of COMP) execute voting, that token holder receive a NFT as a proof of voting.
    • As a incentive to keep engaging in voting, token holders who has voting NFTs can receive rewards regularly.

  • This smart contract try to solve current disadvantage of on-chain voting that:
    • Token holders (of COMP) need to pay GasFee⛽️ for every voting. (In case token holders vote by themself)
    • Small share holders (of COMP) has less voting power than large share holders.
      • By distributing rewards via this smart contract like above, all token holders (of COMP) can get benefit to engage in voting even if they are small share holders (of COMP).


 


【Workflow】

  • Workflow
    • ① Create a proposal (from voters to the GovernorAlphaWithProofOfVotingNFT contract).
    • ② Create a proposal (from the GovernorAlphaWithProofOfVotingNFT contract to the GovernorAlpha contract).
      => Workflow of ① and ② above are execute via the GovernorAlphaWithProofOfVotingNFT contract in a single transaction.
    • ③ Cast a vote (from voters to the GovernorAlphaWithProofOfVotingNFT contract).
    • ④ Cast a vote (from the GovernorAlphaWithProofOfVotingNFT contract to the GovernorAlpha contract).
      => Workflow of ③ and ④ above are execute via the GovernorAlphaWithProofOfVotingNFT contract in a single transaction.
    • ⑤ Create a new proof of voting NFT .
    • ⑥ Mint a proof of voting NFT.
    • ⑦ Transfer a proof of voting NFT to voter who is voted.
    • ⑧ Distribute reward tokens (COMP) based on number of a proof of voting NFTs .

  • Diagram of workflow: 【Decentralized Governance Hack🌍Compound】GovernorAlpha with Proof of Voting NFT

 


【Remarks】

  • Versions:
    • Solidity (Solc): v0.5.16
    • Hardhat: v2.6.1
    • ether.js: v5.4.6
    • web3.js: v1.5.2
    • @openzeppelin/contracts: v2.5.1

 


【Setup】

① Install modules

  • Install npm modules in the root directory
npm install

② Compile contracts

npm run compile

 


【Unit test】

  • Scenario test
npm run test:Scenario.test.js

 


【Demo】


 


【References】