MATIC Price: $0.554954 (-4.40%)
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
0x60806040396127232023-02-23 6:37:01487 days ago1677134221IN
 Create: DelegatedDepositVerifier
0 MATIC0.1157881155

Parent Transaction Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DelegatedDepositVerifier

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 1 : DelegatedDepositVerifier.sol
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;
        input[0] = p1.X;
        input[1] = p1.Y;
        input[2] = p2.X;
        input[3] = 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.scalar_mul(1) and p.plus(p) == p.scalar_mul(2) for all
        *         points p.
        */
    function scalar_mul(G1Point memory p, uint256 s) internal view returns (G1Point memory r) {
        uint256[3] memory input;
        input[0] = p.X;
        input[1] = p.Y;
        input[2] = 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)
    {
        G1Point[4] memory p1 = [a1, b1, c1, d1];
        G2Point[4] memory p2 = [a2, b2, c2, d2];
        uint256 inputSize = 24;
        uint256[] memory input = new uint256[](inputSize);
        for (uint256 i = 0; i < 4; i++) {
            uint256 j = i * 6;
            input[j + 0] = p1[i].X;
            input[j + 1] = p1[i].Y;
            input[j + 2] = p2[i].X[0];
            input[j + 3] = p2[i].X[1];
            input[j + 4] = p2[i].Y[0];
            input[j + 5] = p2[i].Y[1];
        }
        uint256[1] memory out;
        bool success;
        // solium-disable-next-line security/no-inline-assembly
        assembly {
            success := staticcall(sub(gas(), 2000), 8, add(input, 0x20), mul(inputSize, 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 DelegatedDepositVerifier {
    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[2] IC;
    }

    struct Proof {
        Pairing.G1Point A;
        Pairing.G2Point B;
        Pairing.G1Point C;
    }

    function verifyingKey() internal pure returns (VerifyingKey memory vk) {
        vk.alfa1 = Pairing.G1Point(
            17259644642628619054198707088350178151915223546531204588599012585652862256289,
            6538916430504110934790598121254623711490867458521598147771684120236145100336
        );
        vk.beta2 = Pairing.G2Point(
            [
                uint256(11097434194162826858949644387544008701579694224939913271486290330733219134420),
                6010942275679443033856179065724641913553695310529001864983746063540149145812
            ],
            [
                uint256(19013261012401115818773510381885163557486260979365651129010452890236255493703),
                11314427763437581543307480788475949801872673194176472756000669236569465847384
            ]
        );
        vk.gamma2 = Pairing.G2Point(
            [
                uint256(11559732032986387107991004021392285783925812861821192530917403151452391805634),
                10857046999023057135944570762232829481370756359578518086990519993285655852781
            ],
            [
                uint256(4082367875863433681332203403145435568316851327593401208105741076214120093531),
                8495653923123431417604973247489272438418190587263600148770280649306958101930
            ]
        );
        vk.delta2 = Pairing.G2Point(
            [
                uint256(20596197302949557031748141567210475715798309559907780390700134984983115559882),
                6795827289834521192889336350792389794278131678535599693412737786082509196184
            ],
            [
                uint256(3071278453481481257048265274358991193050415115356277470484499946741596250004),
                16109431524735432543047461545716878470963649282388841345319798473820817732173
            ]
        );
        vk.IC[0] = Pairing.G1Point(
            1732346966736414682335973520537427550453872191417067078510232494543657625006,
            4138706833950901884151067237468888705428046952150216875166629634771468487738
        );
        vk.IC[1] = Pairing.G1Point(
            17488876820116126816206205578152651059932298944081349925912822909010163384020,
            374568260659821853315155015539102651528191411147754035047285225143131926571
        );
    }

    /*
        * @returns Whether the proof is valid given the hardcoded verifying key
        *          above and the public inputs
        */
    function verifyProof(uint256[1] memory input, uint256[8] memory p) public view returns (bool) {
        // Make sure that each element in the proof is less than the prime q
        for (uint8 i = 0; i < p.length; i++) {
            require(p[i] < PRIME_Q, "verifier-proof-element-gte-prime-q");
        }
        Proof memory _proof;
        _proof.A = Pairing.G1Point(p[0], p[1]);
        _proof.B = Pairing.G2Point([p[3], p[2]], [p[5], p[4]]);
        _proof.C = Pairing.G1Point(p[6], p[7]);
        VerifyingKey memory vk = verifyingKey();
        // Compute the linear combination vk_x
        Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
        vk_x = Pairing.plus(vk_x, vk.IC[0]);
        // Make sure that every input is less than the snark scalar field
        for (uint256 i = 0; i < input.length; i++) {
            require(input[i] < SNARK_SCALAR_FIELD, "verifier-gte-snark-scalar-field");
            vk_x = Pairing.plus(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
        }
        return Pairing.pairing(
            Pairing.negate(_proof.A), _proof.B, vk.alfa1, vk.beta2, vk_x, vk.gamma2, _proof.C, vk.delta2
        );
    }
}

Settings
{
  "remappings": [
    "@base58-solidity/=lib/base58-solidity/contracts/",
    "@gnosis/=lib/@gnosis/",
    "@gnosis/auction/=lib/@gnosis/auction/contracts/",
    "@openzeppelin/=lib/@openzeppelin/contracts/",
    "@openzeppelin/contracts/=lib/@openzeppelin/contracts/contracts/",
    "@uniswap/=lib/@uniswap/",
    "base58-solidity/=lib/base58-solidity/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "istanbul",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256[1]","name":"input","type":"uint256[1]"},{"internalType":"uint256[8]","name":"p","type":"uint256[8]"}],"name":"verifyProof","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50610c8a806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80633cac775b14610030575b600080fd5b6100b0600480360361012081101561004757600080fd5b81019080806020019060018060200260405190810160405280929190826001602002808284376000920191909152505060408051610100818101909252929594938181019392509060089083908390808284376000920191909152509194506100c49350505050565b604080519115158252519081900360200190f35b6000805b60088160ff16101561014d577f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47838260ff166008811061010457fe5b6020020151106101455760405162461bcd60e51b8152600401808060200182810382526022815260200180610c336022913960400191505060405180910390fd5b6001016100c8565b50610156610a80565b6040805180820182528451815260208086015181830152908352815160808082018452606080880151838601908152888601519184019190915282528351808501855260a08801518152908701518184015281830152838201528151808301835260c0860151815260e086015191810191909152908201526101d6610ab2565b6101de610335565b90506101e8610af9565b6040518060400160405280600081526020016000815250905061022081836080015160006002811061021657fe5b6020020151610655565b905060005b60018110156102f6577f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000187826001811061025b57fe5b6020020151106102b2576040805162461bcd60e51b815260206004820152601f60248201527f76657269666965722d6774652d736e61726b2d7363616c61722d6669656c6400604482015290519081900360640190fd5b6102ec826102e7856080015184600101600281106102cc57fe5b60200201518a85600181106102dd57fe5b60200201516106f5565b610655565b9150600101610225565b5061032b610307846000015161077b565b84602001518460000151856020015185876040015189604001518960600151610822565b9695505050505050565b61033d610ab2565b6040805180820182527f26289cd8abd1fa2a98d463c99b2c27f4d93fc00e39380d234ac13221ae9b04a181527f0e74e5426db6b07b4c5fdeb9c845cd7ad268e017ec852d569c7b7889a121c6306020808301919091529083528151608080820184527f1888ecd7b2c8cfeb687ad2a234c85b829156a830e7ec17e8f8fa3670191fbbd48285019081527f0d4a12a09a90d343c5bf278dac62a5bbdfd23e79600f9199470e1d25e871d0d4606080850191909152908352845180860186527f2a091fd6eb117e394f56d1728002cbc2ac0d80b181a4c765df0e6df8e1c85e4781527f1903bd3a843a21c30f289c0c16840b09d059bf7c46298c59d3e3f14182367e58818601528385015285840192909252835180820185527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28186019081527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed828501528152845180860186527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa818601528185015285850152835180820185527f2d8908d92b315981ec1b1f4f82ed1ae98bc3e2ffd6acb77e3249b793a1cd73ca8186019081527f0f064d4bd31b5e3ffa76319b5ca15b8eeca24df69e8a92275a553e7d93400b98828501528152845180860186527f06ca48314d2033c458731aedd5fbf858433ac36246a49cfef288cabb6b455f9481527f239d9d78f4cdca58a694f9d9e698128afe58479e25aa6eec43d3aec64886324d818601528185015291850191909152825180840184527f03d479403dce9f8ffdefb0933c03324fc9b25bafe5bb03238f1e444c57e5e5ae81527f09266cd0719eadc6b0d50e308d3cd35e73949d8b39a20d84074501a55b550c3a8184015290840180519190915282518084019093527f26aa5a7eb2a92feee7afe36c0013a1538c11ac568b9549857e3061c622a1bed483527ed3ff84f681ba959fdc3bfeebb214d4763d3e32e49c5b2c39017ab2fe9f702b8383015251015290565b61065d610af9565b610665610b13565b8351815260208085015181830152835160408301528301516060808301919091526000908360c08460066107d05a03fa90508080156106a3576106a5565bfe5b50806106ed576040805162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5859190b59985a5b195960721b604482015290519081900360640190fd5b505092915050565b6106fd610af9565b610705610b31565b835181526020808501519082015260408101839052600060608360808460076107d05a03fa90508080156106a35750806106ed576040805162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5b5d5b0b59985a5b195960721b604482015290519081900360640190fd5b610783610af9565b815115801561079457506020820151155b156107b35750604080518082019091526000808252602082015261081d565b6040518060400160405280836000015181526020017f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478460200151816107f557fe5b067f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703905290505b919050565b600061082c610b4f565b60405180608001604052808b8152602001898152602001878152602001858152509050610857610b7c565b50604080516080810182528a81526020810189905280820187905260608082018690528251601880825261032082019094529192918281602001602082028036833701905050905060005b60048110156109f957600681028582600481106108bb57fe5b60200201515183518490839081106108cf57fe5b6020026020010181815250508582600481106108e757fe5b6020020151602001518382600101815181106108ff57fe5b60200260200101818152505084826004811061091757fe5b60200201515151835184906002840190811061092f57fe5b60200260200101818152505084826004811061094757fe5b6020020151516001602002015183826003018151811061096357fe5b60200260200101818152505084826004811061097b57fe5b60200201516020015160006002811061099057fe5b60200201518382600401815181106109a457fe5b6020026020010181815250508482600481106109bc57fe5b6020020151602001516001600281106109d157fe5b60200201518382600501815181106109e557fe5b6020908102919091010152506001016108a2565b50610a02610ba9565b6000602082602086026020860160086107d05a03fa90508080156106a3575080610a6b576040805162461bcd60e51b81526020600482015260156024820152741c185a5c9a5b99cb5bdc18dbd9194b59985a5b1959605a1b604482015290519081900360640190fd5b505115159d9c50505050505050505050505050565b6040518060600160405280610a93610af9565b8152602001610aa0610bc7565b8152602001610aad610af9565b905290565b6040518060a00160405280610ac5610af9565b8152602001610ad2610bc7565b8152602001610adf610bc7565b8152602001610aec610bc7565b8152602001610aad610be7565b604051806040016040528060008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180608001604052806004905b610b66610af9565b815260200190600190039081610b5e5790505090565b60405180608001604052806004905b610b93610bc7565b815260200190600190039081610b8b5790505090565b60405180602001604052806001906020820280368337509192915050565b6040518060400160405280610bda610c14565b8152602001610aad610c14565b60405180604001604052806002905b610bfe610af9565b815260200190600190039081610bf65790505090565b6040518060400160405280600290602082028036833750919291505056fe76657269666965722d70726f6f662d656c656d656e742d6774652d7072696d652d71a26469706673582212200a80d9b406347e8536430ec981efba54e311686f105db5b818fbee62cd646dae64736f6c634300060c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80633cac775b14610030575b600080fd5b6100b0600480360361012081101561004757600080fd5b81019080806020019060018060200260405190810160405280929190826001602002808284376000920191909152505060408051610100818101909252929594938181019392509060089083908390808284376000920191909152509194506100c49350505050565b604080519115158252519081900360200190f35b6000805b60088160ff16101561014d577f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47838260ff166008811061010457fe5b6020020151106101455760405162461bcd60e51b8152600401808060200182810382526022815260200180610c336022913960400191505060405180910390fd5b6001016100c8565b50610156610a80565b6040805180820182528451815260208086015181830152908352815160808082018452606080880151838601908152888601519184019190915282528351808501855260a08801518152908701518184015281830152838201528151808301835260c0860151815260e086015191810191909152908201526101d6610ab2565b6101de610335565b90506101e8610af9565b6040518060400160405280600081526020016000815250905061022081836080015160006002811061021657fe5b6020020151610655565b905060005b60018110156102f6577f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000187826001811061025b57fe5b6020020151106102b2576040805162461bcd60e51b815260206004820152601f60248201527f76657269666965722d6774652d736e61726b2d7363616c61722d6669656c6400604482015290519081900360640190fd5b6102ec826102e7856080015184600101600281106102cc57fe5b60200201518a85600181106102dd57fe5b60200201516106f5565b610655565b9150600101610225565b5061032b610307846000015161077b565b84602001518460000151856020015185876040015189604001518960600151610822565b9695505050505050565b61033d610ab2565b6040805180820182527f26289cd8abd1fa2a98d463c99b2c27f4d93fc00e39380d234ac13221ae9b04a181527f0e74e5426db6b07b4c5fdeb9c845cd7ad268e017ec852d569c7b7889a121c6306020808301919091529083528151608080820184527f1888ecd7b2c8cfeb687ad2a234c85b829156a830e7ec17e8f8fa3670191fbbd48285019081527f0d4a12a09a90d343c5bf278dac62a5bbdfd23e79600f9199470e1d25e871d0d4606080850191909152908352845180860186527f2a091fd6eb117e394f56d1728002cbc2ac0d80b181a4c765df0e6df8e1c85e4781527f1903bd3a843a21c30f289c0c16840b09d059bf7c46298c59d3e3f14182367e58818601528385015285840192909252835180820185527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28186019081527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed828501528152845180860186527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa818601528185015285850152835180820185527f2d8908d92b315981ec1b1f4f82ed1ae98bc3e2ffd6acb77e3249b793a1cd73ca8186019081527f0f064d4bd31b5e3ffa76319b5ca15b8eeca24df69e8a92275a553e7d93400b98828501528152845180860186527f06ca48314d2033c458731aedd5fbf858433ac36246a49cfef288cabb6b455f9481527f239d9d78f4cdca58a694f9d9e698128afe58479e25aa6eec43d3aec64886324d818601528185015291850191909152825180840184527f03d479403dce9f8ffdefb0933c03324fc9b25bafe5bb03238f1e444c57e5e5ae81527f09266cd0719eadc6b0d50e308d3cd35e73949d8b39a20d84074501a55b550c3a8184015290840180519190915282518084019093527f26aa5a7eb2a92feee7afe36c0013a1538c11ac568b9549857e3061c622a1bed483527ed3ff84f681ba959fdc3bfeebb214d4763d3e32e49c5b2c39017ab2fe9f702b8383015251015290565b61065d610af9565b610665610b13565b8351815260208085015181830152835160408301528301516060808301919091526000908360c08460066107d05a03fa90508080156106a3576106a5565bfe5b50806106ed576040805162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5859190b59985a5b195960721b604482015290519081900360640190fd5b505092915050565b6106fd610af9565b610705610b31565b835181526020808501519082015260408101839052600060608360808460076107d05a03fa90508080156106a35750806106ed576040805162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5b5d5b0b59985a5b195960721b604482015290519081900360640190fd5b610783610af9565b815115801561079457506020820151155b156107b35750604080518082019091526000808252602082015261081d565b6040518060400160405280836000015181526020017f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478460200151816107f557fe5b067f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703905290505b919050565b600061082c610b4f565b60405180608001604052808b8152602001898152602001878152602001858152509050610857610b7c565b50604080516080810182528a81526020810189905280820187905260608082018690528251601880825261032082019094529192918281602001602082028036833701905050905060005b60048110156109f957600681028582600481106108bb57fe5b60200201515183518490839081106108cf57fe5b6020026020010181815250508582600481106108e757fe5b6020020151602001518382600101815181106108ff57fe5b60200260200101818152505084826004811061091757fe5b60200201515151835184906002840190811061092f57fe5b60200260200101818152505084826004811061094757fe5b6020020151516001602002015183826003018151811061096357fe5b60200260200101818152505084826004811061097b57fe5b60200201516020015160006002811061099057fe5b60200201518382600401815181106109a457fe5b6020026020010181815250508482600481106109bc57fe5b6020020151602001516001600281106109d157fe5b60200201518382600501815181106109e557fe5b6020908102919091010152506001016108a2565b50610a02610ba9565b6000602082602086026020860160086107d05a03fa90508080156106a3575080610a6b576040805162461bcd60e51b81526020600482015260156024820152741c185a5c9a5b99cb5bdc18dbd9194b59985a5b1959605a1b604482015290519081900360640190fd5b505115159d9c50505050505050505050505050565b6040518060600160405280610a93610af9565b8152602001610aa0610bc7565b8152602001610aad610af9565b905290565b6040518060a00160405280610ac5610af9565b8152602001610ad2610bc7565b8152602001610adf610bc7565b8152602001610aec610bc7565b8152602001610aad610be7565b604051806040016040528060008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180608001604052806004905b610b66610af9565b815260200190600190039081610b5e5790505090565b60405180608001604052806004905b610b93610bc7565b815260200190600190039081610b8b5790505090565b60405180602001604052806001906020820280368337509192915050565b6040518060400160405280610bda610c14565b8152602001610aad610c14565b60405180604001604052806002905b610bfe610af9565b815260200190600190039081610bf65790505090565b6040518060400160405280600290602082028036833750919291505056fe76657269666965722d70726f6f662d656c656d656e742d6774652d7072696d652d71a26469706673582212200a80d9b406347e8536430ec981efba54e311686f105db5b818fbee62cd646dae64736f6c634300060c0033

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.