Skip to content

Commit

Permalink
Update oracle.go
Browse files Browse the repository at this point in the history
  • Loading branch information
nnn-gif committed Sep 13, 2023
1 parent 84e03ed commit fc5b3eb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/model/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ func (rdb *RelDB) UpdateFeederAddressCheckSum(oracleaddress string) (err error)
return
}

func (rdb *RelDB) GetAllFeeders() (oracleconfigs []dia.OracleConfig, err error) {
func (rdb *RelDB) GetAllFeeders(isDeleted bool) (oracleconfigs []dia.OracleConfig, err error) {
var (
rows pgx.Rows
deviationFloat float64
)

query := fmt.Sprintf(`
SELECT address, feeder_id, owner,symbols, chainID, frequency, sleepseconds, deviationpermille, blockchainnode, active,mandatory_frequency, feeder_address, createddate, COALESCE(lastupdate, '0001-01-01 00:00:00'::timestamp),deleted
FROM %s WHERE mandatory_frequency IS NOT NULL
FROM %s WHERE mandatory_frequency IS NOT NULL and deleted=$1
`, oracleconfigTable)
rows, err = rdb.postgresClient.Query(context.Background(), query)
rows, err = rdb.postgresClient.Query(context.Background(), query, isDeleted)
if err != nil {
return
}
Expand Down Expand Up @@ -275,6 +275,7 @@ func (rdb *RelDB) GetOracleConfig(address, chainid string) (oracleconfig dia.Ora
SELECT address, feeder_id, owner,symbols, chainid, feedSelection,deviationpermille, sleepseconds,frequency, blockchainnode, mandatory_frequency
FROM %s
WHERE address=$1 and chainid=$2`, oracleconfigTable)
fmt.Println(query)
err = rdb.postgresClient.QueryRow(context.Background(), query, address, chainid).Scan(&oracleconfig.Address, &oracleconfig.FeederID, &oracleconfig.Owner, &symbols, &oracleconfig.ChainID, &feedSelection, &oracleconfig.DeviationPermille, &oracleconfig.SleepSeconds, &oracleconfig.Frequency, &oracleconfig.BlockchainNode, &oracleconfig.MandatoryFrequency)
if err != nil {
return
Expand Down

0 comments on commit fc5b3eb

Please sign in to comment.