-
Notifications
You must be signed in to change notification settings - Fork 38
/
exec_msgs.go
64 lines (49 loc) · 1.37 KB
/
exec_msgs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package types
import (
"encoding/json"
fmt "fmt"
)
const DefaultGasLimitContractRegistration = uint64(8987600)
type CWRegisterExecMsg struct {
Register *RegisterMsg `json:"register,omitempty"`
}
type RegisterMsg struct {
GasLimit uint64 `json:"gas_limit"`
ContractAddress string `json:"contract_address"`
}
type CWBeginBlockerExecMsg struct {
BeginBlockerMsg *BeginBlockerMsg `json:"begin_blocker,omitempty"`
}
type BeginBlockerMsg struct {
}
func BeginBlockerExecMsg() ([]byte, error) {
// Construct Exec message
beginBlocker := CWBeginBlockerExecMsg{BeginBlockerMsg: &BeginBlockerMsg{}}
// execMsg := []byte("{\"begin_blocker\":{}}")
execMsg, err := json.Marshal(beginBlocker)
if err != nil {
fmt.Println("Register marshal failed")
return nil, err
}
return execMsg, nil
}
type CWGetContractsQueryMsg struct {
QueryContractsMsg *QueryContractsMsg `json:"get_contracts,omitempty"`
}
type QueryContractsMsg struct {
}
func ContractsQueryMsg() ([]byte, error) {
// Construct Exec message
contractQuery := CWGetContractsQueryMsg{QueryContractsMsg: &QueryContractsMsg{}}
// queryData := []byte("{\"get_contracts\": {}}")
queryMsg, err := json.Marshal(contractQuery)
if err != nil {
fmt.Println("Register marshal failed")
return nil, err
}
return queryMsg, nil
}
type Contract struct {
Address string `json:"address"`
GasLimit uint64 `json:"gas_limit"`
}