module EVM.FeeSchedule where

data FeeSchedule n = FeeSchedule
  { FeeSchedule n -> n
g_zero :: n
  , FeeSchedule n -> n
g_base :: n
  , FeeSchedule n -> n
g_verylow :: n
  , FeeSchedule n -> n
g_low :: n
  , FeeSchedule n -> n
g_mid :: n
  , FeeSchedule n -> n
g_high :: n
  , FeeSchedule n -> n
g_extcode :: n
  , FeeSchedule n -> n
g_balance :: n
  , FeeSchedule n -> n
g_sload :: n
  , FeeSchedule n -> n
g_jumpdest :: n
  , FeeSchedule n -> n
g_sset :: n
  , FeeSchedule n -> n
g_sreset :: n
  , FeeSchedule n -> n
r_sclear :: n
  , FeeSchedule n -> n
g_selfdestruct :: n
  , FeeSchedule n -> n
g_selfdestruct_newaccount :: n
  , FeeSchedule n -> n
r_selfdestruct :: n
  , FeeSchedule n -> n
g_create :: n
  , FeeSchedule n -> n
g_codedeposit :: n
  , FeeSchedule n -> n
g_call :: n
  , FeeSchedule n -> n
g_callvalue :: n
  , FeeSchedule n -> n
g_callstipend :: n
  , FeeSchedule n -> n
g_newaccount :: n
  , FeeSchedule n -> n
g_exp :: n
  , FeeSchedule n -> n
g_expbyte :: n
  , FeeSchedule n -> n
g_memory :: n
  , FeeSchedule n -> n
g_txcreate :: n
  , FeeSchedule n -> n
g_txdatazero :: n
  , FeeSchedule n -> n
g_txdatanonzero :: n
  , FeeSchedule n -> n
g_transaction :: n
  , FeeSchedule n -> n
g_log :: n
  , FeeSchedule n -> n
g_logdata :: n
  , FeeSchedule n -> n
g_logtopic :: n
  , FeeSchedule n -> n
g_sha3 :: n
  , FeeSchedule n -> n
g_sha3word :: n
  , FeeSchedule n -> n
g_copy :: n
  , FeeSchedule n -> n
g_blockhash :: n
  , FeeSchedule n -> n
g_extcodehash :: n
  , FeeSchedule n -> n
g_quaddivisor :: n
  , FeeSchedule n -> n
g_ecadd :: n
  , FeeSchedule n -> n
g_ecmul :: n
  , FeeSchedule n -> n
g_pairing_point :: n
  , FeeSchedule n -> n
g_pairing_base :: n
  , FeeSchedule n -> n
g_fround :: n
  , FeeSchedule n -> n
r_block :: n
  , FeeSchedule n -> n
g_cold_sload :: n
  , FeeSchedule n -> n
g_cold_account_access :: n
  , FeeSchedule n -> n
g_warm_storage_read :: n
  , FeeSchedule n -> n
g_access_list_address :: n
  , FeeSchedule n -> n
g_access_list_storage_key :: n
  } deriving Int -> FeeSchedule n -> ShowS
[FeeSchedule n] -> ShowS
FeeSchedule n -> String
(Int -> FeeSchedule n -> ShowS)
-> (FeeSchedule n -> String)
-> ([FeeSchedule n] -> ShowS)
-> Show (FeeSchedule n)
forall n. Show n => Int -> FeeSchedule n -> ShowS
forall n. Show n => [FeeSchedule n] -> ShowS
forall n. Show n => FeeSchedule n -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FeeSchedule n] -> ShowS
$cshowList :: forall n. Show n => [FeeSchedule n] -> ShowS
show :: FeeSchedule n -> String
$cshow :: forall n. Show n => FeeSchedule n -> String
showsPrec :: Int -> FeeSchedule n -> ShowS
$cshowsPrec :: forall n. Show n => Int -> FeeSchedule n -> ShowS
Show

-- For the purposes of this module, we define an EIP as just a fee
-- schedule modification.
type EIP n = Num n => FeeSchedule n -> FeeSchedule n

