rm hardcode on native chainid

This commit is contained in:
Moon Man 2025-01-18 08:39:43 -05:00
parent 27d859116e
commit 45b056acce
1 changed files with 5 additions and 2 deletions

View File

@ -34,6 +34,7 @@ error InvalidInitialSupply();
contract TenGransToken is ERC20, ERC20Permit, ERC20Votes, ERC20FlashMint, ERC20Capped, IERC7802 { contract TenGransToken is ERC20, ERC20Permit, ERC20Votes, ERC20FlashMint, ERC20Capped, IERC7802 {
address public signer; address public signer;
mapping(address => bool) public transitionMinted; mapping(address => bool) public transitionMinted;
uint256 public immutable nativeChainId;
event TransitionMint(address indexed holder, uint256 amount); event TransitionMint(address indexed holder, uint256 amount);
@ -42,11 +43,13 @@ contract TenGransToken is ERC20, ERC20Permit, ERC20Votes, ERC20FlashMint, ERC20C
string memory symbol, string memory symbol,
uint256 initialSupplyWei, uint256 initialSupplyWei,
uint256 capWei, uint256 capWei,
address _signer address _signer,
uint256 _nativeChainId
) ERC20(name, symbol) ERC20Permit(name) ERC20Capped(capWei) { ) ERC20(name, symbol) ERC20Permit(name) ERC20Capped(capWei) {
require(initialSupplyWei <= capWei, InvalidInitialSupply()); require(initialSupplyWei <= capWei, InvalidInitialSupply());
_mint(msg.sender, initialSupplyWei); _mint(msg.sender, initialSupplyWei);
signer = _signer; signer = _signer;
nativeChainId = _nativeChainId;
} }
/// @notice Allows the SuperchainTokenBridge to mint tokens. /// @notice Allows the SuperchainTokenBridge to mint tokens.
@ -82,7 +85,7 @@ contract TenGransToken is ERC20, ERC20Permit, ERC20Votes, ERC20FlashMint, ERC20C
/// @param snapshotQuantity Amount of tokens to mint. /// @param snapshotQuantity Amount of tokens to mint.
/// @param signature Signature of the holder. /// @param signature Signature of the holder.
function transitionMint(address holder, uint256 snapshotQuantity, bytes memory signature) external { function transitionMint(address holder, uint256 snapshotQuantity, bytes memory signature) external {
require(block.chainid == 8453, InvalidChain()); require(block.chainid == nativeChainId, InvalidChain());
require(!transitionMinted[holder], AlreadyMinted()); require(!transitionMinted[holder], AlreadyMinted());
require(TransitionMintLib.verifyMintSignature(holder, snapshotQuantity, signature, signer), InvalidSignature()); require(TransitionMintLib.verifyMintSignature(holder, snapshotQuantity, signature, signer), InvalidSignature());