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

types.gno

3.56 Kb · 137 lines
  1package zkgm
  2
  3import u256 "gno.land/p/onbloc/math/uint256"
  4
  5// BURN_ADDRESS is the canonical zero burn address: bech32 of 20 zero bytes with
  6// the gno `g` HRP, matching union's get_burn_address = addr_humanize([0;20]).
  7// A market-maker ack naming this address burns the escrow instead of releasing it.
  8//
  9// reference: https://github.com/unionlabs/union/blob/d91c5e94354e15801bd5f82dc658eae3b79f2dad/cosmwasm/app/ucs03-zkgm/src/contract.rs#L3211
 10const BURN_ADDRESS = "g1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqluuxe"
 11
 12// ZkgmPacket is the outer ZKGM packet envelope.
 13//
 14// Mirrors `ZkgmPacket` at com.rs:33.
 15type ZkgmPacket struct {
 16	Salt        [32]byte
 17	Path        *u256.Uint
 18	Instruction Instruction
 19}
 20
 21// Instruction identifies an operation and carries its ABI-encoded operand.
 22//
 23// Mirrors `Instruction` at com.rs:40.
 24type Instruction struct {
 25	Version uint8
 26	Opcode  uint8
 27	Operand []byte
 28}
 29
 30// Forward wraps another instruction for forwarding across a channel path.
 31//
 32// Mirrors `Forward` at com.rs:46.
 33type Forward struct {
 34	Path             *u256.Uint
 35	TimeoutHeight    uint64
 36	TimeoutTimestamp uint64
 37	Instruction      Instruction
 38}
 39
 40// Call describes an application call instruction.
 41//
 42// Mirrors `Call` at com.rs:54.
 43type Call struct {
 44	Sender           []byte
 45	Eureka           bool
 46	ContractAddress  []byte
 47	ContractCalldata []byte
 48}
 49
 50// Batch groups multiple instructions.
 51//
 52// Mirrors `Batch` at com.rs:61.
 53type Batch struct {
 54	Instructions []Instruction
 55}
 56
 57// TokenOrderV1 is the legacy token order shape with token metadata fields.
 58//
 59// Mirrors `TokenOrderV1` at com.rs:66.
 60type TokenOrderV1 struct {
 61	Sender            []byte
 62	Receiver          []byte
 63	BaseToken         []byte
 64	BaseAmount        *u256.Uint
 65	BaseTokenSymbol   string
 66	BaseTokenName     string
 67	BaseTokenDecimals uint8
 68	BaseTokenPath     *u256.Uint
 69	QuoteToken        []byte
 70	QuoteAmount       *u256.Uint
 71}
 72
 73// TokenOrderV2 is the current token order shape.
 74//
 75// Mirrors `TokenOrderV2` at com.rs:80.
 76type TokenOrderV2 struct {
 77	Sender      []byte
 78	Receiver    []byte
 79	BaseToken   []byte
 80	BaseAmount  *u256.Uint
 81	QuoteToken  []byte
 82	QuoteAmount *u256.Uint
 83	Kind        uint8
 84	Metadata    []byte
 85}
 86
 87// TokenMetadata carries wrapped token implementation initialization data.
 88//
 89// Mirrors `TokenMetadata` at com.rs:92.
 90type TokenMetadata struct {
 91	Implementation []byte
 92	Initializer    []byte
 93}
 94
 95// TokenInitializer holds token display metadata; decimals are metadata only, never used for scaling.
 96// Authority and Minter are the ZkgmERC20 initialize(...) EVM addresses (20 bytes each): the admin
 97// authority, and the address granted the minter role (the EVM ZKGM contract, named `zkgm` in the
 98// Solidity signature — see docs/guides/zkgm-packet-send/initialize.md). Leave them nil to encode
 99// the zero address, the default for callers that don't care about a real EVM authority/minter.
100type TokenInitializer struct {
101	Authority []byte
102	Minter    []byte
103	Name      string
104	Symbol    string
105	Decimals  uint8
106}
107
108// SolverMetadata carries market maker solver data.
109//
110// Mirrors `SolverMetadata` at com.rs:98.
111type SolverMetadata struct {
112	SolverAddress []byte
113	Metadata      []byte
114}
115
116// Ack wraps an acknowledgement tag and payload.
117//
118// Mirrors `Ack` at com.rs:104.
119type Ack struct {
120	Tag      *u256.Uint
121	InnerAck []byte
122}
123
124// BatchAck groups acknowledgement payloads.
125//
126// Mirrors `BatchAck` at com.rs:109.
127type BatchAck struct {
128	Acknowledgements [][]byte
129}
130
131// TokenOrderAck describes token order settlement acknowledgement data.
132//
133// Mirrors `TokenOrderAck` at com.rs:114.
134type TokenOrderAck struct {
135	FillType    *u256.Uint
136	MarketMaker []byte
137}