-
Notifications
You must be signed in to change notification settings - Fork 1
/
delegatebw.go
33 lines (30 loc) · 942 Bytes
/
delegatebw.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
package system
import (
zsw "github.com/zhongshuwen/zswchain-go"
)
// NewDelegateBW returns a `delegatebw` action that lives on the
// `zswhq.system` contract.
func NewDelegateBW(from, receiver zsw.AccountName, stakeCPU, stakeNet zsw.Asset, transfer bool) *zsw.Action {
return &zsw.Action{
Account: AN("zswhq"),
Name: ActN("delegatebw"),
Authorization: []zsw.PermissionLevel{
{Actor: from, Permission: PN("active")},
},
ActionData: zsw.NewActionData(DelegateBW{
From: from,
Receiver: receiver,
StakeNet: stakeNet,
StakeCPU: stakeCPU,
Transfer: zsw.Bool(transfer),
}),
}
}
// DelegateBW represents the `zswhq.system::delegatebw` action.
type DelegateBW struct {
From zsw.AccountName `json:"from"`
Receiver zsw.AccountName `json:"receiver"`
StakeNet zsw.Asset `json:"stake_net_quantity"`
StakeCPU zsw.Asset `json:"stake_cpu_quantity"`
Transfer zsw.Bool `json:"transfer"`
}