From d1dda28570a19df4865ce87ae87f228a4fef215d Mon Sep 17 00:00:00 2001 From: PacificYield <173040337+PacificYield@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:13:43 +0100 Subject: [PATCH] refactor: rename Comp.sol to ConfidentialERC20Votes.sol --- README.md | 2 +- .../{Comp.sol => ConfidentialERC20Votes.sol} | 12 +- contracts/governance/GovernorAlphaZama.sol | 18 +- ...{IComp.sol => IConfidentialERC20Votes.sol} | 4 +- ...omp.sol => TestConfidentialERC20Votes.sol} | 6 +- .../{Comp.md => ConfidentialERC20Votes.md} | 13 +- docs/governance/GovernorAlphaZama.md | 20 +- .../{IComp.md => IConfidentialERC20Votes.md} | 2 +- ...e.ts => ConfidentialERC20Votes.fixture.ts} | 22 +- ...test.ts => ConfidentialERC20Votes.test.ts} | 273 +++++++++++------- test/governance/DelegateBySig.ts | 6 +- test/governance/GovernorAlphaZama.test.ts | 44 +-- 12 files changed, 249 insertions(+), 173 deletions(-) rename contracts/governance/{Comp.sol => ConfidentialERC20Votes.sol} (96%) rename contracts/governance/{IComp.sol => IConfidentialERC20Votes.sol} (91%) rename contracts/test/governance/{TestComp.sol => TestConfidentialERC20Votes.sol} (56%) rename docs/governance/{Comp.md => ConfidentialERC20Votes.md} (93%) rename docs/governance/{IComp.md => IConfidentialERC20Votes.md} (97%) rename test/governance/{Comp.fixture.ts => ConfidentialERC20Votes.fixture.ts} (68%) rename test/governance/{Comp.test.ts => ConfidentialERC20Votes.test.ts} (56%) diff --git a/README.md b/README.md index 4351e0a..5559f70 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ These Solidity templates include governance-related and token-related contracts. ### Governance -- [Comp](./contracts/governance/Comp.sol) +- [ConfidentialERC20Votes](./contracts/governance/ConfidentialERC20Votes.sol) - [GovernorAlphaZama](./contracts/governance/GovernorAlphaZama.sol) ### Utils diff --git a/contracts/governance/Comp.sol b/contracts/governance/ConfidentialERC20Votes.sol similarity index 96% rename from contracts/governance/Comp.sol rename to contracts/governance/ConfidentialERC20Votes.sol index 3db749a..95a87af 100644 --- a/contracts/governance/Comp.sol +++ b/contracts/governance/ConfidentialERC20Votes.sol @@ -6,20 +6,20 @@ import { Ownable2Step, Ownable } from "@openzeppelin/contracts/access/Ownable2St import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol"; import { ConfidentialERC20 } from "../token/ERC20/ConfidentialERC20.sol"; -import { IComp } from "./IComp.sol"; +import { IConfidentialERC20Votes } from "./IConfidentialERC20Votes.sol"; /** - * @title Comp + * @title ConfidentialERC20Votes * @notice This contract inherits ConfidentialERC20, EIP712, and Ownable2Step. - * This is based on the Comp.sol contract written by Compound Labs. - * see: compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol + * This is based on the ConfidentialERC20Votes.sol contract written by Compound Labs. + * see: compound-finance/compound-protocol/blob/master/contracts/Governance/ConfidentialERC20Votes.sol * It is a governance token used to delegate votes, which can be used by contracts such as * GovernorAlphaZama.sol. * It uses encrypted votes to delegate the voting power associated * with an account's balance. * @dev The delegation of votes leaks information about the account's encrypted balance to the `delegatee`. */ -abstract contract Comp is IComp, ConfidentialERC20, EIP712, Ownable2Step { +abstract contract ConfidentialERC20Votes is IConfidentialERC20Votes, ConfidentialERC20, EIP712, Ownable2Step { /// @notice Returned if the `blockNumber` is higher or equal to the (current) `block.number`. /// @dev It is returned in requests to access votes. error BlockNumberEqualOrHigherThanCurrentBlock(); @@ -161,7 +161,7 @@ abstract contract Comp is IComp, ConfidentialERC20, EIP712, Ownable2Step { } /** - * @notice See {IComp-getPriorVotesForGovernor}. + * @notice See {IConfidentialERC20Votes-getPriorVotesForGovernor}. */ function getPriorVotesForGovernor(address account, uint256 blockNumber) public virtual returns (euint64 votes) { if (msg.sender != governor) { diff --git a/contracts/governance/GovernorAlphaZama.sol b/contracts/governance/GovernorAlphaZama.sol index d11df9e..805a2ee 100644 --- a/contracts/governance/GovernorAlphaZama.sol +++ b/contracts/governance/GovernorAlphaZama.sol @@ -5,7 +5,7 @@ import "fhevm/lib/TFHE.sol"; import "fhevm/gateway/GatewayCaller.sol"; import { Ownable2Step, Ownable } from "@openzeppelin/contracts/access/Ownable2Step.sol"; -import { IComp } from "./IComp.sol"; +import { IConfidentialERC20Votes } from "./IConfidentialERC20Votes.sol"; import { ICompoundTimelock } from "./ICompoundTimelock.sol"; /** @@ -197,12 +197,12 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller { uint256 public constant PROPOSAL_MAX_OPERATIONS = 10; /// @notice The number of votes required for a voter to become a proposer. - /// @dev It is set at 100,000, which is 1% of the total supply of the Comp token. + /// @dev It is set at 100,000, which is 1% of the total supply of the ConfidentialERC20Votes token. uint256 public constant PROPOSAL_THRESHOLD = 100000e6; /// @notice The number of votes in support of a proposal required in order for a quorum to be reached /// and for a vote to succeed. - /// @dev It is set at 400,000, which is 4% of the total supply of the Comp token. + /// @dev It is set at 400,000, which is 4% of the total supply of the ConfidentialERC20Votes token. uint64 public constant QUORUM_VOTES = 400000e6; /// @notice The delay before voting on a proposal may take place once proposed. @@ -214,8 +214,8 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller { /// (i.e 21,600 for 12-second blocks). uint256 public immutable VOTING_PERIOD; - /// @notice Comp governance token. - IComp public immutable COMP; + /// @notice ConfidentialERC20Votes governance token. + IConfidentialERC20Votes public immutable CONFIDENTIAL_ERC20_VOTES; /// @notice Compound Timelock. ICompoundTimelock public immutable TIMELOCK; @@ -253,7 +253,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller { /** * @param owner_ Owner address. * @param timelock_ Timelock contract. - * @param comp_ Comp token. + * @param comp_ ConfidentialERC20Votes token. * @param votingPeriod_ Voting period. * @dev Do not use a small value in production such as 5 or 20 to avoid security issues * unless for testing purpose. It should by at least a few days,. @@ -261,7 +261,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller { */ constructor(address owner_, address timelock_, address comp_, uint256 votingPeriod_) Ownable(owner_) { TIMELOCK = ICompoundTimelock(timelock_); - COMP = IComp(comp_); + CONFIDENTIAL_ERC20_VOTES = IConfidentialERC20Votes(comp_); VOTING_PERIOD = votingPeriod_; /// @dev Store these constant-like variables in the storage. @@ -443,7 +443,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller { ebool canPropose = TFHE.lt( _EUINT64_PROPOSAL_THRESHOLD, - COMP.getPriorVotesForGovernor(msg.sender, block.number - 1) + CONFIDENTIAL_ERC20_VOTES.getPriorVotesForGovernor(msg.sender, block.number - 1) ); uint256[] memory cts = new uint256[](1); @@ -645,7 +645,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller { revert VoterHasAlreadyVoted(); } - euint64 votes = COMP.getPriorVotesForGovernor(voter, proposal.startBlock); + euint64 votes = CONFIDENTIAL_ERC20_VOTES.getPriorVotesForGovernor(voter, proposal.startBlock); proposal.forVotes = TFHE.select(support, TFHE.add(proposal.forVotes, votes), proposal.forVotes); proposal.againstVotes = TFHE.select(support, proposal.againstVotes, TFHE.add(proposal.againstVotes, votes)); diff --git a/contracts/governance/IComp.sol b/contracts/governance/IConfidentialERC20Votes.sol similarity index 91% rename from contracts/governance/IComp.sol rename to contracts/governance/IConfidentialERC20Votes.sol index a93e0a7..a0e9020 100644 --- a/contracts/governance/IComp.sol +++ b/contracts/governance/IConfidentialERC20Votes.sol @@ -4,10 +4,10 @@ pragma solidity ^0.8.24; import "fhevm/lib/TFHE.sol"; /** - * @title IComp + * @title IConfidentialERC20Votes * @dev The GovernorAlphaZama relies on this interface. */ -interface IComp { +interface IConfidentialERC20Votes { /** * @notice Determine the prior number of votes for an account as of a block number. * @dev Block number must be a finalized block or else this function will revert. diff --git a/contracts/test/governance/TestComp.sol b/contracts/test/governance/TestConfidentialERC20Votes.sol similarity index 56% rename from contracts/test/governance/TestComp.sol rename to contracts/test/governance/TestConfidentialERC20Votes.sol index 7cfd190..5b0a398 100644 --- a/contracts/test/governance/TestComp.sol +++ b/contracts/test/governance/TestConfidentialERC20Votes.sol @@ -1,17 +1,17 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear pragma solidity ^0.8.24; -import { Comp } from "../../governance/Comp.sol"; +import { ConfidentialERC20Votes } from "../../governance/ConfidentialERC20Votes.sol"; import { MockZamaFHEVMConfig } from "fhevm/config/ZamaFHEVMConfig.sol"; -contract TestComp is MockZamaFHEVMConfig, Comp { +contract TestConfidentialERC20Votes is MockZamaFHEVMConfig, ConfidentialERC20Votes { constructor( address owner_, string memory name_, string memory symbol_, string memory version_, uint64 totalSupply_ - ) Comp(owner_, name_, symbol_, version_, totalSupply_) { + ) ConfidentialERC20Votes(owner_, name_, symbol_, version_, totalSupply_) { // } } diff --git a/docs/governance/Comp.md b/docs/governance/ConfidentialERC20Votes.md similarity index 93% rename from docs/governance/Comp.md rename to docs/governance/ConfidentialERC20Votes.md index 9ba71df..b4bfe5c 100644 --- a/docs/governance/Comp.md +++ b/docs/governance/ConfidentialERC20Votes.md @@ -1,8 +1,9 @@ -# Comp +# ConfidentialERC20Votes -This contract inherits ConfidentialERC20, EIP712, and Ownable2Step. This is based on the Comp.sol contract written by -Compound Labs. see: compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol. It is a governance -token used to delegate votes, which can be used by contracts such as GovernorAlphaZama.sol. It uses encrypted votes to +This contract inherits ConfidentialERC20, EIP712, and Ownable2Step. This is based on the ConfidentialERC20Votes.sol +contract written by Compound Labs. see: +compound-finance/compound-protocol/blob/master/contracts/Governance/ConfidentialERC20Votes.sol. It is a governance token +used to delegate votes, which can be used by contracts such as GovernorAlphaZama.sol. It uses encrypted votes to delegate the voting power associated with an account's balance. _The delegation of votes leaks information about the account's encrypted balance to the `delegatee`._ @@ -151,7 +152,7 @@ The number of checkpoints for an `account`. ## \_checkpoints ```solidity -mapping(address => mapping(uint32 => struct Comp.Checkpoint)) _checkpoints +mapping(address => mapping(uint32 => struct ConfidentialERC20Votes.Checkpoint)) _checkpoints ``` A record of votes \_checkpoints for an `account` using incremental indices. @@ -223,7 +224,7 @@ _This function enables the sender to cancel a signature._ function getPriorVotesForGovernor(address account, uint256 blockNumber) public virtual returns (euint64 votes) ``` -See {IComp-getPriorVotesForGovernor}. +See {IConfidentialERC20Votes-getPriorVotesForGovernor}. ## getCurrentVotes diff --git a/docs/governance/GovernorAlphaZama.md b/docs/governance/GovernorAlphaZama.md index 3a1fc59..b1ee419 100644 --- a/docs/governance/GovernorAlphaZama.md +++ b/docs/governance/GovernorAlphaZama.md @@ -301,7 +301,7 @@ uint256 PROPOSAL_THRESHOLD The number of votes required for a voter to become a proposer. -_It is set at 100,000, which is 1% of the total supply of the Comp token._ +_It is set at 100,000, which is 1% of the total supply of the ConfidentialERC20Votes token._ ## QUORUM_VOTES @@ -311,7 +311,7 @@ uint64 QUORUM_VOTES The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed. -_It is set at 400,000, which is 4% of the total supply of the Comp token._ +_It is set at 400,000, which is 4% of the total supply of the ConfidentialERC20Votes token._ ## VOTING_DELAY @@ -334,10 +334,10 @@ _It is recommended to be set at 3 days in blocks (i.e 21,600 for 12-second block ## COMP ```solidity -contract IComp COMP +contract IConfidentialERC20Votes COMP ``` -Comp governance token. +ConfidentialERC20Votes governance token. ## TIMELOCK @@ -400,12 +400,12 @@ by at least a few days,. For instance, 3 days would have a votingPeriod = 21,600 ### Parameters -| Name | Type | Description | -| -------------- | ------- | ------------------ | -| owner\_ | address | Owner address. | -| timelock\_ | address | Timelock contract. | -| comp\_ | address | Comp token. | -| votingPeriod\_ | uint256 | Voting period. | +| Name | Type | Description | +| ------------------------ | ------- | ----------------------------- | +| owner\_ | address | Owner address. | +| timelock\_ | address | Timelock contract. | +| confidentialERC20Votes\_ | address | ConfidentialERC20Votes token. | +| votingPeriod\_ | uint256 | Voting period. | ## cancel diff --git a/docs/governance/IComp.md b/docs/governance/IConfidentialERC20Votes.md similarity index 97% rename from docs/governance/IComp.md rename to docs/governance/IConfidentialERC20Votes.md index 9b17317..16f8659 100644 --- a/docs/governance/IComp.md +++ b/docs/governance/IConfidentialERC20Votes.md @@ -1,4 +1,4 @@ -# IComp +# IConfidentialERC20Votes _The GovernorAlphaZama relies on this interface._ diff --git a/test/governance/Comp.fixture.ts b/test/governance/ConfidentialERC20Votes.fixture.ts similarity index 68% rename from test/governance/Comp.fixture.ts rename to test/governance/ConfidentialERC20Votes.fixture.ts index 373a085..969ec3f 100644 --- a/test/governance/Comp.fixture.ts +++ b/test/governance/ConfidentialERC20Votes.fixture.ts @@ -1,13 +1,13 @@ import { parseUnits } from "ethers"; import { ethers } from "hardhat"; -import type { TestComp } from "../../types"; +import type { TestConfidentialERC20Votes } from "../../types"; import { reencryptEuint64 } from "../reencrypt"; import { Signers } from "../signers"; import { FhevmInstances } from "../types"; -export async function deployCompFixture(signers: Signers): Promise { - const contractFactory = await ethers.getContractFactory("TestComp"); +export async function deployConfidentialERC20Votes(signers: Signers): Promise { + const contractFactory = await ethers.getContractFactory("TestConfidentialERC20Votes"); const contract = await contractFactory .connect(signers.alice) .deploy(signers.alice.address, "CompoundZama", "COMP", "1.0", parseUnits("10000000", 6)); @@ -21,21 +21,23 @@ export async function transferTokensAndDelegate( transferAmount: bigint, account: string, delegate: string, - comp: TestComp, + confidentialERC20Votes: TestConfidentialERC20Votes, compAddress: string, ): Promise { const input = instances.alice.createEncryptedInput(compAddress, signers.alice.address); input.add64(transferAmount); const encryptedTransferAmount = await input.encrypt(); - let tx = await comp + let tx = await confidentialERC20Votes .connect(signers.alice) [ "transfer(address,bytes32,bytes)" ](signers[account as keyof Signers], encryptedTransferAmount.handles[0], encryptedTransferAmount.inputProof); await tx.wait(); - tx = await comp.connect(signers[account as keyof Signers]).delegate(signers[delegate as keyof Signers].address); + tx = await confidentialERC20Votes + .connect(signers[account as keyof Signers]) + .delegate(signers[delegate as keyof Signers].address); await tx.wait(); } @@ -43,10 +45,10 @@ export async function reencryptCurrentVotes( signers: Signers, instances: FhevmInstances, account: string, - comp: TestComp, + confidentialERC20Votes: TestConfidentialERC20Votes, compAddress: string, ): Promise { - const voteHandle = await comp.getCurrentVotes(signers[account as keyof Signers].address); + const voteHandle = await confidentialERC20Votes.getCurrentVotes(signers[account as keyof Signers].address); const vote = await reencryptEuint64(signers, instances, account, voteHandle, compAddress); return vote; } @@ -56,10 +58,10 @@ export async function reencryptPriorVotes( instances: FhevmInstances, account: string, blockNumber: number, - comp: TestComp, + confidentialERC20Votes: TestConfidentialERC20Votes, compAddress: string, ): Promise { - const voteHandle = await comp.getPriorVotes(signers[account as keyof Signers].address, blockNumber); + const voteHandle = await confidentialERC20Votes.getPriorVotes(signers[account as keyof Signers].address, blockNumber); const vote = await reencryptEuint64(signers, instances, account, voteHandle, compAddress); return vote; } diff --git a/test/governance/Comp.test.ts b/test/governance/ConfidentialERC20Votes.test.ts similarity index 56% rename from test/governance/Comp.test.ts rename to test/governance/ConfidentialERC20Votes.test.ts index 13d3e67..f041f4f 100644 --- a/test/governance/Comp.test.ts +++ b/test/governance/ConfidentialERC20Votes.test.ts @@ -7,10 +7,14 @@ import { createInstances } from "../instance"; import { reencryptEuint64 } from "../reencrypt"; import { getSigners, initSigners } from "../signers"; import { waitNBlocks } from "../utils"; -import { deployCompFixture, reencryptCurrentVotes, reencryptPriorVotes } from "./Comp.fixture"; +import { + deployConfidentialERC20Votes, + reencryptCurrentVotes, + reencryptPriorVotes, +} from "./ConfidentialERC20Votes.fixture"; import { delegateBySig } from "./DelegateBySig"; -describe("Comp", function () { +describe("ConfidentialERC20Votes", function () { // @dev The placeholder is type(uint256).max --> 2**256 - 1. const PLACEHOLDER = 2n ** 256n - 1n; const NULL_ADDRESS = "0x0000000000000000000000000000000000000000"; @@ -21,9 +25,9 @@ describe("Comp", function () { }); beforeEach(async function () { - const contract = await deployCompFixture(this.signers); + const contract = await deployConfidentialERC20Votes(this.signers); this.compAddress = await contract.getAddress(); - this.comp = contract; + this.confidentialERC20Votes = contract; this.instances = await createInstances(this.signers); }); @@ -34,40 +38,60 @@ describe("Comp", function () { input.add64(transferAmount); const encryptedTransferAmount = await input.encrypt(); - const tx = await this.comp["transfer(address,bytes32,bytes)"]( + const tx = await this.confidentialERC20Votes["transfer(address,bytes32,bytes)"]( this.signers.bob.address, encryptedTransferAmount.handles[0], encryptedTransferAmount.inputProof, ); - await expect(tx).to.emit(this.comp, "Transfer").withArgs(this.signers.alice, this.signers.bob, PLACEHOLDER); + await expect(tx) + .to.emit(this.confidentialERC20Votes, "Transfer") + .withArgs(this.signers.alice, this.signers.bob, PLACEHOLDER); // Decrypt Alice's balance - expect(await reencryptBalance(this.signers, this.instances, "alice", this.comp, this.compAddress)).to.equal( - parseUnits(String(8_000_000), 6), - ); + expect( + await reencryptBalance(this.signers, this.instances, "alice", this.confidentialERC20Votes, this.compAddress), + ).to.equal(parseUnits(String(8_000_000), 6)); // Decrypt Bob's balance - expect(await reencryptBalance(this.signers, this.instances, "bob", this.comp, this.compAddress)).to.equal( - parseUnits(String(2_000_000), 6), - ); + expect( + await reencryptBalance(this.signers, this.instances, "bob", this.confidentialERC20Votes, this.compAddress), + ).to.equal(parseUnits(String(2_000_000), 6)); }); it("can delegate tokens on-chain", async function () { - const tx = await this.comp.connect(this.signers.alice).delegate(this.signers.bob.address); - await expect(tx).to.emit(this.comp, "DelegateChanged").withArgs(this.signers.alice, NULL_ADDRESS, this.signers.bob); + const tx = await this.confidentialERC20Votes.connect(this.signers.alice).delegate(this.signers.bob.address); + await expect(tx) + .to.emit(this.confidentialERC20Votes, "DelegateChanged") + .withArgs(this.signers.alice, NULL_ADDRESS, this.signers.bob); const latestBlockNumber = await ethers.provider.getBlockNumber(); await waitNBlocks(1); expect( - await reencryptPriorVotes(this.signers, this.instances, "bob", latestBlockNumber, this.comp, this.compAddress), + await reencryptPriorVotes( + this.signers, + this.instances, + "bob", + latestBlockNumber, + this.confidentialERC20Votes, + this.compAddress, + ), ).to.equal(parseUnits(String(10_000_000), 6)); // Verify the two functions return the same. expect( - await reencryptPriorVotes(this.signers, this.instances, "bob", latestBlockNumber, this.comp, this.compAddress), - ).to.equal(await reencryptCurrentVotes(this.signers, this.instances, "bob", this.comp, this.compAddress)); + await reencryptPriorVotes( + this.signers, + this.instances, + "bob", + latestBlockNumber, + this.confidentialERC20Votes, + this.compAddress, + ), + ).to.equal( + await reencryptCurrentVotes(this.signers, this.instances, "bob", this.confidentialERC20Votes, this.compAddress), + ); }); it("can delegate votes via delegateBySig if signature is valid", async function () { @@ -77,36 +101,61 @@ describe("Comp", function () { let latestBlockNumber = await ethers.provider.getBlockNumber(); const block = await ethers.provider.getBlock(latestBlockNumber); const expiry = block!.timestamp + 100; - const signature = await delegateBySig(delegator, delegatee.address, this.comp, nonce, expiry); + const signature = await delegateBySig(delegator, delegatee.address, this.confidentialERC20Votes, nonce, expiry); - const tx = await this.comp + const tx = await this.confidentialERC20Votes .connect(this.signers.alice) .delegateBySig(delegator, delegatee, nonce, expiry, signature); - await expect(tx).to.emit(this.comp, "DelegateChanged").withArgs(this.signers.alice, NULL_ADDRESS, this.signers.bob); + await expect(tx) + .to.emit(this.confidentialERC20Votes, "DelegateChanged") + .withArgs(this.signers.alice, NULL_ADDRESS, this.signers.bob); latestBlockNumber = await ethers.provider.getBlockNumber(); await waitNBlocks(1); expect( - await reencryptPriorVotes(this.signers, this.instances, "bob", latestBlockNumber, this.comp, this.compAddress), + await reencryptPriorVotes( + this.signers, + this.instances, + "bob", + latestBlockNumber, + this.confidentialERC20Votes, + this.compAddress, + ), ).to.equal(parseUnits(String(10_000_000), 6)); // Verify the two functions return the same. expect( - await reencryptPriorVotes(this.signers, this.instances, "bob", latestBlockNumber, this.comp, this.compAddress), - ).to.equal(await reencryptCurrentVotes(this.signers, this.instances, "bob", this.comp, this.compAddress)); + await reencryptPriorVotes( + this.signers, + this.instances, + "bob", + latestBlockNumber, + this.confidentialERC20Votes, + this.compAddress, + ), + ).to.equal( + await reencryptCurrentVotes(this.signers, this.instances, "bob", this.confidentialERC20Votes, this.compAddress), + ); }); it("cannot delegate votes to self but it gets removed once the tokens are transferred", async function () { - let tx = await this.comp.connect(this.signers.alice).delegate(this.signers.alice.address); + let tx = await this.confidentialERC20Votes.connect(this.signers.alice).delegate(this.signers.alice.address); await tx.wait(); let latestBlockNumber = await ethers.provider.getBlockNumber(); await waitNBlocks(1); expect( - await reencryptPriorVotes(this.signers, this.instances, "alice", latestBlockNumber, this.comp, this.compAddress), + await reencryptPriorVotes( + this.signers, + this.instances, + "alice", + latestBlockNumber, + this.confidentialERC20Votes, + this.compAddress, + ), ).to.equal(parseUnits(String(10_000_000), 6)); const transferAmount = parseUnits(String(10_000_000), 6); @@ -114,7 +163,7 @@ describe("Comp", function () { input.add64(transferAmount); const encryptedTransferAmount = await input.encrypt(); - tx = await this.comp + tx = await this.confidentialERC20Votes .connect(this.signers.alice) [ "transfer(address,bytes32,bytes)" @@ -126,7 +175,14 @@ describe("Comp", function () { await waitNBlocks(1); expect( - await reencryptPriorVotes(this.signers, this.instances, "alice", latestBlockNumber, this.comp, this.compAddress), + await reencryptPriorVotes( + this.signers, + this.instances, + "alice", + latestBlockNumber, + this.confidentialERC20Votes, + this.compAddress, + ), ).to.equal(0); }); @@ -136,18 +192,17 @@ describe("Comp", function () { const nonce = 0; const block = await ethers.provider.getBlock(await ethers.provider.getBlockNumber()); const expiry = block!.timestamp + 100; - const signature = await delegateBySig(delegator, delegatee.address, this.comp, nonce, expiry); + const signature = await delegateBySig(delegator, delegatee.address, this.confidentialERC20Votes, nonce, expiry); - const tx = await this.comp + const tx = await this.confidentialERC20Votes .connect(this.signers.alice) .delegateBySig(delegator, delegatee, nonce, expiry, signature); await tx.wait(); // Cannot reuse same nonce when delegating by sig - await expect(this.comp.delegateBySig(delegator, delegatee, nonce, expiry, signature)).to.be.revertedWithCustomError( - this.comp, - "SignatureNonceInvalid", - ); + await expect( + this.confidentialERC20Votes.delegateBySig(delegator, delegatee, nonce, expiry, signature), + ).to.be.revertedWithCustomError(this.confidentialERC20Votes, "SignatureNonceInvalid"); }); it("cannot delegate votes if nonce is invalid due to the delegator incrementing her nonce", async function () { @@ -156,17 +211,16 @@ describe("Comp", function () { const nonce = 0; const block = await ethers.provider.getBlock(await ethers.provider.getBlockNumber()); const expiry = block!.timestamp + 100; - const signature = await delegateBySig(delegator, delegatee.address, this.comp, nonce, expiry); + const signature = await delegateBySig(delegator, delegatee.address, this.confidentialERC20Votes, nonce, expiry); - const tx = await this.comp.connect(delegator).incrementNonce(); + const tx = await this.confidentialERC20Votes.connect(delegator).incrementNonce(); // @dev the newNonce is 1 - await expect(tx).to.emit(this.comp, "NonceIncremented").withArgs(delegator, BigInt("1")); + await expect(tx).to.emit(this.confidentialERC20Votes, "NonceIncremented").withArgs(delegator, BigInt("1")); // Cannot reuse same nonce when delegating by sig - await expect(this.comp.delegateBySig(delegator, delegatee, nonce, expiry, signature)).to.be.revertedWithCustomError( - this.comp, - "SignatureNonceInvalid", - ); + await expect( + this.confidentialERC20Votes.delegateBySig(delegator, delegatee, nonce, expiry, signature), + ).to.be.revertedWithCustomError(this.confidentialERC20Votes, "SignatureNonceInvalid"); }); it("cannot delegate votes if signer is invalid", async function () { @@ -177,11 +231,16 @@ describe("Comp", function () { const expiry = block!.timestamp + 100; // Signer is not the delegator - const signature = await delegateBySig(this.signers.carol, delegatee.address, this.comp, nonce, expiry); - await expect(this.comp.delegateBySig(delegator, delegatee, nonce, expiry, signature)).to.be.revertedWithCustomError( - this.comp, - "SignatureVerificationFail", + const signature = await delegateBySig( + this.signers.carol, + delegatee.address, + this.confidentialERC20Votes, + nonce, + expiry, ); + await expect( + this.confidentialERC20Votes.delegateBySig(delegator, delegatee, nonce, expiry, signature), + ).to.be.revertedWithCustomError(this.confidentialERC20Votes, "SignatureVerificationFail"); }); it("cannot delegate votes if signature has expired", async function () { @@ -190,31 +249,32 @@ describe("Comp", function () { const nonce = 0; const block = await ethers.provider.getBlock(await ethers.provider.getBlockNumber()); const expiry = block!.timestamp + 100; - const signature = await delegateBySig(delegator, delegatee.address, this.comp, nonce, expiry); + const signature = await delegateBySig(delegator, delegatee.address, this.confidentialERC20Votes, nonce, expiry); await ethers.provider.send("evm_increaseTime", ["0xffff"]); await expect( - this.comp.connect(delegatee).delegateBySig(delegator, delegatee, nonce, expiry, signature), - ).to.be.revertedWithCustomError(this.comp, "SignatureExpired"); + this.confidentialERC20Votes.connect(delegatee).delegateBySig(delegator, delegatee, nonce, expiry, signature), + ).to.be.revertedWithCustomError(this.confidentialERC20Votes, "SignatureExpired"); }); it("cannot request votes if blocktime is equal to current blocktime", async function () { let blockNumber = await ethers.provider.getBlockNumber(); - await expect(this.comp.getPriorVotes(this.signers.alice, blockNumber + 1)).to.be.revertedWithCustomError( - this.comp, - "BlockNumberEqualOrHigherThanCurrentBlock", - ); + await expect( + this.confidentialERC20Votes.getPriorVotes(this.signers.alice, blockNumber + 1), + ).to.be.revertedWithCustomError(this.confidentialERC20Votes, "BlockNumberEqualOrHigherThanCurrentBlock"); - const tx = await this.comp.connect(this.signers.alice).setGovernor(this.signers.bob); - await expect(tx).to.emit(this.comp, "NewGovernor").withArgs(this.signers.bob); + const tx = await this.confidentialERC20Votes.connect(this.signers.alice).setGovernor(this.signers.bob); + await expect(tx).to.emit(this.confidentialERC20Votes, "NewGovernor").withArgs(this.signers.bob); blockNumber = await ethers.provider.getBlockNumber(); await expect( - this.comp.connect(this.signers.bob).getPriorVotesForGovernor(this.signers.alice, blockNumber + 1), - ).to.be.revertedWithCustomError(this.comp, "BlockNumberEqualOrHigherThanCurrentBlock"); + this.confidentialERC20Votes + .connect(this.signers.bob) + .getPriorVotesForGovernor(this.signers.alice, blockNumber + 1), + ).to.be.revertedWithCustomError(this.confidentialERC20Votes, "BlockNumberEqualOrHigherThanCurrentBlock"); }); it("users can request past votes getPriorVotes", async function () { @@ -225,7 +285,7 @@ describe("Comp", function () { input.add64(transferAmount); const encryptedTransferAmount = await input.encrypt(); - let tx = await this.comp["transfer(address,bytes32,bytes)"]( + let tx = await this.confidentialERC20Votes["transfer(address,bytes32,bytes)"]( this.signers.bob.address, encryptedTransferAmount.handles[0], encryptedTransferAmount.inputProof, @@ -233,7 +293,7 @@ describe("Comp", function () { await tx.wait(); - tx = await this.comp["transfer(address,bytes32,bytes)"]( + tx = await this.confidentialERC20Votes["transfer(address,bytes32,bytes)"]( this.signers.carol.address, encryptedTransferAmount.handles[0], encryptedTransferAmount.inputProof, @@ -241,7 +301,7 @@ describe("Comp", function () { await tx.wait(); - tx = await this.comp["transfer(address,bytes32,bytes)"]( + tx = await this.confidentialERC20Votes["transfer(address,bytes32,bytes)"]( this.signers.dave.address, encryptedTransferAmount.handles[0], encryptedTransferAmount.inputProof, @@ -249,13 +309,13 @@ describe("Comp", function () { await tx.wait(); - tx = await this.comp.connect(this.signers.bob).delegate(this.signers.dave.address); + tx = await this.confidentialERC20Votes.connect(this.signers.bob).delegate(this.signers.dave.address); await tx.wait(); const firstCheckPointBlockNumber = await ethers.provider.getBlockNumber(); await waitNBlocks(1); - tx = await this.comp.connect(this.signers.carol).delegate(this.signers.dave.address); + tx = await this.confidentialERC20Votes.connect(this.signers.carol).delegate(this.signers.dave.address); await tx.wait(); const secondCheckPointBlockNumber = await ethers.provider.getBlockNumber(); @@ -267,7 +327,7 @@ describe("Comp", function () { this.instances, "dave", firstCheckPointBlockNumber, - this.comp, + this.confidentialERC20Votes, this.compAddress, ), ).to.be.equal(parseUnits(String(1_000_000), 6)); @@ -278,7 +338,7 @@ describe("Comp", function () { this.instances, "dave", secondCheckPointBlockNumber, - this.comp, + this.confidentialERC20Votes, this.compAddress, ), ).to.be.equal(parseUnits(String(2_000_000), 6)); @@ -286,31 +346,33 @@ describe("Comp", function () { it("only governor contract can call getPriorVotes", async function () { await expect( - this.comp.getPriorVotesForGovernor("0xE359a77c3bFE58792FB167D05720e37032A1e520", 0), - ).to.be.revertedWithCustomError(this.comp, "GovernorInvalid"); + this.confidentialERC20Votes.getPriorVotesForGovernor("0xE359a77c3bFE58792FB167D05720e37032A1e520", 0), + ).to.be.revertedWithCustomError(this.confidentialERC20Votes, "GovernorInvalid"); }); it("only owner can set governor contract", async function () { const newAllowedContract = "0x9d3e06a2952dc49EDCc73e41C76645797fC53967"; - await expect(this.comp.connect(this.signers.bob).setGovernor(newAllowedContract)) - .to.be.revertedWithCustomError(this.comp, "OwnableUnauthorizedAccount") + await expect(this.confidentialERC20Votes.connect(this.signers.bob).setGovernor(newAllowedContract)) + .to.be.revertedWithCustomError(this.confidentialERC20Votes, "OwnableUnauthorizedAccount") .withArgs(this.signers.bob.address); }); it("getCurrentVote/getPriorVotes without any vote cannot be decrypted", async function () { // 1. If no checkpoint exists using getCurrentVotes - let currentVoteHandle = await this.comp.connect(this.signers.bob).getCurrentVotes(this.signers.bob.address); + let currentVoteHandle = await this.confidentialERC20Votes + .connect(this.signers.bob) + .getCurrentVotes(this.signers.bob.address); expect(currentVoteHandle).to.be.eq(0n); await expect( - reencryptEuint64(this.signers, this.instances, "bob", currentVoteHandle, this.comp), + reencryptEuint64(this.signers, this.instances, "bob", currentVoteHandle, this.confidentialERC20Votes), ).to.be.rejectedWith("Handle is not initialized"); // 2. If no checkpoint exists using getPriorVotes let latestBlockNumber = await ethers.provider.getBlockNumber(); await waitNBlocks(1); - currentVoteHandle = await this.comp + currentVoteHandle = await this.confidentialERC20Votes .connect(this.signers.bob) .getPriorVotes(this.signers.bob.address, latestBlockNumber); @@ -318,17 +380,17 @@ describe("Comp", function () { expect(currentVoteHandle).not.to.be.eq(0n); await expect( - reencryptEuint64(this.signers, this.instances, "bob", currentVoteHandle, this.comp), + reencryptEuint64(this.signers, this.instances, "bob", currentVoteHandle, this.confidentialERC20Votes), ).to.be.rejectedWith("Invalid contract address."); // 3. If a checkpoint exists using getPriorVotes but block.number < block of first checkpoint latestBlockNumber = await ethers.provider.getBlockNumber(); await waitNBlocks(1); - const tx = await this.comp.connect(this.signers.alice).delegate(this.signers.bob.address); + const tx = await this.confidentialERC20Votes.connect(this.signers.alice).delegate(this.signers.bob.address); await tx.wait(); - currentVoteHandle = await this.comp + currentVoteHandle = await this.confidentialERC20Votes .connect(this.signers.bob) .getPriorVotes(this.signers.bob.address, latestBlockNumber); @@ -336,7 +398,7 @@ describe("Comp", function () { expect(currentVoteHandle).not.to.be.eq(0n); await expect( - reencryptEuint64(this.signers, this.instances, "bob", currentVoteHandle, this.comp), + reencryptEuint64(this.signers, this.instances, "bob", currentVoteHandle, this.confidentialERC20Votes), ).to.be.rejectedWith("Invalid contract address."); }); @@ -348,11 +410,11 @@ describe("Comp", function () { const thisBlockNumber = await ethers.provider.getBlockNumber(); while (i < 20) { - let tx = await this.comp.connect(this.signers.alice).delegate(this.signers.alice.address); + let tx = await this.confidentialERC20Votes.connect(this.signers.alice).delegate(this.signers.alice.address); await tx.wait(); blockNumbers.push(await ethers.provider.getBlockNumber()); - tx = await this.comp.connect(this.signers.alice).delegate(this.signers.carol.address); + tx = await this.confidentialERC20Votes.connect(this.signers.alice).delegate(this.signers.carol.address); await tx.wait(); blockNumbers.push(await ethers.provider.getBlockNumber()); i++; @@ -361,8 +423,8 @@ describe("Comp", function () { await waitNBlocks(1); // There are 40 checkpoints for Alice and 39 checkpoints for Carol - expect(await this.comp.numCheckpoints(this.signers.alice.address)).to.eq(BigInt(40)); - expect(await this.comp.numCheckpoints(this.signers.carol.address)).to.eq(BigInt(39)); + expect(await this.confidentialERC20Votes.numCheckpoints(this.signers.alice.address)).to.eq(BigInt(40)); + expect(await this.confidentialERC20Votes.numCheckpoints(this.signers.carol.address)).to.eq(BigInt(39)); i = 0; @@ -376,7 +438,7 @@ describe("Comp", function () { this.instances, startWithAlice ? "alice" : "carol", blockNumbers[i], - this.comp, + this.confidentialERC20Votes, this.compAddress, ), ).to.be.eq(parseUnits(String(10_000_000), 6)); @@ -387,7 +449,7 @@ describe("Comp", function () { this.instances, startWithAlice ? "carol" : "alice", blockNumbers[i], - this.comp, + this.confidentialERC20Votes, this.compAddress, ), ).to.be.eq(parseUnits(String(10_000_000), 6)); @@ -398,11 +460,11 @@ describe("Comp", function () { it("governor address can access votes for any account", async function () { // Bob becomes the governor address. - let tx = await this.comp.connect(this.signers.alice).setGovernor(this.signers.bob.address); - await expect(tx).to.emit(this.comp, "NewGovernor").withArgs(this.signers.bob); + let tx = await this.confidentialERC20Votes.connect(this.signers.alice).setGovernor(this.signers.bob.address); + await expect(tx).to.emit(this.confidentialERC20Votes, "NewGovernor").withArgs(this.signers.bob); // Alice delegates her votes to Carol. - tx = await this.comp.connect(this.signers.alice).delegate(this.signers.carol.address); + tx = await this.confidentialERC20Votes.connect(this.signers.alice).delegate(this.signers.carol.address); await tx.wait(); const latestBlockNumber = await ethers.provider.getBlockNumber(); @@ -412,7 +474,7 @@ describe("Comp", function () { // Bob, the governor address, gets the prior votes of Carol. // @dev It is not possible to catch the return value since it is not a view function. // GovernorAlphaZama.test.ts contains tests that use this function. - await this.comp + await this.confidentialERC20Votes .connect(this.signers.bob) .getPriorVotesForGovernor(this.signers.carol.address, latestBlockNumber + 1); }); @@ -424,7 +486,7 @@ describe("Comp", function () { input.add64(transferAmount); const encryptedTransferAmount = await input.encrypt(); - let tx = await this.comp["transfer(address,bytes32,bytes)"]( + let tx = await this.confidentialERC20Votes["transfer(address,bytes32,bytes)"]( this.signers.bob.address, encryptedTransferAmount.handles[0], encryptedTransferAmount.inputProof, @@ -432,22 +494,31 @@ describe("Comp", function () { await tx.wait(); - tx = await this.comp.connect(this.signers.alice).delegate(this.signers.carol); + tx = await this.confidentialERC20Votes.connect(this.signers.alice).delegate(this.signers.carol); await tx.wait(); - tx = await this.comp.connect(this.signers.bob).delegate(this.signers.carol); + tx = await this.confidentialERC20Votes.connect(this.signers.bob).delegate(this.signers.carol); await tx.wait(); const latestBlockNumber = await ethers.provider.getBlockNumber(); await waitNBlocks(1); - expect(await reencryptCurrentVotes(this.signers, this.instances, "carol", this.comp, this.compAddress)).to.equal( - parseUnits(String(10_000_000), 6), - ); + expect( + await reencryptCurrentVotes(this.signers, this.instances, "carol", this.confidentialERC20Votes, this.compAddress), + ).to.equal(parseUnits(String(10_000_000), 6)); expect( - await reencryptPriorVotes(this.signers, this.instances, "carol", latestBlockNumber, this.comp, this.compAddress), - ).to.equal(await reencryptCurrentVotes(this.signers, this.instances, "carol", this.comp, this.compAddress)); + await reencryptPriorVotes( + this.signers, + this.instances, + "carol", + latestBlockNumber, + this.confidentialERC20Votes, + this.compAddress, + ), + ).to.equal( + await reencryptCurrentVotes(this.signers, this.instances, "carol", this.confidentialERC20Votes, this.compAddress), + ); }); // TODO: fix issue with mining @@ -456,21 +527,23 @@ describe("Comp", function () { await network.provider.send("evm_setIntervalMining", [0]); // do two checkpoints in same block - const tx1 = this.comp.connect(this.signers.alice).delegate(this.signers.bob); - const tx2 = this.comp.connect(this.signers.alice).delegate(this.signers.carol); + const tx1 = this.confidentialERC20Votes.connect(this.signers.alice).delegate(this.signers.bob); + const tx2 = this.confidentialERC20Votes.connect(this.signers.alice).delegate(this.signers.carol); await network.provider.send("evm_mine"); await network.provider.send("evm_setAutomine", [true]); await Promise.all([tx1, tx2]); - expect(await this.comp.numCheckpoints(this.signers.alice.address)).to.be.equal(0n); - expect(await this.comp.numCheckpoints(this.signers.bob.address)).to.be.equal(1n); - expect(await this.comp.numCheckpoints(this.signers.carol.address)).to.be.equal(1n); + expect(await this.confidentialERC20Votes.numCheckpoints(this.signers.alice.address)).to.be.equal(0n); + expect(await this.confidentialERC20Votes.numCheckpoints(this.signers.bob.address)).to.be.equal(1n); + expect(await this.confidentialERC20Votes.numCheckpoints(this.signers.carol.address)).to.be.equal(1n); - expect(await reencryptCurrentVotes(this.signers, this.instances, "bob", this.comp, this.compAddress)).to.equal(0); + expect( + await reencryptCurrentVotes(this.signers, this.instances, "bob", this.confidentialERC20Votes, this.compAddress), + ).to.equal(0); - expect(await reencryptCurrentVotes(this.signers, this.instances, "carol", this.comp, this.compAddress)).to.equal( - parseUnits(String(10_000_000), 6), - ); + expect( + await reencryptCurrentVotes(this.signers, this.instances, "carol", this.confidentialERC20Votes, this.compAddress), + ).to.equal(parseUnits(String(10_000_000), 6)); }); }); diff --git a/test/governance/DelegateBySig.ts b/test/governance/DelegateBySig.ts index 5ec02b5..72c993d 100644 --- a/test/governance/DelegateBySig.ts +++ b/test/governance/DelegateBySig.ts @@ -2,13 +2,13 @@ import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; import { ethers } from "hardhat"; import { Address } from "hardhat-deploy/types"; -import type { Comp } from "../../types"; +import type { ConfidentialERC20Votes } from "../../types"; /** * * @param _signer Signer from ethers. * @param _delegatee Delegatee address. - * @param _comp Comp token. + * @param _comp ConfidentialERC20Votes token. * @param _nonce Nonce to sign. * @param _expiry Expiry timestamp. * @returns The signature. @@ -16,7 +16,7 @@ import type { Comp } from "../../types"; export const delegateBySig = async ( _signer: HardhatEthersSigner, _delegatee: Address, - _comp: Comp, + _comp: ConfidentialERC20Votes, _nonce: number, _expiry: number, ): Promise => { diff --git a/test/governance/GovernorAlphaZama.test.ts b/test/governance/GovernorAlphaZama.test.ts index 4a1bfd4..da90a92 100644 --- a/test/governance/GovernorAlphaZama.test.ts +++ b/test/governance/GovernorAlphaZama.test.ts @@ -6,7 +6,7 @@ import { awaitAllDecryptionResults } from "../asyncDecrypt"; import { createInstances } from "../instance"; import { getSigners, initSigners } from "../signers"; import { mineNBlocks } from "../utils"; -import { deployCompFixture, transferTokensAndDelegate } from "./Comp.fixture"; +import { deployConfidentialERC20Votes, transferTokensAndDelegate } from "./ConfidentialERC20Votes.fixture"; import { deployGovernorAlphaZamaFixture, deployTimelockFixture, @@ -20,8 +20,8 @@ describe("GovernorAlphaZama", function () { }); beforeEach(async function () { - const contract = await deployCompFixture(this.signers); - this.comp = contract; + const contract = await deployConfidentialERC20Votes(this.signers); + this.confidentialERC20Votes = contract; this.compAddress = await contract.getAddress(); this.instances = await createInstances(this.signers); @@ -38,7 +38,7 @@ describe("GovernorAlphaZama", function () { this.governor = governor; this.governorAddress = await governor.getAddress(); - const tx = await this.comp.setGovernor(this.governorAddress); + const tx = await this.confidentialERC20Votes.setGovernor(this.governorAddress); await tx.wait(); this.VOTING_DELAY = await this.governor.VOTING_DELAY(); @@ -60,7 +60,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -116,7 +116,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -156,7 +156,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -166,7 +166,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "carol", "carol", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -305,7 +305,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -379,7 +379,7 @@ describe("GovernorAlphaZama", function () { transferAmountFor, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -389,7 +389,7 @@ describe("GovernorAlphaZama", function () { transferAmountAgainst, "carol", "carol", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -621,7 +621,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -651,7 +651,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -680,7 +680,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -741,7 +741,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -765,7 +765,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "carol", "carol", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -804,7 +804,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "dave", "dave", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -873,7 +873,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -938,7 +938,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -982,7 +982,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -1035,7 +1035,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, ); @@ -1079,7 +1079,7 @@ describe("GovernorAlphaZama", function () { transferAmount, "bob", "bob", - this.comp, + this.confidentialERC20Votes, this.compAddress, );