Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

impl.gno

1.39 Kb · 39 lines
 1// Package impl is the v1 implementation of the IBC host logic for the
 2// gno.land/r/onbloc/ibc/union/core proxy. The proxy keeps the stable identity
 3// (admin, package address), the Store, and the app registry; this realm holds
 4// the swappable protocol logic and is injected with the proxy-owned store
 5// (core.IStore) at install time.
 6//
 7// core/v1 implements the client, connection, channel, packet, app registry, and
 8// query surfaces behind the proxy's ICore interface.
 9package core
10
11import (
12	core "gno.land/r/onbloc/ibc/union/core"
13)
14
15// coreV1 holds the injected proxy state and contains the host logic. State writes
16// go through the store's borrow-rule setters: c.store.SetXxx(0, rlm, ...).
17type coreV1 struct {
18	store core.IStore
19}
20
21var _ core.ICore = (*coreV1)(nil)
22
23// New constructs a fresh v1 impl. The store is injected by the proxy at install
24// time via SetStore, so it is nil until installed.
25func NewCoreV1(s core.IStore) core.ICore {
26	return &coreV1{store: s}
27}
28
29// resolveRelayer defaults an empty relayer string to the authenticated caller.
30// The client lifecycle message constructors leave Relayer empty, so without this
31// the light-client callbacks would receive the zero address; union likewise
32// reuses info.sender as the relayer on the paths that do not carry one.
33func resolveRelayer(caller address, relayer string) address {
34	if relayer == "" {
35		return caller
36	}
37
38	return address(relayer)
39}