tx · 5QLSnFmbVFC8VijPDYQHHzaeahpzbBmp9rxTHQi57uKZ 3N993f67Vv3Jz3F2VXhGqDR37w6Sw3z3883: -0.01400000 Waves 2023.02.06 00:26 [2436870] smart account 3N993f67Vv3Jz3F2VXhGqDR37w6Sw3z3883 > SELF 0.00000000 Waves
{ "type": 13, "id": "5QLSnFmbVFC8VijPDYQHHzaeahpzbBmp9rxTHQi57uKZ", "fee": 1400000, "feeAssetId": null, "timestamp": 1675632466928, "version": 2, "chainId": 84, "sender": "3N993f67Vv3Jz3F2VXhGqDR37w6Sw3z3883", "senderPublicKey": "4Th7ZmZ8q1gJTWYroiTqkP8SHd97aJUT2bQyKgCyvqZF", "proofs": [ "5MmhmWxjjyUyoNLjPCRjTk1XqTbaWQRth8n5K6mVArNDLfD3D6hcwMyE4LEVfcZe7KUagY7VjYmCurBFzD2um5n7" ], "script": "base64:AAIEAAAAAAAAAAkIAhIAEgMKAQEAAAAAAAAAAgAAAAFpAQAAAAtkZXBvc2l0QlVTRAAAAAAEAAAACXB5bXRlcnJvcgIAAAAjS2luZGx5IG1ha2UgYSBEZXBvc2l0IGFib3ZlIDUgQlVTRC4EAAAAA3BtdAMJAAAAAAAAAgkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkAAAIAAAABBQAAAAlweW10ZXJyb3IEAAAAC0JVU0Rhc3NldGlkAQAAACBrKxJLUQo7JCgQppbMVKNCw/AufUIO4YVSVrkcgR91JAQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAA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jpA9Jfb9hkQjLNxfTGu8B7HRQsGXaAkJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyCQAAaQAAAAIJAABoAAAAAgkAAGgAAAACAAAAAAAAB+kABQAAAAZhbW91bnQAAAAAAAAAAA4AAAAAAAAABaABAAAAINfvY0HxNFX9HI6QPSX2/YZEIyzcX0xrvAex0ULBl2gJBQAAAANuaWwJAAACAAAAAQIAAAAbQmxvY2sgRGlmZmVyZW5jZSBub3QgRm91bmQuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V583HjuA==", "height": 2436870, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AWm2JFTM36YtWxdmtvjdMCGysyR8kdTv6o4J1rJThpWC Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func BuyTNWithWaves () = { | |
8 | - | let SpendWavesValue = 340000000 | |
9 | - | let Dappfeepercentage = 96 | |
10 | - | let calleraddress = toBase58String(i.caller.bytes) | |
11 | - | let AMM_Address = addressFromStringValue("3JjH6bhCEcN3JduEjACmBvLQ1eQvXSnAuyi") | |
12 | - | let WAVES = base58'EzwaF58ssALcUCZ9FbyeD1GTSteoZAQZEDTqBAXHfq8y' | |
13 | - | let kBalanceA = "global_TN_balance" | |
14 | - | let A_asset_balance = getIntegerValue(AMM_Address, kBalanceA) | |
15 | - | let kBalanceB = "global_EzwaF58ssALcUCZ9FbyeD1GTSteoZAQZEDTqBAXHfq8y_balance" | |
16 | - | let B_asset_balance = getIntegerValue(AMM_Address, kBalanceB) | |
17 | - | let newbalanceofWAVES = fraction(B_asset_balance, A_asset_balance, (B_asset_balance + SpendWavesValue)) | |
18 | - | let minAmountToReceive = (A_asset_balance - newbalanceofWAVES) | |
19 | - | let AMM_fee = fraction(minAmountToReceive, Dappfeepercentage, 10000) | |
20 | - | let actualminAmountToReceive = ((minAmountToReceive - AMM_fee) - 2) | |
21 | - | let payment = AttachedPayment(WAVES, SpendWavesValue) | |
22 | - | let invokeToBuyWAVES = invoke(AMM_Address, "swap", [actualminAmountToReceive], [payment]) | |
23 | - | [IntegerEntry("Swap_TN_Amount", actualminAmountToReceive)] | |
7 | + | func depositBUSD () = { | |
8 | + | let pymterror = "Kindly make a Deposit above 5 BUSD." | |
9 | + | let pmt = if ((size(i.payments) == 1)) | |
10 | + | then i.payments[0] | |
11 | + | else throw(pymterror) | |
12 | + | let BUSDassetid = base58'8DLiYZjo3UUaRBTHU7Ayoqg4ihwb6YH1AfXrrhdjQ7K1' | |
13 | + | let currentKey = toBase58String(i.caller.bytes) | |
14 | + | let currentAmount = match getInteger(this, currentKey) { | |
15 | + | case a: Int => | |
16 | + | a | |
17 | + | case _ => | |
18 | + | 0 | |
19 | + | } | |
20 | + | let newAmount = (currentAmount + pmt.amount) | |
21 | + | if ((pmt.assetId != BUSDassetid)) | |
22 | + | then throw((("Kindly Deposit Only " + toBase58String(BUSDassetid)) + " [BUSD].")) | |
23 | + | else if ((15000000 >= pmt.amount)) | |
24 | + | then throw((("Please attach minimum 5 [BUSD] " + toBase58String(BUSDassetid)) + ".")) | |
25 | + | else [IntegerEntry(("Deposit_Height_Of_" + currentKey), height), IntegerEntry(currentKey, newAmount)] | |
26 | + | } | |
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | @Callable(i) | |
31 | + | func withdrawKUSD (amount) = { | |
32 | + | let kUSD = base58'FXvNWA5Gfy8yLPHGScm6Gmn4DSZX9brFZ9qmEkPxAhGk' | |
33 | + | let currentKey = toBase58String(i.caller.bytes) | |
34 | + | let currentAmount = match getInteger(this, currentKey) { | |
35 | + | case a: Int => | |
36 | + | a | |
37 | + | case _ => | |
38 | + | 0 | |
39 | + | } | |
40 | + | let newAmount = (currentAmount - (amount * 1000000)) | |
41 | + | let swapheightkeyname = ("Deposit_Height_Of_" + currentKey) | |
42 | + | let diff = (height - getIntegerValue(this, swapheightkeyname)) | |
43 | + | if ((0 > amount)) | |
44 | + | then throw("Can't withdraw negative kUSD amount") | |
45 | + | else if ((0 > newAmount)) | |
46 | + | then throw("Not enough kUSD balance") | |
47 | + | else if ((518400 > diff)) | |
48 | + | then [IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, (amount * 100000000), base58'FXvNWA5Gfy8yLPHGScm6Gmn4DSZX9brFZ9qmEkPxAhGk'), ScriptTransfer(i.caller, (((diff * amount) * 14) / 1440), base58'FXvNWA5Gfy8yLPHGScm6Gmn4DSZX9brFZ9qmEkPxAhGk')] | |
49 | + | else if ((diff >= 518400)) | |
50 | + | then [IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, (amount * 100000000), base58'FXvNWA5Gfy8yLPHGScm6Gmn4DSZX9brFZ9qmEkPxAhGk'), ScriptTransfer(i.caller, (((518400 * amount) * 14) / 1440), base58'FXvNWA5Gfy8yLPHGScm6Gmn4DSZX9brFZ9qmEkPxAhGk')] | |
51 | + | else throw("Block Difference not Found.") | |
24 | 52 | } | |
25 | 53 | ||
26 | 54 | ||
27 | 55 | @Verifier(tx) | |
28 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
56 | + | func verify () = match tx { | |
57 | + | case _ => | |
58 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
59 | + | } | |
29 | 60 |
github/deemru/w8io/169f3d6 33.39 ms ◑