tx · 6dbArGBxr88325yTEfRadVdVYkQP8mW1oGa4kwWQd49T

3N66job2d8LT5VRVrR6sVrm5TetTVjHiBgK:  -0.01000000 Waves

2022.11.01 12:58 [2297894] smart account 3N66job2d8LT5VRVrR6sVrm5TetTVjHiBgK > SELF 0.00000000 Waves

{ "type": 13, "id": "6dbArGBxr88325yTEfRadVdVYkQP8mW1oGa4kwWQd49T", "fee": 1000000, "feeAssetId": null, "timestamp": 1667296694793, "version": 2, "chainId": 84, "sender": "3N66job2d8LT5VRVrR6sVrm5TetTVjHiBgK", "senderPublicKey": "HtiQy2G7cXKiGN6z5x5aCuKqMKhLWN6RQCkkrstfEnpQ", "proofs": [ "3oU4ywinzwkbbV6FKpmaph8AtFLDBYyY3Gpwj9DFz9izPViLGLj2Z6AgGNLeApUCXc6whp5iTSAaGyV8iYW3dAxu" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAEAAAAAAluZnRJc3N1ZWQCAAAACXdhc0luaXRlZAAAAAAKbmZ0QXNzZXRJZAIAAAALbmZ0X2Fzc2V0SWQAAAAAD1RvdGFsbmZ0U3dhcHBlZAIAAAAMdG90YWxTd2FwcGVkAAAAAA1vbGRuZnRBc3NldElkAQAAAAAAAAACAAAAAWkBAAAAC2lzc3VlTmV3bmZ0AAAAAAMJAQAAAAIhPQAAAAIJAAQgAAAAAQUAAAAJbmZ0SXNzdWVkBQAAAAR1bml0CQAAAgAAAAEJAAEsAAAAAgIAAAAvTmV3IG5mdCBpcyBhbHJlYWR5IGlzc3VlZCBhbmQgaXRzIGFzc2V0IGlkIGlzOiAJAQAAABFAZXh0ck5hdGl2ZSgxMDU4KQAAAAEFAAAACm5mdEFzc2V0SWQEAAAABm5ld05mdAkABEMAAAAHAgAAAAhEdWNrIEVnZwIAAABQVXRpbGl0eSBhbmQgUmV3YXJkIHRva2VuIEAgV2F2ZXNEdWNrcy5jb20gZ2FtZS4gVGhlIGR1Y2tpZXN0IHRva2VuIGluIHRoZSB3b3JsZC4A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AAAAHUmVpc3N1ZQAAAAMFAAAADW5ld0VnZ0Fzc2V0SWQFAAAADXN3YXBwZWRBbW91bnQGCQAETAAAAAIFAAAAB3JlaXNzdWUJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAVzd2FwXwkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkAgAAAAdfYW1vdW50BQAAAAx0b1N3YXBBbW91bnQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAAD1RvdGFsbmZ0U3dhcHBlZAkAAGQAAAACBQAAAA90b3RhbFN3YXBwZWRWYWwFAAAADHRvU3dhcEFtb3VudAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADXN3YXBwZWRBbW91bnQFAAAADW5ld0VnZ0Fzc2V0SWQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5tD1HEA==", "height": 2297894, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 31v5w7DFT1QNjeJ79TiRvaXbfdayTkEcvqAWMbScpo9w Next: 8Mbb5mLaQp8129KHum5eqicKPBnk9GHXidKAAchfuj8u Full:
OldNewDifferences
1-{-# STDLIB_VERSION 3 #-}
1+{-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let maxAuctionDuration = (1440 * 30)
4+let nftIssued = "wasInited"
5+
6+let nftAssetId = "nft_assetId"
7+
8+let TotalnftSwapped = "totalSwapped"
9+
10+let oldnftAssetId = base58''
511
612 @Callable(i)
7-func startAuction (duration,startPrice,priceAssetId) = {
8- let auctionId = toBase58String(i.transactionId)
9- let endHeight = (lastBlock.height + duration)
10- let pmt = extract(i.payment)
11- if ((duration > maxAuctionDuration))
12- then throw(("Duration is too long. Must be less than " + toString(maxAuctionDuration)))
13- else WriteSet([DataEntry(auctionId, endHeight), DataEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId))
14- then toBase58String(value(pmt.assetId))
15- else "WAVES"), DataEntry((auctionId + "_lot_amount"), pmt.amount), DataEntry((auctionId + "_startPrice"), startPrice), DataEntry((auctionId + "_priceAssetId"), priceAssetId)])
16- }
13+func issueNewnft () = if ((getBoolean(nftIssued) != unit))
14+ then throw(("New nft is already issued and its asset id is: " + getStringValue(nftAssetId)))
15+ else {
16+ let newNft = Issue("Duck Egg", "Utility and Reward token @ WavesDucks.com game. The duckiest token in the world.", 1, 8, true, unit, 0)
17+ let newNftId = calculateAssetId(newNft)
18+[newNft, BooleanEntry(nftIssued, true), StringEntry(nftAssetId, toBase58String(newNftId))]
19+ }
1720
1821
1922
2023 @Callable(i)
21-func bid (auctionId) = {
22- let pmt = extract(i.payment)
23- let pmtAssetIdStr = if (isDefined(pmt.assetId))
24- then toBase58String(value(pmt.assetId))
25- else "WAVES"
26- let callerAddressStr = toBase58String(i.caller.bytes)
27- let endHeight = getIntegerValue(this, auctionId)
28- let startPrice = getIntegerValue(this, (auctionId + "_startPrice"))
29- let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
30- let winAmount = getInteger(this, (auctionId + "_winAmount"))
31- let winner = getString(this, (auctionId + "_winner"))
32- let bidFromTheSameUser = if (isDefined(winner))
33- then (value(winner) == callerAddressStr)
34- else false
35- let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser)
36- then value(winAmount)
37- else 0))
38- if ((lastBlock.height >= endHeight))
39- then throw("Auction already finished")
40- else if ((priceAssetId != pmtAssetIdStr))
41- then throw((("Bid must be in asset '" + priceAssetId) + "'"))
42- else if (if (if (isDefined(winAmount))
43- then (value(winAmount) >= totalBidAmount)
44- else false)
45- then true
46- else if (!(isDefined(winAmount)))
47- then (startPrice >= totalBidAmount)
48- else false)
49- then throw(("Bid must be more then " + toString(if (isDefined(winAmount))
50- then value(winAmount)
51- else startPrice)))
52- else if (if (bidFromTheSameUser)
53- then true
54- else !(isDefined(winner)))
55- then WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)])
56- else {
57- let previousBidderAddr = addressFromStringValue(value(winner))
58- let priceAsset = if (if ((priceAssetId == "WAVES"))
59- then true
60- else (priceAssetId == ""))
61- then unit
62- else fromBase58String(priceAssetId)
63- ScriptResult(WriteSet([DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)]))
64- }
65- }
24+func swapEgg () = if ((size(i.payments) != 1))
25+ then throw("You can attach only EGG tokens")
26+ else if ((value(i.payments[0]).assetId != oldnftAssetId))
27+ then throw("You can attach only EGG tokens")
28+ else {
29+ let totalSwappedVal = match getInteger(TotalnftSwapped) {
30+ case int: Int =>
31+ int
32+ case _ =>
33+ 0
34+ }
35+ let newEggAssetId = fromBase58String(getStringValue(nftAssetId))
36+ let toSwapAmount = value(i.payments[0]).amount
37+ let swappedAmount = (toSwapAmount * 1000000)
38+ let reissue = Reissue(newEggAssetId, swappedAmount, true)
39+[reissue, IntegerEntry((("swap_" + toBase58String(i.transactionId)) + "_amount"), toSwapAmount), IntegerEntry(TotalnftSwapped, (totalSwappedVal + toSwapAmount)), ScriptTransfer(i.caller, swappedAmount, newEggAssetId)]
40+ }
6641
6742
68-
69-@Callable(i)
70-func withdraw (auctionId) = {
71- let pmt = extract(i.payment)
72- let pmtAssetIdStr = if (isDefined(pmt.assetId))
73- then toBase58String(value(pmt.assetId))
74- else "WAVES"
75- let callerAddressStr = toBase58String(i.caller.bytes)
76- let endHeight = getIntegerValue(this, auctionId)
77- let organizer = getStringValue(this, (auctionId + "_organizer"))
78- let winner = getString(this, (auctionId + "_winner"))
79- let lotAssetId = getStringValue(this, (auctionId + "_lot_assetId"))
80- let lotAmount = getIntegerValue(this, (auctionId + "_lot_amount"))
81- let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
82- let winAmount = getIntegerValue(this, (auctionId + "_winAmount"))
83- let lotAsset = if ((lotAssetId == "WAVES"))
84- then unit
85- else fromBase58String(lotAssetId)
86- let priceAsset = if (if ((priceAssetId == "WAVES"))
87- then true
88- else (priceAssetId == ""))
89- then unit
90- else fromBase58String(priceAssetId)
91- let winnerAddr = addressFromStringValue(value(winner))
92- let organizerAddr = addressFromStringValue(value(organizer))
93- let betAmount = getInteger(this, ((auctionId + "_bidder_") + callerAddressStr))
94- if ((endHeight > lastBlock.height))
95- then throw("Auction is not finished yet")
96- else if (!(isDefined(winner)))
97- then if (isDefined(getString(this, (auctionId + "_lot_passed"))))
98- then throw("Organizer has already got his lot back")
99- else ScriptResult(WriteSet([DataEntry((auctionId + "_lot_passed"), organizer)]), TransferSet([ScriptTransfer(organizerAddr, lotAmount, lotAsset)]))
100- else if (isDefined(getString(this, (auctionId + "_lot_passed"))))
101- then throw("Lot is already passed to the winner, and organizer got his reward")
102- else ScriptResult(WriteSet([DataEntry((auctionId + "_lot_passed"), toBase58String(winnerAddr.bytes))]), TransferSet([ScriptTransfer(winnerAddr, lotAmount, lotAsset), ScriptTransfer(organizerAddr, winAmount, priceAsset)]))
103- }
104-
43+@Verifier(tx)
44+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
10545

github/deemru/w8io/026f985 
27.07 ms