tx · DogKWkJZ2U9s7rrUKWLvtdwWRygno1fbtD1BmHA1Nf3K 3N3en9HRhzbk3DDqeGd6DUKc1SG4rmpXguH: -0.09900000 Waves 2020.10.17 22:44 [1225009] smart account 3N3en9HRhzbk3DDqeGd6DUKc1SG4rmpXguH > SELF 0.00000000 Waves
{ "type": 13, "id": "DogKWkJZ2U9s7rrUKWLvtdwWRygno1fbtD1BmHA1Nf3K", "fee": 9900000, "feeAssetId": null, "timestamp": 1602963903145, "version": 2, "chainId": 84, "sender": "3N3en9HRhzbk3DDqeGd6DUKc1SG4rmpXguH", "senderPublicKey": "3UC2eCnSLx9fHcXvssZJZLNzMshb9NM6GchfmEhx6syQ", "proofs": [ "2tXJTA6ghMgTRyMf1AjCf8tBBNZBdEcANCDkkQBPnd3RBusHWD7mHa3nJL7MNMGbNJqEqcMGYdDkthbmqowvD4Ez" ], "script": "base64:AAIDAAAAAAAAAA0IARIAEgASAwoBARIAAAAAAAAAAAQAAAABaQEAAAAIcGF5WWllbGQAAAAABAAAAAtHb3Zlcm5Ub2tlbgEAAAAgvAZyzUx++c2P/OaSk4N3DovQ0UYK2akT0ub7yzxoPM0EAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIFAAAADWN1cnJlbnRBbW91bnQAAAAAAAAAAAAEAAAAEUdvdmVyblRva2VuQW1vdW50CQAD6wAAAAIFAAAABHRoaXMFAAAAC0dvdmVyblRva2VuAwkAAGYAAAACAAAAAAAAAAABBQAAABFHb3Zlcm5Ub2tlbkFtb3VudAkAAAIAAAABAgAAACFObyBlbm91Z2ggR292ZXJuVG9rZW4gSW4gQ29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RyeQAAAAIFAAAAB0Z1bmRCb3gAAAAAAAAAAAAJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkAAAAAAAAAAAEFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAp3aW5BZGRyZXNzBQAAAAtQcml6ZUFtb3VudAUAAAAPQ29sbGF0ZXJhbFRva2VuCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAACgUAAAALR292ZXJuVG9rZW4FAAAAA25pbAkAAAIAAAABAgAAADhZb3UgbmVlZCB0byBoYXZlIGRlcG9zaXQgaW4gdGhlIENvbnRyYWN0IHRvIGNsYWltIHJld2FyZAAAAADJa7p1", "height": 1225009, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2dr36NNg3enjc7r9dj1x4jH3pFVR6Q7HpWnnCFKUnBPE Next: 5L9iM798B2SFnAozFV6qCf6fgBx8ytmvxFE3ovuXYVfv Diff:
Old | New | Differences | |
---|---|---|---|
81 | 81 | @Callable(i) | |
82 | 82 | func ClaimPrize () = { | |
83 | 83 | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
84 | + | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
84 | 85 | let winnerPrize = "3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" | |
86 | + | let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') | |
87 | + | let FundBoxAddress = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') | |
85 | 88 | let FundBox = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD" | |
86 | 89 | let currentKey = toBase58String(i.caller.bytes) | |
87 | - | let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') | |
88 | - | let FundBoxAddress = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') | |
89 | 90 | let CallerAmount = match getInteger(this, currentKey) { | |
90 | 91 | case a: Int => | |
91 | 92 | a | |
103 | 104 | else if ((currentKey != winnerPrize)) | |
104 | 105 | then throw("You are not the winner hence cannot claim the reward") | |
105 | 106 | else if ((CallerAmount > 0)) | |
106 | - | then ScriptResult(WriteSet([DataEntry(winnerPrize, PrizeAmount), DataEntry(FundBox, 0)]), TransferSet([ScriptTransfer(winAddress, PrizeAmount, CollateralToken)])) | |
107 | + | then ScriptResult(WriteSet([DataEntry(winnerPrize, PrizeAmount), DataEntry(FundBox, 0), DataEntry(currentKey, 1)]), TransferSet([ScriptTransfer(winAddress, PrizeAmount, CollateralToken), ScriptTransfer(i.caller, 10, GovernToken)])) | |
107 | 108 | else throw("You need to have deposit in the Contract to claim reward") | |
108 | 109 | } | |
109 | 110 |
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 GovernTokenAmount = assetBalance(this, GovernToken) | |
19 | 19 | if ((1 > GovernTokenAmount)) | |
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 GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
32 | 32 | let pmt = extract(i.payment) | |
33 | 33 | if (if (isDefined(pmt.assetId)) | |
34 | 34 | then (extract(pmt.assetId) == CollateralToken) | |
35 | 35 | else false) | |
36 | 36 | then { | |
37 | 37 | let currentKey = toBase58String(i.caller.bytes) | |
38 | 38 | let currentAmount = match getInteger(this, currentKey) { | |
39 | 39 | case a: Int => | |
40 | 40 | a | |
41 | 41 | case _ => | |
42 | 42 | 0 | |
43 | 43 | } | |
44 | 44 | let newAmount = (currentAmount + pmt.amount) | |
45 | 45 | let GovernTokenAmount = assetBalance(this, GovernToken) | |
46 | 46 | if ((1 > GovernTokenAmount)) | |
47 | 47 | then throw("No enough GovernToken In Contract") | |
48 | 48 | else ScriptResult(WriteSet([DataEntry(currentKey, 10), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)])) | |
49 | 49 | } | |
50 | 50 | else throw("Can deposit only MyToken") | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | ||
55 | 55 | @Callable(i) | |
56 | 56 | func withdrawFunds (amount) = { | |
57 | 57 | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
58 | 58 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
59 | 59 | let currentKey = toBase58String(i.caller.bytes) | |
60 | 60 | let currentAmount = match getInteger(this, currentKey) { | |
61 | 61 | case a: Int => | |
62 | 62 | a | |
63 | 63 | case _ => | |
64 | 64 | 0 | |
65 | 65 | } | |
66 | 66 | let newAmount = (currentAmount - amount) | |
67 | 67 | if ((0 > amount)) | |
68 | 68 | then throw("Can't withdraw negative amount") | |
69 | 69 | else if ((0 > newAmount)) | |
70 | 70 | then throw("User cannot withdraw more than deposited funds") | |
71 | 71 | else { | |
72 | 72 | let GovernTokenAmount = assetBalance(this, GovernToken) | |
73 | 73 | if ((1 > GovernTokenAmount)) | |
74 | 74 | then throw("No enough GovernToken In Contract") | |
75 | 75 | else ScriptResult(WriteSet([DataEntry(currentKey, 1), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken), ScriptTransfer(i.caller, amount, CollateralToken)])) | |
76 | 76 | } | |
77 | 77 | } | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
81 | 81 | @Callable(i) | |
82 | 82 | func ClaimPrize () = { | |
83 | 83 | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
84 | + | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
84 | 85 | let winnerPrize = "3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" | |
86 | + | let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') | |
87 | + | let FundBoxAddress = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') | |
85 | 88 | let FundBox = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD" | |
86 | 89 | let currentKey = toBase58String(i.caller.bytes) | |
87 | - | let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') | |
88 | - | let FundBoxAddress = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') | |
89 | 90 | let CallerAmount = match getInteger(this, currentKey) { | |
90 | 91 | case a: Int => | |
91 | 92 | a | |
92 | 93 | case _ => | |
93 | 94 | 0 | |
94 | 95 | } | |
95 | 96 | let PrizeAmount = match getInteger(this, FundBox) { | |
96 | 97 | case a: Int => | |
97 | 98 | a | |
98 | 99 | case _ => | |
99 | 100 | 0 | |
100 | 101 | } | |
101 | 102 | if ((PrizeAmount == 0)) | |
102 | 103 | then throw("No prize to Claim") | |
103 | 104 | else if ((currentKey != winnerPrize)) | |
104 | 105 | then throw("You are not the winner hence cannot claim the reward") | |
105 | 106 | else if ((CallerAmount > 0)) | |
106 | - | then ScriptResult(WriteSet([DataEntry(winnerPrize, PrizeAmount), DataEntry(FundBox, 0)]), TransferSet([ScriptTransfer(winAddress, PrizeAmount, CollateralToken)])) | |
107 | + | then ScriptResult(WriteSet([DataEntry(winnerPrize, PrizeAmount), DataEntry(FundBox, 0), DataEntry(currentKey, 1)]), TransferSet([ScriptTransfer(winAddress, PrizeAmount, CollateralToken), ScriptTransfer(i.caller, 10, GovernToken)])) | |
107 | 108 | else throw("You need to have deposit in the Contract to claim reward") | |
108 | 109 | } | |
109 | 110 | ||
110 | 111 |
github/deemru/w8io/169f3d6 32.47 ms ◑