Skip to content

Commit

Permalink
fix: oracle accept list no longer automatically adds blacklisted toke…
Browse files Browse the repository at this point in the history
…ns (#1736)

* fix: oracle accept list no longer automatically adds blacklisted tokens

* cl++

* switch order

(cherry picked from commit b1454c1)

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
toteki authored and mergify[bot] committed Feb 14, 2023
1 parent c9c37b5 commit c79c124
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Fixes

<<<<<<< HEAD
- [1800](https://github.com/umee-network/umee/pull/1800) Handle non-capitalized assets when calling the historacle data.
=======
- [1736](https://github.com/umee-network/umee/pull/1736) Blacklisted tokens no longer add themselves back to the oracle accept list.
>>>>>>> b1454c1 (fix: oracle accept list no longer automatically adds blacklisted tokens (#1736))
## [v4.0.0](https://github.com/umee-network/umee/releases/tag/v4.0.0) - 2023-01-20

Expand Down
5 changes: 5 additions & 0 deletions x/oracle/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ func (k Keeper) Hooks() Hooks {
// it checks if the provided Token should be added to the existing accepted list
// of assets for the x/oracle module.
func (h Hooks) AfterTokenRegistered(ctx sdk.Context, token leveragetypes.Token) {
if token.Blacklist {
// Blacklisted tokens should not trigger updates to the oracle accept list
return
}

acceptList := h.k.AcceptList(ctx)

var tokenExists bool
Expand Down
9 changes: 9 additions & 0 deletions x/oracle/keeper/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,13 @@ func (s *IntegrationTestSuite) TestHooks_AfterTokenRegistered() {
Exponent: 6,
})
s.Require().Len(s.app.OracleKeeper.AcceptList(s.ctx), 3)

// require a blacklisted token does not update the accept list
h.AfterTokenRegistered(s.ctx, leveragetypes.Token{
BaseDenom: "unope",
SymbolDenom: "NOPE",
Exponent: 6,
Blacklist: true,
})
s.Require().Len(s.app.OracleKeeper.AcceptList(s.ctx), 3)
}

0 comments on commit c79c124

Please sign in to comment.