Skip to content

Commit

Permalink
refactor(v1beta3): convert params from map to slice
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Aug 3, 2023
1 parent 9c4d315 commit 29e52f5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/akash-network/node
go 1.20

require (
github.com/akash-network/akash-api v0.0.24
github.com/akash-network/akash-api v0.0.25
github.com/blang/semver/v4 v4.0.0
github.com/boz/go-lifecycle v0.1.1
github.com/cosmos/cosmos-sdk v0.45.16
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBA
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
github.com/akash-network/akash-api v0.0.24 h1:nIuftXhNI6w5oLjfncbb2BLxLEZvkwfxknbjYuFBI5M=
github.com/akash-network/akash-api v0.0.24/go.mod h1:9/uYusyBcZecBQCgZWUbXRu0i1tyxj4/ze45XB2oLIU=
github.com/akash-network/akash-api v0.0.25 h1:Gm7SZnR1Lu/0gvomG/drybgGzWCANWsQ+EoIICJbngA=
github.com/akash-network/akash-api v0.0.25/go.mod h1:9/uYusyBcZecBQCgZWUbXRu0i1tyxj4/ze45XB2oLIU=
github.com/akash-network/cometbft v0.34.27-akash h1:V1dApDOr8Ee7BJzYyQ7Z9VBtrAul4+baMeA6C49dje0=
github.com/akash-network/cometbft v0.34.27-akash/go.mod h1:BcCbhKv7ieM0KEddnYXvQZR+pZykTKReJJYf7YC7qhw=
github.com/akash-network/ledger-go v0.14.3 h1:LCEFkTfgGA2xFMN2CtiKvXKE7dh0QSM77PJHCpSkaAo=
Expand Down
5 changes: 3 additions & 2 deletions x/deployment/simulation/genesis.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package simulation

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"

types "github.com/akash-network/akash-api/go/node/deployment/v1beta3"
Expand All @@ -14,8 +15,8 @@ var (
func RandomizedGenState(simState *module.SimulationState) {
deploymentGenesis := &types.GenesisState{
Params: types.Params{
MinDeposits: map[string]uint32{
minDeposit.Denom: uint32(minDeposit.Amount.ToDec().TruncateInt64()),
MinDeposits: sdk.Coins{
minDeposit,
},
},
}
Expand Down
10 changes: 7 additions & 3 deletions x/take/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ func (k Keeper) SubtractFees(ctx sdk.Context, amt sdk.Coin) (sdk.Coin, sdk.Coin,
func (k Keeper) findRate(ctx sdk.Context, denom string) sdk.Dec {
params := k.GetParams(ctx)

rate, ok := params.DenomTakeRates[denom]
if !ok {
rate = params.DefaultTakeRate
rate := params.DefaultTakeRate

for _, denomRate := range params.DenomTakeRates {
if denom == denomRate.Denom {
rate = denomRate.Rate
break
}
}

// return percentage.
Expand Down
1 change: 1 addition & 0 deletions x/take/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ func NewAppModuleSimulation(k keeper.IKeeper) AppModuleSimulation {
}

// AppModuleSimulation functions

// GenerateGenesisState creates a randomized GenState of the staking module.
func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) {
simulation.RandomizedGenState(simState)
Expand Down

0 comments on commit 29e52f5

Please sign in to comment.