tx · BpwmB4oLWsgermjCKfqPx8ukNXszvfbPkfDpWVkGHoKd

3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F:  -0.01000000 Waves

2023.01.05 09:54 [2391325] smart account 3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F > SELF 0.00000000 Waves

{ "type": 13, "id": "BpwmB4oLWsgermjCKfqPx8ukNXszvfbPkfDpWVkGHoKd", "fee": 1000000, "feeAssetId": null, "timestamp": 1672901808530, "version": 2, "chainId": 84, "sender": "3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F", "senderPublicKey": "3V22YUj3GF4AeBxdWx8rgGdG4groE4W6P2s4sAkshe7R", "proofs": [ "2jwDKPfP3kgxgMgYPdLhe6tF5zd75WAPRTUhzqQ4tYLTG498dDZyR4covR9QKoCTR5s8ucCvX3j15dAvvQ7jBKQT" ], "script": "base64:BgIKCAISBgoECAgIAQkACXNlcGFyYXRvcgIBXwAEa0J1eQIDYnV5AAZrUHJpY2UCBXByaWNlAAVrU2VsbAIEc2VsbAASbWF4QXVjdGlvbkR1cmF0aW9uAAcABGtCaWQCA2JpZAAMc3RhdHVzRm9yTkZUCQCWCgQCBE9QRU4CBkNMT1NFRAIIUkVXQVJERUQCCENBTkNFTEVEAAtkQXBwQWRkcmVzcwEaAVRKuE9s3sLak+30julKNvjVT3+V1VVbXaABBWlzTmZ0AQdhc3NldElkBAckbWF0Y2gwCQDsBwEFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIFQXNzZXQEBXRva2VuBQckbWF0Y2gwAwMJAAACCAUFdG9rZW4IZGVjaW1hbHMAAAkAAAIIBQV0b2tlbghxdWFudGl0eQABBwkAAAIIBQV0b2tlbgpyZWlzc3VhYmxlBwcHAQFpAQphZGRBdWN0aW9uBAVzdGFydANlbmQKc3RhcnRQcmljZQhkdXJhdGlvbgQEdHhJZAkA2AQBCAUBaQ10cmFuc2FjdGlvbklkBAVuZnRJZAkBBXZhbHVlAQgJAJEDAggFAWkIcGF5bWVudHMAAAdhc3NldElkBAVwcmljZQkBBXZhbHVlAQUKc3RhcnRQcmljZQQJZW5kSGVpZ2h0CQBkAggFCWxhc3RCbG9jawZoZWlnaHQFCGR1cmF0aW9uBAZjYWxsZXIICAUBaQZjYWxsZXIFYnl0ZXMEEWNoZWNrTmZ0QXVjdGlvbmVkBAckbWF0Y2gwCQCdCAIFBHRoaXMJAKwCAgkArAICCQCsAgIJANgEAQUFbmZ0SWQFCXNlcGFyYXRvcgILbmZ0X3N0YXR1c18JANgEAQUGY2FsbGVyAwkAAQIFByRtYXRjaDACBlN0cmluZwQBYQUHJG1hdGNoMAYHAwkAAAIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUEdW5pdAkAAgECEE5GVCBub3QgYXR0YWNoZWQDCQAAAgURY2hlY2tOZnRBdWN0aW9uZWQGCQACAQIXQWxyZWFkeSBpbiBhdWN0aW9uIGxpc3QDCQBmAgUIZHVyYXRpb24FEm1heEF1Y3Rpb25EdXJhdGlvbgkAAgEJAKwCAgI2RHVyYXRpb24gaXMgdG9vIGxvbmcuIE11c3QgYmUgbGVzcyB0aGFuIG9yIGVxdWFsIHRvIDcgCQCkAwEFEm1heEF1Y3Rpb25EdXJhdGlvbgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgUEdHhJZAIYX25mdF9zdGFydF9hdWN0aW9uX2RhdGVfCQDYBAEFBmNhbGxlcgUFc3RhcnQJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIFBHR4SWQCFl9uZnRfZW5kX2F1Y3Rpb25fZGF0ZV8JANgEAQUGY2FsbGVyBQNlbmQJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQR0eElkAhBfbmZ0X3N0YXJ0X3ByaWNlBQpzdGFydFByaWNlCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUEdHhJZAIKX25mdF9vd25lcgkApQgBCAUBaQZjYWxsZXIJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQR0eElkAg9fbmZ0X29uX2F1Y3Rpb24JANgEAQUFbmZ0SWQJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQR0eElkAhBfcHJldmlvdXNfYmlkZGVyAgRub25lCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUEdHhJZAIMX2hpZ2hlc3RfYmlkAgEwCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUEdHhJZAIOX3dpbm5lcl9vZl9uZnQCATAJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQR0eElkAg1fYmlkZGVyX2NvdW50AgEwCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUEdHhJZAILX25mdF9zdGF0dXMCBE9QRU4FA25pbAAAaXda", "height": 2391325, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CskGsY7HVsKJHeLkGqunb6n5zjBEsVd8fadDb57ivfjS Next: 4o5zmW6XLMiRrdzHJfFjc4WTsMkbue6Ta9CUiXXCuWEz Diff:
OldNewDifferences
3030
3131
3232 @Callable(i)
33-func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = {
34- let newToken = Issue(nft_name, nft_description, 1, 0, false)
35- let issueId = calculateAssetId(newToken)
36- let txId = i.transactionId
37-[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))]
38- }
39-
40-
41-
42-@Callable(i)
43-func sellNFT (price) = {
44- let txId = i.transactionId
45- let seller = i.caller.bytes
46- let $t017921877 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
47- let token0 = $t017921877._1
48- let amount0 = $t017921877._2
49- if (!(isNft(token0)))
50- then throw("Token is not NFT")
51- else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
52- }
53-
54-
55-
56-@Callable(i)
57-func buyNFT (nftID,current_nft_owner) = {
58- let assetId = fromBase58String(nftID)
59- let amount = value(i.payments[0].amount)
60- let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) {
61- case a: String =>
62- a
63- case _ =>
64- false
65- }
66- let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner))
67- if ((i.payments[0].assetId != unit))
68- then throw("Pay in waves")
69- else if ((current_nft_owner == toString(i.caller)))
70- then throw("current Owner of NFT not able to purchase")
71- else [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))]
72- }
73-
74-
75-
76-@Callable(i)
7733 func addAuction (start,end,startPrice,duration) = {
7834 let txId = toBase58String(i.transactionId)
7935 let nftId = value(i.payments[0].assetId)
9652 }
9753
9854
99-
100-@Callable(i)
101-func placeBid (auctionId,nftId,nft_owner,bid_price) = {
102- let txId = toBase58String(i.transactionId)
103- let caller = i.caller.bytes
104- let assetId = fromBase58String(nftId)
105- let currentBidPrice = i.payments[0].amount
106- let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid"))
107- let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder"))
108- let currentBidCount = getStringValue(this, (auctionId + "_bidder_count"))
109- let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft"))
110- let checkNftAuctioned = getStringValue(this, (auctionId + "_nft_status"))
111- if ((i.payments[0].assetId != unit))
112- then throw("Pay in waves")
113- else if ((checkNftAuctioned != "OPEN"))
114- then throw("Not open for auction")
115- else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice))
116- then throw("Bid is less then starting/highest Bid")
117- else if ((getLastWinnerBidPrice == "0"))
118- 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)]
119- else [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)]
120- }
121-
122-
123-
124-@Callable(i)
125-func acceptBidOffer (auctionId,nftId,bid_amount_from_user) = {
126- let txId = toBase58String(i.transactionId)
127- let caller = i.caller.bytes
128- let assetId = fromBase58String(nftId)
129- let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid"))
130- let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
131-[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")]
132- }
133-
134-
135-
136-@Callable(i)
137-func cancelAuction (auctionId) = {
138- let txId = toBase58String(i.transactionId)
139- let caller = i.caller.bytes
140- let auctionStatus = getStringValue(this, (auctionId + "_nft_status"))
141- let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
142- let nftOwner = getStringValue(this, (auctionId + "_nft_owner"))
143- let nftId = getStringValue(this, (auctionId + "_nft_on_auction"))
144- let biddingPrice = getStringValue(this, (auctionId + "_highest_bid"))
145- if ((biddingWinner == "0"))
146- then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))]
147- else [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)]
148- }
149-
150-
151-
152-@Callable(i)
153-func withdrawBid (bidTxId) = {
154- let caller = i.caller.bytes
155- let bidPrice = getStringValue(this, (bidTxId + "_highest_bid"))
156- let asBidder = getStringValue(this, (bidTxId + "_winner"))
157- let bidForNFT = getStringValue(this, (bidTxId + "_nft_id"))
158- if ((toBase58String(caller) != asBidder))
159- then throw("No bid")
160- else [StringEntry((bidTxId + "_nft_bid"), "WITHDRAW"), StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)]
161- }
162-
163-
164-
165-@Callable(i)
166-func testBid (data) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")]
167-
168-
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let separator = "_"
55
66 let kBuy = "buy"
77
88 let kPrice = "price"
99
1010 let kSell = "sell"
1111
1212 let maxAuctionDuration = 7
1313
1414 let kBid = "bid"
1515
1616 let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED")
1717
1818 let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq'
1919
2020 func isNft (assetId) = match assetInfo(assetId) {
2121 case token: Asset =>
2222 if (if ((token.decimals == 0))
2323 then (token.quantity == 1)
2424 else false)
2525 then (token.reissuable == false)
2626 else false
2727 case _ =>
2828 false
2929 }
3030
3131
3232 @Callable(i)
33-func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = {
34- let newToken = Issue(nft_name, nft_description, 1, 0, false)
35- let issueId = calculateAssetId(newToken)
36- let txId = i.transactionId
37-[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))]
38- }
39-
40-
41-
42-@Callable(i)
43-func sellNFT (price) = {
44- let txId = i.transactionId
45- let seller = i.caller.bytes
46- let $t017921877 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
47- let token0 = $t017921877._1
48- let amount0 = $t017921877._2
49- if (!(isNft(token0)))
50- then throw("Token is not NFT")
51- else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
52- }
53-
54-
55-
56-@Callable(i)
57-func buyNFT (nftID,current_nft_owner) = {
58- let assetId = fromBase58String(nftID)
59- let amount = value(i.payments[0].amount)
60- let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) {
61- case a: String =>
62- a
63- case _ =>
64- false
65- }
66- let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner))
67- if ((i.payments[0].assetId != unit))
68- then throw("Pay in waves")
69- else if ((current_nft_owner == toString(i.caller)))
70- then throw("current Owner of NFT not able to purchase")
71- else [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))]
72- }
73-
74-
75-
76-@Callable(i)
7733 func addAuction (start,end,startPrice,duration) = {
7834 let txId = toBase58String(i.transactionId)
7935 let nftId = value(i.payments[0].assetId)
8036 let price = value(startPrice)
8137 let endHeight = (lastBlock.height + duration)
8238 let caller = i.caller.bytes
8339 let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) {
8440 case a: String =>
8541 true
8642 case _ =>
8743 false
8844 }
8945 if ((i.payments[0].assetId == unit))
9046 then throw("NFT not attached")
9147 else if ((checkNftAuctioned == true))
9248 then throw("Already in auction list")
9349 else if ((duration > maxAuctionDuration))
9450 then throw(("Duration is too long. Must be less than or equal to 7 " + toString(maxAuctionDuration)))
9551 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")]
9652 }
9753
9854
99-
100-@Callable(i)
101-func placeBid (auctionId,nftId,nft_owner,bid_price) = {
102- let txId = toBase58String(i.transactionId)
103- let caller = i.caller.bytes
104- let assetId = fromBase58String(nftId)
105- let currentBidPrice = i.payments[0].amount
106- let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid"))
107- let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder"))
108- let currentBidCount = getStringValue(this, (auctionId + "_bidder_count"))
109- let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft"))
110- let checkNftAuctioned = getStringValue(this, (auctionId + "_nft_status"))
111- if ((i.payments[0].assetId != unit))
112- then throw("Pay in waves")
113- else if ((checkNftAuctioned != "OPEN"))
114- then throw("Not open for auction")
115- else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice))
116- then throw("Bid is less then starting/highest Bid")
117- else if ((getLastWinnerBidPrice == "0"))
118- 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)]
119- else [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)]
120- }
121-
122-
123-
124-@Callable(i)
125-func acceptBidOffer (auctionId,nftId,bid_amount_from_user) = {
126- let txId = toBase58String(i.transactionId)
127- let caller = i.caller.bytes
128- let assetId = fromBase58String(nftId)
129- let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid"))
130- let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
131-[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")]
132- }
133-
134-
135-
136-@Callable(i)
137-func cancelAuction (auctionId) = {
138- let txId = toBase58String(i.transactionId)
139- let caller = i.caller.bytes
140- let auctionStatus = getStringValue(this, (auctionId + "_nft_status"))
141- let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
142- let nftOwner = getStringValue(this, (auctionId + "_nft_owner"))
143- let nftId = getStringValue(this, (auctionId + "_nft_on_auction"))
144- let biddingPrice = getStringValue(this, (auctionId + "_highest_bid"))
145- if ((biddingWinner == "0"))
146- then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))]
147- else [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)]
148- }
149-
150-
151-
152-@Callable(i)
153-func withdrawBid (bidTxId) = {
154- let caller = i.caller.bytes
155- let bidPrice = getStringValue(this, (bidTxId + "_highest_bid"))
156- let asBidder = getStringValue(this, (bidTxId + "_winner"))
157- let bidForNFT = getStringValue(this, (bidTxId + "_nft_id"))
158- if ((toBase58String(caller) != asBidder))
159- then throw("No bid")
160- else [StringEntry((bidTxId + "_nft_bid"), "WITHDRAW"), StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)]
161- }
162-
163-
164-
165-@Callable(i)
166-func testBid (data) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")]
167-
168-

github/deemru/w8io/169f3d6 
61.92 ms