-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathupgradeable.go
33 lines (27 loc) · 1.02 KB
/
upgradeable.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
// (c) 2022 Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package precompileconfig
import "github.com/ava-labs/subnet-evm/utils"
// Upgrade contains the timestamp for the upgrade along with
// a boolean [Disable]. If [Disable] is set, the upgrade deactivates
// the precompile and clears its storage.
type Upgrade struct {
BlockTimestamp *uint64 `json:"blockTimestamp"`
Disable bool `json:"disable,omitempty"`
}
// Timestamp returns the timestamp this network upgrade goes into effect.
func (u *Upgrade) Timestamp() *uint64 {
return u.BlockTimestamp
}
// IsDisabled returns true if the network upgrade deactivates the precompile.
func (u *Upgrade) IsDisabled() bool {
return u.Disable
}
// Equal returns true iff [other] has the same blockTimestamp and has the
// same on value for the Disable flag.
func (u *Upgrade) Equal(other *Upgrade) bool {
if other == nil {
return false
}
return u.Disable == other.Disable && utils.Uint64PtrEqual(u.BlockTimestamp, other.BlockTimestamp)
}