tx · 937rDM1R7WL7zNoS5MiChpfGuyTCri4qA1dex1AoUq7T
3N7qWoNJm2kBsZJ7N44SrccFYyVoCCu6btm: -0.01400000 Waves
2019.07.10 17:50 [579718] smart account 3N7qWoNJm2kBsZJ7N44SrccFYyVoCCu6btm > SELF 0.00000000 Waves
{
"type": 13,
"id": "937rDM1R7WL7zNoS5MiChpfGuyTCri4qA1dex1AoUq7T",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1562770313607,
"version": 1,
"sender": "3N7qWoNJm2kBsZJ7N44SrccFYyVoCCu6btm",
"senderPublicKey": "3nLaq8Mii8HoWP7iB5ruTcozseuC1WzQGJ9MwuX9S9EE",
"proofs": [
"3zk2e6cQ25Bw9Z9dayTdxmtW2zs3QkmSXcPyXVR7ZCJKrVNStNbY3hDLphUMCHRWaCfzNyTKUMejkUZcJvPzfuy"
],
"script": "base64:AAIDAAAAAAAAAAAAAAABAQAAABJ1c2VySGFzQWRtaW5BY2Nlc3MAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwAAAAIAAAABaQEAAAADYmV0AAAAAAQAAAAWc3RhcnRUcmFuc2FjdGlvbkhlaWdodAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAAFc3RhcnQEAAAACXRpbWVEZWx0YQkAAGUAAAACBQAAAAZoZWlnaHQFAAAAFnN0YXJ0VHJhbnNhY3Rpb25IZWlnaHQEAAAABm1heEJldAkBAAAAB2V4dHJhY3QAAAABCQAEGgAAAAIFAAAABHRoaXMCAAAABm1heEJldAQAAAALbWF4QmV0T3duZXIJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEJAQAAAAdleHRyYWN0AAAAAQkABBwAAAACBQAAAAR0aGlzAgAAAAttYXhCZXRPd25lcgMJAABmAAAAAgUAAAAJdGltZURlbHRhAAAAAAAAAAfQCQAAAgAAAAECAAAAFlRoZSBiZXR0aW5nIHdhcyBjb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RQcmljZQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAALbWF4QmV0T3duZXIIBQAAAAFpAAAAD2NhbGxlclB1YmxpY0tleQUAAAADbmlsAAAAAKfmQ40=",
"chainId": 84,
"height": 579718,
"spentComplexity": 0
}
View: original | compacted
Prev: 4be9LBzsvpUdV41yxpeU9yVfUNSDXsFQwvQKKbTh7DcF
Next: none
Diff:
Old | New | | Differences |
---|
8 | 8 | | func bet () = { |
---|
9 | 9 | | let startTransactionHeight = getIntegerValue(this, "start") |
---|
10 | 10 | | let timeDelta = (height - startTransactionHeight) |
---|
| 11 | + | let maxBet = extract(getInteger(this, "maxBet")) |
---|
| 12 | + | let maxBetOwner = addressFromPublicKey(extract(getBinary(this, "maxBetOwner"))) |
---|
11 | 13 | | if ((timeDelta > 2000)) |
---|
12 | 14 | | then throw("The betting was closed") |
---|
13 | 15 | | else { |
---|
14 | 16 | | let pmt = extract(i.payment) |
---|
15 | 17 | | if (!(isDefined(pmt.assetId))) |
---|
16 | | - | then if ((pmt.amount > extract(getInteger(this, "maxBet")))) |
---|
17 | | - | then WriteSet([DataEntry("maxBet", pmt.amount), DataEntry(toBase58String(i.callerPublicKey), pmt.amount)]) |
---|
| 18 | + | then if ((pmt.amount > maxBet)) |
---|
| 19 | + | then ScriptResult(WriteSet([DataEntry("maxBet", pmt.amount), DataEntry("maxBetOwner", i.callerPublicKey), DataEntry(toBase58String(i.callerPublicKey), pmt.amount)]), TransferSet([ScriptTransfer(maxBetOwner, maxBet, unit)])) |
---|
18 | 20 | | else throw("Your bet isn't the max bet") |
---|
19 | 21 | | else throw("You need to place a bet using waves currency") |
---|
20 | 22 | | } |
---|
|
25 | 27 | | @Callable(i) |
---|
26 | 28 | | func start (startPrice) = if (!(userHasAdminAccess(i.caller))) |
---|
27 | 29 | | then throw("You have no access!") |
---|
28 | | - | else WriteSet([DataEntry("start", height), DataEntry("maxBet", startPrice)]) |
---|
| 30 | + | else WriteSet([DataEntry("start", height), DataEntry("maxBet", startPrice), DataEntry("maxBetOwner", i.callerPublicKey)]) |
---|
29 | 31 | | |
---|
30 | 32 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | func userHasAdminAccess (address) = (address == this) |
---|
5 | 5 | | |
---|
6 | 6 | | |
---|
7 | 7 | | @Callable(i) |
---|
8 | 8 | | func bet () = { |
---|
9 | 9 | | let startTransactionHeight = getIntegerValue(this, "start") |
---|
10 | 10 | | let timeDelta = (height - startTransactionHeight) |
---|
| 11 | + | let maxBet = extract(getInteger(this, "maxBet")) |
---|
| 12 | + | let maxBetOwner = addressFromPublicKey(extract(getBinary(this, "maxBetOwner"))) |
---|
11 | 13 | | if ((timeDelta > 2000)) |
---|
12 | 14 | | then throw("The betting was closed") |
---|
13 | 15 | | else { |
---|
14 | 16 | | let pmt = extract(i.payment) |
---|
15 | 17 | | if (!(isDefined(pmt.assetId))) |
---|
16 | | - | then if ((pmt.amount > extract(getInteger(this, "maxBet")))) |
---|
17 | | - | then WriteSet([DataEntry("maxBet", pmt.amount), DataEntry(toBase58String(i.callerPublicKey), pmt.amount)]) |
---|
| 18 | + | then if ((pmt.amount > maxBet)) |
---|
| 19 | + | then ScriptResult(WriteSet([DataEntry("maxBet", pmt.amount), DataEntry("maxBetOwner", i.callerPublicKey), DataEntry(toBase58String(i.callerPublicKey), pmt.amount)]), TransferSet([ScriptTransfer(maxBetOwner, maxBet, unit)])) |
---|
18 | 20 | | else throw("Your bet isn't the max bet") |
---|
19 | 21 | | else throw("You need to place a bet using waves currency") |
---|
20 | 22 | | } |
---|
21 | 23 | | } |
---|
22 | 24 | | |
---|
23 | 25 | | |
---|
24 | 26 | | |
---|
25 | 27 | | @Callable(i) |
---|
26 | 28 | | func start (startPrice) = if (!(userHasAdminAccess(i.caller))) |
---|
27 | 29 | | then throw("You have no access!") |
---|
28 | | - | else WriteSet([DataEntry("start", height), DataEntry("maxBet", startPrice)]) |
---|
| 30 | + | else WriteSet([DataEntry("start", height), DataEntry("maxBet", startPrice), DataEntry("maxBetOwner", i.callerPublicKey)]) |
---|
29 | 31 | | |
---|
30 | 32 | | |
---|