def main(): badger = connect_badger() multisig = badger.paymentsMultisig safe = ApeSafe(multisig.address) payments = load_ltcc_recipients("data/ltcc_recipients.csv") payments.calc_totals() payments.print_recipients() abi = Sett.abi bBadger = safe.contract_from_abi( badger.getSett("native.badger").address, "Sett", abi ) usdcToken = safe.contract_from_abi( registry.tokens.usdc, "IERC20", interface.IERC20.abi ) badgerToken = safe.contract_from_abi( badger.token.address, "IERC20", interface.IERC20.abi ) # TODO: Do this in bBadger going forward - this is the way. # Approve treasury multi to stake # Deposit badger -> bBadger snap = BalanceSnapshotter( [badgerToken, bBadger, usdcToken], [multisig, badger.deployer, badger.rewardsEscrow], ) for recipient in payments.recipients: snap.add_account(recipient.address) snap.snap(name="Before bBadger Deposit") assert bBadger.approved(multisig) badger_total = payments.totals["badger"] assert badgerToken.balanceOf(multisig.address) >= badger_total bBadger_total = badger_to_bBadger(badger, badger_total) badgerToken.approve(bBadger, badger_total) assert badgerToken.allowance(multisig.address, bBadger.address) >= badger_total bBadger.deposit(badger_total) snap.snap(name="After bBadger Deposit") snap.diff_last_two() safe_tx = safe.multisend_from_receipts() safe.preview(safe_tx) data = safe.print_transaction(safe_tx) safe.post_transaction(safe_tx)
def main(): badger = connect_badger() multisig = badger.devMultisig safe = ApeSafe(multisig.address) payments = load_ltcc_recipients("scripts/actions/treasury/ltcc_recipients.csv") payments.print_recipients() abi = Sett.abi bBadger = safe.contract_from_abi( badger.getSett("native.badger").address, "Sett", abi ) usdcToken = safe.contract_from_abi(registry.tokens.usdc, "IERC20", interface.IERC20.abi) badgerToken = safe.contract_from_abi(badger.token.address, "IERC20", interface.IERC20.abi) # TODO: Do this in bBadger going forward - this is the way. # Approve treasury multi to stake # Deposit badger -> bBadger snap = BalanceSnapshotter( [badgerToken, bBadger, usdcToken], [multisig, badger.deployer, badger.rewardsEscrow] ) for recipient in payments.recipients: snap.add_account(recipient.address) snap.snap(name="Before Transfers") for recipient in payments.recipients: bBadger_amount = badger_to_bBadger(badger, recipient.get_amount("badger")) console.print(recipient.address, recipient.get_amount("badger"), bBadger_amount) diff = bBadger_amount - bBadger.balanceOf(multisig) console.print(bBadger.balanceOf(multisig), diff) if bBadger.balanceOf(multisig) < bBadger_amount: assert diff < Wei("0.1 ether") bBadger_amount = bBadger.balanceOf(multisig) # tx = usdcToken.transfer(recipient.address, recipient.get_amount("usdc")) tx = bBadger.transfer(recipient.address, bBadger_amount) snap.snap(name="After Transfers") snap.diff_last_two() safe_tx = safe.multisend_from_receipts() safe.preview(safe_tx) data = safe.print_transaction(safe_tx) safe.post_transaction(safe_tx)
def main(): badger = connect_badger() multisig = badger.paymentsMultisig safe = ApeSafe(multisig.address) helper = ApeSafeHelper(badger, safe) payments = load_ltcc_recipients("data/ltcc_recipients.csv") payments.calc_totals() payments.print_recipients() abi = Sett.abi bBadger = safe.contract_from_abi( badger.getSett("native.badger").address, "Sett", abi) usdcToken = safe.contract_from_abi(registry.tokens.usdc, "IERC20", interface.IERC20.abi) badgerToken = safe.contract_from_abi(badger.token.address, "IERC20", interface.IERC20.abi) snap = BalanceSnapshotter( [badgerToken, bBadger, usdcToken], [multisig, badger.deployer, badger.rewardsEscrow], ) snap.snap() # TODO: Do this in bBadger going forward - this is the way. # Approve treasury multi to stake # Deposit badger -> bBadger # console.print(f"Converting total of {val(payments.totals['badger'])} badger into bBadger") # badgerToken.approve(bBadger, payments.totals['badger']) # bBadger.deposit(payments.totals['badger']) # snap.snap() # snap.diff_last_two() # helper.publish() # return True for recipient in payments.recipients: snap.add_account(recipient.address) snap.snap(name="Before Transfers") for recipient in payments.recipients: bBadger_amount = badger_to_bBadger(badger, recipient.get_amount("badger")) console.print(recipient.address, recipient.get_amount("badger"), bBadger_amount) diff = bBadger_amount - bBadger.balanceOf(multisig) console.print(bBadger.balanceOf(multisig), diff) if bBadger.balanceOf(multisig) < bBadger_amount: assert diff < Wei("0.1 ether") bBadger_amount = bBadger.balanceOf(multisig) tx = usdcToken.transfer(recipient.address, recipient.get_amount("usdc")) tx = bBadger.transfer(recipient.address, bBadger_amount) snap.snap(name="After Transfers") snap.diff_last_two() helper.publish()