Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tests after ownership is transfer to assert behaviours #1395

Merged
merged 5 commits into from
Jan 24, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 46 additions & 3 deletions scripts/issue/1277/mint_controller_admin_update.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,60 @@
from brownie import accounts

from great_ape_safe import GreatApeSafe
from helpers.addresses import r


def main():
def main(verify_future_state=True):
safe = GreatApeSafe(r.badger_wallets.dev_multisig)

# contracts
controller = safe.contract(r.GatedMiniMeController)
timelock_gov = safe.contract(r.governance_timelock)

# tkns
badger = safe.contract(r.treasury_tokens.BADGER)
dai = safe.contract(r.treasury_tokens.DAI)

controller.transferOwnership(timelock_gov)

# guardian setup
timelock_gov.setGuardian(r.badger_wallets.techops_multisig)
if verify_future_state:
tl_gov = accounts.at(r.governance_timelock, force=True)

# mint
controller.mint(100e18, {"from": tl_gov})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use a variable to hold the magic value of 100e18


assert badger.balanceOf(tl_gov) == 100e18
petrovska-petro marked this conversation as resolved.
Show resolved Hide resolved

# claim tokens
bal_in_minime = dai.balanceOf(badger)

controller.claimTokens(r.treasury_tokens.DAI, {"from": tl_gov})

assert dai.balanceOf(tl_gov) == bal_in_minime

# disable minting
controller.disableMinting({"from": tl_gov})

assert controller.mintingEnabled() == False

# transfer ownership
controller.transferOwnership(
r.badger_wallets.treasury_vault_multisig, {"from": tl_gov}
)

assert controller.owner() == r.badger_wallets.treasury_vault_multisig

# erc20 basic samples
holder_one = accounts.at(r.badger_wallets.treasury_vault_multisig, force=True)
holder_two = accounts.at(r.badger_wallets.treasury_ops_multisig, force=True)

# check basic transfer and balance updates
holder_one_bal_before = badger.balanceOf(holder_one)
holder_two_bal_before = badger.balanceOf(holder_two)

badger.transfer(holder_two, 5e18, {"from": holder_one})

assert badger.balanceOf(holder_two) == holder_two_bal_before + 5e18

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use a variable to hold the magic value of 5e18

assert badger.balanceOf(holder_one) == holder_one_bal_before - 5e18

safe.post_safe_tx()
Loading