/
voteproducer.go
32 lines (29 loc) · 929 Bytes
/
voteproducer.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
package system
import "github.com/tsfdsong/eos-go"
// NewNonce returns a `nonce` action that lives on the
// `eosio.bios` contract. It should exist only when booting a new
// network, as it is replaced using the `eos-bios` boot process by the
// `eosio.system` contract.
func NewVoteProducer(voter eos.AccountName, proxy eos.AccountName, producers ...eos.AccountName) *eos.Action {
a := &eos.Action{
Account: AN("eosio"),
Name: ActN("voteproducer"),
Authorization: []eos.PermissionLevel{
{Actor: voter, Permission: PN("active")},
},
ActionData: eos.NewActionData(
VoteProducer{
Voter: voter,
Proxy: proxy,
Producers: producers,
},
),
}
return a
}
// VoteProducer represents the `eosio.system::voteproducer` action
type VoteProducer struct {
Voter eos.AccountName `json:"voter"`
Proxy eos.AccountName `json:"proxy"`
Producers []eos.AccountName `json:"producers"`
}