1 | | - | {-# STDLIB_VERSION 3 #-} |
---|
2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | |
---|
5 | | - | |
---|
6 | | - | @Callable(a) |
---|
7 | | - | func deposit () = { |
---|
8 | | - | let b = extract(a.payment) |
---|
9 | | - | let c = base58'FGZTpAqL2wwfXwFRX32tAeD88Uaw8LSt3DPS312XodHZ' |
---|
10 | | - | if (isDefined(b.assetId)) |
---|
11 | | - | then throw("can hodl AAico only at the moment") |
---|
12 | | - | else { |
---|
13 | | - | let d = toBase58String(a.caller.bytes) |
---|
14 | | - | let e = { |
---|
15 | | - | let f = getInteger(this, d) |
---|
16 | | - | if ($isInstanceOf(f, "Int")) |
---|
17 | | - | then { |
---|
18 | | - | let g = f |
---|
19 | | - | g |
---|
20 | | - | } |
---|
21 | | - | else 0 |
---|
22 | | - | } |
---|
23 | | - | let h = (e + b.amount) |
---|
24 | | - | WriteSet([DataEntry(d, h)]) |
---|
25 | | - | } |
---|
26 | | - | } |
---|
27 | | - | |
---|
28 | | - | |
---|
29 | | - | |
---|
30 | | - | @Callable(a) |
---|
31 | | - | func withdraw (i) = { |
---|
32 | | - | let d = toBase58String(a.caller.bytes) |
---|
33 | | - | let e = { |
---|
34 | | - | let f = getInteger(this, d) |
---|
35 | | - | if ($isInstanceOf(f, "Int")) |
---|
36 | | - | then { |
---|
37 | | - | let g = f |
---|
38 | | - | g |
---|
39 | | - | } |
---|
40 | | - | else 0 |
---|
41 | | - | } |
---|
42 | | - | let h = (e - i) |
---|
43 | | - | if ((0 > i)) |
---|
44 | | - | then throw("Can't withdraw negative amount") |
---|
45 | | - | else if ((0 > h)) |
---|
46 | | - | then throw("Not enough balance") |
---|
47 | | - | else ScriptResult(WriteSet([DataEntry(d, h)]), TransferSet([ScriptTransfer(a.caller, i, unit)])) |
---|
48 | | - | } |
---|
49 | | - | |
---|
50 | | - | |
---|
51 | | - | @Verifier(j) |
---|
52 | | - | func k () = true |
---|
53 | | - | |
---|
| 1 | + | # no script |
---|