app.gno
1.65 Kb · 56 lines
1package app
2
3import (
4 "gno.land/p/aib/ibc/types"
5)
6
7// IBCApp defines an interface that implements all the callbacks that apps must
8// define as specified in IBC Protocol V2.
9type IBCApp interface {
10 // OnSendPacket is executed when a packet is being sent from sending chain.
11 // This callback is provided with the source and destination IDs, the signer,
12 // the packet sequence and the packet data for this specific application.
13 OnSendPacket(
14 cur realm,
15 sourceClient string,
16 destinationClient string,
17 sequence uint64,
18 payload types.Payload,
19 ) error
20
21 // OnRecvPacket is executed when a packet is received from receiving chain.
22 //
23 // CONTRACT: unlike other functions of this interface, OnRecvPacket does not
24 // return an error, this is because in case of error (i.e. when
25 // RecvPacketResult.Status == Failure), the underlying transaction is not
26 // aborted. So implementer of this interface must keep in mind that any
27 // writes to the store and all emitted events in this function aren't not
28 // canceled if it returns RecvPacketResult.Status == Failure.
29 OnRecvPacket(
30 cur realm,
31 sourceClient string,
32 destinationClient string,
33 sequence uint64,
34 payload types.Payload,
35 ) types.RecvPacketResult
36
37 // OnTimeoutPacket is executed when a packet has timed out on the receiving
38 // chain.
39 OnTimeoutPacket(
40 cur realm,
41 sourceClient string,
42 destinationClient string,
43 sequence uint64,
44 payload types.Payload,
45 ) error
46
47 // OnAcknowledgementPacket is executed when a packet gets acknowledged.
48 OnAcknowledgementPacket(
49 cur realm,
50 sourceClient string,
51 destinationClient string,
52 sequence uint64,
53 acknowledgement []byte,
54 payload types.Payload,
55 ) error
56}