tx · 2nkzLJDqh3ymhpCfHhJ9iP9GFCa9oVPuAyPgjNiUqRqd 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo: -0.01000000 Waves 2022.12.05 16:58 [2347139] smart account 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo > SELF 0.00000000 Waves
{ "type": 13, "id": "2nkzLJDqh3ymhpCfHhJ9iP9GFCa9oVPuAyPgjNiUqRqd", "fee": 1000000, "feeAssetId": null, "timestamp": 1670248695091, "version": 2, "chainId": 84, "sender": "3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo", "senderPublicKey": "Kwu4LYBMntApXv8t7csxV23Kvc3tvak26wMKK56tA4V", "proofs": [ "gWfTjkkcoQ85Vaygj4rCW96qjV8NCQ2i28WH5BBNSHQ9budEx6naH2QoD1ZSA5VV2ErGaTg6pP1uoJ5se6uHMae" ], "script": "base64:BgIJCAISBQoDCAgBAAEBaQEOYWNjZXB0QmlkT2ZmZXIDCWF1Y3Rpb25JZAVuZnRJZBRiaWRfYW1vdW50X2Zyb21fdXNlcgQEdHhJZAkA2AQBCAUBaQ10cmFuc2FjdGlvbklkBAZjYWxsZXIICAUBaQZjYWxsZXIFYnl0ZXMEB2Fzc2V0SWQJANkEAQUFbmZ0SWQEEmdldE5mdFdpbm5pbmdQcmljZQkBEUBleHRyTmF0aXZlKDEwNTMpAgUEdGhpcwkArAICBQlhdWN0aW9uSWQCDF9oaWdoZXN0X2JpZAQQZ2V0QXVjdGlvbldpbm5lcgkBEUBleHRyTmF0aXZlKDEwNTMpAgUEdGhpcwkArAICBQlhdWN0aW9uSWQCDl93aW5uZXJfb2ZfbmZ0CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMJAQdBZGRyZXNzAQUGY2FsbGVyCQENcGFyc2VJbnRWYWx1ZQEFEmdldE5mdFdpbm5pbmdQcmljZQUEdW5pdAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQEHQWRkcmVzcwEJANkEAQUQZ2V0QXVjdGlvbldpbm5lcgABBQdhc3NldElkCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUEdHhJZAIVX2Ftb3VudF9wYWlkX3RvX293bmVyBRJnZXROZnRXaW5uaW5nUHJpY2UJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQR0eElkAhBfbmZ0X3RyYW5zZmVyX3RvBRBnZXRBdWN0aW9uV2lubmVyCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUEdHhJZAILX25mdF9zdGF0dXMCCFJFV0FSREVECQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUJYXVjdGlvbklkAhVfYW1vdW50X3BhaWRfdG9fb3duZXIFEmdldE5mdFdpbm5pbmdQcmljZQkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIFCWF1Y3Rpb25JZAIQX25mdF90cmFuc2Zlcl90bwUQZ2V0QXVjdGlvbldpbm5lcgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIFCWF1Y3Rpb25JZAILX25mdF9zdGF0dXMCCFJFV0FSREVEBQNuaWwATcK1Cg==", "height": 2347139, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 91R6WV5PTyPjx6qWAWaLzZ8jk7Hip8HQjEfDapQpxKJp Next: 3n1vxLuqcksFLo2Gyvm74rPdbxnTc5pDmxXc4hVSqfDr Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func startAuction (duration,startPrice) = { | |
8 | - | let auctionId = toBase58String(i.transactionId) | |
9 | - | let pmt = value(i.payments[0]) | |
10 | - | [StringEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), IntegerEntry((auctionId + "_amount"), pmt.amount), IntegerEntry((auctionId + "_startPrice"), startPrice)] | |
11 | - | } | |
12 | - | ||
13 | - | ||
14 | - | ||
15 | - | @Callable(i) | |
16 | - | func bid () = { | |
17 | - | let auctionId = toBase58String(i.transactionId) | |
18 | - | let pmt = value(i.payments[0]) | |
19 | - | let pmtAssetIdStr = toBase58String(value(pmt.assetId)) | |
20 | - | let callerAddressStr = toBase58String(i.caller.bytes) | |
21 | - | let startPrice = getIntegerValue(this, (auctionId + "_startPrice")) | |
22 | - | let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId")) | |
23 | - | let winAmount = getInteger(this, (auctionId + "_winAmount")) | |
24 | - | let winner = getString(this, (auctionId + "_winner")) | |
25 | - | let bidFromTheSameUser = if (isDefined(winner)) | |
26 | - | then (value(winner) == callerAddressStr) | |
27 | - | else false | |
28 | - | let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser) | |
29 | - | then value(winAmount) | |
30 | - | else 0)) | |
31 | - | if ((priceAssetId != pmtAssetIdStr)) | |
32 | - | then throw((("Bid must be in asset '" + priceAssetId) + "'")) | |
33 | - | else if (if (if (isDefined(winAmount)) | |
34 | - | then (value(winAmount) >= totalBidAmount) | |
35 | - | else false) | |
36 | - | then true | |
37 | - | else if (!(isDefined(winAmount))) | |
38 | - | then (startPrice >= totalBidAmount) | |
39 | - | else false) | |
40 | - | then throw(("Bid must be more then " + toString(if (isDefined(winAmount)) | |
41 | - | then value(winAmount) | |
42 | - | else startPrice))) | |
43 | - | else if (if (bidFromTheSameUser) | |
44 | - | then true | |
45 | - | else !(isDefined(winner))) | |
46 | - | then [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount)] | |
47 | - | else { | |
48 | - | let previousBidderAddr = addressFromStringValue(value(winner)) | |
49 | - | let priceAsset = if (if ((priceAssetId == "WAVES")) | |
50 | - | then true | |
51 | - | else (priceAssetId == "")) | |
52 | - | then unit | |
53 | - | else fromBase58String(priceAssetId) | |
54 | - | [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount), ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)] | |
55 | - | } | |
7 | + | func acceptBidOffer (auctionId,nftId,bid_amount_from_user) = { | |
8 | + | let txId = toBase58String(i.transactionId) | |
9 | + | let caller = i.caller.bytes | |
10 | + | let assetId = fromBase58String(nftId) | |
11 | + | let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
12 | + | let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
13 | + | [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")] | |
56 | 14 | } | |
57 | 15 | ||
58 | 16 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func startAuction (duration,startPrice) = { | |
8 | - | let auctionId = toBase58String(i.transactionId) | |
9 | - | let pmt = value(i.payments[0]) | |
10 | - | [StringEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), IntegerEntry((auctionId + "_amount"), pmt.amount), IntegerEntry((auctionId + "_startPrice"), startPrice)] | |
11 | - | } | |
12 | - | ||
13 | - | ||
14 | - | ||
15 | - | @Callable(i) | |
16 | - | func bid () = { | |
17 | - | let auctionId = toBase58String(i.transactionId) | |
18 | - | let pmt = value(i.payments[0]) | |
19 | - | let pmtAssetIdStr = toBase58String(value(pmt.assetId)) | |
20 | - | let callerAddressStr = toBase58String(i.caller.bytes) | |
21 | - | let startPrice = getIntegerValue(this, (auctionId + "_startPrice")) | |
22 | - | let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId")) | |
23 | - | let winAmount = getInteger(this, (auctionId + "_winAmount")) | |
24 | - | let winner = getString(this, (auctionId + "_winner")) | |
25 | - | let bidFromTheSameUser = if (isDefined(winner)) | |
26 | - | then (value(winner) == callerAddressStr) | |
27 | - | else false | |
28 | - | let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser) | |
29 | - | then value(winAmount) | |
30 | - | else 0)) | |
31 | - | if ((priceAssetId != pmtAssetIdStr)) | |
32 | - | then throw((("Bid must be in asset '" + priceAssetId) + "'")) | |
33 | - | else if (if (if (isDefined(winAmount)) | |
34 | - | then (value(winAmount) >= totalBidAmount) | |
35 | - | else false) | |
36 | - | then true | |
37 | - | else if (!(isDefined(winAmount))) | |
38 | - | then (startPrice >= totalBidAmount) | |
39 | - | else false) | |
40 | - | then throw(("Bid must be more then " + toString(if (isDefined(winAmount)) | |
41 | - | then value(winAmount) | |
42 | - | else startPrice))) | |
43 | - | else if (if (bidFromTheSameUser) | |
44 | - | then true | |
45 | - | else !(isDefined(winner))) | |
46 | - | then [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount)] | |
47 | - | else { | |
48 | - | let previousBidderAddr = addressFromStringValue(value(winner)) | |
49 | - | let priceAsset = if (if ((priceAssetId == "WAVES")) | |
50 | - | then true | |
51 | - | else (priceAssetId == "")) | |
52 | - | then unit | |
53 | - | else fromBase58String(priceAssetId) | |
54 | - | [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount), ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)] | |
55 | - | } | |
7 | + | func acceptBidOffer (auctionId,nftId,bid_amount_from_user) = { | |
8 | + | let txId = toBase58String(i.transactionId) | |
9 | + | let caller = i.caller.bytes | |
10 | + | let assetId = fromBase58String(nftId) | |
11 | + | let getNftWinningPrice = getStringValue(this, (auctionId + "_highest_bid")) | |
12 | + | let getAuctionWinner = getStringValue(this, (auctionId + "_winner_of_nft")) | |
13 | + | [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")] | |
56 | 14 | } | |
57 | 15 | ||
58 | 16 |
github/deemru/w8io/026f985 30.54 ms ◑