tx · E3QUQ9babF8rejcj5DDXAxMHN67K5QssFH7v9sASqs6v
3N5Ju64uTPuaR4M4f9YB5LRYRNJ382MWrat: -0.00600000 Waves
2022.09.29 17:44 [2250534] smart account 3N5Ju64uTPuaR4M4f9YB5LRYRNJ382MWrat > SELF 0.00000000 Waves
{
"type": 13,
"id": "E3QUQ9babF8rejcj5DDXAxMHN67K5QssFH7v9sASqs6v",
"fee": 600000,
"feeAssetId": null,
"timestamp": 1664462683020,
"version": 2,
"chainId": 84,
"sender": "3N5Ju64uTPuaR4M4f9YB5LRYRNJ382MWrat",
"senderPublicKey": "AwWYbCDs6GDxAT6diG2mfEqD7tFz9JXu9k234FS135kR",
"proofs": [
"5hj5zHX37kJabozfQEpcHijBA8ePuXE2NveqwUd9PLQEcpdYzktSjVbkrhs6cEvFDPBbgK2S5662xHFwC1sbjWM4"
],
"script": "base64:AAIFAAAAAAAAAAgIAhIECgIIAQAAAAYAAAAABXJ1bGVyAgAAACxCZ3hwQ200d3hiVzhTS0xQS1puZjRLVTJENlpVMjlvdjhNZ1pya2FTQXFwWQAAAAAIYm9ibWFfaWQCAAAALDV4eXJVb0p1WEpjWXhjOFJmcm9XajRRZUxhdzZ4aEJmQWRTcmVTdFlDUk1uAAAAAAhidWdnc19pZAIAAAAsSDVVVXVQSjdXQlh6amc2WjFhaEJVeGo3VldvVkZGZkczQk16eUFBblJXdDYBAAAADmdldEFzc2V0U3RyaW5nAAAAAQAAAAdhc3NldElkBAAAAAckbWF0Y2gwBQAAAAdhc3NldElkAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFiBQAAAAckbWF0Y2gwCQACWAAAAAEFAAAAAWICAAAABVdBVkVTAQAAAA1nZXRBc3NldEJ5dGVzAAAAAQAAAAdhc3NldElkAwkAAAAAAAACBQAAAAdhc3NldElkAgAAAAVXQVZFUwUAAAAEdW5pdAkAAlkAAAABBQAAAAdhc3NldElkAQAAAAlteUJhbGFuY2UAAAABAAA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MAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkt9tLp",
"height": 2250534,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 6vVHmgqPevTKeDZUg8j8CKm6MrUqptfsDDJVz2gVyM28
Next: DDpUWDq62oidgqFWr8YRJax3Y7f8Q5UmYnsTkmPWrNZ8
Diff:
Old | New | | Differences |
---|
30 | 30 | | |
---|
31 | 31 | | @Callable(i) |
---|
32 | 32 | | func swap (assetOut,minimum) = { |
---|
33 | | - | let caller = toString(i.caller) |
---|
34 | 33 | | let callerPbk = toBase58String(i.callerPublicKey) |
---|
35 | | - | let bomba_balance = myBalance(getAssetBytes(bobma_id)) |
---|
36 | | - | let buggs_balance = myBalance(getAssetBytes(buggs_id)) |
---|
37 | | - | if ((callerPbk == ruler)) |
---|
38 | | - | then throw(((("No-no-no bomba: " + toString(bomba_balance)) + ", buggs: ") + toString(buggs_balance))) |
---|
| 34 | + | if ((callerPbk != ruler)) |
---|
| 35 | + | then throw("No-no-no") |
---|
39 | 36 | | else { |
---|
| 37 | + | let bomba_balance = myBalance(getAssetBytes(bobma_id)) |
---|
| 38 | + | let buggs_balance = myBalance(getAssetBytes(buggs_id)) |
---|
40 | 39 | | let pmt = i.payments[0] |
---|
41 | 40 | | let assetIn = value(pmt.assetId) |
---|
42 | 41 | | let amountIn = value(pmt.amount) |
---|
43 | | - | [IntegerEntry("op", 1)] |
---|
| 42 | + | let amountOut = (amountIn * 2) |
---|
| 43 | + | [ScriptTransfer(i.caller, amountOut, getAssetBytes(assetOut))] |
---|
44 | 44 | | } |
---|
45 | 45 | | } |
---|
46 | 46 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let ruler = "BgxpCm4wxbW8SKLPKZnf4KU2D6ZU29ov8MgZrkaSAqpY" |
---|
5 | 5 | | |
---|
6 | 6 | | let bobma_id = "5xyrUoJuXJcYxc8RfroWj4QeLaw6xhBfAdSreStYCRMn" |
---|
7 | 7 | | |
---|
8 | 8 | | let buggs_id = "H5UUuPJ7WBXzjg6Z1ahBUxj7VWoVFFfG3BMzyAAnRWt6" |
---|
9 | 9 | | |
---|
10 | 10 | | func getAssetString (assetId) = match assetId { |
---|
11 | 11 | | case b: ByteVector => |
---|
12 | 12 | | toBase58String(b) |
---|
13 | 13 | | case _ => |
---|
14 | 14 | | "WAVES" |
---|
15 | 15 | | } |
---|
16 | 16 | | |
---|
17 | 17 | | |
---|
18 | 18 | | func getAssetBytes (assetId) = if ((assetId == "WAVES")) |
---|
19 | 19 | | then unit |
---|
20 | 20 | | else fromBase58String(assetId) |
---|
21 | 21 | | |
---|
22 | 22 | | |
---|
23 | 23 | | func myBalance (assetId) = match assetId { |
---|
24 | 24 | | case b: ByteVector => |
---|
25 | 25 | | assetBalance(this, b) |
---|
26 | 26 | | case _ => |
---|
27 | 27 | | wavesBalance(this).available |
---|
28 | 28 | | } |
---|
29 | 29 | | |
---|
30 | 30 | | |
---|
31 | 31 | | @Callable(i) |
---|
32 | 32 | | func swap (assetOut,minimum) = { |
---|
33 | | - | let caller = toString(i.caller) |
---|
34 | 33 | | let callerPbk = toBase58String(i.callerPublicKey) |
---|
35 | | - | let bomba_balance = myBalance(getAssetBytes(bobma_id)) |
---|
36 | | - | let buggs_balance = myBalance(getAssetBytes(buggs_id)) |
---|
37 | | - | if ((callerPbk == ruler)) |
---|
38 | | - | then throw(((("No-no-no bomba: " + toString(bomba_balance)) + ", buggs: ") + toString(buggs_balance))) |
---|
| 34 | + | if ((callerPbk != ruler)) |
---|
| 35 | + | then throw("No-no-no") |
---|
39 | 36 | | else { |
---|
| 37 | + | let bomba_balance = myBalance(getAssetBytes(bobma_id)) |
---|
| 38 | + | let buggs_balance = myBalance(getAssetBytes(buggs_id)) |
---|
40 | 39 | | let pmt = i.payments[0] |
---|
41 | 40 | | let assetIn = value(pmt.assetId) |
---|
42 | 41 | | let amountIn = value(pmt.amount) |
---|
43 | | - | [IntegerEntry("op", 1)] |
---|
| 42 | + | let amountOut = (amountIn * 2) |
---|
| 43 | + | [ScriptTransfer(i.caller, amountOut, getAssetBytes(assetOut))] |
---|
44 | 44 | | } |
---|
45 | 45 | | } |
---|
46 | 46 | | |
---|
47 | 47 | | |
---|
48 | 48 | | @Verifier(tx) |
---|
49 | 49 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
50 | 50 | | |
---|