-
Notifications
You must be signed in to change notification settings - Fork 4
/
GovernorAlphaWithProofOfVotingNFT.sol
33 lines (24 loc) · 1.38 KB
/
GovernorAlphaWithProofOfVotingNFT.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
import { ProofOfVotingNFT } from "./ProofOfVotingNFT.sol";
import { ProofOfVotingNFTFactory } from "./ProofOfVotingNFTFactory.sol";
import { GovernorAlpha } from "./compound/Governance/GovernorAlpha.sol";
/**
* @notice - This is the smart contract of NFT that represents a proof of voting
*/
contract GovernorAlphaWithProofOfVotingNFT is GovernorAlpha {
/// @notice The address of the ProofOfVotingNFTFactory contract
ProofOfVotingNFTFactory public proofOfVotingNFTFactory;
constructor(address timelock_, address comp_, address guardian_, address proofOfVotingNFTFactory_) GovernorAlpha(timelock_, comp_, guardian_, proofOfVotingNFTFactory_) public {
proofOfVotingNFTFactory = ProofOfVotingNFTFactory(proofOfVotingNFTFactory_);
}
function castVoteWithProofOfVotingNFT(uint proposalId, bool support) public {
// Execute castVote method in the GovernorAlpha.sol
castVote(proposalId, support);
// [Note]: Mint a proof of voting NFT into a voter's wallet
proofOfVotingNFTFactory.createNewProofOfVotingNFT(msg.sender);
address latestProofOfVotingNFTAddress = proofOfVotingNFTFactory.getLatestProofOfVotingNFTAddress();
ProofOfVotingNFT proofOfVotingNFT = ProofOfVotingNFT(latestProofOfVotingNFTAddress);
proofOfVotingNFT.mintProofOfVotingNFTs(msg.sender);
}
}