为什么委托调用不能运行内部函数?
自我定向委托调用与通常调用它的内部功能之一的合同之间有什么区别?
contract DelegateInternal {
address public senderOne;
address public senderTwo;
function dellyCall() payable returns(uint256) {
senderOne = msg.sender;
this.delegatecall(bytes4(sha3('otherFunction()')));
}
// Not able to set this variable when this function is made internal
function otherFunction()
internal {
senderTwo = msg.sender;
}
}发布于 2019-02-13 15:53:36
功能是内部的。这意味着无法通过消息调用直接调用它,因为签名(在本例中为bytes4(sha3('otherFunction()')))不在函数表中。如果必须这样做,则必须公开一个公共函数,如果需要,还可以通过执行require(msg.sender == address(this))将其限制为自调用。
https://ethereum.stackexchange.com/questions/67018
复制相似问题