Skip to content

Commit

Permalink
feat: allow redstone url as env
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-98 committed Dec 28, 2024
1 parent 6a0c99e commit d74833d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/redstone/pod_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,19 @@ func (r *RSPriceOnDemandObj) convert(token common.Address) *RSPriceOnDemand {
pod: priceOnDemand,
}
}
func getRedstoneUrl() string {
return utils.GetEnvOrDefault("REDSTONE_URL", "https://testnet.gearbox.foundation/redstone")
}

func getLatestPodSign(details core.RedStonePF) map[string]*RSPriceOnDemandObj {
// prod/aave/1
url := fmt.Sprintf("https://testnet.gearbox.foundation/redstone/%s/%d?dataFeeds=%s", details.DataServiceId, details.SignersThreshold, details.DataId)
url := fmt.Sprintf("%s/%s/%d?dataFeeds=%s", getRedstoneUrl(), details.DataServiceId, details.SignersThreshold, details.DataId)
return getpodSign(url, "latest-"+details.DataId, -1)
}
func getHistoricPodSign(timestamp int64, details core.RedStonePF) map[string]*RSPriceOnDemandObj {
// prod/aave/1
timestamp = tenthMillSec(timestamp) // due to node js
url := fmt.Sprintf("https://testnet.gearbox.foundation/redstone/%s/%d/%d?dataFeeds=%s", details.DataServiceId, details.SignersThreshold, timestamp, details.DataId)
url := fmt.Sprintf("%s/%s/%d/%d?dataFeeds=%s", getRedstoneUrl(), details.DataServiceId, details.SignersThreshold, timestamp, details.DataId)
// log.Info(url)
return getpodSign(url, "historic-"+details.DataId, timestamp)
}
Expand Down

0 comments on commit d74833d

Please sign in to comment.