tx · BhoPGBJt5obnarenQzhtQJR1528zzBvmVg1E4yA4nrcn 3N2MgATULesg3Pbc1z77qNaN92FwMGTrFqv: -0.01000000 Waves 2019.07.04 14:30 [570621] smart account 3N2MgATULesg3Pbc1z77qNaN92FwMGTrFqv > SELF 0.00000000 Waves
{ "type": 13, "id": "BhoPGBJt5obnarenQzhtQJR1528zzBvmVg1E4yA4nrcn", "fee": 1000000, "feeAssetId": null, "timestamp": 1562239830798, "version": 1, "sender": "3N2MgATULesg3Pbc1z77qNaN92FwMGTrFqv", "senderPublicKey": "HPQmkar9cuDjU4jxJnXro8SR4eBzkeSZquwqzEqMQH3i", "proofs": [ "56pL54B9So8wdzr6MhZfWfeVwLjFP3FispFYf4J3GDojaupSYRCFQ7JRf7HUGkUXw2UJkZB9N9ud2Nc6HswRjcBA" ], "script": "base64:AAIDAAAAAAAAAAAAAAAYAAAAAAxkZXBvc2l0VG9rZW4FAAAABHVuaXQAAAAADmdyYWNlUGVyaW9kS2V5AgAAAAtncmFjZVBlcmlvZAAAAAARaW50ZXJlc3RQZXJpb2RLZXkCAAAADmludGVyZXN0UGVyaW9kAAAAABJyZXZlcnNlTGVuZFJhdGVLZXkCAAAABHJhdGUAAAAADWFzc2V0VG9rZW5LZXkCAAAACmFzc2V0VG9rZW4AAAAACG93bmVyS2V5AgAAAAVvd25lcgAAAAANYmVuZWZjaWFyeUtleQIAAAALYmVuZWZpY2lhcnkBAAAAB3N0YXJ0T2YAAAABAAAABnJlbnRlcgkAASwAAAACAgAAAAlzdGFydF9vZl8FAAAABnJlbnRlcgEAAAANZW5kT2ZGcmVlemVPZgAAAAEAAAAGcmVudGVyCQABLAAAAAICAAAAEWVuZF9vZl9mcmVlemVfb2ZfBQAAAAZyZW50ZXIBAAAABnJhdGVPZgAAAAEAAAAGcmVudGVyCQABLAAAAAICAAAACHJhdGVfb2ZfBQAAAAZyZW50ZXIBAAAACWRlcG9zaXRPZgAAAAEAAAAGcmVudGVyCQABLAAAAAICAAAAC2Rl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lIGV4cGlyZWQgcmVudCBvZiBhIHVzZXIDCQEAAAABIQAAAAEFAAAAC2xvYW5FeHBpcmVkCQAAAgAAAAEJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAN093bmVyIGNhbiBvbmx5IGNsb3NlIGV4cGlyZWQgcmVudHMuIEV4cGlyaW5nIG9uIGhlaWdodCAJAAGkAAAAAQUAAAAMZXhwaXJ5SGVpZ2h0AgAAABAsIGN1cnJlbnQgaGVpZ2h0CQABpAAAAAEFAAAABmhlaWdodAkBAAAADGNsb3NlRXhwaXJlZAAAAAEFAAAAB2FkZHJlc3MAAAABaQEAAAAHZGlzY2FyZAAAAAAEAAAAB2FkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwkBAAAADGNsb3NlRXhwaXJlZAAAAAEFAAAAB2FkZHJlc3MAAAABaQEAAAAId2l0aGRyYXcAAAABAAAABmFtb3VudAMJAAAAAAAAAggFAAAAAWkAAAAGY2FsbGVyBQAAAAVvd25lcgkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAVvd25lcgUAAAAGYW1vdW50BQAAAAphc3NldFRva2VuBQAAAANuaWwJAAACAAAAAQIAAAAcb25seSBvd25lciBjYW4gd2l0aGRyYXcgV0JUQwAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAADCQEAAAABIQAAAAEFAAAAC2luaXRpYWxpemVkCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQeN4HTS", "chainId": 84, "height": 570621, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let depositToken = unit | |
5 | + | ||
6 | + | let gracePeriodKey = "gracePeriod" | |
7 | + | ||
8 | + | let interestPeriodKey = "interestPeriod" | |
9 | + | ||
10 | + | let reverseLendRateKey = "rate" | |
11 | + | ||
12 | + | let assetTokenKey = "assetToken" | |
13 | + | ||
14 | + | let ownerKey = "owner" | |
15 | + | ||
16 | + | let benefciaryKey = "beneficiary" | |
17 | + | ||
18 | + | func startOf (renter) = ("start_of_" + renter) | |
19 | + | ||
20 | + | ||
21 | + | func endOfFreezeOf (renter) = ("end_of_freeze_of_" + renter) | |
22 | + | ||
23 | + | ||
24 | + | func rateOf (renter) = ("rate_of_" + renter) | |
25 | + | ||
26 | + | ||
27 | + | func depositOf (renter) = ("deposit_of_" + renter) | |
28 | + | ||
29 | + | ||
30 | + | func lendAmount (renter) = ("lend_of_" + renter) | |
31 | + | ||
32 | + | ||
33 | + | func registeredTx (txId) = ("registered_return_of_" + txId) | |
34 | + | ||
35 | + | ||
36 | + | let owner = addressFromStringValue(value(getString(this, ownerKey))) | |
37 | + | ||
38 | + | let beneficiary = addressFromStringValue(value(getString(this, benefciaryKey))) | |
39 | + | ||
40 | + | let assetToken = fromBase58String(value(getString(this, assetTokenKey))) | |
41 | + | ||
42 | + | let gracePeriod = value(getInteger(this, gracePeriodKey)) | |
43 | + | ||
44 | + | let interestPeriod = value(getInteger(this, interestPeriodKey)) | |
45 | + | ||
46 | + | let reverseLendRate = value(getInteger(this, reverseLendRateKey)) | |
47 | + | ||
48 | + | let initialized = isDefined(getString(this, assetTokenKey)) | |
49 | + | ||
50 | + | func isLendOpen (renter) = match getInteger(this, startOf(renter)) { | |
51 | + | case s: Int => | |
52 | + | (s > 0) | |
53 | + | case _ => | |
54 | + | false | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | func closing (renter) = WriteSet([DataEntry(startOf(renter), 0), DataEntry(endOfFreezeOf(renter), 0), DataEntry(rateOf(renter), 0), DataEntry(depositOf(renter), 0), DataEntry(lendAmount(renter), 0)]) | |
59 | + | ||
60 | + | ||
61 | + | func closeExpired (address) = { | |
62 | + | let loanSize = value(getInteger(this, depositOf(address))) | |
63 | + | ScriptResult(closing(address), TransferSet([ScriptTransfer(beneficiary, loanSize, depositToken)])) | |
64 | + | } | |
65 | + | ||
66 | + | ||
67 | + | func doBB (renter,returnAssetId,returnAmt) = { | |
68 | + | let renterStr = toBase58String(renter.bytes) | |
69 | + | let lendOpen = isLendOpen(renterStr) | |
70 | + | let correctRetrurningBase = (returnAssetId == assetToken) | |
71 | + | let lentAmount = value(getInteger(this, lendAmount(renterStr))) | |
72 | + | let correctReturnAmount = (lentAmount == returnAmt) | |
73 | + | let depositedValue = value(getInteger(this, depositOf(renterStr))) | |
74 | + | if (!(lendOpen)) | |
75 | + | then throw("No open lends for caller") | |
76 | + | else if (!(correctRetrurningBase)) | |
77 | + | then throw(((("User must return WBTC: " + toBase58String(assetToken)) + "but recieving:") + toBase58String(returnAssetId))) | |
78 | + | else if (!(correctReturnAmount)) | |
79 | + | then throw(((("User must return " + toString(lentAmount)) + " WBTC, but returning ") + toString(returnAmt))) | |
80 | + | else { | |
81 | + | let returnFullAmount = ((value(getInteger(this, startOf(renterStr))) + gracePeriod) > height) | |
82 | + | let expirationHeight = value(getInteger(this, endOfFreezeOf(renterStr))) | |
83 | + | let returnAmount = if (returnFullAmount) | |
84 | + | then depositedValue | |
85 | + | else if ((height > expirationHeight)) | |
86 | + | then throw("your loan has expired") | |
87 | + | else fraction(depositedValue, (expirationHeight - height), interestPeriod) | |
88 | + | let theRestOfAmount = (depositedValue - returnAmount) | |
89 | + | ScriptResult(closing(renterStr), TransferSet([ScriptTransfer(renter, returnAmount, depositToken), ScriptTransfer(beneficiary, theRestOfAmount, depositToken)])) | |
90 | + | } | |
91 | + | } | |
92 | + | ||
93 | + | ||
94 | + | @Callable(i) | |
95 | + | func init (owner,beneficiary,token,rate,grace,interest) = if ((i.caller == this)) | |
96 | + | then if (initialized) | |
97 | + | then throw("already initialized with token") | |
98 | + | else WriteSet([DataEntry(ownerKey, owner), DataEntry(benefciaryKey, beneficiary), DataEntry(assetTokenKey, token), DataEntry(reverseLendRateKey, rate), DataEntry(gracePeriodKey, grace), DataEntry(interestPeriodKey, interest)]) | |
99 | + | else throw("only dapp itself can init") | |
100 | + | ||
101 | + | ||
102 | + | ||
103 | + | @Callable(i) | |
104 | + | func updateRate (rate,grace,interest) = if ((i.caller == owner)) | |
105 | + | then WriteSet([DataEntry(reverseLendRateKey, rate), DataEntry(gracePeriodKey, grace), DataEntry(interestPeriodKey, interest)]) | |
106 | + | else throw("only contract owner can set a rate") | |
107 | + | ||
108 | + | ||
109 | + | ||
110 | + | @Callable(i) | |
111 | + | func borrow () = { | |
112 | + | let renter = toBase58String(i.caller.bytes) | |
113 | + | if (isLendOpen(renter)) | |
114 | + | then throw((renter + " already has an open loan")) | |
115 | + | else match i.payment { | |
116 | + | case a: AttachedPayment => | |
117 | + | if ((a.assetId == depositToken)) | |
118 | + | then { | |
119 | + | let currentHeight = height | |
120 | + | let expirationHeight = ((height + gracePeriod) + interestPeriod) | |
121 | + | let rate = reverseLendRate | |
122 | + | let depositAmount = a.amount | |
123 | + | let assetTokensLent = (a.amount / rate) | |
124 | + | let datas = WriteSet([DataEntry(startOf(renter), currentHeight), DataEntry(endOfFreezeOf(renter), expirationHeight), DataEntry(rateOf(renter), rate), DataEntry(depositOf(renter), depositAmount), DataEntry(lendAmount(renter), assetTokensLent)]) | |
125 | + | ScriptResult(datas, TransferSet([ScriptTransfer(i.caller, assetTokensLent, assetToken)])) | |
126 | + | } | |
127 | + | else throw(("can only lend WBTC for WAVES, but got " + toBase58String(value(a.assetId)))) | |
128 | + | case _ => | |
129 | + | throw("payment in assetTokens must be attached") | |
130 | + | } | |
131 | + | } | |
132 | + | ||
133 | + | ||
134 | + | ||
135 | + | @Callable(i) | |
136 | + | func restoreBuyBack (txId) = match transferTransactionById(fromBase58String(txId)) { | |
137 | + | case t: TransferTransaction => | |
138 | + | match getBoolean(this, registeredTx(txId)) { | |
139 | + | case b: Boolean => | |
140 | + | throw((("Tx id " + txId) + " has already been registered")) | |
141 | + | case _ => | |
142 | + | if ((t.recipient != this)) | |
143 | + | then throw("Can only register payments for this dapp address") | |
144 | + | else { | |
145 | + | let sr = doBB(t.sender, value(t.assetId), t.amount) | |
146 | + | ScriptResult(WriteSet([DataEntry(registeredTx(txId), true), sr.writeSet.data]), sr.transferSet) | |
147 | + | } | |
148 | + | } | |
149 | + | case _: Unit => | |
150 | + | throw("Transaction doesn't exist") | |
151 | + | case _ => | |
152 | + | throw() | |
153 | + | } | |
154 | + | ||
155 | + | ||
156 | + | ||
157 | + | @Callable(i) | |
158 | + | func buyBack () = doBB(i.caller, value(value(i.payment).assetId), value(i.payment).amount) | |
159 | + | ||
160 | + | ||
161 | + | ||
162 | + | @Callable(i) | |
163 | + | func closeExpiredFor (address) = { | |
164 | + | let expiryHeight = value(getInteger(this, endOfFreezeOf(address))) | |
165 | + | let loanExpired = (height > expiryHeight) | |
166 | + | let ownerCall = (i.caller.bytes == owner.bytes) | |
167 | + | if (!(ownerCall)) | |
168 | + | then throw("Only owner can close expired rent of a user") | |
169 | + | else if (!(loanExpired)) | |
170 | + | then throw(((("Owner can only close expired rents. Expiring on height " + toString(expiryHeight)) + ", current height") + toString(height))) | |
171 | + | else closeExpired(address) | |
172 | + | } | |
173 | + | ||
174 | + | ||
175 | + | ||
176 | + | @Callable(i) | |
177 | + | func discard () = { | |
178 | + | let address = toBase58String(i.caller.bytes) | |
179 | + | closeExpired(address) | |
180 | + | } | |
181 | + | ||
182 | + | ||
183 | + | ||
184 | + | @Callable(i) | |
185 | + | func withdraw (amount) = if ((i.caller == owner)) | |
186 | + | then TransferSet([ScriptTransfer(owner, amount, assetToken)]) | |
187 | + | else throw("only owner can withdraw WBTC") | |
188 | + | ||
189 | + | ||
190 | + | @Verifier(tx) | |
191 | + | func verify () = if (!(initialized)) | |
192 | + | then sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
193 | + | else false | |
194 | + |
github/deemru/w8io/169f3d6 20.43 ms ◑