Skip to content

Commit

Permalink
Merge pull request #1065 from wavesplatform/release-12-fix
Browse files Browse the repository at this point in the history
Fix burn amount
  • Loading branch information
alexeykiselev authored Apr 28, 2018
2 parents d24c5da + 9445ce5 commit e9c1088
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/main/scala/scorex/transaction/assets/BurnTransaction.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package scorex.transaction.assets

import cats.implicits._
import com.google.common.primitives.{Bytes, Longs}
import com.wavesplatform.state.ByteStr
import monix.eval.Coeval
import play.api.libs.json.{JsObject, Json}
import scorex.account.PublicKeyAccount
import scorex.crypto.signatures.Curve25519.KeyLength
import scorex.transaction._
import scorex.transaction.validation._

trait BurnTransaction extends ProvenTransaction {
def version: Byte
Expand Down Expand Up @@ -62,12 +60,10 @@ object BurnTransaction {
(sender, assetId, quantity, fee, timestamp, quantityStart + 24)
}

def validateBurnParams(amount: Long, fee: Long): Either[ValidationError, Unit] = {
(validateAmount(amount, "assets"), validateFee(fee))
.mapN { case _ => () }
.fold(
_.head.asLeft[Unit],
_.asRight[ValidationError]
)
}
def validateBurnParams(amount: Long, fee: Long): Either[ValidationError, Unit] =
if (amount < 0) {
Left(ValidationError.NegativeAmount(amount, "assets"))
} else if (fee <= 0) {
Left(ValidationError.InsufficientFee())
} else Right(())
}

0 comments on commit e9c1088

Please sign in to comment.