tx · 5xXsnRn2wKECZdbeocfeyHnkmgykwotvvAmgWNATPDgr

3Mz6N28dUJUcjCPJL9VeWUSCa1BwSt6jJzZ:  -0.01400000 Waves

2019.09.02 16:03 [658373] smart account 3Mz6N28dUJUcjCPJL9VeWUSCa1BwSt6jJzZ > SELF 0.00000000 Waves

{ "type": 13, "id": "5xXsnRn2wKECZdbeocfeyHnkmgykwotvvAmgWNATPDgr", "fee": 1400000, "feeAssetId": null, "timestamp": 1567429391172, "version": 1, "sender": "3Mz6N28dUJUcjCPJL9VeWUSCa1BwSt6jJzZ", "senderPublicKey": "FhgqfReoyDTTzZduUhRcu2zPSYKtic6Xm52hj4u5xBph", "proofs": [ "4ZhDtsvUpdXngCtnQfzu1PW8pHAWQvj6ETizzH28VwUM761qMrE9n3tx6xUakKuBjLtfyWk7W3sTgN2nmtDPp1MB" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAVvd25lcgEAAAAaAVRvovpmYkDANGhlfPK4RjDdGie4wHkyEG4AAAAADWFzc2V0SWRUb2tlbkEBAAAAIKwWrtdRiKI+Ovl92r0/qi8cccF3dXxVwbqzeRWWBRdtAAAAAA1hc3NldElkVG9rZW5CAQAAACDqSdGhrjcs3i8YIkgOtSbBR1rzRHscUKOx/2v/wIXFhQAAAAAJY29taXNzaW9uAAAAAAAAAAAKAAAABAAAAApjb250ZXh0T2JqAQAAAARmdW5kAAAAAAQAAAAHcGF5bWVudAQAAAAHJG1hdGNoMAgFAAAACmNvbnRleHRPYmoAAAAHcGF5bWVudAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPQXR0YWNoZWRQYXltZW50BAAAAAFwBQAAAAckbWF0Y2gwBQAAAAFwCQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkBAAAAA9hc3NldElkUmVjZWl2ZWQIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQEAAAAEnRva2VuUmVjZWl2ZUFtb3VudAgFAAAAB3BheW1lbnQAAAAGYW1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AACURhdGFFbnRyeQAAAAICAAAADGFtb3VudFRva2VuQQIAAAAJd2l0aGRyYXduCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAxhbW91bnRUb2tlbkICAAAACXdpdGhkcmF3bgkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAGc3RhdHVzBwUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAANQmFsYW5jZVRva2VuQQUAAAANYXNzZXRJZFRva2VuQQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIFAAAADUJhbGFuY2VUb2tlbkIFAAAADWFzc2V0SWRUb2tlbkIFAAAAA25pbAkAAAIAAAABAgAAAB1Zb3UgYXJlIG5vdCBleGNoYW5nZXIncyBvd25lcgAAAAEAAAAKY29udGV4dE9iagEAAAAGdmVyaWZ5AAAAAAb7v6tE", "chainId": 84, "height": 658373, "spentComplexity": 0 } View: original | compacted Prev: ExdgtybjF46xQh5SythpmJTUkZ38a1W4KoTU7Uitcn8j Next: none Diff:
OldNewDifferences
5858 else false)
5959 then {
6060 let amountTokenB = getIntegerValue(this, "amountTokenB")
61- WriteSet([DataEntry("amountTokenA", (amountTokenB + tokenReceiveAmount))])
61+ WriteSet([DataEntry("amountTokenB", (amountTokenB + tokenReceiveAmount))])
6262 }
6363 else throw("there was an error in the replenishment")
6464 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let owner = base58'3Mz6N28dUJUcjCPJL9VeWUSCa1BwSt6jJzZ'
55
66 let assetIdTokenA = base58'CamBjBD1kfhVrYtmqEi6aCEEgYxjhwePLNvA2Kk87wRe'
77
88 let assetIdTokenB = base58'GmZgrH2Aya5CjScjYQLG4GtVPHqpJQAr6yaNooWWcxbn'
99
1010 let comission = 10
1111
1212 @Callable(contextObj)
1313 func fund () = {
1414 let payment = match contextObj.payment {
1515 case p: AttachedPayment =>
1616 p
1717 case _ =>
1818 throw("Payment not attached")
1919 }
2020 let assetIdReceived = payment.assetId
2121 let tokenReceiveAmount = payment.amount
2222 if (if ((assetIdReceived == assetIdTokenA))
2323 then !(isDefined(getBoolean(this, "fundA")))
2424 else false)
2525 then if (isDefined(getBoolean(this, "fundB")))
2626 then WriteSet([DataEntry("amountTokenA", tokenReceiveAmount), DataEntry("fundA", true), DataEntry("assetIdTokenA", extract(payment.assetId)), DataEntry("status", true)])
2727 else WriteSet([DataEntry("amountTokenA", tokenReceiveAmount), DataEntry("fundA", true), DataEntry("fundA", true), DataEntry("assetIdTokenA", extract(payment.assetId))])
2828 else if (if ((assetIdReceived == assetIdTokenB))
2929 then !(isDefined(getBoolean(this, "fundB")))
3030 else false)
3131 then if (isDefined(getBoolean(this, "fundA")))
3232 then WriteSet([DataEntry("amountTokenB", tokenReceiveAmount), DataEntry("fundB", true), DataEntry("assetIdTokenB", extract(payment.assetId)), DataEntry("status", true)])
3333 else WriteSet([DataEntry("amountTokenB", tokenReceiveAmount), DataEntry("fundB", true), DataEntry("assetIdTokenB", extract(payment.assetId))])
3434 else throw("already funded or you try to fund with incorrect asset")
3535 }
3636
3737
3838
3939 @Callable(contextObj)
4040 func replenishment () = {
4141 let payment = match contextObj.payment {
4242 case p: AttachedPayment =>
4343 p
4444 case _ =>
4545 throw("Payment not attached")
4646 }
4747 let assetIdReceived = payment.assetId
4848 let tokenReceiveAmount = payment.amount
4949 if (if ((assetIdReceived == assetIdTokenA))
5050 then isDefined(getBoolean(this, "fundA"))
5151 else false)
5252 then {
5353 let amountTokenA = getIntegerValue(this, "amountTokenA")
5454 WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount))])
5555 }
5656 else if (if ((assetIdReceived == assetIdTokenB))
5757 then isDefined(getBoolean(this, "fundB"))
5858 else false)
5959 then {
6060 let amountTokenB = getIntegerValue(this, "amountTokenB")
61- WriteSet([DataEntry("amountTokenA", (amountTokenB + tokenReceiveAmount))])
61+ WriteSet([DataEntry("amountTokenB", (amountTokenB + tokenReceiveAmount))])
6262 }
6363 else throw("there was an error in the replenishment")
6464 }
6565
6666
6767
6868 @Callable(contextObj)
6969 func exchanger (minTokenRecieve) = if (if ((0 > comission))
7070 then true
7171 else (comission > 100))
7272 then throw("incorrect comission value")
7373 else {
7474 let amountTokenB = getIntegerValue(this, "amountTokenB")
7575 let amountTokenA = getIntegerValue(this, "amountTokenA")
7676 let payment = match contextObj.payment {
7777 case p: AttachedPayment =>
7878 p
7979 case _ =>
8080 throw("Payment not attached")
8181 }
8282 let assetIdReceived = payment.assetId
8383 let tokenReceiveAmount = payment.amount
8484 let count = match getInteger(this, "exchange_count") {
8585 case i: Int =>
8686 value(getInteger(this, "exchange_count"))
8787 case _ =>
8888 0
8989 }
9090 if ((assetIdReceived == assetIdTokenB))
9191 then {
9292 let tokenSendAmount = ((fraction(amountTokenA, tokenReceiveAmount, (tokenReceiveAmount + amountTokenB)) * (100 - comission)) / 100)
9393 if ((minTokenRecieve > tokenSendAmount))
9494 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
9595 else {
9696 let assetIdSent = assetIdTokenA
9797 ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA - tokenSendAmount)), DataEntry("amountTokenB", (amountTokenB + tokenReceiveAmount)), DataEntry("exchange_count", (count + 1))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
9898 }
9999 }
100100 else if ((assetIdReceived == assetIdTokenA))
101101 then {
102102 let tokenSendAmount = ((fraction(amountTokenB, tokenReceiveAmount, (tokenReceiveAmount + amountTokenA)) * (100 - comission)) / 100)
103103 if ((minTokenRecieve > tokenSendAmount))
104104 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
105105 else {
106106 let assetIdSent = assetIdTokenB
107107 ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), DataEntry("amountTokenB", (amountTokenB - tokenSendAmount)), DataEntry("exchange_count", (count + 1))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
108108 }
109109 }
110110 else throw("Asset is not allowed")
111111 }
112112
113113
114114
115115 @Callable(contextObj)
116116 func withdraw () = {
117117 let BalanceTokenA = assetBalance(this, assetIdTokenA)
118118 let BalanceTokenB = assetBalance(this, assetIdTokenB)
119119 if ((contextObj.caller.bytes == owner))
120120 then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn"), DataEntry("status", false)]), TransferSet([ScriptTransfer(contextObj.caller, BalanceTokenA, assetIdTokenA), ScriptTransfer(contextObj.caller, BalanceTokenB, assetIdTokenB)]))
121121 else throw("You are not exchanger's owner")
122122 }
123123
124124
125125 @Verifier(contextObj)
126126 func verify () = true
127127

github/deemru/w8io/026f985 
42.91 ms