Skip to content

Commit

Permalink
Add runlog (#2049)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahthepro authored May 6, 2024
1 parent 553e168 commit a7457ec
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions brownie/runlogs/2024_05_strategist.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,44 @@ def main():
print("Sell 100 OETH Curve prices before and after", "{:.6f}".format(eth_out_before / 10**18), "{:.6f}".format(eth_out_after / 10**18))
print("Curve ETH and OETH balances before", "{:.6f}".format(balances_before[0] / 10**18), "{:.6f}".format(balances_before[1] / 10**18))
print("Curve ETH and OETH balances after", "{:.6f}".format(balances_after[0] / 10**18), "{:.6f}".format(balances_after[1] / 10**18))

# -------------------------------------
# May 6, 2024 - rETH to stETH
# -------------------------------------
from collateralSwap import *

def main():
with TemporaryForkForReallocations() as txs:
try:
# Before
txs.append(vault_oeth_core.rebase(std))
txs.append(oeth_vault_value_checker.takeSnapshot(std))

# Withdraw all WETH from Morpho Aave
txs.append(
vault_oeth_admin.withdrawAllFromStrategy(
OETH_MORPHO_AAVE_STRAT,
std
)
)

# Swap all rETH to stETH
# Full sweep fails, so leaves some dust
reth_balance = reth.balanceOf(VAULT_OETH_PROXY_ADDRESS) - 1e4
_, swap_data = build_swap_tx(RETH, STETH, reth_balance, 0.1, False)
decoded_input = oeth_vault_core.swapCollateral.decode_input(swap_data)
txs.append(
oeth_vault_core.swapCollateral(*decoded_input, std)
)

# After
vault_change = vault_oeth_core.totalValue() - oeth_vault_value_checker.snapshots(STRATEGIST)[0]
supply_change = oeth.totalSupply() - oeth_vault_value_checker.snapshots(STRATEGIST)[1]
profit = vault_change - supply_change
txs.append(oeth_vault_value_checker.checkDelta(profit, (1 * 10**18), vault_change, (1 * 10**18), std))
print("-----")
print("Profit", "{:.6f}".format(profit / 10**18), profit)
print("OETH supply change", "{:.6f}".format(supply_change / 10**18), supply_change)
print("Vault Change", "{:.6f}".format(vault_change / 10**18), vault_change)
except:
brownie.chain.revert()

0 comments on commit a7457ec

Please sign in to comment.