shapeshift / rFOX

rFOX - RUNE rewards for FOX stakers
MIT License
0 stars 0 forks source link

Feat/multiple unstakes #37

Closed 0xean closed 1 month ago

0xean commented 2 months ago

Creating this draft pull request to discuss this option.

If we decide we want to move forward, will continue with additional tests, but a basic POC test exists.

Some notes:

TLDR: we can do it, but there are just tradeoffs here. Is it better to allow it or not?

0xean commented 1 month ago

adding much more testing and a better algorithm for calling withdraw()

please take another pass, marking as "ready for review"

kaladinlight commented 1 month ago

One more thought regarding user interaction optimization: withdraw() could instead withdraw all cooled down unstaking requests instead of the most recent one each call.

0xean commented 1 month ago

One more thought regarding user interaction optimization: withdraw() could instead withdraw all cooled down unstaking requests instead of the most recent one each call.

Yes, I thought about this also.

The complexity here is not trivial because we need to modify the array index while iterating the same array. I don't know a graceful way to handle this in solidity without introducing a significant amount of code that I don't think is really warranted. If you have an easy way to do it, I think its worth discussing.

0xean commented 1 month ago

@gomesalexandre - ready for another pass. Good to treat as high risk, so would prefer 2 stampers.