tx · 6GuwfUiDWFgUSiNJmohG8oD4NqnT4CqYxMoac4nv5Zcf

3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep:  -0.01400000 Waves

2019.07.12 13:42 [582404] smart account 3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep > SELF 0.00000000 Waves

{ "type": 13, "id": "6GuwfUiDWFgUSiNJmohG8oD4NqnT4CqYxMoac4nv5Zcf", "fee": 1400000, "feeAssetId": null, "timestamp": 1562928166335, "version": 1, "sender": "3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep", "senderPublicKey": "BJAeTqNbDSA5FiYihZZaSWvD6XL5XjpqVXbTGerBJjRK", "proofs": [ "3J66XjvuotiuRfsRnanntDGnguH8J8Wz5VSTh6z372t844g1c3y8g4USS9kMbi8JTs1CgpQ2o3TBbbJjGxDjAx9v" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAp0b2tlbklkRGVmAQAAACCU1B7l35UfeySUCJ5Oe8nTMKHr4huFqp+vPk8CQCqTZQEAAAASdXNlckhhc0FkbWluQWNjZXNzAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXMBAAAABGFkZHIAAAACAAAAB3Rva2VuSWQAAAADcGFyCQABLAAAAAIJAAEsAAAAAgkAAlgAAAABBQAAAAd0b2tlbklkAgAAAAFfBQAAAANwYXIBAAAABXNhZGRyAAAAAgAAAAd0b2tlbklkAAAAA3BhcgkAASwAAAACCQABLAAAAAIFAAAAB3Rva2VuSWQCAAAAAV8FAAAAA3BhcgAAAAMAAAABaQEAAAADYmV0AAAAAQAAAA10b2tlbklkU3RyaW5nBAAAABZzdGFydFRyYW5zYWN0aW9uSGVpZ2h0CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzCQEAAAAFc2FkZHIAAAACBQAAAA10b2tlbklkU3RyaW5nAgAAAAVzdGFydAQAAAAJdGltZURlbHRhCQAAZQAAAAIFAAA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IFAAAAB3Rva2VuSWQCAAAABXN0YXJ0BQAAAAZoZWlnaHQEAAAABWRlbHRhCQAAZQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMJAQAAAARhZGRyAAAAAgUAAAAHdG9rZW5JZAIAAAAIZHVyYXRpb24FAAAABmxlbmd0aAMJAABmAAAAAgUAAAAFZGVsdGEAAAAAAAAAAAAJAAACAAAAAQkAASwAAAACCQABLAAAAAICAAAAJFRoZSBhdWN0aW9uIGNhbm5vdCBiZSBmaW5pc2hlZCB5ZXQhIAkAAaQAAAABBQAAAAVkZWx0YQIAAAASIG1pbnV0ZXMgcmVtYWluaW5nBAAAAAttYXhCZXRPd25lcgkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQkAAZsAAAABCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzCQEAAAAEYWRkcgAAAAIFAAAAB3Rva2VuSWQCAAAAC21heEJldE93bmVyCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAABGFkZHIAAAACBQAAAAd0b2tlbklkAgAAAAVzdGFydAAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAC21heEJldE93bmVyAAAAAAAAAAABBQAAAAd0b2tlbklkBQAAAANuaWwAAAAAoUdKJQ==", "chainId": 84, "height": 582404, "spentComplexity": 0 } View: original | compacted Prev: BwE16QDFubJDYmNhmWhHByY3ywxGN7wyXpWWXn1TkfcX Next: 96xi7Diav6ZmeAvFsNFDf1YnDqRnifyxbcdUv1zJzEme Diff:
OldNewDifferences
99 func addr (tokenId,par) = ((toBase58String(tokenId) + "_") + par)
1010
1111
12+func saddr (tokenId,par) = ((tokenId + "_") + par)
13+
14+
1215 @Callable(i)
1316 func bet (tokenIdString) = {
14- let tokenId = toBytes(tokenIdString)
15- throw(toBase58String(tokenId))
17+ let startTransactionHeight = getIntegerValue(this, saddr(tokenIdString, "start"))
18+ let timeDelta = (height - startTransactionHeight)
19+ let maxBet = extract(getInteger(this, saddr(tokenIdString, "maxBet")))
20+ let maxBetOwner = addressFromPublicKey(toBytes(getStringValue(this, saddr(tokenIdString, "maxBetOwner"))))
21+ let pmt = extract(i.payment)
22+ if ((timeDelta > 20000))
23+ then throw("The betting was closed")
24+ else if (!(isDefined(pmt.assetId)))
25+ then {
26+ let price = pmt.amount
27+ if ((price > maxBet))
28+ then ScriptResult(WriteSet([DataEntry(saddr(tokenIdString, "maxBet"), price), DataEntry(saddr(tokenIdString, "maxBetOwner"), toBase58String(i.callerPublicKey))]), TransferSet([ScriptTransfer(maxBetOwner, maxBet, unit)]))
29+ else throw("Your bet isn't the max bet")
30+ }
31+ else throw("You need to place a bet using waves currency")
1632 }
1733
1834
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let tokenIdDef = base58'B1xwWnBLB7z79VPr4sq1jBb5GDqs8TeT5jHojTdiwxfE'
55
66 func userHasAdminAccess (address) = (address == this)
77
88
99 func addr (tokenId,par) = ((toBase58String(tokenId) + "_") + par)
1010
1111
12+func saddr (tokenId,par) = ((tokenId + "_") + par)
13+
14+
1215 @Callable(i)
1316 func bet (tokenIdString) = {
14- let tokenId = toBytes(tokenIdString)
15- throw(toBase58String(tokenId))
17+ let startTransactionHeight = getIntegerValue(this, saddr(tokenIdString, "start"))
18+ let timeDelta = (height - startTransactionHeight)
19+ let maxBet = extract(getInteger(this, saddr(tokenIdString, "maxBet")))
20+ let maxBetOwner = addressFromPublicKey(toBytes(getStringValue(this, saddr(tokenIdString, "maxBetOwner"))))
21+ let pmt = extract(i.payment)
22+ if ((timeDelta > 20000))
23+ then throw("The betting was closed")
24+ else if (!(isDefined(pmt.assetId)))
25+ then {
26+ let price = pmt.amount
27+ if ((price > maxBet))
28+ then ScriptResult(WriteSet([DataEntry(saddr(tokenIdString, "maxBet"), price), DataEntry(saddr(tokenIdString, "maxBetOwner"), toBase58String(i.callerPublicKey))]), TransferSet([ScriptTransfer(maxBetOwner, maxBet, unit)]))
29+ else throw("Your bet isn't the max bet")
30+ }
31+ else throw("You need to place a bet using waves currency")
1632 }
1733
1834
1935
2036 @Callable(i)
2137 func start (startPrice,auctionDuration) = {
2238 let pmt = extract(i.payment)
2339 let tokenId = extract(pmt.assetId)
2440 if (isDefined(tokenId))
2541 then WriteSet([DataEntry(addr(tokenId, "start"), height), DataEntry(addr(tokenId, "startPrice"), startPrice), DataEntry(addr(tokenId, "duration"), auctionDuration), DataEntry(addr(tokenId, "maxBetOwner"), toBase58String(i.callerPublicKey))])
2642 else throw("You can't sell waves using the auction")
2743 }
2844
2945
3046
3147 @Callable(i)
3248 func finish (tokenId) = {
3349 let length = (getIntegerValue(this, addr(tokenId, "start")) - height)
3450 let delta = (getIntegerValue(this, addr(tokenId, "duration")) - length)
3551 if ((delta > 0))
3652 then throw((("The auction cannot be finished yet! " + toString(delta)) + " minutes remaining"))
3753 else {
3854 let maxBetOwner = addressFromPublicKey(toBytes(getStringValue(this, addr(tokenId, "maxBetOwner"))))
3955 ScriptResult(WriteSet([DataEntry(addr(tokenId, "start"), 0)]), TransferSet([ScriptTransfer(maxBetOwner, 1, tokenId)]))
4056 }
4157 }
4258
4359

github/deemru/w8io/169f3d6 
38.26 ms