Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
2c4ac9d
fix(c4-117-g03): state variables should be cached in stack variables
tmigone Oct 24, 2022
76865a4
fix(c4-117-g05): require()/revert() strings longer than 32 bytes cost…
tmigone Oct 24, 2022
18afb3a
fix(c4-117-g06): keccak256() should only need to be called on a speci…
tmigone Oct 24, 2022
ee5d3cb
fix(c4-117-g11): using > 0 costs more gas than != 0 when used on a ui…
tmigone Oct 24, 2022
71314dd
fix(c4-117-g12): splitting require() statements that use && saves gas
tmigone Oct 24, 2022
d5aece4
fix(c4-117-g15): require() or revert() statements that check input ar…
tmigone Oct 24, 2022
2ad9f4e
fix(c4-6-g07): expressions for constant values such as a call to kecc…
tmigone Oct 24, 2022
e0440a8
fix(c4-6-g08): duplicated require()/revert() checks should be refacto…
tmigone Oct 24, 2022
3805ca9
fix(c4-6-13): use calldata instead of memory for function parameters
tmigone Oct 24, 2022
54157a7
fix(c4-86-g07): emitting or returning storage values
tmigone Oct 24, 2022
7d29d6d
fix(c4-172-g02): set allowance to 0 instead of decreasing allowance b…
tmigone Oct 24, 2022
534d224
fix(c4-287-g01): remove unused local variable
tmigone Oct 24, 2022
0b7ad55
fix(c4-272): remove unnecessary use of safe math
tmigone Oct 24, 2022
d091781
fix(c4-272): remove unnecessary usage of safemath
tmigone Oct 24, 2022
1f85e12
fix: further optimize governed contract
tmigone Oct 24, 2022
27902cc
fix: add visibility to managed immutable vars
tmigone Oct 24, 2022
e3a668e
fix: update e2e tests to new error messages
tmigone Oct 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: further optimize governed contract
Signed-off-by: Tomás Migone <[email protected]>
  • Loading branch information
tmigone committed Oct 27, 2022
commit 1f85e126bb51423d6cfd3a6f12aa8a21199cd7d0
8 changes: 4 additions & 4 deletions contracts/governance/Governed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ contract Governed {
* This function must called by the pending governor.
*/
function acceptOwnership() external {
address _pendingGovernor = pendingGovernor;
address oldPendingGovernor = pendingGovernor;

require(
_pendingGovernor != address(0) && msg.sender == _pendingGovernor,
oldPendingGovernor != address(0) && msg.sender == oldPendingGovernor,
"Caller must be pending governor"
);

address oldGovernor = governor;
address oldPendingGovernor = _pendingGovernor;

governor = _pendingGovernor;
governor = oldPendingGovernor;
pendingGovernor = address(0);

emit NewOwnership(oldGovernor, governor);
Expand Down