I'm currently trying to develop my knowledge further on lower level calls such as DELEGATECALL.

I am continiously running into when trying to use .delegatecall():

RunTime Error: out of gas
Gas Usage: 0xe07e44(Decimal = 14712388)

delegateCall contract:

 pragma solidity ^0.4.4;
 import "delegateReceiever.sol";

contract delegateCall{
uint public testInt;
address public sender;

function delegateCall(){
    testInt = 1;

function delegateCallC(address _c, uint _testInt){
if(_c.delegatecall(bytes4(sha3("setTestInt(uint")),_testInt ))

delegateReceiever contract:

pragma solidity ^0.4.4;
contract delegateReceiever{
uint public testInt;

function delegateReceiever(){
    testInt = 2;

function setTestInt(uint _testInt){
    testInt = _testInt;

Edited truffle deploy to increase gas like so:


Edited testrpc initial account balance to:


Edited truffle.js file to include gas:

   host: "localhost",
   port: 8545,
   gas: 114712388

Is there any other method of ensuring gas will not run out? For example, is there a developer parameter that requires no gas etc..?

  • For my own learning, is "setTestInt(uint" missing a closing parentheses on purpose? – Miguel Mota Aug 9 '18 at 11:26

delegatecall returns true on success, so

if(_c.delegatecall(bytes4(sha3("setTestInt(uint")),_testInt ))

will throw if the call is successfull.


if(!_c.delegatecall(bytes4(sha3("setTestInt(uint")),_testInt ))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.