requestRandomNumber() has the same name twice?

A friend helped me out with this and I don't know if this is a typo or some kind of override?
"""
/* VRF Chainlink
Request random number from Chainlink
*/

function requestRandomNumber(RandomNumberRequest memory _randomNumberRequest) public {
    requestRandomNumber();
    randomNumberRequestsQueue.push(_randomNumberRequest);
}

function requestRandomNumber() public {
    s_requestId = COORDINATOR.requestRandomWords(
        keyHash,
        s_subscriptionId,
        requestConfirmations,
        callbackGasLimit,
        numWords
    );
}

"""

In solidity it is allowed to have 2 functions with the same name as long as the parameters are different. They call it function overloading.

See: https://docs.soliditylang.org/en/v0.8.4/contracts.html#function-overloading

1 Like