-
Notifications
You must be signed in to change notification settings - Fork 140
/
params.go
163 lines (126 loc) · 5.16 KB
/
params.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// Code generated by schema tool; DO NOT EDIT.
// Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
package coreroot
import (
"github.com/iotaledger/wasp/packages/wasmvm/wasmlib/go/wasmlib"
"github.com/iotaledger/wasp/packages/wasmvm/wasmlib/go/wasmlib/wasmtypes"
)
type MapStringToImmutableBytes struct {
Proxy wasmtypes.Proxy
}
func (m MapStringToImmutableBytes) GetBytes(key string) wasmtypes.ScImmutableBytes {
return wasmtypes.NewScImmutableBytes(m.Proxy.Key(wasmtypes.StringToBytes(key)))
}
type ImmutableDeployContractParams struct {
Proxy wasmtypes.Proxy
}
func NewImmutableDeployContractParams() ImmutableDeployContractParams {
return ImmutableDeployContractParams{Proxy: wasmlib.NewParamsProxy()}
}
// additional params for smart contract init function
func (s ImmutableDeployContractParams) InitParams() MapStringToImmutableBytes {
return MapStringToImmutableBytes(s)
}
// The name of the contract to be deployed, used to calculate the contract's hname.
// The hname must be unique among all contract hnames in the chain.
func (s ImmutableDeployContractParams) Name() wasmtypes.ScImmutableString {
return wasmtypes.NewScImmutableString(s.Proxy.Root(ParamName))
}
// hash of blob that has been previously stored in blob contract
func (s ImmutableDeployContractParams) ProgramHash() wasmtypes.ScImmutableHash {
return wasmtypes.NewScImmutableHash(s.Proxy.Root(ParamProgramHash))
}
type MapStringToMutableBytes struct {
Proxy wasmtypes.Proxy
}
func (m MapStringToMutableBytes) Clear() {
m.Proxy.ClearMap()
}
func (m MapStringToMutableBytes) GetBytes(key string) wasmtypes.ScMutableBytes {
return wasmtypes.NewScMutableBytes(m.Proxy.Key(wasmtypes.StringToBytes(key)))
}
type MutableDeployContractParams struct {
Proxy wasmtypes.Proxy
}
// additional params for smart contract init function
func (s MutableDeployContractParams) InitParams() MapStringToMutableBytes {
return MapStringToMutableBytes(s)
}
// The name of the contract to be deployed, used to calculate the contract's hname.
// The hname must be unique among all contract hnames in the chain.
func (s MutableDeployContractParams) Name() wasmtypes.ScMutableString {
return wasmtypes.NewScMutableString(s.Proxy.Root(ParamName))
}
// hash of blob that has been previously stored in blob contract
func (s MutableDeployContractParams) ProgramHash() wasmtypes.ScMutableHash {
return wasmtypes.NewScMutableHash(s.Proxy.Root(ParamProgramHash))
}
type ImmutableGrantDeployPermissionParams struct {
Proxy wasmtypes.Proxy
}
func NewImmutableGrantDeployPermissionParams() ImmutableGrantDeployPermissionParams {
return ImmutableGrantDeployPermissionParams{Proxy: wasmlib.NewParamsProxy()}
}
// agent to grant deploy permission to
func (s ImmutableGrantDeployPermissionParams) Deployer() wasmtypes.ScImmutableAgentID {
return wasmtypes.NewScImmutableAgentID(s.Proxy.Root(ParamDeployer))
}
type MutableGrantDeployPermissionParams struct {
Proxy wasmtypes.Proxy
}
// agent to grant deploy permission to
func (s MutableGrantDeployPermissionParams) Deployer() wasmtypes.ScMutableAgentID {
return wasmtypes.NewScMutableAgentID(s.Proxy.Root(ParamDeployer))
}
type ImmutableRequireDeployPermissionsParams struct {
Proxy wasmtypes.Proxy
}
func NewImmutableRequireDeployPermissionsParams() ImmutableRequireDeployPermissionsParams {
return ImmutableRequireDeployPermissionsParams{Proxy: wasmlib.NewParamsProxy()}
}
// turns permission check on or off
func (s ImmutableRequireDeployPermissionsParams) DeployPermissionsEnabled() wasmtypes.ScImmutableBool {
return wasmtypes.NewScImmutableBool(s.Proxy.Root(ParamDeployPermissionsEnabled))
}
type MutableRequireDeployPermissionsParams struct {
Proxy wasmtypes.Proxy
}
// turns permission check on or off
func (s MutableRequireDeployPermissionsParams) DeployPermissionsEnabled() wasmtypes.ScMutableBool {
return wasmtypes.NewScMutableBool(s.Proxy.Root(ParamDeployPermissionsEnabled))
}
type ImmutableRevokeDeployPermissionParams struct {
Proxy wasmtypes.Proxy
}
func NewImmutableRevokeDeployPermissionParams() ImmutableRevokeDeployPermissionParams {
return ImmutableRevokeDeployPermissionParams{Proxy: wasmlib.NewParamsProxy()}
}
// agent to revoke deploy permission for
func (s ImmutableRevokeDeployPermissionParams) Deployer() wasmtypes.ScImmutableAgentID {
return wasmtypes.NewScImmutableAgentID(s.Proxy.Root(ParamDeployer))
}
type MutableRevokeDeployPermissionParams struct {
Proxy wasmtypes.Proxy
}
// agent to revoke deploy permission for
func (s MutableRevokeDeployPermissionParams) Deployer() wasmtypes.ScMutableAgentID {
return wasmtypes.NewScMutableAgentID(s.Proxy.Root(ParamDeployer))
}
type ImmutableFindContractParams struct {
Proxy wasmtypes.Proxy
}
func NewImmutableFindContractParams() ImmutableFindContractParams {
return ImmutableFindContractParams{Proxy: wasmlib.NewParamsProxy()}
}
// The smart contract’s Hname
func (s ImmutableFindContractParams) Hname() wasmtypes.ScImmutableHname {
return wasmtypes.NewScImmutableHname(s.Proxy.Root(ParamHname))
}
type MutableFindContractParams struct {
Proxy wasmtypes.Proxy
}
// The smart contract’s Hname
func (s MutableFindContractParams) Hname() wasmtypes.ScMutableHname {
return wasmtypes.NewScMutableHname(s.Proxy.Root(ParamHname))
}