tx · 54iJvH9CJ31ZvRyq9v2DNk3AzVSzKA6ZrG5EGNdradGW

3MyBgxRjsj4dFVLNqZVMpJuqFcchA1rfdPd:  -0.05000000 Waves

2019.10.17 00:31 [723090] smart account 3MyBgxRjsj4dFVLNqZVMpJuqFcchA1rfdPd > SELF 0.00000000 Waves

{ "type": 13, "id": "54iJvH9CJ31ZvRyq9v2DNk3AzVSzKA6ZrG5EGNdradGW", "fee": 5000000, "feeAssetId": null, "timestamp": 1571261394619, "version": 1, "sender": "3MyBgxRjsj4dFVLNqZVMpJuqFcchA1rfdPd", "senderPublicKey": "FNveiFvnZxbJ2nmWHcE42V2V1LQV3qAtmdpvbFnTimVG", "proofs": [ "2hgZKgqRDiD1kqDoCb4TJhVBVoodhkcBcHe4jpwY63MJoPA8qvUUZGuA3EaWKs9zMH9eJ7essa3MMUxUVh2udw9X" ], "script": "base64:AAIDAAAAAAAAAAwIARIDCgEIEgMKAQEAAAATAAAAAAl3YXZlc0xldHMAAAAAAAX14QAAAAAADlRvdGFsQW1vdW50S2V5AgAAAAtUb3RhbEFtb3VudAAAAAASVG90YWxBbW91bnRMZWZ0S2V5AgAAAA9Ub3RhbEFtb3VudExlZnQAAAAAEVVuaXF1ZVNwb25zb3JzS2V5AgAAAA5VbmlxdWVTcG9uc29ycwAAAAAJRmVlUHVia2V5AQAAACAok4ZZcGaRC+s2MKC22dBEPDzVWEOIB9nM7V46PClPeQAAAAAJRmVlV2FsbGV0CQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAAAlGZWVQdWJrZXkAAAAADnJlY2VpdmVyUHViS2V5AQAAACAlbSP+mgMlNuu7HG4M1vuMOYBvzRL+YwXaxGu6HTwDKwAAAAAIcmVjZWl2ZXIJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEFAAAADnJlY2VpdmVyUHViS2V5AAAAAAdBc3NldGlkAgAAACw0NDdQV3dlcVRRUEY5YW5VS3RrbkR4N2ZOc0d6SENWZ3Ni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AgUAAAAOTGFzdFBheW1lbnRLZXkFAAAABmhlaWdodAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAACHJlY2VpdmVyBQAAAA5XaXRoZHJhd0Ftb3VudAUAAAAEdW5pdAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAlGZWVXYWxsZXQFAAAACUZlZUFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAAFzBQAAAAckbWF0Y2gwBgdjhxj/", "chainId": 84, "height": 723090, "spentComplexity": 0 } View: original | compacted Prev: 67i6kSx1JJWo93FNdP4McdgJSRZ8rJd3ZChRFiDYxT78 Next: Ha6uniSDKBytp5p617nXV3SNJHWbo12fMZXHRq6Wfeyd Diff:
OldNewDifferences
2626 let MaxSalary = 1
2727
2828 let Fee = 2
29+
30+let test = 1
2931
3032 func getNumberByKey (key) = {
3133 let num = match getInteger(this, key) {
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let wavesLets = 100000000
55
66 let TotalAmountKey = "TotalAmount"
77
88 let TotalAmountLeftKey = "TotalAmountLeft"
99
1010 let UniqueSponsorsKey = "UniqueSponsors"
1111
1212 let FeePubkey = base58'3jPnDZ2dMwgNS3NJKwrRaov4EsEygKfrnHPyQDD2bfk4'
1313
1414 let FeeWallet = addressFromPublicKey(FeePubkey)
1515
1616 let receiverPubKey = base58'3X6cLkhy6PLoJ5uJdjke6a3ikfEW8Msf62CaoHRY8YWv'
1717
1818 let receiver = addressFromPublicKey(receiverPubKey)
1919
2020 let Assetid = "447PWweqTQPF9anUKtknDx7fNsGzHCVgsbVJiP8FSGdt"
2121
2222 let LastPaymentKey = "LastPayment"
2323
2424 let PaymentTimeout = 10
2525
2626 let MaxSalary = 1
2727
2828 let Fee = 2
29+
30+let test = 1
2931
3032 func getNumberByKey (key) = {
3133 let num = match getInteger(this, key) {
3234 case a: Int =>
3335 a
3436 case _ =>
3537 0
3638 }
3739 num
3840 }
3941
4042
4143 func GetKeySponsor (sponsor) = (sponsor + "_sponsor")
4244
4345
4446 func GetKeySponsorAmount (sponsor) = (sponsor + "_amount")
4547
4648
4749 func GetSponsorAmount (sponsor) = getNumberByKey(GetKeySponsorAmount(sponsor))
4850
4951
5052 func CheckUniqueSponsor (sponsor,count) = {
5153 let returnval = match getString(this, GetKeySponsor(sponsor)) {
5254 case a: String =>
5355 count
5456 case _ =>
5557 (count + 1)
5658 }
5759 returnval
5860 }
5961
6062
6163 @Callable(i)
6264 func deposit (sponsor) = {
6365 let pmt = extract(i.payment)
6466 if ((pmt.assetId != toBytes(Assetid)))
6567 then throw("Only Assetid can be deposited")
6668 else {
6769 let currentKey = toBase58String(i.caller.bytes)
6870 let currentAmount = getNumberByKey(currentKey)
6971 let CurrSponsorAmount = GetSponsorAmount(currentKey)
7072 let currentTotalAmount = getNumberByKey(TotalAmountKey)
7173 let currentAmountLeft = getNumberByKey(TotalAmountLeftKey)
7274 let UniqueSponsorCount = getNumberByKey(UniqueSponsorsKey)
7375 let newUniqueSponsorCount = CheckUniqueSponsor(currentKey, UniqueSponsorCount)
7476 let newSponsorAmount = (CurrSponsorAmount + pmt.amount)
7577 let newAmount = (currentAmount + pmt.amount)
7678 let newtotalAmount = (currentTotalAmount + pmt.amount)
7779 let newtotalamountleft = (currentAmountLeft + pmt.amount)
7880 WriteSet([DataEntry(currentKey, newAmount), DataEntry(TotalAmountKey, newtotalAmount), DataEntry(TotalAmountLeftKey, newtotalamountleft), DataEntry(GetKeySponsorAmount(currentKey), newSponsorAmount), DataEntry(GetKeySponsor(currentKey), toBytes(sponsor)), DataEntry(UniqueSponsorsKey, newUniqueSponsorCount)])
7981 }
8082 }
8183
8284
8385
8486 @Callable(i)
8587 func withdraw (amount) = {
8688 let currentKey = toBase58String(i.caller.bytes)
8789 let AllowedSigner = (i.caller == receiver)
8890 let FeeAmount = ((amount * Fee) / 100)
8991 let WithdrawAmount = (amount - FeeAmount)
9092 let currentAmountLeft = match getInteger(this, TotalAmountLeftKey) {
9193 case a: Int =>
9294 a
9395 case _ =>
9496 0
9597 }
9698 let lastPayment = match getInteger(this, LastPaymentKey) {
9799 case a: Int =>
98100 a
99101 case _ =>
100102 0
101103 }
102104 if (!(AllowedSigner))
103105 then throw("Withdraw is only allowed by recipient")
104106 else if (((lastPayment + PaymentTimeout) > height))
105107 then throw("Next payment not yet allowed")
106108 else {
107109 let newAmountLeft = (currentAmountLeft - amount)
108110 if ((0 > amount))
109111 then throw("Can't withdraw negative amount")
110112 else if ((amount > (MaxSalary * wavesLets)))
111113 then throw((("Not allowed to withdraw more than " + toString(MaxSalary)) + " WAVES"))
112114 else if ((0 > newAmountLeft))
113115 then throw("Not enough balance")
114116 else ScriptResult(WriteSet([DataEntry(TotalAmountLeftKey, newAmountLeft), DataEntry(LastPaymentKey, height)]), TransferSet([ScriptTransfer(receiver, WithdrawAmount, unit), ScriptTransfer(FeeWallet, FeeAmount, unit)]))
115117 }
116118 }
117119
118120
119121 @Verifier(tx)
120122 func verify () = match tx {
121123 case s: SetScriptTransaction =>
122124 true
123125 case _ =>
124126 false
125127 }
126128

github/deemru/w8io/169f3d6 
43.93 ms