@ajna-finance/sdk
Version:
A typescript SDK that can be used to create Dapps in Ajna ecosystem.
96 lines (95 loc) • 4.34 kB
TypeScript
import { BigNumber, Signer } from 'ethers';
import { Address, ExecuteProposalParams, IGrantFund, ProposalParams, SignerOrProvider, WrappedTransaction } from '../types';
import { ContractBase } from './ContractBase';
import { DistributionPeriod } from './DistributionPeriod';
import { Proposal } from './Proposal';
/**
* Class used to iteract with grants fund contract.
*/
export declare class GrantFund extends ContractBase implements IGrantFund {
constructor(signerOrProvider: SignerOrProvider);
/**
* Get total token supply.
* @returns BigNumber
*/
getTotalSupply(): Promise<any>;
/**
* Delegates vote to the given delegatee.
* @param signer vote delegator
* @param delegatee address of the delegateee
* @returns promise to transaction
*/
delegateVote(signer: Signer, delegatee: Address): Promise<WrappedTransaction>;
/**
* Get the address account is currently delegating to.
* @param address delegator
* @returns address
*/
getDelegates(address: Address): Promise<any>;
/**
* Starts a new distribution period, ensuring the treasury is funded.
* @param signer transaction signer
* @returns promise to transaction
*/
startNewDistributionPeriod(signer: Signer): Promise<WrappedTransaction>;
/**
* Gets the current treasury balance.
* @returns BigNumber
*/
getTreasury(): Promise<BigNumber>;
/**
* Gets details of the distribution period.
* @param signer caller
* @param distributionId id of the distrituion period
* @returns DistributionPeriod
*/
getDistributionPeriod(distributionId: number): Promise<DistributionPeriod>;
/**
* Gets details of the currently active distribution period.
* @param signer caller
* @returns DistributionPeriod
*/
getActiveDistributionPeriod(): Promise<DistributionPeriod | undefined>;
/**
* Creates a proposal in the current distribution period.
* @param signer caller
* @param params ProposalParams object
* @returns promise to transaction
*/
createProposal(signer: Signer, params: ProposalParams): Promise<WrappedTransaction>;
/**
* Gets a proposal object with the given proposalId.
* @param proposalId BigNumber
* @returns Proposal object
*/
getProposal(proposalId: BigNumber): Proposal;
/**
* Distributes delegate reward based on delegatee Vote share.
* @param distributionId_ Id of distribution from which delegatee wants to claim their reward.
* @return rewardClaimed_ amount of reward claimed by delegatee.
*/
claimDelegateReward(signer: Signer, distributionId: number): Promise<WrappedTransaction>;
/**
* Retrieve the delegate reward accrued to a voter in a given distribution period.
* @param distributionId_ The distributionId to calculate rewards for.
* @param voter_ the address of the voter to calculate rewards for.
* @return rewards_ the rewards earned by the voter for voting in that distribution period.
*/
getDelegateReward(distributionId: number, voter: Address): Promise<BigNumber>;
/**
* Get the reward claim status of an account in a given distribution period.
* @param distributionId_ The distributionId of the distribution period to check.
* @param voter_ the address of the voter to check.
* @return rewards_ the reward claim status of the account in the distribution period.
*/
getHasClaimedRewards(distributionId: number, voter: Address): Promise<boolean>;
/**
* Execute a proposal that has been approved by the community. Only proposals in the finalized top slate slate at the end of the challenge period can be executed.
* @param targets_ list of contracts the proposal calldata will interact with. Should be the Ajna token contract for all proposals.
* @param values_ list of values to be sent with the proposal calldata. Should be 0 for all proposals.
* @param calldatas_ list of calldata to be executed. Should be the transfer() method.
* @param descriptionHash_ hash of proposal's description string.
* @return proposalId_ the id of the executed proposal.
*/
executeProposal(signer: Signer, { params, description }: ExecuteProposalParams): Promise<WrappedTransaction>;
}