tx · J2LFZQFo4NpoFCeTywdJhGgUrnsFzagT1s7pmQD7jFT9

3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF:  -0.01400000 Waves

2020.03.11 22:27 [904906] smart account 3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF > SELF 0.00000000 Waves

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

github/deemru/w8io/169f3d6 
43.94 ms