From b811cbbd05f3285241a541c1257f673fdffc6401 Mon Sep 17 00:00:00 2001 From: stubbsta Date: Tue, 29 Jul 2025 16:27:45 +0200 Subject: [PATCH] Use 'Ownable' for access control --- test/TestStableToken.sol | 11 ++++------- test/WakuRlnV2.t.sol | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/test/TestStableToken.sol b/test/TestStableToken.sol index 114f673..76d0aa6 100644 --- a/test/TestStableToken.sol +++ b/test/TestStableToken.sol @@ -4,16 +4,13 @@ pragma solidity >=0.8.19 <0.9.0; import { BaseScript } from "../script/Base.s.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; +import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; -contract TestStableToken is ERC20, ERC20Permit { - address public immutable owner; - - constructor() ERC20("TestStableToken", "TST") ERC20Permit("TestStableToken") { - owner = msg.sender; +contract TestStableToken is ERC20, ERC20Permit, Ownable { + constructor() ERC20("TestStableToken", "TST") ERC20Permit("TestStableToken") Ownable() { } - function mint(address to, uint256 amount) external { - require(msg.sender == owner, "Only owner can mint"); + function mint(address to, uint256 amount) external onlyOwner { _mint(to, amount); } } diff --git a/test/WakuRlnV2.t.sol b/test/WakuRlnV2.t.sol index 9c45779..9c6d7c7 100644 --- a/test/WakuRlnV2.t.sol +++ b/test/WakuRlnV2.t.sol @@ -768,7 +768,7 @@ contract WakuRlnV2Test is Test { uint256 mintAmount = 1000 ether; vm.prank(nonOwner); - vm.expectRevert("Only owner can mint"); + vm.expectRevert("Ownable: caller is not the owner"); token.mint(nonOwner, mintAmount); }