-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat/manage protocol fee list #464
base: main
Are you sure you want to change the base?
Conversation
balance := common.BalanceOf(token, consts.PROTOCOL_FEE_ADDR) | ||
|
||
// amount in `tokenListWithAmount` is corrupted, it should be equal to balance | ||
if amount != balance { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyone can transfer assets to a PROTOCOL_FEE contract. The guard on that line is panicking if the assets on the books don't match the balance in the actual token contract. If someone maliciously sends assets to the PROTOCOL_FEE Contract, PROTOCOL_FEE will never receive them back. We recommend removing the guard on that line as it can cause problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic(errInvalidAmount.Error()) | ||
} | ||
|
||
if balance > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the condition should enter when the amount, not balance, is greater than or equal to 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quality Gate passedIssues Measures |
Description
protocol_fee
manages accumulated token path with its amount