Skip to content

Commit

Permalink
more rename
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Nov 20, 2023
1 parent 6b7d6c2 commit 6e92850
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion x/uibc/quota/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (kb Builder) ExportGenesis(ctx sdk.Context) *uibc.GenesisState {
return &uibc.GenesisState{
Params: k.GetParams(),
Outflows: outflows,
OutflowSum: k.GetTotalOutflow(),
OutflowSum: k.GetOutflowSum(),
QuotaExpires: *quotaExpires,
Inflows: inflows,
InflowSum: k.GetInflowSum(),
Expand Down
2 changes: 1 addition & 1 deletion x/uibc/quota/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (q Querier) Outflows(goCtx context.Context, req *uibc.QueryOutflows) (
k := q.Keeper(&ctx)
var o sdk.Dec
if len(req.Denom) == 0 {
o = k.GetTotalOutflow()
o = k.GetOutflowSum()
} else {
d := k.GetTokenOutflows(req.Denom)
o = d.Amount
Expand Down
8 changes: 4 additions & 4 deletions x/uibc/quota/keeper/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func (k Keeper) SetOutflowSum(amount sdk.Dec) {
util.Panic(err)
}

// GetTotalOutflow returns the total outflow of ibc-transfer amount.
func (k Keeper) GetTotalOutflow() sdk.Dec {
// 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")
return amount
Expand Down Expand Up @@ -158,7 +158,7 @@ func (k Keeper) CheckAndUpdateQuota(denom string, newOutflow sdkmath.Int) error
// Allow outflow either of two conditions
// 1. Outflow Sum <= Total Outflow Quota
// 2. OR Outflow Sum <= params.InflowOutflowQuotaBase + (params.InflowOutflowQuotaRate * sum of all inflows)
outflowSum := k.GetTotalOutflow().Add(exchangePrice)
outflowSum := k.GetOutflowSum().Add(exchangePrice)
inflowSum := k.GetInflowSum()
if !params.TotalQuota.IsZero() {
if outflowSum.GT(params.TotalQuota) ||
Expand Down Expand Up @@ -223,7 +223,7 @@ func (k Keeper) UndoUpdateQuota(denom string, amount sdkmath.Int) error {
}
k.SetTokenOutflow(o)

totalOutflowSum := k.GetTotalOutflow()
totalOutflowSum := k.GetOutflowSum()
k.SetOutflowSum(totalOutflowSum.Sub(exchangePrice))
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion x/uibc/quota/keeper/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (k TestKeeper) checkOutflows(denom string, perToken, total int64) {
o := k.GetTokenOutflows(denom)
require.Equal(k.t, sdk.NewDec(perToken), o.Amount)

d := k.GetTotalOutflow()
d := k.GetOutflowSum()
require.Equal(k.t, sdk.NewDec(total), d)
}

Expand Down

0 comments on commit 6e92850

Please sign in to comment.