tx · BjDHqU87iuEJGa4xV7Aa55Tm3AdBwfDaApvRzos56D1T

3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF:  -0.01400000 Waves

2020.03.11 21:36 [904849] smart account 3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF > SELF 0.00000000 Waves

{ "type": 13, "id": "BjDHqU87iuEJGa4xV7Aa55Tm3AdBwfDaApvRzos56D1T", "fee": 1400000, "feeAssetId": null, "timestamp": 1583951728923, "version": 1, "sender": "3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF", "senderPublicKey": "9v3cUhWaBqFKLuHQTbz2osNsxRANDcpaRZja43mFNkR3", "proofs": [ "tnWeLPTq88xKejddh98ZJNTJrh365MQ6bhiuCAMhFirbMJx8oTsfiY1UzCeSt7hA2Cd6WtCQDDBHKQKaqPtemTz" ], "script": "base64:AAIDAAAAAAAAAA0IARIAEgASABIDCgEBAAAABQAAAAAGRVVDb2luAQAAACDJofoUphCC2vgdQrn0R0tQm4QOreBLRVolNScltI/WUQAAAAAGVVNDb2luAQAAACCWpimiLpI8FZFaHXIW3ZwI74bEgcPecoAv5ODcRcQ7/QAAAAAOb3duZXJQdWJsaWNLZXkBAAAAIIR0OzhzTJc1ozXjp3CfISpQxO2vbrCrTGSiFABFRe8mAAAAAA1PcmFjbGVBZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEJAAGbAAAAAQIAAAAjM05BY29lV2RVVFduOGNzWEpQRzQ3djFGanRqY2ZxeGI1dHUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAANT3JhY2xlQWRkcmVzcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAAAAAEAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcG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AAAA5vd25lclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgdGCuTK", "chainId": 84, "height": 904849, "spentComplexity": 0 } View: original | compacted Prev: Cm6C884zYJHbW5w1ZC27w9gUgmoRiDek1ribtDxrWDGH Next: kRfpfFMedXH6N1BznxHwbywmbsq6tEdJWdCzEQ8gXbW Diff:
OldNewDifferences
4747 let rate = getNumberByKey("waves_usd_2")
4848 let trasferAmount = ((pmt.amount * rate) / 100)
4949 let newAmount = (currentAmount + (pmt.amount / 100))
50- ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, EUCoin)]))
50+ ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, rate, EUCoin)]))
5151 }
5252 }
5353
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 = Address(toBytes("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 let trasferAmount = ((pmt.amount * rate) / 100)
4949 let newAmount = (currentAmount + (pmt.amount / 100))
50- ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, EUCoin)]))
50+ ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, rate, EUCoin)]))
5151 }
5252 }
5353
5454
5555
5656 @Callable(i)
5757 func withdrawUSCoin () = {
5858 let pmt = extract(i.payment)
5959 if (isDefined(pmt.assetId))
6060 then if ((pmt.assetId == EUCoin))
6161 then {
6262 let currentKey = toBase58String(i.caller.bytes)
6363 let currentAmount = match getInteger(this, (currentKey + "_uscoin")) {
6464 case a: Int =>
6565 a
6666 case _ =>
6767 0
6868 }
6969 let rate = getNumberByKey("waves_usd_2")
7070 let trasferAmount = (pmt.amount / 100)
7171 let newAmount = (currentAmount - trasferAmount)
7272 if ((0 > pmt.amount))
7373 then throw("Can't withdraw negative amount")
7474 else if ((0 > newAmount))
7575 then throw("Not enough USCoin Deposited")
7676 else ScriptResult(WriteSet([DataEntry((currentKey + "_uscoin"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, USCoin)]))
7777 }
7878 else throw("You Can Withdraw with EUCoin only")
7979 else throw("You Can Withdraw with EUCoin only")
8080 }
8181
8282
8383
8484 @Callable(i)
8585 func withdrawWaves () = {
8686 let pmt = extract(i.payment)
8787 if (isDefined(pmt.assetId))
8888 then if ((pmt.assetId == EUCoin))
8989 then {
9090 let currentKey = toBase58String(i.caller.bytes)
9191 let currentAmount = match getInteger(this, (currentKey + "_waves")) {
9292 case a: Int =>
9393 a
9494 case _ =>
9595 0
9696 }
9797 let rate = getNumberByKey("waves_usd_2")
9898 let trasferAmount = ((pmt.amount / rate) * 100)
9999 let newAmount = (currentAmount - trasferAmount)
100100 if ((0 > pmt.amount))
101101 then throw("Can't withdraw negative amount")
102102 else if ((0 > newAmount))
103103 then throw("Not enough Waves Deposited")
104104 else ScriptResult(WriteSet([DataEntry((currentKey + "_waves"), newAmount)]), TransferSet([ScriptTransfer(i.caller, trasferAmount, unit)]))
105105 }
106106 else throw("You Can Withdraw with EUCoin only")
107107 else throw("You Can Withdraw with EUCoin only")
108108 }
109109
110110
111111
112112 @Callable(i)
113113 func getFaucet (amount) = {
114114 let currentKey = toBase58String(i.caller.bytes)
115115 let currentAmount = match getInteger(this, (currentKey + "_faucet")) {
116116 case a: Int =>
117117 a
118118 case _ =>
119119 0
120120 }
121121 if ((0 > amount))
122122 then throw("Can't withdraw negative amount")
123123 else if ((currentAmount > 0))
124124 then throw("Faucet already taken")
125125 else ScriptResult(WriteSet([DataEntry((currentKey + "_faucet"), amount)]), TransferSet([ScriptTransfer(i.caller, amount, EUCoin)]))
126126 }
127127
128128
129129 @Verifier(tx)
130130 func verify () = match tx {
131131 case d: SetScriptTransaction =>
132132 sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey)
133133 case d: DataTransaction =>
134134 true
135135 case _ =>
136136 false
137137 }
138138

github/deemru/w8io/169f3d6 
61.12 ms