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:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let adminrights = getStringValue(this, "DApp_Admin_Rights")
4+
55
66 @Callable(i)
77 func BuyTNWithWaves () = {
8- let SpendUSDNValue = 340000000
8+ let SpendWavesValue = 340000000
99 let Dappfeepercentage = 96
1010 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)]
1424 }
1525
1626
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let adminrights = getStringValue(this, "DApp_Admin_Rights")
4+
55
66 @Callable(i)
77 func BuyTNWithWaves () = {
8- let SpendUSDNValue = 340000000
8+ let SpendWavesValue = 340000000
99 let Dappfeepercentage = 96
1010 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)]
1424 }
1525
1626
1727 @Verifier(tx)
1828 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
1929

github/deemru/w8io/169f3d6 
27.93 ms