tx · 7KgSYbDidQ1pC6WWZLTPHFsv2oYMaLdLx6BcXrkuVCGN

3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq:  -0.01000000 Waves

2024.03.04 14:41 [3003219] smart account 3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq > SELF 0.00000000 Waves

{ "type": 13, "id": "7KgSYbDidQ1pC6WWZLTPHFsv2oYMaLdLx6BcXrkuVCGN", "fee": 1000000, "feeAssetId": null, "timestamp": 1709552501522, "version": 2, "chainId": 84, "sender": "3N61RYWc9QuqKUwLvowpZZLpgUnqpQSFwLq", "senderPublicKey": "HdwFH8HPYu3HG27yK6bszu1CdR4uik4HgzyTimeSfcYf", "proofs": [ "7rxmtPxhctKR95HDaTVgWUvnmMF3aJu1mFBz5H1bma1vP1P96cV7sTwiKJAA5Z4RiRPpxwP4AnhBLxyTGUWYbE3" ], "script": "base64:BgIOCAISABIDCgEBEgMKAQgOABBhbW91bnRBc3NldElkS2V5Ag1hbW91bnRBc3NldElkAA9wcmljZUFzc2V0SWRLZXkCDHByaWNlQXNzZXRJZAAKZmVlUmF0ZUtleQIHZmVlUmF0ZQEKZ2V0QXNzZXRJZAENYXNzZXRJZFN0cmluZwMJAAACBQ1hc3NldElkU3RyaW5nAgVXQVZFUwUEdW5pdAkA2QQBBQ1hc3NldElkU3RyaW5nAQ9nZXRBc3NldEJhbGFuY2UBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQCaWQFByRtYXRjaDAJAPAHAgUEdGhpcwUCaWQICQDvBwEFBHRoaXMJYXZhaWxhYmxlABNhbW91bnRBc3NldElkU3RyaW5nCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzBRBhbW91bnRBc3NldElkS2V5AA1hbW91bnRBc3NldElkCQEKZ2V0QXNzZXRJZAEFE2Ftb3VudEFzc2V0SWRTdHJpbmcAEnByaWNlQXNzZXRJZFN0cmluZwkBEUBleH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WVBbW91bnQAAAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDBQdhZGRyZXNzBQpzZW5kQW1vdW50BQtzZW5kQXNzZXRJZAUDbmlsCQACAQIRYW1vdW50IGlzIHRvbyBsb3cJAJQKAgULc2VuZEFjdGlvbnMJAJYKBAUKc2VuZEFtb3VudAUJZmVlQW1vdW50BQtzZW5kQXNzZXRJZAUNdXNlclJlYWxQcmljZQkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgMBaQEEc3dhcAAJAQxzd2FwSW50ZXJuYWwCCAUBaQZjYWxsZXIFAWkBaQEKc3dhcE5vTGVzcwEJbWluQW1vdW50BAskdDAyODIwMjg3MgkBDHN3YXBJbnRlcm5hbAIIBQFpBmNhbGxlcgUBaQQLc2VuZEFjdGlvbnMIBQskdDAyODIwMjg3MgJfMQQFdHVwbGUIBQskdDAyODIwMjg3MgJfMgQLJHQwMjg3NzI5NDAFBXR1cGxlBApzZW5kQW1vdW50CAULJHQwMjg3NzI5NDACXzEECWZlZUFtb3VudAgFCyR0MDI4NzcyOTQwAl8yBAtzZW5kQXNzZXRJZAgFCyR0MDI4NzcyOTQwAl8zBA11c2VyUmVhbFByaWNlCAULJHQwMjg3NzI5NDACXzQDCQBmAgUJbWluQW1vdW50BQpzZW5kQW1vdW50CQACAQkAuQkCCQDMCAICGlByaWNlIHNsaXBwZWQuIG1pbkFtb3VudDogCQDMCAIJAKQDAQUJbWluQW1vdW50CQDMCAICDSBzd2FwQW1vdW50OiAJAMwIAgkApAMBBQpzZW5kQW1vdW50BQNuaWwCAAkAlAoCBQtzZW5kQWN0aW9ucwUFdHVwbGUBaQEHc3dhcEZvcgEHYWRkcmVzcwkBDHN3YXBJbnRlcm5hbAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFB2FkZHJlc3MFAWkALRU0jQ==", "height": 3003219, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EuyqCcEoAAFYgX74pS5AhjzCd3TKhprbrZ2irLWfNr8z Next: 2TXNUoCatBrgcHKhwMQcQstCekjbmLRbzv2i4wygavVN Diff:
OldNewDifferences
9191
9292
9393 @Callable(G)
94+func swapNoLess (L) = {
95+ let M = E(G.caller, G)
96+ let K = M._1
97+ let N = M._2
98+ let O = N
99+ let v = O._1
100+ let C = O._2
101+ let J = O._3
102+ let D = O._4
103+ if ((L > v))
104+ then throw(makeString(["Price slipped. minAmount: ", toString(L), " swapAmount: ", toString(v)], ""))
105+ else $Tuple2(K, N)
106+ }
107+
108+
109+
110+@Callable(G)
94111 func swapFor (F) = E(addressFromStringValue(F), G)
95112
96113
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "amountAssetId"
55
66 let b = "priceAssetId"
77
88 let c = "feeRate"
99
1010 func d (e) = if ((e == "WAVES"))
1111 then unit
1212 else fromBase58String(e)
1313
1414
1515 func f (g) = {
1616 let h = g
1717 if ($isInstanceOf(h, "ByteVector"))
1818 then {
1919 let i = h
2020 assetBalance(this, i)
2121 }
2222 else wavesBalance(this).available
2323 }
2424
2525
2626 let j = getStringValue(this, a)
2727
2828 let k = d(j)
2929
3030 let l = getStringValue(this, b)
3131
3232 let m = d(l)
3333
3434 let n = 100000000
3535
3636 let o = valueOrElse(getInteger(this, c), 200000)
3737
3838 func p (q,r,s) = {
3939 let t = (r + s)
4040 let u = fraction(q, r, t)
4141 let v = (q - u)
4242 v
4343 }
4444
4545
4646 func w (x,s) = {
4747 let y = if ((x == k))
4848 then $Tuple2(m, k)
4949 else $Tuple2(k, m)
5050 let z = y._1
5151 let A = y._2
5252 let q = f(z)
5353 let r = (f(A) - s)
5454 let B = p(q, r, s)
5555 let C = fraction(B, o, n)
5656 let v = (B - C)
5757 let D = if ((x == k))
5858 then fraction(v, n, s)
5959 else fraction(s, n, v)
6060 $Tuple4(v, C, z, D)
6161 }
6262
6363
6464 func E (F,G) = {
6565 let H = [if ((size(G.payments) > 0))
6666 then true
6767 else throw("should be with 1 payment"), if (containsElement([k, m], G.payments[0].assetId))
6868 then true
6969 else throw(makeString(["payment assetId should be", j, "or", l], " "))]
7070 if ((H == H))
7171 then {
7272 let x = G.payments[0].assetId
7373 let s = G.payments[0].amount
7474 let I = w(x, s)
7575 let v = I._1
7676 let C = I._2
7777 let J = I._3
7878 let D = I._4
7979 let K = if ((C > 0))
8080 then [ScriptTransfer(F, v, J)]
8181 else throw("amount is too low")
8282 $Tuple2(K, $Tuple4(v, C, J, D))
8383 }
8484 else throw("Strict value is not equal to itself.")
8585 }
8686
8787
8888 @Callable(G)
8989 func swap () = E(G.caller, G)
9090
9191
9292
9393 @Callable(G)
94+func swapNoLess (L) = {
95+ let M = E(G.caller, G)
96+ let K = M._1
97+ let N = M._2
98+ let O = N
99+ let v = O._1
100+ let C = O._2
101+ let J = O._3
102+ let D = O._4
103+ if ((L > v))
104+ then throw(makeString(["Price slipped. minAmount: ", toString(L), " swapAmount: ", toString(v)], ""))
105+ else $Tuple2(K, N)
106+ }
107+
108+
109+
110+@Callable(G)
94111 func swapFor (F) = E(addressFromStringValue(F), G)
95112
96113

github/deemru/w8io/169f3d6 
25.06 ms