Commit 8d125b7b authored by Kelvin Fichter's avatar Kelvin Fichter

feat(ctb): preserve legacy ETH invariant

Preserves the invariant in LegacyERC20ETH that balanceOf(x) is always
the same as address(x).balance. balanceOf is the only function that was
not being blocked and contracts may exist that rely on this behavior.
parent 5ff5a00f
This diff is collapsed.
This diff is collapsed.
...@@ -22,6 +22,19 @@ contract LegacyERC20ETH is OptimismMintableERC20 { ...@@ -22,6 +22,19 @@ contract LegacyERC20ETH is OptimismMintableERC20 {
OptimismMintableERC20(Predeploys.L2_STANDARD_BRIDGE, address(0), "Ether", "ETH") OptimismMintableERC20(Predeploys.L2_STANDARD_BRIDGE, address(0), "Ether", "ETH")
{} {}
/**
* @notice Returns the ETH balance of the target account. Overrides the base behavior of the
* contract to preserve the invariant that the balance within this contract always
* matches the balance in the state trie.
*
* @param _who Address of the account to query.
*
* @return The ETH balance of the target account.
*/
function balanceOf(address _who) public view virtual override returns (uint256) {
return address(_who).balance;
}
/** /**
* @custom:blocked * @custom:blocked
* @notice Mints some amount of ETH. * @notice Mints some amount of ETH.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment