tx · HBBhSEcWc8fwgc28PHv3wpsKgrjEnFCU5CBxWwDitJpm

3MyBgxRjsj4dFVLNqZVMpJuqFcchA1rfdPd:  -0.05000000 Waves

2019.10.17 01:18 [723145] smart account 3MyBgxRjsj4dFVLNqZVMpJuqFcchA1rfdPd > SELF 0.00000000 Waves

{ "type": 13, "id": "HBBhSEcWc8fwgc28PHv3wpsKgrjEnFCU5CBxWwDitJpm", "fee": 5000000, "feeAssetId": null, "timestamp": 1571264318554, "version": 1, "sender": "3MyBgxRjsj4dFVLNqZVMpJuqFcchA1rfdPd", "senderPublicKey": "FNveiFvnZxbJ2nmWHcE42V2V1LQV3qAtmdpvbFnTimVG", "proofs": [ "3XEdTCGfRc4cPSgii9oyFpQ4XeEYWZeD3vUByiKYAWWMnXHroZcp4oW1qMHx2g67LZzfcTFsNiiDMbhGg1VDcDrB" ], "script": "base64:AAIDAAAAAAAAAAwIARIDCgEIEgMKAQEAAAATAAAAAAl3YXZlc0xldHMAAAAAAAX14QAAAAAADlRvdGFsQW1vdW50S2V5AgAAAAtUb3RhbEFtb3VudAAAAAASVG90YWxBbW91bnRMZWZ0S2V5AgAAAA9Ub3RhbEFtb3VudExlZnQAAAAAEVVuaXF1ZVNwb25zb3JzS2V5AgAAAA5VbmlxdWVTcG9uc29ycwAAAAAJRmVlUHVia2V5AQAAACAok4ZZcGaRC+s2MKC22dBEPDzVWEOIB9nM7V46PClPeQAAAAAJRmVlV2FsbGV0CQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAAAlGZWVQdWJrZXkAAAAADnJlY2VpdmVyUHViS2V5AQAAACAlbSP+mgMlNuu7HG4M1vuMOYBvzRL+YwXaxGu6HTwDKwAAAAAIcmVjZWl2ZXIJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEFAAAADnJlY2VpdmVyUHViS2V5AAAAAAdBc3NldGlkAQAAACAtXwbA0Q7uhfCrAR9ZeFYHgPlLE5YOZ+sod5jyZQISnwAAAA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JAQAAAAlEYXRhRW50cnkAAAACBQAAAA5MYXN0UGF5bWVudEtleQUAAAAGaGVpZ2h0BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAIcmVjZWl2ZXIFAAAADldpdGhkcmF3QW1vdW50BQAAAAR1bml0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAACUZlZVdhbGxldAUAAAAJRmVlQW1vdW50BQAAAAR1bml0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAXMFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BxBcOyk=", "chainId": 84, "height": 723145, "spentComplexity": 0 } View: original | compacted Prev: FCQ4WM7zuAZjBPp25CDs7CH71r8GQEgc1XrRuFt8wWXH Next: 8mfVNSEVMBLs1S4mSRg2PS5iug3iTg2sq5m8dQ8s15Co Diff:
OldNewDifferences
5050
5151
5252 func CheckUniqueSponsor (sponsor,count) = {
53- let returnval = match getString(this, GetKeySponsor(sponsor)) {
54- case a: String =>
53+ let returnval = match getBinary(this, GetKeySponsor(sponsor)) {
54+ case a: ByteVector =>
5555 count
5656 case _ =>
5757 (count + 1)
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 = base58'447PWweqTQPF9anUKtknDx7fNsGzHCVgsbVJiP8FSGdt'
2121
2222 let LastPaymentKey = "LastPayment"
2323
2424 let PaymentTimeout = 10
2525
2626 let MaxSalary = 1
2727
2828 let Fee = 2
2929
3030 let test = 2
3131
3232 func getNumberByKey (key) = {
3333 let num = match getInteger(this, key) {
3434 case a: Int =>
3535 a
3636 case _ =>
3737 0
3838 }
3939 num
4040 }
4141
4242
4343 func GetKeySponsor (sponsor) = (sponsor + "_sponsor")
4444
4545
4646 func GetKeySponsorAmount (sponsor) = (sponsor + "_amount")
4747
4848
4949 func GetSponsorAmount (sponsor) = getNumberByKey(GetKeySponsorAmount(sponsor))
5050
5151
5252 func CheckUniqueSponsor (sponsor,count) = {
53- let returnval = match getString(this, GetKeySponsor(sponsor)) {
54- case a: String =>
53+ let returnval = match getBinary(this, GetKeySponsor(sponsor)) {
54+ case a: ByteVector =>
5555 count
5656 case _ =>
5757 (count + 1)
5858 }
5959 returnval
6060 }
6161
6262
6363 @Callable(i)
6464 func deposit (sponsor) = {
6565 let pmt = extract(i.payment)
6666 if ((pmt.assetId != Assetid))
6767 then throw("Only Assetid can be deposited")
6868 else {
6969 let currentKey = toBase58String(i.caller.bytes)
7070 let currentAmount = getNumberByKey(currentKey)
7171 let CurrSponsorAmount = GetSponsorAmount(currentKey)
7272 let currentTotalAmount = getNumberByKey(TotalAmountKey)
7373 let currentAmountLeft = getNumberByKey(TotalAmountLeftKey)
7474 let UniqueSponsorCount = getNumberByKey(UniqueSponsorsKey)
7575 let newUniqueSponsorCount = CheckUniqueSponsor(currentKey, UniqueSponsorCount)
7676 let newSponsorAmount = (CurrSponsorAmount + pmt.amount)
7777 let newAmount = (currentAmount + pmt.amount)
7878 let newtotalAmount = (currentTotalAmount + pmt.amount)
7979 let newtotalamountleft = (currentAmountLeft + pmt.amount)
8080 WriteSet([DataEntry(currentKey, newAmount), DataEntry(TotalAmountKey, newtotalAmount), DataEntry(TotalAmountLeftKey, newtotalamountleft), DataEntry(GetKeySponsorAmount(currentKey), newSponsorAmount), DataEntry(GetKeySponsor(currentKey), toBytes(sponsor)), DataEntry(UniqueSponsorsKey, newUniqueSponsorCount)])
8181 }
8282 }
8383
8484
8585
8686 @Callable(i)
8787 func withdraw (amount) = {
8888 let currentKey = toBase58String(i.caller.bytes)
8989 let AllowedSigner = (i.caller == receiver)
9090 let FeeAmount = ((amount * Fee) / 100)
9191 let WithdrawAmount = (amount - FeeAmount)
9292 let currentAmountLeft = match getInteger(this, TotalAmountLeftKey) {
9393 case a: Int =>
9494 a
9595 case _ =>
9696 0
9797 }
9898 let lastPayment = match getInteger(this, LastPaymentKey) {
9999 case a: Int =>
100100 a
101101 case _ =>
102102 0
103103 }
104104 if (!(AllowedSigner))
105105 then throw("Withdraw is only allowed by recipient")
106106 else if (((lastPayment + PaymentTimeout) > height))
107107 then throw("Next payment not yet allowed")
108108 else {
109109 let newAmountLeft = (currentAmountLeft - amount)
110110 if ((0 > amount))
111111 then throw("Can't withdraw negative amount")
112112 else if ((amount > (MaxSalary * wavesLets)))
113113 then throw((("Not allowed to withdraw more than " + toString(MaxSalary)) + " WAVES"))
114114 else if ((0 > newAmountLeft))
115115 then throw("Not enough balance")
116116 else ScriptResult(WriteSet([DataEntry(TotalAmountLeftKey, newAmountLeft), DataEntry(LastPaymentKey, height)]), TransferSet([ScriptTransfer(receiver, WithdrawAmount, unit), ScriptTransfer(FeeWallet, FeeAmount, unit)]))
117117 }
118118 }
119119
120120
121121 @Verifier(tx)
122122 func verify () = match tx {
123123 case s: SetScriptTransaction =>
124124 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
125125 case _ =>
126126 false
127127 }
128128

github/deemru/w8io/169f3d6 
52.86 ms