tx · GYrvjGQfZqpixX2JCmDbaVp9UhGo95otsZsbbvgLHLTS

3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F:  -0.01000000 Waves

2023.01.25 09:56 [2420172] smart account 3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F > SELF 0.00000000 Waves

{ "type": 13, "id": "GYrvjGQfZqpixX2JCmDbaVp9UhGo95otsZsbbvgLHLTS", "fee": 1000000, "feeAssetId": null, "timestamp": 1674629980446, "version": 2, "chainId": 84, "sender": "3N9cKCHp6ZLMgz7rRgF8Q8DEt8zbtd1Ht7F", "senderPublicKey": "3V22YUj3GF4AeBxdWx8rgGdG4groE4W6P2s4sAkshe7R", "proofs": [ "mc5TUUXKN9SpLprWhCBK6T34x4uzKYNXvfBe4Fqq26TFu1VNZWRyGtx6JE4NHQLhav3dCKHCr31JXM59gtVssSY" ], "script": "base64:BgIICAISBAoCCAgLAAlzZXBhcmF0b3ICAV8ABGtCdXkCA2J1eQAGa1ByaWNlAgVwcmljZQAFa1NlbGwCBHNlbGwABXRlYW1zASCFY5Wj84iOsN4MF44ITr+aP5K7Jts66HaOFtwUIipIfgAFV0FWRVMBAAASbWF4QXVjdGlvbkR1cmF0aW9uAAcABGtCaWQCA2JpZAAMc3RhdHVzRm9yTkZUCQCWCgQCBE9QRU4CBkNMT1NFRAIIUkVXQVJERUQCCENBTkNFTEVEAAtkQXBwQWRkcmVzcwEaAVRKuE9s3sLak+30julKNvjVT3+V1VVbXaABBWlzTmZ0AQdhc3NldElkBAckbWF0Y2gwCQDsBwEFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIFQXNzZXQEBXRva2VuBQckbWF0Y2gwAwMJAAACCAUFdG9rZW4IZGVjaW1hbHMAAAkAAAIIBQV0b2tlbghxdWFudGl0eQABBwkAAAIIBQV0b2tlbgpyZWlzc3VhYmxlBwcHAQFpARJtYW51YWxGdW5kVHJhbnNmZXICDXJlY2VwaWVudEFkZHIHbWVzc2FnZQQGY2FsbGVyCAgFAWkGY2FsbGVyBWJ5dGVzBAdyZWNpdmVyCQDZBAEFDXJlY2VwaWVudEFkZHIEBmFtb3VudAgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQDCQAAAgkApAMBBQZhbW91bnQCBXRlYW1zCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIJANgEAQUGY2FsbGVyAglfdHJhbnNmZXIFBmFtb3VudAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJANgEAQUGY2FsbGVyAgxfdHJhbnNmZXJfdG8FDXJlY2VwaWVudEFkZHIJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBB0FkZHJlc3MBBQdyZWNpdmVyBQZhbW91bnQFBXRlYW1zBQNuaWwJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgkA2AQBBQZjYWxsZXICCV90cmFuc2ZlcgUGYW1vdW50CQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkA2AQBBQZjYWxsZXICDF90cmFuc2Zlcl90bwUNcmVjZXBpZW50QWRkcgkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQEHQWRkcmVzcwEFB3JlY2l2ZXIFBmFtb3VudAUEdW5pdAUDbmlsAIut3UY=", "height": 2420172, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5LZ628D5Q1iVZMxSuanRhn4KKL3M4E5mPWTqf84KekUp Next: UgDYv1qGa33swxK71FZzA6RAQkk9uhKxBgtXJ9spew4 Diff:
OldNewDifferences
99
1010 let kSell = "sell"
1111
12-let maxAuctionDuration = 7
13-
1412 let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'
1513
16-let waves = base58''
14+let WAVES = base58''
15+
16+let maxAuctionDuration = 7
1717
1818 let kBid = "bid"
1919
3434
3535
3636 @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))]
42- }
43-
44-
45-
46-@Callable(i)
47-func sellNFT (price) = {
48- let txId = i.transactionId
49- let seller = i.caller.bytes
50- let $t018771962 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
51- let token0 = $t018771962._1
52- let amount0 = $t018771962._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 == 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 [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))]
76- }
77-
78-
79-
80-@Callable(i)
81-func cancelSell (nftId) = {
82- let txId = toBase58String(i.transactionId)
83- let seller = i.caller.bytes
84-[StringEntry(((txId + nftId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(seller), 1, fromBase58String(nftId))]
85- }
86-
87-
88-
89-@Callable(i)
90-func addAuction (start,end,startPrice,duration) = {
91- let txId = toBase58String(i.transactionId)
92- let nftId = value(i.payments[0].assetId)
93- let price = value(startPrice)
94- let endHeight = (lastBlock.height + duration)
95- let caller = i.caller.bytes
96- let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) {
97- case a: String =>
98- true
99- case _ =>
100- false
101- }
102- if ((i.payments[0].assetId == unit))
103- then throw("NFT not attached")
104- else 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 [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")]
109- }
110-
111-
112-
113-@Callable(i)
114-func placeBid (auctionId,nftId,nft_owner,bid_price) = {
115- let txId = toBase58String(i.transactionId)
116- let caller = i.caller.bytes
117- let assetId = fromBase58String(nftId)
118- let currentBidPrice = i.payments[0].amount
119- let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid"))
120- let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder"))
121- let currentBidCount = getStringValue(this, (auctionId + "_bidder_count"))
122- let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft"))
123- let checkNftAuctioned = getStringValue(this, (auctionId + "_nft_status"))
124- if ((i.payments[0].assetId != unit))
125- then throw("Pay in waves")
126- else if ((checkNftAuctioned != "OPEN"))
127- then throw("Not open for auction")
128- else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice))
129- then throw("Bid is less then starting/highest Bid")
130- else if ((getLastWinnerBidPrice == "0"))
131- 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)]
132- 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)]
133- }
134-
135-
136-
137-@Callable(i)
138-func acceptBidOffer (auctionId,nftId,bid_amount_from_user) = {
139- let txId = toBase58String(i.transactionId)
140- let caller = i.caller.bytes
141- let assetId = fromBase58String(nftId)
142- let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid"))
143- let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
144-[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")]
145- }
146-
147-
148-
149-@Callable(i)
150-func cancelAuction (auctionId) = {
151- let txId = toBase58String(i.transactionId)
152- let caller = i.caller.bytes
153- let auctionStatus = getStringValue(this, (auctionId + "_nft_status"))
154- let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
155- let nftOwner = getStringValue(this, (auctionId + "_nft_owner"))
156- let nftId = getStringValue(this, (auctionId + "_nft_on_auction"))
157- let biddingPrice = getStringValue(this, (auctionId + "_highest_bid"))
158- if ((biddingWinner == "0"))
159- then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))]
160- 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)]
161- }
162-
163-
164-
165-@Callable(i)
166-func withdrawBid (bidTxId) = {
167- let caller = i.caller.bytes
168- let bidPrice = getStringValue(this, (bidTxId + "_highest_bid"))
169- let asBidder = getStringValue(this, (bidTxId + "_winner"))
170- let bidForNFT = getStringValue(this, (bidTxId + "_nft_id"))
171- if ((toBase58String(caller) != asBidder))
172- then throw("No bid")
173- else [StringEntry((bidTxId + "_nft_bid"), "WITHDRAW"), StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)]
174- }
175-
176-
177-
178-@Callable(i)
17937 func manualFundTransfer (recepientAddr,message) = {
18038 let caller = i.caller.bytes
18139 let reciver = fromBase58String(recepientAddr)
18240 let amount = i.payments[0].amount
183- if ((toString(amount) == ""))
184- then throw("Payment is not attached or empty")
185- else [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, teams)]
41+ if ((toString(amount) == "teams"))
42+ then [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, teams)]
43+ else [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, unit)]
18644 }
187-
188-
189-
190-@Callable(i)
191-func testBid (data) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")]
19245
19346
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
12-let maxAuctionDuration = 7
13-
1412 let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'
1513
16-let waves = base58''
14+let WAVES = base58''
15+
16+let maxAuctionDuration = 7
1717
1818 let kBid = "bid"
1919
2020 let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED")
2121
2222 let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq'
2323
2424 func isNft (assetId) = match assetInfo(assetId) {
2525 case token: Asset =>
2626 if (if ((token.decimals == 0))
2727 then (token.quantity == 1)
2828 else false)
2929 then (token.reissuable == false)
3030 else false
3131 case _ =>
3232 false
3333 }
3434
3535
3636 @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))]
42- }
43-
44-
45-
46-@Callable(i)
47-func sellNFT (price) = {
48- let txId = i.transactionId
49- let seller = i.caller.bytes
50- let $t018771962 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
51- let token0 = $t018771962._1
52- let amount0 = $t018771962._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 == 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 [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))]
76- }
77-
78-
79-
80-@Callable(i)
81-func cancelSell (nftId) = {
82- let txId = toBase58String(i.transactionId)
83- let seller = i.caller.bytes
84-[StringEntry(((txId + nftId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(seller), 1, fromBase58String(nftId))]
85- }
86-
87-
88-
89-@Callable(i)
90-func addAuction (start,end,startPrice,duration) = {
91- let txId = toBase58String(i.transactionId)
92- let nftId = value(i.payments[0].assetId)
93- let price = value(startPrice)
94- let endHeight = (lastBlock.height + duration)
95- let caller = i.caller.bytes
96- let checkNftAuctioned = match getString(this, (((toBase58String(nftId) + separator) + "nft_status_") + toBase58String(caller))) {
97- case a: String =>
98- true
99- case _ =>
100- false
101- }
102- if ((i.payments[0].assetId == unit))
103- then throw("NFT not attached")
104- else 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 [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")]
109- }
110-
111-
112-
113-@Callable(i)
114-func placeBid (auctionId,nftId,nft_owner,bid_price) = {
115- let txId = toBase58String(i.transactionId)
116- let caller = i.caller.bytes
117- let assetId = fromBase58String(nftId)
118- let currentBidPrice = i.payments[0].amount
119- let getLastWinnerBidPrice = getStringValue(this, (auctionId + "_highest_bid"))
120- let getPreviousBidderAddress = getString(this, (auctionId + "_previous_bidder"))
121- let currentBidCount = getStringValue(this, (auctionId + "_bidder_count"))
122- let getLastWinnerAddress = getStringValue(this, (auctionId + "_winner_of_nft"))
123- let checkNftAuctioned = getStringValue(this, (auctionId + "_nft_status"))
124- if ((i.payments[0].assetId != unit))
125- then throw("Pay in waves")
126- else if ((checkNftAuctioned != "OPEN"))
127- then throw("Not open for auction")
128- else if ((parseIntValue(getLastWinnerBidPrice) >= currentBidPrice))
129- then throw("Bid is less then starting/highest Bid")
130- else if ((getLastWinnerBidPrice == "0"))
131- 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)]
132- 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)]
133- }
134-
135-
136-
137-@Callable(i)
138-func acceptBidOffer (auctionId,nftId,bid_amount_from_user) = {
139- let txId = toBase58String(i.transactionId)
140- let caller = i.caller.bytes
141- let assetId = fromBase58String(nftId)
142- let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid"))
143- let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
144-[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")]
145- }
146-
147-
148-
149-@Callable(i)
150-func cancelAuction (auctionId) = {
151- let txId = toBase58String(i.transactionId)
152- let caller = i.caller.bytes
153- let auctionStatus = getStringValue(this, (auctionId + "_nft_status"))
154- let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
155- let nftOwner = getStringValue(this, (auctionId + "_nft_owner"))
156- let nftId = getStringValue(this, (auctionId + "_nft_on_auction"))
157- let biddingPrice = getStringValue(this, (auctionId + "_highest_bid"))
158- if ((biddingWinner == "0"))
159- then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))]
160- 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)]
161- }
162-
163-
164-
165-@Callable(i)
166-func withdrawBid (bidTxId) = {
167- let caller = i.caller.bytes
168- let bidPrice = getStringValue(this, (bidTxId + "_highest_bid"))
169- let asBidder = getStringValue(this, (bidTxId + "_winner"))
170- let bidForNFT = getStringValue(this, (bidTxId + "_nft_id"))
171- if ((toBase58String(caller) != asBidder))
172- then throw("No bid")
173- else [StringEntry((bidTxId + "_nft_bid"), "WITHDRAW"), StringEntry((bidTxId + "_nft_id"), bidForNFT), StringEntry((bidTxId + "_bidding_price_refund_amount"), bidPrice), ScriptTransfer(i.caller, parseIntValue(bidPrice), unit)]
174- }
175-
176-
177-
178-@Callable(i)
17937 func manualFundTransfer (recepientAddr,message) = {
18038 let caller = i.caller.bytes
18139 let reciver = fromBase58String(recepientAddr)
18240 let amount = i.payments[0].amount
183- if ((toString(amount) == ""))
184- then throw("Payment is not attached or empty")
185- else [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, teams)]
41+ if ((toString(amount) == "teams"))
42+ then [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, teams)]
43+ else [IntegerEntry((toBase58String(caller) + "_transfer"), amount), StringEntry((toBase58String(caller) + "_transfer_to"), recepientAddr), ScriptTransfer(Address(reciver), amount, unit)]
18644 }
187-
188-
189-
190-@Callable(i)
191-func testBid (data) = [StringEntry("E8kkFBYCy44JJaq6pAZ6KizsuResi5UKNhbD1WNZwhhY_highest_bid", "0")]
19245
19346

github/deemru/w8io/169f3d6 
48.86 ms