-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathTestHelperVRF.sol
55 lines (44 loc) · 1.52 KB
/
TestHelperVRF.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "../contracts/VRF.sol";
/**
* @title Test Helper for the VRF contract
* @dev The aim of this contract is twofold:
* 1. Raise the visibility modifier of VRF contract functions for testing purposes
* 2. Removal of the `pure` modifier to allow gas consumption analysis
* @author Witnet Foundation
*/
contract TestHelperVRF {
function decodeProof(bytes memory _proof) public pure returns (uint[4] memory) {
return VRF.decodeProof(_proof);
}
function decodePoint(bytes memory _point) public pure returns (uint[2] memory) {
return VRF.decodePoint(_point);
}
function computeFastVerifyParams(uint256[2] memory _publicKey, uint256[4] memory _proof, bytes memory _message)
public pure returns (uint256[2] memory, uint256[4] memory)
{
return VRF.computeFastVerifyParams(_publicKey, _proof, _message);
}
function verify(uint256[2] memory _publicKey, uint256[4] memory _proof, bytes memory _message) public pure returns (bool) {
return VRF.verify(_publicKey, _proof, _message);
}
function fastVerify(
uint256[2] memory _publicKey,
uint256[4] memory _proof,
bytes memory _message,
uint256[2] memory _uPoint,
uint256[4] memory _vComponents)
public pure returns (bool)
{
return VRF.fastVerify(
_publicKey,
_proof,
_message,
_uPoint,
_vComponents);
}
function gammaToHash(uint256 _gammaX, uint256 _gammaY) public pure returns (bytes32) {
return VRF.gammaToHash(_gammaX, _gammaY);
}
}