tx · 6py2KX9oKWHjv8AHGXqfSjG1nEcZTzrUDV2LBfz2FCQf 3N7KPSUwpMgvDEVGw1DYBnKDiixSQUXhn2P: -0.01000000 Waves 2023.05.31 08:18 [2601717] smart account 3N7KPSUwpMgvDEVGw1DYBnKDiixSQUXhn2P > SELF 0.00000000 Waves
{ "type": 13, "id": "6py2KX9oKWHjv8AHGXqfSjG1nEcZTzrUDV2LBfz2FCQf", "fee": 1000000, "feeAssetId": null, "timestamp": 1685510362311, "version": 2, "chainId": 84, "sender": "3N7KPSUwpMgvDEVGw1DYBnKDiixSQUXhn2P", "senderPublicKey": "BTvXQMmkgSf57dbcqWxpEvbi3ZYcEeWFkkXDZC6FrneM", "proofs": [ "3pGc8RLXk6NjqgRRKAogecme4HY4J3o3znARq1dKrG3MTCCccYbFTvQX6KdNRvTbLd7YJZupVJVKGJ2g4CHWP5us" ], "script": "base64:BgILCAISABIAEgMKAQEBAAxvd25lckFkZHJlc3MCIzNNdmpBYURZSHBTNEE1SzRDVjNrWk1NRUg5bTlKZEJTdmJxAwFpAQRjYWxsAAQFYXNzZXQJAMMIBwIFQXNzZXQCAAABAAAGBQR1bml0AAAEB2Fzc2V0SWQJALgIAQUFYXNzZXQJAMwIAgkBC0JpbmFyeUVudHJ5AgIDYmluAQAJAMwIAgkBDEJvb2xlYW5FbnRyeQICBGJvb2wGCQDMCAIJAQxJbnRlZ2VyRW50cnkCAgNpbnQAAQkAzAgCCQELU3RyaW5nRW50cnkCAgNzdHICAAkAzAgCCQELRGVsZXRlRW50cnkBAgNzdHIJAMwIAgUFYXNzZXQJAMwIAgkBB1JlaXNzdWUDBQdhc3NldElkAAEHCQDMCAIJAQRCdXJuAgUHYXNzZXRJZAABCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgABBQdhc3NldElkBQNuaWwBaQEHZGVwb3NpdAAECmN1cnJlbnRLZXkJANgEAQgIBQFpBmNhbGxlcgVieXRlcwQNZGVwb3NpdEFtb3Vud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QEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFEGFtb3VudFRvV2l0aERyYXcFBHVuaXQFA25pbAC4L3t2", "height": 2601717, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6iKwBM18VxhwvsPGHhtiahvXFSFeFqNmgfzvT75eTCyG Next: 67zAgh5xzku45yJZx2ry9vECoZ6QKEHfdwcWu4popPS Diff:
Old | New | Differences | |
---|---|---|---|
15 | 15 | @Callable(i) | |
16 | 16 | func deposit () = { | |
17 | 17 | let currentKey = toBase58String(i.caller.bytes) | |
18 | - | let depositAmount = (i.payments[0].amount - 5000000) | |
19 | - | let platformfee = 5000000 | |
20 | - | let totalPlatformFee = getIntegerValue(this, ("platform_bal" + ownerAddress)) | |
18 | + | let depositAmount = (i.payments[0].amount - 50000000) | |
19 | + | let platformfee = 50000000 | |
20 | + | let totalPlatformFee = match getInteger(this, ("platform_bal_" + ownerAddress)) { | |
21 | + | case a: Int => | |
22 | + | a | |
23 | + | case _ => | |
24 | + | 0 | |
25 | + | } | |
21 | 26 | let platformFeeInc = (totalPlatformFee + platformfee) | |
22 | 27 | [IntegerEntry(("balance_" + currentKey), depositAmount), IntegerEntry(("platform_bal_" + ownerAddress), platformFeeInc)] | |
23 | 28 | } | |
28 | 33 | func withDraw (amountToWithDraw) = { | |
29 | 34 | let Caller = toBase58String(i.caller.bytes) | |
30 | 35 | let currentKey = toBase58String(i.caller.bytes) | |
31 | - | let | |
36 | + | let currentPlatformAmount = match getInteger(this, ("platform_bal_" + Caller)) { | |
32 | 37 | case a: Int => | |
33 | 38 | a | |
34 | 39 | case _ => | |
35 | 40 | 0 | |
36 | 41 | } | |
37 | - | let newAmount = ( | |
42 | + | let newAmount = (currentPlatformAmount - amountToWithDraw) | |
38 | 43 | if ((Caller != ownerAddress)) | |
39 | 44 | then throw("Not Authorized") | |
40 | - | else if (( | |
45 | + | else if ((currentPlatformAmount == 0)) | |
41 | 46 | then throw("No sufficent amount available") | |
42 | - | else [IntegerEntry(("platform_bal" + ownerAddress), newAmount), ScriptTransfer(i.caller, amountToWithDraw, unit)] | |
47 | + | else [IntegerEntry(("platform_bal_" + ownerAddress), newAmount), ScriptTransfer(i.caller, amountToWithDraw, unit)] | |
43 | 48 | } | |
44 | 49 | ||
45 | 50 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ownerAddress = "3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq" | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func call () = { | |
8 | 8 | let asset = Issue("Asset", "", 1, 0, true, unit, 0) | |
9 | 9 | let assetId = calculateAssetId(asset) | |
10 | 10 | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), asset, Reissue(assetId, 1, false), Burn(assetId, 1), ScriptTransfer(i.caller, 1, assetId)] | |
11 | 11 | } | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
15 | 15 | @Callable(i) | |
16 | 16 | func deposit () = { | |
17 | 17 | let currentKey = toBase58String(i.caller.bytes) | |
18 | - | let depositAmount = (i.payments[0].amount - 5000000) | |
19 | - | let platformfee = 5000000 | |
20 | - | let totalPlatformFee = getIntegerValue(this, ("platform_bal" + ownerAddress)) | |
18 | + | let depositAmount = (i.payments[0].amount - 50000000) | |
19 | + | let platformfee = 50000000 | |
20 | + | let totalPlatformFee = match getInteger(this, ("platform_bal_" + ownerAddress)) { | |
21 | + | case a: Int => | |
22 | + | a | |
23 | + | case _ => | |
24 | + | 0 | |
25 | + | } | |
21 | 26 | let platformFeeInc = (totalPlatformFee + platformfee) | |
22 | 27 | [IntegerEntry(("balance_" + currentKey), depositAmount), IntegerEntry(("platform_bal_" + ownerAddress), platformFeeInc)] | |
23 | 28 | } | |
24 | 29 | ||
25 | 30 | ||
26 | 31 | ||
27 | 32 | @Callable(i) | |
28 | 33 | func withDraw (amountToWithDraw) = { | |
29 | 34 | let Caller = toBase58String(i.caller.bytes) | |
30 | 35 | let currentKey = toBase58String(i.caller.bytes) | |
31 | - | let | |
36 | + | let currentPlatformAmount = match getInteger(this, ("platform_bal_" + Caller)) { | |
32 | 37 | case a: Int => | |
33 | 38 | a | |
34 | 39 | case _ => | |
35 | 40 | 0 | |
36 | 41 | } | |
37 | - | let newAmount = ( | |
42 | + | let newAmount = (currentPlatformAmount - amountToWithDraw) | |
38 | 43 | if ((Caller != ownerAddress)) | |
39 | 44 | then throw("Not Authorized") | |
40 | - | else if (( | |
45 | + | else if ((currentPlatformAmount == 0)) | |
41 | 46 | then throw("No sufficent amount available") | |
42 | - | else [IntegerEntry(("platform_bal" + ownerAddress), newAmount), ScriptTransfer(i.caller, amountToWithDraw, unit)] | |
47 | + | else [IntegerEntry(("platform_bal_" + ownerAddress), newAmount), ScriptTransfer(i.caller, amountToWithDraw, unit)] | |
43 | 48 | } | |
44 | 49 | ||
45 | 50 |
github/deemru/w8io/026f985 42.39 ms ◑