Skip to content

Commit

Permalink
Merge branch 'master' of github.com:DecentralCardGame/Cardchain
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickwieth committed Feb 29, 2024
2 parents 70ff1e1 + dbf348a commit ae1a824
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo
}

if app.LastBlockHeight()%500 == 0 { //HourlyFaucet
app.CardchainKeeper.AddPoolCredits(ctx, cardchainmodulekeeper.PublicPoolKey, app.CardchainKeeper.GetParams(ctx).HourlyFaucet)
app.CardchainKeeper.DistributeHourlyFaucet(ctx)

incentives := cardchainmodulekeeper.QuoCoin(*app.CardchainKeeper.Pools.Get(ctx, cardchainmodulekeeper.PublicPoolKey), 10)
app.CardchainKeeper.SubPoolCredits(ctx, cardchainmodulekeeper.PublicPoolKey, incentives)
Expand Down
8 changes: 3 additions & 5 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ genesis:
denom_metadata:
- base: ubpf
denom_units:
- aliases:
- microbpf
- aliases: [microbpf]
denom: ubpf
exponent: 0
- aliases:
- millibpf
- aliases: [millibpf]
denom: mbpf
exponent: 3
- aliases: []
Expand Down Expand Up @@ -88,7 +86,7 @@ genesis:
staking:
params:
bond_denom: ubpf
chain_id: cardtestnet-9
chain_id: cardtestnet-10
validators:
- name: alice
bonded: 5000000ubpf
Expand Down
8 changes: 8 additions & 0 deletions x/cardchain/keeper/pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ func (k Keeper) SubPoolCredits(ctx sdk.Context, poolName string, amount sdk.Coin
newPool := pool.Sub(amount)
k.Pools.Set(ctx, poolName, &newPool)
}

// DistributeHourlyFaucet distributes hourly faucet
func (k Keeper) DistributeHourlyFaucet(ctx sdk.Context) {
pool := k.Pools.Get(ctx, PublicPoolKey)
if pool.Amount.LT(sdk.NewInt(1_000_000_000_000_000)) {
k.AddPoolCredits(ctx, PublicPoolKey, k.GetParams(ctx).HourlyFaucet)
}
}
2 changes: 1 addition & 1 deletion x/cardchain/keeper/vote_right.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (k Keeper) GetVoteReward(ctx sdk.Context) sdk.Coin {

pool := k.Pools.Get(ctx, BalancersPoolKey)
reward := QuoCoin(*pool, params.VotePoolFraction)
if reward.Amount.Int64() > params.VotingRewardCap {
if reward.Amount.GTE(sdk.NewInt(params.VotingRewardCap)) {
return sdk.NewInt64Coin(reward.Denom, params.VotingRewardCap)
}
return reward
Expand Down

0 comments on commit ae1a824

Please sign in to comment.