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