-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deposit limit module events (#43)
* feat: added deposit limit events * test: adding unit tests for events
- Loading branch information
Showing
3 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -2,22 +2,48 @@ | |
|
||
""" | ||
@title Temporary Deposit Limit Module for yearn vaults | ||
@notice This contract temporarily controls deposits into a yearn vault and manages roles (admin and security_agent). | ||
@dev Admins can appoint new admins and security_agents, while security_agents can pause or resume deposits. | ||
This module will be removed once the vault is battle-tested and proven stable. | ||
@notice This contract temporarily controls deposits into a yearn vault and | ||
manages roles (admin and security_agent). | ||
@dev Admins can appoint new admins and security_agents, while security_agents | ||
can pause or resume deposits. This module will be removed once the vault is | ||
battle-tested and proven stable. | ||
@license Copyright (c) Curve.Fi, 2020-2024 - all rights reserved | ||
@author curve.fi | ||
@custom:security [email protected] | ||
""" | ||
|
||
|
||
################################################################ | ||
# INTERFACES # | ||
################################################################ | ||
|
||
|
||
from interfaces import IVault | ||
|
||
|
||
################################################################ | ||
# EVENTS # | ||
################################################################ | ||
|
||
|
||
event DepositsPaused: | ||
status: bool | ||
|
||
|
||
event DepositLimitChanged: | ||
new_deposit_limit: uint256 | ||
|
||
|
||
################################################################ | ||
# STORAGE # | ||
################################################################ | ||
|
||
|
||
# Two main roles: admin and security_agent | ||
is_admin: public(HashMap[address, bool]) | ||
is_security_agent: public(HashMap[address, bool]) | ||
|
@@ -31,10 +57,12 @@ max_deposit_limit: public(uint256) | |
# Stablecoin/Vault addresses | ||
vault: public(immutable(IVault)) | ||
|
||
|
||
################################################################ | ||
# CONSTRUCTOR # | ||
################################################################ | ||
|
||
|
||
@deploy | ||
def __init__( | ||
_vault: IVault, | ||
|
@@ -56,6 +84,7 @@ def __init__( | |
# INTERNAL FUNCTIONS # | ||
################################################################ | ||
|
||
|
||
@internal | ||
def _set_admin(_address: address, is_admin: bool): | ||
""" | ||
|
@@ -84,6 +113,8 @@ def _set_deposits_paused(is_paused: bool): | |
""" | ||
self.deposits_paused = is_paused | ||
|
||
log DepositsPaused(is_paused) | ||
|
||
|
||
@internal | ||
def _set_deposit_limit(new_limit: uint256): | ||
|
@@ -93,11 +124,14 @@ def _set_deposit_limit(new_limit: uint256): | |
""" | ||
self.max_deposit_limit = new_limit | ||
|
||
log DepositLimitChanged(new_limit) | ||
|
||
|
||
################################################################ | ||
# EXTERNAL FUNCTIONS # | ||
################################################################ | ||
|
||
|
||
@external | ||
def set_admin(new_admin: address, is_admin: bool): | ||
""" | ||
|
@@ -148,6 +182,7 @@ def set_deposit_limit(new_limit: uint256): | |
# VIEW FUNCTIONS # | ||
################################################################ | ||
|
||
|
||
@view | ||
@external | ||
def available_deposit_limit(receiver: address) -> uint256: | ||
|
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