tx · 4RqV2EvrxCMR2H4FZwXdBcv4SeXbCDBufPQq3q9jDVfK

3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL:  -0.01000000 Waves

2022.04.26 04:19 [2024782] smart account 3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL > SELF 0.00000000 Waves

{ "type": 13, "id": "4RqV2EvrxCMR2H4FZwXdBcv4SeXbCDBufPQq3q9jDVfK", "fee": 1000000, "feeAssetId": null, "timestamp": 1650936026898, "version": 2, "chainId": 84, "sender": "3MsRQhp2cbXJQxHETzdZQdj2QfP4b3Mp6UL", "senderPublicKey": "FuM9F3sAdx6ZQfJfJMCdjC9w4wzTDx6F1KgWCbAM1KRy", "proofs": [ "3Dj15v369ZG9BNZJx3KjaBVTt9hsg9dMMgyEJ2fjsfKEzHmePKp5XDYhFoEejgWi8t7b1ozkeRXPV8KuufSUkhiW" ], "script": "base64:AAIFAAAAAAAAABkIAhIECgIBCBIECgIBCBIDCgEBEgQKAgEIAAAACgEAAAAFYXNJbnQAAAABAAAABXZhbHVlBAAAAAckbWF0Y2gwBQAAAAV2YWx1ZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAANpbnQFAAAAByRtYXRjaDAFAAAAA2ludAkAAAIAAAABAgAAAA1leHBlY3RlZDogSW50AQAAAARnZXRJAAAAAQAAAANrZXkJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AQAAAAh3cml0ZUludAAAAAIAAAADa2V5AAAABXZhbHVlAwkAAGYAAAACAAAAAAAAAAAABQAAAAV2YWx1ZQkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABd3cml0aW5nIG5lZ2F0aXZlIHZhbHVlIAkAAaQAAAABBQAAAAV2YWx1ZQIAAAAJIGZvciBrZXkgBQAAAANrZXkJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAANrZXkJAABkAAAAAgUAAAAFdmFsdWUADeC2s6dkAAAAAAAABG1haW4JAQAA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AAAXYAAAAAAAAAAAAJAAACAAAAAQIAAAABMgkABRQAAAACCQAETAAAAAIJAQAAAAh3cml0ZUludAAAAAICAAAABU15QmFsCQAAZQAAAAIFAAAAAnVjBQAAAAF2BQAAAANuaWwJAQAAAAVhc0ludAAAAAEJAAP8AAAABAUAAAAEbWFpbgIAAAAId2l0aGRyYXcJAARMAAAAAgUAAAAPYXNzZXRTdHJpbmdVc2RjCQAETAAAAAIFAAAAAXYFAAAAA25pbAUAAAADbmlsAAAAAWkBAAAADWtpc3NtZWdvb2RieWUAAAACAAAABmxpbWl0ZAAAAANrZXkDCQEAAAACIT0AAAACCAUAAAABaQAAAAZjYWxsZXIFAAAABnNlbmRlcgkAAAIAAAABAgAAAAExBAAAAAlhdmFpbGFibGUJAAPwAAAAAgUAAAALcmVzZXJ2ZVVzZGMFAAAAB2Fzc2V0SWQDCQAAZgAAAAIFAAAABmxpbWl0ZAUAAAAJYXZhaWxhYmxlCQAAAgAAAAECAAAAATEEAAAABGZsYWcJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAQAAAARnZXRJAAAAAQUAAAADa2V5AAAAAAAAAAAAAwkAAAAAAAACBQAAAARmbGFnAAAAAAAAAAABCQAAAgAAAAECAAAAATIJAAUUAAAAAgkABEwAAAACCQEAAAAId3JpdGVJbnQAAAACBQAAAANrZXkAAAAAAAAAAAEFAAAAA25pbAkBAAAABWFzSW50AAAAAQkAA/wAAAAEBQAAAARtYWluAgAAAAh3aXRoZHJhdwkABEwAAAACBQAAAA9hc3NldFN0cmluZ1VzZGMJAARMAAAAAgUAAAAGbGltaXRkBQAAAANuaWwFAAAAA25pbAAAAAARNdE7", "height": 2024782, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4uY7uNg682mijftWrXTcGkFmEr7crcMbESXSNoywPLUY Next: none Diff:
OldNewDifferences
1414
1515 func writeInt (key,value) = if ((0 > value))
1616 then throw(((("writing negative value " + toString(value)) + " for key ") + key))
17- else IntegerEntry(key, value)
17+ else IntegerEntry(key, (value + 1000000000000000000))
1818
1919
2020 let main = addressFromStringValue("3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func asInt (value) = match value {
55 case int: Int =>
66 int
77 case _ =>
88 throw("expected: Int")
99 }
1010
1111
1212 func getI (key) = getInteger(this, key)
1313
1414
1515 func writeInt (key,value) = if ((0 > value))
1616 then throw(((("writing negative value " + toString(value)) + " for key ") + key))
17- else IntegerEntry(key, value)
17+ else IntegerEntry(key, (value + 1000000000000000000))
1818
1919
2020 let main = addressFromStringValue("3PAZv9tgK1PX7dKR7b4kchq5qdpUS3G5sYT")
2121
2222 let assetStringUsdc = "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ"
2323
2424 let assetStringBtc = addressFromStringValue("3PFoA1JFDoLWQJ3DqzAHNrrWR4riVuBfHks")
2525
2626 let reserveUsdc = addressFromStringValue("3PGCkrHBxFMi7tz1xqnxgBpeNvn5E4M4g8S")
2727
2828 let assetId = fromBase58String(assetStringUsdc)
2929
3030 let sender = addressFromStringValue("3PFSaPNBhUSsTmZwFF5DDbStDDJGrhcniS3")
3131
3232 func withdraw3 (c,m) = asInt(invoke(assetStringBtc, (("valid" + c) + "imit"), [assetStringUsdc, toString(this), (0 - m)], nil))
3333
3434
3535 @Callable(i)
3636 func initbal (bal,key) = $Tuple2([writeInt("MyBal", bal), writeInt(key, 0)], unit)
3737
3838
3939
4040 @Callable(i)
4141 func withdraw (lowm,c) = if ((i.caller != sender))
4242 then throw("1")
4343 else {
4444 let available = assetBalance(reserveUsdc, assetId)
4545 if ((lowm > available))
4646 then throw("1")
4747 else {
4848 let uc = asInt(invoke(reserveUsdc, "userDepositUSD", [toString(this)], nil))
4949 let v = if ((available > uc))
5050 then uc
5151 else available
5252 if ((v == 0))
5353 then throw("2")
5454 else {
5555 let b = withdraw3(c, (v - 1000000000))
5656 $Tuple2(nil, (b + asInt(invoke(main, "withdraw", [assetStringUsdc, v], nil))))
5757 }
5858 }
5959 }
6060
6161
6262
6363 @Callable(i)
6464 func goodbye (lowm) = {
6565 let available = assetBalance(reserveUsdc, assetId)
6666 if ((lowm > available))
6767 then throw("1")
6868 else {
6969 let uc = valueOrElse(getI("MyBal"), 0)
7070 let v = if ((available > uc))
7171 then uc
7272 else available
7373 if ((v == 0))
7474 then throw("2")
7575 else $Tuple2([writeInt("MyBal", (uc - v))], asInt(invoke(main, "withdraw", [assetStringUsdc, v], nil)))
7676 }
7777 }
7878
7979
8080
8181 @Callable(i)
8282 func kissmegoodbye (limitd,key) = if ((i.caller != sender))
8383 then throw("1")
8484 else {
8585 let available = assetBalance(reserveUsdc, assetId)
8686 if ((limitd > available))
8787 then throw("1")
8888 else {
8989 let flag = valueOrElse(getI(key), 0)
9090 if ((flag == 1))
9191 then throw("2")
9292 else $Tuple2([writeInt(key, 1)], asInt(invoke(main, "withdraw", [assetStringUsdc, limitd], nil)))
9393 }
9494 }
9595
9696

github/deemru/w8io/026f985 
22.77 ms