tx · 3sPLws5tXwicZQGq4hv1AaDf27Z369MFXcftqpGZsoHa
3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S: -0.01400000 Waves
2021.03.26 23:26 [1455189] smart account 3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S > SELF 0.00000000 Waves
{
"type": 13,
"id": "3sPLws5tXwicZQGq4hv1AaDf27Z369MFXcftqpGZsoHa",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1616790406533,
"version": 2,
"chainId": 84,
"sender": "3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S",
"senderPublicKey": "CgByewRUvLk7UtWSfRMLSYw4Ap2wT5dcdVYKideqDp9M",
"proofs": [
"tUZAmPEkMACLu5KT9Vm1GydrSfg5bq3Ao6sL8vY6Btk7iDn13TpUyXGWgaw2iE1Z8bevWzPWF7x8okg14NU3MBM"
],
"script": "base64:AAIEAAAAAAAAAAgIAhIAEgASAAAAAA8AAAAADnRvdGFsRmVlRXRoS2V5AgAAAA10b3RhbF9mZWVfZXRoAAAAAA50b3RhbEZlZVVzZEtleQIAAAANdG90YWxfZmVlX3VzZAAAAAASdG90YWxGZWVEeXpyYXB0S2V5AgAAABF0b3RhbF9mZWVfZHl6cmFwdAAAAAARcHJpY2VPZkR5enJhcHRLZXkCAAAAA2R5egAAAAANcHJpY2VPZkV0aEtleQIAAAADZXRoAAAAAA1vcmFjbGVBZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUvj/uzYkPvAWmBY0l0o79qoW9wh0kW3OWAAAAAA5keXpyYXB0QXNzZXRJZAEAAAAgnxnpc9km71BHiGYaP3+jsvIwnjyNE9APQJ48k4SnBCMAAAAACmV0aEFzc2V0SWQBAAAAICImU7qSm/1VgN3CrHN9jStFD2u0cA4gGz96jcaC4wuhAAAAAAt1c2RuQXNzZXRJZAEAAAAgfGnBa2RwgHQkUhuI1e0jfydVGajNaZehqKCu72Hgd8IBAAAADGdldEZlZUFtb3VudAAA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Adhc3NldElkBQAAAApldGhBc3NldElkCQAAAgAAAAECAAAAKU9ubHkgd2V0aCB0b2tlbnMgYXJlIGFsbG93ZWQgZm9yIHN3YXBwaW5nBAAAAANmZWUJAQAAAAxnZXRGZWVBbW91bnQAAAABBQAAAAt0b3RhbEFtb3VudAQAAAAGYW1vdW50CQAAZQAAAAIFAAAAC3RvdGFsQW1vdW50BQAAAANmZWUEAAAACGV0aFByaWNlCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQaAAAAAgUAAAANb3JhY2xlQWRkcmVzcwUAAAANcHJpY2VPZkV0aEtleQIAAAAUVW5hYmxlIHRvIGxvYWQgcHJpY2UEAAAACnVzZG5BbW91bnQJAABrAAAAAwUAAAAGYW1vdW50BQAAAAhldGhQcmljZQAAAAAAAAAnEAQAAAANZHl6cmFwdEFtb3VudAkBAAAADXVzZG5Ub0R5enJhcHQAAAABBQAAAAp1c2RuQW1vdW50BAAAAAhzYXZlZEZlZQkBAAAADmdldFRvdGFsRmVlRXRoAAAAAAQAAAAIdG90YWxGZWUJAABkAAAAAgUAAAAIc2F2ZWRGZWUFAAAAA2ZlZQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAOdG90YWxGZWVFdGhLZXkFAAAACHRvdGFsRmVlCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAANZHl6cmFwdEFtb3VudAUAAAAOZHl6cmFwdEFzc2V0SWQFAAAAA25pbAAAAAANN/Wx",
"height": 1455189,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: Fm35RrkjvLNf4dZYggTUdmDGAtDW7KV7VRWJWcH1tMFc
Next: 5R5BHKikDAGwFGHyA72uMjcsx5XfXsQJNRvZmsmcyxUB
Diff:
Old | New | | Differences |
---|
41 | 41 | | |
---|
42 | 42 | | |
---|
43 | 43 | | func s (k) = { |
---|
44 | | - | let t = valueOrErrorMessage(getInteger(f, "dyz"), "Unable to load price") |
---|
| 44 | + | let t = valueOrErrorMessage(getInteger(f, d), "Unable to load price") |
---|
45 | 45 | | fraction(k, 10000, t) |
---|
46 | 46 | | } |
---|
47 | 47 | | |
---|
|
76 | 76 | | } |
---|
77 | 77 | | |
---|
78 | 78 | | |
---|
| 79 | + | |
---|
| 80 | + | @Callable(u) |
---|
| 81 | + | func swapEthToDyzrapt () = { |
---|
| 82 | + | let v = value(u.payments[0]) |
---|
| 83 | + | let w = v.assetId |
---|
| 84 | + | let x = v.amount |
---|
| 85 | + | if ((w != h)) |
---|
| 86 | + | then throw("Only weth tokens are allowed for swapping") |
---|
| 87 | + | else { |
---|
| 88 | + | let l = j(x) |
---|
| 89 | + | let k = (x - l) |
---|
| 90 | + | let B = valueOrErrorMessage(getInteger(f, e), "Unable to load price") |
---|
| 91 | + | let C = fraction(k, B, 10000) |
---|
| 92 | + | let y = s(C) |
---|
| 93 | + | let z = p() |
---|
| 94 | + | let A = (z + l) |
---|
| 95 | + | [IntegerEntry(a, A), ScriptTransfer(u.caller, y, g)] |
---|
| 96 | + | } |
---|
| 97 | + | } |
---|
| 98 | + | |
---|
| 99 | + | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 4 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let a = "total_fee_eth" |
---|
5 | 5 | | |
---|
6 | 6 | | let b = "total_fee_usd" |
---|
7 | 7 | | |
---|
8 | 8 | | let c = "total_fee_dyzrapt" |
---|
9 | 9 | | |
---|
10 | 10 | | let d = "dyz" |
---|
11 | 11 | | |
---|
12 | 12 | | let e = "eth" |
---|
13 | 13 | | |
---|
14 | 14 | | let f = Address(base58'3N7G2kVtBTh94aEnDHQ9dpi4EdsDxAiDXjB') |
---|
15 | 15 | | |
---|
16 | 16 | | let g = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA' |
---|
17 | 17 | | |
---|
18 | 18 | | let h = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp' |
---|
19 | 19 | | |
---|
20 | 20 | | let i = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5' |
---|
21 | 21 | | |
---|
22 | 22 | | func j (k) = { |
---|
23 | 23 | | let l = fraction(k, 3, 100) |
---|
24 | 24 | | l |
---|
25 | 25 | | } |
---|
26 | 26 | | |
---|
27 | 27 | | |
---|
28 | 28 | | func m (n) = { |
---|
29 | 29 | | let o = valueOrElse(getInteger(this, n), 0) |
---|
30 | 30 | | o |
---|
31 | 31 | | } |
---|
32 | 32 | | |
---|
33 | 33 | | |
---|
34 | 34 | | func p () = m(a) |
---|
35 | 35 | | |
---|
36 | 36 | | |
---|
37 | 37 | | func q () = m(b) |
---|
38 | 38 | | |
---|
39 | 39 | | |
---|
40 | 40 | | func r () = m(c) |
---|
41 | 41 | | |
---|
42 | 42 | | |
---|
43 | 43 | | func s (k) = { |
---|
44 | | - | let t = valueOrErrorMessage(getInteger(f, "dyz"), "Unable to load price") |
---|
| 44 | + | let t = valueOrErrorMessage(getInteger(f, d), "Unable to load price") |
---|
45 | 45 | | fraction(k, 10000, t) |
---|
46 | 46 | | } |
---|
47 | 47 | | |
---|
48 | 48 | | |
---|
49 | 49 | | @Callable(u) |
---|
50 | 50 | | func test () = { |
---|
51 | 51 | | let v = value(u.payments[0]) |
---|
52 | 52 | | let w = v.assetId |
---|
53 | 53 | | let k = v.amount |
---|
54 | 54 | | if ((w == g)) |
---|
55 | 55 | | then throw(("its a dyzrapt. Amount=" + toString(k))) |
---|
56 | 56 | | else throw("its not a dyzrapt") |
---|
57 | 57 | | } |
---|
58 | 58 | | |
---|
59 | 59 | | |
---|
60 | 60 | | |
---|
61 | 61 | | @Callable(u) |
---|
62 | 62 | | func swapUsdnToDyzrapt () = { |
---|
63 | 63 | | let v = value(u.payments[0]) |
---|
64 | 64 | | let w = v.assetId |
---|
65 | 65 | | let x = v.amount |
---|
66 | 66 | | if ((w != i)) |
---|
67 | 67 | | then throw("Only usdn tokens are allowed for swapping") |
---|
68 | 68 | | else { |
---|
69 | 69 | | let l = j(x) |
---|
70 | 70 | | let k = (x - l) |
---|
71 | 71 | | let y = s(k) |
---|
72 | 72 | | let z = q() |
---|
73 | 73 | | let A = (z + l) |
---|
74 | 74 | | [IntegerEntry(b, A), ScriptTransfer(u.caller, y, g)] |
---|
75 | 75 | | } |
---|
76 | 76 | | } |
---|
77 | 77 | | |
---|
78 | 78 | | |
---|
| 79 | + | |
---|
| 80 | + | @Callable(u) |
---|
| 81 | + | func swapEthToDyzrapt () = { |
---|
| 82 | + | let v = value(u.payments[0]) |
---|
| 83 | + | let w = v.assetId |
---|
| 84 | + | let x = v.amount |
---|
| 85 | + | if ((w != h)) |
---|
| 86 | + | then throw("Only weth tokens are allowed for swapping") |
---|
| 87 | + | else { |
---|
| 88 | + | let l = j(x) |
---|
| 89 | + | let k = (x - l) |
---|
| 90 | + | let B = valueOrErrorMessage(getInteger(f, e), "Unable to load price") |
---|
| 91 | + | let C = fraction(k, B, 10000) |
---|
| 92 | + | let y = s(C) |
---|
| 93 | + | let z = p() |
---|
| 94 | + | let A = (z + l) |
---|
| 95 | + | [IntegerEntry(a, A), ScriptTransfer(u.caller, y, g)] |
---|
| 96 | + | } |
---|
| 97 | + | } |
---|
| 98 | + | |
---|
| 99 | + | |
---|