tx · AWm2JFTM36YtWxdmtvjdMCGysyR8kdTv6o4J1rJThpWC 3N993f67Vv3Jz3F2VXhGqDR37w6Sw3z3883: -0.01400000 Waves 2023.01.17 10:47 [2408653] smart account 3N993f67Vv3Jz3F2VXhGqDR37w6Sw3z3883 > SELF 0.00000000 Waves
{ "type": 13, "id": "AWm2JFTM36YtWxdmtvjdMCGysyR8kdTv6o4J1rJThpWC", "fee": 1400000, "feeAssetId": null, "timestamp": 1673941694588, "version": 2, "chainId": 84, "sender": "3N993f67Vv3Jz3F2VXhGqDR37w6Sw3z3883", "senderPublicKey": "4Th7ZmZ8q1gJTWYroiTqkP8SHd97aJUT2bQyKgCyvqZF", "proofs": [ "5yqP79oekSWLqEDWk4xbfuoxchhpmByoo26A5Y5RTukz8DwCVqcn7XtyZTgkcmGsFC9vsxn5hUopxUA5JDZHdttu" ], "script": "base64:AAIFAAAAAAAAAPcIAhIAIgFpIg9TcGVuZFdhdmVzVmFsdWUiEURhcHBmZWVwZXJjZW50YWdlIg1jYWxsZXJhZGRyZXNzIgtBTU1fQWRkcmVzcyIFV0FWRVMiCWtCYWxhbmNlQSIPQV9hc3NldF9iYWxhbmNlIglrQmFsYW5jZUIiD0JfYXNzZXRfYmFsYW5jZSIRbmV3YmFsYW5jZW9mV0FWRVMiEm1pbkFtb3VudFRvUmVjZWl2ZSIHQU1NX2ZlZSIYYWN0dWFsbWluQW1vdW50VG9SZWNlaXZlIgdwYXltZW50IhBpbnZva2VUb0J1eVdBVkVTIgJ0eCIGdmVyaWZ5AAAAAAAAAAEAAAABYQEAAAAOQnV5VE5XaXRoV2F2ZXMAAAAABAAAAAFiAAAAAAAUQ/0ABAAAAAFjAAAAAAAAAABgBAAAAAFkCQACWAAAAAEICAUAAAABYQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAAWUJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAECAAAAIzNKakg2YmhDRWNOM0pkdUVqQUNtQnZMUTFlUXZYU25BdXlpBAAAAAFmAQAAACDP/74B1d4jjFgihGpnkOPBwPYiuXsdK1Tqg2sFWwuhfgQAAAABZwIAAAARZ2xvYmFsX1ROX2JhbGFuY2UEAAAAAWgJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAAAWUFAAAAAWcEAAAAAWkCAAAAO2dsb2JhbF9FendhRjU4c3NBTGNVQ1o5RmJ5ZUQxR1RTdGVvWkFRWkVEVHFCQVhIZnE4eV9iYWxhbmNlBAAAAAFqCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAFlBQAAAAFpBAAAAAFrCQAAawAAAAMFAAAAAWoFAAAAAWgJAABkAAAAAgUAAAABagUAAAABYgQAAAABbAkAAGUAAAACBQAAAAFoBQAAAAFrBAAAAAFtCQAAawAAAAMFAAAAAWwFAAAAAWMAAAAAAAAAJxAEAAAAAW4JAABlAAAAAgkAAGUAAAACBQAAAAFsBQAAAAFtAAAAAAAAAAACBAAAAAFvCQEAAAAPQXR0YWNoZWRQYXltZW50AAAAAgUAAAABZgUAAAABYgQAAAABcAkAA/wAAAAEBQAAAAFlAgAAAARzd2FwCQAETAAAAAIFAAAAAW4FAAAAA25pbAkABEwAAAACBQAAAAFvBQAAAANuaWwJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAADlN3YXBfVE5fQW1vdW50BQAAAAFuBQAAAANuaWwAAAABAAAAAXEBAAAAAXIAAAAACQAB9AAAAAMIBQAAAAFxAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAABcQAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAFxAAAAD3NlbmRlclB1YmxpY0tleZaHPB0=", "height": 2408653, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B6G2npUoaPQsZLRKe1x7sKkPM6Dy8VfN15stSCmKKhfB Next: 5QLSnFmbVFC8VijPDYQHHzaeahpzbBmp9rxTHQi57uKZ Diff:
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 | 7 | func BuyTNWithWaves () = { | |
8 | - | let | |
8 | + | let SpendWavesValue = 340000000 | |
9 | 9 | let Dappfeepercentage = 96 | |
10 | 10 | let calleraddress = toBase58String(i.caller.bytes) | |
11 | - | if ((adminrights != calleraddress)) | |
12 | - | then throw((("I know You are not An Admin. Only " + adminrights) + " has rights to Sign.")) | |
13 | - | else [IntegerEntry("global_TN_balance", 30428578826086), IntegerEntry("global_EzwaF58ssALcUCZ9FbyeD1GTSteoZAQZEDTqBAXHfq8y_balance", 75906702019), StringEntry("DApp_Admin_Rights", "3N7mtXVHnAL3zdCRzVhrk8rzzXCQSL4kHJn")] | |
11 | + | let AMM_Address = addressFromStringValue("3JjH6bhCEcN3JduEjACmBvLQ1eQvXSnAuyi") | |
12 | + | let WAVES = base58'EzwaF58ssALcUCZ9FbyeD1GTSteoZAQZEDTqBAXHfq8y' | |
13 | + | let kBalanceA = "global_TN_balance" | |
14 | + | let A_asset_balance = getIntegerValue(AMM_Address, kBalanceA) | |
15 | + | let kBalanceB = "global_EzwaF58ssALcUCZ9FbyeD1GTSteoZAQZEDTqBAXHfq8y_balance" | |
16 | + | let B_asset_balance = getIntegerValue(AMM_Address, kBalanceB) | |
17 | + | let newbalanceofWAVES = fraction(B_asset_balance, A_asset_balance, (B_asset_balance + SpendWavesValue)) | |
18 | + | let minAmountToReceive = (A_asset_balance - newbalanceofWAVES) | |
19 | + | let AMM_fee = fraction(minAmountToReceive, Dappfeepercentage, 10000) | |
20 | + | let actualminAmountToReceive = ((minAmountToReceive - AMM_fee) - 2) | |
21 | + | let payment = AttachedPayment(WAVES, SpendWavesValue) | |
22 | + | let invokeToBuyWAVES = invoke(AMM_Address, "swap", [actualminAmountToReceive], [payment]) | |
23 | + | [IntegerEntry("Swap_TN_Amount", actualminAmountToReceive)] | |
14 | 24 | } | |
15 | 25 | ||
16 | 26 |
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 | 7 | func BuyTNWithWaves () = { | |
8 | - | let | |
8 | + | let SpendWavesValue = 340000000 | |
9 | 9 | let Dappfeepercentage = 96 | |
10 | 10 | let calleraddress = toBase58String(i.caller.bytes) | |
11 | - | if ((adminrights != calleraddress)) | |
12 | - | then throw((("I know You are not An Admin. Only " + adminrights) + " has rights to Sign.")) | |
13 | - | else [IntegerEntry("global_TN_balance", 30428578826086), IntegerEntry("global_EzwaF58ssALcUCZ9FbyeD1GTSteoZAQZEDTqBAXHfq8y_balance", 75906702019), StringEntry("DApp_Admin_Rights", "3N7mtXVHnAL3zdCRzVhrk8rzzXCQSL4kHJn")] | |
11 | + | let AMM_Address = addressFromStringValue("3JjH6bhCEcN3JduEjACmBvLQ1eQvXSnAuyi") | |
12 | + | let WAVES = base58'EzwaF58ssALcUCZ9FbyeD1GTSteoZAQZEDTqBAXHfq8y' | |
13 | + | let kBalanceA = "global_TN_balance" | |
14 | + | let A_asset_balance = getIntegerValue(AMM_Address, kBalanceA) | |
15 | + | let kBalanceB = "global_EzwaF58ssALcUCZ9FbyeD1GTSteoZAQZEDTqBAXHfq8y_balance" | |
16 | + | let B_asset_balance = getIntegerValue(AMM_Address, kBalanceB) | |
17 | + | let newbalanceofWAVES = fraction(B_asset_balance, A_asset_balance, (B_asset_balance + SpendWavesValue)) | |
18 | + | let minAmountToReceive = (A_asset_balance - newbalanceofWAVES) | |
19 | + | let AMM_fee = fraction(minAmountToReceive, Dappfeepercentage, 10000) | |
20 | + | let actualminAmountToReceive = ((minAmountToReceive - AMM_fee) - 2) | |
21 | + | let payment = AttachedPayment(WAVES, SpendWavesValue) | |
22 | + | let invokeToBuyWAVES = invoke(AMM_Address, "swap", [actualminAmountToReceive], [payment]) | |
23 | + | [IntegerEntry("Swap_TN_Amount", actualminAmountToReceive)] | |
14 | 24 | } | |
15 | 25 | ||
16 | 26 | ||
17 | 27 | @Verifier(tx) | |
18 | 28 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
19 | 29 |
github/deemru/w8io/026f985 25.70 ms ◑