Skip to content

Commit

Permalink
add zero check
Browse files Browse the repository at this point in the history
  • Loading branch information
godzillaba committed Jan 15, 2025
1 parent 523a2a4 commit 275ba6c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bridge/ERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ contract ERC20Bridge is AbsBridge, IERC20Bridge {
/// @notice When upgrading a custom fee chain from v1.x.x to v2.1.2, nativeTokenDecimals must be set to 18.
/// This is because v1.x.x contracts assume 18 decimals, but the ERC20Bridge does not have the decimals set in storage.
function postUpgradeInit() external onlyDelegated onlyProxyOwner {
// this zero check might save you from accidentally upgrading from v2.x.x to v2.1.2
// it will not save you if your native token is supposed to have 0 decimals
require(nativeTokenDecimals == 0, "NONZERO_NATIVE_TOKEN_DECIMALS");
nativeTokenDecimals = 18;
}

Expand Down

0 comments on commit 275ba6c

Please sign in to comment.