tx · BwE16QDFubJDYmNhmWhHByY3ywxGN7wyXpWWXn1TkfcX 3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep: -0.01400000 Waves 2019.07.12 13:39 [582402] smart account 3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep > SELF 0.00000000 Waves
{ "type": 13, "id": "BwE16QDFubJDYmNhmWhHByY3ywxGN7wyXpWWXn1TkfcX", "fee": 1400000, "feeAssetId": null, "timestamp": 1562927982863, "version": 1, "sender": "3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep", "senderPublicKey": "BJAeTqNbDSA5FiYihZZaSWvD6XL5XjpqVXbTGerBJjRK", "proofs": [ "4D2MdndQf6BqohLBvnvoLhMtPf6cH8TpbNE23mE27zairrQtdfwaPCXU79nwxFxsu7HALeZH18BieZWZM4xVm3sm" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAAAp0b2tlbklkRGVmAQAAACCU1B7l35UfeySUCJ5Oe8nTMKHr4huFqp+vPk8CQCqTZQEAAAASdXNlckhhc0FkbWluQWNjZXNzAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXMBAAAABGFkZHIAAAACAAAAB3Rva2VuSWQAAAADcGFyCQABLAAAAAIJAAEsAAAAAgkAAlgAAAABBQAAAAd0b2tlbklkAgAAAAFfBQAAAANwYXIAAAADAAAAAWkBAAAAA2JldAAAAAEAAAANdG9rZW5JZFN0cmluZwQAAAAHdG9rZW5JZAkAAZsAAAABBQAAAA10b2tlbklkU3RyaW5nCQAAAgAAAAEJAAJYAAAAAQUAAAAHdG9rZW5JZAAAAAFpAQAAAAVzdGFydAAAAAIAAAAKc3RhcnRQcmljZQAAAA9hdWN0aW9uRHVyYXRpb24EAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50BAAAAAd0b2tlbklkCQEAAAAHZXh0cmFjdAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZA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AgAAABIgbWludXRlcyByZW1haW5pbmcEAAAAC21heEJldE93bmVyCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABCQABmwAAAAEJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMJAQAAAARhZGRyAAAAAgUAAAAHdG9rZW5JZAIAAAALbWF4QmV0T3duZXIJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAEYWRkcgAAAAIFAAAAB3Rva2VuSWQCAAAABXN0YXJ0AAAAAAAAAAAABQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAALbWF4QmV0T3duZXIAAAAAAAAAAAEFAAAAB3Rva2VuSWQFAAAAA25pbAAAAAB64+2I", "chainId": 84, "height": 582402, "spentComplexity": 0 } View: original | compacted Prev: 38MWWQv1Ebp7yD5uKJecxBb7w73wuqnGpMrX6ZNVJeLV Next: 6GuwfUiDWFgUSiNJmohG8oD4NqnT4CqYxMoac4nv5Zcf Diff:
Old | New | Differences | |
---|---|---|---|
12 | 12 | @Callable(g) | |
13 | 13 | func bet (h) = { | |
14 | 14 | let e = toBytes(h) | |
15 | - | let i = getIntegerValue(this, d(e, "start")) | |
16 | - | let j = (height - i) | |
17 | - | let k = extract(getInteger(this, d(e, "maxBet"))) | |
18 | - | let l = addressFromPublicKey(toBytes(getStringValue(this, d(e, "maxBetOwner")))) | |
19 | - | let m = extract(g.payment) | |
20 | - | if ((j > 20000)) | |
21 | - | then throw("The betting was closed") | |
22 | - | else if (!(isDefined(m.assetId))) | |
23 | - | then { | |
24 | - | let n = m.amount | |
25 | - | if ((n > k)) | |
26 | - | then ScriptResult(WriteSet([DataEntry(d(e, "maxBet"), n), DataEntry(d(e, "maxBetOwner"), toBase58String(g.callerPublicKey))]), TransferSet([ScriptTransfer(l, k, unit)])) | |
27 | - | else throw("Your bet isn't the max bet") | |
28 | - | } | |
29 | - | else throw("You need to place a bet using waves currency") | |
15 | + | throw(toBase58String(e)) | |
30 | 16 | } | |
31 | 17 | ||
32 | 18 | ||
33 | 19 | ||
34 | 20 | @Callable(g) | |
35 | - | func start ( | |
36 | - | let | |
37 | - | let e = extract( | |
21 | + | func start (i,j) = { | |
22 | + | let k = extract(g.payment) | |
23 | + | let e = extract(k.assetId) | |
38 | 24 | if (isDefined(e)) | |
39 | - | then WriteSet([DataEntry(d(e, "start"), height), DataEntry(d(e, "startPrice"), | |
25 | + | then WriteSet([DataEntry(d(e, "start"), height), DataEntry(d(e, "startPrice"), i), DataEntry(d(e, "duration"), j), DataEntry(d(e, "maxBetOwner"), toBase58String(g.callerPublicKey))]) | |
40 | 26 | else throw("You can't sell waves using the auction") | |
41 | 27 | } | |
42 | 28 | ||
44 | 30 | ||
45 | 31 | @Callable(g) | |
46 | 32 | func finish (e) = { | |
47 | - | let | |
48 | - | let | |
49 | - | if (( | |
50 | - | then throw((("The auction cannot be finished yet! " + toString( | |
33 | + | let l = (getIntegerValue(this, d(e, "start")) - height) | |
34 | + | let m = (getIntegerValue(this, d(e, "duration")) - l) | |
35 | + | if ((m > 0)) | |
36 | + | then throw((("The auction cannot be finished yet! " + toString(m)) + " minutes remaining")) | |
51 | 37 | else { | |
52 | - | let | |
53 | - | ScriptResult(WriteSet([DataEntry(d(e, "start"), 0)]), TransferSet([ScriptTransfer( | |
38 | + | let n = addressFromPublicKey(toBytes(getStringValue(this, d(e, "maxBetOwner")))) | |
39 | + | ScriptResult(WriteSet([DataEntry(d(e, "start"), 0)]), TransferSet([ScriptTransfer(n, 1, e)])) | |
54 | 40 | } | |
55 | 41 | } | |
56 | 42 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'B1xwWnBLB7z79VPr4sq1jBb5GDqs8TeT5jHojTdiwxfE' | |
5 | 5 | ||
6 | 6 | func b (c) = (c == this) | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func d (e,f) = ((toBase58String(e) + "_") + f) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | @Callable(g) | |
13 | 13 | func bet (h) = { | |
14 | 14 | let e = toBytes(h) | |
15 | - | let i = getIntegerValue(this, d(e, "start")) | |
16 | - | let j = (height - i) | |
17 | - | let k = extract(getInteger(this, d(e, "maxBet"))) | |
18 | - | let l = addressFromPublicKey(toBytes(getStringValue(this, d(e, "maxBetOwner")))) | |
19 | - | let m = extract(g.payment) | |
20 | - | if ((j > 20000)) | |
21 | - | then throw("The betting was closed") | |
22 | - | else if (!(isDefined(m.assetId))) | |
23 | - | then { | |
24 | - | let n = m.amount | |
25 | - | if ((n > k)) | |
26 | - | then ScriptResult(WriteSet([DataEntry(d(e, "maxBet"), n), DataEntry(d(e, "maxBetOwner"), toBase58String(g.callerPublicKey))]), TransferSet([ScriptTransfer(l, k, unit)])) | |
27 | - | else throw("Your bet isn't the max bet") | |
28 | - | } | |
29 | - | else throw("You need to place a bet using waves currency") | |
15 | + | throw(toBase58String(e)) | |
30 | 16 | } | |
31 | 17 | ||
32 | 18 | ||
33 | 19 | ||
34 | 20 | @Callable(g) | |
35 | - | func start ( | |
36 | - | let | |
37 | - | let e = extract( | |
21 | + | func start (i,j) = { | |
22 | + | let k = extract(g.payment) | |
23 | + | let e = extract(k.assetId) | |
38 | 24 | if (isDefined(e)) | |
39 | - | then WriteSet([DataEntry(d(e, "start"), height), DataEntry(d(e, "startPrice"), | |
25 | + | then WriteSet([DataEntry(d(e, "start"), height), DataEntry(d(e, "startPrice"), i), DataEntry(d(e, "duration"), j), DataEntry(d(e, "maxBetOwner"), toBase58String(g.callerPublicKey))]) | |
40 | 26 | else throw("You can't sell waves using the auction") | |
41 | 27 | } | |
42 | 28 | ||
43 | 29 | ||
44 | 30 | ||
45 | 31 | @Callable(g) | |
46 | 32 | func finish (e) = { | |
47 | - | let | |
48 | - | let | |
49 | - | if (( | |
50 | - | then throw((("The auction cannot be finished yet! " + toString( | |
33 | + | let l = (getIntegerValue(this, d(e, "start")) - height) | |
34 | + | let m = (getIntegerValue(this, d(e, "duration")) - l) | |
35 | + | if ((m > 0)) | |
36 | + | then throw((("The auction cannot be finished yet! " + toString(m)) + " minutes remaining")) | |
51 | 37 | else { | |
52 | - | let | |
53 | - | ScriptResult(WriteSet([DataEntry(d(e, "start"), 0)]), TransferSet([ScriptTransfer( | |
38 | + | let n = addressFromPublicKey(toBytes(getStringValue(this, d(e, "maxBetOwner")))) | |
39 | + | ScriptResult(WriteSet([DataEntry(d(e, "start"), 0)]), TransferSet([ScriptTransfer(n, 1, e)])) | |
54 | 40 | } | |
55 | 41 | } | |
56 | 42 | ||
57 | 43 |
github/deemru/w8io/169f3d6 63.37 ms ◑