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