PovwMint
Inherits: IPovwMint, Initializable, OwnableUpgradeable, UUPSUpgradeable
PovwMint controls the minting of token rewards associated with Proof of Verifiable Work (PoVW). This contract consumes updates produced by the mint calculator guest, mints token rewards, and maintains state to ensure that any given token reward is minted at most once.
State Variables
VERSION
The version of the contract, with respect to upgrades.
uint64 public constant VERSION = 1;
VERIFIER
Note: oz-upgrades-unsafe-allow: state-variable-immutable
IRiscZeroVerifier public immutable VERIFIER;
TOKEN
Note: oz-upgrades-unsafe-allow: state-variable-immutable
IZKC public immutable TOKEN;
TOKEN_REWARDS
Note: oz-upgrades-unsafe-allow: state-variable-immutable
IZKCRewards public immutable TOKEN_REWARDS;
ACCOUNTING
Note: oz-upgrades-unsafe-allow: state-variable-immutable
PovwAccounting public immutable ACCOUNTING;
MINT_CALCULATOR_ID
Image ID of the mint calculator guest.
*The mint calculator ensures:
- An event was logged by the PoVW accounting contract for each log update and epoch finalization.
- Each event is counted at most once.
- Events form an unbroken chain from initialCommit to updatedCommit. This constitutes an exhaustiveness check such that the prover cannot exclude updates, and thereby deny a reward.
- Mint value is calculated correctly from the PoVW totals in each included epoch.
- An event was logged by the PoVW accounting contract for epoch finalization.
- The total work from the epoch finalization event is used in the mint calculation.
- The mint recipient is set correctly.*
Note: oz-upgrades-unsafe-allow: state-variable-immutable
bytes32 public immutable MINT_CALCULATOR_ID;
workLogCommits
Mapping from work log ID to the most recent work log commit for which a mint has occurred.
Each time a mint occurs associated with a work log, this value ratchets forward. It ensure that any given work log update can be used in at most one mint.
mapping(address => bytes32) public workLogCommits;
Functions
constructor
Note: oz-upgrades-unsafe-allow: constructor
constructor(
IRiscZeroVerifier verifier,
PovwAccounting accounting,
bytes32 mintCalculatorId,
IZKC token,
IZKCRewards tokenRewards
);
initialize
function initialize(address initialOwner) external initializer;
_authorizeUpgrade
function _authorizeUpgrade(address newImplementation) internal override onlyOwner;
mint
Mint tokens as a reward for verifiable work.
function mint(bytes calldata journalBytes, bytes calldata seal) external;
workLogCommit
Get the current work log commitment for the given work log.
This commits to the consumed nonces for all updates that have been included in a mint operation.
function workLogCommit(address workLogId) public view returns (bytes32);