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

feat(incentives)!: create gauge and add to gauge fee charge #2227

Merged
merged 29 commits into from
Jul 26, 2022

Conversation

p0mvn
Copy link
Member

@p0mvn p0mvn commented Jul 24, 2022

Closes: #2191

What is the purpose of the change

This change introduces a message fee for creating and adding to gauge.

Create gauge has a fee of 50 OSMO while adding to gauge 25. The feel is always subtracted in OSMO.

If the user does not have enough OSMO to create/add to gauge + pay the fee, no action is done and the message server returns an error.

Brief Changelog

  • chargeFeeIfSufficientFeeDenomBalance method create on the keeper
  • test for chargeFeeIfSufficientFeeDenomBalance
  • fee tests for CreateGauge in the incentives message server
  • chargeFeeIfSufficientFeeDenomBalance is called from CreateGauge in incentives message server
  • fee tests for AddToGauge in the incentives message server
  • chargeFeeIfSufficientFeeDenomBalance is called from AddToGauge in incentives message server

Testing and Verifying

This change added tests and can be verified as follows:

  • TestCreateGauge_Fee
  • TestAddToGauge_Fee
  • TestChargeFeeIfSufficientFeeDenomBalance

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? yes
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? yes
  • How is the feature or change documented? godocs

@github-actions github-actions bot added C:app-wiring Changes to the app folder C:x/incentives labels Jul 24, 2022
x/incentives/keeper/gauge.go Outdated Show resolved Hide resolved
x/incentives/keeper/gauge.go Outdated Show resolved Hide resolved
@github-actions github-actions bot added the C:docs Improvements or additions to documentation label Jul 25, 2022
p0mvn and others added 2 commits July 24, 2022 19:31
* finished tests

* use keeper instead of math

* remove unused tests
@github-actions github-actions bot added the C:simulator Edits simulator or simulations label Jul 25, 2022
@czarcas7ic
Copy link
Member

Simulator was failing because we are essentially explicitly requiring the "uosmo" denom for the fees and we use the "stake" denom for the simulator. Normally I would just change the parameters from uosmo to stake, but because we are defining this directly in the msg_server, I am unable to override it. Regardless, I added a check in the simulator to only allow account with enough tokens in fees to create/add to gauges. Because no account has uosmo all attempts fail but the simulator will pass

@czarcas7ic czarcas7ic marked this pull request as ready for review July 25, 2022 04:58
@czarcas7ic czarcas7ic requested a review from a team July 25, 2022 04:58
Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, we should eventually fix the fact that a user will still pay the add to gauge fee if they submit an add to gauge message with a gaugeID that does not exist.

Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@p0mvn p0mvn marked this pull request as draft July 25, 2022 19:52
@p0mvn p0mvn marked this pull request as ready for review July 26, 2022 01:13
@czarcas7ic czarcas7ic merged commit cbfde11 into main Jul 26, 2022
@czarcas7ic czarcas7ic deleted the roman/txfees-simplified branch July 26, 2022 16:28
@czarcas7ic czarcas7ic added the A:backport/v11.x backport patches to v11.x branch label Jul 26, 2022
czarcas7ic added a commit that referenced this pull request Jul 26, 2022
* feat(incentives)!: create gauge and add to gauge fee charge

* initialize txfees keeper before incentives

* finish TestChargeFee

* refactor to charge fee in message server

* more tests

* clean up

* test balances

* test create gauge fees (#2228)

* test create gauge fees

* add mod account to test

* test create gauge fees

* add mod account to test

* move to msg server

* merge

* add comments

* account keeper comment

* fix TestCreateGaugeFee

* apply appparams.BaseCoinUnit

* remove txfees keeper from incentives and revert order

* clean up

* remove unused keepers fromm incentives keeper

* Update x/incentives/keeper/gauge.go

* Update x/incentives/keeper/gauge.go

* clean up

* fixture names

* chargeFeeIfSufficientFeeDenomBalance test name

* changelog

* comment

* finished tests (#2230)

* finished tests

* use keeper instead of math

* remove unused tests

* clean up

* sim only allow accounts with enough to pay fee

* lint

* move fee to types and reuse in simulation (#2234)

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
czarcas7ic added a commit that referenced this pull request Jul 26, 2022
…2227) (#2237)

* feat(incentives)!: create gauge and add to gauge fee charge (#2227)

* feat(incentives)!: create gauge and add to gauge fee charge

* initialize txfees keeper before incentives

* finish TestChargeFee

* refactor to charge fee in message server

* more tests

* clean up

* test balances

* test create gauge fees (#2228)

* test create gauge fees

* add mod account to test

* test create gauge fees

* add mod account to test

* move to msg server

* merge

* add comments

* account keeper comment

* fix TestCreateGaugeFee

* apply appparams.BaseCoinUnit

* remove txfees keeper from incentives and revert order

* clean up

* remove unused keepers fromm incentives keeper

* Update x/incentives/keeper/gauge.go

* Update x/incentives/keeper/gauge.go

* clean up

* fixture names

* chargeFeeIfSufficientFeeDenomBalance test name

* changelog

* comment

* finished tests (#2230)

* finished tests

* use keeper instead of math

* remove unused tests

* clean up

* sim only allow accounts with enough to pay fee

* lint

* move fee to types and reuse in simulation (#2234)

Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>

* merge gauge fee changes

* go mod updates

Co-authored-by: Roman <[email protected]>
@github-actions github-actions bot mentioned this pull request Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v11.x backport patches to v11.x branch C:app-wiring Changes to the app folder C:docs Improvements or additions to documentation C:simulator Edits simulator or simulations C:x/incentives
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Create a fee for Gauge Creation
4 participants