Skip to content

Commit

Permalink
SentToOwnersTestPlanSpec: simplify getStoProperty()
Browse files Browse the repository at this point in the history
* Make `numberOfTokens` effectively final
* Use if/else for readability
  • Loading branch information
msgilligan committed Jul 8, 2023
1 parent 2b0f220 commit 74fd52a
Showing 1 changed file with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,9 @@ class SendToOwnersTestPlanSpec extends BaseRegTestSpec {
def amountAvailable = OmniValue.of(new BigDecimal(data.AmountAvailable), propertyType)
def ecosystem = Ecosystem.valueOf(Short.valueOf(data.Ecosystem))
def propertyName = new String(data.PropertyName)
def numberOfTokens = OmniValue.of(0, propertyType)

if (amountAvailableOwners.size()) {
numberOfTokens += OmniValue.of((BigDecimal) amountAvailableOwners.sum(), propertyType)
}
def numberOfTokens = (amountAvailableOwners.size())
? OmniValue.of((BigDecimal) amountAvailableOwners.sum(), propertyType)
: OmniValue.of(0, propertyType)

if (propertyName == "OMNI" || propertyName == "TOMNI") {
if (numberOfTokens > 0) {
Expand All @@ -363,22 +361,16 @@ class SendToOwnersTestPlanSpec extends BaseRegTestSpec {
generateBlocks(1)
}
return CurrencyID.valueOf(propertyName)
}

numberOfTokens += amountAvailable

// if (propertyType == PropertyType.DIVISIBLE) {
// numberOfTokens = BTC.btcToSatoshis(numberOfTokens)
// }
} else {
def txid = createProperty(actorAddress, ecosystem, numberOfTokens + amountAvailable)
generateBlocks(1)

def txid = createProperty(actorAddress, ecosystem, numberOfTokens)
generateBlocks(1)

def transaction = omniGetTransaction(txid)
assert transaction.valid
assert transaction.confirmations == 1
def transaction = omniGetTransaction(txid)
assert transaction.valid
assert transaction.confirmations == 1

return transaction.propertyId
return transaction.propertyId
}
}

/**
Expand Down

0 comments on commit 74fd52a

Please sign in to comment.