tx · 3AWcH11UPGnenDKJXu7DNgGJFR89yFYPNQnchuLQuPa2
3Ms8fqbXM4RhmM6CPTr44hUwHe2CCmVCfVA: -0.01000000 Waves
2023.09.03 00:52 [2738305] smart account 3Ms8fqbXM4RhmM6CPTr44hUwHe2CCmVCfVA > SELF 0.00000000 Waves
{
"type": 13,
"id": "3AWcH11UPGnenDKJXu7DNgGJFR89yFYPNQnchuLQuPa2",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1693691564559,
"version": 2,
"chainId": 84,
"sender": "3Ms8fqbXM4RhmM6CPTr44hUwHe2CCmVCfVA",
"senderPublicKey": "HQQ69Dum2Dp6ikGs7dfYRtTema79wqesthHx1wHmHC5Q",
"proofs": [
"C77cFUTDGqe8xEujX5kUr5HQqVupg3dtfsN1o7tYK35Xx1N3DM8aXv7Q6EGNiC9Psht7SS9ePedyBcFiUKUrJhy"
],
"script": "base64:AAIFAAAAAAAAAAkIAhIDCgEIEgAAAAACAQAAABRnZXRXYXZlc0N1cnJlbnRQcmljZQAAAAAAAAAAAAAehIABAAAAEGdldFdhdmVzTmV3UHJpY2UAAAAAAAAAAAAALcbAAAAAAgAAAAFpAQAAAAtzd2FwVG9XYXZlcwAAAAEAAAAIY2FsbGVySWQDAwkBAAAAAiE9AAAAAgkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAQYJAAAAAAAAAggJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAAAAAGYW1vdW50AAAAAAAAAAAACQAAAgAAAAECAAAAHDEgcGF5bWVudCBoYXMgdG8gYmUgYXR0YWNoZWQEAAAACEFtb3VudEluCAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAAAAAZhbW91bnQEAAAACUFtb3VudE91dAkAAGkAAAACCQAAaAAAAAIFAAAACEFtb3VudEluAAAAAAAF9eEAAAAAAAAAHoSACQAFFAAAAAIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQ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us": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: HnRvNFvTrjzkkzAM5VDd1AsXwghx42BAAzD5WFw87Uxw
Next: 2qXJBMu1pz4BUcCMK5hEqWfis2pNySZwg9ftfZ2zLW4p
Diff:
Old | New | | Differences |
---|
14 | 14 | | then throw("1 payment has to be attached") |
---|
15 | 15 | | else { |
---|
16 | 16 | | let AmountIn = i.payments[0].amount |
---|
17 | | - | let AmountOut = ((AmountIn / 2000000) * 100000000) |
---|
| 17 | + | let AmountOut = ((AmountIn * 100000000) / 2000000) |
---|
18 | 18 | | $Tuple2([IntegerEntry("AmountIn_USDN", AmountIn), IntegerEntry("AmountOut_WAVES", AmountOut), IntegerEntry((callerId + "_Last_AmountOut_Waves"), AmountOut)], AmountOut) |
---|
19 | 19 | | } |
---|
20 | 20 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | func getWavesCurrentPrice () = 2000000 |
---|
5 | 5 | | |
---|
6 | 6 | | |
---|
7 | 7 | | func getWavesNewPrice () = 3000000 |
---|
8 | 8 | | |
---|
9 | 9 | | |
---|
10 | 10 | | @Callable(i) |
---|
11 | 11 | | func swapToWaves (callerId) = if (if ((size(i.payments) != 1)) |
---|
12 | 12 | | then true |
---|
13 | 13 | | else (i.payments[0].amount == 0)) |
---|
14 | 14 | | then throw("1 payment has to be attached") |
---|
15 | 15 | | else { |
---|
16 | 16 | | let AmountIn = i.payments[0].amount |
---|
17 | | - | let AmountOut = ((AmountIn / 2000000) * 100000000) |
---|
| 17 | + | let AmountOut = ((AmountIn * 100000000) / 2000000) |
---|
18 | 18 | | $Tuple2([IntegerEntry("AmountIn_USDN", AmountIn), IntegerEntry("AmountOut_WAVES", AmountOut), IntegerEntry((callerId + "_Last_AmountOut_Waves"), AmountOut)], AmountOut) |
---|
19 | 19 | | } |
---|
20 | 20 | | |
---|
21 | 21 | | |
---|
22 | 22 | | |
---|
23 | 23 | | @Callable(i) |
---|
24 | 24 | | func swapToUSDN () = if (if ((size(i.payments) != 1)) |
---|
25 | 25 | | then true |
---|
26 | 26 | | else (i.payments[0].amount == 0)) |
---|
27 | 27 | | then throw("1 payment has to be attached") |
---|
28 | 28 | | else { |
---|
29 | 29 | | let AmountIn = i.payments[0].amount |
---|
30 | 30 | | let AmountOut = ((AmountIn * getWavesNewPrice()) / 100) |
---|
31 | 31 | | $Tuple2([IntegerEntry("AmountIn_Waves", AmountIn), IntegerEntry("AmountOut_USDN", AmountOut)], AmountOut) |
---|
32 | 32 | | } |
---|
33 | 33 | | |
---|
34 | 34 | | |
---|
35 | 35 | | @Verifier(tx) |
---|
36 | 36 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
37 | 37 | | |
---|