Skip to content

Commit

Permalink
Fix audittens i16 (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavBreadless authored Nov 29, 2024
1 parent d335fe3 commit 39ca05d
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions l1-contracts/contracts/bridge/BridgeHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,23 @@ library BridgeHelper {
symbol = abi.encode("ETH");
decimals = abi.encode(uint8(18));
} else {
bool success;
/// note this also works on the L2 for the base token.
(, name) = _token.staticcall(abi.encodeCall(IERC20Metadata.name, ()));
(, symbol) = _token.staticcall(abi.encodeCall(IERC20Metadata.symbol, ()));
(, decimals) = _token.staticcall(abi.encodeCall(IERC20Metadata.decimals, ()));
(success, name) = _token.staticcall(abi.encodeCall(IERC20Metadata.name, ()));
if (!success) {
// We ignore the revert data
name = hex"";
}
(success, symbol) = _token.staticcall(abi.encodeCall(IERC20Metadata.symbol, ()));
if (!success) {
// We ignore the revert data
symbol = hex"";
}
(success, decimals) = _token.staticcall(abi.encodeCall(IERC20Metadata.decimals, ()));
if (!success) {
// We ignore the revert data
decimals = hex"";
}
}
return
DataEncoding.encodeTokenData({_chainId: _originChainId, _name: name, _symbol: symbol, _decimals: decimals});
Expand Down

0 comments on commit 39ca05d

Please sign in to comment.