Skip to content

Commit

Permalink
Cleanup and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcgary committed Sep 6, 2024
1 parent 7dd015b commit 8005a4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
19 changes: 4 additions & 15 deletions internal/eigenState/operatorShares/operatorShares.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,7 @@ import (
"time"
)

// Changes table
type OperatorShareChange struct {
Id uint64 `gorm:"type:serial"`
Operator string
Strategy string
Shares string `gorm:"type:numeric"`
TransactionHash string
TransactionIndex uint64
LogIndex uint64
BlockNumber uint64
CreatedAt time.Time
}

// Block table
// OperatorShares represents the state of an operator's shares in a strategy at a given block number
type OperatorShares struct {
Operator string
Strategy string
Expand All @@ -45,6 +32,7 @@ type OperatorShares struct {
CreatedAt time.Time
}

// AccumulatedStateChange represents the accumulated state change for an operator's shares in a strategy at a given block number
type AccumulatedStateChange struct {
Operator string
Strategy string
Expand All @@ -60,6 +48,7 @@ type OperatorSharesDiff struct {
IsNew bool
}

// SlotId is a unique identifier for an operator's shares in a strategy
type SlotId string

func NewSlotId(operator string, strategy string) SlotId {
Expand All @@ -69,7 +58,7 @@ func NewSlotId(operator string, strategy string) SlotId {
// Implements IEigenStateModel
type OperatorSharesModel struct {
base.BaseEigenState
StateTransitions types.StateTransitions[OperatorShareChange]
StateTransitions types.StateTransitions[AccumulatedStateChange]
Db *gorm.DB
Network config.Network
Environment config.Environment
Expand Down
16 changes: 4 additions & 12 deletions internal/eigenState/stakerDelegations/stakerDelegations.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,23 @@ import (
"time"
)

// DelegatedStakers State model for staker delegations at block_number
type DelegatedStakers struct {
Staker string
Operator string
BlockNumber uint64
CreatedAt time.Time
}

type StakerDelegationChange struct {
Staker string
Operator string
Delegated bool
TransactionHash string
TransactionIndex uint64
LogIndex uint64
BlockNumber uint64
CreatedAt time.Time
}

// AccumulatedStateChange represents the accumulated state change for a staker/operator pair
type AccumulatedStateChange struct {
Staker string
Operator string
BlockNumber uint64
Delegated bool
}

// SlotId represents a unique identifier for a staker/operator pair
type SlotId string

func NewSlotId(staker string, operator string) SlotId {
Expand All @@ -55,7 +47,7 @@ func NewSlotId(staker string, operator string) SlotId {

type StakerDelegationsModel struct {
base.BaseEigenState
StateTransitions types.StateTransitions[StakerDelegationChange]
StateTransitions types.StateTransitions[AccumulatedStateChange]
Db *gorm.DB
Network config.Network
Environment config.Environment
Expand Down

0 comments on commit 8005a4e

Please sign in to comment.