I'm going through the Numerai contracts and noticing a common pattern - https://github.com/numerai/contract/blob/master/contracts/NumeraireBackend.sol
and https://gist.github.com/Arachnid/4ca9da48d51e23e5cfe0f0e14dd6318f
function stakeOnBehalf(address _staker, uint256 _value, bytes32 _tag, uint256 _tournamentID, uint256 _roundID, uint256 _confidence) stopInEmergency onlyPayloadSize(6) returns (bool ok) {
return delegateContract.delegatecall(bytes4(sha3("stakeOnBehalf(address,uint256,bytes32,uint256,uint256,uint256)")), _staker, _value, _tag, _tournamentID, _roundID, _confidence);
}
I see the delegatecall with the bytes4
and get the sha3
hash of a string before the variables of the function. I understand what sha3
does in this context, but my question is why?
Is it for security? What is the purpose of the string before the variables as well?