Document "duplicate" proposal storing in GovernorCompatibilityBravo (#4073)

Co-authored-by: Francisco <fg@frang.io>
pull/4074/head
Hadrien Croubois 2 years ago committed by GitHub
parent b4d765b130
commit 8a43ebac28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      contracts/governance/compatibility/GovernorCompatibilityBravo.sol

@ -55,6 +55,7 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
bytes[] memory calldatas,
string memory description
) public virtual override(IGovernor, Governor) returns (uint256) {
// Stores the proposal details (if not already present) and executes the propose logic from the core.
_storeProposal(_msgSender(), targets, values, new string[](calldatas.length), calldatas, description);
return super.propose(targets, values, calldatas, description);
}
@ -69,6 +70,10 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
bytes[] memory calldatas,
string memory description
) public virtual override returns (uint256) {
// Stores the full proposal and fallback to the public (possibly overridden) propose. The fallback is done
// after the full proposal is stored, so the store operation included in the fallback will be skipped. Here we
// call `propose` and not `super.propose` to make sure if a child contract override `propose`, whatever code
// is added their is also executed when calling this alternative interface.
_storeProposal(_msgSender(), targets, values, signatures, calldatas, description);
return propose(targets, values, _encodeCalldata(signatures, calldatas), description);
}
@ -174,7 +179,7 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
}
/**
* @dev Store proposal metadata for later lookup
* @dev Store proposal metadata (if not already present) for later lookup.
*/
function _storeProposal(
address proposer,

Loading…
Cancel
Save