Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper *Keeper) types.MsgServer
- func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- type DepositState
- type Hooks
- func (h Hooks) AfterAutoStakingEnd()
- func (h Hooks) AfterDelegateEnd(ctx sdk.Context, delegateMsg stakingtypes.MsgDelegate)
- func (h Hooks) AfterTransferEnd(ctx sdk.Context, data transfertypes.FungibleTokenPacketData, baseDenom string)
- func (h Hooks) AfterUndelegateEnd(ctx sdk.Context, undelegateMsg stakingtypes.MsgUndelegate, ...)
- func (h Hooks) AfterWithdrawEnd(ctx sdk.Context, transferMsg transfertypes.MsgTransfer)
- func (h Hooks) BeforeUndelegateStart(ctx sdk.Context, zoneId string)
- type Keeper
- func (k Keeper) BurnShareTokens(ctx sdk.Context, burner sdk.Address, amt sdk.Coin) error
- func (k Keeper) CalculateDepositAlpha(userDepositAmt, totalShareTokenSupply, totalStakedAmount *big.Int) *big.Int
- func (k Keeper) CalculateWithdrawAlpha(burnedStTokenAmt, totalShareTokenSupply, totalStakedAmount *big.Int) *big.Int
- func (k Keeper) ChangeDepositState(ctx sdk.Context, zoneId string, preState, postState DepositState)
- func (k Keeper) ChangeUndelegateState(ctx sdk.Context, zoneId string, state UndelegatedState)
- func (k Keeper) ChangeWithdrawState(ctx sdk.Context, zoneId string, preState, postState WithdrawRegisterType)
- func (k Keeper) ClaimAndMintShareToken(ctx sdk.Context, claimer sdk.AccAddress, asset sdk.Coin, ...) (sdk.Coin, error)
- func (k Keeper) ClaimWithdrawAsset(ctx sdk.Context, from sdk.AccAddress, withdrawer sdk.AccAddress, amt sdk.Coin) error
- func (k Keeper) ClearRecordedDepositAmt(ctx sdk.Context, zoneId string, depositor sdk.AccAddress) error
- func (k Keeper) DeleteRecordedDepositItem(ctx sdk.Context, zoneId string, depositor sdk.AccAddress, state DepositState) error
- func (k Keeper) DeleteUndelegateRecords(ctx sdk.Context, zoneId string, state UndelegatedState)
- func (k Keeper) DeleteWithdrawRecord(ctx sdk.Context, withdraw types.WithdrawRecord)
- func (k Keeper) DepositHistory(goCtx context.Context, rq *types.QueryDepositHistoryRequest) (*types.QueryDepositHistoryResponse, error)
- func (k Keeper) GetAllAmountNotMintShareToken(ctx sdk.Context, zoneId, transferPortId, transferChanId string) (sdk.Coin, error)
- func (k Keeper) GetAllUndelegateRecord(ctx sdk.Context, zoneId string) []types.UndelegateRecord
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRecordedDepositAmt(ctx sdk.Context, zoneId string, depositor sdk.AccAddress) (*types.DepositRecord, error)
- func (k Keeper) GetTotalDepositAmtForZoneId(ctx sdk.Context, zoneId, denom string, state DepositState) sdk.Coin
- func (k Keeper) GetTotalStakedForLazyMinting(ctx sdk.Context, denom, transferPortId, transferChanId string) (sdk.Coin, error)
- func (k Keeper) GetTotalWithdrawAmountForZoneId(ctx sdk.Context, zoneId string, blockTime time.Time) sdk.Coin
- func (k Keeper) GetUndelegateAmount(ctx sdk.Context, denom string, zoneId string, state UndelegatedState) sdk.Coin
- func (k Keeper) GetUndelegateRecord(ctx sdk.Context, key string) (types.UndelegateRecord, bool)
- func (k Keeper) GetUndelegateRecordsForZoneId(ctx sdk.Context, zoneId string, state UndelegatedState) []types.UndelegateRecord
- func (k Keeper) GetWithdrawAmt(ctx sdk.Context, amt sdk.Coin) (sdk.Coin, error)
- func (k Keeper) GetWithdrawRecord(ctx sdk.Context, zoneId, withdrawer string) (*types.WithdrawRecord, error)
- func (k Keeper) GetsnDenomForIBCDenom(ctx sdk.Context, ibcDenom string) (string, error)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) IsAbleToWithdraw(ctx sdk.Context, from sdk.AccAddress, amt sdk.Coin) bool
- func (k Keeper) IterateDepositRecord(ctx sdk.Context, ...)
- func (k Keeper) IterateUndelegatedRecords(ctx sdk.Context, ...)
- func (k Keeper) IterateWithdrawRecords(ctx sdk.Context, ...)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintShareTokens(ctx sdk.Context, depositor sdk.AccAddress, amt sdk.Coin) error
- func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SetBlockHeight(ctx sdk.Context, zoneId string, state DepositState, blockHeight int64)
- func (k Keeper) SetDepositAmt(ctx sdk.Context, msg *types.DepositRecord)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetUndelegateRecord(ctx sdk.Context, record types.UndelegateRecord)
- func (k Keeper) SetWithdrawRecord(ctx sdk.Context, record types.WithdrawRecord)
- func (k Keeper) SetWithdrawRecords(ctx sdk.Context, zoneId string, state UndelegatedState)
- func (k Keeper) SetWithdrawTime(ctx sdk.Context, zoneId string, state WithdrawRegisterType, time time.Time)
- func (k Keeper) Share(context context.Context, rq *types.QueryCacheDepositAmountRequest) (*types.QueryCachedDepositAmountResponse, error)
- func (k Keeper) TransferToTargetZone(ctx sdk.Context, sourcePort, sourceChannel, depositor, icaController string, ...) error
- func (k Keeper) UndelegateHistory(goCtx context.Context, rq *types.QueryUndelegateHistoryRequest) (*types.QueryUndelegateHistoryResponse, error)
- func (k Keeper) WithdrawHistory(goCtx context.Context, rq *types.QueryWithdrawHistoryRequest) (*types.QueryWithdrawHistoryResponse, error)
- type UndelegatedState
- type WithdrawRegisterType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl creates and returns a new types.MsgServer, fulfilling the ibcstaking Msg service interface
func NewQuerier ¶
func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
NewQuerier returns a new sdk.Keeper instance.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers the gal module invariants
Types ¶
type DepositState ¶
type DepositState int64
const ( DEPOSIT_REQUEST DepositState = iota + 1 DEPOSIT_SUCCESS DELEGATE_REQUEST DELEGATE_SUCCESS )
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for gal keeper
func (Hooks) AfterAutoStakingEnd ¶
func (h Hooks) AfterAutoStakingEnd()
func (Hooks) AfterDelegateEnd ¶
func (h Hooks) AfterDelegateEnd(ctx sdk.Context, delegateMsg stakingtypes.MsgDelegate)
delegateAddr(controllerAddr), validatorAddr, delegateAmt
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) 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) AfterWithdrawEnd ¶
func (h Hooks) AfterWithdrawEnd(ctx sdk.Context, transferMsg transfertypes.MsgTransfer)
ica transfer
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, bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, ibcstakingKeeper ibcstakingKeeper.Keeper, ibcTransferKeeper transfer.Keeper, oracleKeeper oraclekeeper.Keeper) Keeper
func (Keeper) BurnShareTokens ¶
BurnShareTokens burns share token.
func (Keeper) CalculateDepositAlpha ¶
func (k Keeper) CalculateDepositAlpha(userDepositAmt, totalShareTokenSupply, totalStakedAmount *big.Int) *big.Int
CalculateDepositAlpha calculates alpha value. Alpha = userDepositAmount / totalStakedAmount Delta = Alpha * totalShareTokenSupply
func (Keeper) CalculateWithdrawAlpha ¶
func (k Keeper) CalculateWithdrawAlpha(burnedStTokenAmt, totalShareTokenSupply, totalStakedAmount *big.Int) *big.Int
CalculateWithdrawAlpha calculates lambda value. Lambda = userWithdrawAmount / totalStakedAmount Delta = Lambda * totalShareTokenSupply
func (Keeper) ChangeDepositState ¶
func (k Keeper) ChangeDepositState(ctx sdk.Context, zoneId string, preState, postState DepositState)
func (Keeper) ChangeUndelegateState ¶
func (k Keeper) ChangeUndelegateState(ctx sdk.Context, zoneId string, state UndelegatedState)
ChangeUndelegateState changes undelegate record. 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 WithdrawRegisterType)
func (Keeper) ClaimAndMintShareToken ¶
func (k Keeper) ClaimAndMintShareToken(ctx sdk.Context, claimer sdk.AccAddress, asset sdk.Coin, transferPortId, transferChanId string) (sdk.Coin, error)
ClaimAndMintShareToken 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, from sdk.AccAddress, withdrawer sdk.AccAddress, amt sdk.Coin) error
ClaimWithdrawAsset is used when user want to claim their asset which is after undeleagted.
func (Keeper) ClearRecordedDepositAmt ¶
func (k Keeper) ClearRecordedDepositAmt(ctx sdk.Context, zoneId string, depositor sdk.AccAddress) error
ClearRecordedDepositAmt remove all data in "DepositRecord". It must be removed after staking in host chain.
func (Keeper) DeleteRecordedDepositItem ¶
func (k Keeper) DeleteRecordedDepositItem(ctx sdk.Context, zoneId string, depositor sdk.AccAddress, state DepositState) error
func (Keeper) DeleteUndelegateRecords ¶
func (k Keeper) DeleteUndelegateRecords(ctx sdk.Context, zoneId string, state UndelegatedState)
DeleteUndelegateRecords removes undelegate record.
func (Keeper) DeleteWithdrawRecord ¶
func (k Keeper) DeleteWithdrawRecord(ctx sdk.Context, withdraw types.WithdrawRecord)
DeleteWithdrawRecord removes withdraw record.
func (Keeper) DepositHistory ¶
func (k Keeper) DepositHistory(goCtx context.Context, rq *types.QueryDepositHistoryRequest) (*types.QueryDepositHistoryResponse, error)
func (Keeper) GetAllAmountNotMintShareToken ¶
func (Keeper) GetAllUndelegateRecord ¶
GetAllUndelegateRecord returns all undelegate record.
func (Keeper) GetRecordedDepositAmt ¶
func (k Keeper) GetRecordedDepositAmt(ctx sdk.Context, zoneId string, depositor sdk.AccAddress) (*types.DepositRecord, error)
GetRecordedDepositAmt returns the amount of coin user deposit by address.
func (Keeper) GetTotalDepositAmtForZoneId ¶
func (k Keeper) GetTotalDepositAmtForZoneId(ctx sdk.Context, zoneId, denom string, state DepositState) sdk.Coin
GetTotalDepositAmtForZoneId : delegate를 위한 TotlaDepositAmt로, 해당 zone에서 deposit 완료된 금액을 받아서 반환하는 함수
func (Keeper) GetTotalStakedForLazyMinting ¶
func (Keeper) GetTotalWithdrawAmountForZoneId ¶
func (Keeper) GetUndelegateAmount ¶
func (k Keeper) GetUndelegateAmount(ctx sdk.Context, denom string, zoneId string, state UndelegatedState) sdk.Coin
GetUndelegateAmount returns the amount of undelegated coin.
func (Keeper) GetUndelegateRecord ¶
GetUndelegateRecord returns undelegate record by key.
func (Keeper) GetUndelegateRecordsForZoneId ¶
func (k Keeper) GetUndelegateRecordsForZoneId(ctx sdk.Context, zoneId string, state UndelegatedState) []types.UndelegateRecord
GetUndelegateRecordsForZoneId returns undelegate coins by zone-id.
func (Keeper) GetWithdrawAmt ¶
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) (*types.WithdrawRecord, error)
GetWithdrawRecord returns withdraw record item by key.
func (Keeper) GetsnDenomForIBCDenom ¶
func (Keeper) IsAbleToWithdraw ¶
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) IterateDepositRecord ¶
func (Keeper) IterateUndelegatedRecords ¶
func (k Keeper) IterateUndelegatedRecords(ctx sdk.Context, fn func(index int64, undelegateInfo types.UndelegateRecord) (stop bool))
IterateUndelegatedRecords iterate through zones
func (Keeper) IterateWithdrawRecords ¶
func (k Keeper) IterateWithdrawRecords(ctx sdk.Context, fn func(index int64, withdrawInfo types.WithdrawRecord) (stop bool))
IterateWithdrawRecords iterate
func (Keeper) MintShareTokens ¶
MintShareTokens mints st-token(share token) regard with deposited token.
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) SetBlockHeight ¶
func (Keeper) SetDepositAmt ¶
func (k Keeper) SetDepositAmt(ctx sdk.Context, msg *types.DepositRecord)
SetDepositAmt write the amount of coin user deposit to the "DepositRecord" store.
func (Keeper) SetUndelegateRecord ¶
func (k Keeper) SetUndelegateRecord(ctx sdk.Context, record types.UndelegateRecord)
SetUndelegateRecord write undelegate record.
func (Keeper) SetWithdrawRecord ¶
func (k Keeper) SetWithdrawRecord(ctx sdk.Context, record types.WithdrawRecord)
SetWithdrawRecord writes withdraw record.
func (Keeper) SetWithdrawRecords ¶
func (k Keeper) SetWithdrawRecords(ctx sdk.Context, zoneId string, state UndelegatedState)
SetWithdrawRecords write multiple withdraw record.
func (Keeper) SetWithdrawTime ¶
func (k Keeper) SetWithdrawTime(ctx sdk.Context, zoneId string, state WithdrawRegisterType, time time.Time)
SetWithdrawTime writes the time undelegate finish.
func (Keeper) Share ¶
func (k Keeper) Share(context context.Context, rq *types.QueryCacheDepositAmountRequest) (*types.QueryCachedDepositAmountResponse, error)
func (Keeper) TransferToTargetZone ¶
func (k Keeper) TransferToTargetZone(ctx sdk.Context, sourcePort, sourceChannel, depositor, icaController string, amt sdk.Coin) error
TransferToTargetZone transfers user's asset to target zone(Host chain) using IBC transfer.
func (Keeper) UndelegateHistory ¶
func (k Keeper) UndelegateHistory(goCtx context.Context, rq *types.QueryUndelegateHistoryRequest) (*types.QueryUndelegateHistoryResponse, error)
func (Keeper) WithdrawHistory ¶
func (k Keeper) WithdrawHistory(goCtx context.Context, rq *types.QueryWithdrawHistoryRequest) (*types.QueryWithdrawHistoryResponse, error)
type UndelegatedState ¶
type UndelegatedState int64
const ( UNDELEGATE_REQUEST_USER UndelegatedState = iota + 1 UNDELEGATE_REQUEST_ICA )
type WithdrawRegisterType ¶
type WithdrawRegisterType int
const ( WITHDRAW_REGISTER WithdrawRegisterType = iota + 1 TRANSFER_SUCCESS )