app.gno
3.05 Kb · 88 lines
1package ucs03_zkgm
2
3import (
4 app "gno.land/p/onbloc/ibc/union/app"
5 types "gno.land/p/onbloc/ibc/union/types"
6)
7
8// app.gno is the App receiver surface: the core-driven half of the proxy. core
9// holds this App reference permanently (its port is keyed by the proxy pkgpath
10// and re-registration is rejected), so App is the stable IBC identity and must
11// never carry business logic. Every receiver gates on assertIsCoreRealm and
12// assertIsNotPaused before delegating to the installed impl or rejecting channel
13// close. Logic lives in the impl realm; authority and funds live in the proxy.
14// See assert.gno for the gates and upgrade.gno for the swap point.
15type App struct{}
16
17var (
18 _ app.IApp = &App{}
19 _ app.IIntentApp = &App{}
20)
21
22func (a *App) OnChannelOpenInit(cur realm, connectionId types.ConnectionId, channelId types.ChannelId, version string, relayer address) {
23 assertIsCoreRealm(cur)
24 assertIsNotPaused()
25
26 mustGetImpl().OnChannelOpenInit(0, cur, connectionId, channelId, version, relayer)
27}
28
29func (a *App) OnChannelOpenTry(cur realm, connectionId types.ConnectionId, channelId types.ChannelId, version string, counterpartyVersion string, relayer address) {
30 assertIsCoreRealm(cur)
31 assertIsNotPaused()
32
33 mustGetImpl().OnChannelOpenTry(0, cur, connectionId, channelId, version, counterpartyVersion, relayer)
34}
35
36func (a *App) OnChannelOpenAck(cur realm, channelId types.ChannelId, counterpartyChannelId types.ChannelId, counterpartyVersion string, relayer address) {
37 assertIsCoreRealm(cur)
38 assertIsNotPaused()
39
40 mustGetImpl().OnChannelOpenAck(0, cur, channelId, counterpartyChannelId, counterpartyVersion, relayer)
41}
42
43func (a *App) OnChannelOpenConfirm(cur realm, channelId types.ChannelId, relayer address) {
44 assertIsCoreRealm(cur)
45 assertIsNotPaused()
46
47 mustGetImpl().OnChannelOpenConfirm(0, cur, channelId, relayer)
48}
49
50func (a *App) OnChannelCloseInit(cur realm, channelId types.ChannelId, relayer address) {
51 assertIsCoreRealm(cur)
52 assertIsNotPaused()
53
54 panic("the show must go on")
55}
56
57func (a *App) OnChannelCloseConfirm(cur realm, channelId types.ChannelId, relayer address) {
58 assertIsCoreRealm(cur)
59 assertIsNotPaused()
60
61 panic("the show must go on")
62}
63
64func (a *App) OnRecvPacket(cur realm, packet types.Packet, relayer address, relayerMsg []byte) types.RecvPacketResult {
65 assertIsCoreRealm(cur)
66 assertIsNotPaused()
67
68 return mustGetImpl().OnRecvPacket(0, cur, packet, relayer, relayerMsg)
69}
70
71func (a *App) OnAcknowledgementPacket(cur realm, packet types.Packet, acknowledgement []byte, relayer address) {
72 assertIsCoreRealm(cur)
73 assertIsNotPaused()
74 mustGetImpl().OnAcknowledgementPacket(0, cur, packet, acknowledgement, relayer)
75}
76
77func (a *App) OnTimeoutPacket(cur realm, packet types.Packet, relayer address) {
78 assertIsCoreRealm(cur)
79 assertIsNotPaused()
80 mustGetImpl().OnTimeoutPacket(0, cur, packet, relayer)
81}
82
83func (a *App) OnIntentRecvPacket(cur realm, packet types.Packet, marketMaker address, marketMakerMsg []byte) types.RecvPacketResult {
84 assertIsCoreRealm(cur)
85 assertIsNotPaused()
86
87 return mustGetImpl().OnIntentRecvPacket(0, cur, packet, marketMaker, marketMakerMsg)
88}