Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
Prevent 0x0 address to be provided for non mintable native tokens bur…
Browse files Browse the repository at this point in the history
…n contract
  • Loading branch information
Stefan-Ethernal committed Jun 22, 2023
1 parent d96699a commit 458a21f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions command/genesis/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,20 @@ func (p *genesisParams) validateRewardWallet() error {
// burn contract flag must not be set. If native token is non mintable only one burn contract
// can be set and the specified address will be used to predeploy default EIP1559 burn contract.
func (p *genesisParams) validateBurnContract() error {
if p.nativeTokenConfig.IsMintable && p.isBurnContractEnabled() {
if p.isBurnContractEnabled() {
burnContractInfo, err := parseBurnContractInfo(p.burnContract)
if err != nil {
return fmt.Errorf("invalid burn contract info provided: %w", err)
}

if burnContractInfo.Address != types.ZeroAddress {
return errors.New("only zero address is allowed as burn destination for mintable native token")
if p.nativeTokenConfig.IsMintable {
if burnContractInfo.Address != types.ZeroAddress {
return errors.New("only zero address is allowed as burn destination for mintable native token")
}
} else {
if burnContractInfo.Address == types.ZeroAddress {
return errors.New("it is not allowed to deploy burn contract to 0x0 address")
}
}
}

Expand Down

0 comments on commit 458a21f

Please sign in to comment.