From d42da2078ee22f51f978655bc55d8828606e8422 Mon Sep 17 00:00:00 2001 From: neokry Date: Wed, 13 Dec 2023 12:49:44 -0800 Subject: [PATCH] Fix formatting --- src/governance/governor/Governor.sol | 23 ++++++++++++-- src/governance/governor/IGovernor.sol | 15 ++++++++-- test/Gov.t.sol | 24 +++++++++++++-- test/Token.t.sol | 43 ++++++++++++++++++++++----- test/utils/NounsBuilderTest.sol | 19 ++++++++++-- 5 files changed, 106 insertions(+), 18 deletions(-) diff --git a/src/governance/governor/Governor.sol b/src/governance/governor/Governor.sol index 5e0a234..207ab09 100644 --- a/src/governance/governor/Governor.sol +++ b/src/governance/governor/Governor.sol @@ -218,7 +218,11 @@ contract Governor is IGovernor, VersionedContract, UUPS, Ownable, EIP712, Propos /// @param _proposalId The proposal id /// @param _support The support value (0 = Against, 1 = For, 2 = Abstain) /// @param _reason The vote reason - function castVoteWithReason(bytes32 _proposalId, uint256 _support, string memory _reason) external returns (uint256) { + function castVoteWithReason( + bytes32 _proposalId, + uint256 _support, + string memory _reason + ) external returns (uint256) { return _castVote(_proposalId, msg.sender, _support, _reason); } @@ -270,7 +274,12 @@ contract Governor is IGovernor, VersionedContract, UUPS, Ownable, EIP712, Propos /// @param _proposalId The proposal id /// @param _voter The voter address /// @param _support The vote choice - function _castVote(bytes32 _proposalId, address _voter, uint256 _support, string memory _reason) internal returns (uint256) { + function _castVote( + bytes32 _proposalId, + address _voter, + uint256 _support, + string memory _reason + ) internal returns (uint256) { // Ensure voting is active if (state(_proposalId) != ProposalState.Active) revert VOTING_NOT_STARTED(); @@ -518,7 +527,15 @@ contract Governor is IGovernor, VersionedContract, UUPS, Ownable, EIP712, Propos /// @notice The vote counts for a proposal /// @param _proposalId The proposal id - function proposalVotes(bytes32 _proposalId) external view returns (uint256, uint256, uint256) { + function proposalVotes(bytes32 _proposalId) + external + view + returns ( + uint256, + uint256, + uint256 + ) + { Proposal memory proposal = proposals[_proposalId]; return (proposal.againstVotes, proposal.forVotes, proposal.abstainVotes); diff --git a/src/governance/governor/IGovernor.sol b/src/governance/governor/IGovernor.sol index f844cec..679b105 100644 --- a/src/governance/governor/IGovernor.sol +++ b/src/governance/governor/IGovernor.sol @@ -170,7 +170,11 @@ interface IGovernor is IUUPS, IOwnable, IEIP712, GovernorTypesV1 { /// @param proposalId The proposal id /// @param support The support value (0 = Against, 1 = For, 2 = Abstain) /// @param reason The vote reason - function castVoteWithReason(bytes32 proposalId, uint256 support, string memory reason) external returns (uint256); + function castVoteWithReason( + bytes32 proposalId, + uint256 support, + string memory reason + ) external returns (uint256); /// @notice Casts a signed vote /// @param voter The voter address @@ -245,7 +249,14 @@ interface IGovernor is IUUPS, IOwnable, IEIP712, GovernorTypesV1 { /// @notice The vote counts for a proposal /// @param proposalId The proposal id - function proposalVotes(bytes32 proposalId) external view returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes); + function proposalVotes(bytes32 proposalId) + external + view + returns ( + uint256 againstVotes, + uint256 forVotes, + uint256 abstainVotes + ); /// @notice The timestamp valid to execute a proposal /// @param proposalId The proposal id diff --git a/test/Gov.t.sol b/test/Gov.t.sol index cc5cc42..cff994e 100644 --- a/test/Gov.t.sol +++ b/test/Gov.t.sol @@ -150,7 +150,12 @@ contract GovTest is NounsBuilderTest, GovernorTypesV1 { vm.warp(block.timestamp + 20); } - function castVotes(bytes32 _proposalId, uint256 _numAgainst, uint256 _numFor, uint256 _numAbstain) internal { + function castVotes( + bytes32 _proposalId, + uint256 _numAgainst, + uint256 _numFor, + uint256 _numAbstain + ) internal { uint256 currentVoterIndex; for (uint256 i = 0; i < _numAgainst; ++i) { @@ -175,7 +180,15 @@ contract GovTest is NounsBuilderTest, GovernorTypesV1 { } } - function mockProposal() internal view returns (address[] memory targets, uint256[] memory values, bytes[] memory calldatas) { + function mockProposal() + internal + view + returns ( + address[] memory targets, + uint256[] memory values, + bytes[] memory calldatas + ) + { targets = new address[](1); values = new uint256[](1); calldatas = new bytes[](1); @@ -201,7 +214,12 @@ contract GovTest is NounsBuilderTest, GovernorTypesV1 { proposalId = governor.propose(targets, values, calldatas, ""); } - function createProposal(address _proposer, address _target, uint256 _value, bytes memory _calldata) internal returns (bytes32 proposalId) { + function createProposal( + address _proposer, + address _target, + uint256 _value, + bytes memory _calldata + ) internal returns (bytes32 proposalId) { deployMock(); address[] memory targets = new address[](1); diff --git a/test/Token.t.sol b/test/Token.t.sol index 52aab8a..0175cc0 100644 --- a/test/Token.t.sol +++ b/test/Token.t.sol @@ -53,7 +53,11 @@ contract TokenTest is NounsBuilderTest, TokenTypesV1 { } /// Test that the percentages for founders all ends up as expected - function test_FounderShareAllocationFuzz(uint256 f1Percentage, uint256 f2Percentage, uint256 f3Percentage) public { + function test_FounderShareAllocationFuzz( + uint256 f1Percentage, + uint256 f2Percentage, + uint256 f3Percentage + ) public { address f1Wallet = address(0x1); address f2Wallet = address(0x2); address f3Wallet = address(0x3); @@ -457,7 +461,11 @@ contract TokenTest is NounsBuilderTest, TokenTypesV1 { assertEq(token.ownerOf(tokenId), newMinter); } - function testRevert_OnlyMinterCanMintToRecipient(address newMinter, address nonMinter, address recipient) public { + function testRevert_OnlyMinterCanMintToRecipient( + address newMinter, + address nonMinter, + address recipient + ) public { deployMock(); vm.assume( newMinter != nonMinter && newMinter != founder && newMinter != address(0) && newMinter != address(auction) && recipient != address(0) @@ -478,7 +486,12 @@ contract TokenTest is NounsBuilderTest, TokenTypesV1 { assertEq(token.ownerOf(tokenId), recipient); } - function testRevert_OnlyMinterCanMintBatch(address newMinter, address nonMinter, address recipient, uint256 amount) public { + function testRevert_OnlyMinterCanMintBatch( + address newMinter, + address nonMinter, + address recipient, + uint256 amount + ) public { deployMock(); vm.assume( @@ -649,7 +662,11 @@ contract TokenTest is NounsBuilderTest, TokenTypesV1 { assertEq(token.getFounders().length, 1); } - function test_UpdateFounderShareAllocationFuzz(uint256 f1Percentage, uint256 f2Percentage, uint256 f3Percentage) public { + function test_UpdateFounderShareAllocationFuzz( + uint256 f1Percentage, + uint256 f2Percentage, + uint256 f3Percentage + ) public { deployMock(); address f1Wallet = address(0x1); @@ -830,7 +847,11 @@ contract TokenTest is NounsBuilderTest, TokenTypesV1 { token.ownerOf(tokenId); } - function test_MinterCanMintFromReserve(address _minter, uint256 _reservedUntilTokenId, uint256 _tokenId) public { + function test_MinterCanMintFromReserve( + address _minter, + uint256 _reservedUntilTokenId, + uint256 _tokenId + ) public { deployAltMock(_reservedUntilTokenId); vm.assume(_minter != founder && _minter != address(0) && _minter != address(auction)); @@ -848,7 +869,11 @@ contract TokenTest is NounsBuilderTest, TokenTypesV1 { assertEq(token.ownerOf(_tokenId), minters[0].minter); } - function testRevert_MinterCannotMintPastReserve(address _minter, uint256 _reservedUntilTokenId, uint256 _tokenId) public { + function testRevert_MinterCannotMintPastReserve( + address _minter, + uint256 _reservedUntilTokenId, + uint256 _tokenId + ) public { deployAltMock(_reservedUntilTokenId); vm.assume(_minter != founder && _minter != address(0) && _minter != address(auction)); @@ -890,7 +915,11 @@ contract TokenTest is NounsBuilderTest, TokenTypesV1 { } } - function test_BatchMintCannotMintReserves(address _minter, uint256 _reservedUntilTokenId, uint256 _amount) public { + function test_BatchMintCannotMintReserves( + address _minter, + uint256 _reservedUntilTokenId, + uint256 _amount + ) public { deployAltMock(_reservedUntilTokenId); vm.assume(_minter != founder && _minter != address(0) && _minter != address(auction)); diff --git a/test/utils/NounsBuilderTest.sol b/test/utils/NounsBuilderTest.sol index 9e16fab..8212977 100644 --- a/test/utils/NounsBuilderTest.sol +++ b/test/utils/NounsBuilderTest.sol @@ -102,7 +102,11 @@ contract NounsBuilderTest is Test { setFounderParams(wallets, percents, vestingEnds); } - function setFounderParams(address[] memory _wallets, uint256[] memory _percents, uint256[] memory _vestingEnds) internal virtual { + function setFounderParams( + address[] memory _wallets, + uint256[] memory _percents, + uint256[] memory _vestingEnds + ) internal virtual { uint256 numFounders = _wallets.length; require(numFounders == _percents.length && numFounders == _vestingEnds.length); @@ -178,7 +182,12 @@ contract NounsBuilderTest is Test { setAuctionParams(0.01 ether, 10 minutes, address(0), 0); } - function setAuctionParams(uint256 _reservePrice, uint256 _duration, address _founderRewardRecipent, uint16 _founderRewardBps) internal virtual { + function setAuctionParams( + uint256 _reservePrice, + uint256 _duration, + address _founderRewardRecipent, + uint16 _founderRewardBps + ) internal virtual { auctionParams = IManager.AuctionParams({ reservePrice: _reservePrice, duration: _duration, @@ -247,7 +256,11 @@ contract NounsBuilderTest is Test { setMockMetadata(); } - function deployWithCustomFounders(address[] memory _wallets, uint256[] memory _percents, uint256[] memory _vestExpirys) internal virtual { + function deployWithCustomFounders( + address[] memory _wallets, + uint256[] memory _percents, + uint256[] memory _vestExpirys + ) internal virtual { setFounderParams(_wallets, _percents, _vestExpirys); setMockTokenParams();