From b722da85a05ee975c532e1503e5ddb1ec3e2e3c1 Mon Sep 17 00:00:00 2001 From: josojo Date: Sat, 2 Mar 2024 11:25:24 +0100 Subject: [PATCH] fixes --- contracts/lib/BridgeAssetOperations.sol | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/contracts/lib/BridgeAssetOperations.sol b/contracts/lib/BridgeAssetOperations.sol index 79326e83..5e1057d4 100644 --- a/contracts/lib/BridgeAssetOperations.sol +++ b/contracts/lib/BridgeAssetOperations.sol @@ -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,