-
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: storage contracts for core
- Loading branch information
Showing
13 changed files
with
272 additions
and
206 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
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,47 @@ | ||
// SPDX-License-Identifier: BSL 1.1 | ||
pragma solidity 0.8.20; | ||
|
||
import {FeePayout} from "../utils/FeePayout.sol"; | ||
import {IBlockTracker} from "../interfaces/IBlockTracker.sol"; | ||
import {IBidderRegistry} from "../interfaces/IBidderRegistry.sol"; | ||
|
||
abstract contract BidderRegistryStorage { | ||
using FeePayout for FeePayout.Tracker; | ||
|
||
/// @dev For improved precision | ||
uint256 constant public PRECISION = 10 ** 25; | ||
uint256 constant public PERCENT = 100 * PRECISION; | ||
|
||
/// @dev Address of the pre-confirmations contract | ||
address public preConfirmationsContract; | ||
|
||
/// @dev Fee percent that would be taken by protocol when provider is slashed | ||
uint16 public feePercent; | ||
|
||
/// @dev Block tracker contract | ||
IBlockTracker public blockTrackerContract; | ||
|
||
/// Struct enabling automatic protocol fee payouts | ||
FeePayout.Tracker public protocolFeeTracker; | ||
|
||
/// @dev Mapping for if bidder is registered | ||
mapping(address => bool) public bidderRegistered; | ||
|
||
// Mapping from bidder addresses and window numbers to their locked funds | ||
mapping(address => mapping(uint256 => uint256)) public lockedFunds; | ||
|
||
// Mapping from bidder addresses and blocks to their used funds | ||
mapping(address => mapping(uint64 => uint256)) public usedFunds; | ||
|
||
/// Mapping from bidder addresses and window numbers to their funds per window | ||
mapping(address => mapping(uint256 => uint256)) public maxBidPerBlock; | ||
|
||
/// @dev Mapping from bidder addresses to their locked amount based on bidID (commitmentDigest) | ||
mapping(bytes32 => IBidderRegistry.BidState) public bidPayment; | ||
|
||
/// @dev Amount assigned to bidders | ||
mapping(address => uint256) public providerAmount; | ||
|
||
/// @dev Amount assigned to bidders | ||
uint256 public blocksPerWindow; | ||
} |
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,17 @@ | ||
// SPDX-License-Identifier: BSL 1.1 | ||
pragma solidity 0.8.20; | ||
|
||
abstract contract BlockTrackerStorage { | ||
/// @dev Permissioned address of the oracle account. | ||
address public oracleAccount; | ||
|
||
uint256 public currentWindow; | ||
|
||
uint256 public blocksPerWindow; | ||
|
||
// Mapping from block number to the winner's address | ||
mapping(uint256 => address) public blockWinners; | ||
|
||
/// @dev Maps builder names to their respective Ethereum addresses. | ||
mapping(string => address) public blockBuilderNameToAddress; | ||
} |
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,19 @@ | ||
// SPDX-License-Identifier: BSL 1.1 | ||
pragma solidity 0.8.20; | ||
|
||
import {IPreconfManager} from "../interfaces/IPreconfManager.sol"; | ||
import {IBlockTracker} from "../interfaces/IBlockTracker.sol"; | ||
|
||
abstract contract OracleStorage { | ||
/// @dev Maps builder names to their respective Ethereum addresses. | ||
mapping(string => address) public blockBuilderNameToAddress; | ||
|
||
/// @dev Permissioned address of the oracle account. | ||
address public oracleAccount; | ||
|
||
/// @dev Reference to the PreconfManager contract interface. | ||
IPreconfManager internal _preConfContract; | ||
|
||
/// @dev Reference to the BlockTracker contract interface. | ||
IBlockTracker internal _blockTrackerContract; | ||
} |
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,38 @@ | ||
// SPDX-License-Identifier: BSL 1.1 | ||
pragma solidity 0.8.20; | ||
|
||
import {IProviderRegistry} from "../interfaces/IProviderRegistry.sol"; | ||
import {IBidderRegistry} from "../interfaces/IBidderRegistry.sol"; | ||
import {IBlockTracker} from "../interfaces/IBlockTracker.sol"; | ||
import {IPreconfManager} from "../interfaces/IPreconfManager.sol"; | ||
|
||
abstract contract PreconfManagerStorage { | ||
// Represents the dispatch window in milliseconds | ||
uint64 public commitmentDispatchWindow; | ||
|
||
/// @dev Address of the oracle contract | ||
address public oracleContract; | ||
|
||
/// @dev The number of blocks per window | ||
uint256 public blocksPerWindow; | ||
|
||
/// @dev Address of provider registry | ||
IProviderRegistry public providerRegistry; | ||
|
||
/// @dev Address of bidderRegistry | ||
IBidderRegistry public bidderRegistry; | ||
|
||
/// @dev Address of blockTracker | ||
IBlockTracker public blockTracker; | ||
|
||
/// @dev Mapping from provider to commitments count | ||
mapping(address => uint256) public commitmentsCount; | ||
|
||
/// @dev Commitment Hash -> Opened Commitemnt | ||
/// @dev Only stores valid commitments | ||
mapping(bytes32 => IPreconfManager.OpenedCommitment) public openedCommitments; | ||
|
||
/// @dev Unopened Commitment Hash -> Unopened Commitment | ||
/// @dev Only stores valid unopened commitments | ||
mapping(bytes32 => IPreconfManager.UnopenedCommitment) public unopenedCommitments; | ||
} |
Oops, something went wrong.