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