Skip to content

Commit

Permalink
[Tokenomics] refactor: MintAllocationSourceOwner var usage to param…
Browse files Browse the repository at this point in the history
… usage (#916)

## Summary

Replace usage of `tokenomicskeeper.MintAllocationSupplier` with the new
param and delete it.

## Issue

- `TODO_BETA`

## Type of change

Select one or more from the following:

- [x] New feature, functionality or library
- [ ] Consensus breaking; add the `consensus-breaking` label if so. See
#791 for details
- [ ] Bug fix
- [ ] Code health or cleanup
- [ ] Documentation
- [ ] Other (specify)

## Testing

- [ ] **Documentation**: `make docusaurus_start`; only needed if you
make doc changes
- [ ] **Unit Tests**: `make go_develop_and_test`
- [ ] **LocalNet E2E Tests**: `make test_e2e`
- [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR.

## Sanity Checklist

- [ ] I have tested my changes using the available tooling
- [ ] I have commented my code
- [ ] I have performed a self-review of my own code; both comments &
source code
- [ ] I create and reference any new tickets, if applicable
- [ ] I have left TODOs throughout the codebase, if applicable

---------

Co-authored-by: Redouane Lakrache <r3d0ne@gmail.com>
  • Loading branch information
bryanchriswhite and red-0ne authored Nov 13, 2024
1 parent 40942d2 commit afb2308
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion x/tokenomics/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ func (k Keeper) MintAllocationsSum(ctx context.Context) float64 {
mintAllocationDAO := params.GetMintAllocationDao()
mintAllocationProposer := params.GetMintAllocationProposer()
mintAllocationSupplier := params.GetMintAllocationSupplier()
mintAllocationSourceOwner := params.GetMintAllocationSourceOwner()

return mintAllocationDAO +
mintAllocationProposer +
mintAllocationSupplier +
MintAllocationSourceOwner + MintAllocationApplication
mintAllocationSourceOwner +
MintAllocationApplication
}
4 changes: 2 additions & 2 deletions x/tokenomics/keeper/token_logic_modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ var (

const (
// TODO_BETA(@bryanchriswhite): Make all of these governance params
MintAllocationSourceOwner = 0.15
MintAllocationApplication = 0.0

// MintDistributionAllowableTolerancePercent is the percent difference that is allowable
Expand Down Expand Up @@ -487,7 +486,8 @@ func (k Keeper) TokenLogicModuleGlobalMint(
logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the DAO with address %q", daoCoin, k.GetAuthority()))

// Send a portion of the rewards to the source owner
serviceCoin, err := k.sendRewardsToAccount(ctx, tokenomicstypes.ModuleName, service.OwnerAddress, &newMintAmtFloat, MintAllocationSourceOwner)
mintAllocationSourceOwner := k.GetParams(ctx).MintAllocationSourceOwner
serviceCoin, err := k.sendRewardsToAccount(ctx, tokenomicstypes.ModuleName, service.OwnerAddress, &newMintAmtFloat, mintAllocationSourceOwner)
if err != nil {
return tokenomicstypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to source owner: %v", err)
}
Expand Down
3 changes: 2 additions & 1 deletion x/tokenomics/keeper/token_logic_modules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,12 @@ func TestProcessTokenLogicModules_TLMGlobalMint_Valid_MintDistributionCorrect(t
mintAllocationDao := keepers.Keeper.GetParams(ctx).MintAllocationDao
mintAllocationProposer := keepers.Keeper.GetParams(ctx).MintAllocationProposer
mintAllocationSupplier := keepers.Keeper.GetParams(ctx).MintAllocationSupplier
mintAllocationSourceOwner := keepers.Keeper.GetParams(ctx).MintAllocationSourceOwner
numTokensMinted := numTokensClaimed * tokenomicskeeper.GlobalInflationPerClaim
numTokensMintedInt := cosmosmath.NewIntFromUint64(uint64(numTokensMinted))
daoMint := cosmosmath.NewInt(int64(numTokensMinted * mintAllocationDao))
propMint := cosmosmath.NewInt(int64(numTokensMinted * mintAllocationProposer))
serviceOwnerMint := cosmosmath.NewInt(int64(numTokensMinted * tokenomicskeeper.MintAllocationSourceOwner))
serviceOwnerMint := cosmosmath.NewInt(int64(numTokensMinted * mintAllocationSourceOwner))
appMint := cosmosmath.NewInt(int64(numTokensMinted * tokenomicskeeper.MintAllocationApplication))
supplierMint := float32(numTokensMinted * mintAllocationSupplier)

Expand Down

0 comments on commit afb2308

Please sign in to comment.