tx · 8xLa6JGkxcjPD6rPjBuM3HN1JncvpQe3yRMTWteQ6Qbg

3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F:  -0.01000000 Waves

2023.02.14 14:02 [2449206] smart account 3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F > SELF 0.00000000 Waves

{ "type": 13, "id": "8xLa6JGkxcjPD6rPjBuM3HN1JncvpQe3yRMTWteQ6Qbg", "fee": 1000000, "feeAssetId": null, "timestamp": 1676372739629, "version": 2, "chainId": 84, "sender": "3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F", "senderPublicKey": "3V22YUj3GF4AeBxdWx8rgGdG4groE4W6P2s4sAkshe7R", "proofs": [ "2vBkyzM6hgdPpCi5D4HQfRt5mnPdcyXE5w1dn758esaoQvWfo9hnQYddvJa9856JT51TqtPrJvvZUYJjY3wFD2iU" ], "script": "base64:BgIPCAISBAoCCAgSBQoDCAECAgAFdGVhbXMBIIVjlaPziI6w3gwXjghOv5o/krsm2zrodo4W3BQiKkh+AAVXQVZFUwEAAgFpAQ10cmFuc2ZlclRva2VuAg1yZWNlcGllbnRBZGRyB21lc3NhZ2UEBmNhbGxlcggIBQFpBmNhbGxlcgVieXRlcwQHcmVjaXZlcgkA2QQBBQ1yZWNlcGllbnRBZGRyBAZhbW91bnQICQCRAwIIBQFpCHBheW1lbnRzAAAGYW1vdW50AwkAAAIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUFdGVhbXMJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgkA2AQBBQZjYWxsZXICCV90cmFuc2ZlcgUGYW1vdW50CQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkA2AQBBQZjYWxsZXICDF90cmFuc2Zlcl90bwUNcmVjZXBpZW50QWRkcgkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQEHQWRkcmVzcwEFB3JlY2l2ZXIFBmFtb3VudAUFdGVhbXMFA25pbAUDbmlsAWkBC3NlbmRSZXF1ZXN0Aw1yZWNlcGllbnRBZGRyBmFtb3VudApBdHRhY2htZW50BAZjYWxsZXIICAUBaQZjYWxsZXIFYnl0ZXMEB3JlY2l2ZXIJANkEAQUNcmVjZXBpZW50QWRkcgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJANgEAQUGY2FsbGVyAgxfdHJhbnNmZXJfdG8FDXJlY2VwaWVudEFkZHIJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBB0FkZHJlc3MBBQdyZWNpdmVyAAAFCkF0dGFjaG1lbnQFA25pbAAbxDx+", "height": 2449206, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ce9WnpJGp4smvNZEgdtRAbSSpAKJcRp4ALxZMY9wT4vP Next: CBcRGjcPduaEGCP5WJqzDqhq7fckw9FgydVjUrEhpcQ2 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 = 30
13-
144 let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'
155
166 let WAVES = base58''
177
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-}
34-
35-
368 @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))]
9+func transferToken (recepientAddr,message) = {
10+ let caller = i.caller.bytes
11+ let reciver = fromBase58String(recepientAddr)
12+ let amount = i.payments[0].amount
13+ if ((i.payments[0].assetId == teams))
14+ then [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, teams)]
15+ else nil
4216 }
4317
4418
4519
4620 @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), 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- let seller_amount = ((amount / 1000) * 975)
72- let platform_fee = ((amount / 1000) * 25)
73- if ((current_nft_owner == toString(i.caller)))
74- then throw("current Owner of NFT not able to purchase")
75- else if ((i.payments[0].assetId == teams))
76- then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), seller_amount, teams), StringEntry((("nft_" + nftID) + "platform_fee"), toString(platform_fee)), 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 if ((i.payments[0].assetId == unit))
78- then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), seller_amount, unit), StringEntry((("nft_" + nftID) + "platform_fee"), toString(platform_fee)), 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))]
79- else nil
80- }
81-
82-
83-
84-@Callable(i)
85-func cancelSell (nftId) = {
86- let txId = toBase58String(i.transactionId)
87- let seller = i.caller.bytes
88-[StringEntry(((txId + nftId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(seller), 1, fromBase58String(nftId))]
89- }
90-
91-
92-
93-@Callable(i)
94-func addAuction (start,end,startPrice,duration,payment_currency) = {
95- let txId = toBase58String(i.transactionId)
96- let nftId = value(i.payments[0].assetId)
97- let price = value(startPrice)
98- let endHeight = (lastBlock.height + duration)
99- let caller = i.caller.bytes
100- let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) {
101- case a: String =>
102- true
103- case _ =>
104- false
105- }
106- if ((checkNftAuctioned == true))
107- then throw("Already in auction list")
108- else if ((duration > maxAuctionDuration))
109- then throw(("Duration is too long. Must be less than or equal to 7 " + toString(maxAuctionDuration)))
110- else if ((i.payments[0].assetId == unit))
111- then throw("NFT not attached")
112- else if ((i.payments[0].assetId == teams))
113- then throw("NFT not attached")
114- 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")]
115- }
116-
117-
118-
119-@Callable(i)
120-func placeBid (auctionId,nftId,nft_owner,bid_price) = {
121- let txId = toBase58String(i.transactionId)
122- let caller = i.caller.bytes
123- let assetId = fromBase58String(nftId)
124- let currentBidPrice = i.payments[0].amount
125- let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid"))
126- let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder"))
127- let currentBidCount = getStringValue(this, (auctionId + "_bidder_count"))
128- let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft"))
129- let checkNftAuctioned = getStringValue(this, (auctionId + "_nft_status"))
130- if ((checkNftAuctioned != "OPEN"))
131- then throw("Not open for auction")
132- else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice))
133- then throw("Bid is less then starting/highest Bid")
134- else if (if ((getLastWinnerBidPrice == "0"))
135- then (i.payments[0].assetId == unit)
136- else false)
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)]
138- else if (if ((getLastWinnerBidPrice != "0"))
139- then (i.payments[0].assetId == unit)
140- else false)
141- then [StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), 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), ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), unit)]
142- else if (if ((getLastWinnerBidPrice == "0"))
143- then (i.payments[0].assetId == teams)
144- else false)
145- 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)]
146- else if (if ((getLastWinnerBidPrice != "0"))
147- then (i.payments[0].assetId == teams)
148- else false)
149- then [StringEntry((txId + "_previous_bid_amount_refund_to_address"), getLastWinnerAddress), StringEntry((txId + "_prevoius_bid_amount_refund"), getLastWinnerBidPrice), StringEntry((auctionId + "_bidder_count"), toString((parseIntValue(currentBidCount) + 1))), StringEntry((auctionId + "_highest_bid"), toString(currentBidPrice)), StringEntry((auctionId + "_winner_of_nft"), toBase58String(i.caller.bytes)), 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), ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), teams)]
150- else nil
151- }
152-
153-
154-
155-@Callable(i)
156-func acceptBidOffer (auctionId,nftId,bid_amount_from_user,current_currency) = {
157- let txId = toBase58String(i.transactionId)
158- let caller = i.caller.bytes
159- let assetId = fromBase58String(nftId)
160- let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid"))
161- let getNftWinningamount = ((parseIntValue(getNftWinningPrice) / 1000) * 975)
162- let platform_fee = ((parseIntValue(getNftWinningPrice) / 1000) * 25)
163- let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
164- if ((current_currency == WAVES))
165- then [ScriptTransfer(Address(caller), getNftWinningamount, unit), ScriptTransfer(Address(fromBase58String(getAuctionWinner)), 1, assetId), StringEntry("platform_fee", toString(platform_fee)), 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")]
166- else if ((current_currency == teams))
167- then [ScriptTransfer(Address(caller), getNftWinningamount, teams), ScriptTransfer(Address(fromBase58String(getAuctionWinner)), 1, assetId), StringEntry("platform_fee", toString(platform_fee)), 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")]
168- else nil
169- }
170-
171-
172-
173-@Callable(i)
174-func cancelAuction (auctionId,current_currency) = {
175- let txId = toBase58String(i.transactionId)
176- let caller = i.caller.bytes
177- let auctionStatus = getStringValue(this, (auctionId + "_nft_status"))
178- let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
179- let nftOwner = getStringValue(this, (auctionId + "_nft_owner"))
180- let nftId = getStringValue(this, (auctionId + "_nft_on_auction"))
181- let biddingPrice = getStringValue(this, (auctionId + "_highest_bid"))
182- if ((biddingWinner == "0"))
183- then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))]
184- else if ((biddingWinner != "0"))
185- then throw("soory you can't cancel it because already auction placed by someone")
186- else nil
187- }
188-
189-
190-
191-@Callable(i)
192-func manualFundTransfer (recepientAddr,message) = {
21+func sendRequest (recepientAddr,amount,Attachment) = {
19322 let caller = i.caller.bytes
19423 let reciver = fromBase58String(recepientAddr)
195- let amount = i.payments[0].amount
196- let recepient_payment = ((amount / 1000) * 975)
197- let platform_fee = ((amount / 1000) * 25)
198- if ((i.payments[0].assetId == unit))
199- then [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry("platform_fee", toString(platform_fee)), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), recepient_payment, unit)]
200- else if ((i.payments[0].assetId == teams))
201- then [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry("platform_fee", toString(platform_fee)), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), recepient_payment, teams)]
202- else nil
24+[StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), 0, Attachment)]
20325 }
204-
205-
206-
207-@Callable(i)
208-func testBid (data) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")]
20926
21027

github/deemru/w8io/026f985 
63.99 ms