forked from crypto-com/chain-indexing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_block_commission.go
37 lines (31 loc) · 964 Bytes
/
create_block_commission.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
package command
import (
entity_event "github.com/WilliamXieCrypto/chain-indexing/entity/event"
"github.com/WilliamXieCrypto/chain-indexing/usecase/coin"
"github.com/WilliamXieCrypto/chain-indexing/usecase/event"
)
type CreateBlockCommission struct {
blockHeight int64
validator string
amount coin.DecCoins
}
func NewCreateBlockCommission(blockHeight int64, validator string, amount coin.DecCoins) *CreateBlockCommission {
return &CreateBlockCommission{
blockHeight,
validator,
amount,
}
}
// Name returns name of command
func (*CreateBlockCommission) Name() string {
return "CreateBlockCommission"
}
// Version returns version of command
func (*CreateBlockCommission) Version() int {
return 1
}
// Exec process the command data and return the event accordingly
func (cmd *CreateBlockCommission) Exec() (entity_event.Event, error) {
event := event.NewBlockCommissioned(cmd.blockHeight, cmd.validator, cmd.amount)
return event, nil
}