-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: withdraw limits * test: max withdraw * fix: unrealised loss flow * fix: comments * build: limit modules * test: limit modules * feat: setter restrictions * chore: seperate interfaces * feat: check loss at each step * feat: check max uint * chore: use max redeem instead of max withdraw * feat: dont convert zero
- Loading branch information
1 parent
5632f70
commit 0387181
Showing
11 changed files
with
1,200 additions
and
67 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# @version 0.3.7 | ||
|
||
interface IVault: | ||
def totalAssets() -> uint256: view | ||
|
||
enforce_whitelist: public(bool) | ||
|
||
whitelist: public(HashMap[address, bool]) | ||
|
||
default_deposit_limt: public(uint256) | ||
|
||
default_withdraw_limit: public(uint256) | ||
|
||
@external | ||
def __init__( | ||
default_deposit_limt: uint256, | ||
default_withdraw_limit: uint256, | ||
enforce_whitelist: bool | ||
): | ||
self.default_deposit_limt = default_deposit_limt | ||
self.default_withdraw_limit = default_withdraw_limit | ||
self.enforce_whitelist = enforce_whitelist | ||
|
||
@view | ||
@external | ||
def available_deposit_limit(receiver: address) -> uint256: | ||
if self.enforce_whitelist: | ||
if not self.whitelist[receiver]: | ||
return 0 | ||
|
||
if self.default_deposit_limt == MAX_UINT256: | ||
return MAX_UINT256 | ||
|
||
return self.default_deposit_limt - IVault(msg.sender).totalAssets() | ||
|
||
@view | ||
@external | ||
def available_withdraw_limit(owner: address, max_loss: uint256, strategies: DynArray[address, 10]) -> uint256: | ||
return self.default_withdraw_limit | ||
|
||
@external | ||
def set_whitelist(list: address): | ||
self.whitelist[list] = True | ||
|
||
@external | ||
def set_default_deposit_limit(limit: uint256): | ||
self.default_deposit_limt = limit | ||
|
||
@external | ||
def set_default_withdraw_limit(limit: uint256): | ||
self.default_withdraw_limit = limit | ||
|
||
@external | ||
def set_enforce_whitelist(enforce: bool): | ||
self.enforce_whitelist = enforce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.