tx · 4YhWMpQkvFJah1ashk5xUomxdobUkuppcxpxc6469yFK 3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ: -0.01000000 Waves 2022.05.09 13:37 [2044029] smart account 3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ > SELF 0.00000000 Waves
{ "type": 13, "id": "4YhWMpQkvFJah1ashk5xUomxdobUkuppcxpxc6469yFK", "fee": 1000000, "feeAssetId": null, "timestamp": 1652092766553, "version": 2, "chainId": 84, "sender": "3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ", "senderPublicKey": "BhRnrwd6wVHSkSaWXCjQRjaoXcpCdUW2hkJD6V7uVDxN", "proofs": [ "4kmL8wWd414LoQu68Fvi4kL6qi6HuG9by8AdciapxQgB4Cg7LFA2qf5iJQG81eVGXxh4H1gDTGzxKQPqSosqtfsZ" ], "script": "base64:AAIFAAAAAAAAABgIAhIAEgQKAggBEgMKAQESBQoDCAgBEgAAAAAJAAAAAApzaGlueXdnZ2lkAQAAACCJac8C/7a6udRxltd5uJl2JrB00Hd59HNuhvD0c58GJgAAAAAMYWRtaW5BZGRyZXNzCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABAgAAACMzTXBOdGlQU1JTcTZObmFRWWszOEJmV1N6WmNnQVlUeXJROQAAAAANYXNzZXRzQWRkcmVzcwEAAAAaAVTL5rTBd9cdJy1rFhBLypFI6ymLChqVp5oBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAEAAAANdHJ5R2V0Qm9vbGVhbgAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGwAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAHQm9vbGVhbgQAAAABYg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ZSBub3QgYXV0aG9yaXplZCB0byBwZXJmb3JtIHRoaXMgb3BlcmF0aW9uCQEAAAAQaW50ZXJuYWxUcmFuc2ZlcgAAAAMFAAAAC2Zyb21BZGRyZXNzBQAAAAl0b0FkZHJlc3MFAAAABmFtb3VudAAAAAFpAQAAAAZSZWRlZW0AAAAABAAAAAphZGRyZXNzU3RyCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgQAAAAOcmVzZXJ2ZWRBbW91bnQJAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQkAASwAAAACBQAAAAphZGRyZXNzU3RyAgAAAAlfUmVzZXJ2ZWQDCQAAAAAAAAIFAAAADnJlc2VydmVkQW1vdW50AAAAAAAAAAAACQAAAgAAAAECAAAAEU5vdGhpbmcgdG8gcmVkZWVtCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAAEsAAAAAgUAAAAKYWRkcmVzc1N0cgIAAAAJX1Jlc2VydmVkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAOcmVzZXJ2ZWRBbW91bnQFAAAACnNoaW55d2dnaWQFAAAAA25pbAAAAAArftjs", "height": 2044029, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4FQepgcGSUiM7szPq1pqp5wDqwP9Hxvm9FFWMXP3zhLk Next: 6x5DG9NM6tRwDwEvGw6pZzN1mSpZpL5whQdtLvJCKRFq Diff:
Old | New | Differences | |
---|---|---|---|
32 | 32 | func internalPay (addressStr,amount) = { | |
33 | 33 | let deposited = tryGetInteger((addressStr + "_Deposit")) | |
34 | 34 | if ((0 > (deposited - amount))) | |
35 | - | then throw("Not enough deposit | |
35 | + | then throw("Not enough deposit.") | |
36 | 36 | else if (((deposited - amount) == 0)) | |
37 | 37 | then [DeleteEntry((addressStr + "_Deposit"))] | |
38 | 38 | else [IntegerEntry((addressStr + "_Deposit"), (deposited - amount))] | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func internalTransfer (fromAddress,toAddress,amount) = (internalPay(fromAddress, amount) ++ internalDeposit(toAddress, amount)) | |
49 | - | ||
50 | - | ||
51 | - | @Callable(i) | |
52 | - | func setAssetAddress (assetAddr) = if (if ((i.caller != this)) | |
53 | - | then (i.caller != adminAddress) | |
54 | - | else false) | |
55 | - | then throw("you are not authorized to perform this operation") | |
56 | - | else [StringEntry("AssetAddress", assetAddr)] | |
57 | - | ||
58 | 49 | ||
59 | 50 | ||
60 | 51 | @Callable(i) | |
72 | 63 | then throw("Only $HEG payments allowed") | |
73 | 64 | else { | |
74 | 65 | let amount = tryGetInteger((addressStr + "_Deposit")) | |
75 | - | internalDeposit(addressStr, (amount + amountIn)) | |
66 | + | $Tuple2(internalDeposit(addressStr, (amount + amountIn)), (amount + amountIn)) | |
76 | 67 | } | |
77 | 68 | else throw("Strict value is not equal to itself.") | |
78 | 69 | } | |
90 | 81 | then (i.caller.bytes != assetsAddress) | |
91 | 82 | else false) | |
92 | 83 | then throw("you are not authorized to perform this operation") | |
93 | - | else internalPay(addressStr, amount) | |
84 | + | else $Tuple2(internalPay(addressStr, amount), amount) | |
94 | 85 | ||
95 | 86 | ||
96 | 87 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf' | |
5 | 5 | ||
6 | 6 | let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
7 | 7 | ||
8 | 8 | let assetsAddress = base58'3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb' | |
9 | 9 | ||
10 | 10 | func tryGetInteger (key) = match getInteger(this, key) { | |
11 | 11 | case b: Int => | |
12 | 12 | b | |
13 | 13 | case _ => | |
14 | 14 | 0 | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
19 | 19 | case b: Boolean => | |
20 | 20 | b | |
21 | 21 | case _ => | |
22 | 22 | false | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func internalDeposit (addressStr,amountIn) = { | |
27 | 27 | let amount = tryGetInteger((addressStr + "_Deposit")) | |
28 | 28 | [IntegerEntry((addressStr + "_Deposit"), (amount + amountIn))] | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func internalPay (addressStr,amount) = { | |
33 | 33 | let deposited = tryGetInteger((addressStr + "_Deposit")) | |
34 | 34 | if ((0 > (deposited - amount))) | |
35 | - | then throw("Not enough deposit | |
35 | + | then throw("Not enough deposit.") | |
36 | 36 | else if (((deposited - amount) == 0)) | |
37 | 37 | then [DeleteEntry((addressStr + "_Deposit"))] | |
38 | 38 | else [IntegerEntry((addressStr + "_Deposit"), (deposited - amount))] | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func internalReserve (addressStr,amount) = { | |
43 | 43 | let reservedAmount = tryGetInteger((addressStr + "_Reserved")) | |
44 | 44 | [IntegerEntry((addressStr + "_Reserved"), (reservedAmount + amount))] | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func internalTransfer (fromAddress,toAddress,amount) = (internalPay(fromAddress, amount) ++ internalDeposit(toAddress, amount)) | |
49 | - | ||
50 | - | ||
51 | - | @Callable(i) | |
52 | - | func setAssetAddress (assetAddr) = if (if ((i.caller != this)) | |
53 | - | then (i.caller != adminAddress) | |
54 | - | else false) | |
55 | - | then throw("you are not authorized to perform this operation") | |
56 | - | else [StringEntry("AssetAddress", assetAddr)] | |
57 | - | ||
58 | 49 | ||
59 | 50 | ||
60 | 51 | @Callable(i) | |
61 | 52 | func Deposit () = { | |
62 | 53 | let addressStr = toString(i.originCaller) | |
63 | 54 | let pmt = i.payments[0] | |
64 | 55 | if ((pmt == pmt)) | |
65 | 56 | then { | |
66 | 57 | let amountIn = value(i.payments[0].amount) | |
67 | 58 | if ((amountIn == amountIn)) | |
68 | 59 | then { | |
69 | 60 | let assetIn = pmt.assetId | |
70 | 61 | if ((assetIn == assetIn)) | |
71 | 62 | then if ((assetIn != shinywggid)) | |
72 | 63 | then throw("Only $HEG payments allowed") | |
73 | 64 | else { | |
74 | 65 | let amount = tryGetInteger((addressStr + "_Deposit")) | |
75 | - | internalDeposit(addressStr, (amount + amountIn)) | |
66 | + | $Tuple2(internalDeposit(addressStr, (amount + amountIn)), (amount + amountIn)) | |
76 | 67 | } | |
77 | 68 | else throw("Strict value is not equal to itself.") | |
78 | 69 | } | |
79 | 70 | else throw("Strict value is not equal to itself.") | |
80 | 71 | } | |
81 | 72 | else throw("Strict value is not equal to itself.") | |
82 | 73 | } | |
83 | 74 | ||
84 | 75 | ||
85 | 76 | ||
86 | 77 | @Callable(i) | |
87 | 78 | func Pay (addressStr,amount) = if (if (if ((i.caller != this)) | |
88 | 79 | then (i.caller != adminAddress) | |
89 | 80 | else false) | |
90 | 81 | then (i.caller.bytes != assetsAddress) | |
91 | 82 | else false) | |
92 | 83 | then throw("you are not authorized to perform this operation") | |
93 | - | else internalPay(addressStr, amount) | |
84 | + | else $Tuple2(internalPay(addressStr, amount), amount) | |
94 | 85 | ||
95 | 86 | ||
96 | 87 | ||
97 | 88 | @Callable(i) | |
98 | 89 | func CallerPay (amount) = { | |
99 | 90 | let callerAddr = toString(i.caller) | |
100 | 91 | internalPay(callerAddr, amount) | |
101 | 92 | } | |
102 | 93 | ||
103 | 94 | ||
104 | 95 | ||
105 | 96 | @Callable(i) | |
106 | 97 | func transferCoins (fromAddress,toAddress,amount) = if (if ((i.caller != adminAddress)) | |
107 | 98 | then (i.caller.bytes != assetsAddress) | |
108 | 99 | else false) | |
109 | 100 | then throw("you are not authorized to perform this operation") | |
110 | 101 | else internalTransfer(fromAddress, toAddress, amount) | |
111 | 102 | ||
112 | 103 | ||
113 | 104 | ||
114 | 105 | @Callable(i) | |
115 | 106 | func Redeem () = { | |
116 | 107 | let addressStr = toString(i.caller) | |
117 | 108 | let reservedAmount = tryGetInteger((addressStr + "_Reserved")) | |
118 | 109 | if ((reservedAmount == 0)) | |
119 | 110 | then throw("Nothing to redeem") | |
120 | 111 | else [DeleteEntry((addressStr + "_Reserved")), ScriptTransfer(i.caller, reservedAmount, shinywggid)] | |
121 | 112 | } | |
122 | 113 | ||
123 | 114 |
github/deemru/w8io/169f3d6 83.84 ms ◑