keeper

package
v23.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// If the forward transfer fails, the tokens are sent to the fallback address
	// which is a less than ideal UX
	// As a result, we decided to use a long timeout here such, even in the case
	// of high activity, a timeout should be very unlikely to occur
	// Empirically we found that times of high market stress took roughly
	// 2 hours for transfers to complete
	LiquidStakeForwardTransferTimeout = (time.Hour * 3)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Keeper

type Keeper struct {
	Cdc codec.BinaryCodec
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	Cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	ps paramtypes.Subspace,
	bankKeeper types.BankKeeper,
	stakeibcKeeper stakeibckeeper.Keeper,
	claimKeeper claimkeeper.Keeper,
	transferKeeper types.IbcTransferKeeper,
) *Keeper

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetTransferFallbackAddress

func (k Keeper) GetTransferFallbackAddress(ctx sdk.Context, channelId string, sequence uint64) (address string, found bool)

Returns a fallback address, given the channel ID and sequence number of the packet If no fallback address has been stored, return false

func (Keeper) HandleFallbackAddress

func (k Keeper) HandleFallbackAddress(ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, packetTimedOut bool) error

If there was a timeout or failed ack from an outbound transfer of one of the autopilot actions, we'll need to check if there was a fallback address. If one was stored, bank send to that address If the ack was successful, we should delete the address (if it exists)

func (Keeper) IBCTransferStToken

func (k Keeper) IBCTransferStToken(
	ctx sdk.Context,
	stToken sdk.Coin,
	transferMetadata transfertypes.FungibleTokenPacketData,
	autopilotMetadata types.StakeibcPacketMetadata,
) error

Submits an IBC transfer of the stToken to a non-stride zone (either back to the host zone or to a different zone) The sender of the transfer is the hashed receiver of the original autopilot inbound transfer

func (Keeper) Logger

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

func (Keeper) OnAcknowledgementPacket

func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte) error

OnAcknowledgementPacket should send to the fallback address if the ack is an ack error

func (Keeper) OnTimeoutPacket

func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) error

OnTimeoutPacket should always send to the fallback address

func (Keeper) Params

func (Keeper) RemoveTransferFallbackAddress

func (k Keeper) RemoveTransferFallbackAddress(ctx sdk.Context, channelId string, sequence uint64)

Removes a fallback address from the store This is used after the ack or timeout for a packet has been received

func (Keeper) RunLiquidStake

func (k Keeper) RunLiquidStake(
	ctx sdk.Context,
	amount sdkmath.Int,
	transferMetadata transfertypes.FungibleTokenPacketData,
	autopilotMetadata types.StakeibcPacketMetadata,
) error

Submits a LiquidStake message from the transfer receiver If a forwarding recipient is specified, the stTokens are ibc transferred

func (Keeper) RunRedeemStake

func (k Keeper) RunRedeemStake(ctx sdk.Context, strideAddress string, redemptionReceiver string, hostZoneDenom string, amount sdkmath.Int) error

func (Keeper) SendToFallbackAddress

func (k Keeper) SendToFallbackAddress(ctx sdk.Context, packetData []byte, fallbackAddress string) error

In the event of an ack error after a outbound transfer, we'll have to bank send to a fallback address

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetTransferFallbackAddress

func (k Keeper) SetTransferFallbackAddress(ctx sdk.Context, channelId string, sequence uint64, address string)

Stores a fallback address for an outbound transfer

func (Keeper) TryLiquidStaking

func (k Keeper) TryLiquidStaking(
	ctx sdk.Context,
	packet channeltypes.Packet,
	transferMetadata transfertypes.FungibleTokenPacketData,
	autopilotMetadata types.StakeibcPacketMetadata,
) error

Attempts to do an autopilot liquid stake (and optional forward) The liquid stake is only allowed if the inbound packet came along a trusted channel

func (Keeper) TryRedeemStake

func (k Keeper) TryRedeemStake(
	ctx sdk.Context,
	packet channeltypes.Packet,
	transferPacketData transfertypes.FungibleTokenPacketData,
	autopilotMetadata types.StakeibcPacketMetadata,
) error

func (Keeper) TryUpdateAirdropClaim

func (k Keeper) TryUpdateAirdropClaim(
	ctx sdk.Context,
	packet channeltypes.Packet,
	transferMetadata transfertypes.FungibleTokenPacketData,
) error

Attempt to link a host address with a stride address to enable airdrop claims

Jump to

Keyboard shortcuts

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