Skip to content

Commit

Permalink
Merge branch 'main' into feat/merkl-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
sajanrajdev authored Mar 22, 2024
2 parents 68f972f + 8d4ad3f commit 6513db4
Show file tree
Hide file tree
Showing 16 changed files with 950 additions and 144 deletions.
36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,35 @@ brownie networks import network-config.yaml
brownie test --network sepolia-fork
```

## Multisig Addresses

To be deployed
## eBTC TechOps Signers

The following is a list of all signers on eBTC HighSec and LowSec TechOps:

| Signer | Profiles | Address |
|-|-|-|
| dapp-whisperer | [GitHub](https://github.com/dapp-whisperer/) | `0xaF94D299a73c4545ff702E79D16d9fb1AB5BDAbF` |
| saj | [GitHub](https://github.com/sajanrajdev) | `0xfA5bb45895Cb3C0aE5B1583Fe068f009A48F0187` |
| mrbasado | [GitHub](https://github.com/mrbasado) | `0xE78e3E1668D42FfCa767e22e57d7d249e02B5F0e` |
| jwei | [GitHub](https://github.com/wtj2021) | `0xDA82F543613f90deA718c46D02Ca15e05e88e4aC` |
| abdullah | [GitHub](https://github.com/abdullah-almesbahi) | `0xE2C5B2008d9cc8F8E1FDa8552f7df63Af1f747f8` |
| adcv | [Twitter](https://twitter.com/adcv_) | `0xcC692077C65dd464cAA7e7ae614328914f8469b3` |
| monetsupply | [Twitter](https://twitter.com/MonetSupply) | `0x20359b5f320Ee24FA0B1000D80DAc4aFBF49738C` |

## Treasury Signers

The following is a list of all Treasury Council members and therefore the signers on `treasuryvault.badgerdao.eth`, `treasuryops.badgerdao.eth`, `treasuryvoter.badgerdao.eth` and `ebtcfeerecipient.badgerdao.eth`:

| Signer | Profiles | Address |
|-|-|-|
| petrovska | [GitHub](https://github.com/petrovska-petro) | `0x0a9af7FAba0d5DF7A8C881e1B9cd679ee07Af8A2` |
| adcv | [Twitter](https://twitter.com/adcv_) | `0x2afc096981c2CFe3501bE4054160048718F6C0C8` |
| 1500$Badger | [Twitter](https://twitter.com/haal69k) | `0x66496eBB9d848C6A8F19612a6Dd10E09954532D0` |
| gosuto | [GitHub](https://github.com/gosuto-inzasheru/) | `0x6C6238309f4f36DFF9942e655A678bbd4EA3BC5d` |
| Po | [Forum](https://forum.badger.finance/u/mr_po/summary) | `0x9c8C8bcD625Ed2903823b0b60DeaB2D70B92aFd9` |
| lipp | [Twitter](https://twitter.com/lipp_brian) | `0xaC7B5f4E631b7b5638B9b41d07f1eBED30753f16` |
| dapp-whisperer | [GitHub](https://github.com/dapp-whisperer/) | `0xaF94D299a73c4545ff702E79D16d9fb1AB5BDAbF` |
| saj | [GitHub](https://github.com/sajanrajdev) | `0xD10617AE4Da733d79eF0371aa44cd7fa74C41f6B` |
| Freddy the Filosopher | [Forum](https://forum.badger.finance/u/freddythefilosopher/summary) | `0xaFD01c6161729aa857404763c9577498327c6Aee` |

## eBTC Governance Operations Instructions

Expand Down Expand Up @@ -229,9 +255,9 @@ These operations are executed by the High Sec TechOps multisig with a Low Sec Ti
*Example:* `brownie run scripts/ebtc_governance.py ebtcFeed_set_primary_oracle 0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1`

### Timelock Salt
All Timelock scripts accept an optional *salt* at the end of their parameter list, a unique 32-byte identifier that allows for the distinction of transactions. This is especially useful for queuing transactions that are identical in contract, changes, and values to previous ones. To ensure the correct execution of a scheduled transaction that includes a salt, this same salt must be repeated during the execution phase.
All Timelock scripts accept an optional *salt* at the end of their parameter list, a unique integer identifier that allows for the distinction of transactions. This is especially useful for queuing transactions that are identical in contract, changes, and values to previous ones. To ensure the correct execution of a scheduled transaction that includes a salt, this same salt must be repeated during the execution phase. Note that these scripts convert the salt integers into 32 byte strings, as this is the format expected by the Timelock contracts.

*Example:* `brownie run scripts/ebtc_governance.py borrowerOperations_set_fee_bps 3000 0x0000000000000000000000000000000000000000000000000000000000000001`
*Example:* `brownie run scripts/ebtc_governance.py borrowerOperations_set_fee_bps 3000 1`

### EMERGENCY: Pausing Operations

Expand Down
16 changes: 0 additions & 16 deletions brownie-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,3 @@ networks:
default: mainnet-fork

dotenv: .env

dependencies:
- OpenZeppelin/openzeppelin-contracts@4.5.0
- OpenZeppelin/openzeppelin-contracts-upgradeable@3.4.0 # this is latest for sol v0.6
- smartcontractkit/chainlink@1.6.0
- Uniswap/v3-core@1.0.0
- Uniswap/v3-periphery@1.3.0

compiler:
solc:
remappings:
- "@openzeppelin=OpenZeppelin/openzeppelin-contracts@4.5.0"
- "@openzeppelin-upgradeable=OpenZeppelin/openzeppelin-contracts-upgradeable@3.4.0"
- "@chainlink=smartcontractkit/chainlink@1.6.0"
- "@uniswap/v3-core=Uniswap/v3-core@1.0.0"
- "@uniswap/v3-periphery=Uniswap/v3-periphery@1.3.0"
85 changes: 85 additions & 0 deletions data/authority_audit/authority_audit_sepolia-fork_1709915732.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
Role,Name,User Addresses,User IDs,Target,Target ID,Function
0,Admin,0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb,sepolia_ebtc_highsec_timelock,"0x85A074FF5adDf47fD66c94C780E7596922B3d1D9
0x85A074FF5adDf47fD66c94C780E7596922B3d1D9
0x85A074FF5adDf47fD66c94C780E7596922B3d1D9
0x85A074FF5adDf47fD66c94C780E7596922B3d1D9
0x85A074FF5adDf47fD66c94C780E7596922B3d1D9
0x85A074FF5adDf47fD66c94C780E7596922B3d1D9
0x85A074FF5adDf47fD66c94C780E7596922B3d1D9","sepolia_ebtc_authority
sepolia_ebtc_authority
sepolia_ebtc_authority
sepolia_ebtc_authority
sepolia_ebtc_authority
sepolia_ebtc_authority
sepolia_ebtc_authority","SET_ROLE_NAME_SIG
SET_USER_ROLE_SIG
SET_ROLE_CAPABILITY_SIG
SET_PUBLIC_CAPABILITY_SIG
BURN_CAPABILITY_SIG
TRANSFER_OWNERSHIP_SIG
SET_AUTHORITY_SIG"
1,eBTCToken: mint,,,0xeA2D83AA5e7da0668AdbddADAAc28e51318DDd86,sepolia_assets_ebtc,MINT_SIG
2,eBTCToken: burn,,,"0xeA2D83AA5e7da0668AdbddADAAc28e51318DDd86
0xeA2D83AA5e7da0668AdbddADAAc28e51318DDd86","sepolia_assets_ebtc
sepolia_assets_ebtc","BURN_SIG
BURN2_SIG"
3,CDPManager: all,"0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb
0xaADf07C98E2420E4d995Ba41Db53399648f50076","sepolia_ebtc_highsec_timelock
sepolia_ebtc_lowsec_timelock","0x39D6613ABEDd78a0b8edEEfE62cDEc85FCbe08c0
0x39D6613ABEDd78a0b8edEEfE62cDEc85FCbe08c0
0x39D6613ABEDd78a0b8edEEfE62cDEc85FCbe08c0
0x39D6613ABEDd78a0b8edEEfE62cDEc85FCbe08c0
0x39D6613ABEDd78a0b8edEEfE62cDEc85FCbe08c0","sepolia_ebtc_cdp_manager
sepolia_ebtc_cdp_manager
sepolia_ebtc_cdp_manager
sepolia_ebtc_cdp_manager
sepolia_ebtc_cdp_manager","SET_STAKING_REWARD_SPLIT_SIG
SET_REDEMPTION_FEE_FLOOR_SIG
SET_MINUTE_DECAY_FACTOR_SIG
SET_BETA_SIG
SET_GRACE_PERIOD_SIG"
4,CDPManager+BorrowerOperations+ActivePool: pause,"0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb
0xaADf07C98E2420E4d995Ba41Db53399648f50076
0xC8A7768D2a9EE15437c981a7130268622083c2BD
0x664F43229dDa9fdEE00e723753f88f3Ba81967F6","sepolia_ebtc_highsec_timelock
sepolia_ebtc_lowsec_timelock
sepolia_ebtc_wallets_security_multisig
sepolia_ebtc_wallets_techops_multisig","0x39D6613ABEDd78a0b8edEEfE62cDEc85FCbe08c0
0x3D6697c8Cfcc36b68a3077d0a94385B8904B1299
0x8EbA6a17Fcd480A96a87308C560170206186D3EA","sepolia_ebtc_cdp_manager
sepolia_ebtc_borrower_operations
sepolia_ebtc_active_pool","SET_REDEMPTIONS_PAUSED_SIG
SET_FLASH_LOANS_PAUSED_SIG
SET_FLASH_LOANS_PAUSED_SIG"
5,BorrowerOperations+ActivePool: setFeeBps,"0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb
0xaADf07C98E2420E4d995Ba41Db53399648f50076","sepolia_ebtc_highsec_timelock
sepolia_ebtc_lowsec_timelock","0x3D6697c8Cfcc36b68a3077d0a94385B8904B1299
0x8EbA6a17Fcd480A96a87308C560170206186D3EA","sepolia_ebtc_borrower_operations
sepolia_ebtc_active_pool","SET_FEE_BPS_SIG
SET_FEE_BPS_SIG"
6,ActivePool+CollSurplusPool: sweepToken,"0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb
0xaADf07C98E2420E4d995Ba41Db53399648f50076
0x5C1246E0b464060919301273781a266Ac119A0Bb","sepolia_ebtc_highsec_timelock
sepolia_ebtc_lowsec_timelock
sepolia_ebtc_wallets_fee_recipient_multisig","0x8EbA6a17Fcd480A96a87308C560170206186D3EA
0x6a6Ee2146f851fA745016B9e5592379f775b4ff3","sepolia_ebtc_active_pool
sepolia_ebtc_coll_surplus_pool","SWEEP_TOKEN_SIG
SWEEP_TOKEN_SIG"
7,ActivePool: claimFeeRecipientCollShares,"0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb
0xaADf07C98E2420E4d995Ba41Db53399648f50076
0x5C1246E0b464060919301273781a266Ac119A0Bb","sepolia_ebtc_highsec_timelock
sepolia_ebtc_lowsec_timelock
sepolia_ebtc_wallets_fee_recipient_multisig",0x8EbA6a17Fcd480A96a87308C560170206186D3EA,sepolia_ebtc_active_pool,CLAIM_FEE_RECIPIENT_COLL_SIG
8,EbtcFeed: setPrimaryOracle,0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb,sepolia_ebtc_highsec_timelock,0x14BBa0A866f49D1ef33096557e661bE20BeBADA0,sepolia_ebtc_ebtc_feed,SET_PRIMARY_ORACLE_SIG
9,EbtcFeed: setSecondaryOracle,"0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb
0xaADf07C98E2420E4d995Ba41Db53399648f50076","sepolia_ebtc_highsec_timelock
sepolia_ebtc_lowsec_timelock",0x14BBa0A866f49D1ef33096557e661bE20BeBADA0,sepolia_ebtc_ebtc_feed,SET_SECONDARY_ORACLE_SIG
10,PriceFeed: setFallbackCaller,"0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb
0xaADf07C98E2420E4d995Ba41Db53399648f50076","sepolia_ebtc_highsec_timelock
sepolia_ebtc_lowsec_timelock",0xd2Bdc5Acb219ECeEE3578DA86774BBE4dd85665E,sepolia_ebtc_price_feed,SET_FALLBACK_CALLER_SIG
11,PriceFeed+CDPManager: CollFeedSource & RedemptionFeeFloor,"0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb
0xaADf07C98E2420E4d995Ba41Db53399648f50076","sepolia_ebtc_highsec_timelock
sepolia_ebtc_lowsec_timelock","0x39D6613ABEDd78a0b8edEEfE62cDEc85FCbe08c0
0xd2Bdc5Acb219ECeEE3578DA86774BBE4dd85665E","sepolia_ebtc_cdp_manager
sepolia_ebtc_price_feed","SET_REDEMPTION_FEE_FLOOR_SIG
SET_COLLATERAL_FEED_SOURCE_SIG"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
,timelock_contract,role,role_admin,member_number,member_address,member_id
0,highsec_timelock,TIMELOCK_ADMIN_ROLE,TIMELOCK_ADMIN_ROLE,0,0x0393846e97ab5Ec1DC8CB7A59Ee8505F72A6aEEb,sepolia_ebtc_highsec_timelock
1,highsec_timelock,TIMELOCK_ADMIN_ROLE,TIMELOCK_ADMIN_ROLE,1,0xC8A7768D2a9EE15437c981a7130268622083c2BD,sepolia_ebtc_wallets_security_multisig
2,highsec_timelock,PROPOSER_ROLE,TIMELOCK_ADMIN_ROLE,0,0xC8A7768D2a9EE15437c981a7130268622083c2BD,sepolia_ebtc_wallets_security_multisig
3,highsec_timelock,CANCELLER_ROLE,TIMELOCK_ADMIN_ROLE,0,0xC8A7768D2a9EE15437c981a7130268622083c2BD,sepolia_ebtc_wallets_security_multisig
4,highsec_timelock,EXECUTOR_ROLE,TIMELOCK_ADMIN_ROLE,0,0xC8A7768D2a9EE15437c981a7130268622083c2BD,sepolia_ebtc_wallets_security_multisig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
,timelock_contract,role,role_admin,member_number,member_address,member_id
0,lowsec_timelock,TIMELOCK_ADMIN_ROLE,TIMELOCK_ADMIN_ROLE,0,0xaADf07C98E2420E4d995Ba41Db53399648f50076,sepolia_ebtc_lowsec_timelock
1,lowsec_timelock,TIMELOCK_ADMIN_ROLE,TIMELOCK_ADMIN_ROLE,1,0xC8A7768D2a9EE15437c981a7130268622083c2BD,sepolia_ebtc_wallets_security_multisig
2,lowsec_timelock,PROPOSER_ROLE,TIMELOCK_ADMIN_ROLE,0,0xC8A7768D2a9EE15437c981a7130268622083c2BD,sepolia_ebtc_wallets_security_multisig
3,lowsec_timelock,PROPOSER_ROLE,TIMELOCK_ADMIN_ROLE,1,0x664F43229dDa9fdEE00e723753f88f3Ba81967F6,sepolia_ebtc_wallets_techops_multisig
4,lowsec_timelock,CANCELLER_ROLE,TIMELOCK_ADMIN_ROLE,0,0xC8A7768D2a9EE15437c981a7130268622083c2BD,sepolia_ebtc_wallets_security_multisig
5,lowsec_timelock,CANCELLER_ROLE,TIMELOCK_ADMIN_ROLE,1,0x664F43229dDa9fdEE00e723753f88f3Ba81967F6,sepolia_ebtc_wallets_techops_multisig
6,lowsec_timelock,EXECUTOR_ROLE,TIMELOCK_ADMIN_ROLE,0,0xC8A7768D2a9EE15437c981a7130268622083c2BD,sepolia_ebtc_wallets_security_multisig
7,lowsec_timelock,EXECUTOR_ROLE,TIMELOCK_ADMIN_ROLE,1,0x664F43229dDa9fdEE00e723753f88f3Ba81967F6,sepolia_ebtc_wallets_techops_multisig
66 changes: 27 additions & 39 deletions great_ape_safe/ape_api/ebtc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from datetime import datetime
from enum import Enum

from brownie import interface, web3
from brownie import interface, chain
from rich.console import Console
from helpers.addresses import registry
from helpers.addresses import registry, r
from helpers.utils import encode_signature, approx
from helpers.constants import (
EmptyBytes32,
Expand Down Expand Up @@ -37,56 +37,46 @@ def __init__(self, safe):
self.LIQUIDATOR_REWARD = 2e17

# contracts
self.collateral = safe.contract(
registry.sepolia.ebtc.collateral, interface.ICollateralTokenTester
)
self.authority = safe.contract(
registry.sepolia.ebtc.authority, interface.IGovernor
)
if chain.id == 1:
self.collateral = safe.contract(r.ebtc.collateral, interface.ILido)
self.price_feed = safe.contract(r.ebtc.price_feed, interface.IPriceFeed)
else:
self.collateral = safe.contract(
r.ebtc.collateral, interface.ICollateralTokenTester
)
self.price_feed = safe.contract(
r.ebtc.price_feed, interface.IPriceFeedTestnet
)
self.authority = safe.contract(r.ebtc.authority, interface.IGovernor)
self.liquidation_library = safe.contract(
registry.sepolia.ebtc.liquidation_library, interface.ILiquidationLibrary
)
self.cdp_manager = safe.contract(
registry.sepolia.ebtc.cdp_manager, interface.ICdpManager
r.ebtc.liquidation_library, interface.ILiquidationLibrary
)
self.cdp_manager = safe.contract(r.ebtc.cdp_manager, interface.ICdpManager)
self.borrower_operations = safe.contract(
registry.sepolia.ebtc.borrower_operations, interface.IBorrowerOperations
)
self.ebtc_token = safe.contract(
registry.sepolia.ebtc.ebtc_token, interface.IEBTCToken
)
self.price_feed = safe.contract(
registry.sepolia.ebtc.price_feed, interface.IPriceFeedTestnet
)
self.ebtc_feed = safe.contract(
registry.sepolia.ebtc.ebtc_feed, interface.IEbtcFeed
)
self.active_pool = safe.contract(
registry.sepolia.ebtc.active_pool, interface.IActivePool
r.ebtc.borrower_operations, interface.IBorrowerOperations
)
self.ebtc_token = safe.contract(r.ebtc.ebtc_token, interface.IEBTCToken)
self.ebtc_feed = safe.contract(r.ebtc.ebtc_feed, interface.IEbtcFeed)
self.active_pool = safe.contract(r.ebtc.active_pool, interface.IActivePool)
self.coll_surplus_pool = safe.contract(
registry.sepolia.ebtc.coll_surplus_pool, interface.ICollSurplusPool
)
self.sorted_cdps = safe.contract(
registry.sepolia.ebtc.sorted_cdps, interface.ISortedCdps
)
self.hint_helpers = safe.contract(
registry.sepolia.ebtc.hint_helpers, interface.IHintHelpers
r.ebtc.coll_surplus_pool, interface.ICollSurplusPool
)
self.sorted_cdps = safe.contract(r.ebtc.sorted_cdps, interface.ISortedCdps)
self.hint_helpers = safe.contract(r.ebtc.hint_helpers, interface.IHintHelpers)
self.multi_cdp_getter = safe.contract(
registry.sepolia.ebtc.multi_cdp_getter, interface.IMultiCdpGetter
r.ebtc.multi_cdp_getter, interface.IMultiCdpGetter
)
self.highsec_timelock = safe.contract(
registry.sepolia.ebtc.highsec_timelock,
r.ebtc.highsec_timelock,
interface.ITimelockControllerEnumerable,
)
self.lowsec_timelock = safe.contract(
registry.sepolia.ebtc.lowsec_timelock,
r.ebtc.lowsec_timelock,
interface.ITimelockControllerEnumerable,
)
self.fee_recipient = self.active_pool.feeRecipientAddress()
self.security_multisig = registry.sepolia.ebtc_wallets.security_multisig
self.techops_multisig = registry.sepolia.ebtc_wallets.techops_multisig
self.security_multisig = r.ebtc_wallets.security_multisig
self.techops_multisig = r.ebtc_wallets.techops_multisig

##################################################################
##
Expand Down Expand Up @@ -1592,9 +1582,7 @@ def cdp_withdraw_debt(self, cdp_id, debt_withdrawable_amount):
sync_tcr = self.cdp_manager.getSyncedTCR(feed_price)
assert sync_tcr > self.CCR

# verify: existing debt in cdp id is greater than amount to wd
debt_before = self.cdp_manager.getCdpDebt(cdp_id)
assert debt_before > debt_withdrawable_amount

prev_icr = self.cdp_manager.getSyncedICR(cdp_id, feed_price)

Expand Down
Loading

0 comments on commit 6513db4

Please sign in to comment.