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

feat/custom gas token: diego's changes #10219

Closed
Closed
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
SystemConfig public systemConfig;

/// @notice Semantic version.
/// @custom:semver 2.4.0
string public constant version = "2.4.0";
/// @custom:semver 2.3.0-beta+custom-gas-token
string public constant version = "2.3.0-beta+custom-gas-token";

/// @notice Constructs the L1CrossDomainMessenger contract.
constructor() CrossDomainMessenger() {
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/src/L1/L1StandardBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ contract L1StandardBridge is StandardBridge, ISemver {
);

/// @notice Semantic version.
/// @custom:semver 2.2.0
string public constant version = "2.2.0";
/// @custom:semver 2.1.0-beta+custom-gas-token
string public constant version = "2.1.0-beta+custom-gas-token";

/// @notice Address of the SuperchainConfig contract.
SuperchainConfig public superchainConfig;
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/src/L1/OptimismPortal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
}

/// @notice Semantic version.
/// @custom:semver 2.6.0
string public constant version = "2.6.0";
/// @custom:semver 2.6.0-beta+custom-gas-token
string public constant version = "2.6.0-beta+custom-gas-token";

/// @notice Constructs the OptimismPortal contract.
constructor() {
Expand Down
7 changes: 4 additions & 3 deletions packages/contracts-bedrock/src/L1/SystemConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ contract SystemConfig is OwnableUpgradeable, ISemver {
event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data);

/// @notice Semantic version.
/// @custom:semver 1.12.0
string public constant version = "1.12.0";
/// @custom:semver 1.12.0-beta+custom-gas-token
string public constant version = "1.12.0-beta+custom-gas-token";

/// @notice Constructs the SystemConfig contract. Cannot set
/// the owner to `address(0)` due to the Ownable contract's
Expand Down Expand Up @@ -273,7 +273,8 @@ contract SystemConfig is OwnableUpgradeable, ISemver {
/// @notice Internal setter for the gas paying token address, includes validation.
/// @param _token Address of the gas paying token.
function _setGasPayingToken(address _token) internal {
if (_token != address(0) && _token != Constants.ETHER) {
(address currentToken,) = GasPayingToken.getToken();
if (_token != address(0) && _token != Constants.ETHER && currentToken == Constants.ETHER) {
Comment on lines +276 to +277
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure robust error handling for ERC20 token methods in _setGasPayingToken.

Consider adding try-catch blocks around calls to ERC20(_token).decimals(), ERC20(_token).name(), and ERC20(_token).symbol() to handle cases where these methods are not implemented by the token contract.

require(
ERC20(_token).decimals() == GAS_PAYING_TOKEN_DECIMALS, "SystemConfig: bad decimals of gas paying token"
);
Expand Down
6 changes: 3 additions & 3 deletions packages/contracts-bedrock/src/L2/L1Block.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ contract L1Block is ISemver {
/// @notice The latest L1 blob base fee.
uint256 public blobBaseFee;

/// @custom:semver 1.2.0-beta+custom-gas-token
string public constant version = "1.2.0-beta+custom-gas-token";

/// @notice Returns the gas paying token, its decimals, name and symbol.
/// If nothing is set in state, then it means ether is used.
function gasPayingToken() public view returns (address addr_, uint8 decimals_) {
Expand All @@ -83,9 +86,6 @@ contract L1Block is ISemver {
return token != Constants.ETHER;
}

/// @custom:semver 1.3.0
string public constant version = "1.3.0";

/// @custom:legacy
/// @notice Updates the L1 block values.
/// @param _number L1 blocknumber.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
/// L2 on the L2 side. Users are generally encouraged to use this contract instead of lower
/// level message passing contracts.
contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @custom:semver 2.0.0
string public constant version = "2.1.0";
/// @custom:semver 2.0.0-beta+custom-gas-token
string public constant version = "2.0.0-beta+custom-gas-token";

/// @notice Constructs the L2CrossDomainMessenger contract.
constructor() CrossDomainMessenger() {
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/src/L2/L2StandardBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ contract L2StandardBridge is StandardBridge, ISemver {
bytes extraData
);

/// @custom:semver 1.9.0
string public constant version = "1.9.0";
/// @custom:semver 1.8.0-beta+custom-gas-token
string public constant version = "1.8.0-beta+custom-gas-token";

/// @notice Constructs the L2StandardBridge contract.
constructor() StandardBridge() {
Expand Down