Skip to content

Commit 731434b

Browse files
committed
fix: curve can have oracles which are not redstone
1 parent 1050d7e commit 731434b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

jsonnet/mocks/yearn_feed.jsonnet

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
},
3535
],
3636
tokens: [
37-
'#Token_1',
38-
'#Token_2',
39-
'#Token_3',
40-
'#Token_4',
37+
{ addr: '#Token_1', symbol: 'USDC', decimals: 6 },
38+
{ addr: '#Token_2', symbol: 'YFI', decimals: 18 },
39+
{ addr: '#Token_3', symbol: 'WETH', decimals: 18 },
40+
{ addr: '#Token_4', symbol: 'DAI', decimals: 8 },
4141
],
4242
}

models/price_oracle/po_v3/on_log.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,20 @@ func (mdl *PriceOracle) V3PriceFeedType(opts *bind.CallOpts, oracle, token strin
256256
sig = "e5693f41"
257257
} else if n == 3 {
258258
sig = "427cb6fe"
259+
} else {
260+
log.Warn("n", n, "is not supported")
259261
}
260262
pfBytes, err := core.CallFuncGetSingleValue(mdl.Client, sig, common.HexToAddress(oracle), 0, nil)
261263
log.CheckFatal(err)
262264
pf := common.BytesToAddress(pfBytes)
263265
pfTypeBytes, err := core.CallFuncGetSingleValue(mdl.Client, "3fd0875f", pf, 0, nil) // priceFeedType
264-
log.CheckFatal(err)
266+
if err != nil {
267+
log.Warn("priceFeedType is not implemented on ", pf, "err", err)
268+
}
265269
if new(big.Int).SetBytes(pfTypeBytes).Int64() == core.V3_REDSTONE_ORACLE {
266270
return pf.Hex()
267271
}
272+
log.Warn("priceFeedType is not redstone oracle ", pf, "type", new(big.Int).SetBytes(pfTypeBytes).Int64())
268273
return ""
269274
}
270275
nCoins := int(new(big.Int).SetBytes(nCoinBytes).Int64())

0 commit comments

Comments
 (0)