tx · AND3yuGwTZHnG2ogkkesA8Sum8YnZKZnHzManXpPFyNN 3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM: -0.01500000 Waves 2019.12.14 09:42 [808189] smart account 3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM > SELF 0.00000000 Waves
{ "type": 13, "id": "AND3yuGwTZHnG2ogkkesA8Sum8YnZKZnHzManXpPFyNN", "fee": 1500000, "feeAssetId": null, "timestamp": 1576305802782, "version": 1, "sender": "3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM", "senderPublicKey": "LknnJnwRo6xRdriHmjgVbRDgpexijZFTYBU3Lw4HBS1", "proofs": [ "BsSWsPbpLRZM7Xu1RC9akvNsKToeMhuoNhCyTWJmqBvn6WKSNiTLEYdKfnCyCKTQgeUFS4VdcTs5CCbKgMggkCs" ], "script": "base64:AAIDAAAAAAAAABIIARIECgIBARIDCgEIEgMKAQgAAAABAAAAAA9hdWN0aW9uRHVyYXRpb24JAABoAAAAAgAAAAAAAAAFoAAAAAAAAAAAAQAAAAMAAAABaQEAAAAMYmVnaW5BdWN0aW9uAAAAAgAAAAhtaW5QcmljZQAAAAhkdXJhdGlvbgMJAABmAAAAAgUAAAAIZHVyYXRpb24FAAAAD2F1Y3Rpb25EdXJhdGlvbgkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAE1NwZWNpZmllZCBkdXJhdGlvbigJAAGkAAAAAQUAAAAIZHVyYXRpb24CAAAAHykgZXhjZWVkcyB0aGUgbWF4aW11bSBkdXJhdGlvbigJAAGkAAAAAQUAAAAPYXVjdGlvbkR1cmF0aW9uAgAAAAEpBAAAAAlhdWN0aW9uSWQJAAJYAAAAAQgFAAAAAWkAAAANdHJhbnNhY3Rpb25JZAQAAAAHZW5kVGltZQkAAGQAAAACCAUAAAAJbGFzdEJsb2NrAAAABmhlaWdodAUAAAAIZHVyYXRpb24EAAAAA3BtdAkBAAAAB2V4dHJhY3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AAB19zdGF0dXMGBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAARaGlnaGVzdEJpZGRlckFkZHIAAAAAAAAAAAEBAAAABlQfWoIY8QkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAlvd25lckFkZHIFAAAADWhpZ2hlc3RCaWRBbXQFAAAABHVuaXQFAAAAA25pbAAAAACWpL/d", "chainId": 84, "height": 808189, "spentComplexity": 0 } View: original | compacted Prev: 2jwkjsnqP3zaLdpLUH7xqg9teYSeBcw4Bs74PZ1mAKUJ Next: CAVVBiWYDsZPeCuDfqHbPZsz7ucTjeQq8C2dCxsHkGLW Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | let a = (1440 * 1) | |
5 | 5 | ||
6 | 6 | @Callable(b) | |
7 | - | func bid (c) = { | |
8 | - | let d = extract(b.payment) | |
9 | - | let e = toBase58String(b.caller.bytes) | |
10 | - | let f = getIntegerValue(this, (c + "_endTime")) | |
11 | - | let g = getIntegerValue(this, (c + "_minPrice")) | |
12 | - | let h = getInteger(this, (c + "_highestBidAmt")) | |
13 | - | let i = getString(this, (c + "_highestBidder")) | |
14 | - | let j = if (isDefined(i)) | |
15 | - | then (value(i) == e) | |
7 | + | func beginAuction (c,d) = if ((d > a)) | |
8 | + | then throw((((("Specified duration(" + toString(d)) + ") exceeds the maximum duration(") + toString(a)) + ")")) | |
9 | + | else { | |
10 | + | let e = toBase58String(b.transactionId) | |
11 | + | let f = (lastBlock.height + d) | |
12 | + | let g = extract(b.payment) | |
13 | + | WriteSet([DataEntry(e, e), DataEntry((e + "_endTime"), f), DataEntry((e + "_owner"), toBase58String(b.caller.bytes)), DataEntry((e + "_itemId"), if (isDefined(g.assetId)) | |
14 | + | then toBase58String(value(g.assetId)) | |
15 | + | else throw("Item not atached")), DataEntry((e + "_minPrice"), c)]) | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | @Callable(b) | |
21 | + | func bid (e) = { | |
22 | + | let h = toBase58String(b.caller.bytes) | |
23 | + | let f = getIntegerValue(this, (e + "_endTime")) | |
24 | + | let c = getIntegerValue(this, (e + "_minPrice")) | |
25 | + | let i = getInteger(this, (e + "_highestBidAmt")) | |
26 | + | let j = getString(this, (e + "_highestBidder")) | |
27 | + | let k = if (isDefined(j)) | |
28 | + | then (value(j) == h) | |
16 | 29 | else false | |
17 | - | let | |
18 | - | then value( | |
30 | + | let l = (1000000 + (if (k) | |
31 | + | then value(i) | |
19 | 32 | else 0)) | |
20 | - | if (!(isDefined(getIntegerValue(this, | |
33 | + | if (!(isDefined(getIntegerValue(this, e)))) | |
21 | 34 | then throw("Auction Id not found") | |
22 | 35 | else if ((lastBlock.height >= f)) | |
23 | 36 | then throw("Auction Completed") | |
24 | - | else if (if (if (!(isDefined( | |
25 | - | then ( | |
37 | + | else if (if (if (!(isDefined(i))) | |
38 | + | then (c >= l) | |
26 | 39 | else false) | |
27 | 40 | then true | |
28 | - | else if (isDefined( | |
29 | - | then (value( | |
41 | + | else if (isDefined(i)) | |
42 | + | then (value(i) >= l) | |
30 | 43 | else false) | |
31 | - | then throw(("Bid must be more then " + (if (!(isDefined( | |
32 | - | then toString( | |
33 | - | else toString(value( | |
34 | - | else if (!(isDefined( | |
35 | - | then WriteSet([DataEntry(( | |
36 | - | else if ( | |
37 | - | then WriteSet([DataEntry(( | |
44 | + | then throw(("Bid must be more then " + (if (!(isDefined(i))) | |
45 | + | then toString(c) | |
46 | + | else toString(value(i))))) | |
47 | + | else if (!(isDefined(j))) | |
48 | + | then WriteSet([DataEntry((e + "_highestBidder"), h), DataEntry((e + "_highestBidAmt"), l)]) | |
49 | + | else if (k) | |
50 | + | then WriteSet([DataEntry((e + "_highestBidAmt"), l)]) | |
38 | 51 | else { | |
39 | - | let | |
40 | - | ScriptResult(WriteSet([DataEntry(( | |
52 | + | let m = addressFromStringValue(value(j)) | |
53 | + | ScriptResult(WriteSet([DataEntry((e + "_highestBidder"), h), DataEntry((e + "_highestBidAmt"), l)]), TransferSet([ScriptTransfer(m, value(i), unit)])) | |
41 | 54 | } | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | @Callable(b) | |
60 | + | func withdraw (e) = { | |
61 | + | let g = extract(b.payment) | |
62 | + | let h = toBase58String(b.caller.bytes) | |
63 | + | let f = getIntegerValue(this, (e + "_endTime")) | |
64 | + | let n = getStringValue(this, (e + "_owner")) | |
65 | + | let j = getString(this, (e + "_highestBidder")) | |
66 | + | let o = getStringValue(this, (e + "_itemId")) | |
67 | + | let i = getIntegerValue(this, (e + "_highestBidAmt")) | |
68 | + | let p = addressFromStringValue(value(j)) | |
69 | + | let q = addressFromStringValue(value(n)) | |
70 | + | let r = addressFromStringValue(value(o)) | |
71 | + | if ((f > lastBlock.height)) | |
72 | + | then throw("Auction is not finished yet") | |
73 | + | else if (!(isDefined(j))) | |
74 | + | then if (!(isDefined(getBoolean(this, (e + "_status"))))) | |
75 | + | then throw("Owner already withdrawn the item") | |
76 | + | else ScriptResult(WriteSet([DataEntry((e + "_status"), true)]), TransferSet([ScriptTransfer(q, 1, base58'itemAddr')])) | |
77 | + | else if (isDefined(getBoolean(this, (e + "_status")))) | |
78 | + | then throw("The item is transfered to the highest bidder and the bid amount is transfered to the owner") | |
79 | + | else ScriptResult(WriteSet([DataEntry((e + "_status"), true)]), TransferSet([ScriptTransfer(p, 1, base58'itemAddr'), ScriptTransfer(q, i, unit)])) | |
42 | 80 | } | |
43 | 81 | ||
44 | 82 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = (1440 * 1) | |
5 | 5 | ||
6 | 6 | @Callable(b) | |
7 | - | func bid (c) = { | |
8 | - | let d = extract(b.payment) | |
9 | - | let e = toBase58String(b.caller.bytes) | |
10 | - | let f = getIntegerValue(this, (c + "_endTime")) | |
11 | - | let g = getIntegerValue(this, (c + "_minPrice")) | |
12 | - | let h = getInteger(this, (c + "_highestBidAmt")) | |
13 | - | let i = getString(this, (c + "_highestBidder")) | |
14 | - | let j = if (isDefined(i)) | |
15 | - | then (value(i) == e) | |
7 | + | func beginAuction (c,d) = if ((d > a)) | |
8 | + | then throw((((("Specified duration(" + toString(d)) + ") exceeds the maximum duration(") + toString(a)) + ")")) | |
9 | + | else { | |
10 | + | let e = toBase58String(b.transactionId) | |
11 | + | let f = (lastBlock.height + d) | |
12 | + | let g = extract(b.payment) | |
13 | + | WriteSet([DataEntry(e, e), DataEntry((e + "_endTime"), f), DataEntry((e + "_owner"), toBase58String(b.caller.bytes)), DataEntry((e + "_itemId"), if (isDefined(g.assetId)) | |
14 | + | then toBase58String(value(g.assetId)) | |
15 | + | else throw("Item not atached")), DataEntry((e + "_minPrice"), c)]) | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | @Callable(b) | |
21 | + | func bid (e) = { | |
22 | + | let h = toBase58String(b.caller.bytes) | |
23 | + | let f = getIntegerValue(this, (e + "_endTime")) | |
24 | + | let c = getIntegerValue(this, (e + "_minPrice")) | |
25 | + | let i = getInteger(this, (e + "_highestBidAmt")) | |
26 | + | let j = getString(this, (e + "_highestBidder")) | |
27 | + | let k = if (isDefined(j)) | |
28 | + | then (value(j) == h) | |
16 | 29 | else false | |
17 | - | let | |
18 | - | then value( | |
30 | + | let l = (1000000 + (if (k) | |
31 | + | then value(i) | |
19 | 32 | else 0)) | |
20 | - | if (!(isDefined(getIntegerValue(this, | |
33 | + | if (!(isDefined(getIntegerValue(this, e)))) | |
21 | 34 | then throw("Auction Id not found") | |
22 | 35 | else if ((lastBlock.height >= f)) | |
23 | 36 | then throw("Auction Completed") | |
24 | - | else if (if (if (!(isDefined( | |
25 | - | then ( | |
37 | + | else if (if (if (!(isDefined(i))) | |
38 | + | then (c >= l) | |
26 | 39 | else false) | |
27 | 40 | then true | |
28 | - | else if (isDefined( | |
29 | - | then (value( | |
41 | + | else if (isDefined(i)) | |
42 | + | then (value(i) >= l) | |
30 | 43 | else false) | |
31 | - | then throw(("Bid must be more then " + (if (!(isDefined( | |
32 | - | then toString( | |
33 | - | else toString(value( | |
34 | - | else if (!(isDefined( | |
35 | - | then WriteSet([DataEntry(( | |
36 | - | else if ( | |
37 | - | then WriteSet([DataEntry(( | |
44 | + | then throw(("Bid must be more then " + (if (!(isDefined(i))) | |
45 | + | then toString(c) | |
46 | + | else toString(value(i))))) | |
47 | + | else if (!(isDefined(j))) | |
48 | + | then WriteSet([DataEntry((e + "_highestBidder"), h), DataEntry((e + "_highestBidAmt"), l)]) | |
49 | + | else if (k) | |
50 | + | then WriteSet([DataEntry((e + "_highestBidAmt"), l)]) | |
38 | 51 | else { | |
39 | - | let | |
40 | - | ScriptResult(WriteSet([DataEntry(( | |
52 | + | let m = addressFromStringValue(value(j)) | |
53 | + | ScriptResult(WriteSet([DataEntry((e + "_highestBidder"), h), DataEntry((e + "_highestBidAmt"), l)]), TransferSet([ScriptTransfer(m, value(i), unit)])) | |
41 | 54 | } | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | @Callable(b) | |
60 | + | func withdraw (e) = { | |
61 | + | let g = extract(b.payment) | |
62 | + | let h = toBase58String(b.caller.bytes) | |
63 | + | let f = getIntegerValue(this, (e + "_endTime")) | |
64 | + | let n = getStringValue(this, (e + "_owner")) | |
65 | + | let j = getString(this, (e + "_highestBidder")) | |
66 | + | let o = getStringValue(this, (e + "_itemId")) | |
67 | + | let i = getIntegerValue(this, (e + "_highestBidAmt")) | |
68 | + | let p = addressFromStringValue(value(j)) | |
69 | + | let q = addressFromStringValue(value(n)) | |
70 | + | let r = addressFromStringValue(value(o)) | |
71 | + | if ((f > lastBlock.height)) | |
72 | + | then throw("Auction is not finished yet") | |
73 | + | else if (!(isDefined(j))) | |
74 | + | then if (!(isDefined(getBoolean(this, (e + "_status"))))) | |
75 | + | then throw("Owner already withdrawn the item") | |
76 | + | else ScriptResult(WriteSet([DataEntry((e + "_status"), true)]), TransferSet([ScriptTransfer(q, 1, base58'itemAddr')])) | |
77 | + | else if (isDefined(getBoolean(this, (e + "_status")))) | |
78 | + | then throw("The item is transfered to the highest bidder and the bid amount is transfered to the owner") | |
79 | + | else ScriptResult(WriteSet([DataEntry((e + "_status"), true)]), TransferSet([ScriptTransfer(p, 1, base58'itemAddr'), ScriptTransfer(q, i, unit)])) | |
42 | 80 | } | |
43 | 81 | ||
44 | 82 |
github/deemru/w8io/169f3d6 56.35 ms ◑