Skip to content

Commit

Permalink
fix: optimism fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-98 committed Apr 3, 2024
1 parent 801b98f commit 176a3d9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions debts/tf_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ type FarmingCalculator struct {
}

func NewFarmingCalculator(chainId int64, testing bool) *FarmingCalculator {
tradingTokens := []string{"WETH", "stETH", "DAI", "SUSD", "FRAX", "GUSD", "LUSD", "WBTC", "USDC", "USDT", "LQTY", "LDO", "CVX", "FXS", "CRV", "SNX", // mainnet
"wstETH"} // arbitrum
tradingTokens := core.AllTradingSymbolForDBWithW()
//
tradingTokensMap := map[string]bool{}
syms := core.GetSymToAddrByChainId(chainId)
for _, tradingSym := range tradingTokens {
if addr, ok := syms.Tokens[tradingSym]; ok {
if addr, ok := syms.Tokens[string(tradingSym)]; ok {
tradingTokensMap[addr.Hex()] = true
} else if (tradingSym == "stETH" || tradingSym == "GUSD") && log.GetBaseNet(chainId) == "ARBITRUM" { // these tokens are not present on arbitrum
// ignore
} else if utils.Contains([]core.Symbol{"stETH", "GUSD", "LQTY", "CVX", "yvUSDC", "GMX", "ARB", "MKR", "sDAI", "APE"}, tradingSym) && log.GetBaseNet(chainId) == "OPTIMISM" {
} else {
log.Warnf("Trading token(%s) for tf_index missing from sdk config: %s", tradingSym, addr)
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/Gearbox-protocol/third-eye
go 1.20

require (
github.com/Gearbox-protocol/sdk-go v0.0.0-20240402092756-7897d52fb4bc
github.com/Gearbox-protocol/sdk-go v0.0.0-20240403124252-9047a977a533
github.com/ethereum/go-ethereum v1.13.14
github.com/go-playground/validator/v10 v10.4.1
github.com/google/go-cmp v0.5.9
Expand Down Expand Up @@ -86,6 +86,6 @@ require (

replace github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.1

replace github.com/Gearbox-protocol/sdk-go v0.0.0-20240313165159-fc110d9f032d => ../sdk-go
replace github.com/Gearbox-protocol/sdk-go v0.0.0-20240403100623-4bd3a2aeda08 => ../sdk-go

replace github.com/ethereum/go-ethereum v1.13.14 => github.com/OffchainLabs/go-ethereum v1.13.4-0.20240313010929-e5d8587e7227
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ contrib.go.opencensus.io/exporter/ocagent v0.6.0/go.mod h1:zmKjrJcdo0aYcVS7bmEeS
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
github.com/Gearbox-protocol/sdk-go v0.0.0-20240402092756-7897d52fb4bc h1:nCHIYwL3Ec/sQmfSSHYPYVCLWjWqpkXfQUtOxQDyTD8=
github.com/Gearbox-protocol/sdk-go v0.0.0-20240402092756-7897d52fb4bc/go.mod h1:GqBi61WLtfKxqYFle+ePGkWAOf5lKtgQBTOjGJwkgn0=
github.com/Gearbox-protocol/sdk-go v0.0.0-20240403124252-9047a977a533 h1:aXvmlUeWPTjtZFokwrxdugs0D7XJqlNxf2VO+gwb0HM=
github.com/Gearbox-protocol/sdk-go v0.0.0-20240403124252-9047a977a533/go.mod h1:GqBi61WLtfKxqYFle+ePGkWAOf5lKtgQBTOjGJwkgn0=
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
Expand Down
3 changes: 2 additions & 1 deletion models/aggregated_block_feed/sdk-addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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 @@ -57,7 +58,7 @@ func TokenSymMapFromchainId(chainId int64) TokenSymMap {
func (x TokenSymMap) getTokenAddr(sym string) string {
addr := x.symToAddr[sym]
if addr == core.NULL_ADDR {
if log.GetBaseNet(x.chainId) == "ARBITRUM" {
if utils.Contains([]string{"ARBITRUM", "OPTIMISM"}, log.GetBaseNet(x.chainId)) {
return ""
}
log.Fatal("Token sym not found in embedded jsonnet", sym)
Expand Down
5 changes: 3 additions & 2 deletions models/composite_chainlink/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,16 @@ func getSig(targetMethod string, discoveredAt int64, chainId int64) (sig string)
// TODO anvil fork
compositeOracleVersion := 0
baseNet := log.GetBaseNet(chainId)
if baseNet == "MAINNET" {
switch baseNet {
case "MAINNET":
if discoveredAt <= 15997386 {
compositeOracleVersion = 2
} else if discoveredAt <= 18544086 {
compositeOracleVersion = 210
} else {
compositeOracleVersion = 3
}
} else if baseNet == "ARBITRUM" {
case "ARBITRUM", "OPTIMISM":
compositeOracleVersion = 3
}
//
Expand Down

0 comments on commit 176a3d9

Please sign in to comment.