-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrating oracle old exg rates to new exg rates format (includ…
…e timestamp format) (#2272) * migrating oracle old exg rate format to new exg rates format * retrigger checks --------- Co-authored-by: Egor Kostetskiy <[email protected]> Co-authored-by: kosegor <[email protected]>
- Loading branch information
1 parent
33624ed
commit a174a91
Showing
5 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package migrations | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// MigrateOldExgRatesToExgRatesWithTimestamp will migrate old exchnage rate of denoms into new exchange rate format with | ||
// timestamp into store. | ||
func (m Migrator) MigrateOldExgRatesToExgRatesWithTimestamp(ctx sdk.Context) { | ||
m.keeper.IterateOldExchangeRates(ctx, func(s string, d sdk.Dec) bool { | ||
ctx.Logger().Info("Migrating old exchange rate to new exchange rate format", "denom", s) | ||
m.keeper.SetExchangeRateWithTimestamp(ctx, s, d, ctx.BlockTime()) | ||
return false | ||
}) | ||
} |
7 changes: 4 additions & 3 deletions
7
x/oracle/keeper/migrations.go → x/oracle/migrations/migrations.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters