Skip to content

Commit

Permalink
stablestake default params update and code cleanup with gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
jelysn committed Dec 11, 2023
1 parent 2f6d10e commit b66b45b
Show file tree
Hide file tree
Showing 165 changed files with 160 additions and 412 deletions.
4 changes: 1 addition & 3 deletions x/accountedpool/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import (
"github.com/elys-network/elys/x/accountedpool/types"
)

var (
DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())
)
var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())

const (
flagPacketTimeoutTimestamp = "packet-timeout-timestamp"
Expand Down
2 changes: 0 additions & 2 deletions x/accountedpool/keeper/accounted_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func (k Keeper) SetAccountedPool(ctx sdk.Context, accountedPool types.AccountedP
func (k Keeper) GetAccountedPool(
ctx sdk.Context,
PoolId uint64,

) (val types.AccountedPool, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AccountedPoolKeyPrefix))

Expand All @@ -39,7 +38,6 @@ func (k Keeper) GetAccountedPool(
func (k Keeper) RemoveAccountedPool(
ctx sdk.Context,
poolId uint64,

) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AccountedPoolKeyPrefix))
store.Delete(types.AccountedPoolKey(
Expand Down
1 change: 1 addition & 0 deletions x/accountedpool/keeper/accounted_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func TestAccountedPoolGet(t *testing.T) {
)
}
}

func TestAccountedPoolRemove(t *testing.T) {
keeper, ctx := keepertest.AccountedPoolKeeper(t)
items := createNAccountedPool(keeper, ctx, 10)
Expand Down
1 change: 0 additions & 1 deletion x/accountedpool/keeper/query_accounted_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func (k Keeper) AccountedPoolAll(goCtx context.Context, req *types.QueryAllAccou
accountedPools = append(accountedPools, accountedPool)
return nil
})

