tx · DD7XMnCCbX2kdYpWFPv3T9ebNR4EW5FStoCQKU4LJvTK

3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo:  -0.04000000 Waves

2021.09.02 16:15 [1685459] smart account 3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo > SELF 0.00000000 Waves

{ "type": 13, "id": "DD7XMnCCbX2kdYpWFPv3T9ebNR4EW5FStoCQKU4LJvTK", "fee": 4000000, "feeAssetId": null, "timestamp": 1630588562421, "version": 2, "chainId": 84, "sender": "3MvGMtmdY1eSW4iY922zj5bx8hBfyP1qgHo", "senderPublicKey": "CD4N2SBeZVBUwmtsqwfmQ3ZKnBP3AxpZCvJ5QkHytUed", "proofs": [ "6CrzfNfeusSPovekCUXazPcb2xK8xVGNpCXiqietVgkgRF15JncKcVEER5HdnZz92unD7S8SwvB4LKpAJB2ZPLP" ], "script": "base64:AAIFAAAAAAAAACIIAhIECgIIGBIDCgEIEgMKAQgSBAoCCAQSAwoBCBIDCgEIAAAABwAAAAAGY29uZmlnCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAAZjb25maWcCAAAAAAAAAAAFYWRtaW4JAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAABWFkbWluAgAAAAAAAAAABXBvb2xzCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAAFcG9vbHMCAAAAFk5vIGtleSBwb29scyB3YXMgZm91bmQBAAAAB2lzQWRtaW4AAAABAAAADWNhbGxlckFkZHJlc3MDCQAAAAAAAAIFAAAADWNhbGxlckFkZHJlc3MJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAEFAAAABWFkbWluBgcBAAAACWNoZWNrUG9vbAAAAAEAAAAHcG9vbEFkZAMJAQAAAAhjb250YWlucwAA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TA2MikAAAABBQAAAAtwb29sQWRkcmVzcwIAAAAIZFRva2VuSWQDCQAAAAAAAAIJAAJZAAAAAQUAAAAIZFRva2VuSWQICQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAAAAB2Fzc2V0SWQDCQAAZgAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAABHVzZXIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAADbXNnCQAD/AAAAAQJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAEFAAAAC3Bvb2xBZGRyZXNzAgAAABBsb2NrQXNDb2xsYXRlcmFsCQAETAAAAAIFAAAABHVzZXIFAAAAA25pbAgFAAAAAWkAAAAIcGF5bWVudHMDCQAAAAAAAAIFAAAAA21zZwUAAAADbXNnBAAAAAckbWF0Y2gwBQAAAANtc2cDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABdAUAAAAHJG1hdGNoMAUAAAADbmlsCQAAAgAAAAECAAAAGEluY29ycmVjdCBpbnZva2UgcmVzdWx0IQkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAACAAAAAQIAAAAUTm8gcGF5bWVudCBhdHRhY2hlZCEJAAACAAAAAQIAAAAXQXNzZXRJZHMgZG9lcyBub3QgbWF0Y2gJAAACAAAAAQIAAAAXUG9vbCBhZGRyZXNzIG5vdCBmb3VuZCEAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tled19/t0=", "height": 1685459, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BEGfzUrNJfFkmXeLeX2M27TqGKUV7VChnM9RjCQ7WeNr Next: G2stJ31voBwJDih94dW33m6B9H77gRSAjFPP1sZgTEae Diff:
OldNewDifferences
110110 else throw("Pool address not found!")
111111
112112
113+
114+@Callable(i)
115+func lockAsCollateralAt (poolAddress) = if (checkPool(poolAddress))
116+ then {
117+ let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
118+ if ((fromBase58String(dTokenId) == i.payments[0].assetId))
119+ then if ((size(i.payments) > 0))
120+ then {
121+ let user = toBase58String(i.caller.bytes)
122+ let msg = invoke(addressFromStringValue(poolAddress), "lockAsCollateral", [user], i.payments)
123+ if ((msg == msg))
124+ then match msg {
125+ case t: String =>
126+ nil
127+ case _ =>
128+ throw("Incorrect invoke result!")
129+ }
130+ else throw("Strict value is not equal to itself.")
131+ }
132+ else throw("No payment attached!")
133+ else throw("AssetIds does not match")
134+ }
135+ else throw("Pool address not found!")
136+
137+
113138 @Verifier(tx)
114139 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
115140
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let config = valueOrElse(getStringValue(this, "config"), "")
55
66 let admin = valueOrElse(getStringValue(this, "admin"), "")
77
88 let pools = valueOrErrorMessage(getString(this, "pools"), "No key pools was found")
99
1010 func isAdmin (callerAddress) = if ((callerAddress == addressFromStringValue(admin)))
1111 then true
1212 else false
1313
1414
1515 func checkPool (poolAdd) = if (contains(pools, poolAdd))
1616 then true
1717 else false
1818
1919
2020 func writeString (key,stringValue) = StringEntry(key, stringValue)
2121
2222
2323 func writeInteger (key,integerValue) = IntegerEntry(key, integerValue)
2424
2525
2626 @Callable(i)
2727 func setup (configAddress,pools) = if (if (!(isDefined(getString(this, "config"))))
2828 then !(isDefined(getString(this, "pools")))
2929 else false)
3030 then [writeString("config", configAddress), writeString("pools", makeString(pools, ";"))]
3131 else throw("Admin and config address already definied!")
3232
3333
3434
3535 @Callable(i)
3636 func addPool (poolAddress) = if (isAdmin(i.caller))
3737 then {
3838 let poolList = split(pools, ";")
3939 if ((containsElement(poolList, poolAddress) == false))
4040 then {
4141 let newPools = (poolList :+ poolAddress)
4242 [writeString("pools", makeString(newPools, ";"))]
4343 }
4444 else throw("Pool already exists!")
4545 }
4646 else throw("Address does not match with admin address!")
4747
4848
4949
5050 @Callable(i)
5151 func updateConfig (configAddress) = if (isAdmin(i.caller))
5252 then [writeString("config", configAddress)]
5353 else throw("Address does not match with admin address!")
5454
5555
5656
5757 @Callable(i)
5858 func depositAt (poolAddress,isCollateral) = if (checkPool(poolAddress))
5959 then if ((size(i.payments) > 0))
6060 then {
6161 let user = toBase58String(i.caller.bytes)
6262 let tokenAmount = invoke(addressFromStringValue(poolAddress), "deposit", [user, isCollateral], i.payments)
6363 if ((tokenAmount == tokenAmount))
6464 then {
6565 let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
6666 match tokenAmount {
6767 case t: Int =>
6868 [ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
6969 case t: String =>
7070 nil
7171 case _ =>
7272 throw("Incorrect invoke result!")
7373 }
7474 }
7575 else throw("Strict value is not equal to itself.")
7676 }
7777 else throw("No payment attached!")
7878 else throw("Pool address not found!")
7979
8080
8181
8282 @Callable(i)
8383 func withdrawFrom (poolAddress) = if (checkPool(poolAddress))
8484 then {
8585 let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
8686 if ((fromBase58String(dTokenId) == i.payments[0].assetId))
8787 then if ((size(i.payments) > 0))
8888 then {
8989 let user = toBase58String(i.caller.bytes)
9090 let tokenAmount = invoke(addressFromStringValue(poolAddress), "withdraw", [user], i.payments)
9191 if ((tokenAmount == tokenAmount))
9292 then {
9393 let tokenId = getStringValue(addressFromStringValue(poolAddress), "assetId")
9494 match tokenAmount {
9595 case t: Int =>
9696 if ((tokenId == "WAVES"))
9797 then [ScriptTransfer(i.caller, t, unit)]
9898 else [ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
9999 case t: String =>
100100 nil
101101 case _ =>
102102 throw("Incorrect invoke result!")
103103 }
104104 }
105105 else throw("Strict value is not equal to itself.")
106106 }
107107 else throw("No payment attached!")
108108 else throw("AssetIds does not match")
109109 }
110110 else throw("Pool address not found!")
111111
112112
113+
114+@Callable(i)
115+func lockAsCollateralAt (poolAddress) = if (checkPool(poolAddress))
116+ then {
117+ let dTokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
118+ if ((fromBase58String(dTokenId) == i.payments[0].assetId))
119+ then if ((size(i.payments) > 0))
120+ then {
121+ let user = toBase58String(i.caller.bytes)
122+ let msg = invoke(addressFromStringValue(poolAddress), "lockAsCollateral", [user], i.payments)
123+ if ((msg == msg))
124+ then match msg {
125+ case t: String =>
126+ nil
127+ case _ =>
128+ throw("Incorrect invoke result!")
129+ }
130+ else throw("Strict value is not equal to itself.")
131+ }
132+ else throw("No payment attached!")
133+ else throw("AssetIds does not match")
134+ }
135+ else throw("Pool address not found!")
136+
137+
113138 @Verifier(tx)
114139 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
115140

github/deemru/w8io/169f3d6 
45.32 ms