Documentation ¶
Index ¶
- Variables
- func GetBidIDFromBytes(bz []byte) uint64
- func GetOrderIDBytes(id uint64) []byte
- type Keeper
- func (k Keeper) AppendAtomicOrder(ctx sdk.Context, order types.Order) uint64
- func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
- func (k Keeper) BindPort(ctx sdk.Context, portID string) error
- func (k Keeper) CancelSwap(goCtx context.Context, msg *types.CancelSwapMsg) (*types.MsgCancelSwapResponse, error)
- func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error
- func (q Keeper) EscrowAddress(c context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllOrder(ctx sdk.Context) (list []types.Order)
- func (q Keeper) GetAllOrders(goCtx context.Context, request *types.QueryOrdersRequest) (*types.QueryOrdersResponse, error)
- func (q Keeper) GetAllOrdersByType(ctx context.Context, request *types.QueryOrdersByRequest) (*types.QueryOrdersResponse, error)
- func (k Keeper) GetAtomicOrder(ctx sdk.Context, orderId string) (val types.Order, found bool)
- func (k Keeper) GetAtomicOrderCount(ctx sdk.Context) uint64
- func (k Keeper) GetAtomicOrderCountByOrderId(ctx sdk.Context, orderId string) uint64
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetPort(ctx sdk.Context) string
- func (q Keeper) GetPrivateOrders(ctx context.Context, request *types.QueryPrivateOrdersRequest) (*types.QueryOrdersResponse, error)
- func (q Keeper) GetSubmittedOrders(ctx context.Context, request *types.QuerySubmittedOrdersRequest) (*types.QueryOrdersResponse, error)
- func (k Keeper) GetSwapEnabled(ctx sdk.Context) bool
- func (k Keeper) GetSwapMaxFeeRate(ctx sdk.Context) uint32
- func (q Keeper) GetTookOrders(ctx context.Context, request *types.QueryTookOrdersRequest) (*types.QueryOrdersResponse, error)
- func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState)
- func (k Keeper) IsBound(ctx sdk.Context, portID string) bool
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MakeSwap(goCtx context.Context, msg *types.MakeSwapMsg) (*types.MsgMakeSwapResponse, error)
- func (k Keeper) MarshalOrder(order types.Order) ([]byte, error)
- func (k Keeper) MoveOrderToBottom(ctx sdk.Context, orderId string) error
- func (k Keeper) MustMarshalOrder(order types.Order) []byte
- func (k Keeper) MustUnmarshalOrder(bz []byte) types.Order
- func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, data *types.AtomicSwapPacketData, ...) error
- func (k Keeper) OnReceivedCancel(ctx sdk.Context, packet channeltypes.Packet, msg *types.CancelSwapMsg) (string, error)
- func (k Keeper) OnReceivedMake(ctx sdk.Context, packet channeltypes.Packet, orderId, path string, ...) (string, error)
- func (k Keeper) OnReceivedTake(ctx sdk.Context, packet channeltypes.Packet, msg *types.TakeSwapMsg) (string, error)
- func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data types.AtomicSwapPacketData) ([]byte, error)
- func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, data *types.AtomicSwapPacketData) error
- func (q Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) RemoveOrder(ctx sdk.Context, orderId string)
- func (k Keeper) SendSwapPacket(ctx sdk.Context, sourcePort, sourceChannel string, ...) (*uint64, error)
- func (k Keeper) SetAtomicOrder(ctx sdk.Context, order types.Order)
- func (k Keeper) SetAtomicOrderCount(ctx sdk.Context, count uint64)
- func (k Keeper) SetAtomicOrderCountToOrderID(ctx sdk.Context, orderId string, count uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPort(ctx sdk.Context, portID string)
- func (k Keeper) TakeSwap(goCtx context.Context, msg *types.TakeSwapMsg) (*types.MsgTakeSwapResponse, error)
- func (k Keeper) TrimExcessOrders(ctx sdk.Context)
- func (k Keeper) Unmarshal(bz []byte) (types.Order, error)
Constants ¶
This section is empty.
Variables ¶
var ( StepSend = 1 StepReceive = 2 StepAcknowledgement = 3 )
Functions ¶
func GetBidIDFromBytes ¶
GetAuctionIDFromBytes returns ID in uint64 format from a byte array
func GetOrderIDBytes ¶
GetAuctionIDBytes returns the byte representation of the ID
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper defines the IBC Swap keeper
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace, ics4Wrapper porttypes.ICS4Wrapper, channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, scopedKeeper capabilitykeeper.ScopedKeeper, ) Keeper
NewKeeper creates a new IBC transfer Keeper instance
func (Keeper) AppendAtomicOrder ¶
AppendAuction appends a auction in the store with a new id and update the count
func (Keeper) AuthenticateCapability ¶
func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function
func (Keeper) BindPort ¶
BindPort defines a wrapper function for the ort Keeper's function in order to expose it to module's InitGenesis function
func (Keeper) CancelSwap ¶
func (k Keeper) CancelSwap(goCtx context.Context, msg *types.CancelSwapMsg) (*types.MsgCancelSwapResponse, error)
CancelSwap is the step 10 (Cancel Request) of the atomic swap: https://github.com/cosmos/ibc/tree/main/spec/app/ics-100-atomic-swap. It is executed on the Maker chain. Only the maker of the order can cancel the order.
func (Keeper) ClaimCapability ¶
func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error
ClaimCapability allows the swap module that can claim a capability that IBC module passes to it
func (Keeper) EscrowAddress ¶
func (q Keeper) EscrowAddress(c context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error)
EscrowAddress implements the EscrowAddress gRPC method
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis exports ibc-transfer module's portID and denom trace info into its genesis state.
func (Keeper) GetAllOrder ¶
GetAllAuction returns all auction
func (Keeper) GetAllOrders ¶
func (q Keeper) GetAllOrders(goCtx context.Context, request *types.QueryOrdersRequest) (*types.QueryOrdersResponse, error)
func (Keeper) GetAllOrdersByType ¶
func (q Keeper) GetAllOrdersByType(ctx context.Context, request *types.QueryOrdersByRequest) (*types.QueryOrdersResponse, error)
func (Keeper) GetAtomicOrder ¶
GetAuction returns a auction from its id
func (Keeper) GetAtomicOrderCount ¶
GetAuctionCount get the total number of auction
func (Keeper) GetAtomicOrderCountByOrderId ¶
GetAuctionCount get the total number of auction
func (Keeper) GetPrivateOrders ¶
func (q Keeper) GetPrivateOrders(ctx context.Context, request *types.QueryPrivateOrdersRequest) (*types.QueryOrdersResponse, error)
func (Keeper) GetSubmittedOrders ¶
func (q Keeper) GetSubmittedOrders(ctx context.Context, request *types.QuerySubmittedOrdersRequest) (*types.QueryOrdersResponse, error)
func (Keeper) GetSwapEnabled ¶
GetSwapEnabled retrieves the send enabled boolean from the paramstore
func (Keeper) GetTookOrders ¶
func (q Keeper) GetTookOrders(ctx context.Context, request *types.QueryTookOrdersRequest) (*types.QueryOrdersResponse, error)
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState)
InitGenesis initializes the ibc-transfer state and binds to PortID.
func (Keeper) MakeSwap ¶
func (k Keeper) MakeSwap(goCtx context.Context, msg *types.MakeSwapMsg) (*types.MsgMakeSwapResponse, error)
MakeSwap is called when the maker wants to make atomic swap. The method create new order and lock tokens. This is the step 1 (Create order & Lock Token) of the atomic swap: https://github.com/cosmos/ibc/tree/main/spec/app/ics-100-atomic-swap
func (Keeper) MarshalOrder ¶
MarshalOrder attempts to encode an LimitOrder object and returns the raw encoded bytes.
func (Keeper) MoveOrderToBottom ¶
func (Keeper) MustMarshalOrder ¶
MustMarshalOrder attempts to encode an LimitOrder object and returns the raw encoded bytes. It panics on error.
func (Keeper) MustUnmarshalOrder ¶
MustUnmarshalOrder attempts to decode and return an LimitOrder object from raw encoded bytes. It panics on error.
func (Keeper) OnAcknowledgementPacket ¶
func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, data *types.AtomicSwapPacketData, ack channeltypes.Acknowledgement) error
func (Keeper) OnReceivedCancel ¶
func (k Keeper) OnReceivedCancel(ctx sdk.Context, packet channeltypes.Packet, msg *types.CancelSwapMsg) (string, error)
OnReceivedCancel is the step 12 (Cancel Order) of the atomic swap: https://github.com/cosmos/ibc/tree/main/spec/app/ics-100-atomic-swap. This step is executed on the Taker chain.
func (Keeper) OnReceivedMake ¶
func (k Keeper) OnReceivedMake(ctx sdk.Context, packet channeltypes.Packet, orderId, path string, msg *types.MakeSwapMsg) (string, error)
OnReceivedMake is the step 3.1 (Save order) from the atomic swap: https://github.com/cosmos/ibc/tree/main/spec/app/ics-100-atomic-swap The step is executed on the Taker chain.
func (Keeper) OnReceivedTake ¶
func (k Keeper) OnReceivedTake(ctx sdk.Context, packet channeltypes.Packet, msg *types.TakeSwapMsg) (string, error)
OnReceivedTake is step 7.1 (Transfer Make Token) of the atomic swap: https://github.com/cosmos/ibc/tree/main/spec/app/ics-100-atomic-swap The step is executed on the Maker chain.
func (Keeper) OnRecvPacket ¶
func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data types.AtomicSwapPacketData) ([]byte, error)
func (Keeper) OnTimeoutPacket ¶
func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, data *types.AtomicSwapPacketData) error
func (Keeper) Params ¶
func (q Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params implements the Query/Params gRPC method
func (Keeper) RemoveOrder ¶
RemoveAuction removes a auction from the store
func (Keeper) SendSwapPacket ¶
func (Keeper) SetAtomicOrder ¶
SetAuction set a specific auction in the store
func (Keeper) SetAtomicOrderCount ¶
SetAuctionCount set the total number of auction
func (Keeper) SetAtomicOrderCountToOrderID ¶
SetAuctionCount set the total number of auction
func (Keeper) TakeSwap ¶
func (k Keeper) TakeSwap(goCtx context.Context, msg *types.TakeSwapMsg) (*types.MsgTakeSwapResponse, error)
TakeSwap is the step 5 (Lock Order & Lock Token) of the atomic swap: https://github.com/liangping/ibc/blob/atomic-swap/spec/app/ics-100-atomic-swap/ibcswap.png This method lock the order (set a value to the field "Taker") and lock Token