keeper

package
v0.6.7-rc6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

NewMsgServerImpl creates and returns a new types.MsgServer, fulfilling the icacontrol Msg service interface

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers the gal module invariants

Types

type Hooks

type Hooks struct {
	// contains filtered or unexported fields
}

Hooks wrapper struct for gal keeper

func (Hooks) AfterDelegateEnd

func (h Hooks) AfterDelegateEnd(ctx sdk.Context, delegateMsg stakingtypes.MsgDelegate)

func (Hooks) AfterDelegateFail added in v0.6.3

func (h Hooks) AfterDelegateFail(ctx sdk.Context, delegateMsg stakingtypes.MsgDelegate)

func (Hooks) AfterIcaWithdrawFail added in v0.6.5

func (h Hooks) AfterIcaWithdrawFail(ctx sdk.Context, transferMsg transfertypes.MsgTransfer)

func (Hooks) AfterOnRecvPacket

func (h Hooks) AfterOnRecvPacket(ctx sdk.Context, data transfertypes.FungibleTokenPacketData)

func (Hooks) AfterTransferEnd

func (h Hooks) AfterTransferEnd(ctx sdk.Context, data transfertypes.FungibleTokenPacketData, baseDenom string)

AfterTransferEnd coins user deposit information. It will be used in share token minting process.

func (Hooks) AfterTransferFail added in v0.6.3

func (h Hooks) AfterTransferFail(ctx sdk.Context, data transfertypes.FungibleTokenPacketData, baseDenom string)

func (Hooks) AfterUndelegateEnd

func (h Hooks) AfterUndelegateEnd(ctx sdk.Context, undelegateMsg stakingtypes.MsgUndelegate, msg *stakingtypes.MsgUndelegateResponse)

AfterUndelegateEnd is executed when ICA undelegation request finished. 1. It removes undelegation history in store. 2. It saves undelegation finish time to store.

func (Hooks) AfterUndelegateFail added in v0.6.3

func (h Hooks) AfterUndelegateFail(ctx sdk.Context, undelegateMsg stakingtypes.MsgUndelegate)

func (Hooks) AfterWithdrawEnd

func (h Hooks) AfterWithdrawEnd(ctx sdk.Context, transferMsg transfertypes.MsgTransfer)

AfterWithdrawEnd is executed IcaWithdraw request finished. 1. Increase the withdrawal version. 2. The withdrawal status registered as transferred changes

type IBCTransferOption

type IBCTransferOption struct {
	SourcePort    string
	SourceChannel string
	Token         sdk.Coin
	Sender        string
	Receiver      string
}

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper defines a module interface that facilitates the transfer of coins between accounts.

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec,
	key sdk.StoreKey,
	paramSpace paramtypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	icaControlKeeper icacontrolkeeper.Keeper,
	ibcTransferKeeper transfer.Keeper,
	oracleKeeper oraclekeeper.Keeper,
	airdropKeeper types.AirdropKeeper,
	channelKeeper ibcchanneltypes.Keeper) Keeper

func (Keeper) CalculateDepositAlpha

func (k Keeper) CalculateDepositAlpha(userDepositAmt, totalShareTokenSupply, totalStakedAmount *big.Int) *big.Int

CalculateDepositAlpha calculates alpha value. DepositAlpha = userDepositAmount / totalStakedAmount Issued snAsset = Alpha * totalShareTokenSupply

func (Keeper) CalculateWithdrawAlpha

func (k Keeper) CalculateWithdrawAlpha(burnedStTokenAmt, totalShareTokenSupply, totalStakedAmount *big.Int) *big.Int

CalculateWithdrawAlpha calculates lambda value. WithdrawAlpha = userWithdrawAmount / totalStakedAmount Issued coin = Lambda * totalShareTokenSupply

func (Keeper) ChangeDelegateState added in v0.6.5

func (k Keeper) ChangeDelegateState(ctx sdk.Context, zoneId string, version types.DelegateVersion)

func (Keeper) ChangeDepositState

func (k Keeper) ChangeDepositState(ctx sdk.Context, zoneId, depositor string)

ChangeDepositState updates the deposit records corresponding to the preState to postState. This operation runs in the hook after the remote deposit is run.

