Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt fee computation for all transactions #4632

Closed
Tracked by #4341
sridharmeganathan opened this issue Dec 4, 2022 · 4 comments
Closed
Tracked by #4341

Adapt fee computation for all transactions #4632

sridharmeganathan opened this issue Dec 4, 2022 · 4 comments

Comments

@sridharmeganathan
Copy link
Contributor

sridharmeganathan commented Dec 4, 2022

Description

Adapt the Lisk protocol fee calculation.

Acceptance Criteria

Compute minimum fee

All transactions in Lisk has minimum fee, calculate the minFee using following function by passing the valid input parameter based transaction (e.g for multisignature registration/transaction from multsig account requires particular options to be passed to work properly)

Token transfer
  • call token_getInitializationFees to get the set fees
    e.g
/api/v3/invoke

{
 "endpoint": "token_getInitializationFees",
  "params": {}
}
  • check if recipientAddress exists on the chain by token_userAccountExists
  • if recipientAddress does not exist, add userAccount fee to the fee
  • Use Fees subtitle Account initialization
    • Once an account has been initialised do not show Initialisation fee
Transfer CrossChain
  • call token_getInitializationFees to get the set fees
  • check if receivingChainID exists on the chain by token_escrowAccountExists
  • if receivingChainID does not exist, add escrowAccount fee to the fee
  • Use Fees subtitle Account initialization
  • Once an account has been initialised do not show Initialisation fee
Register Validator
  • call pos_getRegistrationFee to get the fee
  • when calling registerValidator command, add the fee
  • Use Fees subtitle Registration

Additional Information

  • Use invoke endpoint with endpoint name and params to call below mentioned endpoints
  • Show additional fee where required (e.g do not show initialisation fee on register validator flow, rather show registration fee)
    • Use correct title for following transactions:
      • Token transfer, Transfer CrossChain, Reclaim, Register Multisignature: Account initialization
      • Register Validator: Registration
      • Transactions that do not have extra command fees: Stake, Unstake, Unlock
    • Ensure the UI and logic are updated to handle the above cases
  • Consider caching the fee related endpoints as they wont change
    • Clear cache after blockchain switch (this is done already i guess)
  • Update MSW mocks
  • Adopt unit test
@ManuGowda
Copy link
Contributor

@soroushm I think there was no changes to fees endpoint api/v3/fees probably you are referring to this fee changes https://github.com/LiskHQ/discussions/discussions/64?

Please update the issue details to address the same.

CC: @sameersubudhi in case if @soroushm has a different understanding of api/v3/fees endpoint changes.

@reyraa reyraa self-assigned this Jan 2, 2023
@sridharmeganathan sridharmeganathan added this to the Sprint 90 milestone Jan 2, 2023
@ManuGowda
Copy link
Contributor

This issue needs detailing, @ManuGowda will add more context before being worked.

@ManuGowda ManuGowda changed the title Adopt Fees Endpoint Adapt fee computation for all transactions Jan 4, 2023
@ManuGowda ManuGowda moved this from Backlog to Todo in Lisk Desktop Version 3.0.0 Jan 6, 2023
@ManuGowda ManuGowda moved this from Todo to In Progress in Lisk Desktop Version 3.0.0 Jan 11, 2023
@reyraa
Copy link
Contributor

reyraa commented Jan 11, 2023

The current code base requires extensive changes. I'd suggest we break this ticket intro the following:

  • Create a hook to calculate the tx fee using given parameters (Account for command fee and tiebreaker)
  • Fetch command fee and tiebreaker and incorporate in the above hook
  • Use the tx fee hook to calculate min fee, the fee corresponding to max transferrable balance, and the fee corresponding the selected priority.
  • Use above fee to display fees in tx forms (Update React components to work with new data schema)
  • Use above hook to create txs and broadcast them (Update utilities to work with new data schema)

@ManuGowda
Copy link
Contributor

ManuGowda commented Jan 16, 2023

#4720
#4716

@ManuGowda ManuGowda removed this from the Sprint 91 milestone Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants