specify uCLR in locking msgs
parent
faf5c3d89b
commit
275230dc76
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue