tx · 9ns78H1h3uZ9rdJd1AJbnoGEANuwT1uZ26Jq1tiA9yYm

3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV:  -0.01400000 Waves

2019.08.30 16:08 [654026] smart account 3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV > SELF 0.00000000 Waves

{ "type": 13, "id": "9ns78H1h3uZ9rdJd1AJbnoGEANuwT1uZ26Jq1tiA9yYm", "fee": 1400000, "feeAssetId": null, "timestamp": 1567170467078, "version": 1, "sender": "3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV", "senderPublicKey": "854p8BYzrj6yBPRPmfQur3oF1Rjc1AJ548qRp5FT5kDa", "proofs": [ "3a1gWRvwcf8pKPX9DGDgeDu27TsiJcMvXxNZjdDx31mvBP6k1fNmETv5xvMQi6DwbpgUmAgpjRRko4NjD56hS5wm" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAVvd25lcgEAAAAaAVRFbm0V+EOCq2NTOJsSE2133z0GcAjjvP8AAAAADWFzc2V0SWRUb2tlbkEBAAAAIEMzbeDGHf4oU+zuHGjXevUoBPuFN8LOz9CQD8ug/yo1AAAAAA1hc3NldElkVG9rZW5CAQAAACCqoUHYIr+9N/tCdWkhfZ3SevjX3HPTosOWNfoRj9syOgAAAAAJY29taXNzaW9uAAAAAAAAAAAKAAAABAAAAApjb250ZXh0T2JqAQAAAARmdW5kAAAAAAQAAAAHcGF5bWVudAQAAAAHJG1hdGNoMAgFAAAACmNvbnRleHRPYmoAAAAHcGF5bWVudAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPQXR0YWNoZWRQYXltZW50BAAAAAFwBQAAAAckbWF0Y2gwBQAAAAFwCQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkBAAAAA9hc3NldElkUmVjZWl2ZWQIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQEAAAAEnRva2VuUmVjZWl2ZUFtb3VudAgFAAAAB3BheW1l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AAQAAAApjb250ZXh0T2JqAQAAAAZ2ZXJpZnkAAAAABm1XTIM=", "chainId": 84, "height": 654026, "spentComplexity": 0 } View: original | compacted Prev: 7N4UBN22zGYXZFsWzXE3XLQyiJayH2jtZk79tcBCM2YU Next: 89GMYyqTFG1YxNE81JHxnRb9KEb53Niv6P4srhuA8Lm8 Diff:
OldNewDifferences
1919 }
2020 let assetIdReceived = payment.assetId
2121 let tokenReceiveAmount = payment.amount
22- if (if ((assetIdReceived == assetIdTokenA))
23- then !(isDefined(getBoolean(this, "fundA")))
24- else false)
22+ if ((assetIdReceived == assetIdTokenA))
2523 then WriteSet([DataEntry("amountTokenA", tokenReceiveAmount), DataEntry("fundA", true)])
2624 else if (if ((assetIdReceived == assetIdTokenB))
2725 then !(isDefined(getBoolean(this, "fundB")))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let owner = base58'3MvFCghS4jJ7E5QuJfKa4LwCoHJiAcsDQrA'
55
66 let assetIdTokenA = base58'5XKoQDZphxtgtXxm36qhXrYo1F6mRLa9M8QHUDPWQ4mi'
77
88 let assetIdTokenB = base58'CV4vfjkevn3aJ4tKaMn9gPHugYztu6RhDw2ete34SxiV'
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
22- if (if ((assetIdReceived == assetIdTokenA))
23- then !(isDefined(getBoolean(this, "fundA")))
24- else false)
22+ if ((assetIdReceived == assetIdTokenA))
2523 then WriteSet([DataEntry("amountTokenA", tokenReceiveAmount), DataEntry("fundA", true)])
2624 else if (if ((assetIdReceived == assetIdTokenB))
2725 then !(isDefined(getBoolean(this, "fundB")))
2826 else false)
2927 then WriteSet([DataEntry("amountTokenB", tokenReceiveAmount), DataEntry("fundB", true)])
3028 else throw("already funded or you try to fund with incorrect asset")
3129 }
3230
3331
3432
3533 @Callable(contextObj)
3634 func replenishment () = {
3735 let payment = match contextObj.payment {
3836 case p: AttachedPayment =>
3937 p
4038 case _ =>
4139 throw("Payment not attached")
4240 }
4341 let assetIdReceived = payment.assetId
4442 let tokenReceiveAmount = payment.amount
4543 if (if ((assetIdReceived == assetIdTokenA))
4644 then isDefined(getBoolean(this, "fundA"))
4745 else false)
4846 then {
4947 let amountTokenA = getIntegerValue(this, "amountTokenA")
5048 WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount))])
5149 }
5250 else if (if ((assetIdReceived == assetIdTokenB))
5351 then isDefined(getBoolean(this, "fundB"))
5452 else false)
5553 then {
5654 let amountTokenB = getIntegerValue(this, "amountTokenB")
5755 WriteSet([DataEntry("amountTokenA", (amountTokenB + tokenReceiveAmount))])
5856 }
5957 else throw("there was an error in the replenishment")
6058 }
6159
6260
6361
6462 @Callable(contextObj)
6563 func exchanger (minTokenRecieve) = if (if ((0 > comission))
6664 then true
6765 else (comission > 100))
6866 then throw("incorrect comission value")
6967 else {
7068 let amountTokenB = getIntegerValue(this, "amountTokenB")
7169 let amountTokenA = getIntegerValue(this, "amountTokenA")
7270 let payment = match contextObj.payment {
7371 case p: AttachedPayment =>
7472 p
7573 case _ =>
7674 throw("Payment not attached")
7775 }
7876 let assetIdReceived = payment.assetId
7977 let tokenReceiveAmount = payment.amount
8078 if ((assetIdReceived == assetIdTokenB))
8179 then {
8280 let tokenSendAmount = ((fraction(amountTokenA, tokenReceiveAmount, (tokenReceiveAmount + amountTokenB)) * (100 - comission)) / 100)
8381 if ((minTokenRecieve > tokenSendAmount))
8482 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
8583 else {
8684 let assetIdSent = assetIdTokenA
8785 ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA - tokenSendAmount)), DataEntry("amountTokenB", (amountTokenB + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
8886 }
8987 }
9088 else if ((assetIdReceived == assetIdTokenA))
9189 then {
9290 let tokenSendAmount = ((fraction(amountTokenB, tokenReceiveAmount, (tokenReceiveAmount + amountTokenA)) * (100 - comission)) / 100)
9391 if ((minTokenRecieve > tokenSendAmount))
9492 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
9593 else {
9694 let assetIdSent = assetIdTokenB
9795 ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), DataEntry("amountTokenB", (amountTokenB - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
9896 }
9997 }
10098 else throw("Asset is not allowed")
10199 }
102100
103101
104102
105103 @Callable(contextObj)
106104 func withdraw () = {
107105 let BalanceTokenA = assetBalance(this, assetIdTokenA)
108106 let BalanceTokenB = assetBalance(this, assetIdTokenB)
109107 if ((contextObj.caller.bytes == owner))
110108 then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn")]), TransferSet([ScriptTransfer(contextObj.caller, BalanceTokenA, assetIdTokenA), ScriptTransfer(contextObj.caller, BalanceTokenB, assetIdTokenB)]))
111109 else throw("You are not exchanger's owner")
112110 }
113111
114112
115113 @Verifier(contextObj)
116114 func verify () = true
117115

github/deemru/w8io/026f985 
51.58 ms