Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor PR adding some code comments #1101

Merged
merged 1 commit into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions x/superfluid/keeper/stake.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ func (k Keeper) GetTotalSyntheticAssetsLocked(ctx sdk.Context, denom string) sdk

func (k Keeper) GetExpectedDelegationAmount(ctx sdk.Context, acc types.SuperfluidIntermediaryAccount) sdk.Int {
// Get total number of Osmo this account should have delegated after refresh
// (1) Find how many tokens total T are locked for (denom, validator) pair
totalSuperfluidDelegation := k.GetTotalSyntheticAssetsLocked(ctx, stakingSyntheticDenom(acc.Denom, acc.ValAddr))
// (2) Multiply the T tokens, by the number of superfluid osmo per token, to get the total amount
// of osmo we expect.
refreshedAmount := k.GetSuperfluidOSMOTokens(ctx, acc.Denom, totalSuperfluidDelegation)
return refreshedAmount
}

func (k Keeper) RefreshIntermediaryDelegationAmounts(ctx sdk.Context) {
// iterate over every (denom, validator) pair
accs := k.GetAllIntermediaryAccounts(ctx)
for _, acc := range accs {
mAddr := acc.GetAccAddress()
Expand Down
6 changes: 4 additions & 2 deletions x/superfluid/spec/04_epoch.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ Overall Epoch sequence
* Issue new Osmo, and send to various modules (distribution, incentives, etc.)
* 25% currently goes to `x/distribution` which funds `Staking` and `Superfluid` rewards
* Rewards for `Superfluid` are based on the just updated delegation amounts, and queued for payout in the next epoch
* Epoch N ends, during BeginBlock **After** AfterEpochEnd:
* BeginBlock for Distribution
* Distribute staking rewards to all of the 'lazy accounting' accumulators. (F1)
* Epoch N ends, during BeginBlock for superfluid **After** AfterEpochEnd:
* Claim staking rewards for every `Intermediary Account`, put them into gauges.
* Distribute Superfluid staking rewards from gauges to bonded Synthetic Lock owners
* Update `Osmo Equivalent Multiplier` value for each LP token
* (Currently spot price at epoch)
* Refresh delegation amounts for all `Intermediary Accounts`
* Calcultate the expected delegation for this account as `Osmo Equivalent Multipler` *`# LP Shares`* `Risk adjustment`
* Calculate the expected delegation for this account as `Osmo Equivalent Multipler` *`# LP Shares`* `Risk adjustment`
* If this is less than 0.000001 `Osmo` it will be rounded to 0
* Lookup current delegation amount for `Intermediary Account`
* If there is no delegation, treat the current delegation as 0
Expand Down