@@ -97,7 +97,7 @@ def globalfakesha3(data):
97
97
MASK160 = 2 ** 160 - 1
98
98
TT255 = 2 ** 255
99
99
TOOHIGHMEM = 0x1000
100
- DEFAULT_FORK = "constantinople "
100
+ DEFAULT_FORK = "istanbul "
101
101
102
102
# FIXME. We should just use a Transaction() for this
103
103
PendingTransaction = namedtuple (
@@ -1605,6 +1605,9 @@ def BALANCE(self, account):
1605
1605
"""Get balance of the given account"""
1606
1606
return self .world .get_balance (account )
1607
1607
1608
+ def SELFBALANCE (self ):
1609
+ return self .world .get_balance (self .address )
1610
+
1608
1611
def ORIGIN (self ):
1609
1612
"""Get execution origination address"""
1610
1613
return Operators .ZEXTEND (self .world .tx_origin (), 256 )
@@ -1774,6 +1777,12 @@ def EXTCODESIZE(self, account):
1774
1777
"""Get size of an account's code"""
1775
1778
return len (self .world .get_code (account ))
1776
1779
1780
+ @concretized_args (account = "ACCOUNTS" )
1781
+ def EXTCODEHASH (self , account ):
1782
+ """Get hash of code"""
1783
+ bytecode = self .world .get_code (account )
1784
+ return globalsha3 (bytecode )
1785
+
1777
1786
def EXTCODECOPY_gas (self , account , address , offset , size ):
1778
1787
GCOPY = 3 # cost to copy one 32 byte word
1779
1788
extbytecode = self .world .get_code (account )
@@ -1835,6 +1844,11 @@ def GASLIMIT(self):
1835
1844
"""Get the block's gas limit"""
1836
1845
return self .world .block_gaslimit ()
1837
1846
1847
+ def CHAINID (self ):
1848
+ """Get current chainid."""
1849
+ # 1:= Ethereum Mainnet - https://chainid.network/
1850
+ return 1
1851
+
1838
1852
############################################################################
1839
1853
# Stack, Memory, Storage and Flow Operations
1840
1854
def POP (self , a ):
0 commit comments