Skip to content

Commit

Permalink
chore: free for all
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Dec 5, 2024
1 parent 601f698 commit 9123cc3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 15 additions & 1 deletion l1-contracts/src/mock/TestERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
6 changes: 6 additions & 0 deletions yarn-project/ethereum/src/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9123cc3

Please sign in to comment.