Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Nov 20, 2023
1 parent cd8e69f commit 2e32191
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions x/uibc/quota/keeper/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (

var (
keyPrefixDenomOutflows = []byte{0x01}
keyTotalOutflows = []byte{0x02}
keyOutflowSum = []byte{0x02}
keyParams = []byte{0x03}
keyQuotaExpires = []byte{0x04}
keyPrefixDenomInflows = []byte{0x05}
keyTotalInflows = []byte{0x06}
keyInflowSum = []byte{0x06}
)

func keyTotalOutflow(ibcDenom string) []byte {
func keyTokenOutflow(ibcDenom string) []byte {
// keyPrefixDenomOutflows | denom
return util.ConcatBytes(0, keyPrefixDenomOutflows, []byte(ibcDenom))
}
Expand Down
2 changes: 1 addition & 1 deletion x/uibc/quota/keeper/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sdk "github.com/cosmos/cosmos-sdk/types"
// getOldTotalOutflow returns the total outflow of ibc-transfer amount.
// Note: only use for v6.2 migration from v6.1.0
func (k Keeper) getOldTotalOutflow() sdk.Dec {
bz := k.store.Get(keyTotalOutflows)
bz := k.store.Get(keyOutflowSum)
return sdk.MustNewDecFromStr(string(bz))
}

Expand Down
12 changes: 6 additions & 6 deletions x/uibc/quota/keeper/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (k Keeper) GetAllOutflows() (sdk.DecCoins, error) {
// GetTokenOutflows returns sum of denom outflows in USD value in the DecCoin structure.
func (k Keeper) GetTokenOutflows(denom string) sdk.DecCoin {
// When token outflow is not stored in store it will return 0
amount, _ := store.GetDec(k.store, keyTotalOutflow(denom), "total_outflow")
amount, _ := store.GetDec(k.store, keyTokenOutflow(denom), "total_outflow")
return sdk.NewDecCoinFromDec(denom, amount)
}

Expand All @@ -42,20 +42,20 @@ func (k Keeper) SetTokenOutflows(outflows sdk.DecCoins) {

// SetOutflowSum save the total outflow of ibc-transfer amount.
func (k Keeper) SetOutflowSum(amount sdk.Dec) {
err := store.SetDec(k.store, keyTotalOutflows, amount, "total_outflow_sum")
err := store.SetDec(k.store, keyOutflowSum, amount, "total_outflow_sum")
util.Panic(err)
}

// GetOutflowSum returns the total outflow of ibc-transfer amount.
func (k Keeper) GetOutflowSum() sdk.Dec {
// When total outflow is not stored in store it will return 0
amount, _ := store.GetDec(k.store, keyTotalOutflows, "total_outflow")
amount, _ := store.GetDec(k.store, keyOutflowSum, "total_outflow")
return amount
}

// SetTokenOutflow save the outflows of denom into store.
func (k Keeper) SetTokenOutflow(outflow sdk.DecCoin) {
key := keyTotalOutflow(outflow.Denom)
key := keyTokenOutflow(outflow.Denom)
err := store.SetDec(k.store, key, outflow.Amount, "total_outflow")
util.Panic(err)
}
Expand Down Expand Up @@ -92,13 +92,13 @@ func (k Keeper) GetTokenInflow(denom string) sdk.DecCoin {
// GetInflowSum returns the total inflow of ibc-transfer amount.
func (k Keeper) GetInflowSum() sdk.Dec {
// When total inflow is not stored in store it will return 0
amount, _ := store.GetDec(k.store, keyTotalInflows, "total_inflows")
amount, _ := store.GetDec(k.store, keyInflowSum, "total_inflows")
return amount
}

// SetInflowSum save the total inflow of ibc-transfer amount.
func (k Keeper) SetInflowSum(amount sdk.Dec) {
err := store.SetDec(k.store, keyTotalInflows, amount, "total_inflows")
err := store.SetDec(k.store, keyInflowSum, amount, "total_inflows")
util.Panic(err)
}

Expand Down

0 comments on commit 2e32191

Please sign in to comment.