From 2ea7334a8b6c03ea7295b65999921d510b9db76e Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Thu, 29 Feb 2024 16:35:42 +0100 Subject: [PATCH 1/2] fix: Fixed another int conversion --- x/cardchain/keeper/vote_right.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/cardchain/keeper/vote_right.go b/x/cardchain/keeper/vote_right.go index d44df94e..c18a956b 100644 --- a/x/cardchain/keeper/vote_right.go +++ b/x/cardchain/keeper/vote_right.go @@ -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 From f9b66475c5ab039cb492ab2c4dc9a829d2f93afe Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Thu, 29 Feb 2024 17:12:40 +0100 Subject: [PATCH 2/2] fix: Updated chainid and Added Distribute hourly faucet to fix faucet running full --- app/app.go | 2 +- config.yml | 8 +++----- x/cardchain/keeper/pools.go | 8 ++++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/app.go b/app/app.go index ee7c8c60..041eb4f4 100644 --- a/app/app.go +++ b/app/app.go @@ -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) diff --git a/config.yml b/config.yml index 982ecff7..01e1bc60 100644 --- a/config.yml +++ b/config.yml @@ -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: [] @@ -88,7 +86,7 @@ genesis: staking: params: bond_denom: ubpf - chain_id: cardtestnet-9 + chain_id: cardtestnet-10 validators: - name: alice bonded: 5000000ubpf diff --git a/x/cardchain/keeper/pools.go b/x/cardchain/keeper/pools.go index 972fc0ee..d82eb77b 100644 --- a/x/cardchain/keeper/pools.go +++ b/x/cardchain/keeper/pools.go @@ -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) + } +}