Contract
0x55c2Ee4f0a21c59F949f475e52415b5684280CB1
1
Contract Overview
Balance:
0 AVAX
AVAX Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0xd358638d2a7f8914cd02348ab02d546c74afb340e3564729488dbdacdd468642 | 0x60806040 | 12741396 | 52 days 6 hrs ago | 0x209484169c126f69db7c83df8d7cd0cb3db22519 | IN | Create: RewardVerifier | 0 AVAX | 0.260379225 |
[ Download CSV Export ]
Contract Name:
RewardVerifier
Compiler Version
v0.6.12+commit.27d51765
Contract Source Code (Solidity)
/** *Submitted for verification at snowtrace.io on 2022-04-13 */ // RewardVerifier.sol Flattened /* Avacash.Finance: Privacy-focused Investments in Avalanche Visit https://avacash.finance Check Audits in https://docs.avacash.finance/ V.1.1 █████╗ ██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗ ██╔══██╗██║ ██║██╔══██╗██╔════╝██╔══██╗██╔════╝██║ ██║ ███████║██║ ██║███████║██║ ███████║███████╗███████║ ██╔══██║╚██╗ ██╔╝██╔══██║██║ ██╔══██║╚════██║██╔══██║ ██║ ██║ ╚████╔╝ ██║ ██║╚██████╗██║ ██║███████║██║ ██║ ╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ███████╗██╗███╗ ██╗ █████╗ ███╗ ██╗ ██████╗███████╗ ██╔════╝██║████╗ ██║██╔══██╗████╗ ██║██╔════╝██╔════╝ █████╗ ██║██╔██╗ ██║███████║██╔██╗ ██║██║ █████╗ ██╔══╝ ██║██║╚██╗██║██╔══██║██║╚██╗██║██║ ██╔══╝ ██║ ██║██║ ╚████║██║ ██║██║ ╚████║╚██████╗███████╗ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝╚══════╝ */ // File: contracts/verifiers/RewardVerifier.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; library Pairing { uint256 constant PRIME_Q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; struct G1Point { uint256 X; uint256 Y; } // Encoding of field elements is: X[0] * z + X[1] struct G2Point { uint256[2] X; uint256[2] Y; } /* * @return The negation of p, i.e. p.plus(p.negate()) should be zero */ function negate(G1Point memory p) internal pure returns (G1Point memory) { // The prime q in the base field F_q for G1 if (p.X == 0 && p.Y == 0) { return G1Point(0, 0); } else { return G1Point(p.X, PRIME_Q - (p.Y % PRIME_Q)); } } /* * @return r the sum of two points of G1 */ function plus( G1Point memory p1, G1Point memory p2 ) internal view returns (G1Point memory r) { uint256[4] memory input = [ p1.X, p1.Y, p2.X, p2.Y ]; bool success; // solium-disable-next-line security/no-inline-assembly assembly { success := staticcall(sub(gas(), 2000), 6, input, 0xc0, r, 0x60) // Use "invalid" to make gas estimation work switch success case 0 { invalid() } } require(success, "pairing-add-failed"); } /* * @return r the product of a point on G1 and a scalar, i.e. * p == p.scalarMul(1) and p.plus(p) == p.scalarMul(2) for all * points p. */ function scalarMul(G1Point memory p, uint256 s) internal view returns (G1Point memory r) { uint256[3] memory input = [p.X, p.Y, s]; bool success; // solium-disable-next-line security/no-inline-assembly assembly { success := staticcall(sub(gas(), 2000), 7, input, 0x80, r, 0x60) // Use "invalid" to make gas estimation work switch success case 0 { invalid() } } require(success, "pairing-mul-failed"); } /* @return The result of computing the pairing check * e(p1[0], p2[0]) * .... * e(p1[n], p2[n]) == 1 * For example, * pairing([P1(), P1().negate()], [P2(), P2()]) should return true. */ function pairing( G1Point memory a1, G2Point memory a2, G1Point memory b1, G2Point memory b2, G1Point memory c1, G2Point memory c2, G1Point memory d1, G2Point memory d2 ) internal view returns (bool) { uint256[24] memory input = [ a1.X, a1.Y, a2.X[0], a2.X[1], a2.Y[0], a2.Y[1], b1.X, b1.Y, b2.X[0], b2.X[1], b2.Y[0], b2.Y[1], c1.X, c1.Y, c2.X[0], c2.X[1], c2.Y[0], c2.Y[1], d1.X, d1.Y, d2.X[0], d2.X[1], d2.Y[0], d2.Y[1] ]; uint256[1] memory out; bool success; // solium-disable-next-line security/no-inline-assembly assembly { success := staticcall(sub(gas(), 2000), 8, input, mul(24, 0x20), out, 0x20) // Use "invalid" to make gas estimation work switch success case 0 { invalid() } } require(success, "pairing-opcode-failed"); return out[0] != 0; } } contract RewardVerifier { uint256 constant SNARK_SCALAR_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617; uint256 constant PRIME_Q = 21888242871839275222246405745257275088696311157297823662689037894645226208583; using Pairing for *; struct VerifyingKey { Pairing.G1Point alfa1; Pairing.G2Point beta2; Pairing.G2Point gamma2; Pairing.G2Point delta2; Pairing.G1Point[13] IC; } function verifyingKey() internal pure returns (VerifyingKey memory vk) { vk.alfa1 = Pairing.G1Point(uint256(4553325557779972549638085524729520109606974412790145636375195877897165216886), uint256(4565141803779308879478376883020155522080283243481641587848132552194011457072)); vk.beta2 = Pairing.G2Point([uint256(21795043833158849315149822154703943190773888990789209572393217927874997233659), uint256(9615422013179423608802778137712723115287334517418332915037870133668489688426)], [uint256(11396906238363855568648033437869606181086174437666638187380697381691821736516), uint256(21037063051003766616135543879849442507547875476870425189552527497432564332212)]); vk.gamma2 = Pairing.G2Point([uint256(7897617957999673035799789355924936566094200042468389367289322993064642840432), uint256(19463087544215100433813799701170870746179128711738065221641284489355381288731)], [uint256(58428999331624262715765618678790212923533090177577710407545099890344901696), uint256(14699444274472253614650581997793263191127501025785560508155332237963676597243)]); vk.delta2 = Pairing.G2Point([uint256(6407260744615577253013273448670194267447326711790730923817563354209855187074), uint256(12602533981865761589016385150283329940681632535316295028389294423195275109849)], [uint256(21837290307680520538108368182839140442005581975111322692696846161833297300603), uint256(20480098371958932078081909162754900378918077956581547550208277048325758212340)]); vk.IC[0] = Pairing.G1Point(uint256(9056076546161075347166548970907008701734604665913838301067499903383113956445), uint256(18091340235754904503753420435552454028015977980747911843770207510030182936012)); vk.IC[1] = Pairing.G1Point(uint256(6681438949395956520917327622263249539412039091387156741453534809339020135910), uint256(1340958998784938980995616579018897822284916882535450299280291172228690734785)); vk.IC[2] = Pairing.G1Point(uint256(13721153540292832547465731745196759234656617630780310688322491862212848547376), uint256(13363320111049903674452086890312413184243161058502179598656179780619772458694)); vk.IC[3] = Pairing.G1Point(uint256(3947539524660075952352833336050751102960910584366219908864344807665005387881), uint256(5294467160112437621707498299669708039892670197037014095410014311139995248229)); vk.IC[4] = Pairing.G1Point(uint256(7077587025310054030193357832716270269250430755809333108365732575092218788355), uint256(20408356258800341963326551664354901814296197159253435028842468214163089104361)); vk.IC[5] = Pairing.G1Point(uint256(18054387723555555996790083907154866220385980435327582076418943650470854331519), uint256(8799962658993895354624389497858052615707186345602672578895149164056775889727)); vk.IC[6] = Pairing.G1Point(uint256(21377038878160605027683129665314526547485676187054306522335257385974528927831), uint256(10882837078278830115600319485476502490060770549128822573370259485992296981482)); vk.IC[7] = Pairing.G1Point(uint256(20942312410047293785720152899299458461135756113589362698268600238532678374237), uint256(5857164022407541162893158106376785667807060754157295039657399796122351210523)); vk.IC[8] = Pairing.G1Point(uint256(12673742463344061699927863980969981283012056109327725502697371523935062608675), uint256(16052864217724030939862680095107248838213648618452863627753558357913695369152)); vk.IC[9] = Pairing.G1Point(uint256(2367963805563200759391143443496600646345573390209267553258281553419200351627), uint256(13537910469027724695463700821189197899269679775558309729818311085021850548494)); vk.IC[10] = Pairing.G1Point(uint256(10425027035798488340765632713230081375263983094092100225324756523152460367667), uint256(13579817268424669677540588784132407231682927560248859539634692695555741320973)); vk.IC[11] = Pairing.G1Point(uint256(12924832128545372328233083705303231769607023817607236436720126794211844310733), uint256(6665070279895487624101555009565693557628389349007526873122823248540198667409)); vk.IC[12] = Pairing.G1Point(uint256(7251847029011483783651651560962158546305886865520516646384597057701803813578), uint256(12225818222075046279997517934018271636586087932625938280382792436395600261252)); } /* * @returns Whether the proof is valid given the hardcoded verifying key * above and the public inputs */ function verifyProof( bytes memory proof, uint256[12] memory input ) public view returns (bool) { uint256[8] memory p = abi.decode(proof, (uint256[8])); for (uint8 i = 0; i < p.length; i++) { // Make sure that each element in the proof is less than the prime q require(p[i] < PRIME_Q, "verifier-proof-element-gte-prime-q"); } Pairing.G1Point memory proofA = Pairing.G1Point(p[0], p[1]); Pairing.G2Point memory proofB = Pairing.G2Point([p[2], p[3]], [p[4], p[5]]); Pairing.G1Point memory proofC = Pairing.G1Point(p[6], p[7]); VerifyingKey memory vk = verifyingKey(); // Compute the linear combination vkX Pairing.G1Point memory vkX = vk.IC[0]; for (uint256 i = 0; i < input.length; i++) { // Make sure that every input is less than the snark scalar field require(input[i] < SNARK_SCALAR_FIELD, "verifier-input-gte-snark-scalar-field"); vkX = Pairing.plus(vkX, Pairing.scalarMul(vk.IC[i + 1], input[i])); } return Pairing.pairing( Pairing.negate(proofA), proofB, vk.alfa1, vk.beta2, vkX, vk.gamma2, proofC, vk.delta2 ); } }
[{"inputs":[{"internalType":"bytes","name":"proof","type":"bytes"},{"internalType":"uint256[12]","name":"input","type":"uint256[12]"}],"name":"verifyProof","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50611400806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806372774f7214610030575b600080fd5b61012c60048036036101a081101561004757600080fd5b810190808035906020019064010000000081111561006457600080fd5b82018360208201111561007657600080fd5b8035906020019184600183028401116401000000008311171561009857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290806101800190600c806020026040519081016040528092919082600c60200280828437600081840152601f19601f8201169050808301925050505050509192919290505050610144565b60405180821515815260200191505060405180910390f35b600061014e6111fa565b8380602001905161010081101561016457600080fd5b8101908091905050905060005b60088160ff161015610215577f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47828260ff16600881106101ad57fe5b602002015110610208576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806113a96022913960400191505060405180910390fd5b8080600101915050610171565b5061021e61121d565b60405180604001604052808360006008811061023657fe5b602002015181526020018360016008811061024d57fe5b6020020151815250905061025f611237565b604051806040016040528060405180604001604052808660026008811061028257fe5b602002015181526020018660036008811061029957fe5b602002015181525081526020016040518060400160405280866004600881106102be57fe5b60200201518152602001866005600881106102d557fe5b602002015181525081525090506102ea61121d565b60405180604001604052808560066008811061030257fe5b602002015181526020018560076008811061031957fe5b6020020151815250905061032b61125d565b610333610469565b905061033d61121d565b81608001516000600d811061034e57fe5b6020020151905060005b600c811015610432577f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000018982600c811061038e57fe5b6020020151106103e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806113846025913960400191505060405180910390fd5b6104238261041e856080015160018501600d811061040357fe5b60200201518c85600c811061041457fe5b6020020151610cb5565b610d88565b91508080600101915050610358565b5061045b61043f86610e69565b8584600001518560200151858760400151898960600151610f1c565b965050505050505092915050565b61047161125d565b60405180604001604052807f0a111747a66635647b317571f9acdd631da6107eacd8e4f4f9416e9f49de1c7681526020017f0a17c75892c958f3319b68773adad26e60271c9be4c7cd0d794bc02d636066308152508160000181905250604051806040016040528060405180604001604052807f302f8ec267906df8916353d014f1db8e0760bde643f1090d8d7f1ac3c6e1a7fb81526020017f154222d0ba371cf04e7935ab7c15bda9de94bee90b9445a4c4c45b56dcc3756a815250815260200160405180604001604052807f19326b9b2e74dacc5aa920c5211b16c27a93dda3645686798fa283605335424481526020017f2e828e449ca06838faf49ffda23f98fa3246d2b656caaaeec44a517ec4ad76b48152508152508160200181905250604051806040016040528060405180604001604052807f1175e4b30e50a7c98fd6a7aa7f34dc958e3df4ef009aa726404fa3818737877081526020017f2b07b7984dbf89f0d72b90dcf24ffab1a3404ff3d2080b93d2b794e97c65af1b815250815260200160405180604001604052807e2111d409786b9f57cda72db2efbc494a18f6696fba5e7b50bb366dabd8bc4081526020017f207f97332545b3fd43ecf13e4021f084b1e7791963e6f6f7e2d3038ce4e3bbfb8152508152508160400181905250604051806040016040528060405180604001604052807f0e2a618da13e9d3826bc82640f30ff1aba4d2e426af8f845bb1a55c2f427a88281526020017f1bdcc80d990bdc4bc13dab9e90a4e73eb2bb064f1bbed2d4bf8baac66b7625d9815250815260200160405180604001604052807f304777e33c677b1eb139389e919966ebd79c4944a1072ffa93523d7a028dcc7b81526020017f2d47532c7ac2d0f617dcda000a35164fb42703ff79e605832c94be32da6f58f4815250815250816060018190525060405180604001604052807f14058ec442dbe147cfdb6cbf66f314b46653b8e6915300d814940eb2b3d1fc5d81526020017f27ff55f0c43363ff394449716eda6d57ca4478a5d4b09a4443acc5675f0a6dcc81525081608001516000600d811061078257fe5b602002018190525060405180604001604052807f0ec58f787725c14f39ce4d7166121b118d2e879dde8b1fe05427bed2cfef4de681526020017f02f6f4b5a93fa58b34546cf6388bee52938c0819ece8c989b08840c9dfd1eec181525081608001516001600d81106107f057fe5b602002018190525060405180604001604052807f1e55e5cf0fd28ef5408216e99e0bcc14c4786557410e066f6ec434b9cb0e763081526020017f1d8b5f037ebfabefd8e9e1d4e41ee1e5b71b0811f39db5451f3bb43b680976c681525081608001516002600d811061085e57fe5b602002018190525060405180604001604052807f08ba3a6ad979642e4dddc44cf96b111fb8308777b855c0e6debb0a2f907a606981526020017f0bb48fed8c8c5315aa2204ba1f6c22d523198f295d4018430b68208b3947666581525081608001516003600d81106108cc57fe5b602002018190525060405180604001604052807f0fa5c5b5435799b9fc11232658919800a1f841534aa76e7f922e07242913fa0381526020017f2d1eb8659b0a260c4539907eec17962dec94239fcb57def60860cb7f79239de981525081608001516004600d811061093a57fe5b602002018190525060405180604001604052807f27ea6bdbe93c5e6631b0af507282300a2b1f0c087a4d5678fef9fb9b0a2f0c7f81526020017f13749a3434a210b5fa81f31c50a5b929289d87c0a7edf3197e95f266a53e133f81525081608001516005600d81106109a857fe5b602002018190525060405180604001604052807f2f42f9a8e750a8a666ca03d380a07ba4cc22488bc74f20cd617febf63e12e85781526020017f180f77ae46dcfef52037332bf4e3472a7bd8c385b9c02b465cfc82540bb523ea81525081608001516006600d8110610a1657fe5b602002018190525060405180604001604052807f2e4cedc40278619e3e443c58a51102fe0659c34476ce85415dddab5dd7bbd35d81526020017f0cf309902ccc3ab85ed3715bf42fcc4c7f2e7a7e6e5cbdd8c2a185115056901b81525081608001516007600d8110610a8457fe5b602002018190525060405180604001604052807f1c051582f8ff07ab2dc2b4795e0f2511c0906cbcb18ffcfeebcbe624c8fa4b2381526020017f237d9962ece1c4f5e87f741c7c10e7862d6d130e6bda944741bafa59ed5b37c081525081608001516008600d8110610af257fe5b602002018190525060405180604001604052807f053c38531f3b88d4b3cfe03cdca536704f1940b2f9be697f361572343e23cd8b81526020017f1dee2f8fcaaefe8b7dcc64d22dc97c6d7548b9a7bee49df425b8e7447680b90e81525081608001516009600d8110610b6057fe5b602002018190525060405180604001604052807f170c5b3005cd5071116cf8b986cbbf448ca7f8d5c3061b66157ac124cff2473381526020017f1e05e7795f5d7f9d7f61b8a95d026e3a0ec1b943ba99a65a6eb40b965cfc070d8152508160800151600a600d8110610bce57fe5b602002018190525060405180604001604052807f1c93321c472ce72dd2c548ab84bdd5ee7f43f9219b0d1c781b97d056aa4e46cd81526020017f0ebc4bccc4ff718b72da8868fe76841c90659a35f0674e8a61db69c7dbae84918152508160800151600b600d8110610c3c57fe5b602002018190525060405180604001604052807f1008666409dd8f5f599eecad0d96ced23928000e1f2c9446cca53679e42d6aca81526020017f1b079161770ee75c9124fa7990e31744f0cf142f406fbe9434f4a66ca31030848152508160800151600c600d8110610caa57fe5b602002018190525090565b610cbd61121d565b610cc56112aa565b60405180606001604052808560000151815260200185602001518152602001848152509050600060608360808460076107d05a03fa90508060008114610d0a57610d0c565bfe5b5080610d80576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f70616972696e672d6d756c2d6661696c6564000000000000000000000000000081525060200191505060405180910390fd5b505092915050565b610d9061121d565b610d986112cc565b604051806080016040528085600001518152602001856020015181526020018460000151815260200184602001518152509050600060608360c08460066107d05a03fa90508060008114610deb57610ded565bfe5b5080610e61576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f70616972696e672d6164642d6661696c6564000000000000000000000000000081525060200191505060405180910390fd5b505092915050565b610e7161121d565b60008260000151148015610e89575060008260200151145b15610eac5760405180604001604052806000815260200160008152509050610f17565b6040518060400160405280836000015181526020017f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47846020015181610eee57fe5b067f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd470381525090505b919050565b6000610f266112ee565b6040518061030001604052808b6000015181526020018b6020015181526020018a60000151600060028110610f5757fe5b602002015181526020018a60000151600160028110610f7257fe5b602002015181526020018a60200151600060028110610f8d57fe5b602002015181526020018a60200151600160028110610fa857fe5b6020020151815260200189600001518152602001896020015181526020018860000151600060028110610fd757fe5b602002015181526020018860000151600160028110610ff257fe5b60200201518152602001886020015160006002811061100d57fe5b60200201518152602001886020015160016002811061102857fe5b602002015181526020018760000151815260200187602001518152602001866000015160006002811061105757fe5b60200201518152602001866000015160016002811061107257fe5b60200201518152602001866020015160006002811061108d57fe5b6020020151815260200186602001516001600281106110a857fe5b60200201518152602001856000015181526020018560200151815260200184600001516000600281106110d757fe5b6020020151815260200184600001516001600281106110f257fe5b60200201518152602001846020015160006002811061110d57fe5b60200201518152602001846020015160016002811061112857fe5b6020020151815250905061113a611311565b600060208260206018028560086107d05a03fa9050806000811461115d5761115f565bfe5b50806111d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f70616972696e672d6f70636f64652d6661696c6564000000000000000000000081525060200191505060405180910390fd5b6000826000600181106111e257fe5b60200201511415935050505098975050505050505050565b604051806101000160405280600890602082028036833780820191505090505090565b604051806040016040528060008152602001600081525090565b604051806040016040528061124a611333565b8152602001611257611333565b81525090565b6040518060a0016040528061127061121d565b815260200161127d611237565b815260200161128a611237565b8152602001611297611237565b81526020016112a4611355565b81525090565b6040518060600160405280600390602082028036833780820191505090505090565b6040518060800160405280600490602082028036833780820191505090505090565b604051806103000160405280601890602082028036833780820191505090505090565b6040518060200160405280600190602082028036833780820191505090505090565b6040518060400160405280600290602082028036833780820191505090505090565b604051806101a00160405280600d905b61136d61121d565b815260200190600190039081611365579050509056fe76657269666965722d696e7075742d6774652d736e61726b2d7363616c61722d6669656c6476657269666965722d70726f6f662d656c656d656e742d6774652d7072696d652d71a2646970667358221220fb44e6710b698dafbd5260df99913041afac49b9a6254d7cf69c668f400793d564736f6c634300060c0033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.