-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add state change table for AVS operators to make windowing easier
- Loading branch information
1 parent
a0d0294
commit f5f6035
Showing
7 changed files
with
138 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
internal/sqlite/migrations/202409161057_avsOperatorDeltas/up.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package _202409161057_avsOperatorDeltas | ||
|
||
import ( | ||
"fmt" | ||
"gorm.io/gorm" | ||
) | ||
|
||
type SqliteMigration struct { | ||
} | ||
|
||
func (m *SqliteMigration) Up(grm *gorm.DB) error { | ||
queries := []string{ | ||
`create table if not exists avs_operator_state_changes ( | ||
operator TEXT NOT NULL, | ||
avs TEXT NOT NULL, | ||
block_number INTEGER NOT NULL, | ||
log_index INTEGER NOT NULL, | ||
created_at DATETIME default current_timestamp, | ||
registered integer not null, | ||
unique(operator, avs, block_number, log_index) | ||
); | ||
`, | ||
} | ||
|
||
for _, query := range queries { | ||
if res := grm.Exec(query); res.Error != nil { | ||
fmt.Printf("Failed to execute query: %s\n", query) | ||
return res.Error | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func (m *SqliteMigration) GetName() string { | ||
return "202409161057_avsOperatorDeltas" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package rewards | ||
|
||
const query = ` | ||
` | ||
|
||
func (r *RewardsCalculator) GenerateOperatorAvsRegistrationWindows(snapshotDate string) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package rewards | ||
|
||
func (r *RewardsCalculator) GenerateOperatorAvsStrategyWindows(snapshotDate string) { | ||
|
||
} |