2023-01-17 13:55:58 +01:00
|
|
|
// SPDX-License-Identifier: MIT
|
2024-01-23 10:24:02 +01:00
|
|
|
pragma solidity 0.8.23;
|
2023-01-17 13:55:58 +01:00
|
|
|
|
|
|
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
|
|
|
|
|
|
struct MarketplaceConfig {
|
|
|
|
CollateralConfig collateral;
|
|
|
|
ProofConfig proofs;
|
2024-07-25 15:31:32 +10:00
|
|
|
ValidationConfig validation;
|
2023-01-17 13:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct CollateralConfig {
|
2023-03-30 11:11:21 +02:00
|
|
|
/// @dev percentage of remaining collateral slot after it has been freed
|
|
|
|
/// (equivalent to `collateral - (collateral*maxNumberOfSlashes*slashPercentage)/100`)
|
|
|
|
/// TODO: to be aligned more closely with actual cost of repair once bandwidth incentives are known,
|
2023-05-25 12:56:04 +03:00
|
|
|
/// see https://github.com/codex-storage/codex-contracts-eth/pull/47#issuecomment-1465511949.
|
2023-03-30 11:11:21 +02:00
|
|
|
uint8 repairRewardPercentage;
|
|
|
|
uint8 maxNumberOfSlashes; // frees slot when the number of slashing reaches this value
|
|
|
|
uint16 slashCriterion; // amount of proofs missed that lead to slashing
|
|
|
|
uint8 slashPercentage; // percentage of the collateral that is slashed
|
2023-01-17 13:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct ProofConfig {
|
|
|
|
uint256 period; // proofs requirements are calculated per period (in seconds)
|
|
|
|
uint256 timeout; // mark proofs as missing before the timeout (in seconds)
|
|
|
|
uint8 downtime; // ignore this much recent blocks for proof requirements
|
2024-01-30 06:36:27 +01:00
|
|
|
string zkeyHash; // hash of the zkey file which is linked to the verifier
|
2023-01-17 13:55:58 +01:00
|
|
|
}
|
2024-07-25 15:31:32 +10:00
|
|
|
|
|
|
|
struct ValidationConfig {
|
|
|
|
// Number of validators to cover the entire SlotId space, max 65,535 (2^16-1).
|
|
|
|
// IMPORTANT: This value should be a power of 2 for even distribution,
|
|
|
|
// otherwise, the last validator will have a significantly less number of
|
|
|
|
// SlotIds to validate. The closest power of 2 without overflow is 2^15 =
|
|
|
|
// 32,768, giving each validator a maximum of 3.534e72 slots to validate.
|
|
|
|
uint16 validators;
|
|
|
|
}
|