Repository navigation
bath: show Hipo's loans and validation rounds - #992
Merged
Merged
Conversation
Hipo's treasury lends its stakers' coins to validators one round at a time, but none of that showed up as actions: a loan request, the stake sent to the elector, the repayment and its reward split, and the round's own stages all read as bare GRAM transfers between Hipo's contracts. Four generic actions now cover the lending side of a staking pool, like DepositStake does for staking, each naming the pool implementation: - LoanRequest: a validator asks for a loan for the next round. - LoanIssue: the pool lends and the loan contract stakes it. - LoanRepayment: the loan comes back with its reward, split between the stakers, the protocol fee, the HPO burn and the borrower's payout. - PoolRoundTransition: a round moves through election, began, validated, ended and settled; a settled round carries its totals, and its preview shows the round's net result, negative for a losing round. The treasury reports amounts only in its logs, which it writes by topic rather than by op-code. core now decodes the external-out logs of the treasury and of the burner, and a BubbleTx keeps its input message's lt and its sender's logs so a straw can read the log written next to the message it matches. The loan straws are anchored on such a log, since anyone may send these ops but only the treasury can write its logs. A round only absorbs the steps that succeeded; a failed one stays beside it as its own transaction. The coins of every transfer an action absorbs count towards that action rather than as an account's unexplained extra. Unstake-all requests (send_unstake_all or the comment "w") also become a WithdrawStakeRequest, and Straw.Merge no longer adds the head's accounts and transactions twice when a straw extends an action it built before. API: LoanRequest, LoanIssue, LoanRepayment and PoolRoundTransition actions. A loan request's amount and min_payment are optional, absent when too large to represent; round_since is 0 when the round's start is unknown, and the preview then leaves the date out rather than showing 1970. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hipo's treasury lends its stakers' coins to validators one round at a time, but none of that showed up as actions: a loan request, the stake sent to the elector, the repayment and its reward split, and the round's own stages all read as bare GRAM transfers between Hipo's contracts.
Four generic actions now cover the lending side of a staking pool, like DepositStake does for staking, each naming the pool implementation:
The treasury reports amounts only in its logs, which it writes by topic rather than by op-code. core now decodes the external-out logs of the treasury and of the burner, and a BubbleTx keeps its input message's lt and its sender's logs so a straw can read the log written next to the message it matches. The loan straws are anchored on such a log, since anyone may send these ops but only the treasury can write its logs. A round only absorbs the steps that succeeded; a failed one stays beside it as its own transaction. The coins of every transfer an action absorbs count towards that action rather than as an account's unexplained extra.
Unstake-all requests (send_unstake_all or the comment "w") also become a WithdrawStakeRequest, and Straw.Merge no longer adds the head's accounts and transactions twice when a straw extends an action it built before.
API: LoanRequest, LoanIssue, LoanRepayment and PoolRoundTransition actions. A loan request's amount and min_payment are optional, absent when too large to represent; round_since is 0 when the round's start is unknown, and the preview then leaves the date out rather than showing 1970.