tx · J7GbVs4iwNig74pvzgHJemegPjyxxHpEMzUyaeT7Joz8

3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo:  -0.01000000 Waves

2022.12.02 12:03 [2342522] smart account 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo > SELF 0.00000000 Waves

{ "type": 13, "id": "J7GbVs4iwNig74pvzgHJemegPjyxxHpEMzUyaeT7Joz8", "fee": 1000000, "feeAssetId": null, "timestamp": 1669971795984, "version": 2, "chainId": 84, "sender": "3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo", "senderPublicKey": "Kwu4LYBMntApXv8t7csxV23Kvc3tvak26wMKK56tA4V", "proofs": [ "2951R5KGndPGJVULoKJMcDfwZoGrMSZQKGPEXy4Q7dYf9jaCmGhqNq5h1Hh3p6HiAUMYPH6kkKj32ZkDRSnBdahu" ], "script": "base64:BgIHCAISAwoBCAABAWkBA2JpZAEJYXVjdGlvbklkBANwbXQJAQV2YWx1ZQEJAJEDAggFAWkIcGF5bWVudHMAAAQNcG10QXNzZXRJZFN0cgMJAQlpc0RlZmluZWQBCAUDcG10B2Fzc2V0SWQJANgEAQkBBXZhbHVlAQgFA3BtdAdhc3NldElkAgVXQVZFUwQQY2FsbGVyQWRkcmVzc1N0cgkA2AQBCAgFAWkGY2FsbGVyBWJ5dGVzBAllbmRIZWlnaHQJARFAZXh0ck5hdGl2ZSgxMDUwKQIFBHRoaXMFCWF1Y3Rpb25JZAQKc3RhcnRQcmljZQkBEUBleHRyTmF0aXZlKDEwNTApAgUEdGhpcwkArAICBQlhdWN0aW9uSWQCC19zdGFydFByaWNlBAxwcmljZUFzc2V0SWQJARFAZXh0ck5hdGl2ZSgxMDUzKQIFBHRoaXMJAKwCAgUJYXVjdGlvbklkAg1fcHJpY2VBc3NldElkBAl3aW5BbW91bnQJAJoIAgUEdGhpcwkArAICBQlhdWN0aW9uSWQCCl93aW5BbW91bnQEBndpbm5lcgkAnQgCBQR0aGlzCQCsAgIFCWF1Y3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ECnByaWNlQXNzZXQDAwkAAAIFDHByaWNlQXNzZXRJZAIFV0FWRVMGCQAAAgUMcHJpY2VBc3NldElkAgAFBHVuaXQJANkEAQUMcHJpY2VBc3NldElkCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUJYXVjdGlvbklkAgdfd2lubmVyBRBjYWxsZXJBZGRyZXNzU3RyCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIFCWF1Y3Rpb25JZAIKX3dpbkFtb3VudAUOdG90YWxCaWRBbW91bnQJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwUScHJldmlvdXNCaWRkZXJBZGRyCQEFdmFsdWUBBQl3aW5BbW91bnQFCnByaWNlQXNzZXQFA25pbAAfrYLF", "height": 2342522, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CFX9BLfo98YfWYQdqrLAPxQvSuMs2ohhSUQUurdAE532 Next: 4WqTPsAurkDKw5Pw24HKqiqe5NAqsYYxzrQYnp7YWWFq Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let srcToken = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p'
54
6-let dstToken = base58'6nSpVyNH7yM69eg446wrQR94ipbbcmZMU1ENPwanC97g'
7-
8-let message = "Thank you for using the SWAP DApp"
95
106 @Callable(i)
11-func swap () = {
7+func bid (auctionId) = {
128 let pmt = value(i.payments[0])
13- if ((pmt.assetId != srcToken))
14- then throw("Incorrect asset passed.")
15- else [StringEntry("message", (("<h1>You did a swap!</h1><br><p>" + message) + "<p>")), ScriptTransfer(i.caller, pmt.amount, dstToken)]
9+ let pmtAssetIdStr = if (isDefined(pmt.assetId))
10+ then toBase58String(value(pmt.assetId))
11+ else "WAVES"
12+ let callerAddressStr = toBase58String(i.caller.bytes)
13+ let endHeight = getIntegerValue(this, auctionId)
14+ let startPrice = getIntegerValue(this, (auctionId + "_startPrice"))
15+ let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
16+ let winAmount = getInteger(this, (auctionId + "_winAmount"))
17+ let winner = getString(this, (auctionId + "_winner"))
18+ let bidFromTheSameUser = if (isDefined(winner))
19+ then (value(winner) == callerAddressStr)
20+ else false
21+ let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser)
22+ then value(winAmount)
23+ else 0))
24+ if ((lastBlock.height >= endHeight))
25+ then throw("Auction already finished")
26+ else if ((priceAssetId != pmtAssetIdStr))
27+ then throw((("Bid must be in asset '" + priceAssetId) + "'"))
28+ else if (if (if (isDefined(winAmount))
29+ then (value(winAmount) >= totalBidAmount)
30+ else false)
31+ then true
32+ else if (!(isDefined(winAmount)))
33+ then (startPrice >= totalBidAmount)
34+ else false)
35+ then throw(("Bid must be more then " + toString(if (isDefined(winAmount))
36+ then value(winAmount)
37+ else startPrice)))
38+ else if (if (bidFromTheSameUser)
39+ then true
40+ else !(isDefined(winner)))
41+ then [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount)]
42+ else {
43+ let previousBidderAddr = addressFromStringValue(value(winner))
44+ let priceAsset = if (if ((priceAssetId == "WAVES"))
45+ then true
46+ else (priceAssetId == ""))
47+ then unit
48+ else fromBase58String(priceAssetId)
49+[StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount), ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)]
50+ }
1651 }
1752
18-
19-@Verifier(tx)
20-func verify () = match tx {
21- case _ =>
22- sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
23-}
2453

github/deemru/w8io/026f985 
24.50 ms