tx · BuyRzDRkim4Q7ACxiZUcAEqsuy5mVdjx9kCNznM8fxS4
3MpRDrT92zK6yWJh47UdA8mRDH7f2F3CSzH: -0.01000000 Waves
2021.10.31 02:14 [1769692] smart account 3MpRDrT92zK6yWJh47UdA8mRDH7f2F3CSzH > SELF 0.00000000 Waves
{
"type": 13,
"id": "BuyRzDRkim4Q7ACxiZUcAEqsuy5mVdjx9kCNznM8fxS4",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1635635694770,
"version": 2,
"chainId": 84,
"sender": "3MpRDrT92zK6yWJh47UdA8mRDH7f2F3CSzH",
"senderPublicKey": "6it1s6XyHkFTbzgCJPXSeHjyLYixDHy6hJgzzfbntDGB",
"proofs": [
"4jXDwftK9V6vrYxhuB6r5tDpgqHiPhHtUmr2XGZbMrZ8tx3k5PXyksX8NNThCrHNiY6p3occrpbrZXjsEJtA2aY1"
],
"script": "base64:AAIFAAAAAAAAAAwIAhIDCgEIEgMKAQEAAAAFAAAAAAZtZHN0aWQBAAAAIAYu1kRFDCnSZz0aQgjpMvwys70UJVtRnhDUh1FQYpqKAAAAAAtnb29kYWNjb3VudAIAAAAjM016WHFvMnJCeGMzWEVLUFZjWUhEcnNnUDdqbUU2Y0dnNkMAAAAADU9yYWNsZUFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVQFgs5g7sHJWLf0iLmoL9RVDbyuM78yCVYAAAAAA3VzZAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAANT3JhY2xlQWRkcmVzcwIAAAAHdXNkcmF0ZQEAAAALaXNQYXltZW50T2sAAAABAAAAAWkDCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAAACAAAAAQIAAAAUUGF5bWVudCBub3QgYXR0YWNoZWQEAAAAAXAJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAAByRtYXRjaDAIBQAAAAFwAAAAB2Fzc2V0SWQJAABnAAAAAggFAAAAAXAAAAAGYW1vdW50AAAAAAAF9eEAAAAAAgAAAAFpAQAAAAdidXltZHN0AAAAAQAAAAl0aGVTdHJpbmcDCQEAAAALaXNQYXltZW50T2sAAAABBQAAAAFpBAAAAAJwcAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAEYW1udAgFAAAAAnBwAAAABmFtb3VudAQAAAAKbWRzdGFtb3VudAkAAGkAAAACCQAAaAAAAAIJAABoAAAAAgUAAAAEYW1udAUAAAADdXNkAAAAAAAAACcQAAAAAAAF9eEACQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAKbWRzdGFtb3VudAUAAAAGbWRzdGlkBQAAAANuaWwJAAACAAAAAQIAAAAdV3JvbmcgcGF5bWVudCBhbW91bnQgb3IgYXNzZXQAAAABaQEAAAAKY2hhbmdlcmF0ZQAAAAEAAAAEcmF0ZQQAAAAHY29tcGFyZQkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIDCQAAAAAAAAIFAAAAB2NvbXBhcmUFAAAAC2dvb2RhY2NvdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAAd1c2RyYXRlBQAAAARyYXRlBQAAAANuaWwJAAACAAAAAQIAAAALQkFEIEFDQ09VTlQAAAAAyg991Q==",
"height": 1769692,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: EQQLPeXjHcMoDJZHwRqKjDHCZRaDm9VNyeKHf8DYy9KD
Next: AvcTkEKL1gLjM1WFK7hhqM2mS8RpTWDCQVsrRJsMNpZG
Diff:
Old | New | | Differences |
---|
4 | 4 | | let mdstid = base58'R8sQUmwwAENBL6B5ejGztDh3RzJ3MbKRqK7GtspFxKT' |
---|
5 | 5 | | |
---|
6 | 6 | | let goodaccount = "3MzXqo2rBxc3XEKPVcYHDrsgP7jmE6cGg6C" |
---|
| 7 | + | |
---|
| 8 | + | let OracleAddress = Address(base58'3MpRDrT92zK6yWJh47UdA8mRDH7f2F3CSzH') |
---|
| 9 | + | |
---|
| 10 | + | let usd = getIntegerValue(OracleAddress, "usdrate") |
---|
7 | 11 | | |
---|
8 | 12 | | func isPaymentOk (i) = if ((size(i.payments) == 0)) |
---|
9 | 13 | | then throw("Payment not attached") |
---|
|
21 | 25 | | then { |
---|
22 | 26 | | let pp = i.payments[0] |
---|
23 | 27 | | let amnt = pp.amount |
---|
24 | | - | let mdstamount = ((amnt * 5000) / 100000000) |
---|
| 28 | + | let mdstamount = (((amnt * usd) * 10000) / 100000000) |
---|
25 | 29 | | [ScriptTransfer(i.caller, mdstamount, mdstid)] |
---|
26 | 30 | | } |
---|
27 | 31 | | else throw("Wrong payment amount or asset") |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let mdstid = base58'R8sQUmwwAENBL6B5ejGztDh3RzJ3MbKRqK7GtspFxKT' |
---|
5 | 5 | | |
---|
6 | 6 | | let goodaccount = "3MzXqo2rBxc3XEKPVcYHDrsgP7jmE6cGg6C" |
---|
| 7 | + | |
---|
| 8 | + | let OracleAddress = Address(base58'3MpRDrT92zK6yWJh47UdA8mRDH7f2F3CSzH') |
---|
| 9 | + | |
---|
| 10 | + | let usd = getIntegerValue(OracleAddress, "usdrate") |
---|
7 | 11 | | |
---|
8 | 12 | | func isPaymentOk (i) = if ((size(i.payments) == 0)) |
---|
9 | 13 | | then throw("Payment not attached") |
---|
10 | 14 | | else { |
---|
11 | 15 | | let p = i.payments[0] |
---|
12 | 16 | | match p.assetId { |
---|
13 | 17 | | case _ => |
---|
14 | 18 | | (p.amount >= 100000000) |
---|
15 | 19 | | } |
---|
16 | 20 | | } |
---|
17 | 21 | | |
---|
18 | 22 | | |
---|
19 | 23 | | @Callable(i) |
---|
20 | 24 | | func buymdst (theString) = if (isPaymentOk(i)) |
---|
21 | 25 | | then { |
---|
22 | 26 | | let pp = i.payments[0] |
---|
23 | 27 | | let amnt = pp.amount |
---|
24 | | - | let mdstamount = ((amnt * 5000) / 100000000) |
---|
| 28 | + | let mdstamount = (((amnt * usd) * 10000) / 100000000) |
---|
25 | 29 | | [ScriptTransfer(i.caller, mdstamount, mdstid)] |
---|
26 | 30 | | } |
---|
27 | 31 | | else throw("Wrong payment amount or asset") |
---|
28 | 32 | | |
---|
29 | 33 | | |
---|
30 | 34 | | |
---|
31 | 35 | | @Callable(i) |
---|
32 | 36 | | func changerate (rate) = { |
---|
33 | 37 | | let compare = toString(i.caller) |
---|
34 | 38 | | if ((compare == goodaccount)) |
---|
35 | 39 | | then [IntegerEntry("usdrate", rate)] |
---|
36 | 40 | | else throw("BAD ACCOUNT") |
---|
37 | 41 | | } |
---|
38 | 42 | | |
---|
39 | 43 | | |
---|