tx · HraXwejLNZ8rb91AYbHUNJY5JeQX7xj7Ym4V6pYYWLhU

3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV:  -0.01500000 Waves

2019.08.30 15:36 [653993] smart account 3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV > SELF 0.00000000 Waves

{ "type": 13, "id": "HraXwejLNZ8rb91AYbHUNJY5JeQX7xj7Ym4V6pYYWLhU", "fee": 1500000, "feeAssetId": null, "timestamp": 1567168645830, "version": 1, "sender": "3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV", "senderPublicKey": "854p8BYzrj6yBPRPmfQur3oF1Rjc1AJ548qRp5FT5kDa", "proofs": [ "3fE2C7MwV1dDyRZVP7SmrTjduBvJxF5LxapYmQTyurPkdfGCTXkBHphtGgbdUEpHDCC469u1CMA2bXKHUC5qsi1y" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAVvd25lcgEAAAAaAVRFbm0V+EOCq2NTOJsSE2133z0GcAjjvP8AAAAADWFzc2V0SWRUb2tlbkEBAAAAIEMzbeDGHf4oU+zuHGjXevUoBPuFN8LOz9CQD8ug/yo1AAAAAA1hc3NldElkVG9rZW5CAQAAACCqoUHYIr+9N/tCdWkhfZ3SevjX3HPTosOWNfoRj9syOgAAAAAJY29taXNzaW9uAAAAAAAAAAAKAAAABAAAAApjb250ZXh0T2JqAQAAAARmdW5kAAAAAAQAAAAHcGF5bWVudAQAAAAHJG1hdGNoMAgFAAAACmNvbnRleHRPYmoAAAAHcGF5bWVudAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPQXR0YWNoZWRQYXltZW50BAAAAAFwBQAAAAckbWF0Y2gwBQAAAAFwCQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkBAAAAA9hc3NldElkUmVjZWl2ZWQIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQEAAAAEnRva2VuUmVjZWl2ZUFtb3VudAgFAAAAB3BheW1lbnQA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IAAAABAAAACmNvbnRleHRPYmoBAAAABnZlcmlmeQAAAAAGBU4eJg==", "chainId": 84, "height": 653993, "spentComplexity": 0 } View: original | compacted Prev: CsMpHDBrNZq1x2H2yXSSYXkH7H2oLVB6VyyZrdSk5xkV Next: 7N4UBN22zGYXZFsWzXE3XLQyiJayH2jtZk79tcBCM2YU Diff:
OldNewDifferences
1919 }
2020 let assetIdReceived = payment.assetId
2121 let tokenReceiveAmount = payment.amount
22- if (!(isDefined(getBoolean(this, "fundA"))))
22+ if ((assetIdReceived == unit))
2323 then WriteSet([DataEntry("amountTokenA", tokenReceiveAmount), DataEntry("fundA", true)])
2424 else if (if ((assetIdReceived == assetIdTokenB))
2525 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 (!(isDefined(getBoolean(this, "fundA"))))
22+ if ((assetIdReceived == unit))
2323 then WriteSet([DataEntry("amountTokenA", tokenReceiveAmount), DataEntry("fundA", true)])
2424 else if (if ((assetIdReceived == assetIdTokenB))
2525 then !(isDefined(getBoolean(this, "fundB")))
2626 else false)
2727 then WriteSet([DataEntry("amountTokenB", tokenReceiveAmount), DataEntry("fundB", true)])
2828 else throw("already funded or you try to fund with incorrect asset")
2929 }
3030
3131
3232
3333 @Callable(contextObj)
3434 func replenishment () = {
3535 let payment = match contextObj.payment {
3636 case p: AttachedPayment =>
3737 p
3838 case _ =>
3939 throw("Payment not attached")
4040 }
4141 let assetIdReceived = payment.assetId
4242 let tokenReceiveAmount = payment.amount
4343 if (if ((assetIdReceived == assetIdTokenA))
4444 then !(isDefined(getBoolean(this, "fundA")))
4545 else false)
4646 then {
4747 let amountTokenA = getIntegerValue(this, "amountTokenA")
4848 WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount))])
4949 }
5050 else if (if ((assetIdReceived == assetIdTokenB))
5151 then isDefined(getBoolean(this, "fundB"))
5252 else false)
5353 then {
5454 let amountTokenB = getIntegerValue(this, "amountTokenB")
5555 WriteSet([DataEntry("amountTokenA", (amountTokenB + tokenReceiveAmount))])
5656 }
5757 else throw("there was an error in the replenishment")
5858 }
5959
6060
6161
6262 @Callable(contextObj)
6363 func exchanger (minTokenRecieve) = if (if ((0 > comission))
6464 then true
6565 else (comission > 100))
6666 then throw("incorrect comission value")
6767 else {
6868 let amountTokenB = getIntegerValue(this, "amountTokenB")
6969 let amountTokenA = getIntegerValue(this, "amountTokenA")
7070 let payment = match contextObj.payment {
7171 case p: AttachedPayment =>
7272 p
7373 case _ =>
7474 throw("Payment not attached")
7575 }
7676 let assetIdReceived = payment.assetId
7777 let tokenReceiveAmount = payment.amount
7878 if ((assetIdReceived == assetIdTokenB))
7979 then {
8080 let tokenSendAmount = ((fraction(amountTokenA, tokenReceiveAmount, (tokenReceiveAmount + amountTokenB)) * (100 - comission)) / 100)
8181 if ((minTokenRecieve > tokenSendAmount))
8282 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
8383 else {
8484 let assetIdSent = assetIdTokenA
8585 ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA - tokenSendAmount)), DataEntry("amountTokenB", (amountTokenB + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
8686 }
8787 }
8888 else if ((assetIdReceived == assetIdTokenA))
8989 then {
9090 let tokenSendAmount = ((fraction(amountTokenB, tokenReceiveAmount, (tokenReceiveAmount + amountTokenA)) * (100 - comission)) / 100)
9191 if ((minTokenRecieve > tokenSendAmount))
9292 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
9393 else {
9494 let assetIdSent = assetIdTokenB
9595 ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), DataEntry("amountTokenB", (amountTokenB - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
9696 }
9797 }
9898 else throw("Asset is not allowed")
9999 }
100100
101101
102102
103103 @Callable(contextObj)
104104 func withdraw () = {
105105 let BalanceTokenA = assetBalance(this, assetIdTokenA)
106106 let BalanceTokenB = assetBalance(this, assetIdTokenB)
107107 if ((contextObj.caller.bytes == owner))
108108 then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn")]), TransferSet([ScriptTransfer(contextObj.caller, BalanceTokenA, assetIdTokenA), ScriptTransfer(contextObj.caller, BalanceTokenB, assetIdTokenB)]))
109109 else throw("You are not exchanger's owner")
110110 }
111111
112112
113113 @Verifier(contextObj)
114114 func verify () = true
115115

github/deemru/w8io/026f985 
27.08 ms