Documentation ¶
Index ¶
- Constants
- Variables
- func GetContractNativeMinterStatus(stateDB contract.StateDB, address common.Address) allowlist.Role
- func PackMintInput(address common.Address, amount *big.Int) ([]byte, error)
- func SetContractNativeMinterStatus(stateDB contract.StateDB, address common.Address, role allowlist.Role)
- func UnpackMintInput(input []byte) (common.Address, *big.Int, error)
- type Config
Constants ¶
const ConfigKey = "contractNativeMinterConfig"
ConfigKey is the key used in json config files to specify this precompile config. must be unique across all precompiles.
const (
MintGasCost = 30_000
)
Variables ¶
var ( // Singleton StatefulPrecompiledContract for minting native assets by permissioned callers. ContractNativeMinterPrecompile contract.StatefulPrecompiledContract = createNativeMinterPrecompile() ErrCannotMint = errors.New("non-enabled cannot mint") )
var ContractAddress = common.HexToAddress("0x0200000000000000000000000000000000000001")
var Module = modules.Module{ ConfigKey: ConfigKey, Address: ContractAddress, Contract: ContractNativeMinterPrecompile, Configurator: &configurator{}, }
Functions ¶
func GetContractNativeMinterStatus ¶
GetContractNativeMinterStatus returns the role of [address] for the minter list.
func PackMintInput ¶
PackMintInput packs [address] and [amount] into the appropriate arguments for minting operation. Assumes that [amount] can be represented by 32 bytes.
Types ¶
type Config ¶
type Config struct { allowlist.AllowListConfig precompileconfig.Upgrade InitialMint map[common.Address]*math.HexOrDecimal256 `json:"initialMint,omitempty"` // addresses to receive the initial mint mapped to the amount to mint }
Config implements the StatefulPrecompileConfig interface while adding in the ContractNativeMinter specific precompile config.
func NewConfig ¶
func NewConfig(blockTimestamp *uint64, admins []common.Address, enableds []common.Address, managers []common.Address, initialMint map[common.Address]*math.HexOrDecimal256) *Config
NewConfig returns a config for a network upgrade at [blockTimestamp] that enables ContractNativeMinter with the given [admins], [enableds] and [managers] as members of the allowlist. Also mints balances according to [initialMint] when the upgrade activates.
func NewDisableConfig ¶
NewDisableConfig returns config for a network upgrade at [blockTimestamp] that disables ContractNativeMinter.
func (*Config) Equal ¶
func (c *Config) Equal(cfg precompileconfig.Config) bool
Equal returns true if [cfg] is a [*ContractNativeMinterConfig] and it has been configured identical to [c].
func (*Config) Verify ¶
func (c *Config) Verify(chainConfig precompileconfig.ChainConfig) error