tx · 96b1MAqmA3kLyM5oU9jNZiPssvEMFAqg6NTpe8U7iXBD

3N8wF4ntF9niEgikocU8yb1UU9spbdCtWsh:  -0.01400000 Waves

2022.02.22 20:48 [1935180] smart account 3N8wF4ntF9niEgikocU8yb1UU9spbdCtWsh > SELF 0.00000000 Waves

{ "type": 13, "id": "96b1MAqmA3kLyM5oU9jNZiPssvEMFAqg6NTpe8U7iXBD", "fee": 1400000, "feeAssetId": null, "timestamp": 1645552112835, "version": 2, "chainId": 84, "sender": "3N8wF4ntF9niEgikocU8yb1UU9spbdCtWsh", "senderPublicKey": "HD1V9wMeKPrrSPB7aVX6wDgfTgYayNB6vb7LHkVJZzvV", "proofs": [ "5FUKr671AHZe9psbGwvpRaqA7ByMH554gVrjPHUSDKXx1fYwuYYRz4eSUCU47BenSrDKEFx87QwTjPA8EJrUCvSi" ], "script": "base64:AAIDAAAAAAAAABMIARIFCgMBAQgSAwoBCBIDCgEIAAAAAQAAAAASbWF4QXVjdGlvbkR1cmF0aW9uAAAAAAAAAfpAAAAAAwAAAAFpAQAAAAxzdGFydEF1Y3Rpb24AAAADAAAACGR1cmF0aW9uAAAACnN0YXJ0UHJpY2UAAAAMcHJpY2VBc3NldElkBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAJYXVjdGlvbklkCQACWAAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQEAAAACWVuZEhlaWdodAkAAGQAAAACCAUAAAAJbGFzdEJsb2NrAAAABmhlaWdodAUAAAAIZHVyYXRpb24EAAAAC29yZ2FuaXNlcmlkCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAD0F1Y3Rpb25kdXJhdGlvbgkBAAAACURhdGFFbnRyeQAAAAIFAAAACWF1Y3Rpb25JZAUAAAAJZW5kSGVpZ2h0BAAAAAlvcmdhbmlzZXIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAACW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yaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAlhdWN0aW9uSWQCAAAAC19sb3RfcGFzc2VkCQACWAAAAAEIBQAAAAp3aW5uZXJBZGRyAAAABWJ5dGVzBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAKd2lubmVyQWRkcgUAAAAJbG90QW1vdW50BQAAAAhsb3RBc3NldAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAA1vcmdhbml6ZXJBZGRyCQAAaQAAAAIJAABoAAAAAgUAAAAJd2luQW1vdW50AAAAAAAAAABfAAAAAAAAAABkBQAAAApwcmljZUFzc2V0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEBAAAAID2xrnYaAthJk220/tR8xWM8pBKKQq65QwpEXJTVZQpvCQAAaQAAAAIJAABoAAAAAgUAAAAJd2luQW1vdW50AAAAAAAAAAAFAAAAAAAAAABkBQAAAApwcmljZUFzc2V0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlebYUtR0=", "height": 1935180, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 13TDzYmi598xrGEXTyhxfTyhdVjJaRPC9SUE4m58K2EJ Next: 6uwZMkyvAptbq46j3GbFN9Dca8jXwAnrUaLF4YPaV8Bn Diff:
OldNewDifferences
1313 let organiser = DataEntry((auctionId + "_organizer"), organiserid)
1414 let lotassetid = DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId))
1515 then toBase58String(value(pmt.assetId))
16- else "TN")
16+ else "WAVES")
1717 let lotamount = DataEntry((auctionId + "_lot_amount"), pmt.amount)
1818 let startprice = DataEntry((auctionId + "_startPrice"), startPrice)
1919 let priceassetid = DataEntry((auctionId + "_priceAssetId"), priceAssetId)
2929 let pmt = extract(i.payment)
3030 let pmtAssetIdStr = if (isDefined(pmt.assetId))
3131 then toBase58String(value(pmt.assetId))
32- else "TN"
32+ else "WAVES"
3333 let callerAddressStr = toBase58String(i.caller.bytes)
3434 let endHeight = getIntegerValue(this, auctionId)
3535 let startPrice = getIntegerValue(this, (auctionId + "_startPrice"))
6262 then WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)])
6363 else {
6464 let previousBidderAddr = addressFromStringValue(value(winner))
65- let priceAsset = if (if ((priceAssetId == "TN"))
65+ let priceAsset = if (if ((priceAssetId == "WAVES"))
6666 then true
6767 else (priceAssetId == ""))
6868 then unit
7878 let pmt = extract(i.payment)
7979 let pmtAssetIdStr = if (isDefined(pmt.assetId))
8080 then toBase58String(value(pmt.assetId))
81- else "TN"
81+ else "WAVES"
8282 let callerAddressStr = toBase58String(i.caller.bytes)
8383 let endHeight = getIntegerValue(this, auctionId)
8484 let organizer = getStringValue(this, (auctionId + "_organizer"))
8787 let lotAmount = getIntegerValue(this, (auctionId + "_lot_amount"))
8888 let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
8989 let winAmount = getIntegerValue(this, (auctionId + "_winAmount"))
90- let lotAsset = if ((lotAssetId == "TN"))
90+ let lotAsset = if ((lotAssetId == "WAVES"))
9191 then unit
9292 else fromBase58String(lotAssetId)
93- let priceAsset = if (if ((priceAssetId == "TN"))
93+ let priceAsset = if (if ((priceAssetId == "WAVES"))
9494 then true
9595 else (priceAssetId == ""))
9696 then unit
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let maxAuctionDuration = 129600
55
66 @Callable(i)
77 func startAuction (duration,startPrice,priceAssetId) = {
88 let pmt = extract(i.payment)
99 let auctionId = toBase58String(i.transactionId)
1010 let endHeight = (lastBlock.height + duration)
1111 let organiserid = toBase58String(i.caller.bytes)
1212 let Auctionduration = DataEntry(auctionId, endHeight)
1313 let organiser = DataEntry((auctionId + "_organizer"), organiserid)
1414 let lotassetid = DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId))
1515 then toBase58String(value(pmt.assetId))
16- else "TN")
16+ else "WAVES")
1717 let lotamount = DataEntry((auctionId + "_lot_amount"), pmt.amount)
1818 let startprice = DataEntry((auctionId + "_startPrice"), startPrice)
1919 let priceassetid = DataEntry((auctionId + "_priceAssetId"), priceAssetId)
2020 if ((duration > maxAuctionDuration))
2121 then throw(("Duration is too long. Must be less than " + toString(maxAuctionDuration)))
2222 else WriteSet([Auctionduration, organiser, lotassetid, lotamount, startprice, priceassetid])
2323 }
2424
2525
2626
2727 @Callable(i)
2828 func bid (auctionId) = {
2929 let pmt = extract(i.payment)
3030 let pmtAssetIdStr = if (isDefined(pmt.assetId))
3131 then toBase58String(value(pmt.assetId))
32- else "TN"
32+ else "WAVES"
3333 let callerAddressStr = toBase58String(i.caller.bytes)
3434 let endHeight = getIntegerValue(this, auctionId)
3535 let startPrice = getIntegerValue(this, (auctionId + "_startPrice"))
3636 let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
3737 let winAmount = getInteger(this, (auctionId + "_winAmount"))
3838 let winner = getString(this, (auctionId + "_winner"))
3939 let bidFromTheSameUser = if (isDefined(winner))
4040 then (value(winner) == callerAddressStr)
4141 else false
4242 let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser)
4343 then value(winAmount)
4444 else 0))
4545 if ((lastBlock.height >= endHeight))
4646 then throw("Auction already finished")
4747 else if ((priceAssetId != pmtAssetIdStr))
4848 then throw((("Bid must be in asset '" + priceAssetId) + "'"))
4949 else if (if (if (isDefined(winAmount))
5050 then (value(winAmount) >= totalBidAmount)
5151 else false)
5252 then true
5353 else if (!(isDefined(winAmount)))
5454 then (startPrice >= totalBidAmount)
5555 else false)
5656 then throw(("Bid must be more then " + toString(if (isDefined(winAmount))
5757 then value(winAmount)
5858 else startPrice)))
5959 else if (if (bidFromTheSameUser)
6060 then true
6161 else !(isDefined(winner)))
6262 then WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)])
6363 else {
6464 let previousBidderAddr = addressFromStringValue(value(winner))
65- let priceAsset = if (if ((priceAssetId == "TN"))
65+ let priceAsset = if (if ((priceAssetId == "WAVES"))
6666 then true
6767 else (priceAssetId == ""))
6868 then unit
6969 else fromBase58String(priceAssetId)
7070 ScriptResult(WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)]))
7171 }
7272 }
7373
7474
7575
7676 @Callable(i)
7777 func withdraw (auctionId) = {
7878 let pmt = extract(i.payment)
7979 let pmtAssetIdStr = if (isDefined(pmt.assetId))
8080 then toBase58String(value(pmt.assetId))
81- else "TN"
81+ else "WAVES"
8282 let callerAddressStr = toBase58String(i.caller.bytes)
8383 let endHeight = getIntegerValue(this, auctionId)
8484 let organizer = getStringValue(this, (auctionId + "_organizer"))
8585 let winner = getString(this, (auctionId + "_winner"))
8686 let lotAssetId = getStringValue(this, (auctionId + "_lot_assetId"))
8787 let lotAmount = getIntegerValue(this, (auctionId + "_lot_amount"))
8888 let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
8989 let winAmount = getIntegerValue(this, (auctionId + "_winAmount"))
90- let lotAsset = if ((lotAssetId == "TN"))
90+ let lotAsset = if ((lotAssetId == "WAVES"))
9191 then unit
9292 else fromBase58String(lotAssetId)
93- let priceAsset = if (if ((priceAssetId == "TN"))
93+ let priceAsset = if (if ((priceAssetId == "WAVES"))
9494 then true
9595 else (priceAssetId == ""))
9696 then unit
9797 else fromBase58String(priceAssetId)
9898 let winnerAddr = addressFromStringValue(value(winner))
9999 let organizerAddr = addressFromStringValue(value(organizer))
100100 let betAmount = getInteger(this, ((auctionId + "_bidder_") + callerAddressStr))
101101 if ((endHeight > lastBlock.height))
102102 then throw("Auction is not finished yet")
103103 else if (!(isDefined(winner)))
104104 then if (isDefined(getString(this, (auctionId + "_lot_passed"))))
105105 then throw("Organizer has already got his lot back")
106106 else ScriptResult(WriteSet([DataEntry((auctionId + "_lot_passed"), organizer)]), TransferSet([ScriptTransfer(organizerAddr, lotAmount, lotAsset)]))
107107 else if (isDefined(getString(this, (auctionId + "_lot_passed"))))
108108 then throw("Lot is already passed to the winner, and organizer got his reward")
109109 else ScriptResult(WriteSet([DataEntry((auctionId + "_lot_passed"), toBase58String(winnerAddr.bytes))]), TransferSet([ScriptTransfer(winnerAddr, lotAmount, lotAsset), ScriptTransfer(organizerAddr, ((winAmount * 95) / 100), priceAsset), ScriptTransfer(addressFromPublicKey(base58'59q1hHBmeQgfSRst9Dn52VTBbtCu4SQ7AujhGDjHCqn6'), ((winAmount * 5) / 100), priceAsset)]))
110110 }
111111
112112
113113 @Verifier(tx)
114114 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
115115

github/deemru/w8io/026f985 
45.22 ms