tx · CRRGwH4MohyuvNyhaK3id6JnHMqkT2GtAc2oswAaAbJ3 3Mz3A1UYGJv1646xRXHZzTy4nofAbg4QPaH: -0.01400000 Waves 2023.03.06 13:20 [2478098] smart account 3Mz3A1UYGJv1646xRXHZzTy4nofAbg4QPaH > SELF 0.00000000 Waves
{ "type": 13, "id": "CRRGwH4MohyuvNyhaK3id6JnHMqkT2GtAc2oswAaAbJ3", "fee": 1400000, "feeAssetId": null, "timestamp": 1678098111997, "version": 2, "chainId": 84, "sender": "3Mz3A1UYGJv1646xRXHZzTy4nofAbg4QPaH", "senderPublicKey": "8wkcC4wZzidr4PipMnDKcJn4CP25PZn9Mj15Tx51kiB9", "proofs": [ "28RCzJGkpmeKpCunHUjK4RCsafJKJ5hsfMK2s5vSf7FJxf5oq8kuYxCxSprfw5Q3SPtWn2pCLtCb3pU773ryfdXZ" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAAAAAAAAEAAAABaQEAAAASSXNzdWVPcHRpb25MUFRva2VuAAAAAQAAAAxFbnRlckFzc2V0SUQEAAAABGluZm8JAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkAA+wAAAABCQACWQAAAAEFAAAADEVudGVyQXNzZXRJRAkAASwAAAACCQABLAAAAAICAAAABkFzc2V0IAUAAAAMRW50ZXJBc3NldElEAgAAAB0gZG9lc24ndCBleGlzdCBvbiBCbG9ja2NoYWluLgQAAAAEbmFtZQgFAAAABGluZm8AAAAEbmFtZQQAAAAHTFBpc3N1ZQkABEIAAAAFCQABLAAAAAIJAAEsAAAAAgIAAAAET3B0LQkAAS8AAAACBQAAAARuYW1lAAAAAAAAAAAHAgAAAAUtVVNEQwkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAET3B0LQkAAS8AAAACBQAAAARuYW1lAAAAAAAAAAAHAgAAAAUtVVNEQwIAAABEIGlzIGEgTGlxdWlkaXR5IFByb3ZpZGVyIFRva2VuIElzc3VlZCBBZ2FpbnN0IE9wdGlvbiBTbWFydCBDb250cmFjdC4AAAAAAAAAAAEAAAAAAAAAAAgGBAAAAAdhc3NldElkCQAEOAAAAAEFAAAAB0xQaXNzdWUEAAAAGWNoZWNraWZhc3NldGFscmVhZHlpc3N1ZWQJAAQdAAAAAgUAAAAEdGhpcwkAASwAAAACCQABLwAAAAIFAAAABG5hbWUAAAAAAAAAAAcCAAAAEV9MUF9Ub2tlbl9Bc3NldElEAwkAAAAAAAACBQAAABljaGVja2lmYXNzZXRhbHJlYWR5aXNzdWVkBQAAAAxFbnRlckFzc2V0SUQJAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAMRW50ZXJBc3NldElEAgAAAA4gTFAgVG9rZW4gZm9yIAUAAAAMRW50ZXJBc3NldElEAgAAABMgaXMgYWxyZWFkeSBpc3N1ZWQuCQAETAAAAAIFAAAAB0xQaXNzdWUJAARMAAAAAgkBAAAABEJ1cm4AAAACBQAAAAdhc3NldElkAAAAAAAAAAABCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgkAAS8AAAACBQAAAARuYW1lAAAAAAAAAAAHAgAAABFfTFBfVG9rZW5fQXNzZXRJRAkAAlgAAAABBQAAAAdhc3NldElkBQAAAANuaWwAAAAA4sSFTg==", "height": 2478098, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8ZyYmHYVunKjdQ4eBhnJhRwmfsmWH8HdPmt8kBZcQVyn Next: 72j6GXxHhkL8ayto7iceR9oGMcrhWvibFy15e5e5Zw8i Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func call () = { | |
8 | - | let pmt = if ((size(i.payments) == 1)) | |
9 | - | then i.payments[0] | |
10 | - | else throw("No payment attached, Please Attach Tokens in payment[1].") | |
11 | - | let a = [11149000, 1149000] | |
12 | - | func foldFunc (acc,e) = (e + pmt.amount) :: acc | |
13 | - | ||
14 | - | let winningToken = { | |
15 | - | let $l = a | |
16 | - | let $s = size($l) | |
17 | - | let $acc0 = nil | |
18 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
19 | - | then $a | |
20 | - | else foldFunc($a, $l[$i]) | |
21 | - | ||
22 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
23 | - | then $a | |
24 | - | else throw("List size exceeds 2") | |
25 | - | ||
26 | - | $f0_2($f0_1($f0_1($acc0, 0), 1), 2) | |
27 | - | } | |
28 | - | [IntegerEntry("List", winningToken[0])] | |
7 | + | func IssueOptionLPToken (EnterAssetID) = { | |
8 | + | let info = valueOrErrorMessage(assetInfo(fromBase58String(EnterAssetID)), (("Asset " + EnterAssetID) + " doesn't exist on Blockchain.")) | |
9 | + | let name = info.name | |
10 | + | let LPissue = Issue((("Opt-" + take(name, 7)) + "-USDC"), ((("Opt-" + take(name, 7)) + "-USDC") + " is a Liquidity Provider Token Issued Against Option Smart Contract."), 1, 8, true) | |
11 | + | let assetId = calculateAssetId(LPissue) | |
12 | + | let checkifassetalreadyissued = getString(this, (take(name, 7) + "_LP_Token_AssetID")) | |
13 | + | if ((checkifassetalreadyissued == EnterAssetID)) | |
14 | + | then throw((((EnterAssetID + " LP Token for ") + EnterAssetID) + " is already issued.")) | |
15 | + | else [LPissue, Burn(assetId, 1), StringEntry((take(name, 7) + "_LP_Token_AssetID"), toBase58String(assetId))] | |
29 | 16 | } | |
30 | 17 | ||
31 | - | ||
32 | - | @Verifier(tx) | |
33 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
34 | 18 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func call () = { | |
8 | - | let pmt = if ((size(i.payments) == 1)) | |
9 | - | then i.payments[0] | |
10 | - | else throw("No payment attached, Please Attach Tokens in payment[1].") | |
11 | - | let a = [11149000, 1149000] | |
12 | - | func foldFunc (acc,e) = (e + pmt.amount) :: acc | |
13 | - | ||
14 | - | let winningToken = { | |
15 | - | let $l = a | |
16 | - | let $s = size($l) | |
17 | - | let $acc0 = nil | |
18 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
19 | - | then $a | |
20 | - | else foldFunc($a, $l[$i]) | |
21 | - | ||
22 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
23 | - | then $a | |
24 | - | else throw("List size exceeds 2") | |
25 | - | ||
26 | - | $f0_2($f0_1($f0_1($acc0, 0), 1), 2) | |
27 | - | } | |
28 | - | [IntegerEntry("List", winningToken[0])] | |
7 | + | func IssueOptionLPToken (EnterAssetID) = { | |
8 | + | let info = valueOrErrorMessage(assetInfo(fromBase58String(EnterAssetID)), (("Asset " + EnterAssetID) + " doesn't exist on Blockchain.")) | |
9 | + | let name = info.name | |
10 | + | let LPissue = Issue((("Opt-" + take(name, 7)) + "-USDC"), ((("Opt-" + take(name, 7)) + "-USDC") + " is a Liquidity Provider Token Issued Against Option Smart Contract."), 1, 8, true) | |
11 | + | let assetId = calculateAssetId(LPissue) | |
12 | + | let checkifassetalreadyissued = getString(this, (take(name, 7) + "_LP_Token_AssetID")) | |
13 | + | if ((checkifassetalreadyissued == EnterAssetID)) | |
14 | + | then throw((((EnterAssetID + " LP Token for ") + EnterAssetID) + " is already issued.")) | |
15 | + | else [LPissue, Burn(assetId, 1), StringEntry((take(name, 7) + "_LP_Token_AssetID"), toBase58String(assetId))] | |
29 | 16 | } | |
30 | 17 | ||
31 | - | ||
32 | - | @Verifier(tx) | |
33 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
34 | 18 |
github/deemru/w8io/169f3d6 23.71 ms ◑