tx · 7eRZ3K6wYRsjaiu7NMPja13tcdQ2xosDLaT5ghMzYm2Z
3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep: -0.01400000 Waves
2019.07.10 14:58 [579546] smart account 3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep > SELF 0.00000000 Waves
{
"type": 13,
"id": "7eRZ3K6wYRsjaiu7NMPja13tcdQ2xosDLaT5ghMzYm2Z",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1562759885678,
"version": 1,
"sender": "3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep",
"senderPublicKey": "BJAeTqNbDSA5FiYihZZaSWvD6XL5XjpqVXbTGerBJjRK",
"proofs": [
"42KkcHR9cA9DWU1TE1EBNt3nDFSR8oULUVjHkQiujrqKfgFJckRwbgj2dBWKWEsFYFvTtex7eMtq1ybmFBc2wb9M"
],
"script": "base64:AAIDAAAAAAAAAAAAAAABAQAAABJ1c2VySGFzQWRtaW5BY2Nlc3MAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwAAAAIAAAABaQEAAAADYmV0AAAAAAQAAAAWc3RhcnRUcmFuc2FjdGlvbkhlaWdodAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAAFc3RhcnQEAAAACXRpbWVEZWx0YQkAAGUAAAACBQAAAAZoZWlnaHQFAAAAFnN0YXJ0VHJhbnNhY3Rpb25IZWlnaHQDCQAAZgAAAAIFAAAACXRpbWVEZWx0YQAAAAAAAAAH0AkAAAIAAAABAgAAABZUaGUgYmV0dGluZyB3YXMgY2xvc2VkBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQDCQAAZgAAAAIIBQAAAANwbXQAAAAGYW1vdW50CQEAAAAHZXh0cmFjdAAAAAEJAAQaAAAAAgUAAAAEdGhpcwIAAAAGbWF4QmV0CQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAZtYXhCZXQIBQAAAANwbXQAAAAGYW1vdW50CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQACWAAAAAEIBQAAAAFpAAAAD2NhbGxlclB1YmxpY0tleQgFAAAAA3BtdAAAAAZhbW91bnQFAAAAA25pbAkAAAIAAAABAgAAABpZb3VyIGJldCBpc24ndCB0aGUgbWF4IGJldAkAAAIAAAABAgAAACxZb3UgbmVlZCB0byBwbGFjZSBhIGJldCB1c2luZyB3YXZlcyBjdXJyZW5jeQAAAAFpAQAAAAVzdGFydAAAAAEAAAAKc3RhcnRQcmljZQMJAQAAAAEhAAAAAQkBAAAAEnVzZXJIYXNBZG1pbkFjY2VzcwAAAAEIBQAAAAFpAAAABmNhbGxlcgkAAAIAAAABAgAAABNZb3UgaGF2ZSBubyBhY2Nlc3MhCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAVzdGFydAUAAAAGaGVpZ2h0CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAZtYXhCZXQFAAAACnN0YXJ0UHJpY2UFAAAAA25pbAAAAABuzg+c",
"chainId": 84,
"height": 579546,
"spentComplexity": 0
}
View: original | compacted
Prev: BxQC9RDUncNtfaCs7A95Y321oDSNsK1ceThGC6gpg9ds
Next: BwmqPTVoxR4ZWRX3oYWdtZA5owPU3JcNHd6goNZ3p7sg
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | func userHasAdminAccess (userPublicKey) = { |
---|
5 | | - | let adminPubKey = base58'BJAeTqNbDSA5FiYihZZaSWvD6XL5XjpqVXbTGerBJjRK' |
---|
6 | | - | (userPublicKey != adminPubKey) |
---|
7 | | - | } |
---|
| 4 | + | func userHasAdminAccess (address) = (address == this) |
---|
8 | 5 | | |
---|
9 | 6 | | |
---|
10 | 7 | | @Callable(i) |
---|
11 | | - | func bet (price) = { |
---|
| 8 | + | func bet () = { |
---|
12 | 9 | | let startTransactionHeight = getIntegerValue(this, "start") |
---|
13 | 10 | | let timeDelta = (height - startTransactionHeight) |
---|
14 | 11 | | if ((timeDelta > 2000)) |
---|
15 | 12 | | then throw("The betting was closed") |
---|
16 | | - | else WriteSet([DataEntry(toBase58String(i.callerPublicKey), price)]) |
---|
| 13 | + | else { |
---|
| 14 | + | let pmt = extract(i.payment) |
---|
| 15 | + | 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 | + | else throw("Your bet isn't the max bet") |
---|
| 19 | + | else throw("You need to place a bet using waves currency") |
---|
| 20 | + | } |
---|
17 | 21 | | } |
---|
18 | 22 | | |
---|
19 | 23 | | |
---|
20 | 24 | | |
---|
21 | 25 | | @Callable(i) |
---|
22 | | - | func start () = if (!(userHasAdminAccess(i.callerPublicKey))) |
---|
| 26 | + | func start (startPrice) = if (!(userHasAdminAccess(i.caller))) |
---|
23 | 27 | | then throw("You have no access!") |
---|
24 | | - | else WriteSet([DataEntry("start", height)]) |
---|
| 28 | + | else WriteSet([DataEntry("start", height), DataEntry("maxBet", startPrice)]) |
---|
25 | 29 | | |
---|
26 | 30 | | |
---|