-- EIP150: Gas cost changes for IO-heavy operations
-- <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-150.md>
eip150 :: EIP n
eip150 :: FeeSchedule n -> FeeSchedule n
eip150 fees :: FeeSchedule n
fees = FeeSchedule n
fees
  { g_extcode :: n
g_extcode = 700
  , g_balance :: n
g_balance = 400
  , g_sload :: n
g_sload = 200
  , g_call :: n
g_call = 700
  , g_selfdestruct :: n
g_selfdestruct = 5000
  , g_selfdestruct_newaccount :: n
g_selfdestruct_newaccount = 25000
  }

-- EIP160: EXP cost increase
-- <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-160.md>
eip160 :: EIP n
eip160 :: FeeSchedule n -> FeeSchedule n
eip160 fees :: FeeSchedule n
fees = FeeSchedule n
fees
  { g_expbyte :: n
g_expbyte = 50 }

homestead :: Num n => FeeSchedule n
homestead :: FeeSchedule n
homestead = FeeSchedule :: forall n.
n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> n
-> FeeSchedule n
FeeSchedule
  { g_zero :: n
g_zero = 0
  , g_base :: n
g_base = 2
  , g_verylow :: n
g_verylow = 3
  , g_low :: n
g_low = 5
  , g_mid :: n
g_mid = 8
  , g_high :: n
g_high = 10
  , g_extcode :: n
g_extcode = 20
  , g_balance :: n
g_balance = 20
  , g_sload :: n
g_sload = 50
  , g_jumpdest :: n
g_jumpdest = 1
  , g_sset :: n
g_sset = 20000
  , g_sreset :: n
g_sreset = 5000
  , r_sclear :: n
r_sclear = 15000
  , g_selfdestruct :: n
g_selfdestruct = 0
  , g_selfdestruct_newaccount :: n
g_selfdestruct_newaccount = 0
  , r_selfdestruct :: n
r_selfdestruct = 24000
  , g_create :: n
g_create = 32000
  , g_codedeposit :: n
g_codedeposit = 200
  , g_call :: n
g_call = 40
  , g_callvalue :: n
g_callvalue = 9000
  , g_callstipend :: n
g_callstipend = 2300
  , g_newaccount :: n
g_newaccount = 25000
  , g_exp :: n
g_exp = 10
  , g_expbyte :: n
g_expbyte = 10
  , g_memory :: n
g_memory = 3
  , g_txcreate :: n
g_txcreate = 32000
  , g_txdatazero :: n
g_txdatazero = 4
  , g_txdatanonzero :: n
g_txdatanonzero = 68
  , g_transaction :: n
g_transaction = 21000
  , g_log :: n
g_log = 375
  , g_logdata :: n
g_logdata = 8
  , g_logtopic :: n
g_logtopic = 375
  , g_sha3 :: n
g_sha3 = 30
  , g_sha3word :: n
g_sha3word = 6
  , g_copy :: n
g_copy = 3
  , g_blockhash :: n
g_blockhash = 20
  , g_extcodehash :: n
g_extcodehash = 400
  , g_quaddivisor :: n
g_quaddivisor = 20
  , g_ecadd :: n
g_ecadd = 500
  , g_ecmul :: n
g_ecmul = 40000
  , g_pairing_point :: n
g_pairing_point = 80000
  , g_pairing_base :: n
g_pairing_base = 100000
  , g_fround :: n
g_fround = 1
  , r_block :: n
r_block = 2000000000000000000
  , g_cold_sload :: n
g_cold_sload = 2100
  , g_cold_account_access :: n
g_cold_account_access = 2600
  , g_warm_storage_read :: n
g_warm_storage_read = 100
  , g_access_list_address :: n
g_access_list_address = 2400
  , g_access_list_storage_key :: n
g_access_list_storage_key = 1900
  }

metropolis :: Num n => FeeSchedule n
metropolis :: FeeSchedule n
metropolis = FeeSchedule n -> FeeSchedule n
forall n. EIP n
eip160 (FeeSchedule n -> FeeSchedule n)
-> (FeeSchedule n -> FeeSchedule n)
-> FeeSchedule n
-> FeeSchedule n
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FeeSchedule n -> FeeSchedule n
forall n. EIP n
eip150 (FeeSchedule n -> FeeSchedule n) -> FeeSchedule n -> FeeSchedule n
forall a b. (a -> b) -> a -> b
$ FeeSchedule n
forall n. Num n => FeeSchedule n
homestead

