Commit 358dd3f7 authored by AgusDuha's avatar AgusDuha Committed by GitHub

refactor: remove superchain erc20 modifier (#12566)

* fix: remove superchain erc20 modifier (#111)

* fix: remove superchain erc20 modifier

---------
Co-authored-by: default avatarDisco <131301107+0xDiscotech@users.noreply.github.com>
Co-authored-by: default avatar0xng <ng@defi.sucks>
Co-authored-by: default avatar0xParticle <particle@defi.sucks>
Co-authored-by: default avatargotzenx <78360669+gotzenx@users.noreply.github.com>

* fix: pre pr

---------
Co-authored-by: default avatarDisco <131301107+0xDiscotech@users.noreply.github.com>
Co-authored-by: default avatar0xng <ng@defi.sucks>
Co-authored-by: default avatar0xParticle <particle@defi.sucks>
Co-authored-by: default avatargotzenx <78360669+gotzenx@users.noreply.github.com>
parent 20e35fd8
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
}, },
"src/L2/SuperchainERC20.sol": { "src/L2/SuperchainERC20.sol": {
"initCodeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", "initCodeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"sourceCodeHash": "0x6a384ccfb6f2f7316c1b33873a1630b5179e52475951d31771656e06d2b11519" "sourceCodeHash": "0x45b9afdc9e52c27f192673388868a803f54d8f0bffe9defd81d584642e282b6b"
}, },
"src/L2/SuperchainTokenBridge.sol": { "src/L2/SuperchainTokenBridge.sol": {
"initCodeHash": "0xef7590c30630a75f105384e339e52758569c25a5aa0a5934c521e004b8f86220", "initCodeHash": "0xef7590c30630a75f105384e339e52758569c25a5aa0a5934c521e004b8f86220",
......
...@@ -12,22 +12,18 @@ import { Unauthorized } from "src/libraries/errors/CommonErrors.sol"; ...@@ -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 /// bridging to make it fungible across the Superchain. This construction allows the SuperchainTokenBridge to
/// burn and mint tokens. /// burn and mint tokens.
abstract contract SuperchainERC20 is ERC20, ICrosschainERC20, ISemver { 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. /// @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) { 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. /// @notice Allows the SuperchainTokenBridge to mint tokens.
/// @param _to Address to mint tokens to. /// @param _to Address to mint tokens to.
/// @param _amount Amount of tokens to mint. /// @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); _mint(_to, _amount);
emit CrosschainMinted(_to, _amount); emit CrosschainMinted(_to, _amount);
...@@ -36,7 +32,9 @@ abstract contract SuperchainERC20 is ERC20, ICrosschainERC20, ISemver { ...@@ -36,7 +32,9 @@ abstract contract SuperchainERC20 is ERC20, ICrosschainERC20, ISemver {
/// @notice Allows the SuperchainTokenBridge to burn tokens. /// @notice Allows the SuperchainTokenBridge to burn tokens.
/// @param _from Address to burn tokens from. /// @param _from Address to burn tokens from.
/// @param _amount Amount of tokens to burn. /// @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); _burn(_from, _amount);
emit CrosschainBurnt(_from, _amount); emit CrosschainBurnt(_from, _amount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment