tx · zezEHDwmpzyKW9gVydaN4C72UgHEYbAPR8JrPzr8FYj

3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV:  -0.01400000 Waves

2019.08.30 15:22 [653976] smart account 3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
29.14 ms