Skip to content

Commit

Permalink
fix dev grants
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Mar 6, 2024
1 parent 8f5fcf2 commit 11e13df
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions x/jklmint/keeper/mint.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keeper

import (
"crypto/sha256"
"encoding/hex"
"fmt"

Expand Down Expand Up @@ -43,13 +44,28 @@ func (k Keeper) mintStaker(ctx sdk.Context, mintTokens int64, denom string, para
return nil
}

func GetDevGrantsAccount() (sdk.AccAddress, error) {
return GetAccount(types.DevGrantsPool)
}

func GetAccount(name string) (sdk.AccAddress, error) {
s := sha256.New()
s.Write([]byte(name))
m := s.Sum(nil)
mh := hex.EncodeToString(m)
adr, err := sdk.AccAddressFromHex(mh)
if err != nil {
return nil, sdkerrors.Wrapf(err, "cannot get account account")
}
return adr, nil
}

func (k Keeper) mintDevGrants(ctx sdk.Context, mintTokens int64, denom string, params types.Params) error {
devGrantRatio := sdk.NewDec(params.DevGrantsRatio).QuoInt64(100)

devGrantTokenAmount := devGrantRatio.MulInt64(mintTokens).TruncateInt64()

h := hex.EncodeToString([]byte(types.DevGrantsPool))
address, err := sdk.AccAddressFromHex(h)
address, err := GetDevGrantsAccount()
if err != nil {
return sdkerrors.Wrapf(err, "cannot create dev grants address")
}
Expand Down

0 comments on commit 11e13df

Please sign in to comment.