tx · 4XamF6khEMBHypq4b3rWsPUNDyhp5gT1wVJkmthEgqv9

3MxssetYXJfiGwzo9pqChsSwYj3tCYq5FFH:  -0.00400000 Waves

2022.09.25 16:53 [2244753] smart account 3MxssetYXJfiGwzo9pqChsSwYj3tCYq5FFH > SELF 0.00000000 Waves

{ "type": 13, "id": "4XamF6khEMBHypq4b3rWsPUNDyhp5gT1wVJkmthEgqv9", "fee": 400000, "feeAssetId": null, "timestamp": 1664114035770, "version": 2, "chainId": 84, "sender": "3MxssetYXJfiGwzo9pqChsSwYj3tCYq5FFH", "senderPublicKey": "46sMMaC9rMPQdyTE87RpcnevTY9oheuDqzfnuQzoyCtv", "proofs": [ "4shpQQ8PLQe7QQrCwzyFLGnR4dmh6ha16xC4aLDZpNhtM5q1x5GD8yE7JBn9As2Uv7KjRU7KwfF3LRSbDjwNnHAk" ], "script": "base64:BgIYCAISBwoFAQEBAQESBAoCAQgSBQoDAQgBCgERZ2V0SW50ZWdlck9yVGhyb3cCB2FkZHJlc3MDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJoIAgUHYWRkcmVzcwUDa2V5CQCsAgIJAKwCAgkArAICAgxDYW4ndCByZWFkICcFA2tleQINJyBhdCBhZGRyZXNzIAkApQgBBQdhZGRyZXNzARNnZXRJbnRlZ2VyT3JEZWZhdWx0AwdhZGRyZXNzA2tleQdkZWZhdWx0CQELdmFsdWVPckVsc2UCCQCaCAIFB2FkZHJlc3MFA2tleQUHZGVmYXVsdAERcGFyc2VJbnRPckRlZmF1bHQCCG1heWJlSW50B2RlZmF1bHQJAQt2YWx1ZU9yRWxzZQIJALYJAQUIbWF5YmVJbnQFB2RlZmF1bHQACGF1Y1N0YXJ0CQERZ2V0SW50ZWdlck9yVGhyb3cCBQR0aGlzAg5pbml0X3RpbWVzdGFtcAALYmlkRHVyYXRpb24JARFnZXRJbnRlZ2VyT3JUaHJvdwIFBHRoaXMCDGJpZF9kdXJhdGlvbgAOcmV2ZWFsRHVyYXRpb24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2YWx1ZQEJAJ0IAgUEdGhpcwkBBXZhbHVlAQUSdG9wQmlkZGVyUmV2ZWFsS2V5BAx0b3BCaWRBbW91bnQJAQ1wYXJzZUludFZhbHVlAQkAkQMCCQC1CQIFDXRvcEJpZGRlckRhdGECASwAAQMDCQBmAgUJYmlkQW1vdW50BQx0b3BCaWRBbW91bnQJAGcCBQdkZXBvc2l0BQliaWRBbW91bnQHCQDNCAIFCXJldmVhbEJpZAkBC1N0cmluZ0VudHJ5AgUGdG9wS2V5BQlyZXZlYWxLZXkFCXJldmVhbEJpZAkAzQgCBQlyZXZlYWxCaWQJAQtTdHJpbmdFbnRyeQIFBnRvcEtleQUJcmV2ZWFsS2V5ALc7Jnk=", "height": 2244753, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DjNupLd74zpzo19usda4tfG3rAEAo1eNw6DDKj5orhag Next: 9wjTV58BXSA33YMHQzzcEzFiKfMKzJW7RwfK4iNzwJhH Diff:
OldNewDifferences
7272 let keyMainPart = ((((toString(auctionId) + "_") + address) + "_") + hash)
7373 let revealKey = ("reveal_" + keyMainPart)
7474 let topKey = ((("top_" + toString(auctionId)) + "_") + name)
75- let deposit = valueOrErrorMessage(getInteger(this, ("bid_" + keyMainPart)), ("Bid doesn't exists" + hash))
76- let $t029182975 = calcAuctionData()
77- let currentAuctionId = $t029182975._1
78- let currentPeriod = $t029182975._2
75+ let deposit = valueOrErrorMessage(getInteger(this, ("bid_" + keyMainPart)), ("Bid doesn't exists " + hash))
76+ let $t029192976 = calcAuctionData()
77+ let currentAuctionId = $t029192976._1
78+ let currentPeriod = $t029192976._2
7979 if ((currentAuctionId != auctionId))
8080 then throw("Auctions is already over")
8181 else if ((currentPeriod != "reveal"))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getIntegerOrThrow (address,key) = valueOrErrorMessage(getInteger(address, key), ((("Can't read '" + key) + "' at address ") + toString(address)))
55
66
77 func getIntegerOrDefault (address,key,default) = valueOrElse(getInteger(address, key), default)
88
99
1010 func parseIntOrDefault (maybeInt,default) = valueOrElse(parseInt(maybeInt), default)
1111
1212
1313 let aucStart = getIntegerOrThrow(this, "init_timestamp")
1414
1515 let bidDuration = getIntegerOrThrow(this, "bid_duration")
1616
1717 let revealDuration = getIntegerOrThrow(this, "reveal_duration")
1818
1919 let errorFee = getIntegerOrThrow(this, "error_fee")
2020
2121 let minimalBid = getIntegerOrThrow(this, "minimal_bid")
2222
2323 func calcAuctionData () = {
2424 let auctionDuration = (bidDuration + revealDuration)
2525 let currentAuctionId = ((lastBlock.timestamp - aucStart) / auctionDuration)
2626 let currentPeriodStart = ((currentAuctionId * auctionDuration) + aucStart)
2727 let currentAuctionTime = (lastBlock.timestamp - currentPeriodStart)
2828 let period = if ((currentAuctionTime > bidDuration))
2929 then "reveal"
3030 else "bid"
3131 $Tuple2(currentAuctionId, period)
3232 }
3333
3434
3535 func calcHash (name,amount) = toBase58String(blake2b256_16Kb(keccak256_16Kb((toBytes(name) + toBytes(amount)))))
3636
3737
3838 @Callable(inv)
3939 func init (timestamp,bidDuration,revealDuration,errorFee,minimalBid) = if ((this != inv.caller))
4040 then throw("only self calls are allowed")
4141 else [IntegerEntry("init_timestamp", timestamp), IntegerEntry("bid_duration", bidDuration), IntegerEntry("reveal_duration", revealDuration), IntegerEntry("error_fee", errorFee), IntegerEntry("minimal_bid", minimalBid)]
4242
4343
4444
4545 @Callable(inv)
4646 func bid (auctionId,hash) = {
4747 let address = toString(inv.caller)
4848 let bidKey = ((((("bid_" + toString(auctionId)) + "_") + address) + "_") + hash)
4949 let pmt = if (if ((size(inv.payments) == 1))
5050 then (inv.payments[0].assetId == unit)
5151 else false)
5252 then inv.payments[0].amount
5353 else throw("Single payment required")
5454 let $t021152172 = calcAuctionData()
5555 let currentAuctionId = $t021152172._1
5656 let currentPeriod = $t021152172._2
5757 if ((currentAuctionId != auctionId))
5858 then throw("Auctions is already over")
5959 else if ((currentPeriod != "bid"))
6060 then throw("Bid period is over")
6161 else if (isDefined(getInteger(this, bidKey)))
6262 then throw("Bid with exact amount already presented")
6363 else [IntegerEntry(bidKey, pmt)]
6464 }
6565
6666
6767
6868 @Callable(inv)
6969 func reveal (auctionId,name,bidAmount) = {
7070 let address = toString(inv.caller)
7171 let hash = calcHash(name, bidAmount)
7272 let keyMainPart = ((((toString(auctionId) + "_") + address) + "_") + hash)
7373 let revealKey = ("reveal_" + keyMainPart)
7474 let topKey = ((("top_" + toString(auctionId)) + "_") + name)
75- let deposit = valueOrErrorMessage(getInteger(this, ("bid_" + keyMainPart)), ("Bid doesn't exists" + hash))
76- let $t029182975 = calcAuctionData()
77- let currentAuctionId = $t029182975._1
78- let currentPeriod = $t029182975._2
75+ let deposit = valueOrErrorMessage(getInteger(this, ("bid_" + keyMainPart)), ("Bid doesn't exists " + hash))
76+ let $t029192976 = calcAuctionData()
77+ let currentAuctionId = $t029192976._1
78+ let currentPeriod = $t029192976._2
7979 if ((currentAuctionId != auctionId))
8080 then throw("Auctions is already over")
8181 else if ((currentPeriod != "reveal"))
8282 then throw("Reveal period is over")
8383 else if (isDefined(getString(this, revealKey)))
8484 then throw("Bid is already revealed")
8585 else {
8686 let revealBid = [StringEntry(revealKey, ((((toString(deposit) + ",") + toString(bidAmount)) + ",") + name))]
8787 let topBidderRevealKey = getString(this, topKey)
8888 if (isDefined(topBidderRevealKey))
8989 then {
9090 let topBidderData = value(getString(this, value(topBidderRevealKey)))
9191 let topBidAmount = parseIntValue(split(topBidderData, ",")[1])
9292 if (if ((bidAmount > topBidAmount))
9393 then (deposit >= bidAmount)
9494 else false)
9595 then (revealBid :+ StringEntry(topKey, revealKey))
9696 else revealBid
9797 }
9898 else (revealBid :+ StringEntry(topKey, revealKey))
9999 }
100100 }
101101
102102

github/deemru/w8io/169f3d6 
41.80 ms