func (Keeper) ChangeUndelegateState

func (k Keeper) ChangeUndelegateState(ctx sdk.Context, zoneId string, state types.UndelegatedStatusType)

ChangeUndelegateState changes the status for recorded undelegation. UNDELEGATE_REQUEST_USER : Just requested undelegate by user. It is not in undelegate period. UNDELEGATE_REQUEST_ICA : Requested by ICA, It is in undelegate period.

func (Keeper) ChangeWithdrawState

func (k Keeper) ChangeWithdrawState(ctx sdk.Context, zoneId string, preState, postState types.WithdrawStatusType)

ChangeWithdrawState changes each withdraw states. WithdrawStatusRegistered : Withdrawal requests have been registered state of the user. The property of this condition is not carried over from chain host. WithdrawStatusTransferred : WithdrawStatusTransferred is a state in which assets are periodically transferred to the Supernova chain. Assets in this state can be withdrawn by the user.

func (Keeper) CheckDecimal added in v0.6.4

func (k Keeper) CheckDecimal(amount sdk.Coin, decimal int64) error

func (Keeper) ClaimShareToken

func (k Keeper) ClaimShareToken(ctx sdk.Context, zone *icacontrolkeeper.RegisteredZone, asset sdk.Coin) (*sdk.Coin, error)

ClaimShareToken is used when user want to claim their share token. It calculates user's share and the amount of claimable share token.

func (Keeper) ClaimWithdrawAsset

func (k Keeper) ClaimWithdrawAsset(ctx sdk.Context, withdrawer sdk.AccAddress, amt sdk.Coin) error

ClaimWithdrawAsset is used when user want to claim their asset which is after undeleagted.

func (Keeper) ConvertSnAssetToWAssetDecimal

func (k Keeper) ConvertSnAssetToWAssetDecimal(amount *big.Int, decimal int64, denom string) (*sdk.Coin, error)

ConvertSnAssetToWAssetDecimal changes snAsset to matching coin denom and decimal.

func (Keeper) ConvertWAssetToSnAssetDecimal

func (k Keeper) ConvertWAssetToSnAssetDecimal(amount *big.Int, decimal int64, denom string) (*sdk.Coin, error)

ConvertWAssetToSnAssetDecimal changes the common coin to snAsset's denom and decimal.

func (Keeper) DeleteDelegateRecord added in v0.6.5

func (k Keeper) DeleteDelegateRecord(ctx sdk.Context, delegate *types.DelegateRecord)

func (Keeper) DeleteDepositRecords added in v0.6.5

func (k Keeper) DeleteDepositRecords(ctx sdk.Context, zoneId string, state types.DepositStatusType)

func (Keeper) DeleteRecordedDepositItem

func (k Keeper) DeleteRecordedDepositItem(ctx sdk.Context, zoneId string, depositor sdk.AccAddress, state types.DepositStatusType, amount sdk.Int) error

func (Keeper) DeleteUndelegateRecords

func (k Keeper) DeleteUndelegateRecords(ctx sdk.Context, zoneId string, state types.UndelegatedStatusType)

DeleteUndelegateRecords deletes records corresponding to zoneId and state for undelegate records.

func (Keeper) DeleteWithdrawRecord

func (k Keeper) DeleteWithdrawRecord(ctx sdk.Context, withdraw *types.WithdrawRecord)

DeleteWithdrawRecord removes withdraw record.

func (Keeper) GetAllAmountNotMintShareToken

func (k Keeper) GetAllAmountNotMintShareToken(ctx sdk.Context, zone *icacontroltypes.RegisteredZone) (sdk.Coin, error)

GetAllAmountNotMintShareToken returns the sum of assets that have not yet been issued by the user among the assets that have been deposited.

func (Keeper) GetAllUndelegateRecord

func (k Keeper) GetAllUndelegateRecord(ctx sdk.Context, zoneId string) []*types.UndelegateRecord

GetAllUndelegateRecord returns all undelegate records corresponding to zoneId.

func (Keeper) GetDelegateVersion

func (k Keeper) GetDelegateVersion(ctx sdk.Context, zoneId string) types.VersionState

GetDelegateVersion returns version for delegation corresponding to zone-id records.

