Skip to content

Commit

Permalink
only use value from governancePot if proposal type is Open
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalman6 committed Aug 28, 2024
1 parent d2fd833 commit b63bdfa
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions contracts/DiamondDao.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit b63bdfa

Please sign in to comment.