tx · GFf3SRaMSzZbgvHeTgWQc3eiTy78WnhDvuzqtRGd5wn6

3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF:  -0.01400000 Waves

2020.03.11 22:35 [904913] smart account 3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF > SELF 0.00000000 Waves

{ "type": 13, "id": "GFf3SRaMSzZbgvHeTgWQc3eiTy78WnhDvuzqtRGd5wn6", "fee": 1400000, "feeAssetId": null, "timestamp": 1583955114084, "version": 1, "sender": "3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF", "senderPublicKey": "9v3cUhWaBqFKLuHQTbz2osNsxRANDcpaRZja43mFNkR3", "proofs": [ "3x4gQ3M9x92wfNW4J2KnTWuoGqsjia32AG4QJQirfNKuxQmu54oH7HVzJpLK9VZUqeWDCwiEY3f8mV2LQTba6hSY" ], "script": "base64:AAIDAAAAAAAAAA0IARIAEgASABIDCgEBAAAABQAAAAAGRVVDb2luAQAAACDJofoUphCC2vgdQrn0R0tQm4QOreBLRVolNScltI/WUQAAAAAGVVNDb2luAQAAACCWpimiLpI8FZFaHXIW3ZwI74bEgcPecoAv5ODcRcQ7/QAAAAAOb3duZXJQdWJsaWNLZXkBAAAAIIR0OzhzTJc1ozXjp3CfISpQxO2vbrCrTGSiFABFRe8mAAAAAA1PcmFjbGVBZGRyZXNzCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAIzNOQWNvZVdkVVRXbjhjc1hKUEc0N3YxRmp0amNmcXhiNXR1AQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAADU9yYWNsZUFkZHJlc3MFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAAAABAAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10CQEAAAAHZXh0cm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AZwcm9vZnMAAAAAAAAAAAAFAAAADm93bmVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGB/DhB9o=", "chainId": 84, "height": 904913, "spentComplexity": 0 } View: original | compacted Prev: Ds97igpf2vjYHsWmMmgG3QUU5FWDbV535fbeFYDNareb Next: AVBYZBJMgSBP2c76u6KNriv8mqnSGsQFeE36Jy5qojbq Diff:
OldNewDifferences
4444 case _ =>
4545 0
4646 }
47- let rate = match getInteger(OracleAddress, "waves_usd_2") {
48- case a: Int =>
49- a
50- case _ =>
51- 0
52- }
47+ let rate = getNumberByKey("waves_usd_2")
5348 if ((rate == 0))
5449 then throw("rate 0")
5550 else {
56- let trasferAmount = (pmt.amount * rate)
51+ let trasferAmount = ((pmt.amount * rate) / 100)
5752 let newAmount = (currentAmount + pmt.amount)
5853 ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, EUCoin)]))
5954 }
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 }
47- let rate = match getInteger(OracleAddress, "waves_usd_2") {
48- case a: Int =>
49- a
50- case _ =>
51- 0
52- }
47+ let rate = getNumberByKey("waves_usd_2")
5348 if ((rate == 0))
5449 then throw("rate 0")
5550 else {
56- let trasferAmount = (pmt.amount * rate)
51+ let trasferAmount = ((pmt.amount * rate) / 100)
5752 let newAmount = (currentAmount + pmt.amount)
5853 ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, EUCoin)]))
5954 }
6055 }
6156 }
6257
6358
6459
6560 @Callable(i)
6661 func withdrawUSCoin () = {
6762 let pmt = extract(i.payment)
6863 if (isDefined(pmt.assetId))
6964 then if ((pmt.assetId == EUCoin))
7065 then {
7166 let currentKey = toBase58String(i.caller.bytes)
7267 let currentAmount = match getInteger(this, (currentKey + "_uscoin")) {
7368 case a: Int =>
7469 a
7570 case _ =>
7671 0
7772 }
7873 let rate = getNumberByKey("waves_usd_2")
7974 let trasferAmount = (pmt.amount / 100)
8075 let newAmount = (currentAmount - trasferAmount)
8176 if ((0 > pmt.amount))
8277 then throw("Can't withdraw negative amount")
8378 else if ((0 > newAmount))
8479 then throw("Not enough USCoin Deposited")
8580 else ScriptResult(WriteSet([DataEntry((currentKey + "_uscoin"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, USCoin)]))
8681 }
8782 else throw("You Can Withdraw with EUCoin only")
8883 else throw("You Can Withdraw with EUCoin only")
8984 }
9085
9186
9287
9388 @Callable(i)
9489 func withdrawWaves () = {
9590 let pmt = extract(i.payment)
9691 if (isDefined(pmt.assetId))
9792 then if ((pmt.assetId == EUCoin))
9893 then {
9994 let currentKey = toBase58String(i.caller.bytes)
10095 let currentAmount = match getInteger(this, (currentKey + "_waves")) {
10196 case a: Int =>
10297 a
10398 case _ =>
10499 0
105100 }
106101 let rate = getNumberByKey("waves_usd_2")
107102 let trasferAmount = pmt.amount
108103 let newAmount = (currentAmount - trasferAmount)
109104 if ((0 > pmt.amount))
110105 then throw("Can't withdraw negative amount")
111106 else if ((0 > newAmount))
112107 then throw("Not enough Waves Deposited")
113108 else ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, unit)]))
114109 }
115110 else throw("You Can Withdraw with EUCoin only")
116111 else throw("You Can Withdraw with EUCoin only")
117112 }
118113
119114
120115
121116 @Callable(i)
122117 func getFaucet (amount) = {
123118 let currentKey = toBase58String(i.caller.bytes)
124119 let currentAmount = match getInteger(this, (currentKey + "_faucet")) {
125120 case a: Int =>
126121 a
127122 case _ =>
128123 0
129124 }
130125 if ((0 > amount))
131126 then throw("Can't withdraw negative amount")
132127 else if ((currentAmount > 0))
133128 then throw("Faucet already taken")
134129 else ScriptResult(WriteSet([DataEntry((currentKey + "_faucet"), amount)]), TransferSet([ScriptTransfer(i.caller, amount, EUCoin)]))
135130 }
136131
137132
138133 @Verifier(tx)
139134 func verify () = match tx {
140135 case d: SetScriptTransaction =>
141136 sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey)
142137 case d: DataTransaction =>
143138 true
144139 case _ =>
145140 false
146141 }
147142

github/deemru/w8io/169f3d6 
47.94 ms