Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: oracle accept list no longer automatically adds blacklisted tokens #1736

Merged
merged 3 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

### Fixes

- [1736](https://github.com/umee-network/umee/pull/1736) Blacklisted tokens no longer add themselves back to the oracle accept list.

## [v4.0.0](https://github.com/umee-network/umee/releases/tag/v4.0.0) - 2023-01-20

### API Breaking
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)
}