diff --git a/src/CairoLib.sol b/src/CairoLib.sol index af8f883..0fac625 100644 --- a/src/CairoLib.sol +++ b/src/CairoLib.sol @@ -16,11 +16,10 @@ library CairoLib { internal returns (bytes memory) { - bytes memory callData = - abi.encodeWithSignature("call_contract(uint256,uint256,uint256[])", contractAddress, functionSelector, data); + bytes memory callData = abi.encode(contractAddress, functionSelector, data); (bool success, bytes memory result) = CAIRO_PRECOMPILE_ADDRESS.call(callData); - require(success, string(abi.encodePacked("CairoLib: call_contract failed with: ", result))); + require(success, string(abi.encodePacked("CairoLib: cairo call failed with: ", result))); return result; } @@ -69,11 +68,10 @@ library CairoLib { internal returns (bytes memory) { - bytes memory callData = - abi.encodeWithSignature("call_contract(uint256,uint256,uint256[])", contractAddress, functionSelector, data); + bytes memory callData = abi.encode(contractAddress, functionSelector, data); (bool success, bytes memory result) = CAIRO_PRECOMPILE_ADDRESS.delegatecall(callData); - require(success, string(abi.encodePacked("CairoLib: call_contract failed with: ", result))); + require(success, string(abi.encodePacked("CairoLib: cairo call failed with: ", result))); return result; } @@ -130,11 +128,10 @@ library CairoLib { view returns (bytes memory) { - bytes memory callData = - abi.encodeWithSignature("call_contract(uint256,uint256,uint256[])", contractAddress, functionSelector, data); + bytes memory callData = abi.encode(contractAddress, functionSelector, data); (bool success, bytes memory result) = CAIRO_PRECOMPILE_ADDRESS.staticcall(callData); - require(success, string(abi.encodePacked("CairoLib: call_contract failed with: ", result))); + require(success, string(abi.encodePacked("CairoLib: cairo call failed with: ", result))); return result; }