Harmony Read-Only Staking Precompile

Name of Project

Harmony Read-Only Staking Precompile

Proposal overview

Recently staking precompile was added to harmony with the most recent network upgrade here implemented here. This allows smart contracts to participate in staking. However, the smart contracts don’t have a way to read staking related data currently that is required to make a trustless liquid-staking like solution. I propose to add a read-only precompile at address 0xfa (latest available as of writing) to enable reading the following data:

  • getValidatorInfo(address validatorAddress)
    • Identity
    • Min self delegation
    • Max self delegation
    • Commission Rate
    • Max Commission Rate
    • Total Delegation
    • Currently in committee
    • Active Status
    • Apr
  • getDelegationByDelegatorAndValidator(address delegator, address validator)
  • getBalanceAvailableForRedelegation(address delegator): Balance currently available for redelegation
  • getSlashingInfo(address delegator, address validator): Any staking derivative contract will need to be able to read this trustlessly to do accounting of its delegations.
  • getUnclaimedRewards(address delegatorAddress): To build a trustless price oracle within the staking smart contract

Proposal ask


Metrics for success

  • PR enabling staking related read-only precompile merged to harmony geth
  • Solidity library and contract demonstrating the use of the precompiles

Please note: The above list is subject to change as more clarity is gained and with further conversations with the harmony team.

1 Like

Thanks for the proposal. Everything looks good except for the ask. The read-only precompile is not very complicated to implement because most of the utility code is already there. The estimated time to get this done is around 2 weeks. So I would suggest changing the ask to 10k USD.

Hey @rongjian! That works. I think I might have a couple questions around slashing. I’ll get started and will reach out to you on discord if I have any questions.
PS: The original post doesn’t seem to be editable so just acknowledging proposal ask change to 10k usd.

Updated to $10K @silliussoddus

Approved for a Bounty grant of $10K. Congratulations to the team and welcome to the Harmony Ecosystem! :tada:

Looking forward to the initiative to launch on Harmony’s Mainnet with the milestones above.

Meanwhile, to prepare receiving funds, email your identification documents to kyc@harmony.one and create a Gnosis Safe MultiSig wallet at https://multisig.harmony.one and using instructions below
:arrow_right: Setup Gnosis Safe with MetaMask & 1Wallet

Checkout the Funding FAQ for further info at Harmony Funding FAQ

We’d love :blue_heart: to see weekly updates on this channel to keep the community posted on this proposal’s progress!

1 Like

Hi @silliussoddus - following up on pursuant of this grant. We would love to see weekly updates for the community.

Thank you!

1 Like

Hi @cheualx I have submitted my two PRs - one to Harmony and another to staking precompiles. Thanks and looking forward to feedback on the first big project I took up with an open source team.

1 Like

Just hopped over from: Snapshot - Staked ONE Strategy

A method e.g. getUserShare(address wallet) that would return total staked one + wallet balance (over all shards) + maybe also rewards amount(?) would be really good to be used with snapshot.org. Then the owned ONE would be accessible with a single contract call. I did not see a method that get’s the staked one by a single delegator, am I wrong?

Would be great to use it with this strategy.