tx · 8ifdjd58QN68Vbca46VBVEwPHvJywsV9Dvpiv7vM7Nmk
3NBvFDxdNYqr5YwFDwSjH28w8edop2SNro1: -0.05000000 Waves
2019.08.28 13:53 [650960] smart account 3NBvFDxdNYqr5YwFDwSjH28w8edop2SNro1 > SELF 0.00000000 Waves
{
"type": 13,
"id": "8ifdjd58QN68Vbca46VBVEwPHvJywsV9Dvpiv7vM7Nmk",
"fee": 5000000,
"feeAssetId": null,
"timestamp": 1566989614094,
"version": 1,
"sender": "3NBvFDxdNYqr5YwFDwSjH28w8edop2SNro1",
"senderPublicKey": "DjqwCd39F7CCYcgBezgGx7BSPdYfzb29ghqJXWyJREw4",
"proofs": [
"5biVqEqBhQf3wzwbq1q7GeQQXm8T9cMiRn3rykEekcrJa3CRuiMhC2ZbVaTjht22NPKaw93gfzd6TBAQzNWFKAvt"
],
"script": "base64:AAIDAAAAAAAAAAAAAAACAAAAAAVBbGljZQkBAAAAB0FkZHJlc3MAAAABAQAAABoBVOy856VgrJ9/8lXm9eIvlmmpqxijF6Dh9QAAAAADQm9iCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUvNfUuckfKc6hN+HxveCxwK3tOEFNSTkyAAAAAQAAAAFpAQAAAAxkaXZpZGVBbW91bnQAAAAABAAAAA50cmFuc2ZlckFtb3VudAkAAGkAAAACCQEAAAAMd2F2ZXNCYWxhbmNlAAAAAQUAAAAEdGhpcwAAAAAAAAAAAgkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAVBbGljZQUAAAAOdHJhbnNmZXJBbW91bnQFAAAABHVuaXQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAADQm9iBQAAAA50cmFuc2ZlckFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAACavLCY=",
"chainId": 84,
"height": 650960,
"spentComplexity": 0
}
View: original | compacted
Prev: r9WxrkAGX7fnFNe9sLYUC2obw77YqHfZryc5GgTy8GJ
Next: none
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
| 4 | + | let Alice = Address(base58'3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8') |
---|
4 | 5 | | |
---|
| 6 | + | let Bob = Address(base58'3N78bNBYhT6pt6nugc6ay1uW1nLEfnRWkJd') |
---|
5 | 7 | | |
---|
6 | 8 | | @Callable(i) |
---|
7 | | - | func deposit () = { |
---|
8 | | - | let pmt = extract(i.payment) |
---|
9 | | - | if (isDefined(pmt.assetId)) |
---|
10 | | - | then throw("can hold waves only at the moment") |
---|
11 | | - | else { |
---|
12 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
13 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
14 | | - | case a: Int => |
---|
15 | | - | a |
---|
16 | | - | case _ => |
---|
17 | | - | 0 |
---|
18 | | - | } |
---|
19 | | - | let newAmount = (currentAmount + pmt.amount) |
---|
20 | | - | WriteSet([DataEntry(currentKey, newAmount)]) |
---|
21 | | - | } |
---|
| 9 | + | func divideAmount () = { |
---|
| 10 | + | let transferAmount = (wavesBalance(this) / 2) |
---|
| 11 | + | TransferSet([ScriptTransfer(Alice, transferAmount, unit), ScriptTransfer(Bob, transferAmount, unit)]) |
---|
22 | 12 | | } |
---|
23 | 13 | | |
---|
24 | | - | |
---|
25 | | - | |
---|
26 | | - | @Callable(i) |
---|
27 | | - | func withdraw (amount) = { |
---|
28 | | - | let currentKey = toBase58String(i.caller.bytes) |
---|
29 | | - | let currentAmount = match getInteger(this, currentKey) { |
---|
30 | | - | case a: Int => |
---|
31 | | - | a |
---|
32 | | - | case _ => |
---|
33 | | - | 0 |
---|
34 | | - | } |
---|
35 | | - | let newAmount = (currentAmount - amount) |
---|
36 | | - | if ((0 > amount)) |
---|
37 | | - | then throw("Can't withdraw negative amount") |
---|
38 | | - | else if ((0 > newAmount)) |
---|
39 | | - | then throw("Not enough balance") |
---|
40 | | - | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) |
---|
41 | | - | } |
---|
42 | | - | |
---|
43 | | - | |
---|
44 | | - | @Verifier(tx) |
---|
45 | | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
46 | 14 | | |
---|