Skip to content

Commit

Permalink
Merge pull request #54 from ebtc-protocol/feat/pys-change-update
Browse files Browse the repository at this point in the history
feat: pys reward split control migrated to treasury timelock
  • Loading branch information
sajanrajdev authored May 28, 2024
2 parents 9d617d7 + dacf5db commit 1271b14
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 15 deletions.
22 changes: 16 additions & 6 deletions great_ape_safe/ape_api/ebtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def __init__(self, safe):
r.ebtc.lowsec_timelock,
interface.ITimelockControllerEnumerable,
)
self.treasury_timelock = safe.contract(
r.ebtc.treasury_timelock,
interface.ITimelockControllerEnumerable,
)
self.fee_recipient = self.active_pool.feeRecipientAddress()
self.security_multisig = r.ebtc_wallets.security_multisig
self.techops_multisig = r.ebtc_wallets.techops_multisig
Expand All @@ -100,6 +104,7 @@ class governanceRoles(Enum):
STETH_MARKET_RATE_SWITCHER = (
11 # PriceFeed+CDPManager: CollFeedSource & RedemptionFeeFloor
)
PYS_REWARD_SPLIT_SETTER = 12 # CDPManager: setStakingRewardSplit

self.governance_roles = governanceRoles

Expand Down Expand Up @@ -198,12 +203,6 @@ class governanceRoles(Enum):
},
],
governanceRoles.CDP_MANAGER_ALL.value: [
{
"target": self.cdp_manager,
"signature": self.governance_signatures[
"SET_STAKING_REWARD_SPLIT_SIG"
],
},
{
"target": self.cdp_manager,
"signature": self.governance_signatures[
Expand Down Expand Up @@ -305,6 +304,14 @@ class governanceRoles(Enum):
],
},
],
governanceRoles.PYS_REWARD_SPLIT_SETTER.value: [
{
"target": self.cdp_manager,
"signature": self.governance_signatures[
"SET_STAKING_REWARD_SPLIT_SIG"
],
},
],
}

