tx · 4jZtWxoN6tUH5MYMiM5BnwrsZBowbxskuGTKnWc69MUe

3N2HzcM61QM3LsUrsq4UBvi2btJMHyxvVMD:  -0.00200000 Waves

2022.07.14 20:56 [2139721] smart account 3N2HzcM61QM3LsUrsq4UBvi2btJMHyxvVMD > SELF 0.00000000 Waves

{ "type": 13, "id": "4jZtWxoN6tUH5MYMiM5BnwrsZBowbxskuGTKnWc69MUe", "fee": 200000, "feeAssetId": null, "timestamp": 1657821452569, "version": 2, "chainId": 84, "sender": "3N2HzcM61QM3LsUrsq4UBvi2btJMHyxvVMD", "senderPublicKey": "CU5wMqCBg4bC4Zgs8QGiqjjvmeMkSiKo3Ff6k5axJZwr", "proofs": [ "5AcyHSrP5xeViLNUbikRMKDbtBC9hdWRSVDaRXALBLXXVyvoLHUvojRXyKgKddePuffeFNAqHcUiQsoacGuFvCxc" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAABAAAAAAdnZ1Rva2VuAQAAACBrVOjHv/ccQBeJZW/zYCjZI72Il39H9014vm+87tzFkAAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAdnZ1Rva2VuCQAAAgAAAAECAAAATmdnVG9rZW4gOER5aWR2cTh5a1d4bXY2Q3haWlhRdGRqMWFrdGl3UHY0aWJnR1dUZ3hvNWggdG9rZW5zIG9ubHkgYXQgdGhlIG1vbWVudAQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW1vdW50CQAAZAAAAAIFAAAADWN1cnJlbnRBbW91bnQIBQAAAANwbXQAAAAGYW1vdW50CQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAApjdXJyZW50S2V5BQAAAAluZXdBbW91bnQFAAAAA25pbAAAAAFpAQAAAAh3aXRoZHJhdwAAAAEAAAAGYW1vdW50BAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABlAAAAAgUAAAANY3VycmVudEFtb3VudAUAAAAGYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAZhbW91bnQJAAACAAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAluZXdBbW91bnQJAAACAAAAAQIAAAASTm90IGVub3VnaCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABHVuaXQFAAAAA25pbAAAAAAGziiX", "height": 2139721, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D6MbMuk1EUqS8UQ3Z34NeEFBv5rSJm8YteXRWvNRWAxH Next: 4RQ2WLP9sGHKEQKhbLy1WXP3upJt3SipYVEFqywvDKEy Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-
4+let ggToken = base58'8Dyidvq8ykWxmv6CxZZXQtdj1aktiwPv4ibgGWTgxo5h'
55
66 @Callable(i)
77 func deposit () = {
88 let pmt = extract(i.payment)
9- if (isDefined(pmt.assetId))
10- then throw("can hodl waves only at the moment")
9+ if ((pmt.assetId != ggToken))
10+ then throw("ggToken 8Dyidvq8ykWxmv6CxZZXQtdj1aktiwPv4ibgGWTgxo5h tokens only at the moment")
1111 else {
1212 let currentKey = toBase58String(i.caller.bytes)
13- let xxxInvestorBalance = ((currentKey + "_") + "ib")
14- let currentAmount = match getInteger(this, xxxInvestorBalance) {
13+ let currentAmount = match getInteger(this, currentKey) {
1514 case a: Int =>
1615 a
1716 case _ =>
1817 0
1918 }
2019 let newAmount = (currentAmount + pmt.amount)
21- WriteSet([DataEntry(xxxInvestorBalance, newAmount)])
20+ WriteSet([DataEntry(currentKey, newAmount)])
2221 }
2322 }
2423
2726 @Callable(i)
2827 func withdraw (amount) = {
2928 let currentKey = toBase58String(i.caller.bytes)
30- let xxxInvestorBalance = ((currentKey + "_") + "ib")
31- let currentAmount = match getInteger(this, xxxInvestorBalance) {
29+ let currentAmount = match getInteger(this, currentKey) {
3230 case a: Int =>
3331 a
3432 case _ =>
3937 then throw("Can't withdraw negative amount")
4038 else if ((0 > newAmount))
4139 then throw("Not enough balance")
42- else ScriptResult(WriteSet([DataEntry(xxxInvestorBalance, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
43- }
44-
45-
46-
47-@Callable(i)
48-func getFunds (amount) = {
49- let quorum = 2
50- let currentKey = toBase58String(i.caller.bytes)
51- let xxxStartupFund = ((currentKey + "_") + "sf")
52- let xxxStartupVotes = ((currentKey + "_") + "sv")
53- let currentAmount = match getInteger(this, xxxStartupFund) {
54- case a: Int =>
55- a
56- case _ =>
57- 0
58- }
59- let totalVotes = match getInteger(this, xxxStartupVotes) {
60- case a: Int =>
61- a
62- case _ =>
63- 0
64- }
65- let newAmount = (currentAmount - amount)
66- if ((0 > amount))
67- then throw("Can't withdraw negative amount")
68- else if ((0 > newAmount))
69- then throw("Not enough balance")
70- else if ((quorum > totalVotes))
71- then throw("Not enough votes. At least 2 votes required!")
72- else ScriptResult(WriteSet([DataEntry(xxxStartupFund, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
73- }
74-
75-
76-
77-@Callable(i)
78-func vote (amount,address) = {
79- let currentKey = toBase58String(i.caller.bytes)
80- let xxxInvestorBalance = ((currentKey + "_") + "ib")
81- let xxxStartupFund = ((address + "_") + "sf")
82- let xxxStartupVotes = ((address + "_") + "sv")
83- let flagKey = ((address + "_") + currentKey)
84- let flag = match getInteger(this, flagKey) {
85- case a: Int =>
86- a
87- case _ =>
88- 0
89- }
90- let currentAmount = match getInteger(this, xxxInvestorBalance) {
91- case a: Int =>
92- a
93- case _ =>
94- 0
95- }
96- let currentVotes = match getInteger(this, xxxStartupVotes) {
97- case a: Int =>
98- a
99- case _ =>
100- 0
101- }
102- let currentFund = match getInteger(this, xxxStartupFund) {
103- case a: Int =>
104- a
105- case _ =>
106- 0
107- }
108- if ((0 >= amount))
109- then throw("Can't withdraw negative amount")
110- else if ((amount > currentAmount))
111- then throw("Not enough balance!")
112- else if ((flag > 0))
113- then throw("Only one vote per project is possible!")
114- else WriteSet([DataEntry(xxxInvestorBalance, (currentAmount - amount)), DataEntry(xxxStartupVotes, (currentVotes + 1)), DataEntry(flagKey, 1), DataEntry(xxxStartupFund, (currentFund + amount))])
40+ else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
11541 }
11642
11743
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-
4+let ggToken = base58'8Dyidvq8ykWxmv6CxZZXQtdj1aktiwPv4ibgGWTgxo5h'
55
66 @Callable(i)
77 func deposit () = {
88 let pmt = extract(i.payment)
9- if (isDefined(pmt.assetId))
10- then throw("can hodl waves only at the moment")
9+ if ((pmt.assetId != ggToken))
10+ then throw("ggToken 8Dyidvq8ykWxmv6CxZZXQtdj1aktiwPv4ibgGWTgxo5h tokens only at the moment")
1111 else {
1212 let currentKey = toBase58String(i.caller.bytes)
13- let xxxInvestorBalance = ((currentKey + "_") + "ib")
14- let currentAmount = match getInteger(this, xxxInvestorBalance) {
13+ let currentAmount = match getInteger(this, currentKey) {
1514 case a: Int =>
1615 a
1716 case _ =>
1817 0
1918 }
2019 let newAmount = (currentAmount + pmt.amount)
21- WriteSet([DataEntry(xxxInvestorBalance, newAmount)])
20+ WriteSet([DataEntry(currentKey, newAmount)])
2221 }
2322 }
2423
2524
2625
2726 @Callable(i)
2827 func withdraw (amount) = {
2928 let currentKey = toBase58String(i.caller.bytes)
30- let xxxInvestorBalance = ((currentKey + "_") + "ib")
31- let currentAmount = match getInteger(this, xxxInvestorBalance) {
29+ let currentAmount = match getInteger(this, currentKey) {
3230 case a: Int =>
3331 a
3432 case _ =>
3533 0
3634 }
3735 let newAmount = (currentAmount - amount)
3836 if ((0 > amount))
3937 then throw("Can't withdraw negative amount")
4038 else if ((0 > newAmount))
4139 then throw("Not enough balance")
42- else ScriptResult(WriteSet([DataEntry(xxxInvestorBalance, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
43- }
44-
45-
46-
47-@Callable(i)
48-func getFunds (amount) = {
49- let quorum = 2
50- let currentKey = toBase58String(i.caller.bytes)
51- let xxxStartupFund = ((currentKey + "_") + "sf")
52- let xxxStartupVotes = ((currentKey + "_") + "sv")
53- let currentAmount = match getInteger(this, xxxStartupFund) {
54- case a: Int =>
55- a
56- case _ =>
57- 0
58- }
59- let totalVotes = match getInteger(this, xxxStartupVotes) {
60- case a: Int =>
61- a
62- case _ =>
63- 0
64- }
65- let newAmount = (currentAmount - amount)
66- if ((0 > amount))
67- then throw("Can't withdraw negative amount")
68- else if ((0 > newAmount))
69- then throw("Not enough balance")
70- else if ((quorum > totalVotes))
71- then throw("Not enough votes. At least 2 votes required!")
72- else ScriptResult(WriteSet([DataEntry(xxxStartupFund, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
73- }
74-
75-
76-
77-@Callable(i)
78-func vote (amount,address) = {
79- let currentKey = toBase58String(i.caller.bytes)
80- let xxxInvestorBalance = ((currentKey + "_") + "ib")
81- let xxxStartupFund = ((address + "_") + "sf")
82- let xxxStartupVotes = ((address + "_") + "sv")
83- let flagKey = ((address + "_") + currentKey)
84- let flag = match getInteger(this, flagKey) {
85- case a: Int =>
86- a
87- case _ =>
88- 0
89- }
90- let currentAmount = match getInteger(this, xxxInvestorBalance) {
91- case a: Int =>
92- a
93- case _ =>
94- 0
95- }
96- let currentVotes = match getInteger(this, xxxStartupVotes) {
97- case a: Int =>
98- a
99- case _ =>
100- 0
101- }
102- let currentFund = match getInteger(this, xxxStartupFund) {
103- case a: Int =>
104- a
105- case _ =>
106- 0
107- }
108- if ((0 >= amount))
109- then throw("Can't withdraw negative amount")
110- else if ((amount > currentAmount))
111- then throw("Not enough balance!")
112- else if ((flag > 0))
113- then throw("Only one vote per project is possible!")
114- else WriteSet([DataEntry(xxxInvestorBalance, (currentAmount - amount)), DataEntry(xxxStartupVotes, (currentVotes + 1)), DataEntry(flagKey, 1), DataEntry(xxxStartupFund, (currentFund + amount))])
40+ else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
11541 }
11642
11743

github/deemru/w8io/03bedc9 
25.17 ms