tx · AF3Uh5BTus5Nf5uBWTrHybrWt6x3K4CYTKGeoYr3TRMF 3N8wF4ntF9niEgikocU8yb1UU9spbdCtWsh: -0.01400000 Waves 2022.02.23 01:24 [1935460] smart account 3N8wF4ntF9niEgikocU8yb1UU9spbdCtWsh > SELF 0.00000000 Waves
{ "type": 13, "id": "AF3Uh5BTus5Nf5uBWTrHybrWt6x3K4CYTKGeoYr3TRMF", "fee": 1400000, "feeAssetId": null, "timestamp": 1645568637289, "version": 2, "chainId": 84, "sender": "3N8wF4ntF9niEgikocU8yb1UU9spbdCtWsh", "senderPublicKey": "HD1V9wMeKPrrSPB7aVX6wDgfTgYayNB6vb7LHkVJZzvV", "proofs": [ "5pMzrxAqY3EM7Kug7H8ktd4y3WrK2CPCCLCiG8x7eRhK5ibNkHAt32CCpifr1n29eYn9z8CdKYB9LjLRhGd9BPou" ], "script": "base64:AAIDAAAAAAAAABMIARIFCgMBAQgSAwoBCBIDCgEIAAAAAQAAAAASbWF4QXVjdGlvbkR1cmF0aW9uAAAAAAAAAfpAAAAAAwAAAAFpAQAAAAxzdGFydEF1Y3Rpb24AAAADAAAACGR1cmF0aW9uAAAACnN0YXJ0UHJpY2UAAAAMcHJpY2VBc3NldElkBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAJYXVjdGlvbklkCQACWAAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQEAAAACWVuZEhlaWdodAkAAGQAAAACCAUAAAAJbGFzdEJsb2NrAAAABmhlaWdodAUAAAAIZHVyYXRpb24EAAAAC29yZ2FuaXNlcmlkCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAD0F1Y3Rpb25kdXJhdGlvbgkBAAAACURhdGFFbnRyeQAAAAIFAAAACWF1Y3Rpb25JZAUAAAAJZW5kSGVpZ2h0BAAAAAlvcmdhbmlzZXIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAI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wYXNzZWQJAAACAAAAAQIAAABBTG90IGlzIGFscmVhZHkgcGFzc2VkIHRvIHRoZSB3aW5uZXIsIGFuZCBvcmdhbml6ZXIgZ290IGhpcyByZXdhcmQJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAACWF1Y3Rpb25JZAIAAAALX2xvdF9wYXNzZWQJAAJYAAAAAQgFAAAACndpbm5lckFkZHIAAAAFYnl0ZXMFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAp3aW5uZXJBZGRyBQAAAAlsb3RBbW91bnQFAAAACGxvdEFzc2V0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADW9yZ2FuaXplckFkZHIJAABpAAAAAgkAAGgAAAACBQAAAAl3aW5BbW91bnQAAAAAAAAAAF8AAAAAAAAAAGQFAAAACnByaWNlQXNzZXQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQEAAAAgPbGudhoC2EmTbbT+1HzFYzykEopCrrlDCkRclNVlCm8JAABpAAAAAgkAAGgAAAACBQAAAAl3aW5BbW91bnQAAAAAAAAAAAUAAAAAAAAAAGQFAAAACnByaWNlQXNzZXQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5Vbw8RA==", "height": 1935460, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6uwZMkyvAptbq46j3GbFN9Dca8jXwAnrUaLF4YPaV8Bn Next: 55F1TTY5LEyZA8gSAa6sHPQVRDcvrj3oo4QEhKrWnixZ Diff:
Old | New | Differences | |
---|---|---|---|
19 | 19 | let o = DataEntry((g + "_priceAssetId"), e) | |
20 | 20 | if ((c > a)) | |
21 | 21 | then throw(("Duration is too long. Must be less than " + toString(a))) | |
22 | - | else WriteSet([j, k, l, m, n, o]) | |
22 | + | else if ((1000 >= d)) | |
23 | + | then throw("Auction StartPrice less than 0.001") | |
24 | + | else WriteSet([j, k, l, m, n, o]) | |
23 | 25 | } | |
24 | 26 | ||
25 | 27 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = 129600 | |
5 | 5 | ||
6 | 6 | @Callable(b) | |
7 | 7 | func startAuction (c,d,e) = { | |
8 | 8 | let f = extract(b.payment) | |
9 | 9 | let g = toBase58String(b.transactionId) | |
10 | 10 | let h = (lastBlock.height + c) | |
11 | 11 | let i = toBase58String(b.caller.bytes) | |
12 | 12 | let j = DataEntry(g, h) | |
13 | 13 | let k = DataEntry((g + "_organizer"), i) | |
14 | 14 | let l = DataEntry((g + "_lot_assetId"), if (isDefined(f.assetId)) | |
15 | 15 | then toBase58String(value(f.assetId)) | |
16 | 16 | else "WAVES") | |
17 | 17 | let m = DataEntry((g + "_lot_amount"), f.amount) | |
18 | 18 | let n = DataEntry((g + "_startPrice"), d) | |
19 | 19 | let o = DataEntry((g + "_priceAssetId"), e) | |
20 | 20 | if ((c > a)) | |
21 | 21 | then throw(("Duration is too long. Must be less than " + toString(a))) | |
22 | - | else WriteSet([j, k, l, m, n, o]) | |
22 | + | else if ((1000 >= d)) | |
23 | + | then throw("Auction StartPrice less than 0.001") | |
24 | + | else WriteSet([j, k, l, m, n, o]) | |
23 | 25 | } | |
24 | 26 | ||
25 | 27 | ||
26 | 28 | ||
27 | 29 | @Callable(b) | |
28 | 30 | func bid (g) = { | |
29 | 31 | let f = extract(b.payment) | |
30 | 32 | let p = if (isDefined(f.assetId)) | |
31 | 33 | then toBase58String(value(f.assetId)) | |
32 | 34 | else "WAVES" | |
33 | 35 | let q = toBase58String(b.caller.bytes) | |
34 | 36 | let h = getIntegerValue(this, g) | |
35 | 37 | let d = getIntegerValue(this, (g + "_startPrice")) | |
36 | 38 | let e = getStringValue(this, (g + "_priceAssetId")) | |
37 | 39 | let r = getInteger(this, (g + "_winAmount")) | |
38 | 40 | let s = getString(this, (g + "_winner")) | |
39 | 41 | let t = if (isDefined(s)) | |
40 | 42 | then (value(s) == q) | |
41 | 43 | else false | |
42 | 44 | let u = (f.amount + (if (t) | |
43 | 45 | then value(r) | |
44 | 46 | else 0)) | |
45 | 47 | if ((lastBlock.height >= h)) | |
46 | 48 | then throw("Auction already finished") | |
47 | 49 | else if ((e != p)) | |
48 | 50 | then throw((("Bid must be in asset '" + e) + "'")) | |
49 | 51 | else if (if (if (isDefined(r)) | |
50 | 52 | then (value(r) >= u) | |
51 | 53 | else false) | |
52 | 54 | then true | |
53 | 55 | else if (!(isDefined(r))) | |
54 | 56 | then (d >= u) | |
55 | 57 | else false) | |
56 | 58 | then throw(("Bid must be more then " + toString(if (isDefined(r)) | |
57 | 59 | then value(r) | |
58 | 60 | else d))) | |
59 | 61 | else if (if (t) | |
60 | 62 | then true | |
61 | 63 | else !(isDefined(s))) | |
62 | 64 | then WriteSet([DataEntry((g + "_winner"), q), DataEntry((g + "_winAmount"), u)]) | |
63 | 65 | else { | |
64 | 66 | let v = addressFromStringValue(value(s)) | |
65 | 67 | let w = if (if ((e == "WAVES")) | |
66 | 68 | then true | |
67 | 69 | else (e == "")) | |
68 | 70 | then unit | |
69 | 71 | else fromBase58String(e) | |
70 | 72 | ScriptResult(WriteSet([DataEntry((g + "_winner"), q), DataEntry((g + "_winAmount"), u)]), TransferSet([ScriptTransfer(v, value(r), w)])) | |
71 | 73 | } | |
72 | 74 | } | |
73 | 75 | ||
74 | 76 | ||
75 | 77 | ||
76 | 78 | @Callable(b) | |
77 | 79 | func withdraw (g) = { | |
78 | 80 | let f = extract(b.payment) | |
79 | 81 | let p = if (isDefined(f.assetId)) | |
80 | 82 | then toBase58String(value(f.assetId)) | |
81 | 83 | else "WAVES" | |
82 | 84 | let q = toBase58String(b.caller.bytes) | |
83 | 85 | let h = getIntegerValue(this, g) | |
84 | 86 | let x = getStringValue(this, (g + "_organizer")) | |
85 | 87 | let s = getString(this, (g + "_winner")) | |
86 | 88 | let y = getStringValue(this, (g + "_lot_assetId")) | |
87 | 89 | let z = getIntegerValue(this, (g + "_lot_amount")) | |
88 | 90 | let e = getStringValue(this, (g + "_priceAssetId")) | |
89 | 91 | let r = getIntegerValue(this, (g + "_winAmount")) | |
90 | 92 | let A = if ((y == "WAVES")) | |
91 | 93 | then unit | |
92 | 94 | else fromBase58String(y) | |
93 | 95 | let w = if (if ((e == "WAVES")) | |
94 | 96 | then true | |
95 | 97 | else (e == "")) | |
96 | 98 | then unit | |
97 | 99 | else fromBase58String(e) | |
98 | 100 | let B = addressFromStringValue(value(s)) | |
99 | 101 | let C = addressFromStringValue(value(x)) | |
100 | 102 | let D = getInteger(this, ((g + "_bidder_") + q)) | |
101 | 103 | if ((h > lastBlock.height)) | |
102 | 104 | then throw("Auction is not finished yet") | |
103 | 105 | else if (!(isDefined(s))) | |
104 | 106 | then if (isDefined(getString(this, (g + "_lot_passed")))) | |
105 | 107 | then throw("Organizer has already got his lot back") | |
106 | 108 | else ScriptResult(WriteSet([DataEntry((g + "_lot_passed"), x)]), TransferSet([ScriptTransfer(C, z, A)])) | |
107 | 109 | else if (isDefined(getString(this, (g + "_lot_passed")))) | |
108 | 110 | then throw("Lot is already passed to the winner, and organizer got his reward") | |
109 | 111 | else ScriptResult(WriteSet([DataEntry((g + "_lot_passed"), toBase58String(B.bytes))]), TransferSet([ScriptTransfer(B, z, A), ScriptTransfer(C, ((r * 95) / 100), w), ScriptTransfer(addressFromPublicKey(base58'59q1hHBmeQgfSRst9Dn52VTBbtCu4SQ7AujhGDjHCqn6'), ((r * 5) / 100), w)])) | |
110 | 112 | } | |
111 | 113 | ||
112 | 114 | ||
113 | 115 | @Verifier(E) | |
114 | 116 | func F () = sigVerify(E.bodyBytes, E.proofs[0], E.senderPublicKey) | |
115 | 117 |
github/deemru/w8io/026f985 31.15 ms ◑