tx · 8WZhjX9W6SLAUFf613MbMY5rEVLCJ8SiR5serGGorYP1 3Mu35ZY17eYKTNJDAt3waBLGKuC398ZK9ha: -0.01990000 Waves 2020.10.17 00:36 [1223685] smart account 3Mu35ZY17eYKTNJDAt3waBLGKuC398ZK9ha > SELF 0.00000000 Waves
{ "type": 13, "id": "8WZhjX9W6SLAUFf613MbMY5rEVLCJ8SiR5serGGorYP1", "fee": 1990000, "feeAssetId": null, "timestamp": 1602884176011, "version": 2, "chainId": 84, "sender": "3Mu35ZY17eYKTNJDAt3waBLGKuC398ZK9ha", "senderPublicKey": "ex6ShQCmaXZr3wDm8wGbC3EMesy4a8hsg3hoF1gqDqJ", "proofs": [ "3PZ5jwvkLpuTLogSv9WT2YQG95ucH6Bo6gSPinBFpJz9LmHe7AViQQp4tvscs8mz334FrRiQZYaDcDE6P1VrF1fi" ], "script": "base64:AAIDAAAAAAAAAA0IARIAEgASAwoBARIAAAAAAAAAAAQAAAABaQEAAAAIcGF5WWllbGQAAAAABAAAAAtHb3Zlcm5Ub2tlbgEAAAAgvAZyzUx++c2P/OaSk4N3DovQ0UYK2akT0ub7yzxoPM0EAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIFAAAADWN1cnJlbnRBbW91bnQAAAAAAAAAAAAEAAAABmFtb3VudAkAA+sAAAACBQAAAAR0aGlzBQAAAAtHb3Zlcm5Ub2tlbgMJAABmAAAAAgAAAAAAAAAAAQUAAAAGYW1vdW50CQAAAgAAAAECAAAAIU5vIGVub3VnaCBHb3Zlcm5Ub2tlbiBJbiBDb250cmFjdAkBAAAADFNjcmlwdFJlc3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udHJhY3QgdG8gY2xhaW0gcmV3YXJkAAAAANqbK0U=", "height": 1223685, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CMNtzQ9bmFjXrZVv1zKUs5gyh2m1BVYbyTLH9jTgSSXz Next: v8E3JJiaWBsTPnPrB3yg1ZSwGPEcvL4eFHj1GmZpvG3 Diff:
Old | New | Differences | |
---|---|---|---|
91 | 91 | else if ((currentKey != winnerPrize)) | |
92 | 92 | then throw("You are not the winner hence cannot claim the reward") | |
93 | 93 | else if ((CallerAmount > 0)) | |
94 | - | then | |
94 | + | then TransferSet([ScriptTransfer(winAddress, PrizeAmount, CollateralToken)]) | |
95 | 95 | else throw("You need to have deposit in the Contract to claim reward") | |
96 | 96 | } | |
97 | 97 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func payYield () = { | |
8 | 8 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
9 | 9 | let currentKey = toBase58String(i.caller.bytes) | |
10 | 10 | let currentAmount = match getInteger(this, currentKey) { | |
11 | 11 | case a: Int => | |
12 | 12 | a | |
13 | 13 | case _ => | |
14 | 14 | 0 | |
15 | 15 | } | |
16 | 16 | if ((currentAmount > 0)) | |
17 | 17 | then { | |
18 | 18 | let amount = assetBalance(this, GovernToken) | |
19 | 19 | if ((1 > amount)) | |
20 | 20 | then throw("No enough GovernToken In Contract") | |
21 | 21 | else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken)])) | |
22 | 22 | } | |
23 | 23 | else throw("You need to deposit Collateral Token to receive Govern Token") | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | ||
28 | 28 | @Callable(i) | |
29 | 29 | func deposit () = { | |
30 | 30 | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
31 | 31 | let pmt = extract(i.payment) | |
32 | 32 | if (if (isDefined(pmt.assetId)) | |
33 | 33 | then (extract(pmt.assetId) == CollateralToken) | |
34 | 34 | else false) | |
35 | 35 | then { | |
36 | 36 | let currentKey = toBase58String(i.caller.bytes) | |
37 | 37 | let currentAmount = match getInteger(this, currentKey) { | |
38 | 38 | case a: Int => | |
39 | 39 | a | |
40 | 40 | case _ => | |
41 | 41 | 0 | |
42 | 42 | } | |
43 | 43 | let newAmount = (currentAmount + pmt.amount) | |
44 | 44 | WriteSet([DataEntry(currentKey, newAmount)]) | |
45 | 45 | } | |
46 | 46 | else throw("Can deposit only MyToken") | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | 51 | @Callable(i) | |
52 | 52 | func withdrawFunds (amount) = { | |
53 | 53 | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
54 | 54 | let currentKey = toBase58String(i.caller.bytes) | |
55 | 55 | let currentAmount = match getInteger(this, currentKey) { | |
56 | 56 | case a: Int => | |
57 | 57 | a | |
58 | 58 | case _ => | |
59 | 59 | 0 | |
60 | 60 | } | |
61 | 61 | let newAmount = (currentAmount - amount) | |
62 | 62 | if ((0 > amount)) | |
63 | 63 | then throw("Can't withdraw negative amount") | |
64 | 64 | else if ((0 > newAmount)) | |
65 | 65 | then throw("User cannot withdraw more than deposited funds") | |
66 | 66 | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, CollateralToken)])) | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | ||
71 | 71 | @Callable(i) | |
72 | 72 | func ClaimPrize () = { | |
73 | 73 | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
74 | 74 | let winnerPrize = "3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" | |
75 | 75 | let currentKey = toBase58String(i.caller.bytes) | |
76 | 76 | let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') | |
77 | 77 | let CallerAmount = match getInteger(this, currentKey) { | |
78 | 78 | case a: Int => | |
79 | 79 | a | |
80 | 80 | case _ => | |
81 | 81 | 0 | |
82 | 82 | } | |
83 | 83 | let PrizeAmount = match getInteger(this, "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD") { | |
84 | 84 | case a: Int => | |
85 | 85 | a | |
86 | 86 | case _ => | |
87 | 87 | 0 | |
88 | 88 | } | |
89 | 89 | if ((PrizeAmount == 0)) | |
90 | 90 | then throw("No prize to Claim") | |
91 | 91 | else if ((currentKey != winnerPrize)) | |
92 | 92 | then throw("You are not the winner hence cannot claim the reward") | |
93 | 93 | else if ((CallerAmount > 0)) | |
94 | - | then | |
94 | + | then TransferSet([ScriptTransfer(winAddress, PrizeAmount, CollateralToken)]) | |
95 | 95 | else throw("You need to have deposit in the Contract to claim reward") | |
96 | 96 | } | |
97 | 97 | ||
98 | 98 |
github/deemru/w8io/169f3d6 20.91 ms ◑