Skip to content

Commit 4acf559

Browse files
authored
fix: removed usda:usdt pair (#96)
1 parent cb88824 commit 4acf559

File tree

7 files changed

+0
-196
lines changed

7 files changed

+0
-196
lines changed

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ The `pricefeeder` is a tool developed for Nibiru's [Oracle Module consensus](htt
1818
- [Chainlink on B^2 Network](#chainlink-on-b2-network)
1919
- [Eris Protocol for stNIBI price](#eris-protocol-for-stnibi-price)
2020
- [Eris Protocol for stNIBI price](#eris-protocol-for-stnibi-price-1)
21-
- [Avalon Finance for sUSDa, USDa](#avalon-finance-for-susda-usda)
2221
- [Glossary](#glossary)
2322

2423
## Quick Start - Local Development
@@ -188,14 +187,6 @@ ERIS_PROTOCOL_CONTRACT_ADDRESS="nibi1udqqx30cw8nwjxtl4l28ym9hhrp933zlq8dqxfjzcdh
188187
ERIS_PROTOCOL_CONTRACT_ADDRESS="nibi1keqw4dllsczlldd7pmzp25wyl04fw5anh3wxljhg4fjuqj9xnxuqa82rpg"
189188
```
190189

191-
### Avalon Finance for sUSDa, USDa
192-
193-
194-
[Avalon Finance](https://avalonfinance.xyz) is a CeDeFi lending project that
195-
powers both USDa and sUSDa. The redeem rate between USDa and its yield-bearing variant, sUSDa, is retrieved from the API provided by Avalon Labs.
196-
197-
This data source adds queries for the "susda:usda" and "susda:usd" asset pairs.
198-
199190
### Chainlink on B^2 Network
200191

201192
Some token prices are retrieved from other chains Chainlink oracles.

config/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ var defaultExchangeSymbolsMap = map[string]map[asset.Pair]types.Symbol{
7575
"ustnibi:unibi": "ustnibi:unibi", // this is the only pair supported by the Eris Protocol smart contract
7676
},
7777

78-
sources.SourceNameUniswapV3: {
79-
"usda:usd": "USDa:USDT",
80-
},
81-
8278
sources.SourceNameChainLink: {
8379
"b2btc:btc": "uBTC/BTC",
8480
},

feeder/priceprovider.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -251,40 +251,6 @@ func (a AggregatePriceProvider) GetPrice(pair asset.Pair) types.Price {
251251
}
252252
}
253253

254-
case "susda:usd":
255-
priceSusdaUsda := a.GetPrice("susda:usda")
256-
if !priceSusdaUsda.Valid || priceSusdaUsda.Price <= 0 {
257-
// if we can't find a valid susda:usda price, return an invalid price
258-
a.logger.Warn().Str("pair", pairStr).Msg("no valid price found")
259-
aggregatePriceProvider.WithLabelValues(pairStr, "missing", "false").Inc()
260-
return types.Price{
261-
SourceName: "missing",
262-
Pair: pair,
263-
Price: types.PriceAbstain,
264-
Valid: false,
265-
}
266-
}
267-
268-
priceUsdaUsd := a.GetPrice("usda:usd")
269-
if priceUsdaUsd.Valid && priceUsdaUsd.Price > 0 {
270-
return types.Price{
271-
Pair: pair,
272-
Price: priceSusdaUsda.Price * priceUsdaUsd.Price,
273-
SourceName: priceSusdaUsda.SourceName,
274-
Valid: true,
275-
}
276-
}
277-
278-
// if either price is invalid, return an invalid price
279-
a.logger.Warn().Str("pair", pairStr).Msg("no valid price found")
280-
aggregatePriceProvider.WithLabelValues(pairStr, "missing", "false").Inc()
281-
return types.Price{
282-
SourceName: "missing",
283-
Pair: pair,
284-
Price: types.PriceAbstain,
285-
Valid: false,
286-
}
287-
288254
default:
289255
// for all other price pairs, iterate randomly, if we find a valid price, we return it
290256
// otherwise we go onto the next PriceProvider to ask for prices.

feeder/priceprovider_test.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/NibiruChain/nibiru/v2/x/common/asset"
1010
"github.com/NibiruChain/nibiru/v2/x/common/denoms"
1111
"github.com/rs/zerolog"
12-
"github.com/stretchr/testify/assert"
1312
"github.com/stretchr/testify/require"
1413

1514
"github.com/NibiruChain/pricefeeder/sources"
@@ -191,39 +190,4 @@ func TestAggregatePriceProvider(t *testing.T) {
191190
require.Equal(t, asset.NewPair("ustnibi", denoms.USD), price.Pair)
192191
require.Equal(t, sources.SourceNameErisProtocol, price.SourceName)
193192
})
194-
195-
t.Run(sources.SourceNameAvalon, func(t *testing.T) {
196-
pp := NewAggregatePriceProvider(
197-
map[string]map[asset.Pair]types.Symbol{
198-
sources.SourceNameAvalon: {
199-
"susda:usda": sources.Symbol_sUSDaUSDa,
200-
},
201-
sources.SourceNameUniswapV3: {
202-
"usda:usd": sources.Symbol_UniswapV3_USDaUSD,
203-
},
204-
},
205-
map[string]json.RawMessage{},
206-
zerolog.New(io.Discard),
207-
)
208-
defer pp.Close()
209-
<-time.After(sources.UpdateTick + 5*time.Second)
210-
211-
pair := asset.Pair("susda:usda")
212-
price := pp.GetPrice(pair)
213-
assert.Truef(t, price.Valid, "invalid price for %s", price.Pair)
214-
assert.Equal(t, pair, price.Pair)
215-
assert.Equal(t, sources.SourceNameAvalon, price.SourceName)
216-
217-
pair = asset.Pair("usda:usd")
218-
price = pp.GetPrice(pair)
219-
assert.Truef(t, price.Valid, "invalid price for %s", price.Pair)
220-
assert.EqualValues(t, pair, price.Pair)
221-
assert.Equal(t, sources.SourceNameUniswapV3, price.SourceName)
222-
223-
pair = asset.Pair("susda:usd")
224-
price = pp.GetPrice(pair)
225-
assert.Truef(t, price.Valid, "invalid price for %s", price.Pair)
226-
assert.EqualValues(t, pair, price.Pair)
227-
assert.Equal(t, sources.SourceNameAvalon, price.SourceName)
228-
})
229193
}

sources/avalon_finance.go

Lines changed: 0 additions & 84 deletions
This file was deleted.

sources/avalon_finance_test.go

Lines changed: 0 additions & 19 deletions
This file was deleted.

sources/sources.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,6 @@ var allSources = []NamedSource{
159159
return NewTickSource(symbols, ErisProtocolPriceUpdate, logger)
160160
},
161161
},
162-
{
163-
Name: SourceNameUniswapV3,
164-
F: func(
165-
symbols set.Set[types.Symbol],
166-
_ json.RawMessage,
167-
logger zerolog.Logger,
168-
) types.Source {
169-
return NewTickSource(symbols, UniswapV3PriceUpdate, logger)
170-
},
171-
},
172162
{
173163
Name: SourceNameChainLink,
174164
F: func(

0 commit comments

Comments
 (0)