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