# Mapping of the permissioned actors to their assigned roles
Expand All @@ -331,6 +338,9 @@ class governanceRoles(Enum):
governanceRoles.FALLBACK_CALLER_SETTER.value,
governanceRoles.STETH_MARKET_RATE_SWITCHER.value,
],
self.treasury_timelock.address: [
governanceRoles.PYS_REWARD_SPLIT_SETTER.value,
],
self.security_multisig: [
governanceRoles.PAUSER.value,
],
Expand Down
1 change: 1 addition & 0 deletions helpers/addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"ebtc_deployer": "0x5c42faC7eEa7e724986bB5e4F3B12912F046120a",
"highsec_timelock": "0xaDDeE229Bd103bb5B10C3CdB595A01c425dd3264",
"lowsec_timelock": "0xE2F2D9e226e5236BeC4531FcBf1A22A7a2bD0602",
"treasury_timelock": "0xf1B767381819A69094a2A5a715A99776a2701b73",
},
"ebtc_wallets": {
"security_multisig": "0xB3d3B6482fb50C82aa042A710775c72dfa23F7B4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"amount0": 2.8670865599999997,
"amount0": 4.04475594,
"amount1": 0.0,
"liquidity": 874666232502872,
"liquidity": 1233939528994692,
"lowerTick": 230370,
"tokenId": 697672,
"upperTick": 231040
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"amount0": 9.11512035,
"amount0": 13.82579788,
"amount1": 0.13817859615965897,
"liquidity": 18553782074000919,
"liquidity": 27999170803390134,
"lowerTick": 230270,
"tokenId": 697673,
"upperTick": 230370
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"amount0": 0.0,
"amount1": 9.115120380964626,
"liquidity": 18276785972035448,
"amount0": 0.18989810000000001,
"amount1": 13.82579793020361,
"liquidity": 28102887012382635,
"lowerTick": 230170,
"tokenId": 697674,
"upperTick": 230270
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"amount0": 0.0,
"amount1": 5.08213391877394,
"liquidity": 1550417341209950,
"amount1": 6.259803306083683,
"liquidity": 1909691431479813,
"lowerTick": 229500,
"tokenId": 697675,
"upperTick": 230170
Expand Down
92 changes: 92 additions & 0 deletions scripts/pys-changes/treasury_timelock_update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
from brownie import chain, web3

from great_ape_safe import GreatApeSafe

from helpers.addresses import r

from scripts.ebtc_governance_lens import main as ebtc_governance_lens

SALT = web3.solidityKeccak(
["string"], ["PYS_STAKING_REWARD_SPLIT_INTO_TREASURY_TIMELOCK"]
).hex()

# @note that txs are schedule individually due to timelock ui support (lack of batching support atm)
def main(sim=True):
# safe: security msig is a proposer in `highsec_timelock`
safe = GreatApeSafe(r.ebtc_wallets.security_multisig)
safe.init_ebtc()

print("SALT:", SALT)

# contracts
highsec_timelock = safe.ebtc.highsec_timelock
treasury_timelock = r.ebtc.treasury_timelock
auth = safe.ebtc.authority

# 1. disable role `CDP_MANAGER_ALL` (3) signature `SET_STAKING_REWARD_SPLIT_SIG`
disable_role_data = auth.setRoleCapability.encode_input(
safe.ebtc.governance_roles.CDP_MANAGER_ALL.value,
r.ebtc.cdp_manager,
safe.ebtc.governance_signatures["SET_STAKING_REWARD_SPLIT_SIG"],
False,
)
safe.ebtc.schedule_or_execute_timelock(
highsec_timelock, auth, disable_role_data, SALT
)

# 2. create new role `PYS_REWARD_SPLIT_SETTER` (12) provided to the treasury_timelock
set_user_role_data = auth.setUserRole.encode_input(
treasury_timelock,
safe.ebtc.governance_roles.PYS_REWARD_SPLIT_SETTER.value,
True,
)
safe.ebtc.schedule_or_execute_timelock(
highsec_timelock, auth, set_user_role_data, SALT
)

# 3. Set name for the new role as `CDPManager: setStakingRewardSplit`
set_role_name_data = auth.setRoleName.encode_input(
safe.ebtc.governance_roles.PYS_REWARD_SPLIT_SETTER.value,
"CDPManager: setStakingRewardSplit",
)
safe.ebtc.schedule_or_execute_timelock(
highsec_timelock, auth, set_role_name_data, SALT
)

# 4. enable role `STETH_MARKET_RATE_SWITCHER` (12) authority over signature `SET_STAKING_REWARD_SPLIT_SIG`
enable_pys_signature_data = auth.setRoleCapability.encode_input(
safe.ebtc.governance_roles.PYS_REWARD_SPLIT_SETTER.value,
r.ebtc.cdp_manager,
safe.ebtc.governance_signatures["SET_STAKING_REWARD_SPLIT_SIG"],
True,
)
safe.ebtc.schedule_or_execute_timelock(
highsec_timelock, auth, enable_pys_signature_data, SALT
)

# sim the exec after delay
if sim:
delay = highsec_timelock.getMinDelay() # 1 week
chain.sleep(delay + 1)
chain.mine()

# read point 1) above
assert True == safe.ebtc.schedule_or_execute_timelock(
highsec_timelock, auth, disable_role_data, SALT
)
# read point 2) above
assert True == safe.ebtc.schedule_or_execute_timelock(
highsec_timelock, auth, set_user_role_data, SALT
)
# read point 3) above
assert True == safe.ebtc.schedule_or_execute_timelock(
highsec_timelock, auth, set_role_name_data, SALT
)
# read point 4) above
assert True == safe.ebtc.schedule_or_execute_timelock(
highsec_timelock, auth, enable_pys_signature_data, SALT
)
ebtc_governance_lens()

else:
safe.post_safe_tx()

0 comments on commit 1271b14

Please sign in to comment.