From b63bdfa6def7109975a6d9ee63cc00a86ade21cd Mon Sep 17 00:00:00 2001 From: MSalman6 Date: Thu, 29 Aug 2024 01:03:41 +0500 Subject: [PATCH] only use value from governancePot if proposal type is Open --- contracts/DiamondDao.sol | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/contracts/DiamondDao.sol b/contracts/DiamondDao.sol index 398341b..4bc3615 100644 --- a/contracts/DiamondDao.sol +++ b/contracts/DiamondDao.sol @@ -360,7 +360,7 @@ contract DiamondDao is IDiamondDao, Initializable, ReentrancyGuardUpgradeable, V proposal.state = ProposalState.Executed; - _executeOperations(proposal.targets, proposal.values, proposal.calldatas); + _executeOperations(proposal.targets, proposal.values, proposal.calldatas, proposal.proposalType); emit ProposalExecuted(msg.sender, proposalId); } @@ -515,17 +515,19 @@ contract DiamondDao is IDiamondDao, Initializable, ReentrancyGuardUpgradeable, V function _executeOperations( address[] memory targets, uint256[] memory values, - bytes[] memory calldatas + bytes[] memory calldatas, + ProposalType proposalType ) private { for (uint256 i = 0; i < targets.length; ++i) { - (bool success, bytes memory returndata) = targets[i].call{ value: values[i] }( + uint256 execValue = proposalType == ProposalType.Open ? values[i] : 0; + (bool success, bytes memory returndata) = targets[i].call{ value: execValue }( calldatas[i] ); Address.verifyCallResult(success, returndata); - if (values[i] != 0) { - governancePot -= values[i]; + if (execValue != 0) { + governancePot -= execValue; } } }