Skip to content

Commit

Permalink
Add test for preventing delegation to address(0) (#89)
Browse files Browse the repository at this point in the history
* Add dotenv

* Add test for changing delegation to address 0

* Comment nit
  • Loading branch information
ryangoree authored Apr 18, 2024
1 parent 1859822 commit 1a0ac49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions hardhat.config.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "@nomiclabs/hardhat-waffle";
import "hardhat-gas-reporter";
import "solidity-coverage";
import "dotenv/config";

import { HardhatUserConfig } from "hardhat/config";

Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"chai-almost": "^1.0.1",
"coveralls": "^3.1.0",
"cspell": "^5.4.1",
"dotenv": "^16.4.5",
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
"ethereum-waffle": "^3.3.0",
Expand Down
9 changes: 9 additions & 0 deletions test/lockingVault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ describe("Locking Vault", function () {
expect(votingPower).to.be.eq(one.mul(3));
});

it("Does not allow changing delegates to zero address", async () => {
// User 0 deposits and delegates to themselves
await vault.deposit(signers[0].address, one, signers[0].address);
// User 0 tries to change the delegation to zero address
await expect(vault.changeDelegation(zeroAddress)).to.be.revertedWith(
"Zero addr delegation"
);
});

it("Withdraws properly", async () => {
// First we setup the user and give accounts some voting power
await vault.deposit(signers[0].address, one, signers[2].address);
Expand Down

0 comments on commit 1a0ac49

Please sign in to comment.