Hi, I am working with OZ's Governance contracts and has started from the template governance contract the OZ's Wizard generated (non-compound). I am trying to add some custom functions on top on the standard that inheriting the OZ governance contracts provides. In particular, I am trying to add a custom execute
function. It has mostly the same components as the default execute function, except with different ProposalState
conditions.
My issue comes from trying to implement this line
_proposals[proposalId].executed = true;
which is the same as the default execute function. The problem is that _proposals
is a private
mapping and so not visible on my inherited level of code. I am trying my best to stick to the intended way of using OZ's contracts, which is to import, add functionality (if needed) and use. Which is to say to not alter OZ's contract code. But the private mapping _proposals
is making this hard.
What are your recommendations such that I can implement my custom execute function? Something like a getter for _proposals
(I cant find one in OZ contracts)? Here is that custom function:
function customExecute(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 descriptionHash
) external payable returns (uint256) {
uint256 proposalId = hashProposal(
targets,
values,
calldatas,
descriptionHash
);
ProposalState status = state(proposalId);
require(
status == ProposalState.Expired,
"Governor: proposal not expired"
);
_proposals[proposalId].executed = true; // <----- not visible
emit ProposalExecuted(proposalId);
_execute(proposalId, targets, values, calldatas, descriptionHash);
return proposalId;
}