-
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.
Port over staker operator table generation
- Loading branch information
1 parent
e30e126
commit 8cbaf97
Showing
22 changed files
with
1,166 additions
and
54 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
60 changes: 60 additions & 0 deletions
60
pkg/postgres/migrations/202412021311_stakerOperatorTables/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,60 @@ | ||
package _202412021311_stakerOperatorTables | ||
|
||
import ( | ||
"database/sql" | ||
"gorm.io/gorm" | ||
) | ||
|
||
type Migration struct { | ||
} | ||
|
||
func (m *Migration) Up(db *sql.DB, grm *gorm.DB) error { | ||
queries := []string{ | ||
`CREATE TABLE IF NOT EXISTS sot_staker_strategy_payouts ( | ||
reward_hash varchar NOT NULL, | ||
snapshot TIMESTAMP NOT NULL, | ||
token varchar NOT NULL, | ||
tokens_per_day double precision NOT NULL, | ||
avs varchar NOT NULL, | ||
strategy varchar NOT NULL, | ||
multiplier numeric NOT NULL, | ||
reward_type varchar NOT NULL, | ||
operator varchar NOT NULL, | ||
staker varchar NOT NULL, | ||
shares numeric NOT NULL, | ||
staker_tokens numeric NOT NULL, | ||
staker_strategy_weight numeric NOT NULL, | ||
staker_total_strategy_weight numeric NOT NULL, | ||
staker_strategy_proportion numeric NOT NULL, | ||
staker_strategy_tokens numeric NOT NULL | ||
);`, | ||
`CREATE TABLE IF NOT EXISTS sot_operator_strategy_rewards ( | ||
reward_hash varchar NOT NULL, | ||
snapshot TIMESTAMP NOT NULL, | ||
token varchar NOT NULL, | ||
tokens_per_day double precision NOT NULL, | ||
avs varchar NOT NULL, | ||
strategy varchar NOT NULL, | ||
multiplier numeric NOT NULL, | ||
reward_type varchar NOT NULL, | ||
operator varchar NOT NULL, | ||
shares numeric NOT NULL, | ||
operator_tokens numeric NOT NULL, | ||
operator_strategy_weight numeric NOT NULL, | ||
operator_total_strategy_weight numeric NOT NULL, | ||
operator_strategy_proportion numeric NOT NULL, | ||
operator_strategy_tokens numeric NOT NULL | ||
)`, | ||
} | ||
|
||
for _, query := range queries { | ||
if err := grm.Exec(query).Error; err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func (m *Migration) GetName() string { | ||
return "202412021311_stakerOperatorTables" | ||
} |
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
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
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
Oops, something went wrong.