Skip to content

Commit 892d01c

Browse files
authored
add owner to SovaL1Block contract and make setBitcoinBlockData onlyOwner (#50)
1 parent 469d06c commit 892d01c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/SovaL1Block.sol

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity 0.8.15;
33

4+
import "@solady/auth/Ownable.sol";
5+
46
import "./interfaces/ISovaL1Block.sol";
57

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

2524
address private constant SYSTEM_ACCOUNT_ADDRESS = 0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001;
2625

26+
constructor() Ownable() {
27+
_initializeOwner(msg.sender);
28+
}
29+
2730
function version() external pure virtual returns (string memory) {
2831
return "0.1.0-beta.1";
2932
}
3033

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

3437
currentBlockHeight = _blockHeight;
3538
blockHashSixBlocksBack = _blockHash;

0 commit comments

Comments
 (0)