Randomness Callback

The official Seipex VRF Consumer deployment address is 0x7efDa6beA0e3cE66996FA3D82953FF232650ea67on Sei mainnet.

Finally, declare a randomness callback function which the VRC Consumer will call once the random number is ready.

function randomnessCallback(
        bytes32 randomNumber,
        uint256 requestId,
        bytes memory proof
    ) external {
        require(
            msg.sender == address(0x7efDa6beA0e3cE66996FA3D82953FF232650ea67),
            "Only the VRFConsumer can call this function"
        );
        
        // Callback returns the random number, requestId and proof and
        // you complete your game here when the callback happens      
}

Make sure that only the VRF Consumer address can call this function. It's important that this function exists and does not revert otherwise you will not receive your random number automatically.

Last updated