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