Skip to content

Tron freezing + governance data #1451

@tomasklim

Description

@tomasklim

For Ethereum-Everstake, endpoint getAccountInfo?detail=basic (and higher detail) is returning stakingPools?: StakingPool[];

export interface StakingPool {
    /** Staking pool contract address on-chain. */
    contract: string;
    /** Name of the staking pool contract. */
    name: string;
    /** Balance pending deposit or withdrawal, if any. */
    pendingBalance: string;
    /** Any pending deposit that is not yet finalized. */
    pendingDepositedBalance: string;
    /** Currently deposited/staked balance. */
    depositedBalance: string;
    /** Total amount withdrawn from this pool by the address. */
    withdrawTotalAmount: string;
    /** Rewards or principal currently claimable by the address. */
    claimableAmount: string;
    /** Total rewards that have been restaked automatically. */
    restakedReward: string;
    /** Any balance automatically reinvested into the pool. */
    autocompoundBalance: string;
} 

For Tron we need something similar, but generic

  • total freezed balance (only v2 staking)
  • total freezed for energy
  • total freezed for bandwidth
  • unfreezing + when available [array]
  • total votes (can be counted from total freezed balance but imo makes sense to return)
  • available votes
  • voting to whom [array]
  • delegated power
    • will not be possible to do in Suite (for now) but it would be good to have those data

Proposed types below

export interface TronUnstakingBatch {
    /** Amount being unstaked in this batch, in SUN. Maps to unfrozenV2[].unfreeze_amount */
    amount: string;
    /** Unix timestamp (seconds) when this batch becomes withdrawable. Maps to unfrozenV2[].unfreeze_expire_time */
    expireTime: number;
}

export interface TronVote {
    /** Super Representative address receiving this vote (base58check) */
    address: string;
    /** Number of votes (TRON Power units) cast to this SR */
    voteCount: string;
}

export interface TronStakingInfo {
    /** Total TRX staked across both resources, in SUN (1 TRX = 1_000_000 SUN) */
    stakedBalance: string;
    /** TRX staked for Energy resource, in SUN */
    stakedBalanceEnergy: string;
    /** TRX staked for Bandwidth resource, in SUN */
    stakedBalanceBandwidth: string;

    /** Batches of TRX currently in the ~14-day unstaking waiting period. Empty if no pending unstake. */
    unstakingBatches: TronUnstakingBatch[];

    /**
     * Total TRON Power held (1 staked TRX = 1 TP = 1 vote).
     * Equals stakedBalance / 1_000_000.
     */
    totalVotingPower: string;
    /** TRON Power not yet assigned to any SR. Equals totalVotingPower − Σ votes[].voteCount */
    availableVotingPower: string;
    /** Current vote allocations to Super Representatives. Empty if account has not voted. */
    votes: TronVote[];

    /** Unclaimed SR voting rewards, in SUN */
    unclaimedReward: string;

    /** TRX staked for Energy that is currently delegated to another address, in SUN */
    delegatedBalanceEnergy: string;
    /** TRX staked for Bandwidth that is currently delegated to another address, in SUN */
    delegatedBalanceBandwidth: string;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions