fee_protocol cannot be set, protocol is not able to earn fees. #24
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-8
🤖_primary
AI based primary recommendation
🤖_03_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-superposition/blob/4528c9d2dbe1550d2660dac903a8246076044905/pkg/seawater/src/pool.rs#L31
Vulnerability details
Impact
fee_protocol
cannot be set, protocol is not able to earn fees.Proof of Concept
StoragePool::fee_protocol needs to be set non-zero for protocol to earn trading fees. However, there is no method to set fee_protocol, neither is fee_protocol initialized during pool creation. As a result, fee_protocol will always be zero. And the protocol can never earn or collect trading fees.
In
swap()
, wee see only whenfee_protocol
is greater than zero, will protocol fee be accumulated.(https://github.com/code-423n4/2024-08-superposition/blob/4528c9d2dbe1550d2660dac903a8246076044905/pkg/seawater/src/pool.rs#L449-L452)
But here is no method to initialize or modify
fee_protocol
of a pool. Seeinit()
where only the overall trading fees(pool::fee) are initialized, butfee_protocol
cannot be set.(https://github.com/code-423n4/2024-08-superposition/blob/4528c9d2dbe1550d2660dac903a8246076044905/pkg/seawater/src/pool.rs#L49)
Tools Used
Manual
Recommended Mitigation Steps
Add a method to allow the admin to set a pool’s fee_protocol when needed.
Assessed type
Other
The text was updated successfully, but these errors were encountered: