tx · ABqEYGbmUNvS8kZB9cxC4dRR1m4c4VbPf5NV9hpRvzBU

3N88HLHyQgayARc6MXuoJgYJM6Hp9q8AD4X:  -0.04000000 Waves

2021.05.17 15:20 [1529662] smart account 3N88HLHyQgayARc6MXuoJgYJM6Hp9q8AD4X > SELF 0.00000000 Waves

{ "type": 13, "id": "ABqEYGbmUNvS8kZB9cxC4dRR1m4c4VbPf5NV9hpRvzBU", "fee": 4000000, "feeAssetId": null, "timestamp": 1621254018701, "version": 2, "chainId": 84, "sender": "3N88HLHyQgayARc6MXuoJgYJM6Hp9q8AD4X", "senderPublicKey": "7d8ot6oQCGQZb8ATJ6U8KciEiWMyGupkrdYRjcoRfNzs", "proofs": [ "YPNfc5gQBE3mdQMEwXiJifSfzrNuRqXobJuZtGUKGFEQV3RLX2M8q5ZRhvrNMzY5tY3eqWa3ZjM1jmqRnirhmH5" ], "script": "base64:AAIEAAAAAAAAACAIAhIECgIBCBIECgIBCBIECgIBCBIECgIBCBIECgIBCAAAAAMBAAAAEGdldERlcG9zaXRBbW91bnQAAAACAAAACXB1YmxpY0tleQAAAAVhc3NldAQAAAAHYmFsYW5jZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAhkZXBvc2l0XwUAAAAJcHVibGljS2V5AgAAAAFfBQAAAAVhc3NldAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAAdiYWxhbmNlAQAAAA9nZXRCb3Jyb3dBbW91bnQAAAACAAAACXB1YmxpY0tleQAAAAVhc3NldAQAAAAHYmFsYW5jZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAdib3Jyb3dfBQAAAAlwdWJsaWNLZXkCAAAAAV8FAAAABWFzc2V0AwkAAAEAAAACBQAAAAckbWF0Y2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ABXwUAAAAFYXNzZXQJAABlAAAAAgUAAAAKY3VycmVudERlcAUAAAAGYW1vdW50BQAAAANuaWwJAAACAAAAAQIAAAATTm90aGluZyB0byB3aXRoZHJhdwAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24GAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgYGmhGPSw==", "height": 1529662, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CuzvUZ2bjQsCPr74YAzfdZav9BfoS27wrpUKKwjeEeDt Next: 7zMtizKKWVwmCzdhAoDQDZMLsQtpDkNqCJtBVHZKNYe2 Diff:
OldNewDifferences
5252 else asset
5353 let depositAmount = getDepositAmount(publicKey, test)
5454 let newDepositAmount = (depositAmount + amount)
55-[IntegerEntry(((("deposit_" + publicKey) + "_") + asset), newDepositAmount)]
55+[IntegerEntry(((("deposit_" + publicKey) + "_") + test), newDepositAmount)]
5656 }
5757
5858
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getDepositAmount (publicKey,asset) = {
55 let balance = match getInteger(this, ((("deposit_" + publicKey) + "_") + asset)) {
66 case a: Int =>
77 a
88 case _ =>
99 0
1010 }
1111 balance
1212 }
1313
1414
1515 func getBorrowAmount (publicKey,asset) = {
1616 let balance = match getInteger(this, ((("borrow_" + publicKey) + "_") + asset)) {
1717 case a: Int =>
1818 a
1919 case _ =>
2020 0
2121 }
2222 balance
2323 }
2424
2525
2626 func getCollateral (publicKey,asset) = if ((asset == ""))
2727 then {
2828 let collateral = match getInteger(this, ((("collateral_" + publicKey) + "_Waves") + asset)) {
2929 case a: Int =>
3030 a
3131 case _ =>
3232 0
3333 }
3434 collateral
3535 }
3636 else {
3737 let collateral = match getInteger(this, ((("collateral_" + publicKey) + "_") + asset)) {
3838 case a: Int =>
3939 a
4040 case _ =>
4141 0
4242 }
4343 collateral
4444 }
4545
4646
4747 @Callable(i)
4848 func deposit (amount,asset) = {
4949 let publicKey = toBase58String(i.callerPublicKey)
5050 let test = if ((asset == ""))
5151 then "WAVES"
5252 else asset
5353 let depositAmount = getDepositAmount(publicKey, test)
5454 let newDepositAmount = (depositAmount + amount)
55-[IntegerEntry(((("deposit_" + publicKey) + "_") + asset), newDepositAmount)]
55+[IntegerEntry(((("deposit_" + publicKey) + "_") + test), newDepositAmount)]
5656 }
5757
5858
5959
6060 @Callable(i)
6161 func depositCollateral (amount,asset) = {
6262 let publicKey = toBase58String(i.callerPublicKey)
6363 let collateralAmount = getCollateral(publicKey, asset)
6464 let newCollateralAmount = (collateralAmount + amount)
6565 [IntegerEntry(((("collateral_" + publicKey) + "_") + asset), newCollateralAmount)]
6666 }
6767
6868
6969
7070 @Callable(i)
7171 func borrow (amount,asset) = {
7272 let publicKey = toBase58String(i.callerPublicKey)
7373 let borrowAmount = getBorrowAmount(publicKey, asset)
7474 let collateral = getCollateral(publicKey, asset)
7575 let maxBorrowAmount = ((collateral * 70) / 100)
7676 let newBorrowAmount = (borrowAmount + amount)
7777 if ((collateral >= maxBorrowAmount))
7878 then [IntegerEntry(((("borrow_" + publicKey) + "_") + asset), newBorrowAmount)]
7979 else throw("Not enough collateral")
8080 }
8181
8282
8383
8484 @Callable(i)
8585 func repay (amount,asset) = {
8686 let publicKey = toBase58String(i.callerPublicKey)
8787 let currentBorr = getBorrowAmount(publicKey, asset)
8888 if ((currentBorr > 0))
8989 then [IntegerEntry(((("borrow_" + publicKey) + "_") + asset), (currentBorr - amount))]
9090 else throw("Nothing to repay")
9191 }
9292
9393
9494
9595 @Callable(i)
9696 func withdraw (amount,asset) = {
9797 let publicKey = toBase58String(i.callerPublicKey)
9898 let currentDep = getDepositAmount(publicKey, asset)
9999 if ((currentDep > 0))
100100 then [IntegerEntry(((("deposit_" + publicKey) + "_") + asset), (currentDep - amount))]
101101 else throw("Nothing to withdraw")
102102 }
103103
104104
105105 @Verifier(tx)
106106 func verify () = match tx {
107107 case _: DataTransaction =>
108108 true
109109 case _: SetScriptTransaction =>
110110 true
111111 case _ =>
112112 true
113113 }
114114

github/deemru/w8io/169f3d6 
35.48 ms