Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor and resolve issues #380

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions x/collector/keeper/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,15 +491,14 @@ func (k Keeper) SetAuctionMappingForApp(ctx sdk.Context, records ...types.Collec
return nil
}

func (k Keeper) DuplicateCheck(ctx sdk.Context, appId, assetId uint64) (found bool, index int) {
result, found := k.GetAuctionMappingForApp(ctx, appId)
func (k Keeper) DuplicateCheck(ctx sdk.Context, appID, assetID uint64) (found bool, index int) {
result, found := k.GetAuctionMappingForApp(ctx, appID)
if !found {
return false, 0
} else {
for i, data := range result.AssetIdToAuctionLookup {
if data.AssetId == assetId {
return true, i
}
}
for i, data := range result.AssetIdToAuctionLookup {
if data.AssetId == assetID {
return true, i
}
}

Expand Down
5 changes: 2 additions & 3 deletions x/esm/keeper/esm.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/comdex-official/comdex/app/wasm/bindings"
assettypes "github.com/comdex-official/comdex/x/asset/types"
"github.com/comdex-official/comdex/x/esm/types"
esmtypes "github.com/comdex-official/comdex/x/esm/types"
vaulttypes "github.com/comdex-official/comdex/x/vault/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down Expand Up @@ -422,7 +421,7 @@ func (k Keeper) SetUpCollateralRedemptionForVault(ctx sdk.Context, appId uint64)
k.DeleteAddressFromAppExtendedPairVaultMapping(ctx, data.ExtendedPairVaultID, data.Id, data.AppId)
esmStatus, found := k.GetESMStatus(ctx, data.AppId)
if !found {
return esmtypes.ErrESMParamsNotFound
return types.ErrESMParamsNotFound
}
esmStatus.VaultRedemptionStatus = true
k.SetESMStatus(ctx, esmStatus)
Expand Down Expand Up @@ -523,7 +522,7 @@ func (k Keeper) SetUpCollateralRedemptionForStableVault(ctx sdk.Context, appId u
k.DeleteAddressFromAppExtendedPairVaultMapping(ctx, data.ExtendedPairVaultID, data.Id, data.AppId)
esmStatus, found := k.GetESMStatus(ctx, data.AppId)
if !found {
return esmtypes.ErrESMParamsNotFound
return types.ErrESMParamsNotFound
}
esmStatus.StableVaultRedemptionStatus = true
k.SetESMStatus(ctx, esmStatus)
Expand Down
8 changes: 4 additions & 4 deletions x/esm/keeper/klsw.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func (k Keeper) SetKillSwitchData(ctx sdk.Context, switchParams types.KillSwitch
return nil
}

func (k Keeper) GetKillSwitchData(ctx sdk.Context, app_id uint64) (switchParams types.KillSwitchParams, found bool) {
func (k Keeper) GetKillSwitchData(ctx sdk.Context, appID uint64) (switchParams types.KillSwitchParams, found bool) {
var (
store = ctx.KVStore(k.storeKey)
key = types.KillSwitchData(app_id)
key = types.KillSwitchData(appID)
value = store.Get(key)
)

Expand Down Expand Up @@ -60,8 +60,8 @@ func (k Keeper) GetAllKillSwitchData(ctx sdk.Context) (killSwitchParams []types.
}

func (k Keeper) Admin(ctx sdk.Context, from string) bool {
var from_address = k.AdminParam(ctx)
for _, addr := range from_address {
var fromAddress = k.AdminParam(ctx)
for _, addr := range fromAddress {
if addr == from {
return true
}
Expand Down
4 changes: 2 additions & 2 deletions x/esm/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func ESMStatusKey(id uint64) []byte {
return append(ESMStatusPrefix, sdk.Uint64ToBigEndian(id)...)
}

func KillSwitchData(appId uint64) []byte {
return append(KillSwitchDataKey, sdk.Uint64ToBigEndian(appId)...)
func KillSwitchData(appID uint64) []byte {
return append(KillSwitchDataKey, sdk.Uint64ToBigEndian(appID)...)
}

func UserDepositByAppKey(owner string, id uint64) []byte {
Expand Down
2 changes: 1 addition & 1 deletion x/liquidation/expected/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type AuctionKeeper interface {
}

type EsmKeeper interface {
GetKillSwitchData(ctx sdk.Context, app_id uint64) (esmtypes.KillSwitchParams, bool)
GetKillSwitchData(ctx sdk.Context, appID uint64) (esmtypes.KillSwitchParams, bool)
GetESMStatus(ctx sdk.Context, id uint64) (esmStatus esmtypes.ESMStatus, found bool)
}

Expand Down
2 changes: 1 addition & 1 deletion x/vault/expected/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type CollectorKeeper interface {
}

type EsmKeeper interface {
GetKillSwitchData(ctx sdk.Context, app_id uint64) (esmtypes.KillSwitchParams, bool)
GetKillSwitchData(ctx sdk.Context, appID uint64) (esmtypes.KillSwitchParams, bool)
GetESMStatus(ctx sdk.Context, id uint64) (esmStatus esmtypes.ESMStatus, found bool)
GetESMMarketForAsset(ctx sdk.Context, id uint64) (esmMarket esmtypes.ESMMarketPrice, found bool)
GetESMTriggerParams(ctx sdk.Context, id uint64) (esmTriggerParams esmtypes.ESMTriggerParams, found bool)
Expand Down