tx · crwZWnMczdDtwGxREDo21QJeqwCn9w1iffmL8T2MtA3

3N6RmPRrsF5PPv48u6RPC64RuW3EyQGgNhd:  -0.01400000 Waves

2020.10.27 23:06 [1239481] smart account 3N6RmPRrsF5PPv48u6RPC64RuW3EyQGgNhd > SELF 0.00000000 Waves

{ "type": 13, "id": "crwZWnMczdDtwGxREDo21QJeqwCn9w1iffmL8T2MtA3", "fee": 1400000, "feeAssetId": null, "timestamp": 1603829200209, "version": 1, "sender": "3N6RmPRrsF5PPv48u6RPC64RuW3EyQGgNhd", "senderPublicKey": "DNQoUXh3GQY7nCmzoysqo88Q77U2EyQsG7WLyEmWyCYs", "proofs": [ "Um34ummMTAZFAeG6BWBb1YQtGN2Fd6w7jMs9ip6GqyNZo42bYQVMJ7mMY6onLYqtuxjXHgD3DiHtJw1u9hfn7Hd" ], "script": "base64:AAIEAAAAAAAAAA8IAhIAEgASABIAEgMKAQEAAAASAAAAABFnb3Zlcm5hbmNlQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBUxOlRfV53O7UL6ST3Xinja4q82stIcT/pgAAAAAISWRUb2tlbkEJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAADWFzc2V0SWRUb2tlbkEAAAAACElkVG9rZW5CCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAA1hc3NldElkVG9rZW5CAAAAAAxhbW91bnRUb2tlbkIJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAADGFtb3VudFRva2VuQgAAAAAMYW1vdW50VG9rZW5BCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAAxhbW91bnRUb2tlbkEAAAAADElkVG9rZW5TaGFyZQkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAAOc2hhcmVfdG9rZW5faWQAAAAAEHRva2VuU2hhcmVT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bkIFAAAAFnRva2VuU2VuZEFtb3VudFdpdGhGZWUFAAAAE3Rva2VuU2VuZEdvdmVybmFuY2UJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAABZ0b2tlblNlbmRBbW91bnRXaXRoRmVlBQAAAAthc3NldElkU2VuZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABFnb3Zlcm5hbmNlQWRkcmVzcwUAAAATdG9rZW5TZW5kR292ZXJuYW5jZQUAAAALYXNzZXRJZFNlbmQFAAAAA25pbAkAAAIAAAABAgAAABRBc3NldCBpcyBub3QgYWxsb3dlZAAAAABa/TIb", "chainId": 84, "height": 1239481, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9V4S7uaPYQ8bpaBxRyRMEUdxWLMjAU6Epe3DSZgC8Gr2 Next: 5UHNMd6zMZPHPD7a8m7o8Rb5Jz5Zb4EzF9jVDQ59ZE5Q Diff:
OldNewDifferences
2222 let comissionScaleDelimiter = 1000000
2323
2424 let version = "1.0.0"
25+
26+let scaleValue3 = 1000
2527
2628 let scaleValue8 = 100000000
2729
8587 case _ =>
8688 throw("Match error")
8789 }
88-[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), StringEntry("share_token_id", toBase58String(shareTokenAssetId)), IntegerEntry("share_token_supply", shareTokenInitialAmount)]
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)]
8991 }
9092 }
9193
9294
9395
9496 @Callable(contextObj)
95-func replenishment () = {
97+func replenishmentWithTwoToken () = {
9698 let paymentA = value(contextObj.payments[0])
9799 let paymentB = value(contextObj.payments[1])
98100 let assetIdReceivedA = paymentA.assetId
106108 else (assetIdReceivedB != assetIdTokenB))
107109 then throw("incorrect assets")
108110 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")
114114 else {
115115 let shareTokenToPayAmount = fraction(tokenReceiveAmountA, tokenShareSupply, dAppTokensAmountA)
116116 if ((shareTokenToPayAmount == 0))
175175 let payment = value(contextObj.payments[0])
176176 let assetIdReceived = payment.assetId
177177 let tokenReceiveAmount = payment.amount
178- let count = value(getInteger(this, "exchange_count"))
179178 if ((getBooleanValue(this, "status") != true))
180179 then throw("status: Unactive")
181180 else if ((assetIdReceived == assetIdTokenB))
187186 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
188187 else {
189188 let assetIdSend = assetIdTokenA
190-[IntegerEntry("amountTokenA", ((amountTokenA - tokenSendAmountWithFee) - tokenSendGovernance)), IntegerEntry("amountTokenB", (amountTokenB + tokenReceiveAmount)), IntegerEntry("exchange_count", (count + 1)), ScriptTransfer(contextObj.caller, tokenSendAmountWithFee, assetIdSend), ScriptTransfer(governanceAddress, tokenSendGovernance, assetIdSend)]
189+[IntegerEntry("amountTokenA", ((amountTokenA - tokenSendAmountWithFee) - tokenSendGovernance)), IntegerEntry("amountTokenB", (amountTokenB + tokenReceiveAmount)), ScriptTransfer(contextObj.caller, tokenSendAmountWithFee, assetIdSend), ScriptTransfer(governanceAddress, tokenSendGovernance, assetIdSend)]
191190 }
192191 }
193192 else if ((assetIdReceived == assetIdTokenA))
199198 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
200199 else {
201200 let assetIdSend = assetIdTokenB
202-[IntegerEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), IntegerEntry("amountTokenB", ((amountTokenB - tokenSendAmountWithFee) - tokenSendGovernance)), IntegerEntry("exchange_count", (count + 1)), ScriptTransfer(contextObj.caller, tokenSendAmountWithFee, assetIdSend), ScriptTransfer(governanceAddress, tokenSendGovernance, assetIdSend)]
201+[IntegerEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), IntegerEntry("amountTokenB", ((amountTokenB - tokenSendAmountWithFee) - tokenSendGovernance)), ScriptTransfer(contextObj.caller, tokenSendAmountWithFee, assetIdSend), ScriptTransfer(governanceAddress, tokenSendGovernance, assetIdSend)]
203202 }
204203 }
205204 else throw("Asset is not allowed")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let governanceAddress = Address(base58'3MSNMcqyweiM9cWpvf4Fn8GAWeuPstxj2hK')
55
66 let IdTokenA = getStringValue(this, "assetIdTokenA")
77
88 let IdTokenB = getStringValue(this, "assetIdTokenB")
99
1010 let amountTokenB = getIntegerValue(this, "amountTokenB")
1111
1212 let amountTokenA = getIntegerValue(this, "amountTokenA")
1313
1414 let IdTokenShare = getStringValue(this, "share_token_id")
1515
1616 let tokenShareSupply = getIntegerValue(this, "share_token_supply")
1717
1818 let comission = 300
1919
2020 let commisionGovernance = 200
2121
2222 let comissionScaleDelimiter = 1000000
2323
2424 let version = "1.0.0"
25+
26+let scaleValue3 = 1000
2527
2628 let scaleValue8 = 100000000
2729
2830 let scaleValue8Digits = 8
2931
3032 func assetId (asset) = if ((asset == "WAVES"))
3133 then unit
3234 else fromBase58String(asset)
3335
3436
3537 let assetIdTokenA = assetId(IdTokenA)
3638
3739 let assetIdTokenB = assetId(IdTokenB)
3840
3941 let assetIdTokenShare = fromBase58String(IdTokenShare)
4042
4143 @Callable(contextObj)
4244 func fund () = {
4345 let paymentA = value(contextObj.payments[0])
4446 let paymentB = value(contextObj.payments[1])
4547 let assetIdReceivedA = paymentA.assetId
4648 let tokenReceiveAmountA = paymentA.amount
4749 let assetIdReceivedB = paymentB.assetId
4850 let tokenReceiveAmountB = paymentB.amount
4951 let digitTokenA = match assetIdReceivedA {
5052 case p: Unit =>
5153 8
5254 case p: ByteVector =>
5355 value(assetInfo(p)).decimals
5456 case _ =>
5557 throw("Match error")
5658 }
5759 let digitTokenB = match assetIdReceivedB {
5860 case p: Unit =>
5961 8
6062 case p: ByteVector =>
6163 value(assetInfo(p)).decimals
6264 case _ =>
6365 throw("Match error")
6466 }
6567 if (isDefined(getBoolean(this, "status")))
6668 then throw("already active")
6769 else {
6870 let shareTokenName = ("ShareT_" + takeRight(toString(this), 5))
6971 let digitsInShareToken = ((digitTokenA + digitTokenB) / 2)
7072 let shareTokenInitialAmount = fraction(pow(tokenReceiveAmountA, digitTokenA, 5, 1, digitTokenA, HALFDOWN), pow(tokenReceiveAmountB, digitTokenB, 5, 1, digitTokenB, HALFDOWN), pow(10, 0, digitsInShareToken, 0, 0, HALFDOWN))
7173 let shareTokenAssetId = calculateAssetId(Issue(shareTokenName, shareTokenName, shareTokenInitialAmount, digitsInShareToken, true))
7274 let assetIdTokenStringA = match assetIdReceivedA {
7375 case t: Unit =>
7476 "WAVES"
7577 case t: ByteVector =>
7678 toBase58String(value(assetIdReceivedA))
7779 case _ =>
7880 throw("Match error")
7981 }
8082 let assetIdTokenStringB = match assetIdReceivedB {
8183 case t: Unit =>
8284 "WAVES"
8385 case t: ByteVector =>
8486 toBase58String(value(assetIdReceivedB))
8587 case _ =>
8688 throw("Match error")
8789 }
88-[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), StringEntry("share_token_id", toBase58String(shareTokenAssetId)), IntegerEntry("share_token_supply", shareTokenInitialAmount)]
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)]
8991 }
9092 }
9193
9294
9395
9496 @Callable(contextObj)
95-func replenishment () = {
97+func replenishmentWithTwoToken () = {
9698 let paymentA = value(contextObj.payments[0])
9799 let paymentB = value(contextObj.payments[1])
98100 let assetIdReceivedA = paymentA.assetId
99101 let tokenReceiveAmountA = paymentA.amount
100102 let assetIdReceivedB = paymentB.assetId
101103 let tokenReceiveAmountB = paymentB.amount
102104 let dAppTokensAmountA = getIntegerValue(this, "amountTokenA")
103105 let dAppTokensAmountB = getIntegerValue(this, "amountTokenB")
104106 if (if ((assetIdReceivedA != assetIdTokenA))
105107 then true
106108 else (assetIdReceivedB != assetIdTokenB))
107109 then throw("incorrect assets")
108110 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")
114114 else {
115115 let shareTokenToPayAmount = fraction(tokenReceiveAmountA, tokenShareSupply, dAppTokensAmountA)
116116 if ((shareTokenToPayAmount == 0))
117117 then throw("you try replansish with very small amount")
118118 else [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenA", (dAppTokensAmountA + tokenReceiveAmountA)), IntegerEntry("amountTokenB", (dAppTokensAmountB + tokenReceiveAmountB))]
119119 }
120120 }
121121 }
122122
123123
124124
125125 @Callable(contextObj)
126126 func replanishmentWithOneToken () = {
127127 let payment = value(contextObj.payments[0])
128128 let assetIdReceived = payment.assetId
129129 let tokenReceiveAmount = payment.amount
130130 if ((assetIdReceived == assetIdTokenA))
131131 then {
132132 let newAmountTokenA = (amountTokenA + tokenReceiveAmount)
133133 let priceAtoBwith8digits = fraction(newAmountTokenA, scaleValue8, amountTokenB)
134134 let tokenAmountBNewPriceOldInvariant = pow(fraction(amountTokenA, amountTokenB, priceAtoBwith8digits), 0, 5, 1, 0, HALFDOWN)
135135 let newTokenShareSupply = fraction(amountTokenB, tokenShareSupply, tokenAmountBNewPriceOldInvariant)
136136 let shareTokenToPayAmount = (newTokenShareSupply - tokenShareSupply)
137137 [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenA", newAmountTokenA)]
138138 }
139139 else if ((assetIdReceived == assetIdTokenB))
140140 then {
141141 let newAmountTokenB = (amountTokenB + tokenReceiveAmount)
142142 let priceAtoBwith8digits = fraction(amountTokenA, scaleValue8, newAmountTokenB)
143143 let tokenAmountBNewPriceOldInvariant = pow(fraction(amountTokenA, amountTokenB, priceAtoBwith8digits), 0, 5, 1, 0, HALFDOWN)
144144 let newTokenShareSupply = fraction(amountTokenB, tokenShareSupply, tokenAmountBNewPriceOldInvariant)
145145 let shareTokenToPayAmount = (newTokenShareSupply - tokenShareSupply)
146146 [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenB", newAmountTokenB)]
147147 }
148148 else throw("incorrect assets in payment")
149149 }
150150
151151
152152
153153 @Callable(contextObj)
154154 func withdraw () = {
155155 let dAppTokensAmountA = getIntegerValue(this, "amountTokenA")
156156 let dAppTokensAmountB = getIntegerValue(this, "amountTokenB")
157157 let payment = value(contextObj.payments[0])
158158 let assetIdReceived = payment.assetId
159159 let tokenReceiveAmount = payment.amount
160160 if ((assetIdTokenShare != assetIdReceived))
161161 then throw(("you need to attach share token for this dApp " + toBase58String(assetIdTokenShare)))
162162 else {
163163 let tokensToPayA = fraction(tokenReceiveAmount, dAppTokensAmountA, tokenShareSupply)
164164 let tokensToPayB = fraction(tokenReceiveAmount, dAppTokensAmountB, tokenShareSupply)
165165 if ((getBooleanValue(this, "status") != true))
166166 then throw("status: Unactive")
167167 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)]
168168 }
169169 }
170170
171171
172172
173173 @Callable(contextObj)
174174 func exchanger (minTokenRecieve) = {
175175 let payment = value(contextObj.payments[0])
176176 let assetIdReceived = payment.assetId
177177 let tokenReceiveAmount = payment.amount
178- let count = value(getInteger(this, "exchange_count"))
179178 if ((getBooleanValue(this, "status") != true))
180179 then throw("status: Unactive")
181180 else if ((assetIdReceived == assetIdTokenB))
182181 then {
183182 let tokenSendAmountWithoutFee = fraction(amountTokenA, tokenReceiveAmount, (tokenReceiveAmount + amountTokenB))
184183 let tokenSendAmountWithFee = fraction(tokenSendAmountWithoutFee, (comissionScaleDelimiter - comission), comissionScaleDelimiter)
185184 let tokenSendGovernance = fraction(tokenSendAmountWithoutFee, commisionGovernance, comissionScaleDelimiter)
186185 if ((minTokenRecieve > tokenSendAmountWithFee))
187186 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
188187 else {
189188 let assetIdSend = assetIdTokenA
190-[IntegerEntry("amountTokenA", ((amountTokenA - tokenSendAmountWithFee) - tokenSendGovernance)), IntegerEntry("amountTokenB", (amountTokenB + tokenReceiveAmount)), IntegerEntry("exchange_count", (count + 1)), ScriptTransfer(contextObj.caller, tokenSendAmountWithFee, assetIdSend), ScriptTransfer(governanceAddress, tokenSendGovernance, assetIdSend)]
189+[IntegerEntry("amountTokenA", ((amountTokenA - tokenSendAmountWithFee) - tokenSendGovernance)), IntegerEntry("amountTokenB", (amountTokenB + tokenReceiveAmount)), ScriptTransfer(contextObj.caller, tokenSendAmountWithFee, assetIdSend), ScriptTransfer(governanceAddress, tokenSendGovernance, assetIdSend)]
191190 }
192191 }
193192 else if ((assetIdReceived == assetIdTokenA))
194193 then {
195194 let tokenSendAmountWithoutFee = fraction(amountTokenB, tokenReceiveAmount, (tokenReceiveAmount + amountTokenA))
196195 let tokenSendAmountWithFee = fraction(tokenSendAmountWithoutFee, (comissionScaleDelimiter - comission), comissionScaleDelimiter)
197196 let tokenSendGovernance = fraction(tokenSendAmountWithoutFee, commisionGovernance, comissionScaleDelimiter)
198197 if ((minTokenRecieve > tokenSendAmountWithFee))
199198 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
200199 else {
201200 let assetIdSend = assetIdTokenB
202-[IntegerEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), IntegerEntry("amountTokenB", ((amountTokenB - tokenSendAmountWithFee) - tokenSendGovernance)), IntegerEntry("exchange_count", (count + 1)), ScriptTransfer(contextObj.caller, tokenSendAmountWithFee, assetIdSend), ScriptTransfer(governanceAddress, tokenSendGovernance, assetIdSend)]
201+[IntegerEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), IntegerEntry("amountTokenB", ((amountTokenB - tokenSendAmountWithFee) - tokenSendGovernance)), ScriptTransfer(contextObj.caller, tokenSendAmountWithFee, assetIdSend), ScriptTransfer(governanceAddress, tokenSendGovernance, assetIdSend)]
203202 }
204203 }
205204 else throw("Asset is not allowed")
206205 }
207206
208207

github/deemru/w8io/026f985 
37.44 ms