tx · HKuWBqEqxcrVDx1rMyKCq978L2pUUFcrFKGkQvoFKT78

3NCnz63Wq3UgikV5jJfQpG5snnibGbfUHR1:  -0.00500000 Waves

2023.03.25 18:13 [2505689] smart account 3NCnz63Wq3UgikV5jJfQpG5snnibGbfUHR1 > SELF 0.00000000 Waves

{ "type": 13, "id": "HKuWBqEqxcrVDx1rMyKCq978L2pUUFcrFKGkQvoFKT78", "fee": 500000, "feeAssetId": null, "timestamp": 1679757299816, "version": 2, "chainId": 84, "sender": "3NCnz63Wq3UgikV5jJfQpG5snnibGbfUHR1", "senderPublicKey": "4aqyXQp8dTe3bcQoReatzejrngYuQvyooFPeNe8925zb", "proofs": [ "2gmbMCYdpb6rcD3fTnEFiGtw2MmpJcYg823giojoGj1ZuQDZ6Mn5J9PbS4Z6NaJhisF9e8iqh8KoBH3feYDP85Mr" ], "script": "base64:BgIECAISAAIABXRlYW1zASCFY5Wj84iOsN4MF44ITr+aP5K7Jts66HaOFtwUIipIfgEOYWRkU3RyaW5nRW50cnkCBWFjY3VtCW5leHRWYWx1ZQQJJHQwMjI4MjUxBQVhY2N1bQQGcmVzdWx0CAUJJHQwMjI4MjUxAl8xBAFqCAUJJHQwMjI4MjUxAl8yCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgIES2V5XwUJbmV4dFZhbHVlBQluZXh0VmFsdWUFA25pbAEBaQEGYnV5TmZ0AAQGdmFsdWVzCQDMCAICIzNON1N5NFFSZ0xyaGpXQ2hicGl5RnhhUnJZdFROUkd1TlVzCQDMCAICIzNOODVZVzZOWjlwTFl2U2R0MUFTTVFUR3h2bmNuVTF2VU54BQNuaWwEBnJlc3VsdAoAAiRsBQZ2YWx1ZXMKAAIkcwkAkAMBBQIkbAoABSRhY2MwCQCUCgIFA25pbAAACgEFJGYwXzECAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAQ5hZGRTdHJpbmdFbnRyeQIFAiRhCQCRAwIFAiRsBQIkaQoBBSRmMF8yAgIkYQIkaQMJAGcCBQIkaQUCJHMFAiRhCQACAQIUTGlzdCBzaXplIGV4Y2VlZHMgMTAJAQUkZjBfMgIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIFBSRhY2MwAAAAAQACAAMABAAFAAYABwAIAAkACgUDbmlsABZjWDI=", "height": 2505689, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2ahX4xouADVtE1NRxHmKuGHD7FLvGzJWiUTHcSkTKCjR Next: 3jFCwJFyNzuWnNhnETDo6wH8NdE83YxRWq84c9AcmnEb Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let separator = "_"
5-
6-let kBuy = "buy"
7-
8-let kPrice = "price"
9-
10-let kSell = "sell"
11-
12-let maxAuctionDuration = 7
13-
144 let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'
155
16-let WAVES = base58''
17-
18-let kBid = "bid"
19-
20-let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED")
21-
22-let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq'
23-
24-func isNft (assetId) = match assetInfo(assetId) {
25- case token: Asset =>
26- if (if ((token.decimals == 0))
27- then (token.quantity == 1)
28- else false)
29- then (token.reissuable == false)
30- else false
31- case _ =>
32- false
33-}
6+func addStringEntry (accum,nextValue) = {
7+ let $t0228251 = accum
8+ let result = $t0228251._1
9+ let j = $t0228251._2
10+[StringEntry(("Key_" + nextValue), nextValue)]
11+ }
3412
3513
3614 @Callable(i)
37-func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = {
38- let newToken = Issue(nft_name, nft_description, 1, 0, false)
39- let issueId = calculateAssetId(newToken)
40- let txId = i.transactionId
41-[newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "Owner"), toString(i.caller)), StringEntry(((toBase58String(issueId) + separator) + "nft_type"), nft_type), StringEntry(((toBase58String(issueId) + separator) + "nft_tags"), nft_tags), StringEntry(((toBase58String(issueId) + separator) + "nft_dAppAddress"), nft_dAppAddress), IntegerEntry(((toBase58String(issueId) + separator) + "nft_selling_price"), nft_selling_price), StringEntry(((toBase58String(issueId) + separator) + "nft_onSell"), nft_onSell), StringEntry(((toBase58String(issueId) + separator) + "nft_data"), nft_data), StringEntry(((toBase58String(txId) + separator) + "issue_nft"), toBase58String(issueId))]
15+func buyNft () = {
16+ let values = ["3N7Sy4QRgLrhjWChbpiyFxaRrYtTNRGuNUs", "3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx"]
17+ let result = {
18+ let $l = values
19+ let $s = size($l)
20+ let $acc0 = $Tuple2(nil, 0)
21+ func $f0_1 ($a,$i) = if (($i >= $s))
22+ then $a
23+ else addStringEntry($a, $l[$i])
24+
25+ func $f0_2 ($a,$i) = if (($i >= $s))
26+ then $a
27+ else throw("List size exceeds 10")
28+
29+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
30+ }
31+ nil
4232 }
43-
44-
45-
46-@Callable(i)
47-func sellNFT (price,payment_currency) = {
48- let txId = i.transactionId
49- let seller = i.caller.bytes
50- let $t019011986 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
51- let token0 = $t019011986._1
52- let amount0 = $t019011986._2
53- if (!(isNft(token0)))
54- then throw("Token is not NFT")
55- else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), (price + payment_currency)), StringEntry(((toString(i.caller) + separator) + kSell), (((toBase58String(token0) + separator) + toString(amount0)) + payment_currency))]
56- }
57-
58-
59-
60-@Callable(i)
61-func buyNFT (nftID,current_nft_owner) = {
62- let assetId = fromBase58String(nftID)
63- let amount = value(i.payments[0].amount)
64- let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) {
65- case a: String =>
66- a
67- case _ =>
68- false
69- }
70- let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner))
71- if ((current_nft_owner == toString(i.caller)))
72- then throw("current Owner of NFT not able to purchase")
73- else if ((i.payments[0].assetId == teams))
74- then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, teams), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))]
75- else if ((i.payments[0].assetId == unit))
76- then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))]
77- else nil
78- }
79-
80-
81-
82-@Callable(i)
83-func cancelSell (nftId) = {
84- let txId = toBase58String(i.transactionId)
85- let seller = i.caller.bytes
86-[StringEntry(((txId + nftId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(seller), 1, fromBase58String(nftId))]
87- }
88-
89-
90-
91-@Callable(i)
92-func addAuction (start,end,startPrice,duration,payment_currency) = {
93- let txId = toBase58String(i.transactionId)
94- let nftId = value(i.payments[0].assetId)
95- let price = value(startPrice)
96- let endHeight = (lastBlock.height + duration)
97- let caller = i.caller.bytes
98- let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) {
99- case a: String =>
100- true
101- case _ =>
102- false
103- }
104- if ((checkNftAuctioned == true))
105- then throw("Already in auction list")
106- else if ((duration > maxAuctionDuration))
107- then throw(("Duration is too long. Must be less than or equal to 7 " + toString(maxAuctionDuration)))
108- else if ((i.payments[0].assetId == unit))
109- then throw("NFT not attached")
110- else if ((i.payments[0].assetId == teams))
111- then throw("NFT not attached")
112- else [StringEntry(((txId + "nft_start_auction_date") + toBase58String(caller)), start), StringEntry(((txId + "nft_end_auction_date") + toBase58String(caller)), end), StringEntry((txId + "_nft_start_price"), (startPrice + payment_currency)), StringEntry((txId + "_nft_owner"), toString(i.caller)), StringEntry((txId + "_nft_on_auction"), toBase58String(nftId)), StringEntry((txId + "_previous_bidder"), "none"), StringEntry((txId + "_highest_bid"), "0"), StringEntry((txId + "_winner_of_nft"), "0"), StringEntry((txId + "_bidder_count"), "0"), StringEntry((txId + "_nft_status"), "OPEN")]
113- }
114-
115-
116-
117-@Callable(i)
118-func placeBid (auctionId,nftId,nft_owner,startPrice,bid_price) = {
119- let txId = toBase58String(i.transactionId)
120- let caller = i.caller.bytes
121- let assetId = fromBase58String(nftId)
122- let currentBidPrice = i.payments[0].amount
123- let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid"))
124- let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder"))
125- let currentBidCount = getStringValue(this, (auctionId + "_bidder_count"))
126- let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft"))
127- let checkNftAuctioned = getStringValue(this, (auctionId + "_nft_status"))
128- if ((checkNftAuctioned != "OPEN"))
129- then throw("Not open for auction")
130- else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice))
131- then throw("Bid is less then starting/highest Bid")
132- else if ((getLastWinnerBidPrice == "0"))
133- then [StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_nft_id"), toBase58String(assetId)), StringEntry((auctionId + "_nft_owner"), nft_owner), StringEntry((((txId + "_") + auctionId) + "_highest_bid"), toString(currentBidPrice)), StringEntry((((txId + "_") + auctionId) + "_winner"), toBase58String(i.caller.bytes)), StringEntry((((txId + "_") + auctionId) + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((((txId + "_") + auctionId) + "_nft_id"), toBase58String(assetId)), StringEntry((((txId + "_") + auctionId) + "_nft_owner"), nft_owner), StringEntry((txId + "_bid_for_nft_by"), toBase58String(caller)), StringEntry((txId + "_bid_price_place"), bid_price), StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice)]
134- else if ((i.payments[0].assetId == unit))
135- then [StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_nft_id"), toBase58String(assetId)), StringEntry((auctionId + "_nft_owner"), nft_owner), StringEntry((((txId + "_") + auctionId) + "_highest_bid"), toString(currentBidPrice)), StringEntry((((txId + "_") + auctionId) + "_winner"), toBase58String(i.caller.bytes)), StringEntry((((txId + "_") + auctionId) + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((((txId + "_") + auctionId) + "_nft_id"), toBase58String(assetId)), StringEntry((((txId + "_") + auctionId) + "_nft_owner"), nft_owner), StringEntry((txId + "_bid_for_nft_by"), toBase58String(caller)), StringEntry((txId + "_bid_price_place"), bid_price), StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice), ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), unit)]
136- else if ((i.payments[0].assetId == teams))
137- then [StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_nft_id"), toBase58String(assetId)), StringEntry((auctionId + "_nft_owner"), nft_owner), StringEntry((((txId + "_") + auctionId) + "_highest_bid"), toString(currentBidPrice)), StringEntry((((txId + "_") + auctionId) + "_winner"), toBase58String(i.caller.bytes)), StringEntry((((txId + "_") + auctionId) + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((((txId + "_") + auctionId) + "_nft_id"), toBase58String(assetId)), StringEntry((((txId + "_") + auctionId) + "_nft_owner"), nft_owner), StringEntry((txId + "_bid_for_nft_by"), toBase58String(caller)), StringEntry((txId + "_bid_price_place"), bid_price), StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice), ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), teams)]
138- else nil
139- }
140-
141-
142-
143-@Callable(i)
144-func acceptBidOffer (auctionId,nftId,bid_amount_from_user) = {
145- let txId = toBase58String(i.transactionId)
146- let caller = i.caller.bytes
147- let assetId = fromBase58String(nftId)
148- let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid"))
149- let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
150-[ScriptTransfer(Address(caller), parseIntValue(getNftWinningPrice), teams), ScriptTransfer(Address(fromBase58String(getAuctionWinner)), 1, assetId), StringEntry((txId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((txId + "_nft_transfer_to"), getAuctionWinner), StringEntry((txId + "_nft_status"), "REWARDED"), StringEntry((auctionId + "_amount_paid_to_owner"), getNftWinningPrice), StringEntry((auctionId + "_nft_transfer_to"), getAuctionWinner), StringEntry((auctionId + "_nft_status"), "REWARDED")]
151- }
152-
153-
154-
155-@Callable(i)
156-func cancelAuction (auctionId) = {
157- let txId = toBase58String(i.transactionId)
158- let caller = i.caller.bytes
159- let auctionStatus = getStringValue(this, (auctionId + "_nft_status"))
160- let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
161- let nftOwner = getStringValue(this, (auctionId + "_nft_owner"))
162- let nftId = getStringValue(this, (auctionId + "_nft_on_auction"))
163- let biddingPrice = getStringValue(this, (auctionId + "_highest_bid"))
164- if ((biddingWinner == "0"))
165- then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))]
166- else if ((i.payments[0].assetId == unit))
167- then [StringEntry((auctionId + "_nft_status"), "CANCELED"), StringEntry((auctionId + "_previous_bid_amount_refund_to_address"), biddingWinner), StringEntry((auctionId + "_prevoius_bid_amount_refund"), biddingPrice), StringEntry((txId + "_nft_status"), "CANCELED"), StringEntry((txId + "_previous_bid_amount_refund_to_address"), biddingWinner), StringEntry((txId + "_prevoius_bid_amount_refund"), biddingPrice), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId)), ScriptTransfer(Address(fromBase58String(biddingWinner)), parseIntValue(biddingPrice), unit)]
168- else if ((i.payments[0].assetId == teams))
169- then [StringEntry((auctionId + "_nft_status"), "CANCELED"), StringEntry((auctionId + "_previous_bid_amount_refund_to_address"), biddingWinner), StringEntry((auctionId + "_prevoius_bid_amount_refund"), biddingPrice), StringEntry((txId + "_nft_status"), "CANCELED"), StringEntry((txId + "_previous_bid_amount_refund_to_address"), biddingWinner), StringEntry((txId + "_prevoius_bid_amount_refund"), biddingPrice), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId)), ScriptTransfer(Address(fromBase58String(biddingWinner)), parseIntValue(biddingPrice), teams)]
170- else nil
171- }
172-
173-
174-
175-@Callable(i)
176-func withdrawBid (bidTxId) = {
177- let caller = i.caller.bytes
178- let bidPrice = getStringValue(this, (bidTxId + "_highest_bid"))
179- let asBidder = getStringValue(this, (bidTxId + "_winner"))
180- let bidForNFT = getStringValue(this, (bidTxId + "_nft_id"))
181- if ((toBase58String(caller) != asBidder))
182- then throw("No bid")
183- else [StringEntry((bidTxId + "_nft_bid"), "WITHDRAW"), StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)]
184- }
185-
186-
187-
188-@Callable(i)
189-func manualFundTransfer (recepientAddr,message) = {
190- let caller = i.caller.bytes
191- let reciver = fromBase58String(recepientAddr)
192- let amount = i.payments[0].amount
193- if ((i.payments[0].assetId == unit))
194- then [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, unit)]
195- else if ((i.payments[0].assetId == teams))
196- then [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, teams)]
197- else nil
198- }
199-
200-
201-
202-@Callable(i)
203-func testBid (data) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")]
20433
20534

github/deemru/w8io/026f985 
41.66 ms