if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
Expand Down
1 change: 0 additions & 1 deletion x/accountedpool/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func TestGenesisState_Validate(t *testing.T) {
{
desc: "valid genesis state",
genState: &types.GenesisState{

AccountedPoolList: []types.AccountedPool{
{
PoolId: (uint64)(0),
Expand Down
4 changes: 1 addition & 3 deletions x/accountedpool/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import (
"gopkg.in/yaml.v2"
)

var (
_ paramtypes.ParamSet = (*Params)(nil)
)
var _ paramtypes.ParamSet = (*Params)(nil)

// ParamKeyTable the param key table for launch module
func ParamKeyTable() paramtypes.KeyTable {
Expand Down
5 changes: 0 additions & 5 deletions x/amm/client/cli/query_balance.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/elys-network/elys/x/amm/types"
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

func CmdBalance() *cobra.Command {
cmd := &cobra.Command{
Use: "balance [address] [denom]",
Expand All @@ -28,7 +24,6 @@ func CmdBalance() *cobra.Command {
queryClient := types.NewQueryClient(clientCtx)

params := &types.QueryBalanceRequest{

Address: reqAddress,
Denom: reqDenom,
}
Expand Down
4 changes: 0 additions & 4 deletions x/amm/client/cli/query_in_route_by_denom.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/elys-network/elys/x/amm/types"
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

func CmdInRouteByDenom() *cobra.Command {
cmd := &cobra.Command{
Use: "in-route-by-denom [denom-in] [denom-out]",
Expand Down
4 changes: 0 additions & 4 deletions x/amm/client/cli/query_out_route_by_denom.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/elys-network/elys/x/amm/types"
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

func CmdOutRouteByDenom() *cobra.Command {
cmd := &cobra.Command{
Use: "out-route-by-denom [denom-out] [denom-in]",
Expand Down
4 changes: 0 additions & 4 deletions x/amm/client/cli/query_swap_estimation_by_denom.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/elys-network/elys/x/amm/types"
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

func CmdSwapEstimationByDenom() *cobra.Command {
cmd := &cobra.Command{
Use: "swap-estimation-by-denom [amount] [denom-in] [denom-out]",
Expand Down
2 changes: 0 additions & 2 deletions x/amm/client/cli/query_tracked_slippage.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func CmdTrackedSlippage() *cobra.Command {
Example: "elysd q amm tracked-slippage 1",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {

clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
Expand Down Expand Up @@ -54,7 +53,6 @@ func CmdTrackedSlippageAll() *cobra.Command {
Example: "elysd q amm tracked-slippage-all",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) (err error) {

clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
Expand Down
4 changes: 1 addition & 3 deletions x/amm/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import (
"github.com/elys-network/elys/x/amm/types"
)

var (
DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())
)
var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())

const (
FlagDiscount = "discount"
Expand Down
3 changes: 0 additions & 3 deletions x/amm/client/cli/tx_create_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cli

import (
"errors"
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
Expand All @@ -12,8 +11,6 @@ import (
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

const (
FlagSwapFee = "swap-fee"
FlagExitFee = "exit-fee"
Expand Down
4 changes: 0 additions & 4 deletions x/amm/client/cli/tx_exit_pool.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
Expand All @@ -12,8 +10,6 @@ import (
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

func CmdExitPool() *cobra.Command {
cmd := &cobra.Command{
Use: "exit-pool [pool-id] [min-amounts-out] [share-amount-in]",
Expand Down
2 changes: 0 additions & 2 deletions x/amm/client/cli/tx_join_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

func CmdJoinPool() *cobra.Command {
cmd := &cobra.Command{
Use: "join-pool [pool-id] [max-amounts-in] [share-amount-out]",
Expand Down
4 changes: 0 additions & 4 deletions x/amm/client/cli/tx_swap_by_denom.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
Expand All @@ -11,8 +9,6 @@ import (
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

const (
FlagMinAmount = "min-amount"
FlagMaxAmount = "max-amount"
Expand Down
4 changes: 0 additions & 4 deletions x/amm/client/cli/tx_swap_exact_amount_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package cli

import (
"errors"
"strconv"

"strings"

"cosmossdk.io/math"
Expand All @@ -16,8 +14,6 @@ import (
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

func CmdSwapExactAmountIn() *cobra.Command {
cmd := &cobra.Command{
Use: "swap-exact-amount-in [token-in] [token-out-min-amount] [swap-route-pool-ids] [swap-route-denoms]",
Expand Down
4 changes: 0 additions & 4 deletions x/amm/client/cli/tx_swap_exact_amount_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package cli

import (
"errors"
"strconv"

"strings"

"cosmossdk.io/math"
Expand All @@ -16,8 +14,6 @@ import (
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

func CmdSwapExactAmountOut() *cobra.Command {
cmd := &cobra.Command{
Use: "swap-exact-amount-out [token-out] [token-out-max-amount] [swap-route-pool-ids] [swap-route-denoms]",
Expand Down
4 changes: 0 additions & 4 deletions x/amm/client/cli/tx_update_pool_params.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
Expand All @@ -12,8 +10,6 @@ import (
"github.com/spf13/cobra"
)

var _ = strconv.Itoa(0)

func CmdUpdatePoolParams() *cobra.Command {
cmd := &cobra.Command{
Use: "update-pool-params [pool-id] [flags]",
Expand Down
1 change: 0 additions & 1 deletion x/amm/keeper/calc_in_route_spot_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func (k Keeper) CalcInRouteSpotPrice(ctx sdk.Context, tokenIn sdk.Coin, routes [
// Estimate swap
snapshot := k.GetPoolSnapshotOrSet(ctx, pool)
swapResult, err := k.CalcOutAmtGivenIn(ctx, pool.PoolId, k.oracleKeeper, &snapshot, tokensIn, tokenOutDenom, swapFee)

if err != nil {
return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err
}
Expand Down
1 change: 0 additions & 1 deletion x/amm/keeper/calc_out_route_spot_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func (k Keeper) CalcOutRouteSpotPrice(ctx sdk.Context, tokenOut sdk.Coin, routes
// Estimate swap
snapshot := k.GetPoolSnapshotOrSet(ctx, pool)
swapResult, err := k.CalcInAmtGivenOut(ctx, pool.PoolId, k.oracleKeeper, &snapshot, tokensOut, tokenInDenom, swapFee)

if err != nil {
return sdk.ZeroDec(), sdk.Coin{}, sdk.ZeroDec(), sdk.ZeroDec(), sdk.Coin{}, err
}
Expand Down
1 change: 1 addition & 0 deletions x/amm/keeper/denom_liquidity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestDenomLiquidityGet(t *testing.T) {
)
}
}

func TestDenomLiquidityRemove(t *testing.T) {
keeper, ctx, _, _ := keepertest.AmmKeeper(t)
items := createNDenomLiquidity(keeper, ctx, 10)
Expand Down
2 changes: 1 addition & 1 deletion x/amm/keeper/keeper_join_pool_no_swap.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (k Keeper) JoinPoolNoSwap(
}

// check that needed lp liquidity does not exceed the given `tokenInMaxs` parameter. Return error if so.
//if tokenInMaxs == 0, don't do this check.
// if tokenInMaxs == 0, don't do this check.
if tokenInMaxs.Len() != 0 {
if !(neededLpLiquidity.DenomsSubsetOf(tokenInMaxs)) {
return nil, sdk.ZeroInt(), sdkerrors.Wrapf(types.ErrLimitMaxAmount, "TokenInMaxs does not include all the tokens that are part of the target pool,"+
Expand Down
1 change: 0 additions & 1 deletion x/amm/keeper/keeper_update_pool_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ func (k Keeper) UpdatePoolParams(ctx sdk.Context, poolId uint64, poolParams type
k.SetPool(ctx, pool)

return pool.PoolId, pool.PoolParams, nil

}
1 change: 0 additions & 1 deletion x/amm/keeper/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func (k Keeper) GetPool(
func (k Keeper) RemovePool(
ctx sdk.Context,
poolId uint64,

) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PoolKeyPrefix))
store.Delete(types.PoolKey(
Expand Down
1 change: 1 addition & 0 deletions x/amm/keeper/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestPoolGet(t *testing.T) {
)
}
}

func TestPoolRemove(t *testing.T) {
keeper, ctx, _, _ := keepertest.AmmKeeper(t)
items := createNPool(keeper, ctx, 10)
Expand Down
1 change: 0 additions & 1 deletion x/amm/keeper/query_denom_liquidity.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func (k Keeper) DenomLiquidityAll(goCtx context.Context, req *types.QueryAllDeno
denomLiquiditys = append(denomLiquiditys, denomLiquidity)
return nil
})

if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
Expand Down
1 change: 0 additions & 1 deletion x/amm/keeper/query_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func (k Keeper) PoolAll(goCtx context.Context, req *types.QueryAllPoolRequest) (
pools = append(pools, pool)
return nil
})

if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
Expand Down
1 change: 0 additions & 1 deletion x/amm/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func TestGenesisState_Validate(t *testing.T) {
{
desc: "valid genesis state",
genState: &types.GenesisState{

PoolList: []types.Pool{
{
PoolId: 0,
Expand Down
4 changes: 1 addition & 3 deletions x/assetprofile/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import (
"github.com/elys-network/elys/x/assetprofile/types"
)

var (
DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())
)
var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())

const (
flagPacketTimeoutTimestamp = "packet-timeout-timestamp"
Expand Down
1 change: 1 addition & 0 deletions x/assetprofile/keeper/entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func TestEntryGet(t *testing.T) {
)
}
}

func TestEntryRemove(t *testing.T) {
keeper, ctx := keepertest.AssetprofileKeeper(t)
items := createNEntry(keeper, ctx, 10)
Expand Down
2 changes: 1 addition & 1 deletion x/assetprofile/keeper/msg_server_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (k msgServer) CreateEntry(goCtx context.Context, msg *types.MsgCreateEntry)
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "entry already set")
}

var entry = types.Entry{
entry := types.Entry{
Authority: msg.Authority,
BaseDenom: msg.BaseDenom,
Decimals: msg.Decimals,
Expand Down
Loading

0 comments on commit b66b45b

Please sign in to comment.