Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
josojo committed Mar 2, 2024
1 parent cbbb107 commit b722da8
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions contracts/lib/BridgeAssetOperations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,31 @@ library BridgeAssetOperations {
if (tokenInfo.originNetwork == 0) {
revert TokenNotForkable();
}
(bool successNameCall, bytes memory name) = IERC20Metadata(token).staticcall(
(bool successNameCall, bytes memory name) = token.staticcall(
/// encoding the function signature of N
abi.encodeWithSignature("name()")
);
if (!successNameCall) {
name = abi.encode("unknown-", token);
}
(bool successSymbolCall, bytes memory symbol) = address(token).staticcall(abi.encodeWithSignature("symbol()"));
(bool successSymbolCall, bytes memory symbol) = token.staticcall(
abi.encodeWithSignature("symbol()")
);
if (!successSymbolCall) {
symbol = abi.encode("UNKNOWN");
}
(bool successDecimalsCall, bytes memory decimals) = address(token).staticcall(abi.encodeWithSignature("decimals()"));
(bool successDecimalsCall, bytes memory decimals) = token.staticcall(
abi.encodeWithSignature("decimals()")
);
if (!successDecimalsCall) {
// setting the standard of 18 decimals might be wrong, but its better than locking the tokens for-ever in the forked bridge contract.
// we could also during deposits enforce that decimals() is readable
// setting the standard of 18 decimals might be wrong, but its better than locking the tokens for-ever in the forked bridge contract.
// we could also during deposits enforce that decimals() is readable
decimals = abi.encode("18");
}
bytes memory metadata = abi.encode(
name,
symbol,
decimals
abi.decode(name, (string)),
abi.decode(symbol, (string)),
abi.decode(decimals, (uint8))
);
ForkableBridge(child).mintForkableToken(
tokenInfo.originTokenAddress,
Expand Down

0 comments on commit b722da8

Please sign in to comment.