Skip to content

Commit

Permalink
Removed unused variables in ContextFunctionsTest
Browse files Browse the repository at this point in the history
  • Loading branch information
xrtm000 committed Sep 26, 2023
1 parent 7efeb9d commit b623871
Showing 1 changed file with 55 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,76 +272,71 @@ class ContextFunctionsTest extends PropSpec with WithDomain with EthHelpers {
DirectiveDictionary[StdLibVersion].all
.filter(_ >= V3)
.foreach { version =>
val (masterAcc, _, genesis, setScriptTransactions, dataTransaction, transferTx, transfer2) = preconditionsAndPayments
for {
v4Activation <- if (version >= V4) Seq(true) else Seq(false, true)
v5Activation <- if (version >= V5) Seq(true) else Seq(false, true)
} yield {
val fs = settingsForRide(version).blockchainSettings.functionalitySettings

assertDiffAndState(fs) { append =>
append(genesis).explicitGet()
append(Seq(dataTransaction)).explicitGet()
val (masterAcc, _, genesis, _, dataTransaction, transferTx, transfer2) = preconditionsAndPayments
val fs = settingsForRide(version).blockchainSettings.functionalitySettings

val quantity = 100000000L
val decimals = 6.toByte
val reissuable = true
val assetScript = None
assertDiffAndState(fs) { append =>
append(genesis).explicitGet()
append(Seq(dataTransaction)).explicitGet()

val issueTx = TxHelpers.issue(masterAcc, quantity, decimals)
val quantity = 100000000L
val decimals = 6.toByte
val reissuable = true
val assetScript = None

val sponsoredFee = 100
val sponsorTx = TxHelpers.sponsor(issueTx.asset, Some(sponsoredFee), masterAcc)
val issueTx = TxHelpers.issue(masterAcc, quantity, decimals)

append(Seq(transferTx, issueTx)).explicitGet()
val sponsoredFee = 100
val sponsorTx = TxHelpers.sponsor(issueTx.asset, Some(sponsoredFee), masterAcc)

val assetId = issueTx.assetId
append(Seq(transferTx, issueTx)).explicitGet()

val sponsored =
if (version >= V4)
s"let sponsored = aInfo.minSponsoredFee == $sponsoredFee"
else
s"let sponsored = aInfo.sponsored == true"
val assetId = issueTx.assetId

val script = ScriptCompiler
.compile(
s"""
| {-# STDLIB_VERSION ${version.id} #-}
| {-# CONTENT_TYPE EXPRESSION #-}
| {-# SCRIPT_TYPE ACCOUNT #-}
|
| let aInfoOpt = assetInfo(base58'$assetId')
| let aInfo = aInfoOpt.value()
| let id = aInfo.id == base58'$assetId'
| let quantity = aInfo.quantity == $quantity
| let decimals = aInfo.decimals == $decimals
| let issuer = aInfo.issuer.bytes == base58'${issueTx.sender.toAddress}'
| let issuerPublicKey = aInfo.issuerPublicKey == base58'${issueTx.sender}'
| let scripted = aInfo.scripted == ${assetScript.nonEmpty}
| let reissuable = aInfo.reissuable == $reissuable
| $sponsored
|
| id &&
| quantity &&
| decimals &&
| issuer &&
| issuerPublicKey &&
| scripted &&
| reissuable &&
| sponsored
|
val sponsored =
if (version >= V4)
s"let sponsored = aInfo.minSponsoredFee == $sponsoredFee"
else
s"let sponsored = aInfo.sponsored == true"

val script = ScriptCompiler
.compile(
s"""
| {-# STDLIB_VERSION ${version.id} #-}
| {-# CONTENT_TYPE EXPRESSION #-}
| {-# SCRIPT_TYPE ACCOUNT #-}
|
| let aInfoOpt = assetInfo(base58'$assetId')
| let aInfo = aInfoOpt.value()
| let id = aInfo.id == base58'$assetId'
| let quantity = aInfo.quantity == $quantity
| let decimals = aInfo.decimals == $decimals
| let issuer = aInfo.issuer.bytes == base58'${issueTx.sender.toAddress}'
| let issuerPublicKey = aInfo.issuerPublicKey == base58'${issueTx.sender}'
| let scripted = aInfo.scripted == ${assetScript.nonEmpty}
| let reissuable = aInfo.reissuable == $reissuable
| $sponsored
|
| id &&
| quantity &&
| decimals &&
| issuer &&
| issuerPublicKey &&
| scripted &&
| reissuable &&
| sponsored
|
""".stripMargin,
estimator
)
.explicitGet()
._1
estimator
)
.explicitGet()
._1

val setScriptTx = TxHelpers.setScript(masterAcc, script)
val setScriptTx = TxHelpers.setScript(masterAcc, script)

append(Seq(sponsorTx)).explicitGet()
append(Seq(setScriptTx)).explicitGet()
append(Seq(transfer2)).explicitGet()
}
append(Seq(sponsorTx)).explicitGet()
append(Seq(setScriptTx)).explicitGet()
append(Seq(transfer2)).explicitGet()
}
}
}
Expand Down

0 comments on commit b623871

Please sign in to comment.