tx · AVBYZBJMgSBP2c76u6KNriv8mqnSGsQFeE36Jy5qojbq

3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF:  -0.01400000 Waves

2020.03.11 22:49 [904928] smart account 3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF > SELF 0.00000000 Waves

{ "type": 13, "id": "AVBYZBJMgSBP2c76u6KNriv8mqnSGsQFeE36Jy5qojbq", "fee": 1400000, "feeAssetId": null, "timestamp": 1583956145578, "version": 1, "sender": "3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF", "senderPublicKey": "9v3cUhWaBqFKLuHQTbz2osNsxRANDcpaRZja43mFNkR3", "proofs": [ "2XYbR7mFCgRDCea1QXeNEJm1WVkr5ZcQSKLCCZ1oJvcg8A5Gmnd5RnuLXNHLj19qTxhdRYRQCHDhVDX5qfM2gXJ" ], "script": "base64:AAIDAAAAAAAAAA0IARIAEgASABIDCgEBAAAABQAAAAAGRVVDb2luAQAAACDJofoUphCC2vgdQrn0R0tQm4QOreBLRVolNScltI/WUQAAAAAGVVNDb2luAQAAACCWpimiLpI8FZFaHXIW3ZwI74bEgcPecoAv5ODcRcQ7/QAAAAAOb3duZXJQdWJsaWNLZXkBAAAAIIR0OzhzTJc1ozXjp3CfISpQxO2vbrCrTGSiFABFRe8mAAAAAA1PcmFjbGVBZGRyZXNzCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAIzNOQWNvZVdkVVRXbjhjc1hKUEc0N3YxRmp0amNmcXhiNXR1AQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAADU9yYWNsZUFkZHJlc3MFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAAAABAAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10CQEAAAAHZXh0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AAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA5vd25lclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgf9DKog", "chainId": 84, "height": 904928, "spentComplexity": 0 } View: original | compacted Prev: GFf3SRaMSzZbgvHeTgWQc3eiTy78WnhDvuzqtRGd5wn6 Next: none Diff:
OldNewDifferences
7070 case _ =>
7171 0
7272 }
73- let rate = getNumberByKey("waves_usd_2")
7473 let trasferAmount = (pmt.amount / 100)
7574 let newAmount = (currentAmount - trasferAmount)
7675 if ((0 > pmt.amount))
9998 0
10099 }
101100 let rate = getNumberByKey("waves_usd_2")
102- let trasferAmount = pmt.amount
103- let newAmount = (currentAmount - trasferAmount)
104- if ((0 > pmt.amount))
105- then throw("Can't withdraw negative amount")
106- else if ((0 > newAmount))
107- then throw("Not enough Waves Deposited")
108- else ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, unit)]))
101+ if ((rate == 0))
102+ then throw("rate 0")
103+ else {
104+ let trasferAmount = ((pmt.amount / rate) * 100)
105+ let newAmount = (currentAmount - trasferAmount)
106+ if ((0 > pmt.amount))
107+ then throw("Can't withdraw negative amount")
108+ else if ((0 > newAmount))
109+ then throw("Not enough Waves Deposited")
110+ else ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, unit)]))
111+ }
109112 }
110113 else throw("You Can Withdraw with EUCoin only")
111114 else throw("You Can Withdraw with EUCoin only")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let EUCoin = base58'Ea6CdDfumo8ZFecxUSWKAjZpQXmkRC79WB4ktu3KffPn'
55
66 let USCoin = base58'B957NA5BEM8quCDhe1fUPkqBSdCZdJunNxjGE8FRJkWx'
77
88 let ownerPublicKey = base58'9v3cUhWaBqFKLuHQTbz2osNsxRANDcpaRZja43mFNkR3'
99
1010 let OracleAddress = addressFromStringValue("3NAcoeWdUTWn8csXJPG47v1Fjtjcfqxb5tu")
1111
1212 func getNumberByKey (key) = match getInteger(OracleAddress, key) {
1313 case a: Int =>
1414 a
1515 case _ =>
1616 0
1717 }
1818
1919
2020 @Callable(i)
2121 func deposit () = {
2222 let pmt = extract(i.payment)
2323 if (isDefined(pmt.assetId))
2424 then if ((pmt.assetId == USCoin))
2525 then {
2626 let currentKey = toBase58String(i.caller.bytes)
2727 let currentAmount = match getInteger(this, (currentKey + "_uscoin")) {
2828 case a: Int =>
2929 a
3030 case _ =>
3131 0
3232 }
3333 let rate = getNumberByKey("waves_usd_2")
3434 let trasferAmount = (pmt.amount * 100)
3535 let newAmount = (currentAmount + pmt.amount)
3636 ScriptResult(WriteSet([DataEntry((currentKey + "_uscoin"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, EUCoin)]))
3737 }
3838 else throw("can hodl USCoin only at the moment")
3939 else {
4040 let currentKey = toBase58String(i.caller.bytes)
4141 let currentAmount = match getInteger(this, (currentKey + "_waves")) {
4242 case a: Int =>
4343 a
4444 case _ =>
4545 0
4646 }
4747 let rate = getNumberByKey("waves_usd_2")
4848 if ((rate == 0))
4949 then throw("rate 0")
5050 else {
5151 let trasferAmount = ((pmt.amount * rate) / 100)
5252 let newAmount = (currentAmount + pmt.amount)
5353 ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, EUCoin)]))
5454 }
5555 }
5656 }
5757
5858
5959
6060 @Callable(i)
6161 func withdrawUSCoin () = {
6262 let pmt = extract(i.payment)
6363 if (isDefined(pmt.assetId))
6464 then if ((pmt.assetId == EUCoin))
6565 then {
6666 let currentKey = toBase58String(i.caller.bytes)
6767 let currentAmount = match getInteger(this, (currentKey + "_uscoin")) {
6868 case a: Int =>
6969 a
7070 case _ =>
7171 0
7272 }
73- let rate = getNumberByKey("waves_usd_2")
7473 let trasferAmount = (pmt.amount / 100)
7574 let newAmount = (currentAmount - trasferAmount)
7675 if ((0 > pmt.amount))
7776 then throw("Can't withdraw negative amount")
7877 else if ((0 > newAmount))
7978 then throw("Not enough USCoin Deposited")
8079 else ScriptResult(WriteSet([DataEntry((currentKey + "_uscoin"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, USCoin)]))
8180 }
8281 else throw("You Can Withdraw with EUCoin only")
8382 else throw("You Can Withdraw with EUCoin only")
8483 }
8584
8685
8786
8887 @Callable(i)
8988 func withdrawWaves () = {
9089 let pmt = extract(i.payment)
9190 if (isDefined(pmt.assetId))
9291 then if ((pmt.assetId == EUCoin))
9392 then {
9493 let currentKey = toBase58String(i.caller.bytes)
9594 let currentAmount = match getInteger(this, (currentKey + "_waves")) {
9695 case a: Int =>
9796 a
9897 case _ =>
9998 0
10099 }
101100 let rate = getNumberByKey("waves_usd_2")
102- let trasferAmount = pmt.amount
103- let newAmount = (currentAmount - trasferAmount)
104- if ((0 > pmt.amount))
105- then throw("Can't withdraw negative amount")
106- else if ((0 > newAmount))
107- then throw("Not enough Waves Deposited")
108- else ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, unit)]))
101+ if ((rate == 0))
102+ then throw("rate 0")
103+ else {
104+ let trasferAmount = ((pmt.amount / rate) * 100)
105+ let newAmount = (currentAmount - trasferAmount)
106+ if ((0 > pmt.amount))
107+ then throw("Can't withdraw negative amount")
108+ else if ((0 > newAmount))
109+ then throw("Not enough Waves Deposited")
110+ else ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, unit)]))
111+ }
109112 }
110113 else throw("You Can Withdraw with EUCoin only")
111114 else throw("You Can Withdraw with EUCoin only")
112115 }
113116
114117
115118
116119 @Callable(i)
117120 func getFaucet (amount) = {
118121 let currentKey = toBase58String(i.caller.bytes)
119122 let currentAmount = match getInteger(this, (currentKey + "_faucet")) {
120123 case a: Int =>
121124 a
122125 case _ =>
123126 0
124127 }
125128 if ((0 > amount))
126129 then throw("Can't withdraw negative amount")
127130 else if ((currentAmount > 0))
128131 then throw("Faucet already taken")
129132 else ScriptResult(WriteSet([DataEntry((currentKey + "_faucet"), amount)]), TransferSet([ScriptTransfer(i.caller, amount, EUCoin)]))
130133 }
131134
132135
133136 @Verifier(tx)
134137 func verify () = match tx {
135138 case d: SetScriptTransaction =>
136139 sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey)
137140 case d: DataTransaction =>
138141 true
139142 case _ =>
140143 false
141144 }
142145

github/deemru/w8io/169f3d6 
25.14 ms