Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decimals patch version - v2.1.2 #292

Merged
merged 8 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arbitrum/nitro-contracts",
"version": "2.1.1",
"version": "2.1.2",
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
"author": "Offchain Labs, Inc.",
"license": "BUSL-1.1",
Expand Down
9 changes: 9 additions & 0 deletions src/bridge/ERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ 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;
}

/// @inheritdoc IERC20Bridge
function enqueueDelayedMessage(
uint8 kind,
Expand Down
1 change: 1 addition & 0 deletions test/signatures/ERC20Bridge
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"initialize(address,address)": "485cc955",
"nativeToken()": "e1758bd8",
"nativeTokenDecimals()": "ad48cb5e",
"postUpgradeInit()": "95fcea78",
"rollup()": "cb23bcb5",
"sequencerInbox()": "ee35f327",
"sequencerInboxAccs(uint256)": "16bf5579",
Expand Down
Loading