Commit 278b093b authored by Andreas Bigger's avatar Andreas Bigger

Remove games accessor and add len/count accessor

parent ede728c0
......@@ -50,8 +50,8 @@ contract DisputeGameFactory is Ownable, IDisputeGameFactory {
/**
* @inheritdoc IDisputeGameFactory
*/
function allGames() external view returns (IDisputeGame[] memory _disputeGameList) {
_disputeGameList = disputeGameList;
function gameCount() external view returns (uint256 _gameCount) {
_gameCount = disputeGameList.length;
}
/**
......
......@@ -30,10 +30,10 @@ interface IDisputeGameFactory {
event ImplementationSet(address indexed impl, GameType indexed gameType);
/**
* @notice retrieves a list of all dispute games created by this factory.
* @return _disputeGameList The list of all dispute games created by this factory.
* @notice the total number of dispute games created by this factory.
* @return _gameCount The total number of dispute games created by this factory.
*/
function allGames() external view returns (IDisputeGame[] memory _disputeGameList);
function gameCount() external view returns (uint256 _gameCount);
/**
* @notice `games` queries an internal a mapping that maps the hash of
......
......@@ -48,9 +48,8 @@ contract DisputeGameFactory_Test is Test {
// Ensure that the dispute game was assigned to the `disputeGames` mapping.
assertEq(address(factory.games(gt, rootClaim, extraData)), address(proxy));
IDisputeGame[] memory disputeGameList = factory.allGames();
assertEq(disputeGameList.length, 1);
assertEq(address(disputeGameList[0]), address(proxy));
assertEq(factory.gameCount(), 1);
assertEq(address(factory.disputeGameList(0)), address(proxy));
}
/**
......
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