tx · E8HzhmX6gT8ikkWCo1GU8PNzmTgnYumZdpeXmZRQmQAF 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H: -0.01000000 Waves 2022.11.13 15:01 [2315328] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves
{ "type": 13, "id": "E8HzhmX6gT8ikkWCo1GU8PNzmTgnYumZdpeXmZRQmQAF", "fee": 1000000, "feeAssetId": null, "timestamp": 1668340929701, "version": 2, "chainId": 84, "sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H", "senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu", "proofs": [ "3SPqpfF66ZsqzCPrnCh74tFheonQCZwt7n4FtPqoUmzCrcnACLoD3heK6ft9tCqjaKYepHZjxTbnf3asKA5qA3Go" ], "script": "base64:BgIGCAISABIABQAMa1VzZXJQYXltZW50AgdQYXltZW50AARrV29uAgNXb24ACXNlcGFyYXRvcgIBXwEJcmFuZG9taXplAgVieXRlcwVyYW5nZQQEaGFzaAkA9wMBBQVieXRlcwQFaW5kZXgJALEJAQUEaGFzaAkAagIFBWluZGV4BQVyYW5nZQEIY291bnRpbmcBBWJ5dGVzBAVjb3VudAkBCXJhbmRvbWl6ZQIFBWJ5dGVzAAoDCQBnAgUFY291bnQAAwcGAgFpAQtwYXJzZVN0cnVjdAADCQECIT0CCAUBaQZjYWxsZXIFBHRoaXMJAAIBAgpPbmx5IG93bmVyBAx3aW5uZXJTdHJ1Y3QJAQhjb3VudGluZwEIBQFpDXRyYW5zYWN0aW9uSWQJAMwIAgkBDEJvb2xlYW5FbnRyeQIJAKwCAgkArAICCQCsAgIFBGtXb24FCXNlcGFyYXRvcgkApQgBCAUBaQZjYWxsZXIJAKQDAQkBCXJhbmRvbWl6ZQIIBQFpDXRyYW5zYWN0aW9uSWQA6AcFDHdpbm5lclN0cnVjdAkAzAgCCQEMQm9vbGVhbkVudHJ5AgUEa1dvbgUMd2lubmVyU3RydWN0BQNuaWwBaQEJc3RhcnRHYW1lAAQGYW1vdW50CQEFdmFsdWUBCAkAkQMCCAUBaQhwYXltZW50cwAABmFtb3VudAMJAQIhPQIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUEdW5pdAkAAgECDFBheSBpbiB3YXZlcwMJAGYCBQZhbW91bnQACgkAAgECD1RvbyBtdWNoIGFtb3VudAQNbnVsbEluaXRTdG9yZQkA/AcEBQR0aGlzAgtwYXJzZVN0cnVjdAUDbmlsBQNuaWwDCQAAAgUNbnVsbEluaXRTdG9yZQUNbnVsbEluaXRTdG9yZQQDd29uCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJsIAgUEdGhpcwUEa1dvbgISU3RvcmFnZSByZWFkIGVycm9yAwUDd29uCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgkAaAIFBmFtb3VudAACBQR1bml0BQNuaWwFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgA6xAXo", "height": 2315328, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 48xskAHzutcnA19wWcGHp2UFaSoH54ia5DxEcd8sGZLn Next: AyYiw9Ubx4nVpk6A5d3LVvR1fnZHu88VapxMrtZPotsH Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = " | |
4 | + | let a = "Payment" | |
5 | 5 | ||
6 | - | let b = " | |
6 | + | let b = "Won" | |
7 | 7 | ||
8 | - | let c = " | |
8 | + | let c = "_" | |
9 | 9 | ||
10 | - | let d = "price" | |
11 | - | ||
12 | - | func e (f) = { | |
13 | - | let g = assetInfo(f) | |
14 | - | if ($isInstanceOf(g, "Asset")) | |
15 | - | then { | |
16 | - | let h = g | |
17 | - | if (if ((h.decimals == 0)) | |
18 | - | then (h.quantity == 1) | |
19 | - | else false) | |
20 | - | then (h.reissuable == false) | |
21 | - | else false | |
22 | - | } | |
23 | - | else false | |
10 | + | func d (e,f) = { | |
11 | + | let g = sha256(e) | |
12 | + | let h = toInt(g) | |
13 | + | (h % f) | |
24 | 14 | } | |
25 | 15 | ||
26 | 16 | ||
27 | - | ||
28 | - | ||
29 | - | | |
30 | - | | |
31 | - | ||
17 | + | func i (e) = { | |
18 | + | let j = d(e, 10) | |
19 | + | if ((j >= 3)) | |
20 | + | then false | |
21 | + | else true | |
32 | 22 | } | |
33 | 23 | ||
34 | 24 | ||
35 | - | ||
36 | - | @Callable(i) | |
37 | - | func buyNFT (n) = { | |
38 | - | let f = fromBase58String(n) | |
39 | - | let o = value(i.payments[0].amount) | |
40 | - | let p = valueOrErrorMessage(getString(((d + a) + n)), "There is no price for this NFT") | |
41 | - | let q = valueOrErrorMessage(getStringValue(((n + a) + "Owner")), "No owner") | |
42 | - | if ((i.payments[0].assetId != unit)) | |
43 | - | then throw("Pay in waves") | |
44 | - | else if ((parseIntValue(p) > o)) | |
45 | - | then throw("Invalid payment") | |
46 | - | else [ScriptTransfer(i.caller, 1, f), ScriptTransfer(value(addressFromString(q)), parseIntValue(p), unit), StringEntry(((toString(i.caller) + a) + b), ((n + a) + toString(o)))] | |
47 | - | } | |
25 | + | @Callable(k) | |
26 | + | func parseStruct () = if ((k.caller != this)) | |
27 | + | then throw("Only owner") | |
28 | + | else { | |
29 | + | let l = i(k.transactionId) | |
30 | + | [BooleanEntry((((b + c) + toString(k.caller)) + toString(d(k.transactionId, 1000))), l), BooleanEntry(b, l)] | |
31 | + | } | |
48 | 32 | ||
49 | 33 | ||
50 | 34 | ||
51 | - | @Callable(i) | |
52 | - | func sellNFT (p) = { | |
53 | - | let r = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
54 | - | let s = r._1 | |
55 | - | let t = r._2 | |
56 | - | if (!(e(s))) | |
57 | - | then throw("Token is not NFT") | |
58 | - | else [StringEntry(((d + a) + toBase58String(value(i.payments[0].assetId))), toString(p)), StringEntry(((toString(i.caller) + a) + c), ((toBase58String(s) + a) + toString(t)))] | |
35 | + | @Callable(k) | |
36 | + | func startGame () = { | |
37 | + | let m = value(k.payments[0].amount) | |
38 | + | if ((k.payments[0].assetId != unit)) | |
39 | + | then throw("Pay in waves") | |
40 | + | else if ((m > 10)) | |
41 | + | then throw("Too much amount") | |
42 | + | else { | |
43 | + | let n = invoke(this, "parseStruct", nil, nil) | |
44 | + | if ((n == n)) | |
45 | + | then { | |
46 | + | let o = valueOrErrorMessage(getBoolean(this, b), "Storage read error") | |
47 | + | if (o) | |
48 | + | then [ScriptTransfer(k.caller, (m * 2), unit)] | |
49 | + | else nil | |
50 | + | } | |
51 | + | else throw("Strict value is not equal to itself.") | |
52 | + | } | |
59 | 53 | } | |
60 | 54 | ||
61 | 55 |
github/deemru/w8io/026f985 26.86 ms ◑