tx · RY88okCaxByZC5JUKqdTs3dgPNVevxSEoQjtrDafoXk 3NByvCG2T14xJ3bfRNpKCns37ehfBSTGja3: -0.01400000 Waves 2019.07.28 18:28 [606101] smart account 3NByvCG2T14xJ3bfRNpKCns37ehfBSTGja3 > SELF 0.00000000 Waves
{ "type": 13, "id": "RY88okCaxByZC5JUKqdTs3dgPNVevxSEoQjtrDafoXk", "fee": 1400000, "feeAssetId": null, "timestamp": 1564327778782, "version": 1, "sender": "3NByvCG2T14xJ3bfRNpKCns37ehfBSTGja3", "senderPublicKey": "5ADSy4csCWyBrq24UKNhxf9g1q3ntYJ1JJC7582a5sF1", "proofs": [ "3u2jCRyCgUEy7qwYPopzV7BnzHgV6xV3CZsCYUEDsCZCmh1zSWCbajB8SMGHGbipGueUdw2boaXfcfHdEAYnExHy" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAAARzYWx0AgAAAARzYWx0AAAAAAZyZWJhaXQAAAAAAAAPaVABAAAAEmdldEludGVyZ2VyRGVmYXVsdAAAAAIAAAADa2V5AAAAB2RlZmF1bHQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAAB2RlZmF1bHQAAAADAAAAAWkBAAAAB3Nwb25zb3IAAAABAAAADm9yYWNsZUFkZGRyZXNzBAAAAANrZXkJAAEsAAAAAgIAAAAKc3BvbnNvcmVkXwUAAAAOb3JhY2xlQWRkZHJlc3MEAAAAB3BheW1lbnQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAIhPQAAAAIIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQFAAAABHVuaXQJAAACAAAAAQIAAAAcc3BvbnNvcnNoaXAgbXVzdCBiZSBpbiBXQVZFUwQAAAAIbmV3VmFsdWUJAABkAAAAAggFAAAAB3BheW1lbnQAAAAG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eQAAAAIFAAAACXJldmVhbEtleQUAAAAGcmFuZG9tBQAAAANuaWwAAAAAjxF51Q==", "chainId": 84, "height": 606101, "spentComplexity": 0 } View: original | compacted Prev: GRhoZrFn7UeBasXSDqY4KCPH1YXix5VkyUC5QmvjSFje Next: none Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let salt = "salt" | |
5 | 5 | ||
6 | - | let rebait = | |
6 | + | let rebait = 1010000 | |
7 | 7 | ||
8 | 8 | func getIntergerDefault (key,default) = match getInteger(this, key) { | |
9 | 9 | case a: Int => | |
32 | 32 | let caller = toBase58String(i.caller.bytes) | |
33 | 33 | let commitKey = ((("commit_" + caller) + "_") + toString(height)) | |
34 | 34 | if (isDefined(getString(this, commitKey))) | |
35 | - | then throw("commit already done") | |
35 | + | then throw((("commit for height " + toString(height)) + " already done")) | |
36 | 36 | else WriteSet([DataEntry(commitKey, commit)]) | |
37 | 37 | } | |
38 | 38 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let salt = "salt" | |
5 | 5 | ||
6 | - | let rebait = | |
6 | + | let rebait = 1010000 | |
7 | 7 | ||
8 | 8 | func getIntergerDefault (key,default) = match getInteger(this, key) { | |
9 | 9 | case a: Int => | |
10 | 10 | a | |
11 | 11 | case _ => | |
12 | 12 | default | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | @Callable(i) | |
17 | 17 | func sponsor (oracleAdddress) = { | |
18 | 18 | let key = ("sponsored_" + oracleAdddress) | |
19 | 19 | let payment = extract(i.payment) | |
20 | 20 | if ((payment.assetId != unit)) | |
21 | 21 | then throw("sponsorship must be in WAVES") | |
22 | 22 | else { | |
23 | 23 | let newValue = (payment.amount + getIntergerDefault(key, 0)) | |
24 | 24 | WriteSet([DataEntry(key, newValue)]) | |
25 | 25 | } | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | 30 | @Callable(i) | |
31 | 31 | func commit (commit) = { | |
32 | 32 | let caller = toBase58String(i.caller.bytes) | |
33 | 33 | let commitKey = ((("commit_" + caller) + "_") + toString(height)) | |
34 | 34 | if (isDefined(getString(this, commitKey))) | |
35 | - | then throw("commit already done") | |
35 | + | then throw((("commit for height " + toString(height)) + " already done")) | |
36 | 36 | else WriteSet([DataEntry(commitKey, commit)]) | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | ||
41 | 41 | @Callable(i) | |
42 | 42 | func reveal (revealHeight,random) = if ((extract(parseInt(revealHeight)) >= height)) | |
43 | 43 | then throw("reveal must be in the past blocks after commit") | |
44 | 44 | else { | |
45 | 45 | let caller = toBase58String(i.caller.bytes) | |
46 | 46 | let commit = extract(getString(this, ((("commit_" + caller) + "_") + revealHeight))) | |
47 | 47 | let correctCommit = toBase16String(sha256(toBytes((random + salt)))) | |
48 | 48 | if ((commit != correctCommit)) | |
49 | 49 | then throw("invalid reveal") | |
50 | 50 | else { | |
51 | 51 | let revealKey = ((("reveal_" + caller) + "_") + revealHeight) | |
52 | 52 | if (isDefined(getString(this, revealKey))) | |
53 | 53 | then throw("reveal already in blockchain") | |
54 | 54 | else { | |
55 | 55 | let sponsorKey = ("sponsored_" + caller) | |
56 | 56 | let sponsoredAmount = getIntergerDefault(sponsorKey, 0) | |
57 | 57 | if ((sponsoredAmount >= rebait)) | |
58 | 58 | then ScriptResult(WriteSet([DataEntry(sponsorKey, (sponsoredAmount - rebait)), DataEntry(revealKey, random)]), TransferSet([ScriptTransfer(i.caller, rebait, unit)])) | |
59 | 59 | else WriteSet([DataEntry(revealKey, random)]) | |
60 | 60 | } | |
61 | 61 | } | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 |
github/deemru/w8io/169f3d6 41.14 ms ◑