Skip to content

Commit 275ba6c

Browse files
committed
add zero check
1 parent 523a2a4 commit 275ba6c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: src/bridge/ERC20Bridge.sol

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ contract ERC20Bridge is AbsBridge, IERC20Bridge {
6565
/// @notice When upgrading a custom fee chain from v1.x.x to v2.1.2, nativeTokenDecimals must be set to 18.
6666
/// This is because v1.x.x contracts assume 18 decimals, but the ERC20Bridge does not have the decimals set in storage.
6767
function postUpgradeInit() external onlyDelegated onlyProxyOwner {
68+
// this zero check might save you from accidentally upgrading from v2.x.x to v2.1.2
69+
// it will not save you if your native token is supposed to have 0 decimals
70+
require(nativeTokenDecimals == 0, "NONZERO_NATIVE_TOKEN_DECIMALS");
6871
nativeTokenDecimals = 18;
6972
}
7073

0 commit comments

Comments
 (0)