Commit 3ea3937e authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: refactor test

Use the same init logic for the factory in multiple places
parent e6b251da
...@@ -29,6 +29,7 @@ contract DisputeGameFactory_Initializer is Test { ...@@ -29,6 +29,7 @@ contract DisputeGameFactory_Initializer is Test {
_data: abi.encodeCall(impl.initialize, (address(this))) _data: abi.encodeCall(impl.initialize, (address(this)))
}); });
factory = DisputeGameFactory(address(proxy)); factory = DisputeGameFactory(address(proxy));
vm.label(address(factory), "DisputeGameFactoryProxy");
} }
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
pragma solidity ^0.8.15; pragma solidity ^0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { DisputeGameFactory_Initializer } from "./DisputeGameFactory.t.sol";
import { DisputeGameFactory } from "../dispute/DisputeGameFactory.sol"; import { DisputeGameFactory } from "../dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "../dispute/FaultDisputeGame.sol"; import { FaultDisputeGame } from "../dispute/FaultDisputeGame.sol";
...@@ -10,7 +11,7 @@ import "../libraries/DisputeErrors.sol"; ...@@ -10,7 +11,7 @@ import "../libraries/DisputeErrors.sol";
import { LibClock } from "../dispute/lib/LibClock.sol"; import { LibClock } from "../dispute/lib/LibClock.sol";
import { LibPosition } from "../dispute/lib/LibPosition.sol"; import { LibPosition } from "../dispute/lib/LibPosition.sol";
contract FaultDisputeGame_Test is Test { contract FaultDisputeGame_Test is DisputeGameFactory_Initializer {
/** /**
* @dev The root claim of the game. * @dev The root claim of the game.
*/ */
...@@ -28,10 +29,6 @@ contract FaultDisputeGame_Test is Test { ...@@ -28,10 +29,6 @@ contract FaultDisputeGame_Test is Test {
*/ */
string internal constant VERSION = "0.0.1"; string internal constant VERSION = "0.0.1";
/**
* @dev The factory that will be used to create the game.
*/
DisputeGameFactory internal factory;
/** /**
* @dev The implementation of the game. * @dev The implementation of the game.
*/ */
...@@ -43,10 +40,8 @@ contract FaultDisputeGame_Test is Test { ...@@ -43,10 +40,8 @@ contract FaultDisputeGame_Test is Test {
event Move(uint256 indexed parentIndex, Claim indexed pivot, address indexed claimant); event Move(uint256 indexed parentIndex, Claim indexed pivot, address indexed claimant);
function setUp() public { function setUp() public override {
// Deploy a new dispute game factory. super.setUp();
factory = new DisputeGameFactory();
factory.initialize(address(this));
// Deploy an implementation of the fault game // Deploy an implementation of the fault game
gameImpl = new FaultDisputeGame(); gameImpl = new FaultDisputeGame();
// Register the game implementation with the factory. // Register the game implementation with the factory.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment