Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
ede728c0
Commit
ede728c0
authored
Jun 13, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Append only array of games
parent
2959bbb2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
DisputeGameFactory.sol
...ontracts-bedrock/contracts/dispute/DisputeGameFactory.sol
+15
-0
IDisputeGameFactory.sol
...rock/contracts/dispute/interfaces/IDisputeGameFactory.sol
+6
-0
DisputeGameFactory.t.sol
...contracts-bedrock/contracts/test/DisputeGameFactory.t.sol
+3
-0
No files found.
packages/contracts-bedrock/contracts/dispute/DisputeGameFactory.sol
View file @
ede728c0
...
@@ -32,6 +32,13 @@ contract DisputeGameFactory is Ownable, IDisputeGameFactory {
...
@@ -32,6 +32,13 @@ contract DisputeGameFactory is Ownable, IDisputeGameFactory {
*/
*/
mapping(Hash => IDisputeGame) internal disputeGames;
mapping(Hash => IDisputeGame) internal disputeGames;
/**
* @notice An append-only array of disputeGames that have been created.
* @dev This accessor is used by offchain game solvers to efficiently
* track dispute games
*/
IDisputeGame[] public disputeGameList;
/**
/**
* @notice Constructs a new DisputeGameFactory contract.
* @notice Constructs a new DisputeGameFactory contract.
* @param _owner The owner of the contract.
* @param _owner The owner of the contract.
...
@@ -40,6 +47,13 @@ contract DisputeGameFactory is Ownable, IDisputeGameFactory {
...
@@ -40,6 +47,13 @@ contract DisputeGameFactory is Ownable, IDisputeGameFactory {
transferOwnership(_owner);
transferOwnership(_owner);
}
}
/**
* @inheritdoc IDisputeGameFactory
*/
function allGames() external view returns (IDisputeGame[] memory _disputeGameList) {
_disputeGameList = disputeGameList;
}
/**
/**
* @inheritdoc IDisputeGameFactory
* @inheritdoc IDisputeGameFactory
*/
*/
...
@@ -81,6 +95,7 @@ contract DisputeGameFactory is Ownable, IDisputeGameFactory {
...
@@ -81,6 +95,7 @@ contract DisputeGameFactory is Ownable, IDisputeGameFactory {
// Store the dispute game in the mapping & emit the `DisputeGameCreated` event.
// Store the dispute game in the mapping & emit the `DisputeGameCreated` event.
disputeGames[uuid] = proxy;
disputeGames[uuid] = proxy;
disputeGameList.push(proxy);
emit DisputeGameCreated(address(proxy), gameType, rootClaim);
emit DisputeGameCreated(address(proxy), gameType, rootClaim);
}
}
...
...
packages/contracts-bedrock/contracts/dispute/interfaces/IDisputeGameFactory.sol
View file @
ede728c0
...
@@ -29,6 +29,12 @@ interface IDisputeGameFactory {
...
@@ -29,6 +29,12 @@ interface IDisputeGameFactory {
*/
*/
event ImplementationSet(address indexed impl, GameType indexed gameType);
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.
*/
function allGames() external view returns (IDisputeGame[] memory _disputeGameList);
/**
/**
* @notice `games` queries an internal a mapping that maps the hash of
* @notice `games` queries an internal a mapping that maps the hash of
* `gameType ++ rootClaim ++ extraData` to the deployed `DisputeGame` clone.
* `gameType ++ rootClaim ++ extraData` to the deployed `DisputeGame` clone.
...
...
packages/contracts-bedrock/contracts/test/DisputeGameFactory.t.sol
View file @
ede728c0
...
@@ -48,6 +48,9 @@ contract DisputeGameFactory_Test is Test {
...
@@ -48,6 +48,9 @@ contract DisputeGameFactory_Test is Test {
// Ensure that the dispute game was assigned to the `disputeGames` mapping.
// Ensure that the dispute game was assigned to the `disputeGames` mapping.
assertEq(address(factory.games(gt, rootClaim, extraData)), address(proxy));
assertEq(address(factory.games(gt, rootClaim, extraData)), address(proxy));
IDisputeGame[] memory disputeGameList = factory.allGames();
assertEq(disputeGameList.length, 1);
assertEq(address(disputeGameList[0]), address(proxy));
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment