forked from scroll-tech/scroll-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScrollStandardERC20Factory.t.sol
32 lines (25 loc) · 1.14 KB
/
ScrollStandardERC20Factory.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;
import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol";
import {WETH} from "solmate/tokens/WETH.sol";
import {ScrollStandardERC20} from "../libraries/token/ScrollStandardERC20.sol";
import {ScrollStandardERC20Factory} from "../libraries/token/ScrollStandardERC20Factory.sol";
contract ScrollStandardERC20FactoryTest is DSTestPlus {
ScrollStandardERC20 private impl;
ScrollStandardERC20Factory private factory;
function setUp() public {
impl = new ScrollStandardERC20();
factory = new ScrollStandardERC20Factory(address(impl));
}
function testDeployL2Token(address _gateway, address _l1Token) external {
// call by non-owner, should revert
hevm.startPrank(address(1));
hevm.expectRevert("Ownable: caller is not the owner");
factory.deployL2Token(_gateway, _l1Token);
hevm.stopPrank();
// call by owner, should succeed
address computed = factory.computeL2TokenAddress(_gateway, _l1Token);
address deployed = factory.deployL2Token(_gateway, _l1Token);
assertEq(computed, deployed);
}
}