tx · FUfA6PJyTfKPvBZN2Npwh4DF2EzGLYdyLQRCbLn2fvRP 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo: -0.01000000 Waves 2022.12.02 14:42 [2342680] smart account 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo > SELF 0.00000000 Waves
{ "type": 13, "id": "FUfA6PJyTfKPvBZN2Npwh4DF2EzGLYdyLQRCbLn2fvRP", "fee": 1000000, "feeAssetId": null, "timestamp": 1669981303188, "version": 2, "chainId": 84, "sender": "3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo", "senderPublicKey": "Kwu4LYBMntApXv8t7csxV23Kvc3tvak26wMKK56tA4V", "proofs": [ "jsLnBMMzUetJzskaqf5uD7H3nLAr3tawsd1k9KfsUQrmQhArHTreLSdFPSBWTW9NwbMkY2sySrSkf5D9oRePP6A" ], "script": "base64:BgIPCAISBAoCAQESABIDCgEIAQASbWF4QXVjdGlvbkR1cmF0aW9uAAcDAWkBDHN0YXJ0QXVjdGlvbgIIZHVyYXRpb24Kc3RhcnRQcmljZQQJYXVjdGlvbklkCQDYBAEIBQFpDXRyYW5zYWN0aW9uSWQECWVuZEhlaWdodAkAZAIIBQlsYXN0QmxvY2sGaGVpZ2h0BQhkdXJhdGlvbgQDcG10CQEFdmFsdWUBCQCRAwIIBQFpCHBheW1lbnRzAAADCQBmAgUIZHVyYXRpb24FEm1heEF1Y3Rpb25EdXJhdGlvbgkAAgEJAKwCAgIoRHVyYXRpb24gaXMgdG9vIGxvbmcuIE11c3QgYmUgbGVzcyB0aGFuIAkApAMBBRJtYXhBdWN0aW9uRHVyYXRpb24JAMwIAgkBDEludGVnZXJFbnRyeQIFCWF1Y3Rpb25JZAUJZW5kSGVpZ2h0CQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUJYXVjdGlvbklkAgpfb3JnYW5pemVyCQDYBAEICAUBaQZjYWxsZXIFYnl0ZXMJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQlh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5TY3JpcHRUcmFuc2ZlcgMFCndpbm5lckFkZHIFCWxvdEFtb3VudAUIbG90QXNzZXQJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwUNb3JnYW5pemVyQWRkcgUJd2luQW1vdW50BQpwcmljZUFzc2V0BQNuaWwADP066Q==", "height": 2342680, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8XJLysmDCv7vi7bN3mN2rFaZTPiFCFWCPMzY1vKLNjFB Next: 3jZCjrdiD3B2M5AY7H6p8CXLTWPgR7fz5npy5akyrsUM Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = 7 | |
4 | 5 | ||
5 | - | ||
6 | - | @Callable(a) | |
7 | - | func startAuction (b,c) = { | |
8 | - | let d = toBase58String(a.transactionId) | |
9 | - | let e = value(a.payments[0]) | |
10 | - | [StringEntry((d + "_organizer"), toBase58String(a.caller.bytes)), IntegerEntry((d + "amount"), e.amount), IntegerEntry((d + "_startPrice"), c)] | |
6 | + | @Callable(b) | |
7 | + | func startAuction (c,d) = { | |
8 | + | let e = toBase58String(b.transactionId) | |
9 | + | let f = (lastBlock.height + c) | |
10 | + | let g = value(b.payments[0]) | |
11 | + | if ((c > a)) | |
12 | + | then throw(("Duration is too long. Must be less than " + toString(a))) | |
13 | + | else [IntegerEntry(e, f), StringEntry((e + "_organizer"), toBase58String(b.caller.bytes)), StringEntry((e + "_lot_assetId"), if (isDefined(g.assetId)) | |
14 | + | then toBase58String(value(g.assetId)) | |
15 | + | else "WAVES"), IntegerEntry((e + "_lot_amount"), g.amount), IntegerEntry((e + "_startPrice"), d)] | |
11 | 16 | } | |
12 | 17 | ||
13 | 18 | ||
14 | 19 | ||
15 | - | @Callable(a) | |
16 | - | func bid (d) = { | |
17 | - | let e = value(a.payments[0]) | |
18 | - | let f = if (isDefined(e.assetId)) | |
19 | - | then toBase58String(value(e.assetId)) | |
20 | + | @Callable(b) | |
21 | + | func bid () = { | |
22 | + | let e = toBase58String(b.transactionId) | |
23 | + | let g = value(b.payments[0]) | |
24 | + | let h = if (isDefined(g.assetId)) | |
25 | + | then toBase58String(value(g.assetId)) | |
20 | 26 | else "WAVES" | |
21 | - | let | |
22 | - | let | |
23 | - | let | |
24 | - | let | |
25 | - | let | |
26 | - | let | |
27 | - | let | |
28 | - | then (value( | |
27 | + | let i = toBase58String(b.caller.bytes) | |
28 | + | let f = getIntegerValue(this, e) | |
29 | + | let d = getIntegerValue(this, (e + "_startPrice")) | |
30 | + | let j = getStringValue(this, (e + "_priceAssetId")) | |
31 | + | let k = getInteger(this, (e + "_winAmount")) | |
32 | + | let l = getString(this, (e + "_winner")) | |
33 | + | let m = if (isDefined(l)) | |
34 | + | then (value(l) == i) | |
29 | 35 | else false | |
30 | - | let | |
31 | - | then value( | |
36 | + | let n = (g.amount + (if (m) | |
37 | + | then value(k) | |
32 | 38 | else 0)) | |
33 | - | if ((lastBlock.height >= | |
39 | + | if ((lastBlock.height >= f)) | |
34 | 40 | then throw("Auction already finished") | |
35 | - | else if (( | |
36 | - | then throw((("Bid must be in asset '" + | |
37 | - | else if (if (if (isDefined( | |
38 | - | then (value( | |
41 | + | else if ((j != h)) | |
42 | + | then throw((("Bid must be in asset '" + j) + "'")) | |
43 | + | else if (if (if (isDefined(k)) | |
44 | + | then (value(k) >= n) | |
39 | 45 | else false) | |
40 | 46 | then true | |
41 | - | else if (!(isDefined( | |
42 | - | then ( | |
47 | + | else if (!(isDefined(k))) | |
48 | + | then (d >= n) | |
43 | 49 | else false) | |
44 | - | then throw(("Bid must be more then " + toString(if (isDefined( | |
45 | - | then value( | |
46 | - | else | |
47 | - | else if (if ( | |
50 | + | then throw(("Bid must be more then " + toString(if (isDefined(k)) | |
51 | + | then value(k) | |
52 | + | else d))) | |
53 | + | else if (if (m) | |
48 | 54 | then true | |
49 | - | else !(isDefined( | |
50 | - | then [StringEntry(( | |
55 | + | else !(isDefined(l))) | |
56 | + | then [StringEntry((e + "_winner"), i), IntegerEntry((e + "_winAmount"), n)] | |
51 | 57 | else { | |
52 | - | let | |
53 | - | let | |
58 | + | let o = addressFromStringValue(value(l)) | |
59 | + | let p = if (if ((j == "WAVES")) | |
54 | 60 | then true | |
55 | - | else ( | |
61 | + | else (j == "")) | |
56 | 62 | then unit | |
57 | - | else fromBase58String( | |
58 | - | [StringEntry(( | |
63 | + | else fromBase58String(j) | |
64 | + | [StringEntry((e + "_winner"), i), IntegerEntry((e + "_winAmount"), n), ScriptTransfer(o, value(k), p)] | |
59 | 65 | } | |
66 | + | } | |
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | @Callable(b) | |
71 | + | func withdraw (e) = { | |
72 | + | let g = value(b.payments[0]) | |
73 | + | let h = if (isDefined(g.assetId)) | |
74 | + | then toBase58String(value(g.assetId)) | |
75 | + | else "WAVES" | |
76 | + | let i = toBase58String(b.caller.bytes) | |
77 | + | let f = getIntegerValue(this, e) | |
78 | + | let q = getStringValue(this, (e + "_organizer")) | |
79 | + | let l = getString(this, (e + "_winner")) | |
80 | + | let r = getStringValue(this, (e + "_lot_assetId")) | |
81 | + | let s = getIntegerValue(this, (e + "_lot_amount")) | |
82 | + | let j = getStringValue(this, (e + "_priceAssetId")) | |
83 | + | let k = getIntegerValue(this, (e + "_winAmount")) | |
84 | + | let t = if ((r == "WAVES")) | |
85 | + | then unit | |
86 | + | else fromBase58String(r) | |
87 | + | let p = if (if ((j == "WAVES")) | |
88 | + | then true | |
89 | + | else (j == "")) | |
90 | + | then unit | |
91 | + | else fromBase58String(j) | |
92 | + | let u = addressFromStringValue(value(l)) | |
93 | + | let v = addressFromStringValue(value(q)) | |
94 | + | let w = getInteger(this, ((e + "_bidder_") + i)) | |
95 | + | if ((f > lastBlock.height)) | |
96 | + | then throw("Auction is not finished yet") | |
97 | + | else if (!(isDefined(l))) | |
98 | + | then if (isDefined(getString(this, (e + "_lot_passed")))) | |
99 | + | then throw("Organizer has already got his lot back") | |
100 | + | else [StringEntry((e + "_lot_passed"), q), ScriptTransfer(v, s, t)] | |
101 | + | else if (isDefined(getString(this, (e + "_lot_passed")))) | |
102 | + | then throw("Lot is already passed to the winner, and organizer got his reward") | |
103 | + | else [StringEntry((e + "_lot_passed"), toBase58String(u.bytes)), ScriptTransfer(u, s, t), ScriptTransfer(v, k, p)] | |
60 | 104 | } | |
61 | 105 | ||
62 | 106 |
github/deemru/w8io/026f985 35.68 ms ◑