tx · EVKMwVXMuUvbr13pB5k4JdnGZ9cmGGQKaJHTMLJPugKq

3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw:  -0.01000000 Waves

2023.02.11 09:46 [2444615] smart account 3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw > SELF 0.00000000 Waves

{ "type": 13, "id": "EVKMwVXMuUvbr13pB5k4JdnGZ9cmGGQKaJHTMLJPugKq", "fee": 1000000, "feeAssetId": null, "timestamp": 1676098089991, "version": 2, "chainId": 84, "sender": "3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw", "senderPublicKey": "4NDsd3dGKXuKLCoSbYvcWCX276K9ShP75cs9HTBMLJEN", "proofs": [ "UWe6mqEkBJ9eYjXXwvZ6C9qrZuUchBzriXAkwjMtMvtc2PuZJm4brLe9gnLA8a1fuUbpbjCLRXpUzCTYsNQSk9s" ], "script": "base64:BgIcCAISCwoJCAgICAgBCAgIEgQKAggIEgUKAwgICAsACXNlcGFyYXRvcgIBXwAEa0J1eQIDYnV5AAZrUHJpY2UCBXByaWNlAAVrU2VsbAIEc2VsbAASbWF4QXVjdGlvbkR1cmF0aW9uAAcABXRlYW1zASCFY5Wj84iOsN4MF44ITr+aP5K7Jts66HaOFtwUIipIfgAFV0FWRVMBAAAEa0JpZAIDYmlkAAxzdGF0dXNGb3JORlQJAJYKBAIET1BFTgIGQ0xPU0VEAghSRVdBUkRFRAIIQ0FOQ0VMRUQAC2RBcHBBZGRyZXNzARoBVEq4T2zewtqT7fSO6Uo2+NVPf5XVVVtdoAEFaXNOZnQBB2Fzc2V0SWQEByRtYXRjaDAJAOwHAQUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgVBc3NldAQFdG9rZW4FByRtYXRjaDADAwkAAAIIBQV0b2tlbghkZWNpbWFscwAACQAAAggFBXRva2VuCHF1YW50aXR5AAEHCQAAAggFBXRva2VuCnJlaXNzdWFibGUHBwcDAWkBCWNyZWF0ZU5mdAkIbmZ0X25hbW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QJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwgFAWkGY2FsbGVyAAEFB2Fzc2V0SWQJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBB0FkZHJlc3MBCQDZBAEFEWN1cnJlbnRfbmZ0X293bmVyBQxwbGF0ZnJvbV9mZWUFBHVuaXQJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJAKUIAQgFAWkGY2FsbGVyBQlzZXBhcmF0b3IFBGtCdXkJAKwCAgkArAICBQVuZnRJRAUJc2VwYXJhdG9yCQCkAwEFBmFtb3VudAkAzAgCCQELRGVsZXRlRW50cnkBCQCsAgIJAKwCAgIEbmZ0XwURY3VycmVudF9uZnRfb3duZXICBl9vd25lcgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgIEbmZ0XwURY3VycmVudF9uZnRfb3duZXICBl9vd25lcgkApQgBCAUBaQZjYWxsZXIJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIFBW5mdElEBQlzZXBhcmF0b3ICBl9vd25lcgkApQgBCAUBaQZjYWxsZXIFA25pbAUDbmlsAB5F+6I=", "height": 2444615, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BYr8BPcuT9ATTyZLRjMN9U3LxGZiBxqiyWF27WrFPibG Next: 4VHomxzHi3kf5jta2KUa4zFh15d1U1vPeQfx1oyxkASN Diff:
OldNewDifferences
5858
5959
6060 @Callable(i)
61-func buyNFT (nftID,current_nft_owner) = {
61+func buyNFT (nftID,current_nft_owner,platform) = {
6262 let assetId = fromBase58String(nftID)
6363 let amount = value(i.payments[0].amount)
6464 let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) {
6868 false
6969 }
7070 let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner))
71+ let platfrom_fee = ((amount / 1000) * 25)
7172 if ((current_nft_owner == toString(i.caller)))
7273 then throw("current Owner of NFT not able to purchase")
7374 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+ then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), platfrom_fee, 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))]
7576 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+ then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), platfrom_fee, 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))]
7778 else nil
7879 }
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), 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,current_currency) = {
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) >= parseIntValue(toString(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 ((getLastWinnerBidPrice != "0"))
135- then [ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), current_currency), 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)]
136- else nil
137- }
138-
139-
140-
141-@Callable(i)
142-func acceptBidOffer (auctionId,nftId,bid_amount_from_user,current_currency) = {
143- let txId = toBase58String(i.transactionId)
144- let caller = i.caller.bytes
145- let assetId = fromBase58String(nftId)
146- let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid"))
147- let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
148- if ((current_currency == WAVES))
149- 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")]
150- else if ((current_currency == teams))
151- then [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")]
152- else nil
153- }
154-
155-
156-
157-@Callable(i)
158-func cancelAuction (auctionId,current_currency) = {
159- let txId = toBase58String(i.transactionId)
160- let caller = i.caller.bytes
161- let auctionStatus = getStringValue(this, (auctionId + "_nft_status"))
162- let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
163- let nftOwner = getStringValue(this, (auctionId + "_nft_owner"))
164- let nftId = getStringValue(this, (auctionId + "_nft_on_auction"))
165- let biddingPrice = getStringValue(this, (auctionId + "_highest_bid"))
166- if ((biddingWinner == "0"))
167- then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))]
168- else if ((biddingWinner != "0"))
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), current_currency)]
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")]
20480
20581
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 teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'
1515
1616 let WAVES = base58''
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)
3737 func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = {
3838 let newToken = Issue(nft_name, nft_description, 1, 0, false)
3939 let issueId = calculateAssetId(newToken)
4040 let txId = i.transactionId
4141 [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))]
4242 }
4343
4444
4545
4646 @Callable(i)
4747 func sellNFT (price,payment_currency) = {
4848 let txId = i.transactionId
4949 let seller = i.caller.bytes
5050 let $t019011986 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
5151 let token0 = $t019011986._1
5252 let amount0 = $t019011986._2
5353 if (!(isNft(token0)))
5454 then throw("Token is not NFT")
5555 else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), (((toBase58String(token0) + separator) + toString(amount0)) + payment_currency))]
5656 }
5757
5858
5959
6060 @Callable(i)
61-func buyNFT (nftID,current_nft_owner) = {
61+func buyNFT (nftID,current_nft_owner,platform) = {
6262 let assetId = fromBase58String(nftID)
6363 let amount = value(i.payments[0].amount)
6464 let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) {
6565 case a: String =>
6666 a
6767 case _ =>
6868 false
6969 }
7070 let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner))
71+ let platfrom_fee = ((amount / 1000) * 25)
7172 if ((current_nft_owner == toString(i.caller)))
7273 then throw("current Owner of NFT not able to purchase")
7374 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+ then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), platfrom_fee, 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))]
7576 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+ then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), platfrom_fee, 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))]
7778 else nil
7879 }
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), 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,current_currency) = {
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) >= parseIntValue(toString(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 ((getLastWinnerBidPrice != "0"))
135- then [ScriptTransfer(Address(fromBase58String(getLastWinnerAddress)), parseIntValue(getLastWinnerBidPrice), current_currency), 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)]
136- else nil
137- }
138-
139-
140-
141-@Callable(i)
142-func acceptBidOffer (auctionId,nftId,bid_amount_from_user,current_currency) = {
143- let txId = toBase58String(i.transactionId)
144- let caller = i.caller.bytes
145- let assetId = fromBase58String(nftId)
146- let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid"))
147- let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
148- if ((current_currency == WAVES))
149- 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")]
150- else if ((current_currency == teams))
151- then [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")]
152- else nil
153- }
154-
155-
156-
157-@Callable(i)
158-func cancelAuction (auctionId,current_currency) = {
159- let txId = toBase58String(i.transactionId)
160- let caller = i.caller.bytes
161- let auctionStatus = getStringValue(this, (auctionId + "_nft_status"))
162- let biddingWinner = getStringValue(this, (auctionId + "_winner_of_nft"))
163- let nftOwner = getStringValue(this, (auctionId + "_nft_owner"))
164- let nftId = getStringValue(this, (auctionId + "_nft_on_auction"))
165- let biddingPrice = getStringValue(this, (auctionId + "_highest_bid"))
166- if ((biddingWinner == "0"))
167- then [StringEntry(((txId + auctionId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(fromBase58String(nftOwner)), 1, fromBase58String(nftId))]
168- else if ((biddingWinner != "0"))
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), current_currency)]
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")]
20480
20581

github/deemru/w8io/026f985 
37.81 ms