Voting tokens#2
Conversation
… Transferred helper function to the separate module. Added ESLint to the project. Installed Chai for tests. Updated gitignore.
…flow tests sketch.
…. Added interfaces for both tokens. Adapted mock contract.
…l. Touched up existing tests.
| voter2, | ||
| ] = await ethers.getSigners(); | ||
|
|
||
| const Token = await ethers.getContractFactory("MockERC20Votes"); |
There was a problem hiding this comment.
Change all tests to use actual token contracts and not mocks. in ALL Tests
| token = await Token.deploy("Governance Token", "GT", owner); | ||
| await token.waitForDeployment(); | ||
|
|
||
| const Token2 = await ethers.getContractFactory("MockERC721Votes"); |
| ] = await ethers.getSigners(); | ||
|
|
||
| const Token = await ethers.getContractFactory("MockERC20Votes"); | ||
| token = await Token.deploy("Governance Token", "GT", owner); |
| await token.waitForDeployment(); | ||
|
|
||
| const Token2 = await ethers.getContractFactory("MockERC721Votes"); | ||
| token2 = await Token2.deploy("Governance Token 2", "GT2", "1.0", owner); |
| 5n, | ||
| 1n, | ||
| 0n, | ||
| 2n |
There was a problem hiding this comment.
where are these values taken from? this needs to be thought out. now it seems to be negating all the below tests cause quorum seems to be 0
| ); | ||
|
|
||
| await ethers.provider.send("evm_increaseTime", [3600]); | ||
| await ethers.provider.send("evm_mine", []); |
There was a problem hiding this comment.
why are these 2 lines here? what do they do?
|
|
||
| const finalBalance = await token.balanceOf(proposer.address); | ||
| // 1000 was before mint and then mints 100 more. | ||
| expect(finalBalance).to.equal(ethers.parseUnits("1100")); |
There was a problem hiding this comment.
why is this not a variable that we get from the code? some balanceBefore + mintAmt or something
| expect(finalBalance).to.equal(ethers.parseUnits("1100")); | ||
| }); | ||
|
|
||
| it("Other vote, while one propose executes", async () => { |
| expect( | ||
| await token.balanceOf(voter1.address) | ||
| ).to.equal( | ||
| ethers.parseUnits("550") |
There was a problem hiding this comment.
variables calculated in the test! no hardcoded values
| await token.balanceOf(voter2.address) | ||
| ).to.equal( | ||
| ethers.parseUnits("575") | ||
| ); |
There was a problem hiding this comment.
how are voting tokens used? what happens with them?
can you vote with 0 token? can you vote if not delegated any tokens?
can you vote if have tokens but none delegated?
No description provided.