tx · 38c6RNuLWNQmUAjTzA28tYath6rouwzwpDQLJ6DUefw1

3N6s7QBCvgnCNbR7r4rajA9DsejGtshaLLa:  -0.01500000 Waves

2019.12.21 15:07 [818690] smart account 3N6s7QBCvgnCNbR7r4rajA9DsejGtshaLLa > SELF 0.00000000 Waves

{ "type": 13, "id": "38c6RNuLWNQmUAjTzA28tYath6rouwzwpDQLJ6DUefw1", "fee": 1500000, "feeAssetId": null, "timestamp": 1576929837340, "version": 1, "sender": "3N6s7QBCvgnCNbR7r4rajA9DsejGtshaLLa", "senderPublicKey": "5wpzgifs7AQAB2xctYK9m7gDenQv4yCCiLcTgKQTcz9Z", "proofs": [ "uXQvHm7vTsEPEmuAdtAfwb7wL1PDsXLBcjHGMNyVRJhuokxnadaYc6nCU9Uib7FW8F14vestr2n4xhnMEopFa8n" ], "script": "base64:AAIDAAAAAAAAABwIARIDCgEIEgQKAgEBEgMKAQgSAwoBCBIDCgEIAAAAAQAAAAAPYXVjdGlvbkR1cmF0aW9uCQAAaAAAAAIAAAAAAAAABaAAAAAAAAAAAAEAAAAFAAAAAWkBAAAADHJlZ2lzdHJhdGlvbgAAAAEAAAAIdXNlck5hbWUJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwUAAAAIdXNlck5hbWUFAAAAA25pbAAAAAFpAQAAAAxiZWdpbkF1Y3Rpb24AAAACAAAACG1pblByaWNlAAAACGR1cmF0aW9uAwkAAGYAAAACBQAAAAhkdXJhdGlvbgUAAAAPYXVjdGlvbkR1cmF0aW9uCQAAAgAAAAEJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAATU3BlY2lmaWVkIGR1cmF0aW9uKAkAAaQAAAABBQAAAAhkdXJhdGlvbgIAAAAfKSBleGNlZWRzIHRoZSBtYXhpbXVtIGR1cmF0aW9uKAkAAaQAAAABBQAAAA9hd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AMFAAAAEWhpZ2hlc3RCaWRkZXJBZGRyAAAAAAAAAAABBQAAAAhpdGVtQWRkcgUAAAADbmlsAAAAAKOALIY=", "chainId": 84, "height": 818690, "spentComplexity": 0 } View: original | compacted Prev: DG2Z2mZXoJd5kijdah2tNiDVmeXp76vGEyDNbHyhd6K4 Next: D2BuoDWPC5zSLWWyoD7wQEr74rRp2yK93T5VJ9H3bhxT Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let auctionDuration = (1440 * 1)
5+
6+@Callable(i)
7+func registration (userName) = WriteSet([DataEntry(toBase58String(i.caller.bytes), userName)])
8+
9+
510
611 @Callable(i)
712 func beginAuction (minPrice,duration) = if ((duration > auctionDuration))
2328 let callerAddress = toBase58String(i.caller.bytes)
2429 let endTime = getIntegerValue(this, (auctionId + "_endTime"))
2530 let minPrice = getIntegerValue(this, (auctionId + "_minPrice"))
26- let highestBidAmt = getInteger(this, (auctionId + "_highestBidAmt"))
31+ let highestBidAmt = getIntegerValue(this, (auctionId + "_highestBidAmt"))
2732 let highestBidder = getString(this, (auctionId + "_highestBidder"))
2833 let bidFromTheSameUser = if (isDefined(highestBidder))
2934 then (value(highestBidder) == callerAddress)
5156 then WriteSet([DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)])
5257 else {
5358 let previousBidder = addressFromStringValue(value(highestBidder))
54- ScriptResult(WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidder, value(highestBidAmt), unit)]))
59+ ScriptResult(WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidder, highestBidAmt, unit)]))
5560 }
5661 }
5762
7176 if ((callerAddress != value(owner)))
7277 then throw("Access Denied")
7378 else if ((endTime > lastBlock.height))
74- then throw("Auction is not finished yet")
79+ then throw("Auction is still running")
7580 else if (!(isDefined(highestBidder)))
7681 then if (isDefined(getBoolean(this, (auctionId + "_ownerWithdrawStatus"))))
7782 then throw("Item already withdrawn")
99104 else throw("Nobody won this item")))
100105 then throw("Access Denied")
101106 else if ((endTime > lastBlock.height))
102- then throw("Auction is not finished yet")
107+ then throw("Auction is still running")
103108 else if (isDefined(getBoolean(this, (auctionId + "_winnerWithdrawStatus"))))
104109 then throw("The item already transfered")
105110 else ScriptResult(WriteSet([DataEntry((auctionId + "_winnerWithdrawStatus"), true)]), TransferSet([ScriptTransfer(highestBidderAddr, 1, itemAddr)]))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let auctionDuration = (1440 * 1)
5+
6+@Callable(i)
7+func registration (userName) = WriteSet([DataEntry(toBase58String(i.caller.bytes), userName)])
8+
9+
510
611 @Callable(i)
712 func beginAuction (minPrice,duration) = if ((duration > auctionDuration))
813 then throw((((("Specified duration(" + toString(duration)) + ") exceeds the maximum duration(") + toString(auctionDuration)) + ")"))
914 else {
1015 let auctionId = toBase58String(i.transactionId)
1116 let endTime = (lastBlock.height + duration)
1217 let pmt = extract(i.payment)
1318 WriteSet([DataEntry(auctionId, auctionId), DataEntry((auctionId + "_endTime"), endTime), DataEntry((auctionId + "_owner"), toBase58String(i.caller.bytes)), DataEntry((auctionId + "_itemId"), if (isDefined(pmt.assetId))
1419 then toBase58String(value(pmt.assetId))
1520 else throw("Item not atached")), DataEntry((auctionId + "_minPrice"), minPrice)])
1621 }
1722
1823
1924
2025 @Callable(i)
2126 func bid (auctionId) = {
2227 let pmt = extract(i.payment)
2328 let callerAddress = toBase58String(i.caller.bytes)
2429 let endTime = getIntegerValue(this, (auctionId + "_endTime"))
2530 let minPrice = getIntegerValue(this, (auctionId + "_minPrice"))
26- let highestBidAmt = getInteger(this, (auctionId + "_highestBidAmt"))
31+ let highestBidAmt = getIntegerValue(this, (auctionId + "_highestBidAmt"))
2732 let highestBidder = getString(this, (auctionId + "_highestBidder"))
2833 let bidFromTheSameUser = if (isDefined(highestBidder))
2934 then (value(highestBidder) == callerAddress)
3035 else false
3136 let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser)
3237 then value(highestBidAmt)
3338 else 0))
3439 if (!(isDefined(getString(this, auctionId))))
3540 then throw("Auction Id not found")
3641 else if ((lastBlock.height >= endTime))
3742 then throw("Auction Completed")
3843 else if (if (if (!(isDefined(highestBidAmt)))
3944 then (minPrice >= totalBidAmount)
4045 else false)
4146 then true
4247 else if (isDefined(highestBidAmt))
4348 then (value(highestBidAmt) >= totalBidAmount)
4449 else false)
4550 then throw(("Bid must be more then " + (if (!(isDefined(highestBidAmt)))
4651 then toString(minPrice)
4752 else toString(value(highestBidAmt)))))
4853 else if (!(isDefined(highestBidder)))
4954 then WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)])
5055 else if (bidFromTheSameUser)
5156 then WriteSet([DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)])
5257 else {
5358 let previousBidder = addressFromStringValue(value(highestBidder))
54- ScriptResult(WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidder, value(highestBidAmt), unit)]))
59+ ScriptResult(WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidder, highestBidAmt, unit)]))
5560 }
5661 }
5762
5863
5964
6065 @Callable(i)
6166 func ownerWithdraw (auctionId) = {
6267 let callerAddress = toBase58String(i.caller.bytes)
6368 let endTime = getIntegerValue(this, (auctionId + "_endTime"))
6469 let owner = getStringValue(this, (auctionId + "_owner"))
6570 let highestBidder = getString(this, (auctionId + "_highestBidder"))
6671 let itemId = getStringValue(this, (auctionId + "_itemId"))
6772 let highestBidAmt = getIntegerValue(this, (auctionId + "_highestBidAmt"))
6873 let highestBidderAddr = addressFromStringValue(value(highestBidder))
6974 let ownerAddr = addressFromStringValue(value(owner))
7075 let itemAddr = fromBase58String(value(itemId))
7176 if ((callerAddress != value(owner)))
7277 then throw("Access Denied")
7378 else if ((endTime > lastBlock.height))
74- then throw("Auction is not finished yet")
79+ then throw("Auction is still running")
7580 else if (!(isDefined(highestBidder)))
7681 then if (isDefined(getBoolean(this, (auctionId + "_ownerWithdrawStatus"))))
7782 then throw("Item already withdrawn")
7883 else ScriptResult(WriteSet([DataEntry((auctionId + "_ownerWithdrawStatus"), true)]), TransferSet([ScriptTransfer(ownerAddr, 1, itemAddr)]))
7984 else if (isDefined(getBoolean(this, (auctionId + "_ownerWithdrawStatus"))))
8085 then throw("The bid amount is already transfered")
8186 else ScriptResult(WriteSet([DataEntry((auctionId + "_ownerWithdrawStatus"), true)]), TransferSet([ScriptTransfer(ownerAddr, ((highestBidAmt / 100) * 95), unit)]))
8287 }
8388
8489
8590
8691 @Callable(i)
8792 func winnerWithdraw (auctionId) = {
8893 let callerAddress = toBase58String(i.caller.bytes)
8994 let endTime = getIntegerValue(this, (auctionId + "_endTime"))
9095 let owner = getStringValue(this, (auctionId + "_owner"))
9196 let highestBidder = getString(this, (auctionId + "_highestBidder"))
9297 let itemId = getStringValue(this, (auctionId + "_itemId"))
9398 let highestBidAmt = getIntegerValue(this, (auctionId + "_highestBidAmt"))
9499 let highestBidderAddr = addressFromStringValue(value(highestBidder))
95100 let ownerAddr = addressFromStringValue(value(owner))
96101 let itemAddr = fromBase58String(value(itemId))
97102 if ((callerAddress != if (isDefined(highestBidder))
98103 then value(highestBidder)
99104 else throw("Nobody won this item")))
100105 then throw("Access Denied")
101106 else if ((endTime > lastBlock.height))
102- then throw("Auction is not finished yet")
107+ then throw("Auction is still running")
103108 else if (isDefined(getBoolean(this, (auctionId + "_winnerWithdrawStatus"))))
104109 then throw("The item already transfered")
105110 else ScriptResult(WriteSet([DataEntry((auctionId + "_winnerWithdrawStatus"), true)]), TransferSet([ScriptTransfer(highestBidderAddr, 1, itemAddr)]))
106111 }
107112
108113

github/deemru/w8io/169f3d6 
35.47 ms