Blockstream / Blockstream/simplicity-dex
Suggestions for extending fee calculation
- Dominant language
- Rust
- Stars
- 4
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the feature
This issue refers to an extension of the existing fee calculation. This is directly in the context of the function declared in `simplicity-dex` [here](https://github.com/Blockstream/simplicity-dex/blob/e6a8aa486d634c28add88e4712aff789c0eab99b/crates/cli-client/src/fee.rs#L43).
Fee calculation in `lwk_wollet` during transaction finalization is declared here from line [1165](https://github.com/Blockstream/lwk/blob/cf7027c343b5baa027ef8a97e9a8faf64c242f66/lwk_wollet/src/tx_builder.rs#L1165) up to [1220](https://github.com/Blockstream/lwk/blob/cf7027c343b5baa027ef8a97e9a8faf64c242f66/lwk_wollet/src/tx_builder.rs#L1220).
The calculation of fees in `simplicity-dex` is almost the same, so the idea is to improve it and move it to a more general crate.
Improvements that can be made:
* Use `discount_weight` as defined [here](https://github.com/Blockstream/lwk/blob/cf7027c343b5baa027ef8a97e9a8faf64c242f66/lwk_wollet/src/tx_builder.rs#L1196).
* Replace the manual LBTC testnet token definition with `wollet.policy_asset()` (see reference [here](https://github.com/Blockstream/lwk/blob/cf7027c343b5baa027ef8a97e9a8faf64c242f66/lwk_wollet/src/network.rs#L47)).
* Move the logic out of the `cli-client` module into an outer crate to enable reuse in [`simplicityhl-core`](https://github.com/BlockstreamResearch/simplicity-contracts/tree/main/crates/simplicityhl-core).
Contributor guide
Assessment
This issue has not been assessed yet.