-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update total liquidity tracker code (#544)
- Loading branch information
1 parent
e6f23dc
commit 4aa6e38
Showing
4 changed files
with
98 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/osmosis-labs/osmosis/x/gamm/types" | ||
) | ||
|
||
func (k Keeper) SetLegacyTotalLiquidity(ctx sdk.Context, coins sdk.Coins) { | ||
store := ctx.KVStore(k.storeKey) | ||
store.Set(types.KeyTotalLiquidity, []byte(coins.String())) | ||
} | ||
|
||
func (k Keeper) GetLegacyTotalLiquidity(ctx sdk.Context) sdk.Coins { | ||
store := ctx.KVStore(k.storeKey) | ||
if !store.Has(types.KeyTotalLiquidity) { | ||
return sdk.Coins{} | ||
} | ||
|
||
bz := store.Get(types.KeyTotalLiquidity) | ||
coins, err := sdk.ParseCoinsNormalized(string(bz)) | ||
if err != nil { | ||
panic("invalid total liquidity value set") | ||
} | ||
|
||
return coins | ||
} | ||
|
||
func (k Keeper) DeleteLegacyTotalLiquidity(ctx sdk.Context) { | ||
store := ctx.KVStore(k.storeKey) | ||
store.Delete(types.KeyTotalLiquidity) | ||
} |
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