tx · 8SALX1ha7bkpGdEABvRuym5YaAmEnCKypqCV94DEYzer

3NC7GJvfMCykyTMSe9KU2rJmVygk1fzzKpC:  -0.01400000 Waves

2020.04.10 12:10 [948049] smart account 3NC7GJvfMCykyTMSe9KU2rJmVygk1fzzKpC > SELF 0.00000000 Waves

{ "type": 13, "id": "8SALX1ha7bkpGdEABvRuym5YaAmEnCKypqCV94DEYzer", "fee": 1400000, "feeAssetId": null, "timestamp": 1586509862774, "version": 1, "sender": "3NC7GJvfMCykyTMSe9KU2rJmVygk1fzzKpC", "senderPublicKey": "BNrrKkZSXXCbcCtXLT3VMQnSAJt2jt8TLnZWaB5US3Ci", "proofs": [ "5GqH8KJJiSuRxLwGww7jbajVJeVkhGbfBN1dt9oo7vNSjYMYHzpd4Vh4x8Va3gpZvosdb1C1wAHStPo1kjk4tcML" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAACAAAAAAR1c2RuAQAAACAiZD8evmBG6RFqExPcpjP+Fn4H+Xfps/IV/JlJKjAKNwEAAAAKZ2V0QmFsYW5jZQAAAAEAAAAHYWRkcmVzcwQAAAABYgkABBoAAAACBQAAAAR0aGlzBQAAAAdhZGRyZXNzBAAAAAckbWF0Y2gwBQAAAAFiAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAXQFAAAAByRtYXRjaDAFAAAAAXQAAAAAAAAAAAAAAAACAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAAdhZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAA2JhbAkBAAAACmdldEJhbGFuY2UAAAABBQAAAAdhZGRyZXNzBAAAAAdwYXltZW50CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQAAAAAAAAIIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQFAAAABHVzZG4JAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAdhZGRyZXNzCQAAZAAAAAIFAAAAA2JhbAgFAAAAB3BheW1lbnQAAAAGYW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAkAAAIAAAABAgAAAA5TaG91bGQgYmUgVVNETgAAAAFpAQAAAAh3aXRoZHJhdwAAAAEAAAAGYW1vdW50BAAAAAdhZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAA2JhbAkBAAAACmdldEJhbGFuY2UAAAABBQAAAAdhZGRyZXNzAwkAAGcAAAACBQAAAANiYWwFAAAABmFtb3VudAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAB2FkZHJlc3MJAABlAAAAAgUAAAADYmFsBQAAAAZhbW91bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEdXNkbgUAAAADbmlsCQAAAgAAAAEJAAEsAAAAAgIAAAAQWW91ciBiYWxhbmNlIGlzIAkAAaQAAAABBQAAAANiYWwAAAAAcjpsxQ==", "chainId": 84, "height": 948049, "spentComplexity": 0 } View: original | compacted Prev: 6MVLChFtXfrDvSKFzXN1rumyVzq1xG6BAXw193QihaWS Next: A23sR2sNWSQDrFEB3io77bLk2Tp2sMkJp3119GQDj5go Diff:
OldNewDifferences
2525 }
2626
2727
28+
29+@Callable(i)
30+func withdraw (amount) = {
31+ let address = toBase58String(i.caller.bytes)
32+ let bal = getBalance(address)
33+ if ((bal >= amount))
34+ then ScriptResult(WriteSet([DataEntry(address, (bal - amount))]), TransferSet([ScriptTransfer(i.caller, amount, usdn)]))
35+ else throw(("Your balance is " + toString(bal)))
36+ }
37+
38+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let usdn = base58'3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC'
55
66 func getBalance (address) = {
77 let b = getInteger(this, address)
88 match b {
99 case t: Int =>
1010 t
1111 case _ =>
1212 0
1313 }
1414 }
1515
1616
1717 @Callable(i)
1818 func deposit () = {
1919 let address = toBase58String(i.caller.bytes)
2020 let bal = getBalance(address)
2121 let payment = extract(i.payment)
2222 if ((payment.assetId == usdn))
2323 then ScriptResult(WriteSet([DataEntry(address, (bal + payment.amount))]), TransferSet(nil))
2424 else throw("Should be USDN")
2525 }
2626
2727
28+
29+@Callable(i)
30+func withdraw (amount) = {
31+ let address = toBase58String(i.caller.bytes)
32+ let bal = getBalance(address)
33+ if ((bal >= amount))
34+ then ScriptResult(WriteSet([DataEntry(address, (bal - amount))]), TransferSet([ScriptTransfer(i.caller, amount, usdn)]))
35+ else throw(("Your balance is " + toString(bal)))
36+ }
37+
38+

github/deemru/w8io/169f3d6 
47.16 ms