tx · 5f5eCzdCeHc4DmjmD5RQRoLpHBDZacEjwVzPABPiWxSe 3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM: -0.02000000 Waves 2020.01.30 10:15 [876773] smart account 3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM > SELF 0.00000000 Waves
{ "type": 13, "id": "5f5eCzdCeHc4DmjmD5RQRoLpHBDZacEjwVzPABPiWxSe", "fee": 2000000, "feeAssetId": null, "timestamp": 1580368395072, "version": 1, "sender": "3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM", "senderPublicKey": "LknnJnwRo6xRdriHmjgVbRDgpexijZFTYBU3Lw4HBS1", "proofs": [ "37heJDYDZUrHNVK2M2gcPK5YUJrqPx2AMyCD3cLh2JjXsseCyy8Xb18U9s2uxHhi2YVD2xcMQiUoyUfSVyScqkKH" ], "script": "base64:AAIDAAAAAAAAACEIARIDCgEIEgQKAgEBEgMKAQgSAwoBCBIDCgEIEgMKAQgAAAABAAAAAA9hdWN0aW9uRHVyYXRpb24JAABoAAAAAgAAAAAAAAAFoAAAAAAAAAAAHgAAAAYAAAABaQEAAAAMcmVnaXN0cmF0aW9uAAAAAQAAAAh1c2VyTmFtZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBQAAAAh1c2VyTmFtZQUAAAADbmlsAAAAAWkBAAAADGJlZ2luQXVjdGlvbgAAAAIAAAAIbWluUHJpY2UAAAAIZHVyYXRpb24DCQAAZgAAAAIFAAAACGR1cmF0aW9uBQAAAA9hdWN0aW9uRHVyYXRpb24JAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABNTcGVjaWZpZWQgZHVyYXRpb24oCQABpAAAAAEFAAAACGR1cmF0aW9uAgAAAB8pIGV4Y2VlZHMgdGhlIG1heGltdW0gZHVyYXRpb24oCQ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AAAQIAAAAYQXVjdGlvbiBpcyBzdGlsbCBydW5uaW5nAwkAAAAAAAACBQAAAA1jYWxsZXJBZGRyZXNzAwkBAAAACWlzRGVmaW5lZAAAAAEFAAAADWhpZ2hlc3RCaWRkZXIJAQAAAAV2YWx1ZQAAAAEFAAAADWhpZ2hlc3RCaWRkZXIAAAAAAAAAAAAJAAACAAAAAQIAAAAoV2lubmVyIGNhbid0IHdpdGhkcmF3IHRoZSBmcm96ZW4gYmFsYW5jZQMDCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABBQAAABh0aGlzQXVjdGlvbkZyb3plbkJhbGFuY2UGCQAAAAAAAAIFAAAAGHRoaXNBdWN0aW9uRnJvemVuQmFsYW5jZQAAAAAAAAAAAAkAAAIAAAABAgAAAApObyBCYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIFAAAACWF1Y3Rpb25JZAUAAAANY2FsbGVyQWRkcmVzcwIAAAAOX2Zyb3plbkJhbGFuY2UAAAAAAAAAAAAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAEFAAAADWNhbGxlckFkZHJlc3MJAQAAAAV2YWx1ZQAAAAEFAAAAGHRoaXNBdWN0aW9uRnJvemVuQmFsYW5jZQUAAAAEdW5pdAUAAAADbmlsAAAAAHdWW8w=", "chainId": 84, "height": 876773, "spentComplexity": 0 } View: original | compacted Prev: 5X52GTmaLN6mJyxK7KqepaWvoNLAmP5zmgkhHf7HQn2J Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = (1440 * | |
4 | + | let a = (1440 * 30) | |
5 | 5 | ||
6 | 6 | @Callable(b) | |
7 | - | func beginAuction (c,d) = if ((d > a)) | |
8 | - | then throw((((("Specified duration(" + toString(d)) + ") exceeds the maximum duration(") + toString(a)) + ")")) | |
7 | + | func registration (c) = WriteSet([DataEntry(toBase58String(b.caller.bytes), c)]) | |
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | @Callable(b) | |
12 | + | func beginAuction (d,e) = if ((e > a)) | |
13 | + | then throw((((("Specified duration(" + toString(e)) + ") exceeds the maximum duration(") + toString(a)) + ")")) | |
9 | 14 | else { | |
10 | - | let | |
11 | - | let | |
12 | - | let | |
13 | - | WriteSet([DataEntry( | |
14 | - | then toBase58String(value( | |
15 | - | else throw("Item not atached")), DataEntry(( | |
15 | + | let f = toBase58String(b.transactionId) | |
16 | + | let g = (lastBlock.height + e) | |
17 | + | let h = extract(b.payment) | |
18 | + | WriteSet([DataEntry(f, f), DataEntry((f + "_endTime"), g), DataEntry((f + "_owner"), toBase58String(b.caller.bytes)), DataEntry((f + "_itemId"), if (isDefined(h.assetId)) | |
19 | + | then toBase58String(value(h.assetId)) | |
20 | + | else throw("Item not atached")), DataEntry((f + "_minPrice"), d)]) | |
16 | 21 | } | |
17 | 22 | ||
18 | 23 | ||
19 | 24 | ||
20 | 25 | @Callable(b) | |
21 | - | func bid (e) = { | |
22 | - | let g = extract(b.payment) | |
23 | - | let h = toBase58String(b.caller.bytes) | |
24 | - | let f = getIntegerValue(this, (e + "_endTime")) | |
25 | - | let c = getIntegerValue(this, (e + "_minPrice")) | |
26 | - | let i = getInteger(this, (e + "_highestBidAmt")) | |
27 | - | let j = getString(this, (e + "_highestBidder")) | |
28 | - | let k = if (isDefined(j)) | |
29 | - | then (value(j) == h) | |
30 | - | else false | |
31 | - | let l = (g.amount + (if (k) | |
32 | - | then value(i) | |
26 | + | func bid (f) = { | |
27 | + | let h = extract(b.payment) | |
28 | + | let i = toBase58String(b.caller.bytes) | |
29 | + | let g = getIntegerValue(this, (f + "_endTime")) | |
30 | + | let d = getIntegerValue(this, (f + "_minPrice")) | |
31 | + | let j = getInteger(this, (f + "_highestBidAmt")) | |
32 | + | let k = getString(this, (f + "_highestBidder")) | |
33 | + | let l = getInteger(this, ((f + i) + "_frozenBalance")) | |
34 | + | let m = (h.amount + (if (isDefined(l)) | |
35 | + | then value(l) | |
33 | 36 | else 0)) | |
34 | - | if (!(isDefined(getString(this, | |
35 | - | then throw(" | |
36 | - | else if ((lastBlock.height >= | |
37 | + | if (!(isDefined(getString(this, f)))) | |
38 | + | then throw("Invalid auction Id") | |
39 | + | else if ((lastBlock.height >= g)) | |
37 | 40 | then throw("Auction Completed") | |
38 | - | else if (if (if (!(isDefined( | |
39 | - | then ( | |
41 | + | else if (if (if (!(isDefined(j))) | |
42 | + | then (d >= m) | |
40 | 43 | else false) | |
41 | 44 | then true | |
42 | - | else if (isDefined( | |
43 | - | then (value( | |
45 | + | else if (isDefined(j)) | |
46 | + | then (value(j) >= m) | |
44 | 47 | else false) | |
45 | - | then throw(("Bid must be more then " + (if (!(isDefined(i))) | |
46 | - | then toString(c) | |
47 | - | else toString(value(i))))) | |
48 | - | else if (!(isDefined(j))) | |
49 | - | then WriteSet([DataEntry((e + "_highestBidder"), h), DataEntry((e + "_highestBidAmt"), l)]) | |
50 | - | else if (k) | |
51 | - | then WriteSet([DataEntry((e + "_highestBidAmt"), l)]) | |
52 | - | else { | |
53 | - | let m = addressFromStringValue(value(j)) | |
54 | - | ScriptResult(WriteSet([DataEntry((e + "_highestBidder"), h), DataEntry((e + "_highestBidAmt"), l)]), TransferSet([ScriptTransfer(m, value(i), unit)])) | |
55 | - | } | |
48 | + | then throw(("Bid must be more then " + (if (!(isDefined(j))) | |
49 | + | then toString(d) | |
50 | + | else toString(value(j))))) | |
51 | + | else WriteSet([DataEntry((f + "_highestBidder"), i), DataEntry((f + "_highestBidAmt"), m), DataEntry(((f + i) + "_frozenBalance"), m)]) | |
56 | 52 | } | |
57 | 53 | ||
58 | 54 | ||
59 | 55 | ||
60 | 56 | @Callable(b) | |
61 | - | func withdraw (e) = { | |
62 | - | let g = extract(b.payment) | |
63 | - | let h = toBase58String(b.caller.bytes) | |
64 | - | let f = getIntegerValue(this, (e + "_endTime")) | |
65 | - | let n = getStringValue(this, (e + "_owner")) | |
66 | - | let j = getString(this, (e + "_highestBidder")) | |
67 | - | let o = getStringValue(this, (e + "_itemId")) | |
68 | - | let i = getIntegerValue(this, (e + "_highestBidAmt")) | |
69 | - | let p = addressFromStringValue(value(j)) | |
70 | - | let q = addressFromStringValue(value(n)) | |
71 | - | let r = addressFromStringValue(value(o)) | |
72 | - | if ((f > lastBlock.height)) | |
73 | - | then throw("Auction is not finished yet") | |
74 | - | else if (!(isDefined(j))) | |
75 | - | then if (!(isDefined(getBoolean(this, (e + "_status"))))) | |
76 | - | then throw("Owner already withdrawn the item") | |
77 | - | else ScriptResult(WriteSet([DataEntry((e + "_status"), true)]), TransferSet([ScriptTransfer(q, 1, base58'itemAddr')])) | |
78 | - | else if (isDefined(getBoolean(this, (e + "_status")))) | |
79 | - | then throw("The item is transfered to the highest bidder and the bid amount is transfered to the owner") | |
80 | - | else ScriptResult(WriteSet([DataEntry((e + "_status"), true)]), TransferSet([ScriptTransfer(p, 1, base58'itemAddr'), ScriptTransfer(q, i, unit)])) | |
57 | + | func ownerWithdraw (f) = { | |
58 | + | let i = toBase58String(b.caller.bytes) | |
59 | + | let g = getIntegerValue(this, (f + "_endTime")) | |
60 | + | let n = getString(this, (f + "_owner")) | |
61 | + | let k = getString(this, (f + "_highestBidder")) | |
62 | + | let o = getStringValue(this, (f + "_itemId")) | |
63 | + | let j = getInteger(this, (f + "_highestBidAmt")) | |
64 | + | let p = addressFromStringValue(value(n)) | |
65 | + | let q = fromBase58String(o) | |
66 | + | if (if ((i != n)) | |
67 | + | then true | |
68 | + | else !(isDefined(getString(this, f)))) | |
69 | + | then throw(if (!(isDefined(getString(this, f)))) | |
70 | + | then "Invalid auction Id" | |
71 | + | else "Access Denied") | |
72 | + | else if ((g > lastBlock.height)) | |
73 | + | then throw("Auction is still running") | |
74 | + | else if (!(isDefined(k))) | |
75 | + | then if (isDefined(getBoolean(this, (f + "_ownerWithdrawStatus")))) | |
76 | + | then throw("Item already withdrawn") | |
77 | + | else ScriptResult(WriteSet([DataEntry((f + "_ownerWithdrawStatus"), true)]), TransferSet([ScriptTransfer(p, 1, q)])) | |
78 | + | else if (isDefined(getBoolean(this, (f + "_ownerWithdrawStatus")))) | |
79 | + | then throw("The bid amount is already transfered") | |
80 | + | else ScriptResult(WriteSet([DataEntry((f + "_ownerWithdrawStatus"), true)]), TransferSet([ScriptTransfer(p, ((value(j) / 100) * 95), unit)])) | |
81 | + | } | |
82 | + | ||
83 | + | ||
84 | + | ||
85 | + | @Callable(b) | |
86 | + | func winnerWithdraw (f) = { | |
87 | + | let i = toBase58String(b.caller.bytes) | |
88 | + | let g = getIntegerValue(this, (f + "_endTime")) | |
89 | + | let k = getString(this, (f + "_highestBidder")) | |
90 | + | let o = getStringValue(this, (f + "_itemId")) | |
91 | + | let j = getInteger(this, (f + "_highestBidAmt")) | |
92 | + | let r = addressFromStringValue(value(k)) | |
93 | + | let q = fromBase58String(o) | |
94 | + | if (!(isDefined(getString(this, f)))) | |
95 | + | then throw("Invalid auction Id") | |
96 | + | else if ((i != if (isDefined(k)) | |
97 | + | then value(k) | |
98 | + | else throw("Nobody won this item"))) | |
99 | + | then throw("Access Denied") | |
100 | + | else if ((g > lastBlock.height)) | |
101 | + | then throw("Auction is still running") | |
102 | + | else if (isDefined(getBoolean(this, (f + "_winnerWithdrawStatus")))) | |
103 | + | then throw("The item already transfered") | |
104 | + | else ScriptResult(WriteSet([DataEntry((f + "_winnerWithdrawStatus"), true)]), TransferSet([ScriptTransfer(r, 1, q)])) | |
105 | + | } | |
106 | + | ||
107 | + | ||
108 | + | ||
109 | + | @Callable(b) | |
110 | + | func participantWithdraw (f) = { | |
111 | + | let i = toBase58String(b.caller.bytes) | |
112 | + | let g = getIntegerValue(this, (f + "_endTime")) | |
113 | + | let k = getString(this, (f + "_highestBidder")) | |
114 | + | let l = getInteger(this, ((f + i) + "_frozenBalance")) | |
115 | + | if (!(isDefined(getString(this, f)))) | |
116 | + | then throw("Invalid auction Id") | |
117 | + | else if ((g > lastBlock.height)) | |
118 | + | then throw("Auction is still running") | |
119 | + | else if ((i == (if (isDefined(k)) | |
120 | + | then value(k) | |
121 | + | else 0))) | |
122 | + | then throw("Winner can't withdraw the frozen balance") | |
123 | + | else if (if (!(isDefined(l))) | |
124 | + | then true | |
125 | + | else (l == 0)) | |
126 | + | then throw("No Balance") | |
127 | + | else ScriptResult(WriteSet([DataEntry(((f + i) + "_frozenBalance"), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(i), value(l), unit)])) | |
81 | 128 | } | |
82 | 129 | ||
83 | 130 |
github/deemru/w8io/169f3d6 48.81 ms ◑