func (Keeper) GetDelegateVersionStore

func (k Keeper) GetDelegateVersionStore(ctx sdk.Context) prefix.Store

GetDelegateVersionStore returns store for delegation.

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns total set of gal parameters.

func (Keeper) GetReUndelegateAmount added in v0.6.3

func (k Keeper) GetReUndelegateAmount(ctx sdk.Context, snDenom string, zone icacontroltypes.RegisteredZone, version uint64) (sdk.Coin, sdk.Int)

func (Keeper) GetSnDenomForIBCDenom

func (k Keeper) GetSnDenomForIBCDenom(ctx sdk.Context, ibcDenom string) (string, error)

GetSnDenomForIBCDenom changes the IBCDenom to the appropriate SnDenom.

func (Keeper) GetTotalDelegateAmtForUser added in v0.6.5

func (k Keeper) GetTotalDelegateAmtForUser(ctx sdk.Context, zoneId, denom string, userAddr sdk.AccAddress) sdk.Coin

func (Keeper) GetTotalDelegateAmtForZoneId added in v0.6.5

func (k Keeper) GetTotalDelegateAmtForZoneId(ctx sdk.Context, zoneId, denom string, version types.DelegateVersion, state types.DelegateStatusType) sdk.Coin

func (Keeper) GetTotalDepositAmtForUserAddr

func (k Keeper) GetTotalDepositAmtForUserAddr(ctx sdk.Context, zoneId, userAddr, denom string) sdk.Coin

GetTotalDepositAmtForUserAddr returns the sum of the user's address entered as input and the deposit coin corresponding to the coin denom.

func (Keeper) GetTotalDepositAmtForZoneId

func (k Keeper) GetTotalDepositAmtForZoneId(ctx sdk.Context, zoneId, denom string, state types.DepositStatusType) sdk.Coin

GetTotalDepositAmtForZoneId returns the sum of all Deposit coins corresponding to a specified zoneId.

func (Keeper) GetTotalStakedForLazyMinting

func (k Keeper) GetTotalStakedForLazyMinting(ctx sdk.Context, denom, transferPortId, transferChanId string) (sdk.Coin, error)

GetTotalStakedForLazyMinting returns the sum of coins delegated to the Host chain, which have not been issued snAsset.

func (Keeper) GetTotalWithdrawAmountForFailCase added in v0.6.3

func (k Keeper) GetTotalWithdrawAmountForFailCase(ctx sdk.Context, zoneId, denom string, blockTime time.Time) sdk.Coin

func (Keeper) GetTotalWithdrawAmountForZoneId

func (k Keeper) GetTotalWithdrawAmountForZoneId(ctx sdk.Context, zoneId, denom string, blockTime time.Time) sdk.Coin

GetTotalWithdrawAmountForZoneId returns total withdraw amount corresponding to zone-id and denom.

func (Keeper) GetUndelegateAmount

func (k Keeper) GetUndelegateAmount(ctx sdk.Context, snDenom string, zone icacontroltypes.RegisteredZone, version uint64) (sdk.Coin, sdk.Int)

GetUndelegateAmount gets the information that corresponds to the zone during the de-delegation history.

func (Keeper) GetUndelegateRecord

func (k Keeper) GetUndelegateRecord(ctx sdk.Context, zoneId, delegator string) (result *types.UndelegateRecord, found bool)

GetUndelegateRecord returns the record corresponding to zoneId and delegator among the user's undelegation records.

func (Keeper) GetUndelegateVersion

func (k Keeper) GetUndelegateVersion(ctx sdk.Context, zoneId string) types.VersionState

GetUndelegateVersion returns the latest undelegation version.

func (Keeper) GetUndelegateVersionStore

func (k Keeper) GetUndelegateVersionStore(ctx sdk.Context) prefix.Store

GetUndelegateVersionStore returns the store that stores the UndelegateVersion data. The un-delegation task is periodically operated by the bot, so it stores the version for the last action.

func (Keeper) GetUserDelegateRecord added in v0.6.5

func (k Keeper) GetUserDelegateRecord(ctx sdk.Context, zoneId string, claimer sdk.AccAddress) (result *types.DelegateRecord, found bool)

