Skip to content

Commit

Permalink
Merge branch 'master' into shah/l2-governance
Browse files Browse the repository at this point in the history
  • Loading branch information
shahthepro committed Mar 21, 2024
2 parents 71a30ef + e62e925 commit edf9614
Show file tree
Hide file tree
Showing 37 changed files with 2,765 additions and 934 deletions.
669 changes: 669 additions & 0 deletions brownie/abi/frxeth_redeem_strat.json

Large diffs are not rendered by default.

141 changes: 141 additions & 0 deletions brownie/runlogs/2024_03_strategist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# -------------------------------
# Mar 13, 2024 - OUSD Allocation
# -------------------------------
from world import *

def main():
with TemporaryForkForReallocations() as txs:
# Before
txs.append(vault_core.rebase({'from':STRATEGIST}))
txs.append(vault_value_checker.takeSnapshot({'from':STRATEGIST}))

# Withdraw all USDC and USDT from Flux
txs.append(
vault_admin.withdrawFromStrategy(
FLUX_STRAT,
[usdt, usdc],
[flux_strat.checkBalance(usdt), flux_strat.checkBalance(usdc)],
{'from': STRATEGIST}
)
)

# Put everything in Morpho Aave (default strategy for USDC and USDT)
txs.append(vault_core.allocate({'from': STRATEGIST}))

# After
vault_change = vault_core.totalValue() - vault_value_checker.snapshots(STRATEGIST)[0]
supply_change = ousd.totalSupply() - vault_value_checker.snapshots(STRATEGIST)[1]
profit = vault_change - supply_change

txs.append(vault_value_checker.checkDelta(profit, (500 * 10**18), vault_change, (500 * 10**18), {'from': STRATEGIST}))
print("-----")
print("Profit", "{:.6f}".format(profit / 10**18), profit)
print("Vault Change", "{:.6f}".format(vault_change / 10**18), vault_change)

# ---------------------------------
# Mar 14, 2024 - Move out from Flux
# ---------------------------------
from world import *

def main():
with TemporaryForkForReallocations() as txs:
# Before
txs.append(vault_core.rebase({'from':STRATEGIST}))
txs.append(vault_value_checker.takeSnapshot({'from':STRATEGIST}))

# Withdraw all from Flux (including dust)
txs.append(
vault_admin.withdrawAllFromStrategy(
FLUX_STRAT,
{'from': STRATEGIST}
)
)

# Put everything in Morpho Aave (default strategy for USDC and USDT)
txs.append(vault_core.allocate({'from': STRATEGIST}))

# After
vault_change = vault_core.totalValue() - vault_value_checker.snapshots(STRATEGIST)[0]
supply_change = ousd.totalSupply() - vault_value_checker.snapshots(STRATEGIST)[1]
profit = vault_change - supply_change

txs.append(vault_value_checker.checkDelta(profit, (500 * 10**18), vault_change, (500 * 10**18), {'from': STRATEGIST}))
print("-----")
print("Profit", "{:.6f}".format(profit / 10**18), profit)
print("Vault Change", "{:.6f}".format(vault_change / 10**18), vault_change)

# -------------------------------------
# Mar 15, 2024 - OETH Buyback
# -------------------------------------
from buyback import *

def main():
txs = []

with TemporaryFork():
txs.append(
build_buyback_tx(
OETH,
oeth.balanceOf(OETH_BUYBACK),
max_ogv_slippage=3,
max_cvx_slippage=10
)
)

txs.append(
cvx_locker.processExpiredLocks(True, std)
)

print(to_gnosis_json(txs))

# -------------------------------------
# Mar 15, 2024 - OETH Reallocation
# -------------------------------------
from world import *

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

# Deposit 467 rETH and 230 WERH to the Balancer strategy
txs.append(
vault_oeth_admin.depositToStrategy(
BALANCER_RETH_STRATEGY,
[reth, WETH],
[467.04342 * 10**18, 230.56953 * 10**18],
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)
print("-----")

# -------------------------------------
# Mar 18, 2024 - OUSD Buyback
# -------------------------------------
from buyback import *

def main():
txs = []

with TemporaryFork():
txs.append(
build_buyback_tx(
OUSD,
ousd.balanceOf(OUSD_BUYBACK),
max_ogv_slippage=3,
max_cvx_slippage=6
)
)

print(to_gnosis_json(txs))
1 change: 1 addition & 0 deletions brownie/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def load_contract(name, address):
lusd_3pool_strat = load_contract('lusd_3pool_strat', LUSD_3POOL_STRAT)
oeth_morpho_aave_strat = load_contract('morpho_aave_strat', OETH_MORPHO_AAVE_STRAT)
oeth_meta_strat = load_contract('oeth_meta_strat', OETH_CONVEX_OETH_ETH_STRAT)
flux_strat = load_contract('comp_strat', FLUX_STRAT)

ousd_metapool = load_contract("ousd_metapool", OUSD_METAPOOL)
threepool = load_contract("threepool_swap", THREEPOOL)
Expand Down
8 changes: 8 additions & 0 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,14 @@ There's an example
npx hardhat --network mainnet verify --contract contracts/vault/VaultAdmin.sol:VaultAdmin 0x31a91336414d3B955E494E7d485a6B06b55FC8fB
```

### Deployed contract code verification

To verify the deployed contract against the locally compiled contracts sol2uml from Nick Addison is convenient:
```
sol2uml diff [0x_address_of_the_deployed_contract] .,node_modules
```


## Continuous Integration

[GitHub Actions](https://github.com/features/actions) are used for the build. The configuration for GitHub Actions is in [.github/workflows/defi.yml](../.github/workflows/defi.yml). The action workflows can be found at https://github.com/OriginProtocol/origin-dollar/actions.
Expand Down
2 changes: 2 additions & 0 deletions contracts/contracts/interfaces/IVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,6 @@ interface IVault {
function setNetOusdMintForStrategyThreshold(uint256 _threshold) external;

function netOusdMintedForStrategy() external view returns (int256);

function weth() external view returns (address);
}
7 changes: 7 additions & 0 deletions contracts/contracts/proxies/Proxies.sol
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ contract MakerDsrStrategyProxy is InitializeGovernedUpgradeabilityProxy {

}

/**
* @notice FrxEthRedeemStrategyProxy delegates calls to a FrxEthRedeemStrategy implementation
*/
contract FrxEthRedeemStrategyProxy is InitializeGovernedUpgradeabilityProxy {

}

/**
* @notice OETHBuybackProxy delegates calls to Buyback implementation
*/
Expand Down
Loading

0 comments on commit edf9614

Please sign in to comment.