-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add InflateDao function to EndBlocker
- Loading branch information
Charles Dusek
committed
May 12, 2023
1 parent
978e42e
commit 2cdae63
Showing
5 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/onomyprotocol/onomy/x/dao/types" | ||
) | ||
|
||
// VoteAbstain votes abstain on all the proposals from the DAO account. | ||
func (k Keeper) InflateDao(ctx sdk.Context) (err error) { | ||
daoAddr := k.accountKeeper.GetModuleAddress(types.ModuleName) | ||
daoBalance := k.bankKeeper.GetBalance(ctx, daoAddr, "nom") | ||
minter := k.mintKeeper.GetMinter(ctx) | ||
params := k.mintKeeper.GetParams(ctx) | ||
minter.AnnualProvisions = minter.NextAnnualProvisions(params, daoBalance.Amount) | ||
|
||
// mint coins, update supply | ||
mintedCoin := minter.BlockProvision(params) | ||
mintedCoins := sdk.NewCoins(mintedCoin) | ||
|
||
err = k.bankKeeper.MintCoins(ctx, types.ModuleName, mintedCoins) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters