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