diff --git a/contracts/finance/PaymentSplitter.sol b/contracts/finance/PaymentSplitter.sol index 0529737c5aa..34c6060ae52 100644 --- a/contracts/finance/PaymentSplitter.sol +++ b/contracts/finance/PaymentSplitter.sol @@ -169,7 +169,7 @@ contract PaymentSplitter is Context { * total shares and their previous withdrawals. */ function release(address payable account) public virtual { - if (_shares[account] <= 0) { + if (_shares[account] == 0) { revert PaymentSplitterEmptyShares(account); } @@ -196,7 +196,7 @@ contract PaymentSplitter is Context { * contract. */ function release(IERC20 token, address account) public virtual { - if (_shares[account] <= 0) { + if (_shares[account] == 0) { revert PaymentSplitterEmptyShares(account); } @@ -239,7 +239,7 @@ contract PaymentSplitter is Context { if (account == address(0)) { revert PaymentSplitterInvalidPayee(account); } - if (shares_ <= 0) { + if (shares_ == 0) { revert PaymentSplitterEmptyShares(account); } if (_shares[account] != 0) { diff --git a/contracts/governance/Governor.sol b/contracts/governance/Governor.sol index 491a9e2a53b..52d24cb5356 100644 --- a/contracts/governance/Governor.sol +++ b/contracts/governance/Governor.sol @@ -368,7 +368,7 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Receive if (currentState != ProposalState.Pending) { revert GovernorIncorrectState(proposalId, currentState, _encodeState(ProposalState.Pending)); } - address proposer = _proposals[proposalId].proposer; + address proposer = proposalProposer(proposalId); if (_msgSender() != proposer) { revert GovernorOnlyProposer(_msgSender()); } diff --git a/contracts/token/ERC20/extensions/ERC20FlashMint.sol b/contracts/token/ERC20/extensions/ERC20FlashMint.sol index b6e4bbafebe..4f37739bba7 100644 --- a/contracts/token/ERC20/extensions/ERC20FlashMint.sol +++ b/contracts/token/ERC20/extensions/ERC20FlashMint.sol @@ -22,7 +22,7 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender { /** * @dev The loan token is not valid. */ - error ERC3156InvalidToken(address token); + error ERC3156UnsupportedToken(address token); /** * @dev The requested loan exceeds the max loan amount for `token`. @@ -53,7 +53,7 @@ abstract contract ERC20FlashMint is ERC20, IERC3156FlashLender { */ function flashFee(address token, uint256 amount) public view virtual override returns (uint256) { if (token != address(this)) { - revert ERC3156InvalidToken(token); + revert ERC3156UnsupportedToken(token); } return _flashFee(token, amount); } diff --git a/contracts/token/ERC20/extensions/ERC20Snapshot.sol b/contracts/token/ERC20/extensions/ERC20Snapshot.sol index 0c34c174ec1..4dcdbab976a 100644 --- a/contracts/token/ERC20/extensions/ERC20Snapshot.sol +++ b/contracts/token/ERC20/extensions/ERC20Snapshot.sol @@ -142,11 +142,7 @@ abstract contract ERC20Snapshot is ERC20 { } function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) { - if (snapshotId == 0) { - revert ERC20InvalidSnapshot(0); - } - if (snapshotId > _getCurrentSnapshotId()) { - // Non existent id + if (snapshotId == 0 || snapshotId > _getCurrentSnapshotId()) { revert ERC20InvalidSnapshot(snapshotId); } diff --git a/scripts/generate/templates/SafeCast.js b/scripts/generate/templates/SafeCast.js index c7edbe39e53..77f90d5fffd 100644 --- a/scripts/generate/templates/SafeCast.js +++ b/scripts/generate/templates/SafeCast.js @@ -191,7 +191,15 @@ function toUint${length}(int${length} value) internal pure returns (uint${length module.exports = format( header.trimEnd(), 'library SafeCast {', - [...LENGTHS.map(toUintDownCastErrors), toUintErrors(256), ...LENGTHS.map(toIntDownCastErrors), toIntErrors(256)], - [...LENGTHS.map(toUintDownCast), toUint(256), ...LENGTHS.map(toIntDownCast), toInt(256)], + [ + ...LENGTHS.map(toUintDownCastErrors), + toUintErrors(256), + ...LENGTHS.map(toIntDownCastErrors), + toIntErrors(256), + ...LENGTHS.map(toUintDownCast), + toUint(256), + ...LENGTHS.map(toIntDownCast), + toInt(256), + ], '}', );