tx · HRkjZwbdHkMB2yVzSY9hFrKQ2rWhrSE7BTv3cFBFFart

3MrToFL7kWPJfYn65SYNzsiZk5NfukqpyGc:  -0.01000000 Waves

2023.02.04 21:22 [2435249] smart account 3MrToFL7kWPJfYn65SYNzsiZk5NfukqpyGc > SELF 0.00000000 Waves

{ "type": 13, "id": "HRkjZwbdHkMB2yVzSY9hFrKQ2rWhrSE7BTv3cFBFFart", "fee": 1000000, "feeAssetId": null, "timestamp": 1675534929333, "version": 2, "chainId": 84, "sender": "3MrToFL7kWPJfYn65SYNzsiZk5NfukqpyGc", "senderPublicKey": "2CRzFM7gSbmTxT2EbR4ApdH54Sg2o8vwYG3dHKbfbwFs", "proofs": [ "34zGnsAgY3EvxM2VnjV3ebqb5yTJezECvcMV3P3nZ8b1jzw5Wu1nHRFHDyetzUtYA1wQ74iZ4Q3WpEhQEkKvzPtn" ], "script": "base64:BgIHCAISAwoBCAABAWkBB21pbnROZnQBDWlwZnNJbWFnZUhhc2gECXJlY2lwaWVudAgFAWkGY2FsbGVyBAZhc3NldDEJAMIIBQIFYWFhYWECB3N3c2RzZHMAAQAABwQIYXNzZXRJZDEJALgIAQUGYXNzZXQxBAZhc3NldDIJAMIIBQIFYmJiYmICDXNkZmRzZmRzZmRzZmQAAQAABwQIYXNzZXRJZDIJALgIAQUGYXNzZXQyBAZhc3NldDMJAMIIBQIEY2NjYwINc2RmZHNmZHNmZHNmZAABAAAHBAhhc3NldElkMwkAuAgBBQZhc3NldDIEBmFzc2V0NAkAwggFAgVkZGRkZAINc2RmZHNmZHNmZHNmZAABAAAHBAhhc3NldElkNAkAuAgBBQZhc3NldDIEBmFzc2V0NQkAwggFAgVlZWVlZQINc2RmZHNmZHNmZHNmZAABAAAHBAhhc3NldElkNQkAuAgBBQZhc3NldDIEBmFzc2V0NgkAwggFAgRmZmZmAg1zZGZkc2Zkc2Zkc2ZkAAEAAAcECGFzc2V0SWQ2CQC4CAEFBmFzc2V0MgkAzAgCBQZhc3NldDEJAMw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V3BS85 Next: none 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-
14-let Asset = base58'hdyr9C9udjZEX3bZwcjC2YiuWrc8LU8jfru2z2st7KF'
15-
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-}
344
355
366 @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))]
7+func mintNft (ipfsImageHash) = {
8+ let recipient = i.caller
9+ let asset1 = Issue("aaaaa", "swsdsds", 1, 0, false)
10+ let assetId1 = calculateAssetId(asset1)
11+ let asset2 = Issue("bbbbb", "sdfdsfdsfdsfd", 1, 0, false)
12+ let assetId2 = calculateAssetId(asset2)
13+ let asset3 = Issue("cccc", "sdfdsfdsfdsfd", 1, 0, false)
14+ let assetId3 = calculateAssetId(asset2)
15+ let asset4 = Issue("ddddd", "sdfdsfdsfdsfd", 1, 0, false)
16+ let assetId4 = calculateAssetId(asset2)
17+ let asset5 = Issue("eeeee", "sdfdsfdsfdsfd", 1, 0, false)
18+ let assetId5 = calculateAssetId(asset2)
19+ let asset6 = Issue("ffff", "sdfdsfdsfdsfd", 1, 0, false)
20+ let assetId6 = calculateAssetId(asset2)
21+[asset1, asset2, asset3, asset4, asset5, asset6, StringEntry((toBase58String(assetId1) + "_ipfs"), ipfsImageHash), StringEntry((toBase58String(assetId2) + "_ipfs"), ipfsImageHash), ScriptTransfer(recipient, 1, assetId1), ScriptTransfer(recipient, 1, assetId2), StringEntry((toBase58String(assetId3) + "_ipfs"), ipfsImageHash), StringEntry((toBase58String(assetId4) + "_ipfs"), ipfsImageHash), ScriptTransfer(recipient, 1, assetId3), ScriptTransfer(recipient, 1, assetId4), StringEntry((toBase58String(assetId5) + "_ipfs"), ipfsImageHash), StringEntry((toBase58String(assetId6) + "_ipfs"), ipfsImageHash), ScriptTransfer(recipient, 1, assetId5), ScriptTransfer(recipient, 1, assetId6)]
4222 }
43-
44-
45-
46-@Callable(i)
47-func sellNFT (price) = {
48- let txId = i.transactionId
49- let seller = i.caller.bytes
50- let $t018761961 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
51- let token0 = $t018761961._1
52- let amount0 = $t018761961._2
53- if (!(isNft(token0)))
54- then throw("Token is not NFT")
55- else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
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 == Asset))
74- then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, Asset), 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) = {
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 == Asset))
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), 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,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 == Asset))
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), Asset)]
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- if ((i.payments[0].assetId == Asset))
151- then [ScriptTransfer(Address(caller), parseIntValue(getNftWinningPrice), Asset), 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")]
152- else if ((i.payments[0].assetId == unit))
153- then [ScriptTransfer(Address(caller), parseIntValue(getNftWinningPrice), unit), 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")]
154- else nil
155- }
156-
157-
158-
159-@Callable(i)
160-func cancelAuction (auctionId) = {
161- let txId = toBase58String(i.transactionId)
162- let caller = i.caller.bytes
163- let auctionStatus = getStringValue(this, (auctionId + "_nft_status"))
164- let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
165- let nftOwner = getStringValue(this, (auctionId + "_nft_owner"))
166- let nftId = getStringValue(this, (auctionId + "_nft_on_auction"))
167- let biddingPrice = getStringValue(this, (auctionId + "_highest_bid"))
168- if ((biddingWinner == "0"))
169- then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))]
170- else if ((i.payments[0].assetId == unit))
171- 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)]
172- else if ((i.payments[0].assetId == Asset))
173- 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), Asset)]
174- else nil
175- }
176-
177-
178-
179-@Callable(i)
180-func withdrawBid (bidTxId) = {
181- let caller = i.caller.bytes
182- let bidPrice = getStringValue(this, (bidTxId + "_highest_bid"))
183- let asBidder = getStringValue(this, (bidTxId + "_winner"))
184- let bidForNFT = getStringValue(this, (bidTxId + "_nft_id"))
185- if ((toBase58String(caller) != asBidder))
186- then throw("No bid")
187- else [StringEntry((bidTxId + "_nft_bid"), "WITHDRAW"), StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)]
188- }
189-
190-
191-
192-@Callable(i)
193-func manualFundTransfer (recepientAddr,message) = {
194- let caller = i.caller.bytes
195- let reciver = fromBase58String(recepientAddr)
196- let amount = i.payments[0].amount
197- if ((i.payments[0].assetId == unit))
198- then [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, unit)]
199- else if ((i.payments[0].assetId == Asset))
200- then [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, Asset)]
201- else nil
202- }
203-
204-
205-
206-@Callable(i)
207-func testBid (data) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")]
20823
20924

github/deemru/w8io/169f3d6 
55.44 ms