tx · B2LgimrneTiKrC1WT4AMSUmwMwu1H85FWJh5PNA5SeLi

3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL:  -0.01400000 Waves

2019.08.27 18:42 [649802] smart account 3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL > SELF 0.00000000 Waves

{ "type": 13, "id": "B2LgimrneTiKrC1WT4AMSUmwMwu1H85FWJh5PNA5SeLi", "fee": 1400000, "feeAssetId": null, "timestamp": 1566920609672, "version": 1, "sender": "3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL", "senderPublicKey": "3RTmBp69DqXiohzMXcmVU1pMFssmztWoibFARiKrgTr7", "proofs": [ "2iyT4LViRX2v1iHi9a22nnvepD8GfczwYbs2PLrX2u3dpetgQ677xKc72wGMfh9JSruSuodfaCAyjAp1C8jfpajo" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAVvd25lcgEAAAAaAVSTOHBLt7RyJdugRiL5k8zovFc+bobXqh8AAAAADWFzc2V0SWRUb2tlbkEBAAAAIHtxzCCjiO5MvMQa1Azqp+Y2rXgVKpJSDL3j5MzZkFIFAAAAAA1hc3NldElkVG9rZW5CBQAAAAR1bml0AAAAAAljb21pc3Npb24AAAAAAAAAAAAAAAAEAAAACmNvbnRleHRPYmoBAAAABGZ1bmQAAAAABAAAAAdwYXltZW50BAAAAAckbWF0Y2gwCAUAAAAKY29udGV4dE9iagAAAAdwYXltZW50AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9BdHRhY2hlZFBheW1lbnQEAAAAAXAFAAAAByRtYXRjaDAFAAAAAXAJAAACAAAAAQIAAAAUUGF5bWVudCBub3QgYXR0YWNoZWQEAAAAD2Fzc2V0SWRSZWNlaXZlZAgFAAAAB3BheW1lbnQAAAAHYXNzZXRJZAQAAAASdG9rZW5SZWNlaXZlQW1vdW50CAUAAAAHcGF5bWVudAAAAAZhbW91bnQDAwkAAAAAAAACBQAAAA9hc3NldElkUmVjZWl2ZWQFAAA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bkIFAAAADWFzc2V0SWRUb2tlbkIFAAAAA25pbAkAAAIAAAABAgAAAB1Zb3UgYXJlIG5vdCBleGNoYW5nZXIncyBvd25lcgAAAAEAAAAKY29udGV4dE9iagEAAAAGdmVyaWZ5AAAAAAZ9tcw/", "chainId": 84, "height": 649802, "spentComplexity": 0 } View: original | compacted Prev: 3mbQpL9V1L9bRAkhiood43XYiLcUrQKt5bHjxRxs58bh Next: FmsDfs1hYF2fWkm8zAS6V76dWckPnxihtotDVrUSRtjS Diff:
OldNewDifferences
2828 else false)
2929 then WriteSet([DataEntry("amountTokenB", tokenReceiveAmount), DataEntry("fundB", "funded")])
3030 else throw("already funded or you try to fund with incorrect asset")
31+ }
32+
33+
34+
35+@Callable(contextObj)
36+func replenishment () = {
37+ let payment = match contextObj.payment {
38+ case p: AttachedPayment =>
39+ p
40+ case _ =>
41+ throw("Payment not attached")
42+ }
43+ let assetIdReceived = payment.assetId
44+ let tokenReceiveAmount = payment.amount
45+ if (if ((assetIdReceived == assetIdTokenA))
46+ then !(isDefined(getString(this, "fundA")))
47+ else false)
48+ then {
49+ let amountTokenA = getIntegerValue(this, "amountTokenA")
50+ WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount))])
51+ }
52+ else if (if ((assetIdReceived == assetIdTokenB))
53+ then !(isDefined(getString(this, "fundB")))
54+ else false)
55+ then {
56+ let amountTokenB = getIntegerValue(this, "amountTokenB")
57+ WriteSet([DataEntry("amountTokenA", (amountTokenB + tokenReceiveAmount))])
58+ }
59+ else throw("there was an error in the replenishment")
3160 }
3261
3362
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let owner = base58'3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL'
55
66 let assetIdTokenA = base58'9Jsnot7RWQmTsfXtezQN7igoS2q1QF1jsotaxwh8Fxp4'
77
88 let assetIdTokenB = unit
99
1010 let comission = 0
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(getString(this, "fundA")))
2424 else false)
2525 then WriteSet([DataEntry("amountTokenA", tokenReceiveAmount), DataEntry("fundA", "funded")])
2626 else if (if ((assetIdReceived == assetIdTokenB))
2727 then !(isDefined(getString(this, "fundB")))
2828 else false)
2929 then WriteSet([DataEntry("amountTokenB", tokenReceiveAmount), DataEntry("fundB", "funded")])
3030 else throw("already funded or you try to fund with incorrect asset")
31+ }
32+
33+
34+
35+@Callable(contextObj)
36+func replenishment () = {
37+ let payment = match contextObj.payment {
38+ case p: AttachedPayment =>
39+ p
40+ case _ =>
41+ throw("Payment not attached")
42+ }
43+ let assetIdReceived = payment.assetId
44+ let tokenReceiveAmount = payment.amount
45+ if (if ((assetIdReceived == assetIdTokenA))
46+ then !(isDefined(getString(this, "fundA")))
47+ else false)
48+ then {
49+ let amountTokenA = getIntegerValue(this, "amountTokenA")
50+ WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount))])
51+ }
52+ else if (if ((assetIdReceived == assetIdTokenB))
53+ then !(isDefined(getString(this, "fundB")))
54+ else false)
55+ then {
56+ let amountTokenB = getIntegerValue(this, "amountTokenB")
57+ WriteSet([DataEntry("amountTokenA", (amountTokenB + tokenReceiveAmount))])
58+ }
59+ else throw("there was an error in the replenishment")
3160 }
3261
3362
3463
3564 @Callable(contextObj)
3665 func exchanger (minTokenRecieve) = if (if ((0 > comission))
3766 then true
3867 else (comission > 100))
3968 then throw("incorrect comission value")
4069 else {
4170 let amountTokenB = getIntegerValue(this, "amountTokenB")
4271 let amountTokenA = getIntegerValue(this, "amountTokenA")
4372 let payment = match contextObj.payment {
4473 case p: AttachedPayment =>
4574 p
4675 case _ =>
4776 throw("Payment not attached")
4877 }
4978 let assetIdReceived = payment.assetId
5079 let tokenReceiveAmount = payment.amount
5180 if ((assetIdReceived == assetIdTokenB))
5281 then {
5382 let tokenSendAmount = ((fraction(amountTokenA, tokenReceiveAmount, (tokenReceiveAmount + amountTokenB)) * (100 - comission)) / 100)
5483 if ((minTokenRecieve > tokenSendAmount))
5584 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
5685 else {
5786 let assetIdSent = assetIdTokenA
5887 ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA - tokenSendAmount)), DataEntry("amountTokenB", (amountTokenB + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
5988 }
6089 }
6190 else if ((assetIdReceived == assetIdTokenA))
6291 then {
6392 let tokenSendAmount = ((fraction(amountTokenB, tokenReceiveAmount, (tokenReceiveAmount + amountTokenA)) * (100 - comission)) / 100)
6493 if ((minTokenRecieve > tokenSendAmount))
6594 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
6695 else {
6796 let assetIdSent = assetIdTokenB
6897 ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), DataEntry("amountTokenB", (amountTokenB - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
6998 }
7099 }
71100 else throw("Asset is not allowed")
72101 }
73102
74103
75104
76105 @Callable(contextObj)
77106 func withdraw () = {
78107 let BalanceTokenA = assetBalance(this, assetIdTokenA)
79108 let BalanceTokenB = assetBalance(this, assetIdTokenB)
80109 if ((contextObj.caller.bytes == owner))
81110 then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn")]), TransferSet([ScriptTransfer(contextObj.caller, BalanceTokenA, assetIdTokenA), ScriptTransfer(contextObj.caller, BalanceTokenB, assetIdTokenB)]))
82111 else throw("You are not exchanger's owner")
83112 }
84113
85114
86115 @Verifier(contextObj)
87116 func verify () = true
88117

github/deemru/w8io/026f985 
42.15 ms