forked from eoscanada/eos-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setprods.go
34 lines (30 loc) · 919 Bytes
/
setprods.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
package system
import (
eos "github.com/eoscanada/eos-go"
"github.com/eoscanada/eos-go/ecc"
)
// NewSetPriv returns a `setpriv` 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 NewSetProds(producers []ProducerKey) *eos.Action {
a := &eos.Action{
Account: AN("eosio"),
Name: ActN("setprods"),
Authorization: []eos.PermissionLevel{
{Actor: AN("eosio"), Permission: PN("active")},
},
ActionData: eos.NewActionData(SetProds{
Schedule: producers,
}),
}
return a
}
// SetProds is present in `eosio.bios` contract. Used only at boot time.
type SetProds struct {
Schedule []ProducerKey `json:"schedule"`
}
type ProducerKey struct {
ProducerName eos.AccountName `json:"producer_name"`
BlockSigningKey ecc.PublicKey `json:"block_signing_key"`
}