-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: val reg v1 now uses explicit "exist" fields (#172)
* refactor: val reg now uses explicit "exist" fields * fix: example script * fix: bindings + abi
- Loading branch information
Showing
7 changed files
with
151 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 27 additions & 15 deletions
42
contracts-abi/clients/ValidatorRegistryV1/ValidatorRegistryV1.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-License-Identifier: BSL 1.1 | ||
pragma solidity ^0.8.20; | ||
|
||
library EventHeightLib { | ||
/// @title EventHeight | ||
/// @notice A struct to store the block height of an event, where the uint256 height value | ||
/// is only relevant when the struct has been explicitly set. | ||
struct EventHeight { | ||
bool exists; | ||
uint256 blockHeight; | ||
} | ||
|
||
/// @notice Sets the block height of an event | ||
function set(EventHeight storage self, uint256 height) internal { | ||
self.exists = true; | ||
self.blockHeight = height; | ||
} | ||
|
||
/// @notice Deletes the event struct | ||
function del(EventHeight storage self) internal { | ||
self.exists = false; | ||
self.blockHeight = 0; | ||
} | ||
|
||
/// @notice Gets the existance and possible block height of an event | ||
function get(EventHeight storage self) internal view returns (bool, uint256) { | ||
return (self.exists, self.blockHeight); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.