publicExit use case
mikemcdonald opened this issue · comments
publicExit
will always be true for bronze, but what are the scenarios for future releases where a pool should not be exit-able?
A fund manager usually has some control over when and how investors can cash out
We need to define all possible states of a pool (controlled
and finalized
) and bools (publicJoin
and publicExit
). Right now the code is confusing and makes assumptions that don't make sense.
For example - https://github.com/balancer-labs/balancer-core/blob/6f71d92e1e9296038c855887ec3c3fbd9dab0115/contracts/BPool.sol#L407-L408
requires the pool is finalized. Which makes a one way change of publicJoin
and publicExit
to true. And then it unnecessarily checks again isPublicJoin()
.
setPublicJoin
can only be called on a controlled pool. But joinPool
can only be called on a finalized pool. So an user can't join
a controlled pool. In the current state, setPublicJoin
has no use.
finalized
locks the controller out of all controlled functions, controlled
is just not-finalized.
You're right that with our current setup, setPublicJoin
and setPublicExit
have no function use, since we disallow join/exit on controlled pools.
You could allow join/exit on controlled pools, in which case users would need to understand finalized vs unfinalized pool-shares. If not, then yeah, we could remove setPublicJoin and setPublicExit.
I think allowing join / exit on controlled pools opens a mess of complexity that will lead to poor UX and users potentially getting screwed.
IMO for code cleanliness and readability it makes sense to remove isPublicJoin
and isPublicExit
. Everything can be contained in isFinalized
Potentially think about removing isPublicSwap
as well. If a controlled pool doesn't allow swaps, then what's the point of using Balancer.
isPublicSwap could be named back to isPaused
, the point is to change params / balances without exposing yourself in intermediate states
That's a good point. Eh I think isPublicSwap
captures that idea fine.
I'll submit a pull to move all of the other logic into isFinalized
unless there's any additional reasons