tx · 13UsKqtm9NVMPFi6PZV15xmBWqiXupAZvP8RN6zxYkm6

3N93XuDT7GvzMZdp8WGTbqYxiGY9JQmiWAG:  -0.00300000 Waves

2023.09.01 03:00 [2735551] smart account 3N93XuDT7GvzMZdp8WGTbqYxiGY9JQmiWAG > SELF 0.00000000 Waves

{ "type": 13, "id": "13UsKqtm9NVMPFi6PZV15xmBWqiXupAZvP8RN6zxYkm6", "fee": 300000, "feeAssetId": null, "timestamp": 1693526417996, "version": 2, "chainId": 84, "sender": "3N93XuDT7GvzMZdp8WGTbqYxiGY9JQmiWAG", "senderPublicKey": "3MV6QZNSjqH7Ctc3BGRQJJyZ3DJgCJ6Tqn7LXRgneZ5B", "proofs": [ "59nWSoVvz9eP7342iHwiemBSuT4NmtEuMcZiX986vQPwYgKjSXdWyXQXq68dibvvzgnzJHgKit6wT3wxq6GQqQtp" ], "script": "base64:BgISCAISBAoCCAESABIGCgQIAQgICQAKbGltaXRSYXRpbwCgjQYAA2ZlZQBkAAZzY2FsZTUAoI0GAAxmZWVDb2xsZWN0b3ICIzNOMkZ1em9NMXg4aEpxU0RVVmlYdXZhdE5wOWlwN0dyS29CAQpnZXRBc3NldElkAQNhc3QEByRtYXRjaDAFA2FzdAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAFwBQckbWF0Y2gwBQNhc3QFBHVuaXQBDmdldEFzc2V0U3RyaW5nAQdhc3NldElkBAckbWF0Y2gwBQdhc3NldElkAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAWIFByRtYXRjaDAJANgEAQUBYgIFV0FWRVMBDWdldEFzc2V0Qnl0ZXMBB2Fzc2V0SWQDCQAAAgUHYXNzZXRJZAIFV0FWRVMFBHVuaXQJANkEAQUHYXNzZXRJZAEKZ2V0QmFsYW5jZQEHYXNzZXRJZAQHJG1hdGNoMAUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAFiBQckbWF0Y2gwCQDwBwIFBHRoaXMF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compacted Prev: CQFn5V94xYDrowXD5JErCRUD84EthGZiVt2JdYbEX7RF Next: HazBkLE9zJtULt88ocAAKeBpsS9KjP2P3xfBo9u3NH2o Diff:
OldNewDifferences
105105 if ((newBalance == newBalance))
106106 then if ((newBalance >= currentBalance))
107107 then [ScriptTransfer(Address(fromBase58String(feeCollector)), feeAmount, getAssetBytes(assetId))]
108- else throw(((("Rejected due to low repay amount. Need: " + toString(amountToRepay)) + ", provided: ") + toString((newBalance - currentBalance))))
108+ else throw(((("Rejected due to low repay amount. Need: " + toString(amountToRepay)) + ", but received: ") + toString(((newBalance - currentBalance) + amount))))
109109 else throw("Strict value is not equal to itself.")
110110 }
111111 else throw("Strict value is not equal to itself.")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let limitRatio = 100000
55
66 let fee = 100
77
88 let scale5 = 100000
99
1010 let feeCollector = "3N2FuzoM1x8hJqSDUViXuvatNp9ip7GrKoB"
1111
1212 func getAssetId (ast) = match ast {
1313 case p: ByteVector =>
1414 ast
1515 case _ =>
1616 unit
1717 }
1818
1919
2020 func getAssetString (assetId) = match assetId {
2121 case b: ByteVector =>
2222 toBase58String(b)
2323 case _ =>
2424 "WAVES"
2525 }
2626
2727
2828 func getAssetBytes (assetId) = if ((assetId == "WAVES"))
2929 then unit
3030 else fromBase58String(assetId)
3131
3232
3333 func getBalance (assetId) = match assetId {
3434 case b: ByteVector =>
3535 assetBalance(this, b)
3636 case _ =>
3737 wavesBalance(this).available
3838 }
3939
4040
4141 func tryGetInteger (key,address) = match getInteger(address, key) {
4242 case b: Int =>
4343 b
4444 case _ =>
4545 0
4646 }
4747
4848
4949 @Callable(i)
5050 func borrow (assetId,amount) = {
5151 let currentBalance = getBalance(getAssetBytes(assetId))
5252 if ((currentBalance == currentBalance))
5353 then {
5454 let limit = fraction(currentBalance, limitRatio, scale5)
5555 if ((limit >= amount))
5656 then {
5757 let intEntry = IntegerEntry(((("borrowed_" + toString(i.originCaller)) + "_") + assetId), amount)
5858 let transfer = ScriptTransfer(i.originCaller, amount, getAssetBytes(assetId))
5959 if ((i.caller == this))
6060 then [intEntry]
6161 else [intEntry, transfer]
6262 }
6363 else throw(((("Requested amount " + toString(amount)) + " is bigger than limit: ") + toString(limit)))
6464 }
6565 else throw("Strict value is not equal to itself.")
6666 }
6767
6868
6969
7070 @Callable(i)
7171 func repay () = {
7272 let amount = value(i.payments[0].amount)
7373 let assetId = i.payments[0].assetId
7474 let borrowed = tryGetInteger(((("borrowed_" + toString(i.originCaller)) + "_") + getAssetString(assetId)), this)
7575 if ((borrowed > 0))
7676 then {
7777 let toRepayAmount = min([amount, borrowed])
7878 let toReturnAmount = (amount - toRepayAmount)
7979 let intEntry = IntegerEntry(((("borrowed_" + toString(i.originCaller)) + "_") + getAssetString(assetId)), (borrowed - toRepayAmount))
8080 let transfer = ScriptTransfer(i.originCaller, toReturnAmount, assetId)
8181 if ((toReturnAmount > 0))
8282 then [intEntry, transfer]
8383 else [intEntry]
8484 }
8585 else throw("You shouldn't repay")
8686 }
8787
8888
8989
9090 @Callable(i)
9191 func flash (assetId,amount,callbackAddress,callBackFunction) = {
9292 let callbackAdr = Address(fromBase58String(callbackAddress))
9393 let currentBalance = getBalance(getAssetBytes(assetId))
9494 if ((currentBalance == currentBalance))
9595 then {
9696 let borrow = invoke(this, "borrow", [assetId, amount], nil)
9797 if ((borrow == borrow))
9898 then {
9999 let callback = invoke(Address(fromBase58String(callbackAddress)), callBackFunction, nil, [AttachedPayment(getAssetBytes(assetId), amount)])
100100 if ((callback == callback))
101101 then {
102102 let feeAmount = fraction(amount, fee, scale5)
103103 let amountToRepay = (amount + feeAmount)
104104 let newBalance = getBalance(getAssetBytes(assetId))
105105 if ((newBalance == newBalance))
106106 then if ((newBalance >= currentBalance))
107107 then [ScriptTransfer(Address(fromBase58String(feeCollector)), feeAmount, getAssetBytes(assetId))]
108- else throw(((("Rejected due to low repay amount. Need: " + toString(amountToRepay)) + ", provided: ") + toString((newBalance - currentBalance))))
108+ else throw(((("Rejected due to low repay amount. Need: " + toString(amountToRepay)) + ", but received: ") + toString(((newBalance - currentBalance) + amount))))
109109 else throw("Strict value is not equal to itself.")
110110 }
111111 else throw("Strict value is not equal to itself.")
112112 }
113113 else throw("Strict value is not equal to itself.")
114114 }
115115 else throw("Strict value is not equal to itself.")
116116 }
117117
118118

github/deemru/w8io/026f985 
36.24 ms