Skip to content

Commit

Permalink
fix: handle cases for net other than mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-98 committed Apr 4, 2024
1 parent 6ed0d6a commit 6bc5b69
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion engine/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (e *Engine) addstETHToken() {
if core.NULL_ADDR != addr { // on arbitrum
stETHToken := rebase_token.NewRebaseToken(addr.Hex(), e.Client, e.repo)
e.repo.AddSyncAdapter(stETHToken)
} else if log.GetBaseNet(core.GetChainId(e.Client)) != "ARBITRUM" {
} else if log.GetBaseNet(core.GetChainId(e.Client)) == "MAINNET" {
log.Warnf("stETH is not present on %s", log.GetBaseNet(core.GetChainId(e.Client)))
}
}
Expand Down
2 changes: 1 addition & 1 deletion models/aggregated_block_feed/dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func getDepGraph(chainId int64) map[string][]string {
"auraB_rETH_STABLE": {},
"auraB_rETH_STABLE_vault": {},
}
if log.GetBaseNet(chainId) == "ARBITRUM" {
if log.GetBaseNet(chainId) != "MAINNET" {
for sym, deps := range depGraph {
x := make([]string, 0, len(deps))
for _, d := range deps {
Expand Down
3 changes: 1 addition & 2 deletions models/aggregated_block_feed/sdk-addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package aggregated_block_feed
import (
"github.com/Gearbox-protocol/sdk-go/core"
"github.com/Gearbox-protocol/sdk-go/log"
"github.com/Gearbox-protocol/sdk-go/utils"
"github.com/ethereum/go-ethereum/common"
)

Expand Down Expand Up @@ -58,7 +57,7 @@ func TokenSymMapFromchainId(chainId int64) TokenSymMap {
func (x TokenSymMap) getTokenAddr(sym string) string {
addr := x.symToAddr[sym]
if addr == core.NULL_ADDR {
if utils.Contains([]string{"ARBITRUM", "OPTIMISM"}, log.GetBaseNet(x.chainId)) {
if log.GetBaseNet(x.chainId) != "MAINNET" {
return ""
}
log.Fatal("Token sym not found in embedded jsonnet", sym)
Expand Down
2 changes: 1 addition & 1 deletion models/pool/pool_common/weth_gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func GetPoolGateways(client core.ClientI) map[common.Address]GatewayDetails {
return map[common.Address]GatewayDetails{}
}
symToAddrStore := core.GetSymToAddrByChainId(chainId)
if log.GetBaseNet(chainId) == "ARBITRUM" {
if log.GetBaseNet(chainId) != "MAINNET" {
return map[common.Address]GatewayDetails{
symToAddrStore.Exchanges["GEARBOX_WETH_POOL"]: {
Gateway: symToAddrStore.Exchanges["WETH_GATEWAY"],
Expand Down
2 changes: 1 addition & 1 deletion repository/handlers/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func NewTokensRepo(client core.ClientI) *TokensRepo {
}

func (repo *TokensRepo) GetTokenFromSdk(symbol string) string {
if symbol == "stETH" && log.GetBaseNet(core.GetChainId(repo.client)) == "ARBITRUM" {
if symbol == "stETH" && log.GetBaseNet(core.GetChainId(repo.client)) != "MAINNET" {
return ""
}
if addr, ok := repo.symToAddrToken[symbol]; ok {
Expand Down

0 comments on commit 6bc5b69

Please sign in to comment.