Skip to content

Commit

Permalink
prepare beta release (#837)
Browse files Browse the repository at this point in the history
* change creation fee

* update params

* update fee

* set denom fee

* emit distribution event

* fix linter
  • Loading branch information
jhernandezb authored Jul 5, 2023
1 parent 6b64748 commit 5d93a3c
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 23 deletions.
11 changes: 6 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ steps:
password:
from_secret: docker_password
tags:
- v11.0.0-alpha.2
- v11.0.0-beta.1
when:
event:
- push
branch:
- jhernandez/tokenomics-update
- jhernandezb/v11-beta-release
- name: docker_release
image: plugins/docker
settings:
Expand Down Expand Up @@ -350,7 +350,7 @@ steps:
- ./scripts/ci/upgrade/proposal.sh
- name: stargaze-upgraded
pull: always
image: publicawesome/stargaze:v11.0.0-alpha.2
image: publicawesome/stargaze:v11.0.0-beta.1
commands:
- ./scripts/ci/upgrade/run-upgrade.sh
environment:
Expand All @@ -369,10 +369,11 @@ steps:
- http://icad:26657
- name: check-params
pull: always
image: publicawesome/stargaze:v11.0.0-alpha.2
image: publicawesome/stargaze:v11.0.0-beta.1
commands:
- starsd q mint params --node http://stargaze-upgraded:26657
- starsd q alloc params --node http://stargaze-upgraded:26657
- starsd q tokenfactory params --node http://stargaze-upgraded:26657
- starsd q bank balances stars1mnyrspq208uv5m2krdctan2dkyht0szje9s43h --node http://stargaze-upgraded:26657
- starsd q bank balances stars103y4f6h80lc45nr8chuzr3fyzqywm9n0gnr394 --node http://stargaze-upgraded:26657
- starsd q distribution community-pool --node http://stargaze-upgraded:26657
Expand Down Expand Up @@ -415,6 +416,6 @@ volumes:

---
kind: signature
hmac: 6d7b77c0e3c04feeaa508ac592da7feeb6963d8b85da31d180d2bec0b2d3d7eb
hmac: a2715d033d33712aeeb3f541b01e43677014a6871dc7d91b3da0ad19e13faf71

...
6 changes: 1 addition & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,6 @@ func NewStargazeApp(
registry.RegisterEncoder(claimmoduletypes.ModuleName, claimwasm.Encoder)
registry.RegisterEncoder(allocmoduletypes.ModuleName, allocwasm.Encoder)

// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
availableCapabilities := "iterator,staking,stargate,stargaze,cosmwasm_1_1,cosmwasm_1_2,token_factory"

// Wasm accepted Stargate Queries
acceptStargateQueriesList := wasmkeeper.AcceptedStargateQueries{
"/stargaze.tokenfactory.v1.Query/Params": &tokenfactorytypes.QueryParamsResponse{},
Expand Down Expand Up @@ -586,7 +582,7 @@ func NewStargazeApp(
app.GRPCQueryRouter(),
wasmDir,
wasmConfig,
availableCapabilities,
GetWasmCapabilities(),
wasmOpts...,
)

Expand Down
14 changes: 8 additions & 6 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) {
if err != nil {
return nil, err
}
params := app.TokenFactoryKeeper.GetParams(ctx)
params.DenomCreationFee = nil
params.DenomCreationGasConsume = 50_000_000 // 50STARS at 1ustars
app.TokenFactoryKeeper.SetParams(ctx, params)

// Following param changes reflect what was approved by prop 165 and combined in a single upgrade for Prop 1-3
// https://www.mintscan.io/stargaze/proposals/165
Expand All @@ -49,15 +45,21 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) {
// update blocks per year using 5.9 s avg block time
mintParams.BlocksPerYear = 5345036
app.MintKeeper.SetParams(ctx, mintParams)
denom := app.MintKeeper.GetParams(ctx).MintDenom

// token factory params
params := app.TokenFactoryKeeper.GetParams(ctx)
// 10k STARS
params.DenomCreationFee = sdk.NewCoins(sdk.NewInt64Coin(denom, 10_000_000_000))

app.TokenFactoryKeeper.SetParams(ctx, params)

// set community tax to 0 since the allocation module will now take care of it
// making an accurate allocation of the inflation
distributionParams := app.DistrKeeper.GetParams(ctx)
distributionParams.CommunityTax = sdk.ZeroDec()
app.DistrKeeper.SetParams(ctx, distributionParams)

denom := app.MintKeeper.GetParams(ctx).MintDenom

// change alloc params to set nft incentives to 0% until incentives are live
allocParams := app.AllocKeeper.GetParams(ctx)

Expand Down
11 changes: 11 additions & 0 deletions app/wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package app

import "strings"

var wasmCapabilities = []string{
"iterator", "staking", "stargate", "stargaze", "cosmwasm_1_1", "token_factory",
}

func GetWasmCapabilities() string {
return strings.Join(wasmCapabilities, ",")
}
17 changes: 12 additions & 5 deletions x/alloc/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ func (k Keeper) DistributeInflation(ctx sdk.Context) error {
// the amount that needs to be supplemented from the supplement pool
supplementAmount := params.SupplementAmount.AmountOf(denom)

distributionEvent := sdk.NewEvent(
types.EventTypeDistribution,
)
// transfer supplement amount to be distributed to stakers if
// 1- Supplement from params is not 0
// 2- There is enough balance in the pool
Expand All @@ -93,13 +96,13 @@ func (k Keeper) DistributeInflation(ctx sdk.Context) error {
if err != nil {
return err
}

distributionEvent = distributionEvent.AppendAttributes(sdk.NewAttribute(types.AttributeKeySupplementAmount, supplementAmount.String()))
}

// retrieve balance from fee pool which is filled by minting new coins and by collecting transaction fees
blockInflationAddr := k.accountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName).GetAddress()
blockInflation := k.bankKeeper.GetBalance(ctx, blockInflationAddr, denom)

distributionEvent = distributionEvent.AppendAttributes(sdk.NewAttribute(types.AttributeKeyFeePoolAmount, blockInflation.String()))
proportions := params.DistributionProportions

if proportions.NftIncentives.GT(sdk.ZeroDec()) {
Expand All @@ -110,9 +113,7 @@ func (k Keeper) DistributeInflation(ctx sdk.Context) error {
if err != nil {
return err
}

// iterate over list of incentive addresses and proportions
k.Logger(ctx).Debug("fund incentive rewards", "amount", incentiveRewards.String(), "from", blockInflationAddr)
distributionEvent = distributionEvent.AppendAttributes(sdk.NewAttribute(types.AttributeKeyIncentivesAmount, incentiveRewards.String()))
}

// fund community pool if the value is not nil and greater than zero
Expand All @@ -122,14 +123,20 @@ func (k Keeper) DistributeInflation(ctx sdk.Context) error {
if err != nil {
return err
}
distributionEvent = distributionEvent.AppendAttributes(sdk.NewAttribute(types.AttributeKeyCommunityPoolAmount, communityPoolTax.String()))
}

devRewards := k.GetProportions(ctx, blockInflation, proportions.DeveloperRewards)
distributionEvent = distributionEvent.AppendAttributes(sdk.NewAttribute(types.AttributeKeyDevRewardsAmount, devRewards.String()))
err := k.DistributeWeightedRewards(ctx, blockInflationAddr, devRewards, params.WeightedDeveloperRewardsReceivers)
if err != nil {
return err
}

ctx.EventManager().EmitEvents(sdk.Events{
distributionEvent,
})

// fairburn pool
fairburnPoolAddress := k.accountKeeper.GetModuleAccount(ctx, types.FairburnPoolName).GetAddress()
collectedFairburnFees := k.bankKeeper.GetBalance(ctx, fairburnPoolAddress, denom)
Expand Down
10 changes: 8 additions & 2 deletions x/alloc/types/events.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package types

const (
EventTypeFundFairburnPool = "fund_fairburn_pool"
AttributeValueCategory = ModuleName
EventTypeFundFairburnPool = "fund_fairburn_pool"
EventTypeDistribution = "alloc_distribution"
AttributeValueCategory = ModuleName
AttributeKeySupplementAmount = "supplement_amount"
AttributeKeyCommunityPoolAmount = "community_pool_amount"
AttributeKeyIncentivesAmount = "incentives_amount"
AttributeKeyDevRewardsAmount = "dev_rewards_amount"
AttributeKeyFeePoolAmount = "fee_pool_amount"
)

0 comments on commit 5d93a3c

Please sign in to comment.