We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I find myself reusing these functions in my ergoscripts. It might be useful to add this kind of functionality to the global utils:
def verifyBoxHasMarkerToken(args: (Box, Coll[Byte])): Boolean = { val box = args._1 val token = args._2 box.tokens.exists({ (t: (Coll[Byte], Long)) => t._1 == token && t._2 >= 1L }) } def verifyBoxHasNoMarkerToken(args: (Box, Coll[Byte])): Boolean = { val box = args._1 val token = args._2 box.tokens.forall({ (t: (Coll[Byte], Long)) => t._1 != token }) } def verifyUsedAdditionalRegisters(args: (Box, Int)): Boolean = { val box = args._1 val used = args._2 (used >= 1 || box.R4[Any].isEmpty) && (used >= 2 || box.R5[Any].isEmpty) && (used >= 3 || box.R6[Any].isEmpty) && (used >= 4 || box.R7[Any].isEmpty) && (used >= 5 || box.R8[Any].isEmpty) && (used >= 6 || box.R9[Any].isEmpty) } def verifySameForBasicRequiredRegisters(args: (Box, Box)): Boolean = { val inBox = args._1 val outBox = args._2 inBox.value == outBox.value && inBox.propositionBytes == outBox.propositionBytes } def verifySameForRequiredRegisters(args: (Box, Box)): Boolean = { val inBox = args._1 val outBox = args._2 verifySameForBasicRequiredRegisters(args) && inBox.tokens == outBox.tokens } def verifySpentToken(args: ((Box, Box), (Coll[Byte], Long))): Boolean = { val inBox = args._1._1 val outBox = args._1._2 val token = args._2._1 val amount = args._2._2 inBox.tokens.forall({ (it: (Coll[Byte], Long)) => { if (it._1 == token) { outBox.tokens.exists({ (ot: (Coll[Byte], Long)) => it._1 == ot._1 && it._2 == ot._2 + amount }) } else { outBox.tokens.exists({ (ot: (Coll[Byte], Long)) => it._1 == ot._1 && it._2 == ot._2 }) } } }) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I find myself reusing these functions in my ergoscripts. It might be useful to add this kind of functionality to the global utils:
The text was updated successfully, but these errors were encountered: