Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/SovaL1Block.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "@solady/auth/Ownable.sol";

import "./interfaces/ISovaL1Block.sol";

/**
Expand All @@ -13,23 +15,24 @@ import "./interfaces/ISovaL1Block.sol";
* SovaL1Block provides information about the state of the Bitcoin chain.
* Values stored in this contract are used by validators to verify block execution.
* The primary values used here are the Bitcoin block height and trailing block hash.
*
* Values within this contract are updated prior to Sova block execution via a system
* tx and can only be set by the system account.
*/
contract SovaL1Block is ISovaL1Block {
contract SovaL1Block is ISovaL1Block, Ownable {
uint64 private currentBlockHeight;
bytes32 private blockHashSixBlocksBack;
uint256 private lastUpdatedBlock;

address private constant SYSTEM_ACCOUNT_ADDRESS = 0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001;

constructor() Ownable() {
_initializeOwner(msg.sender);
}

function version() external pure virtual returns (string memory) {
return "0.1.0-beta.1";
}

function setBitcoinBlockData(uint64 _blockHeight, bytes32 _blockHash) external {
require(msg.sender == SYSTEM_ACCOUNT_ADDRESS, "SovaL1Block: only the system account can set block data");
require(msg.sender == owner(), "SovaL1Block: only the chain admin can set block data");

currentBlockHeight = _blockHeight;
blockHashSixBlocksBack = _blockHash;
Expand Down