Commit 9e440425 authored by clabby's avatar clabby Committed by GitHub

Add a getter for the claimed bond flag (#9466)

parent f0aaa471
This diff is collapsed.
......@@ -96,8 +96,8 @@
"sourceCodeHash": "0xe1891e7e6a1928b9a2ddc47d1f010650f1125a0617b8bf32190176a3bb674b4f"
},
"src/dispute/FaultDisputeGame.sol": {
"initCodeHash": "0xba582b158027b434b4e7d4d1edc073c7fce8b499c5ce8da03ea98c173c530f5d",
"sourceCodeHash": "0xd5f0f679c4559b277287f1844fb03ed47c702fcffff3c4aaea0e0ce8fc7d0760"
"initCodeHash": "0xca9b1b10500ef59c60f0d575cc3bad28bf6554fbbd1edc26ee0e9225e2c36c86",
"sourceCodeHash": "0xd1e1f952c6112f5126601740cfabfdd3e5692cfaadcc9f5316a30bd48c10cc0b"
},
"src/legacy/DeployerWhitelist.sol": {
"initCodeHash": "0x8de80fb23b26dd9d849f6328e56ea7c173cd9e9ce1f05c9beea559d1720deb3d",
......
......@@ -174,6 +174,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "claimedBondFlag",
"outputs": [
{
"internalType": "uint128",
"name": "claimedBondFlag_",
"type": "uint128"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "createdAt",
......
......@@ -184,6 +184,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "claimedBondFlag",
"outputs": [
{
"internalType": "uint128",
"name": "claimedBondFlag_",
"type": "uint128"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "createdAt",
......
......@@ -50,6 +50,9 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
/// @notice The global root claim's position is always at gindex 1.
Position internal constant ROOT_POSITION = Position.wrap(1);
/// @notice The flag set in the `bond` field of a `ClaimData` struct to indicate that the bond has been claimed.
uint128 internal constant CLAIMED_BOND_FLAG = type(uint128).max;
/// @notice The starting timestamp of the game
Timestamp public createdAt;
......@@ -81,8 +84,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
bool internal initialized;
/// @notice Semantic version.
/// @custom:semver 0.2.1
string public constant version = "0.2.1";
/// @custom:semver 0.3.0
string public constant version = "0.3.0";
/// @param _gameType The type ID of the game.
/// @param _absolutePrestate The absolute prestate of the instruction trace.
......@@ -550,6 +553,12 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
if (!success) revert BondTransferFailed();
}
/// @notice Returns the flag set in the `bond` field of a `ClaimData` struct to indicate that the bond has been
/// claimed.
function claimedBondFlag() external pure returns (uint128 claimedBondFlag_) {
claimedBondFlag_ = CLAIMED_BOND_FLAG;
}
////////////////////////////////////////////////////////////////
// IMMUTABLE GETTERS //
////////////////////////////////////////////////////////////////
......@@ -599,8 +608,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
function _distributeBond(address _recipient, ClaimData storage _bonded) internal {
// Set all bits in the bond value to indicate that the bond has been paid out.
uint256 bond = _bonded.bond;
if (bond == type(uint128).max) revert ClaimAlreadyResolved();
_bonded.bond = type(uint128).max;
if (bond == CLAIMED_BOND_FLAG) revert ClaimAlreadyResolved();
_bonded.bond = CLAIMED_BOND_FLAG;
// Increase the recipient's credit.
credit[_recipient] += bond;
......
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