tx · A36CzN5PtZoatuZk8B5r2K4kCdPVyE9dro8BRtR9pn2N 3MrmQcYkqD2NWZCPBPxJh9ecDeCSHJaGvTX: -0.01400000 Waves 2020.10.22 15:19 [1231770] smart account 3MrmQcYkqD2NWZCPBPxJh9ecDeCSHJaGvTX > SELF 0.00000000 Waves
{ "type": 13, "id": "A36CzN5PtZoatuZk8B5r2K4kCdPVyE9dro8BRtR9pn2N", "fee": 1400000, "feeAssetId": null, "timestamp": 1603369258718, "version": 1, "sender": "3MrmQcYkqD2NWZCPBPxJh9ecDeCSHJaGvTX", "senderPublicKey": "3jFYpyJ6e4HkngCSjP4y8XmWbp72HQExbfLDVKd4wZrr", "proofs": [ "4UaCPn95YMy8ARhsgcWTBoRQHdhw3WiGdFTwFGtDE614SV5QRCxkTbBLzSDYENMoauimfog1qe98zfsbhsh61odJ" ], "script": "base64:AAIEAAAAAAAAAA8IAhIAEgASABIAEgMKAQEAAAAQAAAAAAhJZFRva2VuQQkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAANYXNzZXRJZFRva2VuQQAAAAAISWRUb2tlbkIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAADWFzc2V0SWRUb2tlbkIAAAAADGFtb3VudFRva2VuQgkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAAMYW1vdW50VG9rZW5CAAAAAAxhbW91bnRUb2tlbkEJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAADGFtb3VudFRva2VuQQAAAAARYXNzZXRJZFRva2VuU2hhcmUJAQAAABFAZXh0ck5hdGl2ZSgxMDUyKQAAAAIFAAAABHRoaXMCAAAADnNoYXJlX3Rva2VuX2lkAAAAABB0b2tlblNoYXJlU3VwcGx5CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAABJzaGFyZV90b2tlbl9zd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A1hc3NldElkVG9rZW5CCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAAxhbW91bnRUb2tlbkEJAABkAAAAAgUAAAAMYW1vdW50VG9rZW5BBQAAABJ0b2tlblJlY2VpdmVBbW91bnQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAADGFtb3VudFRva2VuQgkAAGUAAAACBQAAAAxhbW91bnRUb2tlbkIFAAAAD3Rva2VuU2VuZEFtb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAOZXhjaGFuZ2VfY291bnQJAABkAAAAAgUAAAAFY291bnQAAAAAAAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAA90b2tlblNlbmRBbW91bnQFAAAAC2Fzc2V0SWRTZW50BQAAAANuaWwJAAACAAAAAQIAAAAUQXNzZXQgaXMgbm90IGFsbG93ZWQAAAAA2SK/xA==", "chainId": 84, "height": 1231770, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HJ9G3mZog1J8YYE5wAhod9juvn9GQb1MoJ8uPvBGcee Next: AzFFD6fcQsypHMNtruEw8Y8wt2g5JyP2GNbPqZsGGjD8 Diff:
Old | New | Differences | |
---|---|---|---|
13 | 13 | ||
14 | 14 | let tokenShareSupply = getIntegerValue(this, "share_token_supply") | |
15 | 15 | ||
16 | - | let comission = | |
16 | + | let comission = 500 | |
17 | 17 | ||
18 | - | let comissionScaleDelimiter = | |
18 | + | let comissionScaleDelimiter = 1000000 | |
19 | 19 | ||
20 | - | let version = "0.0 | |
20 | + | let version = "1.0.0" | |
21 | 21 | ||
22 | 22 | let scaleValue8 = 100000000 | |
23 | + | ||
24 | + | let ratioThresholdMax = 100000000 | |
25 | + | ||
26 | + | let ratioThresholdMin = 99999000 | |
23 | 27 | ||
24 | 28 | let scaleValue8Digits = 8 | |
25 | 29 | ||
79 | 83 | case _ => | |
80 | 84 | throw("Match error") | |
81 | 85 | } | |
82 | - | [IntegerEntry("amountTokenA", tokenReceiveAmountA), IntegerEntry("amountTokenB", tokenReceiveAmountB), StringEntry("assetIdTokenA", assetIdTokenStringA), StringEntry("assetIdTokenB", assetIdTokenStringB), IntegerEntry("exchange_count", 0), BooleanEntry("status", true), IntegerEntry("comission", comission), IntegerEntry("comissionScaleDelimiter", comissionScaleDelimiter), StringEntry("version", version), Issue(shareTokenName, shareTokenName, shareTokenInitialAmount, | |
86 | + | [IntegerEntry("amountTokenA", tokenReceiveAmountA), IntegerEntry("amountTokenB", tokenReceiveAmountB), StringEntry("assetIdTokenA", assetIdTokenStringA), StringEntry("assetIdTokenB", assetIdTokenStringB), IntegerEntry("exchange_count", 0), BooleanEntry("status", true), IntegerEntry("comission", comission), IntegerEntry("comissionScaleDelimiter", comissionScaleDelimiter), StringEntry("version", version), Issue(shareTokenName, shareTokenName, shareTokenInitialAmount, digitsInShareToken, true), ScriptTransfer(contextObj.caller, shareTokenInitialAmount, shareTokenAssetId), BinaryEntry("share_token_id", shareTokenAssetId), IntegerEntry("share_token_supply", shareTokenInitialAmount)] | |
83 | 87 | } | |
84 | 88 | } | |
85 | 89 | ||
112 | 116 | else [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenA", (dAppTokensAmountA + tokenReceiveAmountA)), IntegerEntry("amountTokenB", (dAppTokensAmountB + tokenReceiveAmountB))] | |
113 | 117 | } | |
114 | 118 | } | |
119 | + | } | |
120 | + | ||
121 | + | ||
122 | + | ||
123 | + | @Callable(contextObj) | |
124 | + | func replanishmentWithOneToken () = { | |
125 | + | let payment = value(contextObj.payments[0]) | |
126 | + | let assetIdReceived = payment.assetId | |
127 | + | let tokenReceiveAmount = payment.amount | |
128 | + | if ((assetIdReceived == assetIdTokenA)) | |
129 | + | then { | |
130 | + | let newAmountTokenA = (amountTokenA + tokenReceiveAmount) | |
131 | + | let priceAtoBwith8digits = fraction(newAmountTokenA, scaleValue8, amountTokenB) | |
132 | + | let tokenAmountBNewPriceOldInvariant = pow(fraction(amountTokenA, amountTokenB, priceAtoBwith8digits), 0, 5, 1, 0, HALFDOWN) | |
133 | + | let newTokenShareSupply = fraction(amountTokenB, tokenShareSupply, tokenAmountBNewPriceOldInvariant) | |
134 | + | let shareTokenToPayAmount = (newTokenShareSupply - tokenShareSupply) | |
135 | + | [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenA", newAmountTokenA)] | |
136 | + | } | |
137 | + | else if ((assetIdReceived == assetIdTokenB)) | |
138 | + | then { | |
139 | + | let newAmountTokenB = (amountTokenB + tokenReceiveAmount) | |
140 | + | let priceAtoBwith8digits = fraction(amountTokenA, scaleValue8, newAmountTokenB) | |
141 | + | let tokenAmountBNewPriceOldInvariant = pow(fraction(amountTokenA, amountTokenB, priceAtoBwith8digits), 0, 5, 1, 0, HALFDOWN) | |
142 | + | let newTokenShareSupply = fraction(amountTokenB, tokenShareSupply, tokenAmountBNewPriceOldInvariant) | |
143 | + | let shareTokenToPayAmount = (newTokenShareSupply - tokenShareSupply) | |
144 | + | [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenB", newAmountTokenB)] | |
145 | + | } | |
146 | + | else throw("incorrect assets in payment") | |
115 | 147 | } | |
116 | 148 | ||
117 | 149 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let IdTokenA = getStringValue(this, "assetIdTokenA") | |
5 | 5 | ||
6 | 6 | let IdTokenB = getStringValue(this, "assetIdTokenB") | |
7 | 7 | ||
8 | 8 | let amountTokenB = getIntegerValue(this, "amountTokenB") | |
9 | 9 | ||
10 | 10 | let amountTokenA = getIntegerValue(this, "amountTokenA") | |
11 | 11 | ||
12 | 12 | let assetIdTokenShare = getBinaryValue(this, "share_token_id") | |
13 | 13 | ||
14 | 14 | let tokenShareSupply = getIntegerValue(this, "share_token_supply") | |
15 | 15 | ||
16 | - | let comission = | |
16 | + | let comission = 500 | |
17 | 17 | ||
18 | - | let comissionScaleDelimiter = | |
18 | + | let comissionScaleDelimiter = 1000000 | |
19 | 19 | ||
20 | - | let version = "0.0 | |
20 | + | let version = "1.0.0" | |
21 | 21 | ||
22 | 22 | let scaleValue8 = 100000000 | |
23 | + | ||
24 | + | let ratioThresholdMax = 100000000 | |
25 | + | ||
26 | + | let ratioThresholdMin = 99999000 | |
23 | 27 | ||
24 | 28 | let scaleValue8Digits = 8 | |
25 | 29 | ||
26 | 30 | func assetId (asset) = if ((asset == "WAVES")) | |
27 | 31 | then unit | |
28 | 32 | else fromBase58String(asset) | |
29 | 33 | ||
30 | 34 | ||
31 | 35 | let assetIdTokenA = assetId(IdTokenA) | |
32 | 36 | ||
33 | 37 | let assetIdTokenB = assetId(IdTokenB) | |
34 | 38 | ||
35 | 39 | @Callable(contextObj) | |
36 | 40 | func fund () = { | |
37 | 41 | let paymentA = value(contextObj.payments[0]) | |
38 | 42 | let paymentB = value(contextObj.payments[1]) | |
39 | 43 | let assetIdReceivedA = paymentA.assetId | |
40 | 44 | let tokenReceiveAmountA = paymentA.amount | |
41 | 45 | let assetIdReceivedB = paymentB.assetId | |
42 | 46 | let tokenReceiveAmountB = paymentB.amount | |
43 | 47 | let digitTokenA = match assetIdReceivedA { | |
44 | 48 | case p: Unit => | |
45 | 49 | 8 | |
46 | 50 | case p: ByteVector => | |
47 | 51 | value(assetInfo(p)).decimals | |
48 | 52 | case _ => | |
49 | 53 | throw("Match error") | |
50 | 54 | } | |
51 | 55 | let digitTokenB = match assetIdReceivedB { | |
52 | 56 | case p: Unit => | |
53 | 57 | 8 | |
54 | 58 | case p: ByteVector => | |
55 | 59 | value(assetInfo(p)).decimals | |
56 | 60 | case _ => | |
57 | 61 | throw("Match error") | |
58 | 62 | } | |
59 | 63 | if (isDefined(getBoolean(this, "status"))) | |
60 | 64 | then throw("already active") | |
61 | 65 | else { | |
62 | 66 | let shareTokenName = ("ShareT_" + takeRight(toString(this), 5)) | |
63 | 67 | let digitsInShareToken = ((digitTokenA + digitTokenB) / 2) | |
64 | 68 | let shareTokenInitialAmount = fraction(pow(tokenReceiveAmountA, digitTokenA, 5, 1, digitTokenA, HALFDOWN), pow(tokenReceiveAmountB, digitTokenB, 5, 1, digitTokenB, HALFDOWN), pow(10, 0, digitsInShareToken, 0, 0, HALFDOWN)) | |
65 | 69 | let shareTokenAssetId = calculateAssetId(Issue(shareTokenName, shareTokenName, shareTokenInitialAmount, digitsInShareToken, true)) | |
66 | 70 | let assetIdTokenStringA = match assetIdReceivedA { | |
67 | 71 | case t: Unit => | |
68 | 72 | "WAVES" | |
69 | 73 | case t: ByteVector => | |
70 | 74 | toBase58String(value(assetIdReceivedA)) | |
71 | 75 | case _ => | |
72 | 76 | throw("Match error") | |
73 | 77 | } | |
74 | 78 | let assetIdTokenStringB = match assetIdReceivedB { | |
75 | 79 | case t: Unit => | |
76 | 80 | "WAVES" | |
77 | 81 | case t: ByteVector => | |
78 | 82 | toBase58String(value(assetIdReceivedB)) | |
79 | 83 | case _ => | |
80 | 84 | throw("Match error") | |
81 | 85 | } | |
82 | - | [IntegerEntry("amountTokenA", tokenReceiveAmountA), IntegerEntry("amountTokenB", tokenReceiveAmountB), StringEntry("assetIdTokenA", assetIdTokenStringA), StringEntry("assetIdTokenB", assetIdTokenStringB), IntegerEntry("exchange_count", 0), BooleanEntry("status", true), IntegerEntry("comission", comission), IntegerEntry("comissionScaleDelimiter", comissionScaleDelimiter), StringEntry("version", version), Issue(shareTokenName, shareTokenName, shareTokenInitialAmount, | |
86 | + | [IntegerEntry("amountTokenA", tokenReceiveAmountA), IntegerEntry("amountTokenB", tokenReceiveAmountB), StringEntry("assetIdTokenA", assetIdTokenStringA), StringEntry("assetIdTokenB", assetIdTokenStringB), IntegerEntry("exchange_count", 0), BooleanEntry("status", true), IntegerEntry("comission", comission), IntegerEntry("comissionScaleDelimiter", comissionScaleDelimiter), StringEntry("version", version), Issue(shareTokenName, shareTokenName, shareTokenInitialAmount, digitsInShareToken, true), ScriptTransfer(contextObj.caller, shareTokenInitialAmount, shareTokenAssetId), BinaryEntry("share_token_id", shareTokenAssetId), IntegerEntry("share_token_supply", shareTokenInitialAmount)] | |
83 | 87 | } | |
84 | 88 | } | |
85 | 89 | ||
86 | 90 | ||
87 | 91 | ||
88 | 92 | @Callable(contextObj) | |
89 | 93 | func replenishment () = { | |
90 | 94 | let paymentA = value(contextObj.payments[0]) | |
91 | 95 | let paymentB = value(contextObj.payments[1]) | |
92 | 96 | let assetIdReceivedA = paymentA.assetId | |
93 | 97 | let tokenReceiveAmountA = paymentA.amount | |
94 | 98 | let assetIdReceivedB = paymentB.assetId | |
95 | 99 | let tokenReceiveAmountB = paymentB.amount | |
96 | 100 | let dAppTokensAmountA = getIntegerValue(this, "amountTokenA") | |
97 | 101 | let dAppTokensAmountB = getIntegerValue(this, "amountTokenB") | |
98 | 102 | if (if ((assetIdReceivedA != assetIdTokenA)) | |
99 | 103 | then true | |
100 | 104 | else (assetIdReceivedB != assetIdTokenB)) | |
101 | 105 | then throw("incorrect assets") | |
102 | 106 | else { | |
103 | 107 | let tokenRatio = (fraction(tokenReceiveAmountA, (1000000000000 * 100000), dAppTokensAmountA) / fraction(dAppTokensAmountB, 1000000000000, tokenReceiveAmountB)) | |
104 | 108 | if (!(if ((tokenRatio > 99990)) | |
105 | 109 | then (100010 > tokenRatio) | |
106 | 110 | else false)) | |
107 | 111 | then throw("incorrect assets amount") | |
108 | 112 | else { | |
109 | 113 | let shareTokenToPayAmount = fraction(tokenReceiveAmountA, tokenShareSupply, dAppTokensAmountA) | |
110 | 114 | if ((shareTokenToPayAmount == 0)) | |
111 | 115 | then throw("you try replansish with very small amount") | |
112 | 116 | else [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenA", (dAppTokensAmountA + tokenReceiveAmountA)), IntegerEntry("amountTokenB", (dAppTokensAmountB + tokenReceiveAmountB))] | |
113 | 117 | } | |
114 | 118 | } | |
119 | + | } | |
120 | + | ||
121 | + | ||
122 | + | ||
123 | + | @Callable(contextObj) | |
124 | + | func replanishmentWithOneToken () = { | |
125 | + | let payment = value(contextObj.payments[0]) | |
126 | + | let assetIdReceived = payment.assetId | |
127 | + | let tokenReceiveAmount = payment.amount | |
128 | + | if ((assetIdReceived == assetIdTokenA)) | |
129 | + | then { | |
130 | + | let newAmountTokenA = (amountTokenA + tokenReceiveAmount) | |
131 | + | let priceAtoBwith8digits = fraction(newAmountTokenA, scaleValue8, amountTokenB) | |
132 | + | let tokenAmountBNewPriceOldInvariant = pow(fraction(amountTokenA, amountTokenB, priceAtoBwith8digits), 0, 5, 1, 0, HALFDOWN) | |
133 | + | let newTokenShareSupply = fraction(amountTokenB, tokenShareSupply, tokenAmountBNewPriceOldInvariant) | |
134 | + | let shareTokenToPayAmount = (newTokenShareSupply - tokenShareSupply) | |
135 | + | [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenA", newAmountTokenA)] | |
136 | + | } | |
137 | + | else if ((assetIdReceived == assetIdTokenB)) | |
138 | + | then { | |
139 | + | let newAmountTokenB = (amountTokenB + tokenReceiveAmount) | |
140 | + | let priceAtoBwith8digits = fraction(amountTokenA, scaleValue8, newAmountTokenB) | |
141 | + | let tokenAmountBNewPriceOldInvariant = pow(fraction(amountTokenA, amountTokenB, priceAtoBwith8digits), 0, 5, 1, 0, HALFDOWN) | |
142 | + | let newTokenShareSupply = fraction(amountTokenB, tokenShareSupply, tokenAmountBNewPriceOldInvariant) | |
143 | + | let shareTokenToPayAmount = (newTokenShareSupply - tokenShareSupply) | |
144 | + | [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenB", newAmountTokenB)] | |
145 | + | } | |
146 | + | else throw("incorrect assets in payment") | |
115 | 147 | } | |
116 | 148 | ||
117 | 149 | ||
118 | 150 | ||
119 | 151 | @Callable(contextObj) | |
120 | 152 | func withdraw () = { | |
121 | 153 | let dAppTokensAmountA = getIntegerValue(this, "amountTokenA") | |
122 | 154 | let dAppTokensAmountB = getIntegerValue(this, "amountTokenB") | |
123 | 155 | let payment = value(contextObj.payments[0]) | |
124 | 156 | let assetIdReceived = payment.assetId | |
125 | 157 | let tokenReceiveAmount = payment.amount | |
126 | 158 | if ((assetIdTokenShare != assetIdReceived)) | |
127 | 159 | then throw(("you need to attach share token for this dApp " + toBase58String(assetIdTokenShare))) | |
128 | 160 | else { | |
129 | 161 | let tokensToPayA = fraction(tokenReceiveAmount, dAppTokensAmountA, tokenShareSupply) | |
130 | 162 | let tokensToPayB = fraction(tokenReceiveAmount, dAppTokensAmountB, tokenShareSupply) | |
131 | 163 | [ScriptTransfer(contextObj.caller, tokensToPayA, assetIdTokenA), ScriptTransfer(contextObj.caller, tokensToPayB, assetIdTokenB), IntegerEntry("amountTokenA", (dAppTokensAmountA - tokensToPayA)), IntegerEntry("amountTokenB", (dAppTokensAmountB - tokensToPayB)), IntegerEntry("share_token_supply", (tokenShareSupply - tokenReceiveAmount)), Burn(assetIdTokenShare, tokenReceiveAmount)] | |
132 | 164 | } | |
133 | 165 | } | |
134 | 166 | ||
135 | 167 | ||
136 | 168 | ||
137 | 169 | @Callable(contextObj) | |
138 | 170 | func exchanger (minTokenRecieve) = { | |
139 | 171 | let payment = value(contextObj.payments[0]) | |
140 | 172 | let assetIdReceived = payment.assetId | |
141 | 173 | let tokenReceiveAmount = payment.amount | |
142 | 174 | let count = value(getInteger(this, "exchange_count")) | |
143 | 175 | if ((assetIdReceived == assetIdTokenB)) | |
144 | 176 | then { | |
145 | 177 | let tokenSendAmount = ((fraction(amountTokenA, tokenReceiveAmount, (tokenReceiveAmount + amountTokenB)) * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
146 | 178 | if ((minTokenRecieve > tokenSendAmount)) | |
147 | 179 | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
148 | 180 | else { | |
149 | 181 | let assetIdSent = assetIdTokenA | |
150 | 182 | [IntegerEntry("amountTokenA", (amountTokenA - tokenSendAmount)), IntegerEntry("amountTokenB", (amountTokenB + tokenReceiveAmount)), IntegerEntry("exchange_count", (count + 1)), ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)] | |
151 | 183 | } | |
152 | 184 | } | |
153 | 185 | else if ((assetIdReceived == assetIdTokenA)) | |
154 | 186 | then { | |
155 | 187 | let tokenSendAmount = ((fraction(amountTokenB, tokenReceiveAmount, (tokenReceiveAmount + amountTokenA)) * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
156 | 188 | if ((minTokenRecieve > tokenSendAmount)) | |
157 | 189 | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
158 | 190 | else { | |
159 | 191 | let assetIdSent = assetIdTokenB | |
160 | 192 | [IntegerEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), IntegerEntry("amountTokenB", (amountTokenB - tokenSendAmount)), IntegerEntry("exchange_count", (count + 1)), ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)] | |
161 | 193 | } | |
162 | 194 | } | |
163 | 195 | else throw("Asset is not allowed") | |
164 | 196 | } | |
165 | 197 | ||
166 | 198 |
github/deemru/w8io/026f985 53.54 ms ◑