1

So there is a way to call other contract using abstract prototype of that contract. But what about delegate calls? I need to split my huge contract into separate pieces. So i can call my functions via delegate call (to make them able to change global state of main storage). The problem is that unlike the simple call (using abstract method), i have to call my own functions via such ugly way: contract_address.delegatecall(bytes4(sha3("foo(uint,uint)")),bar1,bar2); Is there any way to perform abstract delegate call? Or maybe such plans to add this feature? Thank you.

1

Using libraries should be able to help somehow. The problem is that from a library function you cannot access the contract state.

library Helper {
  function add(uint x, uint y) internal constant returns (uint) {
    return x + y;
  }
}

contract C {
  function doSomething(uint x, uint y) public returns (uint) {
    return Helper.add(uint x, uint y);
  }
}
| 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.