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

refactor: remove superchain erc20 modifier #12566

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 packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
},
"src/L2/SuperchainERC20.sol": {
"initCodeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"sourceCodeHash": "0x6a384ccfb6f2f7316c1b33873a1630b5179e52475951d31771656e06d2b11519"
"sourceCodeHash": "0x45b9afdc9e52c27f192673388868a803f54d8f0bffe9defd81d584642e282b6b"
},
"src/L2/SuperchainTokenBridge.sol": {
"initCodeHash": "0xef7590c30630a75f105384e339e52758569c25a5aa0a5934c521e004b8f86220",
Expand Down
18 changes: 8 additions & 10 deletions packages/contracts-bedrock/src/L2/SuperchainERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,18 @@ import { Unauthorized } from "src/libraries/errors/CommonErrors.sol";
/// bridging to make it fungible across the Superchain. This construction allows the SuperchainTokenBridge to
/// burn and mint tokens.
abstract contract SuperchainERC20 is ERC20, ICrosschainERC20, ISemver {
/// @notice A modifier that only allows the SuperchainTokenBridge to call
modifier onlySuperchainTokenBridge() {
if (msg.sender != Predeploys.SUPERCHAIN_TOKEN_BRIDGE) revert Unauthorized();
_;
}

/// @notice Semantic version.
/// @custom:semver 1.0.0-beta.2
/// @custom:semver 1.0.0-beta.3
function version() external view virtual returns (string memory) {
return "1.0.0-beta.2";
return "1.0.0-beta.3";
}

/// @notice Allows the SuperchainTokenBridge to mint tokens.
/// @param _to Address to mint tokens to.
/// @param _amount Amount of tokens to mint.
function crosschainMint(address _to, uint256 _amount) external onlySuperchainTokenBridge {
function crosschainMint(address _to, uint256 _amount) external {
if (msg.sender != Predeploys.SUPERCHAIN_TOKEN_BRIDGE) revert Unauthorized();

_mint(_to, _amount);

emit CrosschainMinted(_to, _amount);
Expand All @@ -36,7 +32,9 @@ abstract contract SuperchainERC20 is ERC20, ICrosschainERC20, ISemver {
/// @notice Allows the SuperchainTokenBridge to burn tokens.
/// @param _from Address to burn tokens from.
/// @param _amount Amount of tokens to burn.
function crosschainBurn(address _from, uint256 _amount) external onlySuperchainTokenBridge {
function crosschainBurn(address _from, uint256 _amount) external {
if (msg.sender != Predeploys.SUPERCHAIN_TOKEN_BRIDGE) revert Unauthorized();

_burn(_from, _amount);

emit CrosschainBurnt(_from, _amount);
Expand Down