Guys, can you help me understand sc-dex-rs? Are there something like estimate call before swap? Like a view method to figure out how much I will receive after swap?
Yes there are views like this:
https://github.com/ElrondNetwork/sc-dex-rs/blob/main/dex/pair/src/lib.rs#L621
Also not that you will always have to provide 2 values to the contract for example with this call:
https://github.com/ElrondNetwork/sc-dex-rs/blob/main/dex/pair/src/lib.rs#L453
So you determine during the call what will be the minimum amount of the other token you expect back. If this can't be fulfilled because the price climbed to high in the meantime it will signal an error with slippage exceeded :)
Yes there are views like this: https://github.com/ElrondNetwork/sc-dex-rs/blob/main/dex/pair/src/lib.rs#L621 Also not that you will always have to provide 2 values to the contract for example with this call: https://github.com/ElrondNetwork/sc-dex-rs/blob/main/dex/pair/src/lib.rs#L453 So you determine during the call what will be the minimum amount of the other token you expect back. If this can't be fulfilled because the price climbed to high in the meantime it will signal an error with slippage exceeded :)