mirror of
https://github.com/luxfi/precompile.git
synced 2026-09-24 00:26:21 +00:00
55 lines
1.4 KiB
Go
55 lines
1.4 KiB
Go
// Copyright (C) 2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package ring
|
|
|
|
import (
|
|
"github.com/luxfi/precompile/contract"
|
|
"github.com/luxfi/precompile/modules"
|
|
"github.com/luxfi/precompile/precompileconfig"
|
|
)
|
|
|
|
var _ contract.Configurator = &configurator{}
|
|
|
|
const ConfigKey = "ringConfig"
|
|
|
|
type configurator struct{}
|
|
|
|
func init() {
|
|
if err := modules.RegisterModule(modules.Module{
|
|
ConfigKey: ConfigKey,
|
|
Address: ContractAddress,
|
|
Contract: RingSignaturePrecompile,
|
|
Configurator: &configurator{},
|
|
}); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func (*configurator) MakeConfig() precompileconfig.Config { return &Config{} }
|
|
|
|
func (*configurator) Configure(
|
|
chainConfig precompileconfig.ChainConfig,
|
|
cfg precompileconfig.Config,
|
|
state contract.StateDB,
|
|
blockContext contract.ConfigurationBlockContext,
|
|
) error {
|
|
return nil
|
|
}
|
|
|
|
type Config struct {
|
|
Upgrade precompileconfig.Upgrade `json:"upgrade"`
|
|
}
|
|
|
|
func (c *Config) Key() string { return ConfigKey }
|
|
func (c *Config) Timestamp() *uint64 { return c.Upgrade.Timestamp() }
|
|
func (c *Config) IsDisabled() bool { return c.Upgrade.Disable }
|
|
func (c *Config) Equal(cfg precompileconfig.Config) bool {
|
|
other, ok := cfg.(*Config)
|
|
if !ok {
|
|
return false
|
|
}
|
|
return c.Upgrade.Equal(&other.Upgrade)
|
|
}
|
|
func (c *Config) Verify(precompileconfig.ChainConfig) error { return nil }
|