tx · 6SVM2WX5AccrzBYwwWKTQpMg5VBmggHiYGga5rgyuQpm 3Mxdm8cTt6aaqjTbbvCy5USBXEduc9amgNa: -0.01000000 Waves 2019.09.02 16:17 [658385] smart account 3Mxdm8cTt6aaqjTbbvCy5USBXEduc9amgNa > SELF 0.00000000 Waves
{ "type": 13, "id": "6SVM2WX5AccrzBYwwWKTQpMg5VBmggHiYGga5rgyuQpm", "fee": 1000000, "feeAssetId": null, "timestamp": 1567430246587, "version": 1, "sender": "3Mxdm8cTt6aaqjTbbvCy5USBXEduc9amgNa", "senderPublicKey": "E8YueHsBcJerA7axc8WE2Ea95uTaFssjVhTm9nu97RR1", "proofs": [ "5YJrP98GHXUxZRtWbscoJayuWKHoks8UwCmt31RnjTX42msiPJhATLDG9AAp5dsahcTnKqkc975o8M9aMHRB48o5" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAVvd25lcgEAAAAaAVRfouoATMjv1bSDpf4nCGupdOcE403u6w8AAAAADWFzc2V0SWRUb2tlbkEBAAAAIPVMhmMvsEQF0zf8ITDMqgM/GMaTkUoB3lAumJLZZnRvAAAAAA1hc3NldElkVG9rZW5CBQAAAAR1bml0AAAAAAljb21pc3Npb24AAAAAAAAAAAoAAAAEAAAACmNvbnRleHRPYmoBAAAABGZ1bmQAAAAABAAAAAdwYXltZW50BAAAAAckbWF0Y2gwCAUAAAAKY29udGV4dE9iagAAAAdwYXltZW50AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9BdHRhY2hlZFBheW1lbnQEAAAAAXAFAAAAByRtYXRjaDAFAAAAAXAJAAACAAAAAQIAAAAUUGF5bWVudCBub3QgYXR0YWNoZWQEAAAAD2Fzc2V0SWRSZWNlaXZlZAgFAAAAB3BheW1lbnQAAAAHYXNzZXRJZAQAAAASdG9rZW5SZWNlaXZlQW1vdW50CAUAAAAHcGF5bWVudAAAAAZhbW91bnQDAwkAAAAAAAACBQAAAA9hc3NldElkUmVjZWl2ZWQFAAAADWFzc2V0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sZXIFAAAADUJhbGFuY2VUb2tlbkIFAAAADWFzc2V0SWRUb2tlbkIFAAAAA25pbAkAAAIAAAABAgAAAB1Zb3UgYXJlIG5vdCBleGNoYW5nZXIncyBvd25lcgAAAAEAAAAKY29udGV4dE9iagEAAAAGdmVyaWZ5AAAAAAYsE9Nl", "chainId": 84, "height": 658385, "spentComplexity": 0 } View: original | compacted Prev: none Next: Bmf9mSwsZe3Eqm3pA3YZwSt6RMbPkJJCmHKnqxvtShhz Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let owner = base58'3Mxdm8cTt6aaqjTbbvCy5USBXEduc9amgNa' | |
5 | + | ||
6 | + | let assetIdTokenA = base58'HWYZmgTwmh6UKf14RTLhM1Ah3rmN64UxTQtShqYuuwTt' | |
7 | + | ||
8 | + | let assetIdTokenB = unit | |
9 | + | ||
10 | + | let comission = 10 | |
11 | + | ||
12 | + | @Callable(contextObj) | |
13 | + | func fund () = { | |
14 | + | let payment = match contextObj.payment { | |
15 | + | case p: AttachedPayment => | |
16 | + | p | |
17 | + | case _ => | |
18 | + | throw("Payment not attached") | |
19 | + | } | |
20 | + | let assetIdReceived = payment.assetId | |
21 | + | let tokenReceiveAmount = payment.amount | |
22 | + | if (if ((assetIdReceived == assetIdTokenA)) | |
23 | + | then !(isDefined(getBoolean(this, "fundA"))) | |
24 | + | else false) | |
25 | + | then if (isDefined(getBoolean(this, "fundB"))) | |
26 | + | then WriteSet([DataEntry("amountTokenA", tokenReceiveAmount), DataEntry("fundA", true), DataEntry("exchange_count", 0), DataEntry("status", true)]) | |
27 | + | else WriteSet([DataEntry("amountTokenA", tokenReceiveAmount), DataEntry("fundA", true)]) | |
28 | + | else if (if ((assetIdReceived == assetIdTokenB)) | |
29 | + | then !(isDefined(getBoolean(this, "fundB"))) | |
30 | + | else false) | |
31 | + | then if (isDefined(getBoolean(this, "fundA"))) | |
32 | + | then WriteSet([DataEntry("amountTokenB", tokenReceiveAmount), DataEntry("fundB", true), DataEntry("exchange_count", 0), DataEntry("status", true)]) | |
33 | + | else WriteSet([DataEntry("amountTokenB", tokenReceiveAmount), DataEntry("fundB", true)]) | |
34 | + | else throw("already funded or you try to fund with incorrect asset") | |
35 | + | } | |
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | @Callable(contextObj) | |
40 | + | func replenishment () = { | |
41 | + | let payment = match contextObj.payment { | |
42 | + | case p: AttachedPayment => | |
43 | + | p | |
44 | + | case _ => | |
45 | + | throw("Payment not attached") | |
46 | + | } | |
47 | + | let assetIdReceived = payment.assetId | |
48 | + | let tokenReceiveAmount = payment.amount | |
49 | + | if (if ((assetIdReceived == assetIdTokenA)) | |
50 | + | then isDefined(getBoolean(this, "fundA")) | |
51 | + | else false) | |
52 | + | then { | |
53 | + | let amountTokenA = getIntegerValue(this, "amountTokenA") | |
54 | + | WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount))]) | |
55 | + | } | |
56 | + | else if (if ((assetIdReceived == assetIdTokenB)) | |
57 | + | then isDefined(getBoolean(this, "fundB")) | |
58 | + | else false) | |
59 | + | then { | |
60 | + | let amountTokenB = getIntegerValue(this, "amountTokenB") | |
61 | + | WriteSet([DataEntry("amountTokenB", (amountTokenB + tokenReceiveAmount))]) | |
62 | + | } | |
63 | + | else throw("there was an error in the replenishment") | |
64 | + | } | |
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | @Callable(contextObj) | |
69 | + | func exchanger (minTokenRecieve) = if (if ((0 > comission)) | |
70 | + | then true | |
71 | + | else (comission > 100)) | |
72 | + | then throw("incorrect comission value") | |
73 | + | else { | |
74 | + | let amountTokenB = getIntegerValue(this, "amountTokenB") | |
75 | + | let amountTokenA = getIntegerValue(this, "amountTokenA") | |
76 | + | let payment = match contextObj.payment { | |
77 | + | case p: AttachedPayment => | |
78 | + | p | |
79 | + | case _ => | |
80 | + | throw("Payment not attached") | |
81 | + | } | |
82 | + | let assetIdReceived = payment.assetId | |
83 | + | let tokenReceiveAmount = payment.amount | |
84 | + | let count = match getInteger(this, "exchange_count") { | |
85 | + | case i: Int => | |
86 | + | value(getInteger(this, "exchange_count")) | |
87 | + | case _ => | |
88 | + | 0 | |
89 | + | } | |
90 | + | if ((assetIdReceived == assetIdTokenB)) | |
91 | + | then { | |
92 | + | let tokenSendAmount = ((fraction(amountTokenA, tokenReceiveAmount, (tokenReceiveAmount + amountTokenB)) * (100 - comission)) / 100) | |
93 | + | if ((minTokenRecieve > tokenSendAmount)) | |
94 | + | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
95 | + | else { | |
96 | + | let assetIdSent = assetIdTokenA | |
97 | + | ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA - tokenSendAmount)), DataEntry("amountTokenB", (amountTokenB + tokenReceiveAmount)), DataEntry("exchange_count", (count + 1))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)])) | |
98 | + | } | |
99 | + | } | |
100 | + | else if ((assetIdReceived == assetIdTokenA)) | |
101 | + | then { | |
102 | + | let tokenSendAmount = ((fraction(amountTokenB, tokenReceiveAmount, (tokenReceiveAmount + amountTokenA)) * (100 - comission)) / 100) | |
103 | + | if ((minTokenRecieve > tokenSendAmount)) | |
104 | + | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
105 | + | else { | |
106 | + | let assetIdSent = assetIdTokenB | |
107 | + | ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), DataEntry("amountTokenB", (amountTokenB - tokenSendAmount)), DataEntry("exchange_count", (count + 1))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)])) | |
108 | + | } | |
109 | + | } | |
110 | + | else throw("Asset is not allowed") | |
111 | + | } | |
112 | + | ||
113 | + | ||
114 | + | ||
115 | + | @Callable(contextObj) | |
116 | + | func withdraw () = { | |
117 | + | let BalanceTokenA = assetBalance(this, assetIdTokenA) | |
118 | + | let BalanceTokenB = assetBalance(this, assetIdTokenB) | |
119 | + | if ((contextObj.caller.bytes == owner)) | |
120 | + | then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn"), DataEntry("status", false)]), TransferSet([ScriptTransfer(contextObj.caller, BalanceTokenA, assetIdTokenA), ScriptTransfer(contextObj.caller, BalanceTokenB, assetIdTokenB)])) | |
121 | + | else throw("You are not exchanger's owner") | |
122 | + | } | |
123 | + | ||
124 | + | ||
125 | + | @Verifier(contextObj) | |
126 | + | func verify () = true | |
127 | + |
github/deemru/w8io/026f985 18.70 ms ◑