From cc729c0c74275702734de356e9bee7120698f0a2 Mon Sep 17 00:00:00 2001 From: Same Perkins Date: Mon, 4 Sep 2023 17:28:12 -0400 Subject: [PATCH] chore: Rename Tx to Proposal --- src/Chamber.sol | 4 ++-- src/interfaces/IChamber.sol | 4 ++-- test/Chamber.t.sol | 8 ++++---- test/lifecycle/ProposalCycle.t.sol | 20 ++++++++++---------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Chamber.sol b/src/Chamber.sol index 0f35660..5df6dc0 100644 --- a/src/Chamber.sol +++ b/src/Chamber.sol @@ -126,7 +126,7 @@ contract Chamber is IChamber, LinkedList, ReentrancyGuard, Context, ERC721Holder } /// @inheritdoc IChamber - function createTx(address[] memory _target, uint256[] memory _value, bytes[] memory _data) external { + function createProposal(address[] memory _target, uint256[] memory _value, bytes[] memory _data) external { if(IERC721(memberToken).balanceOf(_msgSender()) < 1) revert insufficientBalance(); proposalCount++; @@ -143,7 +143,7 @@ contract Chamber is IChamber, LinkedList, ReentrancyGuard, Context, ERC721Holder } /// @inheritdoc IChamber - function approveTx(uint256 _proposalId, uint256 _tokenId) external { + function approveProposal(uint256 _proposalId, uint256 _tokenId) external { if(_msgSender() != IERC721(memberToken).ownerOf(_tokenId)) revert invalidApproval("Sender isn't owner"); if(proposals[_proposalId].state != State.Initialized) revert invalidApproval("Proposal isn't Initialized"); if(voted[_proposalId][_tokenId]) revert invalidApproval("TokenID aleready voted"); diff --git a/src/interfaces/IChamber.sol b/src/interfaces/IChamber.sol index 3f9f1b2..d3615a8 100644 --- a/src/interfaces/IChamber.sol +++ b/src/interfaces/IChamber.sol @@ -95,7 +95,7 @@ interface IChamber { * @param _proposalId The ID of the proposal to approve * @param _tokenId The ID of the NFT to vote */ - function approveTx(uint256 _proposalId, uint256 _tokenId) external; + function approveProposal(uint256 _proposalId, uint256 _tokenId) external; /** * @notice create Proposal function @@ -103,7 +103,7 @@ interface IChamber { * @param _value The uint256 amount of ETH to send with transaction * @param _data The bytes[] of transaction data */ - function createTx(address[] memory _target, uint256[] memory _value, bytes[] memory _data) external; + function createProposal(address[] memory _target, uint256[] memory _value, bytes[] memory _data) external; /** * @notice Stakes a given amount of "stakingToken" against the provided NFT ID diff --git a/test/Chamber.t.sol b/test/Chamber.t.sol index 97f262b..cfac865 100644 --- a/test/Chamber.t.sol +++ b/test/Chamber.t.sol @@ -71,16 +71,16 @@ contract ChamberTest is Test, TestUtilities { valueArray[2] = 10 ether; valueArray[3] = 5 ether; - chamber.createTx(targetArray, valueArray, dataArray); + chamber.createProposal(targetArray, valueArray, dataArray); // Approve Proposal - chamber.approveTx(1, 3); - chamber.approveTx(1, 2); + chamber.approveProposal(1, 3); + chamber.approveProposal(1, 2); // Execute Proposal - chamber.approveTx(1, 1); + chamber.approveProposal(1, 1); } diff --git a/test/lifecycle/ProposalCycle.t.sol b/test/lifecycle/ProposalCycle.t.sol index 05d99e9..c405d86 100644 --- a/test/lifecycle/ProposalCycle.t.sol +++ b/test/lifecycle/ProposalCycle.t.sol @@ -115,16 +115,16 @@ contract ProposalTest is Test { targetArray1[0] = address(chamber); valueArray1[0] = 1 ether; - chamber.createTx(targetArray1, valueArray1, dataArray1); + chamber.createProposal(targetArray1, valueArray1, dataArray1); assertEq(chamber.proposalCount(), 1); // 2. nft holder without stake should not be able to approve transaction vm.expectRevert(); - chamber.approveTx(1, 8); + chamber.approveProposal(1, 8); // 3. nft holder should not be able to approve transaction using unowned tokenId vm.expectRevert(); - chamber.approveTx(1, 5); + chamber.approveProposal(1, 5); vm.stopPrank(); @@ -167,7 +167,7 @@ contract ProposalTest is Test { valueArray[5] = 0; valueArray[6] = 0; - chamber.createTx(targetArray, valueArray, dataArray); + chamber.createProposal(targetArray, valueArray, dataArray); assertEq(chamber.proposalCount(), 2); (votes, state) = chamber.proposals(2); assertEq(votes, 0); @@ -175,25 +175,25 @@ contract ProposalTest is Test { // 4. nft holder should not be able to approve if not a leader vm.expectRevert(); - chamber.approveTx(1, 1); + chamber.approveProposal(1, 1); vm.stopPrank(); // 5. Leaders should be able to approve transaction vm.prank(danny); - chamber.approveTx(2, 5); + chamber.approveProposal(2, 5); (votes, state) = chamber.proposals(2); assertEq(votes, 1); assertTrue(state == IChamber.State.Initialized); vm.prank(shifty); - chamber.approveTx(2, 6); + chamber.approveProposal(2, 6); (votes, state) = chamber.proposals(2); assertEq(votes, 2); assertTrue(state == IChamber.State.Initialized); // 6. Quorum of leaders should execute proposal vm.prank(blackbeard); - chamber.approveTx(2, 7); + chamber.approveProposal(2, 7); (votes, state) = chamber.proposals(2); assertEq(votes, 3); assertTrue(state == IChamber.State.Executed); @@ -211,14 +211,14 @@ contract ProposalTest is Test { assertEq(chamber.getUserStakeIndividualNFT(bones, 1), 43333 ether); vm.expectRevert(); - chamber.approveTx(1, 1); + chamber.approveProposal(1, 1); vm.stopPrank(); // 8. nft holder that unstaked erc20 should be able to approve vm.startPrank(jack); chamber.unstake(33333 ether, 4); helperLogger(); - chamber.approveTx(1, 4); + chamber.approveProposal(1, 4); vm.stopPrank(); } } \ No newline at end of file