tx · Gz8hcS4Mxrsy4NhDn95uxTMMsxDY8nmiuJ9XkHdG5uBC
3N3UmzKXACreLX3MxuUSf1zKdxC6GjE8wHD: -0.01400000 Waves
2021.05.11 16:57 [1521104] smart account 3N3UmzKXACreLX3MxuUSf1zKdxC6GjE8wHD > SELF 0.00000000 Waves
{
"type": 13,
"id": "Gz8hcS4Mxrsy4NhDn95uxTMMsxDY8nmiuJ9XkHdG5uBC",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1620741517425,
"version": 1,
"sender": "3N3UmzKXACreLX3MxuUSf1zKdxC6GjE8wHD",
"senderPublicKey": "Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8",
"proofs": [
"3h6nvpuoovBZtc2JYaijCB866SVmWpzofCP3UxAhoGfMza1NJfwQPZxUvyAnqGQ4Z66e6q29eyJhHKta8nxK9Ssp"
],
"script": "base64:AAIDAAAAAAAAAAQIARIAAAAABgAAAAALZGljZU51bWJlcnMJAARMAAAAAgAAAAAAAAAAAQkABEwAAAACAAAAAAAAAAACCQAETAAAAAIAAAAAAAAAAAMJAARMAAAAAgAAAAAAAAAABAkABEwAAAACAAAAAAAAAAAFCQAETAAAAAIAAAAAAAAAAAYJAARMAAAAAgAAAAAAAAAABwkABEwAAAACAAAAAAAAAAAIBQAAAANuaWwAAAAADkdBTUVJTlBST0dSRVNTAAAAAAAAAAAAAAAAAAxHQU1FRklOSVNIRUQAAAAAAAAAAAAAAAAAE2dhbWVNYXN0ZXJQdWJsaWNLZXkBAAAAIK9A06gZuS3fBWT2Smv7IP105RjssF0Y0JssrkxWRKh1AAAAAAlnYW1lVG9rZW4BAAAAIK5gG7nVQrpvLZOnYFVOI3kG7J/W0G+EQyJ8FisXZ2EDAAAAABBsYXN0Um9sbGVkTnVtYmVyAAAAAAAAAAAAAAAAAQAAAAFpAQAAAAlzdGFydEdhbWUAAAAABAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAhY2FuIGhvZGwgd2F2ZXMgb25seSBhdCB0aGUgbW9tZW50BAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABkAAAAAgUAAAANY3VycmVudEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5oc1tbA==",
"chainId": 84,
"height": 1521104,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 4gmNqxY6acnTjwUKEDQJhrmTPmtDPVK9Q7fdY6QdCRzJ
Next: 2imwiXE3DHUoBbWZ79uzWB8QGi2x2aXGXRUTjdoRPmtn
Diff:
Old | New | | Differences |
---|
7 | 7 | | |
---|
8 | 8 | | let GAMEFINISHED = 0 |
---|
9 | 9 | | |
---|
| 10 | + | let gameMasterPublicKey = base58'Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8' |
---|
| 11 | + | |
---|
| 12 | + | let gameToken = base58'CjgwQi4TUfkHaLgTigyd3xuEpT3GU1ihtHxK2uy5VG4S' |
---|
| 13 | + | |
---|
10 | 14 | | let lastRolledNumber = 0 |
---|
11 | 15 | | |
---|
12 | 16 | | @Callable(i) |
---|
13 | | - | func deposit () = { |
---|
| 17 | + | func startGame () = { |
---|
14 | 18 | | let pmt = extract(i.payment) |
---|
15 | 19 | | if (isDefined(pmt.assetId)) |
---|
16 | 20 | | then throw("can hodl waves only at the moment") |
---|
|
28 | 32 | | } |
---|
29 | 33 | | |
---|
30 | 34 | | |
---|
31 | | - | |
---|
32 | | - | @Callable(i) |
---|
33 | | - | func withdraw (amount) = { |
---|
34 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
35 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
36 | | - | case a: Int => |
---|
37 | | - | a |
---|
38 | | - | case _ => |
---|
39 | | - | 0 |
---|
40 | | - | } |
---|
41 | | - | let newAmount = (currentAmount - amount) |
---|
42 | | - | if ((0 > amount)) |
---|
43 | | - | then throw("Can't withdraw negative amount") |
---|
44 | | - | else if ((0 > newAmount)) |
---|
45 | | - | then throw("Not enough balance") |
---|
46 | | - | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) |
---|
47 | | - | } |
---|
48 | | - | |
---|
49 | | - | |
---|
50 | 35 | | @Verifier(tx) |
---|
51 | 36 | | func verify () = match tx { |
---|
52 | 37 | | case _ => |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let diceNumbers = [1, 2, 3, 4, 5, 6, 7, 8] |
---|
5 | 5 | | |
---|
6 | 6 | | let GAMEINPROGRESS = 0 |
---|
7 | 7 | | |
---|
8 | 8 | | let GAMEFINISHED = 0 |
---|
9 | 9 | | |
---|
| 10 | + | let gameMasterPublicKey = base58'Co7gTLr7ZJvVKwToLpuZJqmkVecy5uwupYH6qCkKuhc8' |
---|
| 11 | + | |
---|
| 12 | + | let gameToken = base58'CjgwQi4TUfkHaLgTigyd3xuEpT3GU1ihtHxK2uy5VG4S' |
---|
| 13 | + | |
---|
10 | 14 | | let lastRolledNumber = 0 |
---|
11 | 15 | | |
---|
12 | 16 | | @Callable(i) |
---|
13 | | - | func deposit () = { |
---|
| 17 | + | func startGame () = { |
---|
14 | 18 | | let pmt = extract(i.payment) |
---|
15 | 19 | | if (isDefined(pmt.assetId)) |
---|
16 | 20 | | then throw("can hodl waves only at the moment") |
---|
17 | 21 | | else { |
---|
18 | 22 | | let currentKey = toBase58String(i.caller.bytes) |
---|
19 | 23 | | let currentAmount = match getInteger(this, currentKey) { |
---|
20 | 24 | | case a: Int => |
---|
21 | 25 | | a |
---|
22 | 26 | | case _ => |
---|
23 | 27 | | 0 |
---|
24 | 28 | | } |
---|
25 | 29 | | let newAmount = (currentAmount + pmt.amount) |
---|
26 | 30 | | WriteSet([DataEntry(currentKey, newAmount)]) |
---|
27 | 31 | | } |
---|
28 | 32 | | } |
---|
29 | 33 | | |
---|
30 | 34 | | |
---|
31 | | - | |
---|
32 | | - | @Callable(i) |
---|
33 | | - | func withdraw (amount) = { |
---|
34 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
35 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
36 | | - | case a: Int => |
---|
37 | | - | a |
---|
38 | | - | case _ => |
---|
39 | | - | 0 |
---|
40 | | - | } |
---|
41 | | - | let newAmount = (currentAmount - amount) |
---|
42 | | - | if ((0 > amount)) |
---|
43 | | - | then throw("Can't withdraw negative amount") |
---|
44 | | - | else if ((0 > newAmount)) |
---|
45 | | - | then throw("Not enough balance") |
---|
46 | | - | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) |
---|
47 | | - | } |
---|
48 | | - | |
---|
49 | | - | |
---|
50 | 35 | | @Verifier(tx) |
---|
51 | 36 | | func verify () = match tx { |
---|
52 | 37 | | case _ => |
---|
53 | 38 | | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
54 | 39 | | } |
---|
55 | 40 | | |
---|