-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from lidofinance/vote_2024_01_16
Vote 2024-01-16 & 2024-01-23
- Loading branch information
Showing
15 changed files
with
2,708 additions
and
11 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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,22 @@ | ||
from typing import Tuple | ||
from brownie import interface | ||
|
||
from utils.config import contracts | ||
from .easy_track import create_permissions | ||
|
||
|
||
def set_limit_parameters(registry_address: str, limit: int, period_duration_months: int) -> Tuple[str, str]: | ||
registry = interface.AllowedRecipientRegistry(registry_address) | ||
return (registry.address, registry.setLimitParameters.encode_input(limit, period_duration_months)) | ||
|
||
|
||
def update_spent_amount(registry_address: str, spent_amount: int) -> Tuple[str, str]: | ||
registry = interface.AllowedRecipientRegistry(registry_address) | ||
return (registry.address, registry.updateSpentAmount.encode_input(spent_amount)) | ||
|
||
|
||
def create_top_up_allowed_recipient_permission(registry_address: str) -> str: | ||
return ( | ||
create_permissions(contracts.finance, "newImmediatePayment") | ||
+ create_permissions(interface.AllowedRecipientRegistry(registry_address), "updateSpentAmount")[2:] | ||
) |
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,28 @@ | ||
from typing import Tuple | ||
from brownie import interface | ||
|
||
from utils.config import contracts | ||
|
||
|
||
def add_accounting_oracle_member(member: str, quorum: int) -> Tuple[str, str]: | ||
hash_consensus: interface.LidoOracle = contracts.hash_consensus_for_accounting_oracle | ||
|
||
return (hash_consensus.address, hash_consensus.addMember.encode_input(member, quorum)) | ||
|
||
|
||
def remove_accounting_oracle_member(member: str, quorum: int) -> Tuple[str, str]: | ||
hash_consensus: interface.LidoOracle = contracts.hash_consensus_for_accounting_oracle | ||
|
||
return (hash_consensus.address, hash_consensus.removeMember.encode_input(member, quorum)) | ||
|
||
|
||
def add_validators_exit_bus_oracle_member(member: str, quorum: int) -> Tuple[str, str]: | ||
hash_consensus: interface.LidoOracle = contracts.hash_consensus_for_validators_exit_bus_oracle | ||
|
||
return (hash_consensus.address, hash_consensus.addMember.encode_input(member, quorum)) | ||
|
||
|
||
def remove_validators_exit_bus_oracle_member(member: str, quorum: int) -> Tuple[str, str]: | ||
hash_consensus: interface.LidoOracle = contracts.hash_consensus_for_validators_exit_bus_oracle | ||
|
||
return (hash_consensus.address, hash_consensus.removeMember.encode_input(member, quorum)) |
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
51 changes: 51 additions & 0 deletions
51
utils/test/event_validators/allowed_recipients_registry.py
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,51 @@ | ||
from brownie.network.event import EventDict | ||
from .common import validate_events_chain | ||
|
||
|
||
def validate_set_limit_parameter_event( | ||
event: EventDict, limit: int, period_duration_month: int, period_start_timestamp: int | ||
): | ||
_events_chain = [ | ||
"LogScriptCall", | ||
"LogScriptCall", | ||
"CurrentPeriodAdvanced", | ||
"LimitsParametersChanged", | ||
"ScriptResult", | ||
] | ||
|
||
validate_events_chain([e.name for e in event], _events_chain) | ||
|
||
assert event.count("CurrentPeriodAdvanced") == 1 | ||
assert event["CurrentPeriodAdvanced"]["_periodStartTimestamp"] == period_start_timestamp | ||
|
||
assert event.count("LimitsParametersChanged") == 1 | ||
assert event["LimitsParametersChanged"]["_limit"] == limit | ||
assert event["LimitsParametersChanged"]["_periodDurationMonths"] == period_duration_month | ||
|
||
|
||
def validate_update_spent_amount_event( | ||
event: EventDict, | ||
already_spent_amount: int, | ||
spendable_balance_in_period: int, | ||
period_start_timestamp: int, | ||
period_end_timestamp: int, | ||
is_period_advanced: bool = False, | ||
): | ||
_events_chain = ( | ||
["LogScriptCall", "LogScriptCall", "CurrentPeriodAdvanced", "SpendableAmountChanged", "ScriptResult"] | ||
if is_period_advanced | ||
else ["LogScriptCall", "LogScriptCall", "SpendableAmountChanged", "ScriptResult"] | ||
) | ||
|
||
validate_events_chain([e.name for e in event], _events_chain) | ||
|
||
if is_period_advanced: | ||
assert event.count("CurrentPeriodAdvanced") == 1 | ||
assert event["CurrentPeriodAdvanced"]["_periodStartTimestamp"] == period_start_timestamp | ||
|
||
assert event.count("SpendableAmountChanged") == 1 | ||
assert event["SpendableAmountChanged"]["_alreadySpentAmount"] == already_spent_amount | ||
assert event["SpendableAmountChanged"]["_spendableBalance"] == spendable_balance_in_period | ||
assert event["SpendableAmountChanged"]["_spendableBalance"] == spendable_balance_in_period | ||
assert event["SpendableAmountChanged"]["_periodStartTimestamp"] == period_start_timestamp | ||
assert event["SpendableAmountChanged"]["_periodEndTimestamp"] == period_end_timestamp |