"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tally__factory = void 0;
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
const ethers_1 = require("ethers");
const _abi = [
    {
        inputs: [],
        name: "AllBallotsTallied",
        type: "error",
    },
    {
        inputs: [],
        name: "AlreadyInitialized",
        type: "error",
    },
    {
        inputs: [],
        name: "BatchStartIndexTooLarge",
        type: "error",
    },
    {
        inputs: [],
        name: "IncorrectSpentVoiceCredits",
        type: "error",
    },
    {
        inputs: [],
        name: "InvalidTallyVotesProof",
        type: "error",
    },
    {
        inputs: [],
        name: "NotSupported",
        type: "error",
    },
    {
        inputs: [],
        name: "ProcessingNotComplete",
        type: "error",
    },
    {
        inputs: [],
        name: "TallyBatchSizeTooLarge",
        type: "error",
    },
    {
        inputs: [],
        name: "VotesNotTallied",
        type: "error",
    },
    {
        inputs: [],
        name: "totalSignupsTooLarge",
        type: "error",
    },
    {
        inputs: [],
        name: "MESSAGE_DATA_LENGTH",
        outputs: [
            {
                internalType: "uint8",
                name: "",
                type: "uint8",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                components: [
                    {
                        internalType: "uint256[]",
                        name: "voteOptionIndices",
                        type: "uint256[]",
                    },
                    {
                        internalType: "uint256[]",
                        name: "tallyResults",
                        type: "uint256[]",
                    },
                    {
                        internalType: "uint256[][][]",
                        name: "tallyResultProofs",
                        type: "uint256[][][]",
                    },
                    {
                        internalType: "uint256",
                        name: "totalSpent",
                        type: "uint256",
                    },
                    {
                        internalType: "uint256",
                        name: "totalSpentSalt",
                        type: "uint256",
                    },
                    {
                        internalType: "uint256",
                        name: "tallyResultSalt",
                        type: "uint256",
                    },
                    {
                        internalType: "uint256",
                        name: "newResultsCommitment",
                        type: "uint256",
                    },
                    {
                        internalType: "uint256",
                        name: "spentVoiceCreditsHash",
                        type: "uint256",
                    },
                    {
                        internalType: "uint256",
                        name: "perVOSpentVoiceCreditsHash",
                        type: "uint256",
                    },
                ],
                internalType: "struct ITally.AddTallyResultsArgs",
                name: "args",
                type: "tuple",
            },
        ],
        name: "addTallyResults",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [],
        name: "getAppendedBytes",
        outputs: [
            {
                internalType: "bytes",
                name: "appendedBytes",
                type: "bytes",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256",
                name: "_batchStartIndex",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "_newTallyCommitment",
                type: "uint256",
            },
        ],
        name: "getPublicCircuitInputs",
        outputs: [
            {
                internalType: "uint256[]",
                name: "publicInputs",
                type: "uint256[]",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256",
                name: "index",
                type: "uint256",
            },
        ],
        name: "getTallyResults",
        outputs: [
            {
                components: [
                    {
                        internalType: "uint256",
                        name: "value",
                        type: "uint256",
                    },
                    {
                        internalType: "bool",
                        name: "isSet",
                        type: "bool",
                    },
                ],
                internalType: "struct ITally.TallyResult",
                name: "",
                type: "tuple",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256[2]",
                name: "array",
                type: "uint256[2]",
            },
        ],
        name: "hash2",
        outputs: [
            {
                internalType: "uint256",
                name: "result",
                type: "uint256",
            },
        ],
        stateMutability: "pure",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256[3]",
                name: "array",
                type: "uint256[3]",
            },
        ],
        name: "hash3",
        outputs: [
            {
                internalType: "uint256",
                name: "result",
                type: "uint256",
            },
        ],
        stateMutability: "pure",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256[4]",
                name: "array",
                type: "uint256[4]",
            },
        ],
        name: "hash4",
        outputs: [
            {
                internalType: "uint256",
                name: "result",
                type: "uint256",
            },
        ],
        stateMutability: "pure",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256[5]",
                name: "array",
                type: "uint256[5]",
            },
        ],
        name: "hash5",
        outputs: [
            {
                internalType: "uint256",
                name: "result",
                type: "uint256",
            },
        ],
        stateMutability: "pure",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256",
                name: "left",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "right",
                type: "uint256",
            },
        ],
        name: "hashLeftRight",
        outputs: [
            {
                internalType: "uint256",
                name: "result",
                type: "uint256",
            },
        ],
        stateMutability: "pure",
        type: "function",
    },
    {
        inputs: [],
        name: "initialize",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [],
        name: "initialized",
        outputs: [
            {
                internalType: "bool",
                name: "",
                type: "bool",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "isTallied",
        outputs: [
            {
                internalType: "bool",
                name: "tallied",
                type: "bool",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "messageProcessor",
        outputs: [
            {
                internalType: "contract IMessageProcessor",
                name: "",
                type: "address",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "mode",
        outputs: [
            {
                internalType: "enum DomainObjs.Mode",
                name: "",
                type: "uint8",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "poll",
        outputs: [
            {
                internalType: "contract IPoll",
                name: "",
                type: "address",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "sbCommitment",
        outputs: [
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256[]",
                name: "array",
                type: "uint256[]",
            },
        ],
        name: "sha256Hash",
        outputs: [
            {
                internalType: "uint256",
                name: "result",
                type: "uint256",
            },
        ],
        stateMutability: "pure",
        type: "function",
    },
    {
        inputs: [],
        name: "tallyBatchNum",
        outputs: [
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "tallyCommitment",
        outputs: [
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256",
                name: "_newTallyCommitment",
                type: "uint256",
            },
            {
                internalType: "uint256[8]",
                name: "_proof",
                type: "uint256[8]",
            },
        ],
        name: "tallyVotes",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [],
        name: "totalSpent",
        outputs: [
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "totalTallyResults",
        outputs: [
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "updateSbCommitment",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [],
        name: "verifier",
        outputs: [
            {
                internalType: "contract IVerifier",
                name: "",
                type: "address",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256",
                name: "_voteOptionIndex",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "_spent",
                type: "uint256",
            },
            {
                internalType: "uint256[][]",
                name: "_spentProof",
                type: "uint256[][]",
            },
            {
                internalType: "uint256",
                name: "_spentSalt",
                type: "uint256",
            },
            {
                internalType: "uint8",
                name: "_voteOptionTreeDepth",
                type: "uint8",
            },
            {
                internalType: "uint256",
                name: "_spentVoiceCreditsHash",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "_resultCommitment",
                type: "uint256",
            },
        ],
        name: "verifyPerVoteOptionSpentVoiceCredits",
        outputs: [
            {
                internalType: "bool",
                name: "isValid",
                type: "bool",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256",
                name: "_totalSpent",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "_totalSpentSalt",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "_resultCommitment",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "_perVoteOptionSpentVoiceCreditsHash",
                type: "uint256",
            },
        ],
        name: "verifySpentVoiceCredits",
        outputs: [
            {
                internalType: "bool",
                name: "isValid",
                type: "bool",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256",
                name: "_batchStartIndex",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "_newTallyCommitment",
                type: "uint256",
            },
            {
                internalType: "uint256[8]",
                name: "_proof",
                type: "uint256[8]",
            },
        ],
        name: "verifyTallyProof",
        outputs: [
            {
                internalType: "bool",
                name: "isValid",
                type: "bool",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256",
                name: "_voteOptionIndex",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "_tallyResult",
                type: "uint256",
            },
            {
                internalType: "uint256[][]",
                name: "_tallyResultProof",
                type: "uint256[][]",
            },
            {
                internalType: "uint256",
                name: "_tallyResultSalt",
                type: "uint256",
            },
            {
                internalType: "uint8",
                name: "_voteOptionTreeDepth",
                type: "uint8",
            },
            {
                internalType: "uint256",
                name: "_spentVoiceCreditsHash",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "_perVoteOptionSpentVoiceCreditsHash",
                type: "uint256",
            },
        ],
        name: "verifyTallyResult",
        outputs: [
            {
                internalType: "bool",
                name: "isValid",
                type: "bool",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "verifyingKeysRegistry",
        outputs: [
            {
                internalType: "contract IVerifyingKeysRegistry",
                name: "",
                type: "address",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
];
const _bytecode = " $ce9c2c925f157047e54fa833ec4e61409f$__9063248f6677906109ae908590600401611d1b565b602060405180830381865af41580156109cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ef9190611b92565b92915050565b60007f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001600283604051602001610a2b9190611d4c565b60408051601f1981840301815290829052610a4591611d82565b602060405180830381855afa158015610a62573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610a859190611b92565b6109ef9190611db4565b6000610a9961158a565b838152602081018390526106db815b6040516314d2f97b60e11b815260009073__$6574937f64fc1d7710ec0e28b7a36713bb$__906329a5f2f6906109ae908590600401611dc8565b6107fc6113c7565b604051630926f44b60e31b815260009073__$20527677031d76601747626a9845039fe4$__90634937a258906109ae908590600401611df0565b600080610b34858b8b8b8b61122c565b90506000600754600160a01b900460ff166002811115610b5657610b5661178a565b03610b9257610b6361156c565b610b6d8288610a8f565b81526020810185905260408101849052600154610b8982610eaf565b14925050610c07565b6001600754600160a01b900460ff166002811115610bb257610bb261178a565b1480610bdb57506002600754600160a01b900460ff166002811115610bd957610bd961178a565b145b15610c0757610be861158a565b610bf28288610a8f565b8152602081018590526001546104f882610aa8565b5098975050505050505050565b6060610c1e611480565b905090565b6000806000600660009054906101000a90046001600160a01b03166001600160a01b031663ac98e5df6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610c7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9f9190611bab565b50915091506000610cb08787610508565b90506000600660009054906101000a90046001600160a01b03166001600160a01b0316638b6e74636040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2b9190611e2d565b90506000600560009054906101000a90046001600160a01b03166001600160a01b031663f3350299836001600160a01b031663652c76e46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db59190611e4a565b60075460405160e084901b6001600160e01b0319168152610de892918a918a91600160a01b900460ff1690600401611e67565b600060405180830381865afa158015610e05573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e2d9190810190611f4f565b6004805460405163352a4d1560e01b81529293506001600160a01b03169163352a4d1591610e61918b9186918991016120bd565b602060405180830381865afa158015610e7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea29190611b70565b9998505050505050505050565b6040516304b98e1d60e31b815260009073__$dc01a9744591ab014bc46a3b7671cdaefb$ ";
const isSuperArgs = (xs) => {
    return (typeof xs[0] === "string" ||
        Array.isArray(xs[0]) ||
        "_isInterface" in xs[0]);
};
class Tally__factory extends ethers_1.ContractFactory {
    constructor(...args) {
        if (isSuperArgs(args)) {
            super(...args);
        }
        else {
            const [linkLibraryAddresses, signer] = args;
            super(_abi, Tally__factory.linkBytecode(linkLibraryAddresses), signer);
        }
    }
    static linkBytecode(linkLibraryAddresses) {
        let linkedBytecode = _bytecode;
        linkedBytecode = linkedBytecode.replace(new RegExp("__\\$ce9c2c925f157047e54fa833ec4e61409f\\$__", "g"), linkLibraryAddresses["contracts/crypto/PoseidonT5.sol:PoseidonT5"]
            .replace(/^0x/, "")
            .toLowerCase());
        linkedBytecode = linkedBytecode.replace(new RegExp("__\\$6574937f64fc1d7710ec0e28b7a36713bb\\$__", "g"), linkLibraryAddresses["contracts/crypto/PoseidonT3.sol:PoseidonT3"]
            .replace(/^0x/, "")
            .toLowerCase());
        linkedBytecode = linkedBytecode.replace(new RegExp("__\\$20527677031d76601747626a9845039fe4\\$__", "g"), linkLibraryAddresses["contracts/crypto/PoseidonT6.sol:PoseidonT6"]
            .replace(/^0x/, "")
            .toLowerCase());
        linkedBytecode = linkedBytecode.replace(new RegExp("__\\$dc01a9744591ab014bc46a3b7671cdaefb\\$__", "g"), linkLibraryAddresses["contracts/crypto/PoseidonT4.sol:PoseidonT4"]
            .replace(/^0x/, "")
            .toLowerCase());
        return linkedBytecode;
    }
    getDeployTransaction(overrides) {
        return super.getDeployTransaction(overrides || {});
    }
    deploy(overrides) {
        return super.deploy(overrides || {});
    }
    connect(runner) {
        return super.connect(runner);
    }
    static createInterface() {
        return new ethers_1.Interface(_abi);
    }
    static connect(address, runner) {
        return new ethers_1.Contract(address, _abi, runner);
    }
}
exports.Tally__factory = Tally__factory;
Tally__factory.bytecode = _bytecode;
Tally__factory.abi = _abi;
//# sourceMappingURL=Tally__factory.js.map