|
18 | 18 | along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
19 | 19 | */
|
20 | 20 |
|
21 |
| -pragma solidity >=0.7.0 <0.9.0; |
| 21 | +pragma solidity 0.8.4; |
22 | 22 |
|
23 | 23 | contract SemaphoreVerifier {
|
24 | 24 | // Scalar field size
|
25 |
| - uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617; |
| 25 | + uint256 public constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617; |
26 | 26 | // Base field size
|
27 |
| - uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; |
| 27 | + uint256 public constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; |
28 | 28 |
|
29 | 29 | // Verification Key data
|
30 |
| - uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042; |
31 |
| - uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958; |
| 30 | + uint256 public constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042; |
| 31 | + uint256 public constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958; |
32 | 32 |
|
33 |
| - uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132; |
34 |
| - uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731; |
| 33 | + uint256 public constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132; |
| 34 | + uint256 public constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731; |
35 | 35 |
|
36 |
| - uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679; |
37 |
| - uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856; |
| 36 | + uint256 public constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679; |
| 37 | + uint256 public constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856; |
38 | 38 |
|
39 |
| - uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; |
40 |
| - uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; |
| 39 | + uint256 public constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; |
| 40 | + uint256 public constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; |
41 | 41 |
|
42 |
| - uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531; |
43 |
| - uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930; |
| 42 | + uint256 public constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531; |
| 43 | + uint256 public constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930; |
44 | 44 |
|
45 |
| - uint256 constant deltax1 = 4802212656094790438590349860247775075786991105131547807727284652635601493451; |
46 |
| - uint256 constant deltax2 = 3192001579163161965737706068451660722884189926734050314177195054150514444526; |
| 45 | + uint256 public constant deltax1 = 4802212656094790438590349860247775075786991105131547807727284652635601493451; |
| 46 | + uint256 public constant deltax2 = 3192001579163161965737706068451660722884189926734050314177195054150514444526; |
47 | 47 |
|
48 |
| - uint256 constant deltay1 = 15972350841447731019470651411783473840114797777894828544121644904018624203926; |
49 |
| - uint256 constant deltay2 = 16736984041748862942817824193402022794140982482563484226161429255394796148810; |
| 48 | + uint256 public constant deltay1 = 15972350841447731019470651411783473840114797777894828544121644904018624203926; |
| 49 | + uint256 public constant deltay2 = 16736984041748862942817824193402022794140982482563484226161429255394796148810; |
50 | 50 |
|
51 |
| - uint256 constant IC0x = 7810627885438804854799393101615420860004300484567847086674409667961806655819; |
52 |
| - uint256 constant IC0y = 17752894058911463947056561254031971003439956976683150238952280384884265610345; |
| 51 | + uint256 public constant IC0x = 7810627885438804854799393101615420860004300484567847086674409667961806655819; |
| 52 | + uint256 public constant IC0y = 17752894058911463947056561254031971003439956976683150238952280384884265610345; |
53 | 53 |
|
54 |
| - uint256 constant IC1x = 1859027844886249956101358092211425783821368393550326618436626137559481879491; |
55 |
| - uint256 constant IC1y = 21054817398797605484546956719908640544118839476669181800056403255004730797738; |
| 54 | + uint256 public constant IC1x = 1859027844886249956101358092211425783821368393550326618436626137559481879491; |
| 55 | + uint256 public constant IC1y = 21054817398797605484546956719908640544118839476669181800056403255004730797738; |
56 | 56 |
|
57 |
| - uint256 constant IC2x = 15796976765804300435452771769828280808531244272386620395606681167033336150695; |
58 |
| - uint256 constant IC2y = 903968937841233929826399002238948203245370749106069849010375461873649600286; |
| 57 | + uint256 public constant IC2x = 15796976765804300435452771769828280808531244272386620395606681167033336150695; |
| 58 | + uint256 public constant IC2y = 903968937841233929826399002238948203245370749106069849010375461873649600286; |
59 | 59 |
|
60 |
| - uint256 constant IC3x = 9939447176137952809861441974771884976492003509733419789700227062163769465749; |
61 |
| - uint256 constant IC3y = 10252048733134373819769164658668132695840284406808712977431939424744406823235; |
| 60 | + uint256 public constant IC3x = 9939447176137952809861441974771884976492003509733419789700227062163769465749; |
| 61 | + uint256 public constant IC3y = 10252048733134373819769164658668132695840284406808712977431939424744406823235; |
62 | 62 |
|
63 |
| - uint256 constant IC4x = 7393464059707248328549959352154443030400062088967711800345697753542770722400; |
64 |
| - uint256 constant IC4y = 7750652018971809526357985723000957185438256496025176410178561237545956517939; |
| 63 | + uint256 public constant IC4x = 7393464059707248328549959352154443030400062088967711800345697753542770722400; |
| 64 | + uint256 public constant IC4y = 7750652018971809526357985723000957185438256496025176410178561237545956517939; |
65 | 65 |
|
66 | 66 | // Memory data
|
67 |
| - uint16 constant pVk = 0; |
68 |
| - uint16 constant pPairing = 128; |
| 67 | + uint16 public constant pVk = 0; |
| 68 | + uint16 public constant pPairing = 128; |
69 | 69 |
|
70 |
| - uint16 constant pLastMem = 896; |
| 70 | + uint16 public constant pLastMem = 896; |
71 | 71 |
|
72 | 72 | function verifyProof(
|
73 | 73 | uint[2] calldata _pA,
|
74 | 74 | uint[2][2] calldata _pB,
|
75 | 75 | uint[2] calldata _pC,
|
76 | 76 | uint[4] calldata _pubSignals
|
77 |
| - ) public view returns (bool) { |
| 77 | + ) external view returns (bool) { |
78 | 78 | assembly {
|
79 | 79 | function checkField(v) {
|
80 | 80 | if iszero(lt(v, q)) {
|
|
0 commit comments