-- EIP1108: Reduce alt_bn128 precompile gas costs
-- <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1108.md>
eip1108 :: EIP n
eip1108 :: FeeSchedule n -> FeeSchedule n
eip1108 fees :: FeeSchedule n
fees = FeeSchedule n
fees
  { g_ecadd :: n
g_ecadd = 150
  , g_ecmul :: n
g_ecmul = 6000
  , g_pairing_point :: n
g_pairing_point = 34000
  , g_pairing_base :: n
g_pairing_base = 45000
  }

-- EIP1884: Repricing for trie-size-dependent opcodes
-- <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1884.md>
eip1884 :: EIP n
eip1884 :: FeeSchedule n -> FeeSchedule n
eip1884 fees :: FeeSchedule n
fees = FeeSchedule n
fees
  { g_sload :: n
g_sload = 800
  , g_balance :: n
g_balance = 700
  , g_extcodehash :: n
g_extcodehash = 700
  }

-- EIP2028: Transaction data gas cost reduction
-- <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2028.md>
eip2028 :: EIP n
eip2028 :: FeeSchedule n -> FeeSchedule n
eip2028 fees :: FeeSchedule n
fees = FeeSchedule n
fees
  { g_txdatanonzero :: n
g_txdatanonzero = 16
  }

-- EIP2200: Structured definitions for gas metering
-- <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2200.md>
eip2200 :: EIP n
eip2200 :: FeeSchedule n -> FeeSchedule n
eip2200 fees :: FeeSchedule n
fees = FeeSchedule n
fees
  { g_sload :: n
g_sload = 800
  , g_sset :: n
g_sset = 20000   -- not changed
  , g_sreset :: n
g_sreset = 5000  -- not changed
  , r_sclear :: n
r_sclear = 15000 -- not changed
  }

istanbul :: Num n => FeeSchedule n
istanbul :: FeeSchedule n
istanbul = FeeSchedule n -> FeeSchedule n
forall n. EIP n
eip1108 (FeeSchedule n -> FeeSchedule n)
-> (FeeSchedule n -> FeeSchedule n)
-> FeeSchedule n
-> FeeSchedule n
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FeeSchedule n -> FeeSchedule n
forall n. EIP n
eip1884 (FeeSchedule n -> FeeSchedule n)
-> (FeeSchedule n -> FeeSchedule n)
-> FeeSchedule n
-> FeeSchedule n
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FeeSchedule n -> FeeSchedule n
forall n. EIP n
eip2028 (FeeSchedule n -> FeeSchedule n)
-> (FeeSchedule n -> FeeSchedule n)
-> FeeSchedule n
-> FeeSchedule n
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FeeSchedule n -> FeeSchedule n
forall n. EIP n
eip2200 (FeeSchedule n -> FeeSchedule n) -> FeeSchedule n -> FeeSchedule n
forall a b. (a -> b) -> a -> b
$ FeeSchedule n
forall n. Num n => FeeSchedule n
metropolis

  -- EIP2929: Gas cost increases for state access opcodes
  -- <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2929.md>
eip2929 :: EIP n
eip2929 :: FeeSchedule n -> FeeSchedule n
eip2929 fees :: FeeSchedule n
fees = FeeSchedule n
fees
  { g_sload :: n
g_sload = 100 
  , g_sreset :: n
g_sreset = 5000 n -> n -> n
forall a. Num a => a -> a -> a
- 2100 
  , g_call :: n
g_call = 2600
  , g_balance :: n
g_balance = 2600
  , g_extcode :: n
g_extcode = 2600
  , g_extcodehash :: n
g_extcodehash = 2600
  }

berlin :: Num n => FeeSchedule n
berlin :: FeeSchedule n
berlin = FeeSchedule n -> FeeSchedule n
forall n. EIP n
eip2929 FeeSchedule n
forall n. Num n => FeeSchedule n
istanbul