specify uCLR in locking msgs

master
michael 2022-09-08 21:43:42 +00:00
parent faf5c3d89b
commit 275230dc76
1 changed files with 3 additions and 3 deletions

View File

@ -44,17 +44,17 @@ func (k msgServer) LockFunds(goCtx context.Context, msg *types.MsgLockFunds) (*t
totalAfterPay := new(big.Int)
totalAfterPay.Add(prevAmount, paying)
if totalAfterPay.Cmp(required) == -1 {
return nil, fmt.Errorf("final locked amount must be above minimum required (actual: %s)", totalAfterPay.String())
return nil, fmt.Errorf("final locked amount must be at least minimum required (actual: %s)", totalAfterPay.String())
}
spendable := k.bank.SpendableCoins(ctx, senderAddr)
if spendable.AmountOf("uclr").BigInt().Cmp(paying) != -1 {
sendCoins := sdk.NewCoins(sdk.NewCoin("uclr", sdk.NewIntFromBigInt(paying)))
if err := k.bank.SendCoinsFromAccountToModule(ctx, senderAddr, types.ModuleName, sendCoins); err != nil {
return nil, fmt.Errorf("failed to lock %s CLR in bank module: %s", paying.String(), err)
return nil, fmt.Errorf("failed to lock %s uCLR in bank module: %s", paying.String(), err)
}
} else {
return nil, fmt.Errorf("not enough balance to lock %s CLR (your balance: %s)", paying.String(), spendable.AmountOf("clr").String())
return nil, fmt.Errorf("not enough balance to lock %s uCLR (your balance: %s)", paying.String(), spendable.AmountOf("uclr").String())
}
lockedUsers.Users[msg.Creator] = totalAfterPay.String()