tx · 8o3juiN1Dev2zdt11ushde6rfK96F6bXZiyfxcsaBpnq
3MpwA3zztn9AiVLgzxtYyj21AAbvtWeBodX: -0.01000000 Waves
2022.05.05 15:28 [2038395] smart account 3MpwA3zztn9AiVLgzxtYyj21AAbvtWeBodX > SELF 0.00000000 Waves
{
"type": 13,
"id": "8o3juiN1Dev2zdt11ushde6rfK96F6bXZiyfxcsaBpnq",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1651753698312,
"version": 2,
"chainId": 84,
"sender": "3MpwA3zztn9AiVLgzxtYyj21AAbvtWeBodX",
"senderPublicKey": "DiHcx3LJuz15WXcQqQE1gEhBzw6k7HqgBE7m1qn3APFw",
"proofs": [
"W9DcGXafpUBHWFcHbuR9NiV71jrTwsenWLcCBqMSw5mxXvyGi39etmwjdfyJChc443DHQyWXhQnCnhsJLAaYacm"
],
"script": "base64:AAIFAAAAAAAAAAcIAhIDCgEBAAAAAgAAAAANUEFZTUVOVF9BU1NFVAEAAAAgrZ1IFoWReWfvw0p6hpnR3VDpBUk85P5AREeM4YPEwvQBAAAAC2lzUGF5bWVudE9rAAAAAQAAAAFpBAAAABFhY2NlcHRhYmxlQXNzZXRJZAUAAAANUEFZTUVOVF9BU1NFVAMJAAAAAAAAAgkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkAAAIAAAABAgAAABRQYXltZW50IG5vdCBhdHRhY2hlZAQAAAABcAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAHJG1hdGNoMAgFAAAAAXAAAAAHYXNzZXRJZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAAHYXNzZXRJZAUAAAAHJG1hdGNoMAMJAAAAAAAAAgUAAAAHYXNzZXRJZAUAAAARYWNjZXB0YWJsZUFzc2V0SWQJAAAAAAAAAggFAAAAAXAAAAAGYW1vdW50AAAAAAAAD0JABwkAAAIAAAABAgAAABNXcm9uZyBwYXltZW50IGFzc2V0AAAAAQAAAAFpAQAAAARmbGlwAAAAAQAAAAZjaG9pY2UDCQEAAAALaXNQYXltZW50T2sAAAABBQAAAAFpBAAAAAF4CQEAAAALdmFsdWVPckVsc2UAAAACBQAAAAZjaG9pY2UAAAAAAAAAAAADAwkAAAAAAAACBQAAAAF4AAAAAAAAAAABBgkAAAAAAAACBQAAAAF4AAAAAAAAAAAABAAAAAZ3YWxsZXQJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwIAAAABXwkAAaQAAAABBQAAAAZjaG9pY2UCAAAAAl9jCQAAAgAAAAEFAAAABndhbGxldAkAAAIAAAABAgAAABJ3cm9uZyBjaG9pY2Ugc2VyISEJAAACAAAAAQIAAAAZd3JvbmcgcGF5bWVudCBhc3NldCBzZXIhIQAAAABHis/r",
"height": 2038395,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: FDKG95TFLaVFESjjHgfTSQDSWpq4KZJYjUMVfv3aMFmd
Next: 7sDT8wewW3KN6UhG9F1MCbDeTdYgHs8W35tS1mtqKBjK
Diff:
Old | New | | Differences |
---|
24 | 24 | | @Callable(i) |
---|
25 | 25 | | func flip (choice) = if (isPaymentOk(i)) |
---|
26 | 26 | | then { |
---|
27 | | - | let wallet = (((toBase58String(i.caller.bytes) + "_") + toString(choice)) + "_c") |
---|
28 | | - | throw(wallet) |
---|
| 27 | + | let x = valueOrElse(choice, 0) |
---|
| 28 | + | if (if ((x == 1)) |
---|
| 29 | + | then true |
---|
| 30 | + | else (x == 0)) |
---|
| 31 | + | then { |
---|
| 32 | + | let wallet = (((toBase58String(i.caller.bytes) + "_") + toString(choice)) + "_c") |
---|
| 33 | + | throw(wallet) |
---|
| 34 | + | } |
---|
| 35 | + | else throw("wrong choice ser!!") |
---|
29 | 36 | | } |
---|
30 | | - | else throw("wrong payment asset") |
---|
| 37 | + | else throw("wrong payment asset ser!!") |
---|
31 | 38 | | |
---|
32 | 39 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let PAYMENT_ASSET = base58'CgidgEMbCKXXErgJXVyZCFRaK8SBNA73Jg8mNXALtVKh' |
---|
5 | 5 | | |
---|
6 | 6 | | func isPaymentOk (i) = { |
---|
7 | 7 | | let acceptableAssetId = PAYMENT_ASSET |
---|
8 | 8 | | if ((size(i.payments) == 0)) |
---|
9 | 9 | | then throw("Payment not attached") |
---|
10 | 10 | | else { |
---|
11 | 11 | | let p = i.payments[0] |
---|
12 | 12 | | match p.assetId { |
---|
13 | 13 | | case assetId: ByteVector => |
---|
14 | 14 | | if ((assetId == acceptableAssetId)) |
---|
15 | 15 | | then (p.amount == 1000000) |
---|
16 | 16 | | else false |
---|
17 | 17 | | case _ => |
---|
18 | 18 | | throw("Wrong payment asset") |
---|
19 | 19 | | } |
---|
20 | 20 | | } |
---|
21 | 21 | | } |
---|
22 | 22 | | |
---|
23 | 23 | | |
---|
24 | 24 | | @Callable(i) |
---|
25 | 25 | | func flip (choice) = if (isPaymentOk(i)) |
---|
26 | 26 | | then { |
---|
27 | | - | let wallet = (((toBase58String(i.caller.bytes) + "_") + toString(choice)) + "_c") |
---|
28 | | - | throw(wallet) |
---|
| 27 | + | let x = valueOrElse(choice, 0) |
---|
| 28 | + | if (if ((x == 1)) |
---|
| 29 | + | then true |
---|
| 30 | + | else (x == 0)) |
---|
| 31 | + | then { |
---|
| 32 | + | let wallet = (((toBase58String(i.caller.bytes) + "_") + toString(choice)) + "_c") |
---|
| 33 | + | throw(wallet) |
---|
| 34 | + | } |
---|
| 35 | + | else throw("wrong choice ser!!") |
---|
29 | 36 | | } |
---|
30 | | - | else throw("wrong payment asset") |
---|
| 37 | + | else throw("wrong payment asset ser!!") |
---|
31 | 38 | | |
---|
32 | 39 | | |
---|