UNPKG

@ajna-finance/sdk

Version:

A typescript SDK that can be used to create Dapps in Ajna ecosystem.

114 lines (113 loc) 5.51 kB
import { BigNumber, Signer } from 'ethers'; import { Address, DistributionPeriodStage, FormattedVoteParams, FundingVotes, IDistributionPeriod, SignerOrProvider, VoteParams, VoterInfo, WrappedTransaction } from '../types'; import { ContractBase } from './ContractBase'; /** * Class used to iteract with distribution periods. */ export declare class DistributionPeriod extends ContractBase implements IDistributionPeriod { id: number; isActive: boolean; startBlock: number; startDate: number; endBlock: number; endDate: number; fundsAvailable: BigNumber; votesCount: BigNumber; fundedSlateHash: string; constructor(signerOrProvider: SignerOrProvider, id: number, isActive: boolean, startBlock: number, startDate: number, endBlock: number, endDate: number, fundsAvailable: BigNumber, votesCount: BigNumber, fundedSlateHash: string); toString(): string; /** * Retrieve a bytes32 hash of the current distribution period stage. */ getStage(): Promise<string>; /** * Get current distribution period stage. * @returns string, distribution period stage */ distributionPeriodStage(): Promise<DistributionPeriodStage>; /** * Get the voter's voting power in the screening stage of a distribution period. * @param distributionId the distributionId of the distribution period to check * @param address the address of the voter to check * @returns the voter's voting power */ getScreeningVotingPower(address: Address): Promise<BigNumber>; /** * Get the remaining quadratic voting power available to the voter in the funding stage of a distribution period. * @param distributionId the distributionId of the distribution period to check * @param address the address of the voter to check * @returns the voter's remaining quadratic voting power */ getFundingVotingPower(address: Address): Promise<BigNumber>; /** * Get the voter's voting power based on current distribution period stage. * @param address the address of the voter to check * @returns the voter's voting power */ getVotingPower(address: Address): Promise<BigNumber>; /** * Get the current state of a given voter in the funding stage. * @param distributionId the distributionId of the distribution period to check. * @param address the address of the voter to check. * @return {@link VoterInfo} * voter's voting information. */ getVoterInfo(address: Address): Promise<VoterInfo>; /** * Get the number of screening votes cast by an account in a given distribution period. * @param distributionId The distributionId of the distribution period to check. * @param account The address of the voter to check. * @return The number of screening votes successfully cast the voter. */ getScreeningVotesCast(address: Address): Promise<BigNumber>; /** * Get the list of funding votes cast by an account in a given distribution period. * @param distributionId_ The distributionId of the distribution period to check. * @param account_ The address of the voter to check. * @return FundingVoteParams The list of FundingVoteParams structs that have been successfully cast the voter. */ getFundingVotesCast(address: Address): Promise<Array<FundingVotes>>; /** * Cast an array of screening votes in one transaction. * @param signer voter * @param {@link VoteParams} * the array of votes on proposals to cast. * @return promise to transaction */ screeningVote(signer: Signer, votes: Array<FormattedVoteParams>): Promise<WrappedTransaction>; /** * Cast an array of funding votes in one transaction. * @param signer voter * @param {@link VoteParams} * the array of votes on proposals to cast. * @return promise to transaction */ fundingVote(signer: Signer, votes: Array<FormattedVoteParams>): Promise<WrappedTransaction>; /** * Cast an array of screening or funding votes (based on current distribution period stage). * @param signer voter * @param {@link VoteParams} * the array of votes on proposals to cast. * @returns promise to transaction */ castVotes(signer: Signer, votes: Array<VoteParams>): Promise<WrappedTransaction>; /** * Get top ten proposals on funding stage. * @param distributionId the distributionId of the distribution period to check * @returns top ten proposals on funding stage */ getTopTenProposals(): Promise<Array<string>>; /** * Check if a slate of proposals meets requirements, and maximizes votes. If so, set the provided proposal slate as the new top slate of proposals. * @param proposals Array of proposals to check. * @returns promise to transaction */ updateSlate(signer: Signer, proposals: Array<string>): Promise<WrappedTransaction>; /** * Get the funded proposal slate for a given distributionId, and slate hash. * @returns The array of proposalIds that are in the funded slate hash. */ getFundedProposalSlate(): Promise<Array<string>>; /** * Get best proposals based on the combination of votes received and tokens requested over tokens available. * @param tokensAvailable treasury. * @returns proposals[] a new slate of proposals */ getOptimalProposals(proposalIds: Array<string>, tokensAvailable: BigNumber): Promise<Array<string>>; }