github.com/intfoundation/intchain@v0.0.0-20220727031208-4316ad31ca73/params/gas_table.go (about)

     1  // Copyright 2016 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package params
    18  
    19  // GasTable organizes gas prices for different ethereum phases.
    20  type GasTable struct {
    21  	ExtcodeSize uint64
    22  	ExtcodeCopy uint64
    23  	ExtcodeHash uint64
    24  	Balance     uint64
    25  	SLoad       uint64
    26  	Calls       uint64
    27  	Suicide     uint64
    28  
    29  	ExpByte uint64
    30  
    31  	// CreateBySuicide occurs when the
    32  	// refunded account is one that does
    33  	// not exist. This logic is similar
    34  	// to call. May be left nil. Nil means
    35  	// not charged.
    36  	CreateBySuicide uint64
    37  }
    38  
    39  // Variables containing gas prices for different ethereum phases.
    40  var (
    41  	// GasTableHomestead contain the gas prices for
    42  	// the homestead phase.
    43  	GasTableHomestead = GasTable{
    44  		ExtcodeSize: 20,
    45  		ExtcodeCopy: 20,
    46  		Balance:     20,
    47  		SLoad:       50,
    48  		Calls:       40,
    49  		Suicide:     0,
    50  		ExpByte:     10,
    51  	}
    52  
    53  	// GasTableEIP150 contain the gas re-prices for
    54  	// the EIP150 phase.
    55  	GasTableEIP150 = GasTable{
    56  		ExtcodeSize: 700,
    57  		ExtcodeCopy: 700,
    58  		Balance:     400,
    59  		SLoad:       200,
    60  		Calls:       700,
    61  		Suicide:     5000,
    62  		ExpByte:     10,
    63  
    64  		CreateBySuicide: 25000,
    65  	}
    66  	// GasTableEIP158 contain the gas re-prices for
    67  	// the EIP155/EIP158 phase.
    68  	GasTableEIP158 = GasTable{
    69  		ExtcodeSize: 700,
    70  		ExtcodeCopy: 700,
    71  		Balance:     400,
    72  		SLoad:       200,
    73  		Calls:       700,
    74  		Suicide:     5000,
    75  		ExpByte:     50,
    76  
    77  		CreateBySuicide: 25000,
    78  	}
    79  	// GasTableConstantinople contain the gas re-prices for
    80  	// the constantinople phase.
    81  	GasTableConstantinople = GasTable{
    82  		ExtcodeSize: 700,
    83  		ExtcodeCopy: 700,
    84  		ExtcodeHash: 400,
    85  		Balance:     400,
    86  		SLoad:       200,
    87  		Calls:       700,
    88  		Suicide:     5000,
    89  		ExpByte:     50,
    90  
    91  		CreateBySuicide: 25000,
    92  	}
    93  )