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] | |||
---|---|---|---|---|---|---|---|---|---|
0x1083372cc11508895d263f3118fde894a1ebd968638f35ec74b226408681eefc | 0x60806040 | 12741414 | 52 days 6 hrs ago | 0x209484169c126f69db7c83df8d7cd0cb3db22519 | IN | Create: WithdrawVerifier | 0 AVAX | 0.2335833 |
[ Download CSV Export ]
Contract Name:
WithdrawVerifier
Compiler Version
v0.6.12+commit.27d51765
Contract Source Code (Solidity)
/** *Submitted for verification at snowtrace.io on 2022-04-13 */ // WithdrawVerifier.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/WithdrawVerifier.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 WithdrawVerifier { 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[8] IC; } function verifyingKey() internal pure returns (VerifyingKey memory vk) { vk.alfa1 = Pairing.G1Point(uint256(8003191257131475466332871572552293218053851410737192258998234109174556022307), uint256(3985238886789381197445132520560863079216250367377662287252232673732932469598)); vk.beta2 = Pairing.G2Point([uint256(9761764439235554326625625306157510890479546648653445898697927151594103249767), uint256(15291887334342321936190920690152242978241756445106371841067398891063016563003)], [uint256(3276588401921358149828146830444994682669968631310129515921610234309100323951), uint256(21453759654473037353413650351257422599525803745872499972193770620265023611146)]); vk.gamma2 = Pairing.G2Point([uint256(21437784757841709926483525215263031111190835510089174002450847296894914679571), uint256(14633042729397704382101842169496928278140071581078443512908669024804415179470)], [uint256(21846661153976494232047264549823968857156054359204182571614737710608838050308), uint256(19016430073612127654119594015944105089810951855757623945306573100498262950530)]); vk.delta2 = Pairing.G2Point([uint256(12989087773594380352701218080969070737137255023238591515387627903045526551576), uint256(18422521064170995525023530832353180455641410936473320843047252868174656188287)], [uint256(1582843353599041149507309163422983238637957760735999464217682245004035464980), uint256(9834675776153140008342079706185528826990599320364135593694920261188780980245)]); vk.IC[0] = Pairing.G1Point(uint256(2018238709384403246832418277863490039734292006123124819472943552929960101608), uint256(19906881758199409019400165150326704020216266606107089415086367868943208181826)); vk.IC[1] = Pairing.G1Point(uint256(10099083955400060641875040462979459736085518901365922541295062403348638556991), uint256(6042047747015005355358104322469150692693114673776937121173533000229766712043)); vk.IC[2] = Pairing.G1Point(uint256(18642384784378086543983998291685447214057157988406464804325053504673092317812), uint256(18980968361413722147178276318974922813461202396877512311747491957603620357086)); vk.IC[3] = Pairing.G1Point(uint256(20987708717888899318373336825162136767216380363407343566633013326952280647154), uint256(104908931723811397542812880522603531301033242887066810851897901081959922779)); vk.IC[4] = Pairing.G1Point(uint256(3162595513976230784991590390745141465766743252210750274725492652565075572705), uint256(16112294705605943709788936539870722970891977266269610720136188448621403578508)); vk.IC[5] = Pairing.G1Point(uint256(9983848770537063730360295728129397568886807302741008612287483246495887774221), uint256(16246744176108594465765605925268282288770046146810238223901195837028789903051)); vk.IC[6] = Pairing.G1Point(uint256(19846979889282629928479250604086913282916037272241605940180327645658195033510), uint256(10557919111633117331029389521021115135297376962895686546486534933571580591540)); vk.IC[7] = Pairing.G1Point(uint256(7070363800118989192445809582331478863252468333509534650956253651537224897224), uint256(15789832792546432685819337101028064415335311645064701122329861504338928655950)); } /* * @returns Whether the proof is valid given the hardcoded verifying key * above and the public inputs */ function verifyProof( bytes memory proof, uint256[7] 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[7]","name":"input","type":"uint256[7]"}],"name":"verifyProof","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506111d9806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063598da1d114610030575b600080fd5b61012b600480360361010081101561004757600080fd5b810190808035906020019064010000000081111561006457600080fd5b82018360208201111561007657600080fd5b8035906020019184600183028401116401000000008311171561009857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908060e001906007806020026040519081016040528092919082600760200280828437600081840152601f19601f8201169050808301925050505050509192919290505050610143565b60405180821515815260200191505060405180910390f35b600061014d610fd3565b8380602001905161010081101561016357600080fd5b8101908091905050905060005b60088160ff161015610214577f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47828260ff16600881106101ac57fe5b602002015110610207576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806111826022913960400191505060405180910390fd5b8080600101915050610170565b5061021d610ff6565b60405180604001604052808360006008811061023557fe5b602002015181526020018360016008811061024c57fe5b6020020151815250905061025e611010565b604051806040016040528060405180604001604052808660026008811061028157fe5b602002015181526020018660036008811061029857fe5b602002015181525081526020016040518060400160405280866004600881106102bd57fe5b60200201518152602001866005600881106102d457fe5b602002015181525081525090506102e9610ff6565b60405180604001604052808560066008811061030157fe5b602002015181526020018560076008811061031857fe5b6020020151815250905061032a611036565b610332610468565b905061033c610ff6565b816080015160006008811061034d57fe5b6020020151905060005b6007811015610431577f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000189826007811061038d57fe5b6020020151106103e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061115d6025913960400191505060405180910390fd5b6104228261041d8560800151600185016008811061040257fe5b60200201518c856007811061041357fe5b6020020151610a8e565b610b61565b91508080600101915050610357565b5061045a61043e86610c42565b8584600001518560200151858760400151898960600151610cf5565b965050505050505092915050565b610470611036565b60405180604001604052807f11b1a54e5c5d4ce1710324f7002f4ae1cceaf708e85b42e3197d331fe12a562381526020017f08cf90b5e88b80cf23f55f9f1f4a8c4a058843e0a0d758255d108efa19d1035e8152508160000181905250604051806040016040528060405180604001604052807f1594f67efee8fd86ea1a4a43c6793d993bb1fd640da0f440474a4f52bcfa1b6781526020017f21cee6c98fc613cfe69004d23659939a9b4ed272978bb68d867f0fbdc0fa213b815250815260200160405180604001604052807f073e7bba896a437c22757ad3c68747fe091588d153f272903a62fbc5db52446f81526020017f2f6e65cca84c0c013d2b44bf9adb6ce37c9effcbf342ef7d718496d01e57210a8152508152508160200181905250604051806040016040528060405180604001604052807f2f655b2ecf1a4fb2cac3952338f5fdc2377aedb5afb75743bc250bbaf9b6531381526020017f205a0238f398017a3f1cc40d4a210a5475766c75a2d09db627a0bd6456c78ace815250815260200160405180604001604052807f304cc5a33e3e24660db3acac4845a91e80d295bb6a3a0edf71e76474018c420481526020017f2a0aeb01ee7cea9a2616089177573956e451351c081ca9098f147f0d5cb802828152508152508160400181905250604051806040016040528060405180604001604052807f1cb7902a9dc92722b5682501b2ee3676dc08584c6bfb3b2cca7b076b450afc1881526020017f28bac7046c85c85f8787b78aa559184cff964a0ae990b3d24b8ae073999e2f7f815250815260200160405180604001604052807f037fdb8b07067bd7e669670e47ece69fd24748581cb50827925d9ef130159f1481526020017f15be3aaeca0b83347e4598f94ec59ba519568d10422cc610d76a290d2a967815815250815250816060018190525060405180604001604052807f0476485a58130d6b7942245095aeb558794db721efdf82b93271484acf4d06e881526020017f2c02e55295cffad91ed957ed78ee50631c555ed21353c44a5ae95b7265ca7042815250816080015160006008811061078257fe5b602002018190525060405180604001604052807f1653e1033c9dfaa453f255bd38d6c64b28fd14a080d045b5a4b91a5d12c1633f81526020017f0d5bad86a8e576e0ecda1bae45aea232280d1916d55194d617451cc8b1a64aeb81525081608001516001600881106107f057fe5b602002018190525060405180604001604052807f293737430e9573db4825e8bb9612f590f05b3d7b3bf695f0a88097c6e9f1b27481526020017f29f6d8edebed675face4b4d8e46f07492dc27c64583d48508db916e82d8403de815250816080015160026008811061085e57fe5b602002018190525060405180604001604052807f2e669f46a6fcd17f027d4e8974e0846249532b87260456bef669feb64ba465f281526020017e3b60588c5198f90a4e21327c5a7fb6e8d17f516675af8e078ab0e48b54fc5b81525081608001516003600881106108cb57fe5b602002018190525060405180604001604052807f06fdf7335365b768b2dc6911d09d55abea37f7acc2d2815374daec982677b7e181526020017f239f3c523cba696bf34d33e8dad2f050dfbd616431c84c13b0f62772ca4c208c815250816080015160046008811061093957fe5b602002018190525060405180604001604052807f1612a87cac0e2c5dc5123b331cc431dada44d0b4dbae2a6acb4ef6879df3d20d81526020017f23eb54d2444483142466284f9bd363c46417354830326dc682cedd8cc537decb81525081608001516005600881106109a757fe5b602002018190525060405180604001604052807f2be0fe16c76a5fad08ed21f6426c9350f6897ca3f694495013e2db5e87b9fda681526020017f1757920912c3ae34ae105a4deba8b1f4c61f9d76ce0337699f9ede0d6795fdb48152508160800151600660088110610a1557fe5b602002018190525060405180604001604052807f0fa1af20f33292ee7917a3797530989be7c583e5d72df194101ec40b66b592c881526020017f22e8ba891fd8229718a6234da2a8d5fe9df2dbc97c0329e6781068851310de4e8152508160800151600760088110610a8357fe5b602002018190525090565b610a96610ff6565b610a9e611083565b60405180606001604052808560000151815260200185602001518152602001848152509050600060608360808460076107d05a03fa90508060008114610ae357610ae5565bfe5b5080610b59576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f70616972696e672d6d756c2d6661696c6564000000000000000000000000000081525060200191505060405180910390fd5b505092915050565b610b69610ff6565b610b716110a5565b604051806080016040528085600001518152602001856020015181526020018460000151815260200184602001518152509050600060608360c08460066107d05a03fa90508060008114610bc457610bc6565bfe5b5080610c3a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f70616972696e672d6164642d6661696c6564000000000000000000000000000081525060200191505060405180910390fd5b505092915050565b610c4a610ff6565b60008260000151148015610c62575060008260200151145b15610c855760405180604001604052806000815260200160008152509050610cf0565b6040518060400160405280836000015181526020017f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47846020015181610cc757fe5b067f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd470381525090505b919050565b6000610cff6110c7565b6040518061030001604052808b6000015181526020018b6020015181526020018a60000151600060028110610d3057fe5b602002015181526020018a60000151600160028110610d4b57fe5b602002015181526020018a60200151600060028110610d6657fe5b602002015181526020018a60200151600160028110610d8157fe5b6020020151815260200189600001518152602001896020015181526020018860000151600060028110610db057fe5b602002015181526020018860000151600160028110610dcb57fe5b602002015181526020018860200151600060028110610de657fe5b602002015181526020018860200151600160028110610e0157fe5b6020020151815260200187600001518152602001876020015181526020018660000151600060028110610e3057fe5b602002015181526020018660000151600160028110610e4b57fe5b602002015181526020018660200151600060028110610e6657fe5b602002015181526020018660200151600160028110610e8157fe5b6020020151815260200185600001518152602001856020015181526020018460000151600060028110610eb057fe5b602002015181526020018460000151600160028110610ecb57fe5b602002015181526020018460200151600060028110610ee657fe5b602002015181526020018460200151600160028110610f0157fe5b60200201518152509050610f136110ea565b600060208260206018028560086107d05a03fa90508060008114610f3657610f38565bfe5b5080610fac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f70616972696e672d6f70636f64652d6661696c6564000000000000000000000081525060200191505060405180910390fd5b600082600060018110610fbb57fe5b60200201511415935050505098975050505050505050565b604051806101000160405280600890602082028036833780820191505090505090565b604051806040016040528060008152602001600081525090565b604051806040016040528061102361110c565b815260200161103061110c565b81525090565b6040518060a00160405280611049610ff6565b8152602001611056611010565b8152602001611063611010565b8152602001611070611010565b815260200161107d61112e565b81525090565b6040518060600160405280600390602082028036833780820191505090505090565b6040518060800160405280600490602082028036833780820191505090505090565b604051806103000160405280601890602082028036833780820191505090505090565b6040518060200160405280600190602082028036833780820191505090505090565b6040518060400160405280600290602082028036833780820191505090505090565b6040518061010001604052806008905b611146610ff6565b81526020019060019003908161113e579050509056fe76657269666965722d696e7075742d6774652d736e61726b2d7363616c61722d6669656c6476657269666965722d70726f6f662d656c656d656e742d6774652d7072696d652d71a2646970667358221220b4708046498caa287851f0e2857f4854aebd6d7839084fd323988cfafcefee8f64736f6c634300060c0033
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.