Skip to content

Commit

Permalink
add back light client to stake table contract
Browse files Browse the repository at this point in the history
  • Loading branch information
sveitser committed Mar 8, 2025
1 parent ed50a96 commit 9a1adfa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
19 changes: 15 additions & 4 deletions contracts/src/StakeTable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ contract StakeTable is AbstractStakeTable, Ownable, InitializedAt {
/// The commission is invalid
error InvalidCommission();

/// Error raised when the light client address is invalid
error InvalidAddress();

struct Validator {
bool isRegistered;
ValidatorStatus status;
Expand All @@ -63,6 +66,9 @@ contract StakeTable is AbstractStakeTable, Ownable, InitializedAt {
Exited
}

/// Reference to the light client contract.
LightClient public lightClient;

/// Currently active validators
mapping(address validator => Validator) public validators;

Expand Down Expand Up @@ -96,11 +102,16 @@ contract StakeTable is AbstractStakeTable, Ownable, InitializedAt {
address public admin;

/// TODO change constructor to initialize function when we make the contract upgradeable
constructor(address _tokenAddress, uint256 _exitEscrowPeriod, address _initialOwner)
Ownable(_initialOwner)
InitializedAt()
{
constructor(
address _tokenAddress,
address _lightClientAddress,
uint256 _exitEscrowPeriod,
address _initialOwner
) Ownable(_initialOwner) InitializedAt() {
// TODO ensure address not zero
tokenAddress = _tokenAddress;
// TODO ensure address not zero
lightClient = LightClient(_lightClientAddress);
exitEscrowPeriod = _exitEscrowPeriod;
admin = msg.sender;
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/mocks/StakeTableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity ^0.8.0;
import { StakeTable } from "../../src/StakeTable.sol";

contract StakeTableMock is StakeTable {
constructor(address token, uint256 escrowPeriod, address initialOwner)
StakeTable(token, escrowPeriod, initialOwner)
constructor(address token, address lightClient, uint256 escrowPeriod, address initialOwner)
StakeTable(token, lightClient, escrowPeriod, initialOwner)
// solhint-disable-next-line no-empty-blocks
{ }
}

0 comments on commit 9a1adfa

Please sign in to comment.