diff --git a/l1-contracts/src/mock/TestERC20.sol b/l1-contracts/src/mock/TestERC20.sol index 9c827a8c59d6..3883b407347d 100644 --- a/l1-contracts/src/mock/TestERC20.sol +++ b/l1-contracts/src/mock/TestERC20.sol @@ -7,12 +7,26 @@ import {ERC20} from "@oz/token/ERC20/ERC20.sol"; import {IMintableERC20} from "./../governance/interfaces/IMintableERC20.sol"; contract TestERC20 is ERC20, IMintableERC20, Ownable { + bool public freeForAll = false; + + modifier ownerOrFreeForAll() { + if (msg.sender != owner() && !freeForAll) { + revert("Not owner or free for all"); + } + _; + } + constructor(string memory _name, string memory _symbol, address _owner) ERC20(_name, _symbol) Ownable(_owner) {} - function mint(address _to, uint256 _amount) external override(IMintableERC20) onlyOwner { + // solhint-disable-next-line comprehensive-interface + function setFreeForAll(bool _freeForAll) external onlyOwner { + freeForAll = _freeForAll; + } + + function mint(address _to, uint256 _amount) external override(IMintableERC20) ownerOrFreeForAll { _mint(_to, _amount); } } diff --git a/yarn-project/ethereum/src/deploy_l1_contracts.ts b/yarn-project/ethereum/src/deploy_l1_contracts.ts index ca1519003412..52a7aed1907b 100644 --- a/yarn-project/ethereum/src/deploy_l1_contracts.ts +++ b/yarn-project/ethereum/src/deploy_l1_contracts.ts @@ -424,6 +424,12 @@ export const deployL1Contracts = async ( // Transaction hashes to await const txHashes: Hex[] = []; + { + const txHash = await feeAsset.write.setFreeForAll([true], {} as any); + logger.info(`Fee asset set to free for all in ${txHash}`); + txHashes.push(txHash); + } + if (args.initialValidators && args.initialValidators.length > 0) { // Mint tokens, approve them, use cheat code to initialise validator set without setting up the epoch. const stakeNeeded = MINIMUM_STAKE * BigInt(args.initialValidators.length);