-
Notifications
You must be signed in to change notification settings - Fork 33
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 #1427 from Badger-Finance/feat/ibbtc-signers-change
feat: swap ibbtc signers for Trops'
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from brownie import interface | ||
from great_ape_safe import GreatApeSafe | ||
from helpers.addresses import r | ||
from rich.console import Console | ||
|
||
C = Console() | ||
|
||
SENTINEL_OWNERS = "0x0000000000000000000000000000000000000001" | ||
|
||
|
||
def main(): | ||
safe = GreatApeSafe(r.badger_wallets.ibbtc_multisig) | ||
ibbtc_multisig = interface.IGnosisSafe_v1_3_0(safe.address, owner=safe.account) | ||
trops_multisig = interface.IGnosisSafe_v1_3_0( | ||
r.badger_wallets.treasury_ops_multisig | ||
) | ||
|
||
trops_owners = trops_multisig.getOwners() | ||
ibbtc_owners = ibbtc_multisig.getOwners() | ||
|
||
unique_to_ibbtc = list(set(ibbtc_owners).difference(set(trops_owners))) | ||
unique_to_trops = list(set(trops_owners).difference(set(ibbtc_owners))) | ||
|
||
# Swap out any unique addresses to ibBTC | ||
for i in range(len(unique_to_ibbtc)): | ||
C.print(f"Swapping {unique_to_ibbtc[i]} for {unique_to_trops[i]}...") | ||
|
||
ibbtc_multisig.swapOwner( | ||
get_previous_owner(ibbtc_multisig, unique_to_ibbtc[i]), | ||
unique_to_ibbtc[i], | ||
unique_to_trops[i], | ||
) | ||
|
||
# Add any missing owners | ||
ibbtc_owners = ibbtc_multisig.getOwners() | ||
for owner in trops_owners: | ||
if owner not in ibbtc_owners: | ||
ibbtc_multisig.addOwnerWithThreshold(owner, 3) | ||
|
||
# Confirm all owners | ||
for owner in ibbtc_multisig.getOwners(): | ||
assert owner in trops_owners | ||
assert len(ibbtc_multisig.getOwners()) == len(trops_owners) | ||
|
||
C.print(f"\nNew Owners at ibbtc_multisig Multisig:") | ||
C.print(f"[green]{ibbtc_multisig.getOwners()}[/green]\n") | ||
|
||
safe.post_safe_tx() | ||
|
||
|
||
def get_previous_owner(safe, owner): | ||
owners = safe.getOwners() | ||
for i in range(len(owners)): | ||
if owners[i] == owner: | ||
if i == 0: | ||
return SENTINEL_OWNERS | ||
else: | ||
return owners[i - 1] |