beefy-contracts icon indicating copy to clipboard operation
beefy-contracts copied to clipboard

Add a modifier to limit deposits from a vault

Open prevostc opened this issue 2 years ago • 1 comments

Solves this issue https://github.com/beefyfinance/beefy-contracts/issues/23

There are sometimes where we're pushing an experimental vault. Or for a few different reasons, we might want to have a temporary cap on deposits. The goal would be to have a reusable contract that lets strategies have a cap for the first x blocks of their existence. This would prevent people from apeing $5M into something experimental.

There is some choices made here I'm not sure about:

  • Used block numbers instead of timestamps, but some chains like avalanche might recommend using timestamps instead
  • Used an initializer instead of a constructor to set both parameters, I'm not sure about the differences
  • Created unit tests using forge due to me being familiar with it but it seems it's only used to test vault deployments for now
  • I don't especially like current naming of the contract and method

prevostc avatar Dec 04 '22 20:12 prevostc

Weso review:

I see the issue mentions it being time bound. It's not really practical as you are setting the time arbitrarily when deploying the contract. Also should have an ability to change cap size by owner. Also it's cheaper to write modifier logic in an internal view function then call the function in the modifier.

prevostc avatar Dec 04 '22 22:12 prevostc