func (Keeper) GetUserDepositRecord

func (k Keeper) GetUserDepositRecord(ctx sdk.Context, zoneId string, depositor sdk.AccAddress) (result *types.DepositRecord, found bool)

GetUserDepositRecord returns the amount of coin user deposit by address.

func (Keeper) GetWithdrawAmountForUser

func (k Keeper) GetWithdrawAmountForUser(ctx sdk.Context, zoneId, denom string, withdrawer string) sdk.Coin

GetWithdrawAmountForUser returns withdraw record corresponding to zone id and denom.

func (Keeper) GetWithdrawAmt

func (k Keeper) GetWithdrawAmt(ctx sdk.Context, amt sdk.Coin) (*sdk.Coin, error)

GetWithdrawAmt is used for calculating the amount of coin user can withdraw after un-delegate. This function is executed when ICA un-delegate call executed, and calculate using the balance of user's share coin.

func (Keeper) GetWithdrawRecord

func (k Keeper) GetWithdrawRecord(ctx sdk.Context, zoneId, withdrawer string) (result *types.WithdrawRecord, found bool)

GetWithdrawRecord returns withdraw record item by key.

func (Keeper) GetWithdrawVersion

func (k Keeper) GetWithdrawVersion(ctx sdk.Context, zoneId string) types.VersionState

GetWithdrawVersion returns current withdraw-version.

func (Keeper) GetWithdrawVersionStore

func (k Keeper) GetWithdrawVersionStore(ctx sdk.Context) prefix.Store

GetWithdrawVersionStore returns store for Withdraw-version.

func (Keeper) HasMaxDepositEntries added in v0.6.4

func (k Keeper) HasMaxDepositEntries(depositRecords types.DepositRecord, maxEntries int64) bool

func (Keeper) HasMaxUndelegateEntries

func (k Keeper) HasMaxUndelegateEntries(undelegateRecords types.UndelegateRecord, maxEntries int64) bool

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

func (Keeper) IsAbleToWithdraw

func (k Keeper) IsAbleToWithdraw(ctx sdk.Context, from sdk.AccAddress, amt sdk.Coin) bool

IsAbleToWithdraw returns if user can withdraw their asset. It refers nova ICA account. If ICA account's balance is greater than user withdraw request amount, this function returns true.

func (Keeper) IsValidDelegateVersion added in v0.6.2

func (k Keeper) IsValidDelegateVersion(ctx sdk.Context, zoneId string, version uint64) bool

func (Keeper) IsValidUndelegateVersion added in v0.6.2

func (k Keeper) IsValidUndelegateVersion(ctx sdk.Context, zoneId string, version uint64) bool

func (Keeper) IsValidWithdrawVersion added in v0.6.2

func (k Keeper) IsValidWithdrawVersion(ctx sdk.Context, zoneId string, version uint64) bool

func (Keeper) IterateDelegateRecord added in v0.6.5

func (k Keeper) IterateDelegateRecord(ctx sdk.Context, zoneId string, fn func(index int64, delegateRecord types.DelegateRecord) (stop bool))

IterateDelegateRecord navigates all delegate requests.

func (Keeper) IterateDepositRecord

func (k Keeper) IterateDepositRecord(ctx sdk.Context, zoneId string, fn func(index int64, depositRecord types.DepositRecord) (stop bool))

IterateDepositRecord navigates all deposit requests.

func (Keeper) IterateUndelegatedRecords

func (k Keeper) IterateUndelegatedRecords(ctx sdk.Context, zoneId string, fn func(index int64, undelegateInfo *types.UndelegateRecord) (stop bool))

IterateUndelegatedRecords navigates de-delegation records.

func (Keeper) IterateWithdrawRecords

func (k Keeper) IterateWithdrawRecords(ctx sdk.Context, zoneId string, fn func(index int64, withdrawInfo *types.WithdrawRecord) (stop bool))

IterateWithdrawRecords iterate all withdraw records.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MintTo

func (k Keeper) MintTo(ctx sdk.Context, claimer sdk.AccAddress, mintCoin sdk.Coin) error

MintTo mints sn-asset(share token) regard with deposited token to claimer.

func (Keeper) SetDelegateOracleVersion added in v0.6.5

