-
Notifications
You must be signed in to change notification settings - Fork 608
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
Protorev: Update timing for pool updating and dev fee payout #4827
Merged
Merged
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
df18e54
Update highest liquidity pools in daily epoch instead of weekly
NotJeremyLiu 5bacd9e
Minimal code change to send dev profit after every trade
NotJeremyLiu 1f2f3dc
Handles dev fee payment without storing in kvstore
NotJeremyLiu 955b2aa
Merge branch 'main' into jl/protorev-update-timing
NotJeremyLiu 9189461
Increase consensus version
NotJeremyLiu efbd26e
Revert "Handles dev fee payment without storing in kvstore"
NotJeremyLiu 744d22e
add upgrade logic, new functions, and deprecated comments
NotJeremyLiu 49c7eaf
add another todo
NotJeremyLiu 104720a
Revert "add another todo"
NotJeremyLiu c8f8ff3
add another todo
NotJeremyLiu 865161c
Panic on migration error
NotJeremyLiu 3b490ee
Hardcode protorev from version to 1
NotJeremyLiu e7b0047
Add tests to ensure protorev upgrade is successful
NotJeremyLiu 2653b70
Remove deprecated comment to pass linter
NotJeremyLiu f457bed
lint
NotJeremyLiu 2474ad6
add changelog entry
NotJeremyLiu 17a85bf
Merge branch 'main' into jl/protorev-update-timing
NotJeremyLiu 5ebb8b6
Change documentation to reflect new timing cadence
NotJeremyLiu 212ec42
Change developer_fees test for new SendDeveloperFee method
NotJeremyLiu 666e53b
Update app/upgrades/v16/upgrades.go
NotJeremyLiu de3c073
move test to top of file, helper at bottom
NotJeremyLiu ad69aa4
Merge branch 'main' into jl/protorev-update-timing
NotJeremyLiu 179fbcb
fix merge conflict typo
NotJeremyLiu 97a6ea8
added migration function to upgrades.go
stackman27 127dc5b
bump consensus version to 2
NotJeremyLiu da4efca
comment out everything upgrade related to isolate problem
NotJeremyLiu 314d1c4
Revert "comment out everything upgrade related to isolate problem"
NotJeremyLiu 43b0abb
Revert "bump consensus version to 2"
NotJeremyLiu e68be34
log instead of pass back up errors
NotJeremyLiu f0a88c9
Remove commented out code
NotJeremyLiu b069fa1
clean up comments
NotJeremyLiu 6723370
add clarifying comment
NotJeremyLiu af008b7
Merge branch 'main' into jl/protorev-update-timing
NotJeremyLiu 61b7c83
fix typpo
NotJeremyLiu 3be7cbc
Merge branch 'main' into jl/protorev-update-timing
NotJeremyLiu 7f8f1e9
update v15 prev version tag in e2e container
NotJeremyLiu 0d63186
remove e2e test that checks protorev dev account not initialized
NotJeremyLiu 4957aff
return err if protorev dev account payment errors during upgrade
NotJeremyLiu 783e448
Merge branch 'main' into jl/protorev-update-timing
NotJeremyLiu fced67d
Add dev fee payment check when testing trade execution
NotJeremyLiu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import ( | |
"github.com/osmosis-labs/osmosis/v15/x/protorev/types" | ||
) | ||
|
||
// Used in v16 upgrade, can be removed in v17 | ||
// SendDeveloperFeesToDeveloperAccount sends the developer fees from the module account to the developer account | ||
func (k Keeper) SendDeveloperFeesToDeveloperAccount(ctx sdk.Context) error { | ||
// Developer account must be set in order to be able to withdraw developer fees | ||
|
@@ -32,6 +33,7 @@ func (k Keeper) SendDeveloperFeesToDeveloperAccount(ctx sdk.Context) error { | |
return nil | ||
} | ||
|
||
// Deprecated: Can be removed in v16 | ||
// UpdateDeveloperFees updates the fees that developers can withdraw from the module account | ||
func (k Keeper) UpdateDeveloperFees(ctx sdk.Context, denom string, profit sdk.Int) error { | ||
Comment on lines
+36
to
38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's remove now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unused now. Please submit separate PR if agreed. Not going to block merge on this |
||
daysSinceGenesis, err := k.GetDaysSinceModuleGenesis(ctx) | ||
|
@@ -62,3 +64,37 @@ func (k Keeper) UpdateDeveloperFees(ctx sdk.Context, denom string, profit sdk.In | |
|
||
return nil | ||
} | ||
|
||
// SendDeveloperFee sends the developer fee from the module account to the developer account | ||
func (k Keeper) SendDeveloperFee(ctx sdk.Context, arbProfit sdk.Coin) error { | ||
// Developer account must be set in order to be able to withdraw developer fees | ||
developerAccount, err := k.GetDeveloperAccount(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Get the days since genesis | ||
daysSinceGenesis, err := k.GetDaysSinceModuleGenesis(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Initialize the developer profit to 0 | ||
devProfit := sdk.NewCoin(arbProfit.Denom, sdk.ZeroInt()) | ||
|
||
// Calculate the developer fee | ||
if daysSinceGenesis < types.Phase1Length { | ||
devProfit.Amount = arbProfit.Amount.MulRaw(types.ProfitSplitPhase1).QuoRaw(100) | ||
} else if daysSinceGenesis < types.Phase2Length { | ||
devProfit.Amount = arbProfit.Amount.MulRaw(types.ProfitSplitPhase2).QuoRaw(100) | ||
} else { | ||
devProfit.Amount = arbProfit.Amount.MulRaw(types.ProfitSplitPhase3).QuoRaw(100) | ||
} | ||
|
||
// Send the developer profit to the developer account | ||
if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, developerAccount, sdk.NewCoins(devProfit)); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also bump
previousVersionInitTag
below tov15.x-63e3f053-1685053483