All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wavesplatform.state.diffs.GenesisTransactionDiff.scala Maven / Gradle / Ivy

The newest version!
package com.wavesplatform.state.diffs

import com.wavesplatform.lang.ValidationError
import com.wavesplatform.state.{Blockchain, Portfolio, StateSnapshot}
import com.wavesplatform.transaction.GenesisTransaction
import com.wavesplatform.transaction.TxValidationError.GenericError

object GenesisTransactionDiff {
  def apply(b: Blockchain)(tx: GenesisTransaction): Either[ValidationError, StateSnapshot] = {
    if (b.height != 1)
      Left(GenericError(s"GenesisTransaction cannot appear in non-initial block (${b.height})"))
    else
      StateSnapshot.build(b, Map(tx.recipient -> Portfolio(balance = tx.amount.value)))
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy