-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
key.go
33 lines (29 loc) · 861 Bytes
/
key.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
package ethkey
import (
"time"
"github.com/smartcontractkit/chainlink/v2/core/services/pg/datatypes"
)
// NOTE: This model refers to the OLD key and is only used for migrations
//
// Key holds the private key metadata for a given address that is used to unlock
// said key when given a password.
//
// By default, a key is assumed to represent an ethereum account.
type Key struct {
ID int32
Address EIP55Address
JSON datatypes.JSON `json:"-"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-"`
// IsFunding marks the address as being used for rescuing the node and the pending transactions
// Only one key can be IsFunding=true at a time.
IsFunding bool
}
// Type returns type of key
func (k Key) Type() string {
if k.IsFunding {
return "funding"
}
return "sending"
}