forked from ChainSafe/ChainBridge
/
events.go
43 lines (33 loc) 路 864 Bytes
/
events.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
38
39
40
41
42
43
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: LGPL-3.0-only
package utils
import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
type EventSig string
func (es EventSig) GetTopic() common.Hash {
return crypto.Keccak256Hash([]byte(es))
}
const (
Deposit EventSig = "Deposit(uint8,bytes32,uint64)"
ProposalEvent EventSig = "ProposalEvent(uint8,uint64,uint8,bytes32,bytes32)"
ProposalVote EventSig = "ProposalVote(uint8,uint64,uint8,bytes32)"
)
type ProposalStatus int
const (
Inactive ProposalStatus = iota
Active
Passed
Executed
Cancelled
)
func IsActive(status uint8) bool {
return ProposalStatus(status) == Active
}
func IsFinalized(status uint8) bool {
return ProposalStatus(status) == Passed
}
func IsExecuted(status uint8) bool {
return ProposalStatus(status) == Executed
}