What I do
I have on the balance: 30685.413253185071200896 BANANATEST
For the 0.1 MNT fee I plan to spend 38.956518155931433038 BANANATEST
So I will sell only 30646.456735029139767858, to leave enough for comission
I send TX:
{ nonce: '129',
chainId: '2',
gasPrice: '1',
gasCoin: 'BANANATEST',
type: '0x02',
data:
{ coinToSell: 'BANANATEST',
valueToSell: '30646.456735029139767858',
coinToBuy: 'MNT',
minimumValueToBuy: '0' },
payload: '',
}
https://minter-node-1.testnet.minter.network/send_transaction?tx=0xf87e818102018a42414e414e415445535402a3e28a42414e414e41544553548a067d59060c9f4d7282328a4d4e540000000000000080808001b845f8431ca01d568386460de1dd40a7c73084a84be68bbf4696aea0208530d3bae2ccf47e4ba059cb6cbfb12e56d7f5f4f8c367a76a867aff09afca15e8d61a7ef4cf7e0d26be
The error occurs: 30685.4691828209 BANANATEST required to proceed such TX
It is 0.055929635828799104 BANANATEST more than I have (0.000143569521334670 MNT equivalent)
What happens
Such calculation occurs in the blockchain:
- Sell 30646.456735029139767858 BANANATEST, write down new coin parameters
- Sell BANANATEST to pay fee taking into account new coin price
What's wrong with it
What we can do
Sell COIN first to calculate fee, than sell COIN to calculate resulting amount
- It looks more intuitive
- Calculating fee will be easy
- No need to fix estimation API method (though I'm not sure it is fixable with current behavior)
- Calculating fee first will produce very little coin price change, so we can even ignore such price change in the UI when calculating estimation of received coins
What I do
I have on the balance: 30685.413253185071200896 BANANATEST
For the 0.1 MNT fee I plan to spend 38.956518155931433038 BANANATEST
So I will sell only 30646.456735029139767858, to leave enough for comission
I send TX:
{ nonce: '129',
chainId: '2',
gasPrice: '1',
gasCoin: 'BANANATEST',
type: '0x02',
data:
{ coinToSell: 'BANANATEST',
valueToSell: '30646.456735029139767858',
coinToBuy: 'MNT',
minimumValueToBuy: '0' },
payload: '',
}
https://minter-node-1.testnet.minter.network/send_transaction?tx=0xf87e818102018a42414e414e415445535402a3e28a42414e414e41544553548a067d59060c9f4d7282328a4d4e540000000000000080808001b845f8431ca01d568386460de1dd40a7c73084a84be68bbf4696aea0208530d3bae2ccf47e4ba059cb6cbfb12e56d7f5f4f8c367a76a867aff09afca15e8d61a7ef4cf7e0d26be
The error occurs: 30685.4691828209 BANANATEST required to proceed such TX
It is 0.055929635828799104 BANANATEST more than I have (0.000143569521334670 MNT equivalent)
What happens
Such calculation occurs in the blockchain:
What's wrong with it
https://minter-node-1.testnet.minter.network/estimate_tx_commission?tx=0xf87e818102018a42414e414e415445535402a3e28a42414e414e41544553548a067d59060c9f4d7282328a4d4e540000000000000080808001b845f8431ca01d568386460de1dd40a7c73084a84be68bbf4696aea0208530d3bae2ccf47e4ba059cb6cbfb12e56d7f5f4f8c367a76a867aff09afca15e8d61a7ef4cf7e0d26be
What we can do
Sell COIN first to calculate fee, than sell COIN to calculate resulting amount