func (k Keeper) SetDelegateOracleVersion(ctx sdk.Context, zoneId string, version types.DelegateVersion, oracleVersion uint64)

SetDelegateOracleVersion updates the Oracle version for recorded delegate requests. This action is required for the correct equity calculation.

func (Keeper) SetDelegateRecord added in v0.6.5

func (k Keeper) SetDelegateRecord(ctx sdk.Context, msg *types.DelegateRecord)

func (Keeper) SetDelegateRecords added in v0.6.5

func (k Keeper) SetDelegateRecords(ctx sdk.Context, zoneId string)

func (Keeper) SetDelegateVersion

func (k Keeper) SetDelegateVersion(ctx sdk.Context, zoneId string, trace types.VersionState)

SetDelegateVersion sets version for delegation corresponding to zone-id records.

func (Keeper) SetDepositRecord

func (k Keeper) SetDepositRecord(ctx sdk.Context, msg *types.DepositRecord)

SetDepositRecord stores the deposit record which stores amount of the coin and user address.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the total set of gal parameters.

func (Keeper) SetUndelegateRecord

func (k Keeper) SetUndelegateRecord(ctx sdk.Context, record *types.UndelegateRecord)

SetUndelegateRecord writes a record of the user's undelegation actions.

func (Keeper) SetUndelegateRecordVersion

func (k Keeper) SetUndelegateRecordVersion(ctx sdk.Context, zoneId string, state types.UndelegatedStatusType, version uint64) bool

SetUndelegateRecordVersion navigates undelegate records and updates version for records corresponding to zoneId and state.

func (Keeper) SetUndelegateVersion

func (k Keeper) SetUndelegateVersion(ctx sdk.Context, zoneId string, trace types.VersionState)

SetUndelegateVersion sets the new un-delgate Version.

func (Keeper) SetWithdrawRecord

func (k Keeper) SetWithdrawRecord(ctx sdk.Context, record *types.WithdrawRecord)

SetWithdrawRecord stores the withdraw record.

func (Keeper) SetWithdrawRecordVersion

func (k Keeper) SetWithdrawRecordVersion(ctx sdk.Context, zoneId string, state types.WithdrawStatusType, version uint64)

SetWithdrawRecordVersion set new version to withdraw record corresponding to zoneId and state.

func (Keeper) SetWithdrawRecords

func (k Keeper) SetWithdrawRecords(ctx sdk.Context, zoneId string, time time.Time)

SetWithdrawRecords write multiple withdraw record.

func (Keeper) SetWithdrawVersion

func (k Keeper) SetWithdrawVersion(ctx sdk.Context, zoneId string, trace types.VersionState)

SetWithdrawVersion set withdraw version for zone id.

func (Keeper) TotalClaimableAssets

func (k Keeper) TotalClaimableAssets(ctx sdk.Context, zone icacontrolkeeper.RegisteredZone, claimer sdk.AccAddress) (*sdk.Coin, error)

TotalClaimableAssets returns the total amount of claimable snAsset.

func (Keeper) TransferToTargetZone

func (k Keeper) TransferToTargetZone(ctx sdk.Context, option *IBCTransferOption) error

TransferToTargetZone transfers user's asset to target zone(Host chain) using IBC transfer.

type QueryServer

type QueryServer struct {
	types.QueryServer
	// contains filtered or unexported fields
}

func NewQueryServer

func NewQueryServer(keeper *Keeper) *QueryServer

func (QueryServer) ClaimableAmount

func (QueryServer) DelegateCurrentVersion added in v0.6.2

func (QueryServer) DelegateRecords added in v0.6.5

func (QueryServer) DelegateVersion

func (QueryServer) DepositAmount

func (QueryServer) DepositRecords

func (QueryServer) EstimateSnAsset

func (QueryServer) Params

func (QueryServer) TotalSnAssetSupply added in v0.6.7

func (QueryServer) UndelegateCurrentVersion added in v0.6.2

func (QueryServer) UndelegateRecords

func (QueryServer) UndelegateVersion

func (QueryServer) WithdrawCurrentVersion added in v0.6.2

func (QueryServer) WithdrawRecords

func (QueryServer) WithdrawVersion

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL