import { ContractLoader, Executor, Logger, LoggerOptions } from '@evan.network/dbcp';
import { NameResolver } from '../name-resolver';
/**
 * info about a member of the voting contract
 */
export interface MemberInfo {
    /**
     * accountId of member
     */
    address: string;
    /**
     * description text of member
     */
    name: string;
    /**
     * date of joining votings contract
     */
    memberSince: string;
}
/**
 * options for membership on voting contract
 */
export interface MemberOptions {
    /**
     * description text for member
     */
    name: string;
}
/**
 * details about a proposal
 */
export interface ProposalInfo {
    /**
     * current number of positive votes
     */
    currentResult: number;
    /**
     * description text
     */
    description: string;
    /**
     * true if already executed
     */
    executed: boolean;
    /**
     * earliest day of execution
     */
    minExecutionDate: number;
    /**
     * number of submitted votes
     */
    numberOfVotes: number;
    /**
     * checksum of proposal: keccak256(beneficiary, weiAmount, transactionBytecode)
     */
    proposalHash: string;
    /**
     * true if executed and proposal passed
     */
    proposalPassed: boolean;
    /**
     * target of proposal (contract/account to send transaction to)
     */
    to: string;
    /**
     * amount of Wei to send to target
     */
    value: string;
}
/**
 * result set for paging through proposals
 */
export interface ProposalInfos {
    /**
     * proposals of current page (length is 10)
     */
    results: ProposalInfo[];
    /**
     * total number of results
     */
    totalCount: number;
}
/**
 * options for creating a proposal
 */
export interface ProposalOptions {
    /**
     * description text
     */
    description: string;
    /**
     * input data for proposal (defaults to '0x' if omitted)
     */
    data?: string;
    /**
     * target of proposal (contract/account to send transaction to)
     */
    to?: string;
    /**
     * amount of Wei to send to target
     */
    value?: string;
}
/**
 * options for creating a new voting contract
 */
export interface VotingsContractOptions {
    /**
     * votes that must have been given before any proposal is accepted; updates to this may affect
     * running proposals
     */
    minimumQuorumForProposals: number;
    /**
     * time to have passed before a proposal can be accepted; updates to this do not affect running
     * proposals
     */
    minutesForDebate: number;
    /**
     * accepting votes that must have been given before any proposal is accepted; updates to this may
     * affect running proposals
     */
    marginOfVotesForMajority: number;
}
/**
 * options for votings library
 */
export interface VotingsOptions extends LoggerOptions {
    contractLoader: ContractLoader;
    executor: Executor;
    nameResolver: NameResolver;
}
/**
 * Votings helper
 *
 * @class      Votings (name)
 */
export declare class Votings extends Logger {
    options: VotingsOptions;
    /**
     * create new Votings instance.
     */
    constructor(options: VotingsOptions);
    /**
     * add member to voting contract
     *
     * @param      {string|any}     contract       web3 voting contract instance or contract address
     * @param      {string}         accountId      account that performs the action
     * @param      {string}         targetAccount  account to add to votings contract
     * @param      {MemberOptions}  memberOptions  options for new member
     * @return     {Promise<void>}  resolved when done
     */
    addMember(contract: string | any, accountId: string, targetAccount: string, memberOptions: MemberOptions): Promise<void>;
    /**
     * create new voting contract instance
     *
     * @param      {string}                  accountId               account that performs the action
     * @param      {VotingsContractOptions}  votingsContractOptions  additional options for voting
     *                                                               contract
     * @return     {Promise<any>}            votings contract web3 instance
     */
    createContract(accountId: string, votingsContractOptions: VotingsContractOptions): Promise<any>;
    /**
     * create a new proposal in votings contract
     *
     * @param      {string|any}       contract         web3 voting contract instance or contract
     *                                                 address
     * @param      {string}           accountId        account that performs the action
     * @param      {ProposalOptions}  proposalOptions  options for new proposal
     * @return     {Promise<string>}  id of new proposal
     */
    createProposal(contract: string | any, accountId: string, proposalOptions: ProposalOptions): Promise<string>;
    /**
     * execute a proposal
     *
     * @param      {string|any}     contract   web3 voting contract instance or contract address
     * @param      {string}         accountId  account that performs the action
     * @param      {string|number}  proposal   id of proposal
     * @param      {string}         data       (optional) transaction input bytes as string
     *                                         (`0x${functionhash}${argumentsData}`)
     * @return     {Promise<void>}  resolved when done
     */
    execute(contract: string | any, accountId: string, proposal: string | number, data?: string): Promise<any>;
    /**
     * get info of a member
     *
     * @param      {string|any}           contract       web3 voting contract instance or contract
     *                                                   address
     * @param      {string}               targetAccount  account to get info for
     * @return     {Promise<MemberInfo>}  info about member
     */
    getMemberInfo(contract: string | any, targetAccount: string): Promise<MemberInfo>;
    /**
     * get number of proposals in votings contract
     *
     * @param      {string|any}       contract  web3 voting contract instance or contract address
     * @return     {Promise<number>}  number of proposals
     */
    getProposalCount(contract: string | any): Promise<number>;
    /**
     * gets info about a given proposal in contract
     *
     * @param      {string|any}             contract  web3 voting contract instance or contract
     *                                                address
     * @param      {string|number}          proposal  id of proposal
     * @return     {Promise<ProposalInfo>}  info about proposal
     */
    getProposalInfo(contract: string | any, proposal: string): Promise<ProposalInfo>;
    /**
     * get multiple proposals from votings contract
     *
     * @param      {string|any}              contract  web3 voting contract instance or
     *                                                 contractaddress
     * @param      {number}                  count     number of items to retrieve
     * @param      {number}                  offset    skip this many entries
     * @param      {boolean}                 reverse   fetch entries, starting with last entry
     * @return     {Promise<ProposalInfos>}  proposals listing
     */
    getProposalInfos(contract: string | any, count?: number, offset?: number, reverse?: boolean): Promise<ProposalInfos>;
    /**
     * checks if a given account is member in voting contract
     *
     * @param      {string|any}        contract       web3 voting contract instance or contract address
     * @param      {string}            targetAccount  account to check
     * @return     {Promise<boolean>}  true if member, false otherwise.
     */
    isMember(contract: string | any, targetAccount: string): Promise<any>;
    /**
     * remove member from votings contract
     *
     * @param      {string|any}  contract       web3 voting contract instance or contract address
     * @param      {string}      accountId      account that performs the action
     * @param      {string}      targetAccount  account to remove from votings contract
     * @return     {Promise<void>}   resolved when done
     */
    removeMember(contract: string | any, accountId: string, targetAccount: string): Promise<void>;
    /**
     * vote for a proposal
     *
     * @param      {string|any}     contract   web3 voting contract instance or contract address
     * @param      {string}         accountId  account that performs the action
     * @param      {string|number}  proposal   id of proposal
     * @param      {boolean}        accept     true if accepting proposal
     * @param      {string}         comment    (optional) comment for vote
     * @return     {Promise<void>}  resolved when done
     */
    vote(contract: string | any, accountId: string, proposal: string, accept: boolean, comment?: string): Promise<void>;
    /**
     * check if given argument is a contract instance, load contract if not
     *
     * @param      {string|any}  contract  web3 voting contract instance or contract address
     * @return     {any}         contract instance
     */
    private ensureContract(contract);
}
