github.com/MetalBlockchain/subnet-evm@v0.4.9/precompile/upgradeable.go (about) 1 // (c) 2022 Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package precompile 5 6 import ( 7 "math/big" 8 9 "github.com/MetalBlockchain/subnet-evm/utils" 10 ) 11 12 // UpgradeableConfig contains the timestamp for the upgrade along with 13 // a boolean [Disable]. If [Disable] is set, the upgrade deactivates 14 // the precompile and resets its storage. 15 type UpgradeableConfig struct { 16 BlockTimestamp *big.Int `json:"blockTimestamp"` 17 Disable bool `json:"disable,omitempty"` 18 } 19 20 // Timestamp returns the timestamp this network upgrade goes into effect. 21 func (c *UpgradeableConfig) Timestamp() *big.Int { 22 return c.BlockTimestamp 23 } 24 25 // IsDisabled returns true if the network upgrade deactivates the precompile. 26 func (c *UpgradeableConfig) IsDisabled() bool { 27 return c.Disable 28 } 29 30 // Equal returns true iff [other] has the same blockTimestamp and has the 31 // same on value for the Disable flag. 32 func (c *UpgradeableConfig) Equal(other *UpgradeableConfig) bool { 33 if other == nil { 34 return false 35 } 36 return c.Disable == other.Disable && utils.BigNumEqual(c.BlockTimestamp, other.BlockTimestamp) 37 }