diff --git a/contracts/README.md b/contracts/README.md index 8403927e9f..1e88700f01 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -125,11 +125,10 @@ You can enable the "hot deploy" mode when doing fork testing development. The mo To enable Hot Deploys set the HOT_DEPLOY variable in the contracts/.env file. Enable various modes using comma separated flags to direct which contracts need source updated (in the node runtime): - strategy -> strategy contract associated to fixture -- vaultCore -> vaultCore or oethVaultCore depending on the nature of the fixture -- vaultAdmin -> vaultAdmin or oethVaultAdmin depending on the nature of the fixture +- vault -> OUSDVault or OETHVault depending on the nature of the fixture - harvester -> harvester or oethHarvester (not yet supported) -example: HOT_DEPLOY=strategy,vaultCore,vaultAdmin,harvester +example: HOT_DEPLOY=strategy,vault,harvester #### Supporting new fixtures / contracts diff --git a/contracts/contracts/interfaces/IVault.sol b/contracts/contracts/interfaces/IVault.sol index e294c2cde9..c517cf82b0 100644 --- a/contracts/contracts/interfaces/IVault.sol +++ b/contracts/contracts/interfaces/IVault.sol @@ -49,8 +49,6 @@ interface IVault { function governor() external view returns (address); - function ADMIN_IMPLEMENTATION() external view returns (address); - // VaultAdmin.sol function setVaultBuffer(uint256 _vaultBuffer) external; @@ -167,8 +165,6 @@ interface IVault { function initialize(address) external; - function setAdminImpl(address) external; - function addWithdrawalQueueLiquidity() external; function requestWithdrawal(uint256 _amount) diff --git a/contracts/contracts/mocks/MockOETHVault.sol b/contracts/contracts/mocks/MockOETHVault.sol index 2cdd9e8a99..7b72c90189 100644 --- a/contracts/contracts/mocks/MockOETHVault.sol +++ b/contracts/contracts/mocks/MockOETHVault.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; -import { OETHVaultCore } from "../vault/OETHVaultCore.sol"; +import { OETHVault } from "../vault/OETHVault.sol"; import { StableMath } from "../utils/StableMath.sol"; import "../utils/Helpers.sol"; -contract MockOETHVault is OETHVaultCore { +contract MockOETHVault is OETHVault { using StableMath for uint256; - constructor(address _weth) OETHVaultCore(_weth) { + constructor(address _weth) OETHVault(_weth) { _setGovernor(msg.sender); } diff --git a/contracts/contracts/mocks/MockOETHVaultAdmin.sol b/contracts/contracts/mocks/MockOETHVaultAdmin.sol index ba5d1313d2..43c9689bd8 100644 --- a/contracts/contracts/mocks/MockOETHVaultAdmin.sol +++ b/contracts/contracts/mocks/MockOETHVaultAdmin.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; -import { OETHVaultAdmin } from "../vault/OETHVaultAdmin.sol"; +import { OETHVault } from "../vault/OETHVault.sol"; -contract MockOETHVaultAdmin is OETHVaultAdmin { - constructor(address _weth) OETHVaultAdmin(_weth) {} +contract MockOETHVault is OETHVault { + constructor(address _weth) OETHVault(_weth) {} // fetches the WETH amount in outstanding withdrawals function outstandingWithdrawalsAmount() diff --git a/contracts/contracts/mocks/MockVault.sol b/contracts/contracts/mocks/MockVault.sol index b037530dd8..fb084b6883 100644 --- a/contracts/contracts/mocks/MockVault.sol +++ b/contracts/contracts/mocks/MockVault.sol @@ -1,16 +1,16 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; -import { VaultCore } from "../vault/VaultCore.sol"; +import { VaultAdmin } from "../vault/VaultAdmin.sol"; import { StableMath } from "../utils/StableMath.sol"; import "../utils/Helpers.sol"; -contract MockVault is VaultCore { +contract MockVault is VaultAdmin { using StableMath for uint256; uint256 storedTotalValue; - constructor(address _asset) VaultCore(_asset) {} + constructor(address _asset) VaultAdmin(_asset) {} function setTotalValue(uint256 _value) public { storedTotalValue = _value; @@ -39,8 +39,4 @@ contract MockVault is VaultCore { return 0; } } - - function setMaxSupplyDiff(uint256 _maxSupplyDiff) external onlyGovernor { - maxSupplyDiff = _maxSupplyDiff; - } } diff --git a/contracts/contracts/vault/OETHBaseVaultAdmin.sol b/contracts/contracts/vault/OETHBaseVault.sol similarity index 84% rename from contracts/contracts/vault/OETHBaseVaultAdmin.sol rename to contracts/contracts/vault/OETHBaseVault.sol index f663e7b4ea..16eebe01f5 100644 --- a/contracts/contracts/vault/OETHBaseVaultAdmin.sol +++ b/contracts/contracts/vault/OETHBaseVault.sol @@ -7,6 +7,6 @@ import { VaultAdmin } from "./VaultAdmin.sol"; * @title OETH Base VaultAdmin Contract * @author Origin Protocol Inc */ -contract OETHBaseVaultAdmin is VaultAdmin { +contract OETHBaseVault is VaultAdmin { constructor(address _weth) VaultAdmin(_weth) {} } diff --git a/contracts/contracts/vault/OETHBaseVaultCore.sol b/contracts/contracts/vault/OETHBaseVaultCore.sol deleted file mode 100644 index 9b9b0a83f3..0000000000 --- a/contracts/contracts/vault/OETHBaseVaultCore.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity ^0.8.0; - -import { VaultCore } from "./VaultCore.sol"; - -/** - * @title OETH Base VaultCore Contract - * @author Origin Protocol Inc - */ -contract OETHBaseVaultCore is VaultCore { - constructor(address _weth) VaultCore(_weth) {} -} diff --git a/contracts/contracts/vault/OETHPlumeVaultCore.sol b/contracts/contracts/vault/OETHPlumeVault.sol similarity index 73% rename from contracts/contracts/vault/OETHPlumeVaultCore.sol rename to contracts/contracts/vault/OETHPlumeVault.sol index 5492ffa919..5a4e8e81a8 100644 --- a/contracts/contracts/vault/OETHPlumeVaultCore.sol +++ b/contracts/contracts/vault/OETHPlumeVault.sol @@ -1,16 +1,16 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; -import { VaultCore } from "./VaultCore.sol"; +import { VaultAdmin } from "./VaultAdmin.sol"; /** - * @title OETH Plume VaultCore Contract + * @title OETH Plume VaultAdmin Contract * @author Origin Protocol Inc */ -contract OETHPlumeVaultCore is VaultCore { - constructor(address _weth) VaultCore(_weth) {} +contract OETHPlumeVault is VaultAdmin { + constructor(address _weth) VaultAdmin(_weth) {} - // @inheritdoc VaultCore + // @inheritdoc VaultAdmin function _mint( address, uint256 _amount, diff --git a/contracts/contracts/vault/OETHVaultAdmin.sol b/contracts/contracts/vault/OETHVault.sol similarity index 85% rename from contracts/contracts/vault/OETHVaultAdmin.sol rename to contracts/contracts/vault/OETHVault.sol index 8bf2e417ad..eb7d3b9f55 100644 --- a/contracts/contracts/vault/OETHVaultAdmin.sol +++ b/contracts/contracts/vault/OETHVault.sol @@ -7,6 +7,6 @@ import { VaultAdmin } from "./VaultAdmin.sol"; * @title OETH VaultAdmin Contract * @author Origin Protocol Inc */ -contract OETHVaultAdmin is VaultAdmin { +contract OETHVault is VaultAdmin { constructor(address _weth) VaultAdmin(_weth) {} } diff --git a/contracts/contracts/vault/OETHVaultCore.sol b/contracts/contracts/vault/OETHVaultCore.sol deleted file mode 100644 index 8356b95b0d..0000000000 --- a/contracts/contracts/vault/OETHVaultCore.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity ^0.8.0; - -import { VaultCore } from "./VaultCore.sol"; - -/** - * @title OETH VaultCore Contract - * @author Origin Protocol Inc - */ -contract OETHVaultCore is VaultCore { - constructor(address _weth) VaultCore(_weth) {} -} diff --git a/contracts/contracts/vault/OSonicVaultAdmin.sol b/contracts/contracts/vault/OSVault.sol similarity index 85% rename from contracts/contracts/vault/OSonicVaultAdmin.sol rename to contracts/contracts/vault/OSVault.sol index aefc3d661d..c965871034 100644 --- a/contracts/contracts/vault/OSonicVaultAdmin.sol +++ b/contracts/contracts/vault/OSVault.sol @@ -7,6 +7,6 @@ import { VaultAdmin } from "./VaultAdmin.sol"; * @title Origin Sonic VaultAdmin contract on Sonic * @author Origin Protocol Inc */ -contract OSonicVaultAdmin is VaultAdmin { +contract OSVault is VaultAdmin { constructor(address _wS) VaultAdmin(_wS) {} } diff --git a/contracts/contracts/vault/OSonicVault.sol b/contracts/contracts/vault/OSonicVault.sol new file mode 100644 index 0000000000..9f65d3d0d7 --- /dev/null +++ b/contracts/contracts/vault/OSonicVault.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.0; + +import { VaultAdmin } from "./VaultAdmin.sol"; + +/** + * @title Origin Sonic VaultAdmin contract on Sonic + * @author Origin Protocol Inc + */ +contract OSonicVault is VaultAdmin { + constructor(address _wS) VaultAdmin(_wS) {} +} diff --git a/contracts/contracts/vault/OSonicVaultCore.sol b/contracts/contracts/vault/OSonicVaultCore.sol deleted file mode 100644 index 2af58f1830..0000000000 --- a/contracts/contracts/vault/OSonicVaultCore.sol +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity ^0.8.0; - -import { VaultCore } from "./VaultCore.sol"; - -/** - * @title Origin Sonic VaultCore contract on Sonic - * @author Origin Protocol Inc - */ -contract OSonicVaultCore is VaultCore { - /// @param _wS Sonic's Wrapped S token - constructor(address _wS) VaultCore(_wS) {} -} diff --git a/contracts/contracts/vault/OUSDVaultAdmin.sol b/contracts/contracts/vault/OUSDVault.sol similarity index 85% rename from contracts/contracts/vault/OUSDVaultAdmin.sol rename to contracts/contracts/vault/OUSDVault.sol index 5ec50a406f..a800636b91 100644 --- a/contracts/contracts/vault/OUSDVaultAdmin.sol +++ b/contracts/contracts/vault/OUSDVault.sol @@ -7,6 +7,6 @@ import { VaultAdmin } from "./VaultAdmin.sol"; * @title OUSD VaultAdmin Contract * @author Origin Protocol Inc */ -contract OUSDVaultAdmin is VaultAdmin { +contract OUSDVault is VaultAdmin { constructor(address _usdc) VaultAdmin(_usdc) {} } diff --git a/contracts/contracts/vault/OUSDVaultCore.sol b/contracts/contracts/vault/OUSDVaultCore.sol deleted file mode 100644 index 28ae839d58..0000000000 --- a/contracts/contracts/vault/OUSDVaultCore.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -pragma solidity ^0.8.0; - -import { VaultCore } from "./VaultCore.sol"; - -/** - * @title OUSD VaultCore Contract - * @author Origin Protocol Inc - */ -contract OUSDVaultCore is VaultCore { - constructor(address _usdc) VaultCore(_usdc) {} -} diff --git a/contracts/contracts/vault/README.md b/contracts/contracts/vault/README.md index 651a49f2d6..868f4d7b2a 100644 --- a/contracts/contracts/vault/README.md +++ b/contracts/contracts/vault/README.md @@ -2,60 +2,14 @@ ## Hierarchy -![Vault Core Hierarchy](../../docs/VaultHierarchy.svg) +![Vault Hierarchy](../../docs/VaultHierarchy.svg) -## OUSD Vault +## Vault -## Vault Core Squashed +## Vault Squashed -![Vault Core Squashed](../../docs/VaultCoreSquashed.svg) +![Vault Squashed](../../docs/VaultSquashed.svg) ### Storage ![Vault Storage](../../docs/VaultStorage.svg) - -## Vault Admin Squashed - -![Vault Admin Squashed](../../docs/VaultAdminSquashed.svg) - -## OETH Vault - -## Vault Core Squashed - -![OETH Vault Core Squashed](../../docs/OETHVaultCoreSquashed.svg) - -## Vault Admin Squashed - -![OETH Vault Admin Squashed](../../docs/OETHVaultAdminSquashed.svg) - -### Storage - -![OETH Vault Storage](../../docs/OETHVaultStorage.svg) - -## Base OETH Vault - -## Vault Core Squashed - -![OETH Vault Core Squashed](../../docs/OETHBaseVaultCoreSquashed.svg) - -## Vault Admin Squashed - -![OETH Vault Admin Squashed](../../docs/OETHBaseVaultAdminSquashed.svg) - -### Storage - -![OETH Vault Storage](../../docs/OETHBaseVaultStorage.svg) - -## Origin Sonic (OS) Vault - -## Vault Core Squashed - -![Sonic Vault Core Squashed](../../docs/OSonicVaultCoreSquashed.svg) - -## Vault Admin Squashed - -![Sonic Vault Admin Squashed](../../docs/OSonicVaultAdminSquashed.svg) - -### Storage - -![Sonic Vault Storage](../../docs/OSonicVaultStorage.svg) \ No newline at end of file diff --git a/contracts/contracts/vault/VaultAdmin.sol b/contracts/contracts/vault/VaultAdmin.sol index acc67a82bd..261b9d70d4 100644 --- a/contracts/contracts/vault/VaultAdmin.sol +++ b/contracts/contracts/vault/VaultAdmin.sol @@ -13,9 +13,9 @@ import { IVault } from "../interfaces/IVault.sol"; import { StableMath } from "../utils/StableMath.sol"; import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; -import "./VaultStorage.sol"; +import "./VaultCore.sol"; -abstract contract VaultAdmin is VaultStorage { +abstract contract VaultAdmin is VaultCore { using SafeERC20 for IERC20; using StableMath for uint256; using SafeCast for uint256; @@ -31,7 +31,7 @@ abstract contract VaultAdmin is VaultStorage { _; } - constructor(address _asset) VaultStorage(_asset) {} + constructor(address _asset) VaultCore(_asset) {} /*************************************** Configuration @@ -415,27 +415,6 @@ abstract contract VaultAdmin is VaultStorage { IERC20(_asset).safeTransfer(governor(), _amount); } - /** - * @dev Calculate how much asset (eg. WETH or USDC) in the vault is not reserved for the withdrawal queue. - * That is, it is available to be redeemed or deposited into a strategy. - */ - function _assetAvailable() internal view returns (uint256 assetAvailable) { - WithdrawalQueueMetadata memory queue = withdrawalQueueMetadata; - - // The amount of asset that is still to be claimed in the withdrawal queue - uint256 outstandingWithdrawals = queue.queued - queue.claimed; - - // The amount of sitting in asset in the vault - uint256 assetBalance = IERC20(asset).balanceOf(address(this)); - - // If there is not enough asset in the vault to cover the outstanding withdrawals - if (assetBalance <= outstandingWithdrawals) { - return 0; - } - - return assetBalance - outstandingWithdrawals; - } - /*************************************** Strategies Admin ****************************************/ diff --git a/contracts/contracts/vault/VaultCore.sol b/contracts/contracts/vault/VaultCore.sol index 53970e6b09..99047e8d98 100644 --- a/contracts/contracts/vault/VaultCore.sol +++ b/contracts/contracts/vault/VaultCore.sol @@ -736,53 +736,6 @@ abstract contract VaultCore is VaultInitializer { return asset == _asset; } - function ADMIN_IMPLEMENTATION() external view returns (address adminImpl) { - bytes32 slot = adminImplPosition; - // solhint-disable-next-line no-inline-assembly - assembly { - adminImpl := sload(slot) - } - } - - /** - * @dev Falldown to the admin implementation - * @notice This is a catch all for all functions not declared in core - */ - // solhint-disable-next-line no-complex-fallback - fallback() external { - bytes32 slot = adminImplPosition; - // solhint-disable-next-line no-inline-assembly - assembly { - // Copy msg.data. We take full control of memory in this inline assembly - // block because it will not return to Solidity code. We overwrite the - // Solidity scratch pad at memory position 0. - calldatacopy(0, 0, calldatasize()) - - // Call the implementation. - // out and outsize are 0 because we don't know the size yet. - let result := delegatecall( - gas(), - sload(slot), - 0, - calldatasize(), - 0, - 0 - ) - - // Copy the returned data. - returndatacopy(0, 0, returndatasize()) - - switch result - // delegatecall returns 0 on error. - case 0 { - revert(0, returndatasize()) - } - default { - return(0, returndatasize()) - } - } - } - function _min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } diff --git a/contracts/contracts/vault/VaultStorage.sol b/contracts/contracts/vault/VaultStorage.sol index 64a9e13169..00fc068449 100644 --- a/contracts/contracts/vault/VaultStorage.sol +++ b/contracts/contracts/vault/VaultStorage.sol @@ -97,11 +97,6 @@ abstract contract VaultStorage is Initializable, Governable { /// @dev Address of the OToken token. eg OUSD or OETH. OUSD public oUSD; - /// @dev Storage slot for the address of the VaultAdmin contract that is delegated to - // keccak256("OUSD.vault.governor.admin.impl"); - bytes32 public constant adminImplPosition = - 0xa2bd3d3cf188a41358c8b401076eb59066b09dec5775650c0de4c55187d17bd9; - /// @dev Address of the contract responsible for post rebase syncs with AMMs address private _deprecated_rebaseHooksAddr = address(0); @@ -227,20 +222,4 @@ abstract contract VaultStorage is Initializable, Governable { asset = _asset; assetDecimals = _decimals; } - - /** - * @notice set the implementation for the admin, this needs to be in a base class else we cannot set it - * @param newImpl address of the implementation - */ - function setAdminImpl(address newImpl) external onlyGovernor { - require( - Address.isContract(newImpl), - "new implementation is not a contract" - ); - bytes32 position = adminImplPosition; - // solhint-disable-next-line no-inline-assembly - assembly { - sstore(position, newImpl) - } - } } diff --git a/contracts/contracts/vault/AbstractOTokenZapper.sol b/contracts/contracts/zapper/AbstractOTokenZapper.sol similarity index 100% rename from contracts/contracts/vault/AbstractOTokenZapper.sol rename to contracts/contracts/zapper/AbstractOTokenZapper.sol diff --git a/contracts/contracts/vault/OETHBaseZapper.sol b/contracts/contracts/zapper/OETHBaseZapper.sol similarity index 100% rename from contracts/contracts/vault/OETHBaseZapper.sol rename to contracts/contracts/zapper/OETHBaseZapper.sol diff --git a/contracts/contracts/vault/OETHZapper.sol b/contracts/contracts/zapper/OETHZapper.sol similarity index 100% rename from contracts/contracts/vault/OETHZapper.sol rename to contracts/contracts/zapper/OETHZapper.sol diff --git a/contracts/contracts/vault/OSonicZapper.sol b/contracts/contracts/zapper/OSonicZapper.sol similarity index 100% rename from contracts/contracts/vault/OSonicZapper.sol rename to contracts/contracts/zapper/OSonicZapper.sol diff --git a/contracts/deploy/base/000_mock.js b/contracts/deploy/base/000_mock.js index 53a2df1bad..9691f51043 100644 --- a/contracts/deploy/base/000_mock.js +++ b/contracts/deploy/base/000_mock.js @@ -22,11 +22,11 @@ const deployWOETH = async () => { // Initialize the proxy // prettier-ignore await cWOETHProxy["initialize(address,address,bytes)"]( - cWOETHImpl.address, - governorAddr, - "0x", - await getTxOpts() - ); + cWOETHImpl.address, + governorAddr, + "0x", + await getTxOpts() + ); // Initialize implementation const cWOETH = await ethers.getContractAt( @@ -83,10 +83,7 @@ const deployCore = async () => { const dwOETHb = await deployWithConfirmation("WOETHBase", [ cOETHbProxy.address, // Base token ]); - const dOETHbVaultCore = await deployWithConfirmation("OETHBaseVaultCore", [ - cWETH.address, - ]); - const dOETHbVaultAdmin = await deployWithConfirmation("OETHBaseVaultAdmin", [ + const dOETHbVaultAdmin = await deployWithConfirmation("OETHBaseVault", [ cWETH.address, ]); @@ -125,7 +122,7 @@ const deployCore = async () => { // prettier-ignore await cOETHbVaultProxy .connect(sDeployer)["initialize(address,address,bytes)"]( - dOETHbVaultCore.address, + dOETHbVaultAdmin.address, governorAddr, initDataOETHbVault ); @@ -143,8 +140,7 @@ const deployCore = async () => { initDatawOETHb ) - await cOETHbVaultProxy.connect(sGovernor).upgradeTo(dOETHbVaultCore.address); - await cOETHbVault.connect(sGovernor).setAdminImpl(dOETHbVaultAdmin.address); + await cOETHbVaultProxy.connect(sGovernor).upgradeTo(dOETHbVaultAdmin.address); await cOETHbVault.connect(sGovernor).unpauseCapital(); }; diff --git a/contracts/deploy/base/040_vault_upgrade.js b/contracts/deploy/base/040_vault_upgrade.js index 1a72a580ac..b44242adb2 100644 --- a/contracts/deploy/base/040_vault_upgrade.js +++ b/contracts/deploy/base/040_vault_upgrade.js @@ -8,18 +8,11 @@ module.exports = deployOnBase( //proposalId: "", }, async ({ ethers }) => { - // 1. Deploy new VaultCore and VaultAdmin implementations - const dOETHbVaultCore = await deployWithConfirmation( - "OETHBaseVaultCore", + // 1. Deploy OETHBaseVault implementations + const dOETHbVault = await deployWithConfirmation( + "OETHBaseVault", [addresses.base.WETH], - "OETHBaseVaultCore", - true - ); - - const dOETHbVaultAdmin = await deployWithConfirmation( - "OETHBaseVaultAdmin", - [addresses.base.WETH], - "OETHBaseVaultAdmin", + "OETHBaseVault", true ); @@ -60,7 +53,7 @@ module.exports = deployOnBase( // Governance Actions // ---------------- return { - name: "Upgrade OETHBase Vault to new Core and Admin implementations", + name: "Upgrade OETHBaseVault to new single Vault implementations", actions: [ // 1. Upgrade Bridged WOETH Strategy implementation { @@ -68,19 +61,13 @@ module.exports = deployOnBase( signature: "upgradeTo(address)", args: [dStrategyImpl.address], }, - // 2. Upgrade VaultCore implementation + // 2. Upgrade OETHBaseVaultProxy to new implementation { contract: cOETHbVaultProxy, signature: "upgradeTo(address)", - args: [dOETHbVaultCore.address], - }, - // 3. Set VaultAdmin implementation - { - contract: cOETHbVault, - signature: "setAdminImpl(address)", - args: [dOETHbVaultAdmin.address], + args: [dOETHbVault.address], }, - // 4. Set Aerodrome AMO as default strategy + // 3. Set Aerodrome AMO as default strategy { contract: cOETHbVault, signature: "setDefaultStrategy(address)", diff --git a/contracts/deploy/deployActions.js b/contracts/deploy/deployActions.js index 76878e69d6..175d4b4f44 100644 --- a/contracts/deploy/deployActions.js +++ b/contracts/deploy/deployActions.js @@ -1074,10 +1074,7 @@ const deployOETHCore = async () => { // Main contracts const dOETH = await deployWithConfirmation("OETH"); - const dOETHVaultCore = await deployWithConfirmation("OETHVaultCore", [ - assetAddresses.WETH, - ]); - const dOETHVaultAdmin = await deployWithConfirmation("OETHVaultAdmin", [ + const dOETHVault = await deployWithConfirmation("OETHVault", [ assetAddresses.WETH, ]); @@ -1103,7 +1100,7 @@ const deployOETHCore = async () => { // prettier-ignore await withConfirmation( cOETHVaultProxy.connect(sDeployer)["initialize(address,address,bytes)"]( - dOETHVaultCore.address, + dOETHVault.address, governorAddr, [], await getTxOpts() @@ -1119,15 +1116,10 @@ const deployOETHCore = async () => { log("Initialized OETHVault"); await withConfirmation( - cOETHVaultProxy.connect(sGovernor).upgradeTo(dOETHVaultCore.address) + cOETHVaultProxy.connect(sGovernor).upgradeTo(dOETHVault.address) ); log("Upgraded VaultCore implementation"); - await withConfirmation( - cOETHVault.connect(sGovernor).setAdminImpl(dOETHVaultAdmin.address) - ); - - log("Initialized VaultAdmin implementation"); // Initialize OETH /* Set the original resolution to 27 decimals. We used to have it set to 18 * decimals at launch and then migrated to 27. Having it set to 27 it will @@ -1175,10 +1167,7 @@ const deployOUSDCore = async () => { } // Deploy Vault implementations - const dVaultCore = await deployWithConfirmation("OUSDVaultCore", [ - assetAddresses.USDC, - ]); - const dVaultAdmin = await deployWithConfirmation("OUSDVaultAdmin", [ + const dVaultAdmin = await deployWithConfirmation("OUSDVault", [ assetAddresses.USDC, ]); log("Deployed OUSD Vault implementations (Core, Admin)"); @@ -1203,7 +1192,7 @@ const deployOUSDCore = async () => { // prettier-ignore await withConfirmation( cVaultProxy.connect(sDeployer)["initialize(address,address,bytes)"]( - dVaultCore.address, + dVaultAdmin.address, governorAddr, [], await getTxOpts() @@ -1217,12 +1206,6 @@ const deployOUSDCore = async () => { ); log("Initialized OUSD Vault Core"); - // Set Vault implementation - await withConfirmation( - cVault.connect(sGovernor).setAdminImpl(dVaultAdmin.address) - ); - log("Initialized OUSD VaultAdmin implementation"); - // Initialize OUSD /* Set the original resolution to 27 decimals. We used to have it set to 18 * decimals at launch and then migrated to 27. Having it set to 27 it will diff --git a/contracts/deploy/mainnet/166_ousd_vault_upgrade.js b/contracts/deploy/mainnet/166_ousd_vault_upgrade.js index 240547d634..deecc6d252 100644 --- a/contracts/deploy/mainnet/166_ousd_vault_upgrade.js +++ b/contracts/deploy/mainnet/166_ousd_vault_upgrade.js @@ -15,10 +15,7 @@ module.exports = deploymentWithGovernanceProposal( // ---------------- // 1. Deploy new OUSD Vault Core and Admin implementations - const dVaultCore = await deployWithConfirmation("OUSDVaultCore", [ - addresses.mainnet.USDC, - ]); - const dVaultAdmin = await deployWithConfirmation("OUSDVaultAdmin", [ + const dVault = await deployWithConfirmation("OUSDVault", [ addresses.mainnet.USDC, ]); @@ -38,21 +35,15 @@ module.exports = deploymentWithGovernanceProposal( { contract: cVaultProxy, signature: "upgradeTo(address)", - args: [dVaultCore.address], - }, - // 2. Set OUSD Vault proxy to the new admin vault implementation - { - contract: cVault, - signature: "setAdminImpl(address)", - args: [dVaultAdmin.address], + args: [dVault.address], }, - // 3. Add OUSD/USDC AMO to mint whitelist + // 2. Add OUSD/USDC AMO to mint whitelist { contract: cVault, signature: "addStrategyToMintWhitelist(address)", args: [cOUSDAMO.address], }, - // 4. Set OUSD/USDC AMO as default strategy + // 3. Set OUSD/USDC AMO as default strategy { contract: cVault, signature: "setDefaultStrategy(address)", diff --git a/contracts/deploy/mainnet/167_oeth_vault_upgrade.js b/contracts/deploy/mainnet/167_oeth_vault_upgrade.js index 85898f0172..3ccf98a10e 100644 --- a/contracts/deploy/mainnet/167_oeth_vault_upgrade.js +++ b/contracts/deploy/mainnet/167_oeth_vault_upgrade.js @@ -15,14 +15,8 @@ module.exports = deploymentWithGovernanceProposal( // ---------------- // 1. Deploy new OETH Vault Core and Admin implementations - const dVaultCore = await deployWithConfirmation( - "OETHVaultCore", - [addresses.mainnet.WETH], - undefined, - true - ); const dVaultAdmin = await deployWithConfirmation( - "OETHVaultAdmin", + "OETHVault", [addresses.mainnet.WETH], undefined, true @@ -46,15 +40,9 @@ module.exports = deploymentWithGovernanceProposal( { contract: cVaultProxy, signature: "upgradeTo(address)", - args: [dVaultCore.address], - }, - // 2. Set OETH Vault proxy to the new admin vault implementation - { - contract: cVault, - signature: "setAdminImpl(address)", args: [dVaultAdmin.address], }, - // 3. Set OETH/WETH AMO as default strategy + // 2. Set OETH/WETH AMO as default strategy { contract: cVault, signature: "setDefaultStrategy(address)", diff --git a/contracts/deploy/plume/002_core.js b/contracts/deploy/plume/002_core.js index ba6eae2b9a..c090140a6c 100644 --- a/contracts/deploy/plume/002_core.js +++ b/contracts/deploy/plume/002_core.js @@ -53,11 +53,10 @@ module.exports = deployOnPlume( const dOETHpVaultCore = await deployWithConfirmation("OETHBaseVaultCore", [ addresses.plume.WETH, ]); - const dOETHpVaultAdmin = await deployWithConfirmation( - "OETHBaseVaultAdmin", - [addresses.plume.WETH] - ); - console.log("OETHBaseVaultAdmin deployed at", dOETHpVaultAdmin.address); + const dOETHpVaultAdmin = await deployWithConfirmation("OETHBaseVault", [ + addresses.plume.WETH, + ]); + console.log("OETHBaseVault deployed at", dOETHpVaultAdmin.address); // Get contract instances const cOETHp = await ethers.getContractAt("OETHPlume", cOETHpProxy.address); const cwOETHp = await ethers.getContractAt( diff --git a/contracts/deploy/sonic/000_mock.js b/contracts/deploy/sonic/000_mock.js index 3abd7cb04e..6612533399 100644 --- a/contracts/deploy/sonic/000_mock.js +++ b/contracts/deploy/sonic/000_mock.js @@ -46,11 +46,8 @@ const deployCore = async () => { const dWOSonic = await deployWithConfirmation("WOSonic", [ cOSonicProxy.address, // Base token ]); - const dOSonicVaultCore = await deployWithConfirmation("OSonicVaultCore", [ - cWS.address, - ]); - const dOSonicVaultAdmin = await deployWithConfirmation("OSonicVaultAdmin", [ + const dOSonicVault = await deployWithConfirmation("OSonicVault", [ cWS.address, ]); @@ -89,7 +86,7 @@ const deployCore = async () => { // prettier-ignore await cOSonicVaultProxy .connect(sDeployer)["initialize(address,address,bytes)"]( - dOSonicVaultCore.address, + dOSonicVault.address, governorAddr, initDataOSonicVault ); @@ -107,10 +104,7 @@ const deployCore = async () => { initDataWOSonic ) - await cOSonicVaultProxy - .connect(sGovernor) - .upgradeTo(dOSonicVaultCore.address); - await cOSonicVault.connect(sGovernor).setAdminImpl(dOSonicVaultAdmin.address); + await cOSonicVaultProxy.connect(sGovernor).upgradeTo(dOSonicVault.address); await cOSonicVault.connect(sGovernor).unpauseCapital(); // Set withdrawal claim delay to 1 day @@ -160,13 +154,13 @@ const deployStakingStrategy = async () => { cSonicStakingStrategy.interface.encodeFunctionData("initialize()", []); // prettier-ignore await withConfirmation( - cSonicStakingStrategyProxy - .connect(sDeployer)["initialize(address,address,bytes)"]( - dSonicStakingStrategy.address, - governorAddr, - initSonicStakingStrategy - ) - ); + cSonicStakingStrategyProxy + .connect(sDeployer)["initialize(address,address,bytes)"]( + dSonicStakingStrategy.address, + governorAddr, + initSonicStakingStrategy + ) + ); }; const deployDripper = async () => { @@ -188,12 +182,12 @@ const deployDripper = async () => { // prettier-ignore await withConfirmation( cOSonicDripperProxy - .connect(sDeployer)["initialize(address,address,bytes)"]( - dFixedRateDripper.address, - governorAddr, - "0x" - ) - ); + .connect(sDeployer)["initialize(address,address,bytes)"]( + dFixedRateDripper.address, + governorAddr, + "0x" + ) + ); }; const main = async () => { diff --git a/contracts/deploy/sonic/001_vault_and_token.js b/contracts/deploy/sonic/001_vault_and_token.js index 0ecb106f98..73b4ec9c81 100644 --- a/contracts/deploy/sonic/001_vault_and_token.js +++ b/contracts/deploy/sonic/001_vault_and_token.js @@ -49,10 +49,10 @@ module.exports = deployOnSonic( ]); console.log(`Deployed Vault Core to ${dOSonicVaultCore.address}`); - const dOSonicVaultAdmin = await deployWithConfirmation("OSonicVaultAdmin", [ + const dOSonicVault = await deployWithConfirmation("OSonicVault", [ cWS.address, ]); - console.log(`Deployed Vault Admin to ${dOSonicVaultAdmin.address}`); + console.log(`Deployed Vault Admin to ${dOSonicVault.address}`); // Get contract instances const cOSonic = await ethers.getContractAt("OSonic", cOSonicProxy.address); @@ -77,11 +77,11 @@ module.exports = deployOnSonic( // prettier-ignore await cOSonicProxy - .connect(sDeployer)["initialize(address,address,bytes)"]( - dOSonic.address, - addresses.sonic.timelock, - initDataOSonic - ); + .connect(sDeployer)["initialize(address,address,bytes)"]( + dOSonic.address, + addresses.sonic.timelock, + initDataOSonic + ); console.log("Initialized Origin S"); // Init OSonicVault @@ -94,11 +94,11 @@ module.exports = deployOnSonic( ); // prettier-ignore await cOSonicVaultProxy - .connect(sDeployer)["initialize(address,address,bytes)"]( - dOSonicVaultCore.address, - addresses.sonic.timelock, - initDataOSonicVault - ); + .connect(sDeployer)["initialize(address,address,bytes)"]( + dOSonicVaultCore.address, + addresses.sonic.timelock, + initDataOSonicVault + ); console.log("Initialized Origin S Vault"); // Init WOSonic @@ -108,11 +108,11 @@ module.exports = deployOnSonic( ); // prettier-ignore await cWOSonicProxy - .connect(sDeployer)["initialize(address,address,bytes)"]( - dWOSonic.address, - addresses.sonic.timelock, - initDataWOSonic - ) + .connect(sDeployer)["initialize(address,address,bytes)"]( + dWOSonic.address, + addresses.sonic.timelock, + initDataWOSonic + ) console.log("Initialized Wrapper Origin S"); // Deploy the Dripper @@ -133,7 +133,7 @@ module.exports = deployOnSonic( // Init the Dripper proxy // prettier-ignore await withConfirmation( - cOSonicDripperProxy + cOSonicDripperProxy .connect(sDeployer)["initialize(address,address,bytes)"]( dFixedRateDripper.address, addresses.sonic.timelock, @@ -170,7 +170,7 @@ module.exports = deployOnSonic( { contract: cOSonicVault, signature: "setAdminImpl(address)", - args: [dOSonicVaultAdmin.address], + args: [dOSonicVault.address], }, // 3. Support wrapped S { diff --git a/contracts/deploy/sonic/026_vault_upgrade.js b/contracts/deploy/sonic/026_vault_upgrade.js index 5099a0632d..30725e2e3a 100644 --- a/contracts/deploy/sonic/026_vault_upgrade.js +++ b/contracts/deploy/sonic/026_vault_upgrade.js @@ -8,18 +8,11 @@ module.exports = deployOnSonic( //proposalId: "", }, async ({ ethers }) => { - // 1. Deploy new VaultCore and VaultAdmin implementations - const dOSonicVaultCore = await deployWithConfirmation( - "OSonicVaultCore", + // 1. Deploy new OSonicVault implementations + const dOSonicVault = await deployWithConfirmation( + "OSVault", [addresses.sonic.wS], - "OSonicVaultCore", - true - ); - - const dOSonicVaultAdmin = await deployWithConfirmation( - "OSonicVaultAdmin", - [addresses.sonic.wS], - "OSonicVaultAdmin", + "OSVault", true ); @@ -43,21 +36,15 @@ module.exports = deployOnSonic( // Governance Actions // ---------------- return { - name: "Upgrade OSonic Vault to new Core and Admin implementations", + name: "Upgrade OSonicVault to new single Vault implementations", actions: [ - // 1. Upgrade VaultCore implementation + // 1. Upgrade OSonicVaultProxy to new implementation { contract: cOSonicVaultProxy, signature: "upgradeTo(address)", - args: [dOSonicVaultCore.address], - }, - // 2. Set VaultAdmin implementation - { - contract: cOSonicVault, - signature: "setAdminImpl(address)", - args: [dOSonicVaultAdmin.address], + args: [dOSonicVault.address], }, - // 3. Set Sonic Staking Strategy as default strategy + // 2. Set Sonic Staking Strategy as default strategy { contract: cOSonicVault, signature: "setDefaultStrategy(address)", diff --git a/contracts/docs/OETHBaseVaultAdminSquashed.svg b/contracts/docs/OETHBaseVaultAdminSquashed.svg deleted file mode 100644 index a4f23c6a14..0000000000 --- a/contracts/docs/OETHBaseVaultAdminSquashed.svg +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - -UmlClassDiagram - - - -282 - -OETHBaseVaultAdmin -../contracts/vault/OETHBaseVaultAdmin.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _deprecated_rebaseHooksAddr: address <<VaultStorage>> -   _deprecated_uniswapAddr: address <<VaultStorage>> -   _deprecated_swapTokens: address[] <<VaultStorage>> -   __gap: uint256[44] <<VaultStorage>> -Internal: -   assets: mapping(address=>Asset) <<VaultStorage>> -   allAssets: address[] <<VaultStorage>> -   strategies: mapping(address=>Strategy) <<VaultStorage>> -   allStrategies: address[] <<VaultStorage>> -   oUSD: OUSD <<VaultStorage>> -   swapConfig: SwapConfig <<VaultStorage>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   priceProvider: address <<VaultStorage>> -   rebasePaused: bool <<VaultStorage>> -   capitalPaused: bool <<VaultStorage>> -   redeemFeeBps: uint256 <<VaultStorage>> -   vaultBuffer: uint256 <<VaultStorage>> -   autoAllocateThreshold: uint256 <<VaultStorage>> -   rebaseThreshold: uint256 <<VaultStorage>> -   adminImplPosition: bytes32 <<VaultStorage>> -   strategistAddr: address <<VaultStorage>> -   assetDefaultStrategies: mapping(address=>address) <<VaultStorage>> -   maxSupplyDiff: uint256 <<VaultStorage>> -   trusteeAddress: address <<VaultStorage>> -   trusteeFeeBps: uint256 <<VaultStorage>> -   MINT_MINIMUM_UNIT_PRICE: uint256 <<VaultStorage>> -   ousdMetaStrategy: address <<VaultStorage>> -   netOusdMintedForStrategy: int256 <<VaultStorage>> -   netOusdMintForStrategyThreshold: uint256 <<VaultStorage>> -   MIN_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   MAX_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   isMintWhitelistedStrategy: mapping(address=>bool) <<VaultStorage>> -   dripper: address <<VaultStorage>> -   withdrawalQueueMetadata: WithdrawalQueueMetadata <<VaultStorage>> -   withdrawalRequests: mapping(uint256=>WithdrawalRequest) <<VaultStorage>> -   withdrawalClaimDelay: uint256 <<VaultStorage>> -   weth: address <<OETHVaultAdmin>> - -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _swapCollateral(address, address, uint256, uint256, bytes): uint256 <<OETHVaultAdmin>> -    _depositToStrategy(_strategyToAddress: address, _assets: address[], _amounts: uint256[]) <<OETHVaultAdmin>> -    _withdrawFromStrategy(_recipient: address, _strategyFromAddress: address, _assets: address[], _amounts: uint256[]) <<OETHVaultAdmin>> -    _withdrawAllFromStrategy(_strategyAddr: address) <<OETHVaultAdmin>> -    _withdrawAllFromStrategies() <<OETHVaultAdmin>> -    _cacheDecimals(token: address) <<VaultAdmin>> -    _wethAvailable(): (wethAvailable: uint256) <<OETHVaultAdmin>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    setAdminImpl(newImpl: address) <<onlyGovernor>> <<VaultStorage>> -    setPriceProvider(_priceProvider: address) <<onlyGovernor>> <<VaultAdmin>> -    setRedeemFeeBps(_redeemFeeBps: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setVaultBuffer(_vaultBuffer: uint256) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    setAutoAllocateThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setRebaseThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setStrategistAddr(_address: address) <<onlyGovernor>> <<VaultAdmin>> -    setAssetDefaultStrategy(_asset: address, _strategy: address) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    setNetOusdMintForStrategyThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setDripper(_dripper: address) <<onlyGovernor>> <<VaultAdmin>> -    setWithdrawalClaimDelay(_delay: uint256) <<onlyGovernor>> <<VaultAdmin>> -    swapCollateral(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _minToAssetAmount: uint256, _data: bytes): (toAssetAmount: uint256) <<nonReentrant, onlyGovernorOrStrategist>> <<VaultAdmin>> -    setSwapper(_swapperAddr: address) <<onlyGovernor>> <<VaultAdmin>> -    swapper(): (swapper_: address) <<VaultAdmin>> -    setSwapAllowedUndervalue(_basis: uint16) <<onlyGovernor>> <<VaultAdmin>> -    allowedSwapUndervalue(): (value: uint256) <<VaultAdmin>> -    setOracleSlippage(_asset: address, _allowedOracleSlippageBps: uint16) <<onlyGovernor>> <<VaultAdmin>> -    supportAsset(_asset: address, _unitConversion: uint8) <<onlyGovernor>> <<VaultAdmin>> -    removeAsset(_asset: address) <<onlyGovernor>> <<VaultAdmin>> -    cacheDecimals(_asset: address) <<onlyGovernor>> <<VaultAdmin>> -    approveStrategy(_addr: address) <<onlyGovernor>> <<VaultAdmin>> -    removeStrategy(_addr: address) <<onlyGovernor>> <<VaultAdmin>> -    depositToStrategy(_strategyToAddress: address, _assets: address[], _amounts: uint256[]) <<onlyGovernorOrStrategist, nonReentrant>> <<VaultAdmin>> -    withdrawFromStrategy(_strategyFromAddress: address, _assets: address[], _amounts: uint256[]) <<onlyGovernorOrStrategist, nonReentrant>> <<VaultAdmin>> -    setMaxSupplyDiff(_maxSupplyDiff: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setTrusteeAddress(_address: address) <<onlyGovernor>> <<VaultAdmin>> -    setTrusteeFeeBps(_basis: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setOusdMetaStrategy(_ousdMetaStrategy: address) <<onlyGovernor>> <<VaultAdmin>> -    pauseRebase() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    unpauseRebase() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    pauseCapital() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    unpauseCapital() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<VaultAdmin>> -    withdrawAllFromStrategy(_strategyAddr: address) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    withdrawAllFromStrategies() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    addStrategyToMintWhitelist(strategyAddr: address) <<onlyGovernor>> <<OETHVaultAdmin>> -    removeStrategyFromMintWhitelist(strategyAddr: address) <<onlyGovernor>> <<OETHVaultAdmin>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> AssetSupported(_asset: address) <<VaultStorage>> -    <<event>> AssetRemoved(_asset: address) <<VaultStorage>> -    <<event>> AssetDefaultStrategyUpdated(_asset: address, _strategy: address) <<VaultStorage>> -    <<event>> AssetAllocated(_asset: address, _strategy: address, _amount: uint256) <<VaultStorage>> -    <<event>> StrategyApproved(_addr: address) <<VaultStorage>> -    <<event>> StrategyRemoved(_addr: address) <<VaultStorage>> -    <<event>> Mint(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> Redeem(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> CapitalPaused() <<VaultStorage>> -    <<event>> CapitalUnpaused() <<VaultStorage>> -    <<event>> RebasePaused() <<VaultStorage>> -    <<event>> RebaseUnpaused() <<VaultStorage>> -    <<event>> VaultBufferUpdated(_vaultBuffer: uint256) <<VaultStorage>> -    <<event>> OusdMetaStrategyUpdated(_ousdMetaStrategy: address) <<VaultStorage>> -    <<event>> RedeemFeeUpdated(_redeemFeeBps: uint256) <<VaultStorage>> -    <<event>> PriceProviderUpdated(_priceProvider: address) <<VaultStorage>> -    <<event>> AllocateThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> RebaseThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> StrategistUpdated(_address: address) <<VaultStorage>> -    <<event>> MaxSupplyDiffChanged(maxSupplyDiff: uint256) <<VaultStorage>> -    <<event>> YieldDistribution(_to: address, _yield: uint256, _fee: uint256) <<VaultStorage>> -    <<event>> TrusteeFeeBpsChanged(_basis: uint256) <<VaultStorage>> -    <<event>> TrusteeAddressChanged(_address: address) <<VaultStorage>> -    <<event>> NetOusdMintForStrategyThresholdChanged(_threshold: uint256) <<VaultStorage>> -    <<event>> SwapperChanged(_address: address) <<VaultStorage>> -    <<event>> SwapAllowedUndervalueChanged(_basis: uint256) <<VaultStorage>> -    <<event>> SwapSlippageChanged(_asset: address, _basis: uint256) <<VaultStorage>> -    <<event>> Swapped(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _toAssetAmount: uint256) <<VaultStorage>> -    <<event>> StrategyAddedToMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> StrategyRemovedFromMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> DripperChanged(_dripper: address) <<VaultStorage>> -    <<event>> WithdrawalRequested(_withdrawer: address, _requestId: uint256, _amount: uint256, _queued: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimed(_withdrawer: address, _requestId: uint256, _amount: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimable(_claimable: uint256, _newClaimable: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimDelayUpdated(_newDelay: uint256) <<VaultStorage>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyGovernorOrStrategist() <<VaultAdmin>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> -    constructor(_weth: address) <<OETHBaseVaultAdmin>> - - - diff --git a/contracts/docs/OETHBaseVaultCoreSquashed.svg b/contracts/docs/OETHBaseVaultCoreSquashed.svg deleted file mode 100644 index 194fb658f8..0000000000 --- a/contracts/docs/OETHBaseVaultCoreSquashed.svg +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - -UmlClassDiagram - - - -283 - -OETHBaseVaultCore -../contracts/vault/OETHBaseVaultCore.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _deprecated_rebaseHooksAddr: address <<VaultStorage>> -   _deprecated_uniswapAddr: address <<VaultStorage>> -   _deprecated_swapTokens: address[] <<VaultStorage>> -   __gap: uint256[44] <<VaultStorage>> -   __gap: uint256[50] <<OETHVaultCore>> -Internal: -   assets: mapping(address=>Asset) <<VaultStorage>> -   allAssets: address[] <<VaultStorage>> -   strategies: mapping(address=>Strategy) <<VaultStorage>> -   allStrategies: address[] <<VaultStorage>> -   oUSD: OUSD <<VaultStorage>> -   swapConfig: SwapConfig <<VaultStorage>> -   MAX_INT: uint256 <<VaultCore>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   priceProvider: address <<VaultStorage>> -   rebasePaused: bool <<VaultStorage>> -   capitalPaused: bool <<VaultStorage>> -   redeemFeeBps: uint256 <<VaultStorage>> -   vaultBuffer: uint256 <<VaultStorage>> -   autoAllocateThreshold: uint256 <<VaultStorage>> -   rebaseThreshold: uint256 <<VaultStorage>> -   adminImplPosition: bytes32 <<VaultStorage>> -   strategistAddr: address <<VaultStorage>> -   assetDefaultStrategies: mapping(address=>address) <<VaultStorage>> -   maxSupplyDiff: uint256 <<VaultStorage>> -   trusteeAddress: address <<VaultStorage>> -   trusteeFeeBps: uint256 <<VaultStorage>> -   MINT_MINIMUM_UNIT_PRICE: uint256 <<VaultStorage>> -   ousdMetaStrategy: address <<VaultStorage>> -   netOusdMintedForStrategy: int256 <<VaultStorage>> -   netOusdMintForStrategyThreshold: uint256 <<VaultStorage>> -   MIN_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   MAX_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   isMintWhitelistedStrategy: mapping(address=>bool) <<VaultStorage>> -   dripper: address <<VaultStorage>> -   withdrawalQueueMetadata: WithdrawalQueueMetadata <<VaultStorage>> -   withdrawalRequests: mapping(uint256=>WithdrawalRequest) <<VaultStorage>> -   withdrawalClaimDelay: uint256 <<VaultStorage>> -   weth: address <<OETHVaultCore>> -   wethAssetIndex: uint256 <<OETHVaultCore>> - -Private: -    abs(x: int256): uint256 <<VaultCore>> -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _mint(_asset: address, _amount: uint256, _minimumOusdAmount: uint256) <<OETHVaultCore>> -    _redeem(_amount: uint256, _minimumUnitAmount: uint256) <<OETHBaseVaultCore>> -    _postRedeem(_amount: uint256) <<VaultCore>> -    _allocate() <<OETHVaultCore>> -    _rebase(): uint256 <<whenNotRebasePaused>> <<VaultCore>> -    _totalValue(): (value: uint256) <<OETHVaultCore>> -    _totalValueInVault(): (value: uint256) <<OETHVaultCore>> -    _totalValueInStrategies(): (value: uint256) <<VaultCore>> -    _totalValueInStrategy(_strategyAddr: address): (value: uint256) <<VaultCore>> -    _checkBalance(_asset: address): (balance: uint256) <<OETHVaultCore>> -    _calculateRedeemOutputs(_amount: uint256): (outputs: uint256[]) <<OETHVaultCore>> -    _toUnits(_raw: uint256, _asset: address): uint256 <<VaultCore>> -    _toUnitPrice(_asset: address, isMint: bool): (price: uint256) <<VaultCore>> -    _getDecimals(_asset: address): (decimals: uint256) <<VaultCore>> -    _claimWithdrawal(requestId: uint256): (amount: uint256) <<OETHVaultCore>> -    _addWithdrawalQueueLiquidity(): (addedClaimable: uint256) <<OETHVaultCore>> -    _wethAvailable(): (wethAvailable: uint256) <<OETHVaultCore>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    setAdminImpl(newImpl: address) <<onlyGovernor>> <<VaultStorage>> -    initialize(_priceProvider: address, _oToken: address) <<onlyGovernor, initializer>> <<VaultInitializer>> -    mint(_asset: address, _amount: uint256, _minimumOusdAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    mintForStrategy(amount: uint256) <<whenNotCapitalPaused>> <<OETHVaultCore>> -    redeem(_amount: uint256, _minimumUnitAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    burnForStrategy(amount: uint256) <<whenNotCapitalPaused>> <<OETHVaultCore>> -    redeemAll(_minimumUnitAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    allocate() <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    rebase() <<nonReentrant>> <<VaultCore>> -    totalValue(): (value: uint256) <<VaultCore>> -    checkBalance(_asset: address): uint256 <<VaultCore>> -    calculateRedeemOutputs(_amount: uint256): uint256[] <<VaultCore>> -    priceUnitMint(asset: address): (price: uint256) <<VaultCore>> -    priceUnitRedeem(asset: address): (price: uint256) <<VaultCore>> -    getAllAssets(): address[] <<VaultCore>> -    getStrategyCount(): uint256 <<VaultCore>> -    getAllStrategies(): address[] <<VaultCore>> -    isSupportedAsset(_asset: address): bool <<VaultCore>> -    null() <<VaultCore>> -    cacheWETHAssetIndex() <<onlyGovernor>> <<OETHVaultCore>> -    requestWithdrawal(_amount: uint256): (requestId: uint256, queued: uint256) <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    claimWithdrawal(_requestId: uint256): (amount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    claimWithdrawals(_requestIds: uint256[]): (amounts: uint256[], totalAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    addWithdrawalQueueLiquidity() <<OETHVaultCore>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> AssetSupported(_asset: address) <<VaultStorage>> -    <<event>> AssetRemoved(_asset: address) <<VaultStorage>> -    <<event>> AssetDefaultStrategyUpdated(_asset: address, _strategy: address) <<VaultStorage>> -    <<event>> AssetAllocated(_asset: address, _strategy: address, _amount: uint256) <<VaultStorage>> -    <<event>> StrategyApproved(_addr: address) <<VaultStorage>> -    <<event>> StrategyRemoved(_addr: address) <<VaultStorage>> -    <<event>> Mint(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> Redeem(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> CapitalPaused() <<VaultStorage>> -    <<event>> CapitalUnpaused() <<VaultStorage>> -    <<event>> RebasePaused() <<VaultStorage>> -    <<event>> RebaseUnpaused() <<VaultStorage>> -    <<event>> VaultBufferUpdated(_vaultBuffer: uint256) <<VaultStorage>> -    <<event>> OusdMetaStrategyUpdated(_ousdMetaStrategy: address) <<VaultStorage>> -    <<event>> RedeemFeeUpdated(_redeemFeeBps: uint256) <<VaultStorage>> -    <<event>> PriceProviderUpdated(_priceProvider: address) <<VaultStorage>> -    <<event>> AllocateThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> RebaseThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> StrategistUpdated(_address: address) <<VaultStorage>> -    <<event>> MaxSupplyDiffChanged(maxSupplyDiff: uint256) <<VaultStorage>> -    <<event>> YieldDistribution(_to: address, _yield: uint256, _fee: uint256) <<VaultStorage>> -    <<event>> TrusteeFeeBpsChanged(_basis: uint256) <<VaultStorage>> -    <<event>> TrusteeAddressChanged(_address: address) <<VaultStorage>> -    <<event>> NetOusdMintForStrategyThresholdChanged(_threshold: uint256) <<VaultStorage>> -    <<event>> SwapperChanged(_address: address) <<VaultStorage>> -    <<event>> SwapAllowedUndervalueChanged(_basis: uint256) <<VaultStorage>> -    <<event>> SwapSlippageChanged(_asset: address, _basis: uint256) <<VaultStorage>> -    <<event>> Swapped(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _toAssetAmount: uint256) <<VaultStorage>> -    <<event>> StrategyAddedToMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> StrategyRemovedFromMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> DripperChanged(_dripper: address) <<VaultStorage>> -    <<event>> WithdrawalRequested(_withdrawer: address, _requestId: uint256, _amount: uint256, _queued: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimed(_withdrawer: address, _requestId: uint256, _amount: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimable(_claimable: uint256, _newClaimable: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimDelayUpdated(_newDelay: uint256) <<VaultStorage>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> whenNotRebasePaused() <<VaultCore>> -    <<modifier>> whenNotCapitalPaused() <<VaultCore>> -    <<modifier>> onlyOusdMetaStrategy() <<VaultCore>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> -    getAssetCount(): uint256 <<VaultCore>> -    getAssetConfig(_asset: address): (config: Asset) <<VaultCore>> -    constructor(_weth: address) <<OETHBaseVaultCore>> - - - diff --git a/contracts/docs/OETHBaseVaultStorage.svg b/contracts/docs/OETHBaseVaultStorage.svg deleted file mode 100644 index f768dd006b..0000000000 --- a/contracts/docs/OETHBaseVaultStorage.svg +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - -StorageDiagram - - - -9 - -OETHBaseVaultCore <<Contract>> - -slot - -0 - -1-50 - -51 - -52 - -53 - -54 - -55 - -56 - -57 - -58 - -59 - -60 - -61 - -62 - -63 - -64 - -65 - -66 - -67 - -68 - -69 - -70 - -71 - -72 - -73 - -74 - -75-76 - -77 - -78 - -79-122 - -123 - -124-173 - -type: <inherited contract>.variable (bytes) - -unallocated (30) - -bool: Initializable.initializing (1) - -bool: Initializable.initialized (1) - -uint256[50]: Initializable.______gap (1600) - -mapping(address=>Asset): VaultStorage.assets (32) - -address[]: VaultStorage.allAssets (32) - -mapping(address=>Strategy): VaultStorage.strategies (32) - -address[]: VaultStorage.allStrategies (32) - -unallocated (10) - -bool: VaultStorage.capitalPaused (1) - -bool: VaultStorage.rebasePaused (1) - -address: VaultStorage.priceProvider (20) - -uint256: VaultStorage.redeemFeeBps (32) - -uint256: VaultStorage.vaultBuffer (32) - -uint256: VaultStorage.autoAllocateThreshold (32) - -uint256: VaultStorage.rebaseThreshold (32) - -unallocated (12) - -OUSD: VaultStorage.oUSD (20) - -unallocated (12) - -address: VaultStorage._deprecated_rebaseHooksAddr (20) - -unallocated (12) - -address: VaultStorage._deprecated_uniswapAddr (20) - -unallocated (12) - -address: VaultStorage.strategistAddr (20) - -mapping(address=>address): VaultStorage.assetDefaultStrategies (32) - -uint256: VaultStorage.maxSupplyDiff (32) - -unallocated (12) - -address: VaultStorage.trusteeAddress (20) - -uint256: VaultStorage.trusteeFeeBps (32) - -address[]: VaultStorage._deprecated_swapTokens (32) - -unallocated (12) - -address: VaultStorage.ousdMetaStrategy (20) - -int256: VaultStorage.netOusdMintedForStrategy (32) - -uint256: VaultStorage.netOusdMintForStrategyThreshold (32) - -SwapConfig: VaultStorage.swapConfig (32) - -mapping(address=>bool): VaultStorage.isMintWhitelistedStrategy (32) - -unallocated (12) - -address: VaultStorage.dripper (20) - -WithdrawalQueueMetadata: VaultStorage.withdrawalQueueMetadata (64) - -mapping(uint256=>WithdrawalRequest): VaultStorage.withdrawalRequests (32) - -uint256: VaultStorage.withdrawalClaimDelay (32) - -uint256[44]: VaultStorage.__gap (1408) - -uint256: OETHVaultCore.wethAssetIndex (32) - -uint256[50]: OETHVaultCore.__gap (1600) - - - -1 - -Asset <<Struct>> - -offset - -0 - -type: variable (bytes) - -unallocated (27) - -uint16: allowedOracleSlippageBps (2) - -uint8: decimals (1) - -UnitConversion: unitConversion (1) - -bool: isSupported (1) - - - -9:8->1 - - - - - -2 - -address[]: allAssets <<Array>> -0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1 - -offset - -0 - -type: variable (bytes) - -unallocated (12) - -address (20) - - - -9:10->2 - - - - - -3 - -Strategy <<Struct>> - -offset - -0 - -1 - -type: variable (bytes) - -unallocated (31) - -bool: isSupported (1) - -uint256: _deprecated (32) - - - -9:13->3 - - - - - -4 - -address[]: allStrategies <<Array>> -0x4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8 - -offset - -0 - -type: variable (bytes) - -unallocated (12) - -address (20) - - - -9:15->4 - - - - - -5 - -address[]: _deprecated_swapTokens <<Array>> -0x9b22d3d61959b4d3528b1d8ba932c96fbe302b36a1aad1d95cab54f9e0a135ea - -offset - -0 - -type: variable (bytes) - -unallocated (12) - -address (20) - - - -9:32->5 - - - - - -6 - -SwapConfig <<Struct>> - -slot - -72 - -type: variable (bytes) - -unallocated (10) - -uint16: allowedUndervalueBps (2) - -address: swapper (20) - - - -9:38->6 - - - - - -7 - -WithdrawalQueueMetadata <<Struct>> - -slot - -75 - -76 - -type: variable (bytes) - -uint128: claimable (16) - -uint128: queued (16) - -uint128: nextWithdrawalIndex (16) - -uint128: claimed (16) - - - -9:45->7 - - - - - -8 - -WithdrawalRequest <<Struct>> - -offset - -0 - -1 - -type: variable (bytes) - -unallocated (6) - -uint40: timestamp (5) - -bool: claimed (1) - -address: withdrawer (20) - -uint128: queued (16) - -uint128: amount (16) - - - -9:51->8 - - - - - diff --git a/contracts/docs/OETHVaultAdminSquashed.svg b/contracts/docs/OETHVaultAdminSquashed.svg deleted file mode 100644 index 42ba2da7ee..0000000000 --- a/contracts/docs/OETHVaultAdminSquashed.svg +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - -UmlClassDiagram - - - -286 - -OETHVaultAdmin -../contracts/vault/OETHVaultAdmin.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _deprecated_rebaseHooksAddr: address <<VaultStorage>> -   _deprecated_uniswapAddr: address <<VaultStorage>> -   _deprecated_swapTokens: address[] <<VaultStorage>> -   __gap: uint256[44] <<VaultStorage>> -Internal: -   assets: mapping(address=>Asset) <<VaultStorage>> -   allAssets: address[] <<VaultStorage>> -   strategies: mapping(address=>Strategy) <<VaultStorage>> -   allStrategies: address[] <<VaultStorage>> -   oUSD: OUSD <<VaultStorage>> -   swapConfig: SwapConfig <<VaultStorage>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   priceProvider: address <<VaultStorage>> -   rebasePaused: bool <<VaultStorage>> -   capitalPaused: bool <<VaultStorage>> -   redeemFeeBps: uint256 <<VaultStorage>> -   vaultBuffer: uint256 <<VaultStorage>> -   autoAllocateThreshold: uint256 <<VaultStorage>> -   rebaseThreshold: uint256 <<VaultStorage>> -   adminImplPosition: bytes32 <<VaultStorage>> -   strategistAddr: address <<VaultStorage>> -   assetDefaultStrategies: mapping(address=>address) <<VaultStorage>> -   maxSupplyDiff: uint256 <<VaultStorage>> -   trusteeAddress: address <<VaultStorage>> -   trusteeFeeBps: uint256 <<VaultStorage>> -   MINT_MINIMUM_UNIT_PRICE: uint256 <<VaultStorage>> -   ousdMetaStrategy: address <<VaultStorage>> -   netOusdMintedForStrategy: int256 <<VaultStorage>> -   netOusdMintForStrategyThreshold: uint256 <<VaultStorage>> -   MIN_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   MAX_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   isMintWhitelistedStrategy: mapping(address=>bool) <<VaultStorage>> -   dripper: address <<VaultStorage>> -   withdrawalQueueMetadata: WithdrawalQueueMetadata <<VaultStorage>> -   withdrawalRequests: mapping(uint256=>WithdrawalRequest) <<VaultStorage>> -   withdrawalClaimDelay: uint256 <<VaultStorage>> -   weth: address <<OETHVaultAdmin>> - -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _swapCollateral(address, address, uint256, uint256, bytes): uint256 <<OETHVaultAdmin>> -    _depositToStrategy(_strategyToAddress: address, _assets: address[], _amounts: uint256[]) <<OETHVaultAdmin>> -    _withdrawFromStrategy(_recipient: address, _strategyFromAddress: address, _assets: address[], _amounts: uint256[]) <<OETHVaultAdmin>> -    _withdrawAllFromStrategy(_strategyAddr: address) <<OETHVaultAdmin>> -    _withdrawAllFromStrategies() <<OETHVaultAdmin>> -    _cacheDecimals(token: address) <<VaultAdmin>> -    _wethAvailable(): (wethAvailable: uint256) <<OETHVaultAdmin>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    setAdminImpl(newImpl: address) <<onlyGovernor>> <<VaultStorage>> -    setPriceProvider(_priceProvider: address) <<onlyGovernor>> <<VaultAdmin>> -    setRedeemFeeBps(_redeemFeeBps: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setVaultBuffer(_vaultBuffer: uint256) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    setAutoAllocateThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setRebaseThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setStrategistAddr(_address: address) <<onlyGovernor>> <<VaultAdmin>> -    setAssetDefaultStrategy(_asset: address, _strategy: address) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    setNetOusdMintForStrategyThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setDripper(_dripper: address) <<onlyGovernor>> <<VaultAdmin>> -    setWithdrawalClaimDelay(_delay: uint256) <<onlyGovernor>> <<VaultAdmin>> -    swapCollateral(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _minToAssetAmount: uint256, _data: bytes): (toAssetAmount: uint256) <<nonReentrant, onlyGovernorOrStrategist>> <<VaultAdmin>> -    setSwapper(_swapperAddr: address) <<onlyGovernor>> <<VaultAdmin>> -    swapper(): (swapper_: address) <<VaultAdmin>> -    setSwapAllowedUndervalue(_basis: uint16) <<onlyGovernor>> <<VaultAdmin>> -    allowedSwapUndervalue(): (value: uint256) <<VaultAdmin>> -    setOracleSlippage(_asset: address, _allowedOracleSlippageBps: uint16) <<onlyGovernor>> <<VaultAdmin>> -    supportAsset(_asset: address, _unitConversion: uint8) <<onlyGovernor>> <<VaultAdmin>> -    removeAsset(_asset: address) <<onlyGovernor>> <<VaultAdmin>> -    cacheDecimals(_asset: address) <<onlyGovernor>> <<VaultAdmin>> -    approveStrategy(_addr: address) <<onlyGovernor>> <<VaultAdmin>> -    removeStrategy(_addr: address) <<onlyGovernor>> <<VaultAdmin>> -    depositToStrategy(_strategyToAddress: address, _assets: address[], _amounts: uint256[]) <<onlyGovernorOrStrategist, nonReentrant>> <<VaultAdmin>> -    withdrawFromStrategy(_strategyFromAddress: address, _assets: address[], _amounts: uint256[]) <<onlyGovernorOrStrategist, nonReentrant>> <<VaultAdmin>> -    setMaxSupplyDiff(_maxSupplyDiff: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setTrusteeAddress(_address: address) <<onlyGovernor>> <<VaultAdmin>> -    setTrusteeFeeBps(_basis: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setOusdMetaStrategy(_ousdMetaStrategy: address) <<onlyGovernor>> <<VaultAdmin>> -    pauseRebase() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    unpauseRebase() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    pauseCapital() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    unpauseCapital() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<VaultAdmin>> -    withdrawAllFromStrategy(_strategyAddr: address) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    withdrawAllFromStrategies() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    addStrategyToMintWhitelist(strategyAddr: address) <<onlyGovernor>> <<OETHVaultAdmin>> -    removeStrategyFromMintWhitelist(strategyAddr: address) <<onlyGovernor>> <<OETHVaultAdmin>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> AssetSupported(_asset: address) <<VaultStorage>> -    <<event>> AssetRemoved(_asset: address) <<VaultStorage>> -    <<event>> AssetDefaultStrategyUpdated(_asset: address, _strategy: address) <<VaultStorage>> -    <<event>> AssetAllocated(_asset: address, _strategy: address, _amount: uint256) <<VaultStorage>> -    <<event>> StrategyApproved(_addr: address) <<VaultStorage>> -    <<event>> StrategyRemoved(_addr: address) <<VaultStorage>> -    <<event>> Mint(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> Redeem(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> CapitalPaused() <<VaultStorage>> -    <<event>> CapitalUnpaused() <<VaultStorage>> -    <<event>> RebasePaused() <<VaultStorage>> -    <<event>> RebaseUnpaused() <<VaultStorage>> -    <<event>> VaultBufferUpdated(_vaultBuffer: uint256) <<VaultStorage>> -    <<event>> OusdMetaStrategyUpdated(_ousdMetaStrategy: address) <<VaultStorage>> -    <<event>> RedeemFeeUpdated(_redeemFeeBps: uint256) <<VaultStorage>> -    <<event>> PriceProviderUpdated(_priceProvider: address) <<VaultStorage>> -    <<event>> AllocateThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> RebaseThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> StrategistUpdated(_address: address) <<VaultStorage>> -    <<event>> MaxSupplyDiffChanged(maxSupplyDiff: uint256) <<VaultStorage>> -    <<event>> YieldDistribution(_to: address, _yield: uint256, _fee: uint256) <<VaultStorage>> -    <<event>> TrusteeFeeBpsChanged(_basis: uint256) <<VaultStorage>> -    <<event>> TrusteeAddressChanged(_address: address) <<VaultStorage>> -    <<event>> NetOusdMintForStrategyThresholdChanged(_threshold: uint256) <<VaultStorage>> -    <<event>> SwapperChanged(_address: address) <<VaultStorage>> -    <<event>> SwapAllowedUndervalueChanged(_basis: uint256) <<VaultStorage>> -    <<event>> SwapSlippageChanged(_asset: address, _basis: uint256) <<VaultStorage>> -    <<event>> Swapped(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _toAssetAmount: uint256) <<VaultStorage>> -    <<event>> StrategyAddedToMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> StrategyRemovedFromMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> DripperChanged(_dripper: address) <<VaultStorage>> -    <<event>> WithdrawalRequested(_withdrawer: address, _requestId: uint256, _amount: uint256, _queued: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimed(_withdrawer: address, _requestId: uint256, _amount: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimable(_claimable: uint256, _newClaimable: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimDelayUpdated(_newDelay: uint256) <<VaultStorage>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyGovernorOrStrategist() <<VaultAdmin>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> -    constructor(_weth: address) <<OETHVaultAdmin>> - - - diff --git a/contracts/docs/OETHVaultCoreSquashed.svg b/contracts/docs/OETHVaultCoreSquashed.svg deleted file mode 100644 index 4bb8488671..0000000000 --- a/contracts/docs/OETHVaultCoreSquashed.svg +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - -UmlClassDiagram - - - -287 - -OETHVaultCore -../contracts/vault/OETHVaultCore.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _deprecated_rebaseHooksAddr: address <<VaultStorage>> -   _deprecated_uniswapAddr: address <<VaultStorage>> -   _deprecated_swapTokens: address[] <<VaultStorage>> -   __gap: uint256[44] <<VaultStorage>> -   __gap: uint256[50] <<OETHVaultCore>> -Internal: -   assets: mapping(address=>Asset) <<VaultStorage>> -   allAssets: address[] <<VaultStorage>> -   strategies: mapping(address=>Strategy) <<VaultStorage>> -   allStrategies: address[] <<VaultStorage>> -   oUSD: OUSD <<VaultStorage>> -   swapConfig: SwapConfig <<VaultStorage>> -   MAX_INT: uint256 <<VaultCore>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   priceProvider: address <<VaultStorage>> -   rebasePaused: bool <<VaultStorage>> -   capitalPaused: bool <<VaultStorage>> -   redeemFeeBps: uint256 <<VaultStorage>> -   vaultBuffer: uint256 <<VaultStorage>> -   autoAllocateThreshold: uint256 <<VaultStorage>> -   rebaseThreshold: uint256 <<VaultStorage>> -   adminImplPosition: bytes32 <<VaultStorage>> -   strategistAddr: address <<VaultStorage>> -   assetDefaultStrategies: mapping(address=>address) <<VaultStorage>> -   maxSupplyDiff: uint256 <<VaultStorage>> -   trusteeAddress: address <<VaultStorage>> -   trusteeFeeBps: uint256 <<VaultStorage>> -   MINT_MINIMUM_UNIT_PRICE: uint256 <<VaultStorage>> -   ousdMetaStrategy: address <<VaultStorage>> -   netOusdMintedForStrategy: int256 <<VaultStorage>> -   netOusdMintForStrategyThreshold: uint256 <<VaultStorage>> -   MIN_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   MAX_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   isMintWhitelistedStrategy: mapping(address=>bool) <<VaultStorage>> -   dripper: address <<VaultStorage>> -   withdrawalQueueMetadata: WithdrawalQueueMetadata <<VaultStorage>> -   withdrawalRequests: mapping(uint256=>WithdrawalRequest) <<VaultStorage>> -   withdrawalClaimDelay: uint256 <<VaultStorage>> -   weth: address <<OETHVaultCore>> -   wethAssetIndex: uint256 <<OETHVaultCore>> - -Private: -    abs(x: int256): uint256 <<VaultCore>> -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _mint(_asset: address, _amount: uint256, _minimumOusdAmount: uint256) <<OETHVaultCore>> -    _redeem(_amount: uint256, _minimumUnitAmount: uint256) <<OETHVaultCore>> -    _postRedeem(_amount: uint256) <<VaultCore>> -    _allocate() <<OETHVaultCore>> -    _rebase(): uint256 <<whenNotRebasePaused>> <<VaultCore>> -    _totalValue(): (value: uint256) <<OETHVaultCore>> -    _totalValueInVault(): (value: uint256) <<OETHVaultCore>> -    _totalValueInStrategies(): (value: uint256) <<VaultCore>> -    _totalValueInStrategy(_strategyAddr: address): (value: uint256) <<VaultCore>> -    _checkBalance(_asset: address): (balance: uint256) <<OETHVaultCore>> -    _calculateRedeemOutputs(_amount: uint256): (outputs: uint256[]) <<OETHVaultCore>> -    _toUnits(_raw: uint256, _asset: address): uint256 <<VaultCore>> -    _toUnitPrice(_asset: address, isMint: bool): (price: uint256) <<VaultCore>> -    _getDecimals(_asset: address): (decimals: uint256) <<VaultCore>> -    _claimWithdrawal(requestId: uint256): (amount: uint256) <<OETHVaultCore>> -    _addWithdrawalQueueLiquidity(): (addedClaimable: uint256) <<OETHVaultCore>> -    _wethAvailable(): (wethAvailable: uint256) <<OETHVaultCore>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    setAdminImpl(newImpl: address) <<onlyGovernor>> <<VaultStorage>> -    initialize(_priceProvider: address, _oToken: address) <<onlyGovernor, initializer>> <<VaultInitializer>> -    mint(_asset: address, _amount: uint256, _minimumOusdAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    mintForStrategy(amount: uint256) <<whenNotCapitalPaused>> <<OETHVaultCore>> -    redeem(_amount: uint256, _minimumUnitAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    burnForStrategy(amount: uint256) <<whenNotCapitalPaused>> <<OETHVaultCore>> -    redeemAll(_minimumUnitAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    allocate() <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    rebase() <<nonReentrant>> <<VaultCore>> -    totalValue(): (value: uint256) <<VaultCore>> -    checkBalance(_asset: address): uint256 <<VaultCore>> -    calculateRedeemOutputs(_amount: uint256): uint256[] <<VaultCore>> -    priceUnitMint(asset: address): (price: uint256) <<VaultCore>> -    priceUnitRedeem(asset: address): (price: uint256) <<VaultCore>> -    getAllAssets(): address[] <<VaultCore>> -    getStrategyCount(): uint256 <<VaultCore>> -    getAllStrategies(): address[] <<VaultCore>> -    isSupportedAsset(_asset: address): bool <<VaultCore>> -    null() <<VaultCore>> -    cacheWETHAssetIndex() <<onlyGovernor>> <<OETHVaultCore>> -    requestWithdrawal(_amount: uint256): (requestId: uint256, queued: uint256) <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    claimWithdrawal(_requestId: uint256): (amount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    claimWithdrawals(_requestIds: uint256[]): (amounts: uint256[], totalAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    addWithdrawalQueueLiquidity() <<OETHVaultCore>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> AssetSupported(_asset: address) <<VaultStorage>> -    <<event>> AssetRemoved(_asset: address) <<VaultStorage>> -    <<event>> AssetDefaultStrategyUpdated(_asset: address, _strategy: address) <<VaultStorage>> -    <<event>> AssetAllocated(_asset: address, _strategy: address, _amount: uint256) <<VaultStorage>> -    <<event>> StrategyApproved(_addr: address) <<VaultStorage>> -    <<event>> StrategyRemoved(_addr: address) <<VaultStorage>> -    <<event>> Mint(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> Redeem(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> CapitalPaused() <<VaultStorage>> -    <<event>> CapitalUnpaused() <<VaultStorage>> -    <<event>> RebasePaused() <<VaultStorage>> -    <<event>> RebaseUnpaused() <<VaultStorage>> -    <<event>> VaultBufferUpdated(_vaultBuffer: uint256) <<VaultStorage>> -    <<event>> OusdMetaStrategyUpdated(_ousdMetaStrategy: address) <<VaultStorage>> -    <<event>> RedeemFeeUpdated(_redeemFeeBps: uint256) <<VaultStorage>> -    <<event>> PriceProviderUpdated(_priceProvider: address) <<VaultStorage>> -    <<event>> AllocateThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> RebaseThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> StrategistUpdated(_address: address) <<VaultStorage>> -    <<event>> MaxSupplyDiffChanged(maxSupplyDiff: uint256) <<VaultStorage>> -    <<event>> YieldDistribution(_to: address, _yield: uint256, _fee: uint256) <<VaultStorage>> -    <<event>> TrusteeFeeBpsChanged(_basis: uint256) <<VaultStorage>> -    <<event>> TrusteeAddressChanged(_address: address) <<VaultStorage>> -    <<event>> NetOusdMintForStrategyThresholdChanged(_threshold: uint256) <<VaultStorage>> -    <<event>> SwapperChanged(_address: address) <<VaultStorage>> -    <<event>> SwapAllowedUndervalueChanged(_basis: uint256) <<VaultStorage>> -    <<event>> SwapSlippageChanged(_asset: address, _basis: uint256) <<VaultStorage>> -    <<event>> Swapped(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _toAssetAmount: uint256) <<VaultStorage>> -    <<event>> StrategyAddedToMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> StrategyRemovedFromMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> DripperChanged(_dripper: address) <<VaultStorage>> -    <<event>> WithdrawalRequested(_withdrawer: address, _requestId: uint256, _amount: uint256, _queued: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimed(_withdrawer: address, _requestId: uint256, _amount: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimable(_claimable: uint256, _newClaimable: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimDelayUpdated(_newDelay: uint256) <<VaultStorage>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> whenNotRebasePaused() <<VaultCore>> -    <<modifier>> whenNotCapitalPaused() <<VaultCore>> -    <<modifier>> onlyOusdMetaStrategy() <<VaultCore>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> -    getAssetCount(): uint256 <<VaultCore>> -    getAssetConfig(_asset: address): (config: Asset) <<VaultCore>> -    constructor(_weth: address) <<OETHVaultCore>> - - - diff --git a/contracts/docs/OETHVaultStorage.svg b/contracts/docs/OETHVaultStorage.svg deleted file mode 100644 index e425f8712d..0000000000 --- a/contracts/docs/OETHVaultStorage.svg +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - -StorageDiagram - - - -8 - -OETHVaultCore <<Contract>> - -slot - -0 - -1-50 - -51 - -52 - -53 - -54 - -55 - -56 - -57 - -58 - -59 - -60 - -61 - -62 - -63 - -64 - -65 - -66 - -67 - -68 - -69 - -70 - -71 - -72 - -73 - -74 - -75-76 - -77 - -78 - -79-122 - -123 - -124-173 - -type: <inherited contract>.variable (bytes) - -unallocated (30) - -bool: Initializable.initializing (1) - -bool: Initializable.initialized (1) - -uint256[50]: Initializable.______gap (1600) - -mapping(address=>Asset): VaultStorage.assets (32) - -address[]: VaultStorage.allAssets (32) - -mapping(address=>Strategy): VaultStorage.strategies (32) - -address[]: VaultStorage.allStrategies (32) - -unallocated (10) - -bool: VaultStorage.capitalPaused (1) - -bool: VaultStorage.rebasePaused (1) - -address: VaultStorage.priceProvider (20) - -uint256: VaultStorage.redeemFeeBps (32) - -uint256: VaultStorage.vaultBuffer (32) - -uint256: VaultStorage.autoAllocateThreshold (32) - -uint256: VaultStorage.rebaseThreshold (32) - -unallocated (12) - -OUSD: VaultStorage.oUSD (20) - -unallocated (12) - -address: VaultStorage._deprecated_rebaseHooksAddr (20) - -unallocated (12) - -address: VaultStorage._deprecated_uniswapAddr (20) - -unallocated (12) - -address: VaultStorage.strategistAddr (20) - -mapping(address=>address): VaultStorage.assetDefaultStrategies (32) - -uint256: VaultStorage.maxSupplyDiff (32) - -unallocated (12) - -address: VaultStorage.trusteeAddress (20) - -uint256: VaultStorage.trusteeFeeBps (32) - -address[]: VaultStorage._deprecated_swapTokens (32) - -unallocated (12) - -address: VaultStorage.ousdMetaStrategy (20) - -int256: VaultStorage.netOusdMintedForStrategy (32) - -uint256: VaultStorage.netOusdMintForStrategyThreshold (32) - -SwapConfig: VaultStorage.swapConfig (32) - -mapping(address=>bool): VaultStorage.isMintWhitelistedStrategy (32) - -unallocated (12) - -address: VaultStorage.dripper (20) - -WithdrawalQueueMetadata: VaultStorage.withdrawalQueueMetadata (64) - -mapping(uint256=>WithdrawalRequest): VaultStorage.withdrawalRequests (32) - -uint256: VaultStorage.withdrawalClaimDelay (32) - -uint256[44]: VaultStorage.__gap (1408) - -uint256: wethAssetIndex (32) - -uint256[50]: __gap (1600) - - - -1 - -Asset <<Struct>> - -offset - -0 - -type: variable (bytes) - -unallocated (27) - -uint16: allowedOracleSlippageBps (2) - -uint8: decimals (1) - -UnitConversion: unitConversion (1) - -bool: isSupported (1) - - - -8:8->1 - - - - - -2 - -address[]: allAssets <<Array>> -0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1 - -offset - -0 - -type: variable (bytes) - -unallocated (12) - -address (20) - - - -8:10->2 - - - - - -3 - -Strategy <<Struct>> - -offset - -0 - -1 - -type: variable (bytes) - -unallocated (31) - -bool: isSupported (1) - -uint256: _deprecated (32) - - - -8:13->3 - - - - - -4 - -address[]: allStrategies <<Array>> -0x4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8 - -offset - -0 - -type: variable (bytes) - -unallocated (12) - -address (20) - - - -8:15->4 - - - - - -5 - -SwapConfig <<Struct>> - -slot - -72 - -type: variable (bytes) - -unallocated (10) - -uint16: allowedUndervalueBps (2) - -address: swapper (20) - - - -8:37->5 - - - - - -6 - -WithdrawalQueueMetadata <<Struct>> - -slot - -75 - -76 - -type: variable (bytes) - -uint128: claimable (16) - -uint128: queued (16) - -uint128: nextWithdrawalIndex (16) - -uint128: claimed (16) - - - -8:44->6 - - - - - -7 - -WithdrawalRequest <<Struct>> - -offset - -0 - -1 - -type: variable (bytes) - -unallocated (6) - -uint40: timestamp (5) - -bool: claimed (1) - -address: withdrawer (20) - -uint128: queued (16) - -uint128: amount (16) - - - -8:50->7 - - - - - diff --git a/contracts/docs/OSonicVaultAdminSquashed.svg b/contracts/docs/OSonicVaultAdminSquashed.svg deleted file mode 100644 index ba51485b4e..0000000000 --- a/contracts/docs/OSonicVaultAdminSquashed.svg +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - -UmlClassDiagram - - - -289 - -OSonicVaultAdmin -../contracts/vault/OSonicVaultAdmin.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _deprecated_rebaseHooksAddr: address <<VaultStorage>> -   _deprecated_uniswapAddr: address <<VaultStorage>> -   _deprecated_swapTokens: address[] <<VaultStorage>> -   __gap: uint256[44] <<VaultStorage>> -Internal: -   assets: mapping(address=>Asset) <<VaultStorage>> -   allAssets: address[] <<VaultStorage>> -   strategies: mapping(address=>Strategy) <<VaultStorage>> -   allStrategies: address[] <<VaultStorage>> -   oUSD: OUSD <<VaultStorage>> -   swapConfig: SwapConfig <<VaultStorage>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   priceProvider: address <<VaultStorage>> -   rebasePaused: bool <<VaultStorage>> -   capitalPaused: bool <<VaultStorage>> -   redeemFeeBps: uint256 <<VaultStorage>> -   vaultBuffer: uint256 <<VaultStorage>> -   autoAllocateThreshold: uint256 <<VaultStorage>> -   rebaseThreshold: uint256 <<VaultStorage>> -   adminImplPosition: bytes32 <<VaultStorage>> -   strategistAddr: address <<VaultStorage>> -   assetDefaultStrategies: mapping(address=>address) <<VaultStorage>> -   maxSupplyDiff: uint256 <<VaultStorage>> -   trusteeAddress: address <<VaultStorage>> -   trusteeFeeBps: uint256 <<VaultStorage>> -   MINT_MINIMUM_UNIT_PRICE: uint256 <<VaultStorage>> -   ousdMetaStrategy: address <<VaultStorage>> -   netOusdMintedForStrategy: int256 <<VaultStorage>> -   netOusdMintForStrategyThreshold: uint256 <<VaultStorage>> -   MIN_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   MAX_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   isMintWhitelistedStrategy: mapping(address=>bool) <<VaultStorage>> -   dripper: address <<VaultStorage>> -   withdrawalQueueMetadata: WithdrawalQueueMetadata <<VaultStorage>> -   withdrawalRequests: mapping(uint256=>WithdrawalRequest) <<VaultStorage>> -   withdrawalClaimDelay: uint256 <<VaultStorage>> -   weth: address <<OETHVaultAdmin>> - -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _swapCollateral(address, address, uint256, uint256, bytes): uint256 <<OETHVaultAdmin>> -    _depositToStrategy(_strategyToAddress: address, _assets: address[], _amounts: uint256[]) <<OETHVaultAdmin>> -    _withdrawFromStrategy(_recipient: address, _strategyFromAddress: address, _assets: address[], _amounts: uint256[]) <<OETHVaultAdmin>> -    _withdrawAllFromStrategy(_strategyAddr: address) <<OETHVaultAdmin>> -    _withdrawAllFromStrategies() <<OETHVaultAdmin>> -    _cacheDecimals(token: address) <<VaultAdmin>> -    _wethAvailable(): (wethAvailable: uint256) <<OETHVaultAdmin>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    setAdminImpl(newImpl: address) <<onlyGovernor>> <<VaultStorage>> -    setPriceProvider(_priceProvider: address) <<onlyGovernor>> <<VaultAdmin>> -    setRedeemFeeBps(_redeemFeeBps: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setVaultBuffer(_vaultBuffer: uint256) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    setAutoAllocateThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setRebaseThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setStrategistAddr(_address: address) <<onlyGovernor>> <<VaultAdmin>> -    setAssetDefaultStrategy(_asset: address, _strategy: address) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    setNetOusdMintForStrategyThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setDripper(_dripper: address) <<onlyGovernor>> <<VaultAdmin>> -    setWithdrawalClaimDelay(_delay: uint256) <<onlyGovernor>> <<VaultAdmin>> -    swapCollateral(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _minToAssetAmount: uint256, _data: bytes): (toAssetAmount: uint256) <<nonReentrant, onlyGovernorOrStrategist>> <<VaultAdmin>> -    setSwapper(_swapperAddr: address) <<onlyGovernor>> <<VaultAdmin>> -    swapper(): (swapper_: address) <<VaultAdmin>> -    setSwapAllowedUndervalue(_basis: uint16) <<onlyGovernor>> <<VaultAdmin>> -    allowedSwapUndervalue(): (value: uint256) <<VaultAdmin>> -    setOracleSlippage(_asset: address, _allowedOracleSlippageBps: uint16) <<onlyGovernor>> <<VaultAdmin>> -    supportAsset(_asset: address, _unitConversion: uint8) <<onlyGovernor>> <<OSonicVaultAdmin>> -    removeAsset(_asset: address) <<onlyGovernor>> <<VaultAdmin>> -    cacheDecimals(_asset: address) <<onlyGovernor>> <<VaultAdmin>> -    approveStrategy(_addr: address) <<onlyGovernor>> <<VaultAdmin>> -    removeStrategy(_addr: address) <<onlyGovernor>> <<VaultAdmin>> -    depositToStrategy(_strategyToAddress: address, _assets: address[], _amounts: uint256[]) <<onlyGovernorOrStrategist, nonReentrant>> <<VaultAdmin>> -    withdrawFromStrategy(_strategyFromAddress: address, _assets: address[], _amounts: uint256[]) <<onlyGovernorOrStrategist, nonReentrant>> <<VaultAdmin>> -    setMaxSupplyDiff(_maxSupplyDiff: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setTrusteeAddress(_address: address) <<onlyGovernor>> <<VaultAdmin>> -    setTrusteeFeeBps(_basis: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setOusdMetaStrategy(_ousdMetaStrategy: address) <<onlyGovernor>> <<VaultAdmin>> -    pauseRebase() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    unpauseRebase() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    pauseCapital() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    unpauseCapital() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<VaultAdmin>> -    withdrawAllFromStrategy(_strategyAddr: address) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    withdrawAllFromStrategies() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    addStrategyToMintWhitelist(strategyAddr: address) <<onlyGovernor>> <<OETHVaultAdmin>> -    removeStrategyFromMintWhitelist(strategyAddr: address) <<onlyGovernor>> <<OETHVaultAdmin>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> AssetSupported(_asset: address) <<VaultStorage>> -    <<event>> AssetRemoved(_asset: address) <<VaultStorage>> -    <<event>> AssetDefaultStrategyUpdated(_asset: address, _strategy: address) <<VaultStorage>> -    <<event>> AssetAllocated(_asset: address, _strategy: address, _amount: uint256) <<VaultStorage>> -    <<event>> StrategyApproved(_addr: address) <<VaultStorage>> -    <<event>> StrategyRemoved(_addr: address) <<VaultStorage>> -    <<event>> Mint(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> Redeem(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> CapitalPaused() <<VaultStorage>> -    <<event>> CapitalUnpaused() <<VaultStorage>> -    <<event>> RebasePaused() <<VaultStorage>> -    <<event>> RebaseUnpaused() <<VaultStorage>> -    <<event>> VaultBufferUpdated(_vaultBuffer: uint256) <<VaultStorage>> -    <<event>> OusdMetaStrategyUpdated(_ousdMetaStrategy: address) <<VaultStorage>> -    <<event>> RedeemFeeUpdated(_redeemFeeBps: uint256) <<VaultStorage>> -    <<event>> PriceProviderUpdated(_priceProvider: address) <<VaultStorage>> -    <<event>> AllocateThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> RebaseThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> StrategistUpdated(_address: address) <<VaultStorage>> -    <<event>> MaxSupplyDiffChanged(maxSupplyDiff: uint256) <<VaultStorage>> -    <<event>> YieldDistribution(_to: address, _yield: uint256, _fee: uint256) <<VaultStorage>> -    <<event>> TrusteeFeeBpsChanged(_basis: uint256) <<VaultStorage>> -    <<event>> TrusteeAddressChanged(_address: address) <<VaultStorage>> -    <<event>> NetOusdMintForStrategyThresholdChanged(_threshold: uint256) <<VaultStorage>> -    <<event>> SwapperChanged(_address: address) <<VaultStorage>> -    <<event>> SwapAllowedUndervalueChanged(_basis: uint256) <<VaultStorage>> -    <<event>> SwapSlippageChanged(_asset: address, _basis: uint256) <<VaultStorage>> -    <<event>> Swapped(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _toAssetAmount: uint256) <<VaultStorage>> -    <<event>> StrategyAddedToMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> StrategyRemovedFromMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> DripperChanged(_dripper: address) <<VaultStorage>> -    <<event>> WithdrawalRequested(_withdrawer: address, _requestId: uint256, _amount: uint256, _queued: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimed(_withdrawer: address, _requestId: uint256, _amount: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimable(_claimable: uint256, _newClaimable: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimDelayUpdated(_newDelay: uint256) <<VaultStorage>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyGovernorOrStrategist() <<VaultAdmin>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> -    constructor(_wS: address) <<OSonicVaultAdmin>> - - - diff --git a/contracts/docs/OSonicVaultCoreSquashed.svg b/contracts/docs/OSonicVaultCoreSquashed.svg deleted file mode 100644 index 9d467a3367..0000000000 --- a/contracts/docs/OSonicVaultCoreSquashed.svg +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - -UmlClassDiagram - - - -290 - -OSonicVaultCore -../contracts/vault/OSonicVaultCore.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _deprecated_rebaseHooksAddr: address <<VaultStorage>> -   _deprecated_uniswapAddr: address <<VaultStorage>> -   _deprecated_swapTokens: address[] <<VaultStorage>> -   __gap: uint256[44] <<VaultStorage>> -   __gap: uint256[50] <<OETHVaultCore>> -Internal: -   assets: mapping(address=>Asset) <<VaultStorage>> -   allAssets: address[] <<VaultStorage>> -   strategies: mapping(address=>Strategy) <<VaultStorage>> -   allStrategies: address[] <<VaultStorage>> -   oUSD: OUSD <<VaultStorage>> -   swapConfig: SwapConfig <<VaultStorage>> -   MAX_INT: uint256 <<VaultCore>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   priceProvider: address <<VaultStorage>> -   rebasePaused: bool <<VaultStorage>> -   capitalPaused: bool <<VaultStorage>> -   redeemFeeBps: uint256 <<VaultStorage>> -   vaultBuffer: uint256 <<VaultStorage>> -   autoAllocateThreshold: uint256 <<VaultStorage>> -   rebaseThreshold: uint256 <<VaultStorage>> -   adminImplPosition: bytes32 <<VaultStorage>> -   strategistAddr: address <<VaultStorage>> -   assetDefaultStrategies: mapping(address=>address) <<VaultStorage>> -   maxSupplyDiff: uint256 <<VaultStorage>> -   trusteeAddress: address <<VaultStorage>> -   trusteeFeeBps: uint256 <<VaultStorage>> -   MINT_MINIMUM_UNIT_PRICE: uint256 <<VaultStorage>> -   ousdMetaStrategy: address <<VaultStorage>> -   netOusdMintedForStrategy: int256 <<VaultStorage>> -   netOusdMintForStrategyThreshold: uint256 <<VaultStorage>> -   MIN_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   MAX_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   isMintWhitelistedStrategy: mapping(address=>bool) <<VaultStorage>> -   dripper: address <<VaultStorage>> -   withdrawalQueueMetadata: WithdrawalQueueMetadata <<VaultStorage>> -   withdrawalRequests: mapping(uint256=>WithdrawalRequest) <<VaultStorage>> -   withdrawalClaimDelay: uint256 <<VaultStorage>> -   weth: address <<OETHVaultCore>> -   wethAssetIndex: uint256 <<OETHVaultCore>> - -Private: -    abs(x: int256): uint256 <<VaultCore>> -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _mint(_asset: address, _amount: uint256, _minimumOusdAmount: uint256) <<OETHVaultCore>> -    _redeem(_amount: uint256, _minimumUnitAmount: uint256) <<OETHVaultCore>> -    _postRedeem(_amount: uint256) <<VaultCore>> -    _allocate() <<OETHVaultCore>> -    _rebase(): uint256 <<whenNotRebasePaused>> <<VaultCore>> -    _totalValue(): (value: uint256) <<OETHVaultCore>> -    _totalValueInVault(): (value: uint256) <<OETHVaultCore>> -    _totalValueInStrategies(): (value: uint256) <<VaultCore>> -    _totalValueInStrategy(_strategyAddr: address): (value: uint256) <<VaultCore>> -    _checkBalance(_asset: address): (balance: uint256) <<OETHVaultCore>> -    _calculateRedeemOutputs(_amount: uint256): (outputs: uint256[]) <<OETHVaultCore>> -    _toUnits(_raw: uint256, _asset: address): uint256 <<VaultCore>> -    _toUnitPrice(_asset: address, isMint: bool): (price: uint256) <<VaultCore>> -    _getDecimals(_asset: address): (decimals: uint256) <<VaultCore>> -    _claimWithdrawal(requestId: uint256): (amount: uint256) <<OETHVaultCore>> -    _addWithdrawalQueueLiquidity(): (addedClaimable: uint256) <<OETHVaultCore>> -    _wethAvailable(): (wethAvailable: uint256) <<OETHVaultCore>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    setAdminImpl(newImpl: address) <<onlyGovernor>> <<VaultStorage>> -    initialize(_priceProvider: address, _oToken: address) <<onlyGovernor, initializer>> <<VaultInitializer>> -    mint(_asset: address, _amount: uint256, _minimumOusdAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    mintForStrategy(amount: uint256) <<whenNotCapitalPaused>> <<OETHVaultCore>> -    redeem(uint256, uint256) <<OSonicVaultCore>> -    burnForStrategy(amount: uint256) <<whenNotCapitalPaused>> <<OETHVaultCore>> -    redeemAll(_minimumUnitAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    allocate() <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    rebase() <<nonReentrant>> <<VaultCore>> -    totalValue(): (value: uint256) <<VaultCore>> -    checkBalance(_asset: address): uint256 <<VaultCore>> -    calculateRedeemOutputs(_amount: uint256): uint256[] <<VaultCore>> -    priceUnitMint(asset: address): (price: uint256) <<VaultCore>> -    priceUnitRedeem(asset: address): (price: uint256) <<VaultCore>> -    getAllAssets(): address[] <<VaultCore>> -    getStrategyCount(): uint256 <<VaultCore>> -    getAllStrategies(): address[] <<VaultCore>> -    isSupportedAsset(_asset: address): bool <<VaultCore>> -    null() <<VaultCore>> -    cacheWETHAssetIndex() <<onlyGovernor>> <<OETHVaultCore>> -    requestWithdrawal(_amount: uint256): (requestId: uint256, queued: uint256) <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    claimWithdrawal(_requestId: uint256): (amount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    claimWithdrawals(_requestIds: uint256[]): (amounts: uint256[], totalAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<OETHVaultCore>> -    addWithdrawalQueueLiquidity() <<OETHVaultCore>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> AssetSupported(_asset: address) <<VaultStorage>> -    <<event>> AssetRemoved(_asset: address) <<VaultStorage>> -    <<event>> AssetDefaultStrategyUpdated(_asset: address, _strategy: address) <<VaultStorage>> -    <<event>> AssetAllocated(_asset: address, _strategy: address, _amount: uint256) <<VaultStorage>> -    <<event>> StrategyApproved(_addr: address) <<VaultStorage>> -    <<event>> StrategyRemoved(_addr: address) <<VaultStorage>> -    <<event>> Mint(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> Redeem(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> CapitalPaused() <<VaultStorage>> -    <<event>> CapitalUnpaused() <<VaultStorage>> -    <<event>> RebasePaused() <<VaultStorage>> -    <<event>> RebaseUnpaused() <<VaultStorage>> -    <<event>> VaultBufferUpdated(_vaultBuffer: uint256) <<VaultStorage>> -    <<event>> OusdMetaStrategyUpdated(_ousdMetaStrategy: address) <<VaultStorage>> -    <<event>> RedeemFeeUpdated(_redeemFeeBps: uint256) <<VaultStorage>> -    <<event>> PriceProviderUpdated(_priceProvider: address) <<VaultStorage>> -    <<event>> AllocateThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> RebaseThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> StrategistUpdated(_address: address) <<VaultStorage>> -    <<event>> MaxSupplyDiffChanged(maxSupplyDiff: uint256) <<VaultStorage>> -    <<event>> YieldDistribution(_to: address, _yield: uint256, _fee: uint256) <<VaultStorage>> -    <<event>> TrusteeFeeBpsChanged(_basis: uint256) <<VaultStorage>> -    <<event>> TrusteeAddressChanged(_address: address) <<VaultStorage>> -    <<event>> NetOusdMintForStrategyThresholdChanged(_threshold: uint256) <<VaultStorage>> -    <<event>> SwapperChanged(_address: address) <<VaultStorage>> -    <<event>> SwapAllowedUndervalueChanged(_basis: uint256) <<VaultStorage>> -    <<event>> SwapSlippageChanged(_asset: address, _basis: uint256) <<VaultStorage>> -    <<event>> Swapped(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _toAssetAmount: uint256) <<VaultStorage>> -    <<event>> StrategyAddedToMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> StrategyRemovedFromMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> DripperChanged(_dripper: address) <<VaultStorage>> -    <<event>> WithdrawalRequested(_withdrawer: address, _requestId: uint256, _amount: uint256, _queued: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimed(_withdrawer: address, _requestId: uint256, _amount: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimable(_claimable: uint256, _newClaimable: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimDelayUpdated(_newDelay: uint256) <<VaultStorage>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> whenNotRebasePaused() <<VaultCore>> -    <<modifier>> whenNotCapitalPaused() <<VaultCore>> -    <<modifier>> onlyOusdMetaStrategy() <<VaultCore>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> -    getAssetCount(): uint256 <<VaultCore>> -    getAssetConfig(_asset: address): (config: Asset) <<VaultCore>> -    constructor(_wS: address) <<OSonicVaultCore>> - - - diff --git a/contracts/docs/OSonicVaultStorage.svg b/contracts/docs/OSonicVaultStorage.svg deleted file mode 100644 index 1f9243ad89..0000000000 --- a/contracts/docs/OSonicVaultStorage.svg +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - -StorageDiagram - - - -8 - -OSonicVaultCore <<Contract>> - -slot - -0 - -1-50 - -51 - -52 - -53 - -54 - -55 - -56 - -57 - -58 - -59 - -60 - -61 - -62 - -63 - -64 - -65 - -66 - -67 - -68 - -69 - -70 - -71 - -72 - -73 - -74 - -75-76 - -77 - -78 - -79-122 - -123 - -124-173 - -type: <inherited contract>.variable (bytes) - -unallocated (30) - -bool: Initializable.initializing (1) - -bool: Initializable.initialized (1) - -uint256[50]: Initializable.______gap (1600) - -mapping(address=>Asset): VaultStorage.assets (32) - -address[]: VaultStorage.allAssets (32) - -mapping(address=>Strategy): VaultStorage.strategies (32) - -address[]: VaultStorage.allStrategies (32) - -unallocated (10) - -bool: VaultStorage.capitalPaused (1) - -bool: VaultStorage.rebasePaused (1) - -address: VaultStorage.priceProvider (20) - -uint256: VaultStorage.redeemFeeBps (32) - -uint256: VaultStorage.vaultBuffer (32) - -uint256: VaultStorage.autoAllocateThreshold (32) - -uint256: VaultStorage.rebaseThreshold (32) - -unallocated (12) - -OUSD: VaultStorage.oUSD (20) - -unallocated (12) - -address: VaultStorage._deprecated_rebaseHooksAddr (20) - -unallocated (12) - -address: VaultStorage._deprecated_uniswapAddr (20) - -unallocated (12) - -address: VaultStorage.strategistAddr (20) - -mapping(address=>address): VaultStorage.assetDefaultStrategies (32) - -uint256: VaultStorage.maxSupplyDiff (32) - -unallocated (12) - -address: VaultStorage.trusteeAddress (20) - -uint256: VaultStorage.trusteeFeeBps (32) - -address[]: VaultStorage._deprecated_swapTokens (32) - -unallocated (12) - -address: VaultStorage.ousdMetaStrategy (20) - -int256: VaultStorage.netOusdMintedForStrategy (32) - -uint256: VaultStorage.netOusdMintForStrategyThreshold (32) - -SwapConfig: VaultStorage.swapConfig (32) - -mapping(address=>bool): VaultStorage.isMintWhitelistedStrategy (32) - -unallocated (12) - -address: VaultStorage.dripper (20) - -WithdrawalQueueMetadata: VaultStorage.withdrawalQueueMetadata (64) - -mapping(uint256=>WithdrawalRequest): VaultStorage.withdrawalRequests (32) - -uint256: VaultStorage.withdrawalClaimDelay (32) - -uint256[44]: VaultStorage.__gap (1408) - -uint256: OETHVaultCore.wethAssetIndex (32) - -uint256[50]: OETHVaultCore.__gap (1600) - - - -1 - -Asset <<Struct>> - -offset - -0 - -type: variable (bytes) - -unallocated (27) - -uint16: allowedOracleSlippageBps (2) - -uint8: decimals (1) - -UnitConversion: unitConversion (1) - -bool: isSupported (1) - - - -8:8->1 - - - - - -2 - -address[]: allAssets <<Array>> -0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1 - -offset - -0 - -type: variable (bytes) - -unallocated (12) - -address (20) - - - -8:10->2 - - - - - -3 - -Strategy <<Struct>> - -offset - -0 - -1 - -type: variable (bytes) - -unallocated (31) - -bool: isSupported (1) - -uint256: _deprecated (32) - - - -8:13->3 - - - - - -4 - -address[]: allStrategies <<Array>> -0x4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8 - -offset - -0 - -type: variable (bytes) - -unallocated (12) - -address (20) - - - -8:15->4 - - - - - -5 - -SwapConfig <<Struct>> - -slot - -72 - -type: variable (bytes) - -unallocated (10) - -uint16: allowedUndervalueBps (2) - -address: swapper (20) - - - -8:37->5 - - - - - -6 - -WithdrawalQueueMetadata <<Struct>> - -slot - -75 - -76 - -type: variable (bytes) - -uint128: claimable (16) - -uint128: queued (16) - -uint128: nextWithdrawalIndex (16) - -uint128: claimed (16) - - - -8:44->6 - - - - - -7 - -WithdrawalRequest <<Struct>> - -offset - -0 - -1 - -type: variable (bytes) - -unallocated (6) - -uint40: timestamp (5) - -bool: claimed (1) - -address: withdrawer (20) - -uint128: queued (16) - -uint128: amount (16) - - - -8:50->7 - - - - - diff --git a/contracts/docs/VaultCoreSquashed.svg b/contracts/docs/VaultCoreSquashed.svg deleted file mode 100644 index e0accdf3c5..0000000000 --- a/contracts/docs/VaultCoreSquashed.svg +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - -UmlClassDiagram - - - -302 - -VaultCore -../contracts/vault/VaultCore.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _deprecated_rebaseHooksAddr: address <<VaultStorage>> -   _deprecated_uniswapAddr: address <<VaultStorage>> -   _deprecated_swapTokens: address[] <<VaultStorage>> -   __gap: uint256[43] <<VaultStorage>> -Internal: -   assets: mapping(address=>Asset) <<VaultStorage>> -   allAssets: address[] <<VaultStorage>> -   allStrategies: address[] <<VaultStorage>> -   swapConfig: SwapConfig <<VaultStorage>> -   MAX_REBASE: uint256 <<VaultStorage>> -   MAX_REBASE_PER_SECOND: uint256 <<VaultStorage>> -   MAX_INT: uint256 <<VaultCore>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   strategies: mapping(address=>Strategy) <<VaultStorage>> -   priceProvider: address <<VaultStorage>> -   rebasePaused: bool <<VaultStorage>> -   capitalPaused: bool <<VaultStorage>> -   redeemFeeBps: uint256 <<VaultStorage>> -   vaultBuffer: uint256 <<VaultStorage>> -   autoAllocateThreshold: uint256 <<VaultStorage>> -   rebaseThreshold: uint256 <<VaultStorage>> -   oUSD: OUSD <<VaultStorage>> -   adminImplPosition: bytes32 <<VaultStorage>> -   strategistAddr: address <<VaultStorage>> -   assetDefaultStrategies: mapping(address=>address) <<VaultStorage>> -   maxSupplyDiff: uint256 <<VaultStorage>> -   trusteeAddress: address <<VaultStorage>> -   trusteeFeeBps: uint256 <<VaultStorage>> -   MINT_MINIMUM_UNIT_PRICE: uint256 <<VaultStorage>> -   ousdMetaStrategy: address <<VaultStorage>> -   netOusdMintedForStrategy: int256 <<VaultStorage>> -   netOusdMintForStrategyThreshold: uint256 <<VaultStorage>> -   MIN_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   MAX_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   isMintWhitelistedStrategy: mapping(address=>bool) <<VaultStorage>> -   dripper: address <<VaultStorage>> -   withdrawalQueueMetadata: WithdrawalQueueMetadata <<VaultStorage>> -   withdrawalRequests: mapping(uint256=>WithdrawalRequest) <<VaultStorage>> -   withdrawalClaimDelay: uint256 <<VaultStorage>> -   lastRebase: uint64 <<VaultStorage>> -   dripDuration: uint64 <<VaultStorage>> -   rebasePerSecondMax: uint64 <<VaultStorage>> -   rebasePerSecondTarget: uint64 <<VaultStorage>> - -Private: -    abs(x: int256): uint256 <<VaultCore>> -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _mint(_asset: address, _amount: uint256, _minimumOusdAmount: uint256) <<VaultCore>> -    _redeem(_amount: uint256, _minimumUnitAmount: uint256) <<VaultCore>> -    _postRedeem(_amount: uint256) <<VaultCore>> -    _allocate() <<VaultCore>> -    _rebase(): uint256 <<whenNotRebasePaused>> <<VaultCore>> -    _nextYield(supply: uint256, vaultValue: uint256, nonRebasing: uint256): (yield: uint256, targetRate: uint256) <<VaultCore>> -    _totalValue(): (value: uint256) <<VaultCore>> -    _totalValueInVault(): (value: uint256) <<VaultCore>> -    _totalValueInStrategies(): (value: uint256) <<VaultCore>> -    _totalValueInStrategy(_strategyAddr: address): (value: uint256) <<VaultCore>> -    _checkBalance(_asset: address): (balance: uint256) <<VaultCore>> -    _calculateRedeemOutputs(_amount: uint256): (outputs: uint256[]) <<VaultCore>> -    _toUnits(_raw: uint256, _asset: address): uint256 <<VaultCore>> -    _toUnitPrice(_asset: address, isMint: bool): (price: uint256) <<VaultCore>> -    _getDecimals(_asset: address): (decimals: uint256) <<VaultCore>> -    _min(a: uint256, b: uint256): uint256 <<VaultCore>> -    _max(a: uint256, b: uint256): uint256 <<VaultCore>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    setAdminImpl(newImpl: address) <<onlyGovernor>> <<VaultStorage>> -    initialize(_priceProvider: address, _oToken: address) <<onlyGovernor, initializer>> <<VaultInitializer>> -    mint(_asset: address, _amount: uint256, _minimumOusdAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    mintForStrategy(_amount: uint256) <<whenNotCapitalPaused, onlyOusdMetaStrategy>> <<VaultCore>> -    redeem(_amount: uint256, _minimumUnitAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    burnForStrategy(_amount: uint256) <<whenNotCapitalPaused, onlyOusdMetaStrategy>> <<VaultCore>> -    redeemAll(_minimumUnitAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    allocate() <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> -    rebase() <<nonReentrant>> <<VaultCore>> -    previewYield(): (yield: uint256) <<VaultCore>> -    totalValue(): (value: uint256) <<VaultCore>> -    checkBalance(_asset: address): uint256 <<VaultCore>> -    calculateRedeemOutputs(_amount: uint256): uint256[] <<VaultCore>> -    priceUnitMint(asset: address): (price: uint256) <<VaultCore>> -    priceUnitRedeem(asset: address): (price: uint256) <<VaultCore>> -    getAllAssets(): address[] <<VaultCore>> -    getStrategyCount(): uint256 <<VaultCore>> -    getAllStrategies(): address[] <<VaultCore>> -    isSupportedAsset(_asset: address): bool <<VaultCore>> -    ADMIN_IMPLEMENTATION(): (adminImpl: address) <<VaultCore>> -    null() <<VaultCore>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> AssetSupported(_asset: address) <<VaultStorage>> -    <<event>> AssetRemoved(_asset: address) <<VaultStorage>> -    <<event>> AssetDefaultStrategyUpdated(_asset: address, _strategy: address) <<VaultStorage>> -    <<event>> AssetAllocated(_asset: address, _strategy: address, _amount: uint256) <<VaultStorage>> -    <<event>> StrategyApproved(_addr: address) <<VaultStorage>> -    <<event>> StrategyRemoved(_addr: address) <<VaultStorage>> -    <<event>> Mint(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> Redeem(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> CapitalPaused() <<VaultStorage>> -    <<event>> CapitalUnpaused() <<VaultStorage>> -    <<event>> RebasePaused() <<VaultStorage>> -    <<event>> RebaseUnpaused() <<VaultStorage>> -    <<event>> VaultBufferUpdated(_vaultBuffer: uint256) <<VaultStorage>> -    <<event>> OusdMetaStrategyUpdated(_ousdMetaStrategy: address) <<VaultStorage>> -    <<event>> RedeemFeeUpdated(_redeemFeeBps: uint256) <<VaultStorage>> -    <<event>> PriceProviderUpdated(_priceProvider: address) <<VaultStorage>> -    <<event>> AllocateThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> RebaseThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> StrategistUpdated(_address: address) <<VaultStorage>> -    <<event>> MaxSupplyDiffChanged(maxSupplyDiff: uint256) <<VaultStorage>> -    <<event>> YieldDistribution(_to: address, _yield: uint256, _fee: uint256) <<VaultStorage>> -    <<event>> TrusteeFeeBpsChanged(_basis: uint256) <<VaultStorage>> -    <<event>> TrusteeAddressChanged(_address: address) <<VaultStorage>> -    <<event>> NetOusdMintForStrategyThresholdChanged(_threshold: uint256) <<VaultStorage>> -    <<event>> SwapperChanged(_address: address) <<VaultStorage>> -    <<event>> SwapAllowedUndervalueChanged(_basis: uint256) <<VaultStorage>> -    <<event>> SwapSlippageChanged(_asset: address, _basis: uint256) <<VaultStorage>> -    <<event>> Swapped(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _toAssetAmount: uint256) <<VaultStorage>> -    <<event>> StrategyAddedToMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> StrategyRemovedFromMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> DripperChanged(_dripper: address) <<VaultStorage>> -    <<event>> RebasePerSecondMaxChanged(rebaseRatePerSecond: uint256) <<VaultStorage>> -    <<event>> DripDurationChanged(dripDuration: uint256) <<VaultStorage>> -    <<event>> WithdrawalRequested(_withdrawer: address, _requestId: uint256, _amount: uint256, _queued: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimed(_withdrawer: address, _requestId: uint256, _amount: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimable(_claimable: uint256, _newClaimable: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimDelayUpdated(_newDelay: uint256) <<VaultStorage>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> whenNotRebasePaused() <<VaultCore>> -    <<modifier>> whenNotCapitalPaused() <<VaultCore>> -    <<modifier>> onlyOusdMetaStrategy() <<VaultCore>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> -    getAssetCount(): uint256 <<VaultCore>> -    getAssetConfig(_asset: address): (config: Asset) <<VaultCore>> - - - diff --git a/contracts/docs/VaultHierarchy.svg b/contracts/docs/VaultHierarchy.svg index 2954412d6e..d7d69bf0d9 100644 --- a/contracts/docs/VaultHierarchy.svg +++ b/contracts/docs/VaultHierarchy.svg @@ -4,180 +4,159 @@ - - + + UmlClassDiagram - - + + -21 - -Governable -../contracts/governance/Governable.sol +44 + +<<Abstract>> +Governable +../contracts/governance/Governable.sol - + -261 - -OUSD -../contracts/token/OUSD.sol +307 + +OUSD +../contracts/token/OUSD.sol - + -261->21 - - +307->44 + + - + -277 - -<<Abstract>> -Initializable -../contracts/utils/Initializable.sol +324 + +<<Abstract>> +Initializable +../contracts/utils/Initializable.sol - + -282 - -OETHBaseVaultAdmin -../contracts/vault/OETHBaseVaultAdmin.sol +330 + +OETHBaseVault +../contracts/vault/OETHBaseVault.sol - - -286 - -OETHVaultAdmin -../contracts/vault/OETHVaultAdmin.sol + + +335 + +<<Abstract>> +VaultAdmin +../contracts/vault/VaultAdmin.sol - + -282->286 - - +330->335 + + - + -283 - -OETHBaseVaultCore -../contracts/vault/OETHBaseVaultCore.sol +332 + +OETHVault +../contracts/vault/OETHVault.sol - - -287 - -OETHVaultCore -../contracts/vault/OETHVaultCore.sol - - + -283->287 - - +332->335 + + - - -293 - -VaultAdmin -../contracts/vault/VaultAdmin.sol + + +333 + +OSonicVault +../contracts/vault/OSonicVault.sol - + -286->293 - - +333->335 + + - - -294 - -VaultCore -../contracts/vault/VaultCore.sol + + +334 + +OUSDVault +../contracts/vault/OUSDVault.sol - + -287->294 - - +334->335 + + - - -289 - -OSonicVaultAdmin -../contracts/vault/OSonicVaultAdmin.sol + + +336 + +<<Abstract>> +VaultCore +../contracts/vault/VaultCore.sol - + -289->286 - - +335->336 + + - - -290 - -OSonicVaultCore -../contracts/vault/OSonicVaultCore.sol + + +337 + +<<Abstract>> +VaultInitializer +../contracts/vault/VaultInitializer.sol - + -290->287 - - - - - -296 - -VaultStorage -../contracts/vault/VaultStorage.sol - - +336->337 + + + + + +338 + +<<Abstract>> +VaultStorage +../contracts/vault/VaultStorage.sol + + -293->296 - - - - - -295 - -VaultInitializer -../contracts/vault/VaultInitializer.sol - - - -294->295 - - +337->338 + + - + -295->296 - - - - - -296->21 - - - - - -296->261 - - - - +338->44 + + + + -296->277 - - +338->307 + + + + + +338->324 + + diff --git a/contracts/docs/VaultAdminSquashed.svg b/contracts/docs/VaultSquashed.svg similarity index 70% rename from contracts/docs/VaultAdminSquashed.svg rename to contracts/docs/VaultSquashed.svg index 221eefa703..06204eb0e2 100644 --- a/contracts/docs/VaultAdminSquashed.svg +++ b/contracts/docs/VaultSquashed.svg @@ -4,169 +4,177 @@ - - + + UmlClassDiagram - - + + -301 - -VaultAdmin -../contracts/vault/VaultAdmin.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _deprecated_rebaseHooksAddr: address <<VaultStorage>> -   _deprecated_uniswapAddr: address <<VaultStorage>> -   _deprecated_swapTokens: address[] <<VaultStorage>> -   __gap: uint256[43] <<VaultStorage>> -Internal: -   assets: mapping(address=>Asset) <<VaultStorage>> -   allAssets: address[] <<VaultStorage>> -   allStrategies: address[] <<VaultStorage>> -   swapConfig: SwapConfig <<VaultStorage>> +334 + +OUSDVault +../contracts/vault/OUSDVault.sol + +Private: +   initialized: bool <<Initializable>> +   initializing: bool <<Initializable>> +   ______gap: uint256[50] <<Initializable>> +   governorPosition: bytes32 <<Governable>> +   pendingGovernorPosition: bytes32 <<Governable>> +   reentryStatusPosition: bytes32 <<Governable>> +   _deprecated_assets: uint256 <<VaultStorage>> +   _deprecated_allAssets: address[] <<VaultStorage>> +   _deprecated_priceProvider: address <<VaultStorage>> +   _deprecated_redeemFeeBps: uint256 <<VaultStorage>> +   _deprecated_rebaseHooksAddr: address <<VaultStorage>> +   _deprecated_uniswapAddr: address <<VaultStorage>> +   _deprecated_assetDefaultStrategies: uint256 <<VaultStorage>> +   _deprecated_swapTokens: address[] <<VaultStorage>> +   _deprecated_ousdMetaStrategy: address <<VaultStorage>> +   _deprecated_netOusdMintedForStrategy: int256 <<VaultStorage>> +   _deprecated_netOusdMintForStrategyThreshold: uint256 <<VaultStorage>> +   _deprecated_swapConfig: uint256 <<VaultStorage>> +   _deprecated_dripper: address <<VaultStorage>> +   __gap: uint256[42] <<VaultStorage>> +   _deprecated_wethAssetIndex: uint256 <<VaultStorage>> +Internal: +   allStrategies: address[] <<VaultStorage>>   MAX_REBASE: uint256 <<VaultStorage>>   MAX_REBASE_PER_SECOND: uint256 <<VaultStorage>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   strategies: mapping(address=>Strategy) <<VaultStorage>> -   priceProvider: address <<VaultStorage>> +   assetDecimals: uint8 <<VaultStorage>> +Public: +   _NOT_ENTERED: uint256 <<Governable>> +   _ENTERED: uint256 <<Governable>> +   strategies: mapping(address=>Strategy) <<VaultStorage>>   rebasePaused: bool <<VaultStorage>>   capitalPaused: bool <<VaultStorage>> -   redeemFeeBps: uint256 <<VaultStorage>> -   vaultBuffer: uint256 <<VaultStorage>> -   autoAllocateThreshold: uint256 <<VaultStorage>> -   rebaseThreshold: uint256 <<VaultStorage>> -   oUSD: OUSD <<VaultStorage>> -   adminImplPosition: bytes32 <<VaultStorage>> -   strategistAddr: address <<VaultStorage>> -   assetDefaultStrategies: mapping(address=>address) <<VaultStorage>> -   maxSupplyDiff: uint256 <<VaultStorage>> -   trusteeAddress: address <<VaultStorage>> -   trusteeFeeBps: uint256 <<VaultStorage>> -   MINT_MINIMUM_UNIT_PRICE: uint256 <<VaultStorage>> -   ousdMetaStrategy: address <<VaultStorage>> -   netOusdMintedForStrategy: int256 <<VaultStorage>> -   netOusdMintForStrategyThreshold: uint256 <<VaultStorage>> -   MIN_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   MAX_UNIT_PRICE_DRIFT: uint256 <<VaultStorage>> -   isMintWhitelistedStrategy: mapping(address=>bool) <<VaultStorage>> -   dripper: address <<VaultStorage>> -   withdrawalQueueMetadata: WithdrawalQueueMetadata <<VaultStorage>> -   withdrawalRequests: mapping(uint256=>WithdrawalRequest) <<VaultStorage>> -   withdrawalClaimDelay: uint256 <<VaultStorage>> -   lastRebase: uint64 <<VaultStorage>> -   dripDuration: uint64 <<VaultStorage>> -   rebasePerSecondMax: uint64 <<VaultStorage>> -   rebasePerSecondTarget: uint64 <<VaultStorage>> - -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _swapCollateral(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _minToAssetAmount: uint256, _data: bytes): (toAssetAmount: uint256) <<VaultAdmin>> -    _depositToStrategy(_strategyToAddress: address, _assets: address[], _amounts: uint256[]) <<VaultAdmin>> -    _withdrawFromStrategy(_recipient: address, _strategyFromAddress: address, _assets: address[], _amounts: uint256[]) <<VaultAdmin>> -    _withdrawAllFromStrategy(_strategyAddr: address) <<VaultAdmin>> -    _withdrawAllFromStrategies() <<VaultAdmin>> -    _cacheDecimals(token: address) <<VaultAdmin>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    setAdminImpl(newImpl: address) <<onlyGovernor>> <<VaultStorage>> -    setPriceProvider(_priceProvider: address) <<onlyGovernor>> <<VaultAdmin>> -    setRedeemFeeBps(_redeemFeeBps: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setVaultBuffer(_vaultBuffer: uint256) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    setAutoAllocateThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setRebaseThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setStrategistAddr(_address: address) <<onlyGovernor>> <<VaultAdmin>> -    setAssetDefaultStrategy(_asset: address, _strategy: address) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    setNetOusdMintForStrategyThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setDripper(_dripper: address) <<onlyGovernor>> <<VaultAdmin>> -    setWithdrawalClaimDelay(_delay: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setRebaseRateMax(yearlyApr: uint256) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    setDripDuration(_dripDuration: uint256) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    swapCollateral(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _minToAssetAmount: uint256, _data: bytes): (toAssetAmount: uint256) <<nonReentrant, onlyGovernorOrStrategist>> <<VaultAdmin>> -    setSwapper(_swapperAddr: address) <<onlyGovernor>> <<VaultAdmin>> -    swapper(): (swapper_: address) <<VaultAdmin>> -    setSwapAllowedUndervalue(_basis: uint16) <<onlyGovernor>> <<VaultAdmin>> -    allowedSwapUndervalue(): (value: uint256) <<VaultAdmin>> -    setOracleSlippage(_asset: address, _allowedOracleSlippageBps: uint16) <<onlyGovernor>> <<VaultAdmin>> -    supportAsset(_asset: address, _unitConversion: uint8) <<onlyGovernor>> <<VaultAdmin>> -    removeAsset(_asset: address) <<onlyGovernor>> <<VaultAdmin>> -    cacheDecimals(_asset: address) <<onlyGovernor>> <<VaultAdmin>> -    approveStrategy(_addr: address) <<onlyGovernor>> <<VaultAdmin>> -    removeStrategy(_addr: address) <<onlyGovernor>> <<VaultAdmin>> -    depositToStrategy(_strategyToAddress: address, _assets: address[], _amounts: uint256[]) <<onlyGovernorOrStrategist, nonReentrant>> <<VaultAdmin>> -    withdrawFromStrategy(_strategyFromAddress: address, _assets: address[], _amounts: uint256[]) <<onlyGovernorOrStrategist, nonReentrant>> <<VaultAdmin>> -    setMaxSupplyDiff(_maxSupplyDiff: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setTrusteeAddress(_address: address) <<onlyGovernor>> <<VaultAdmin>> -    setTrusteeFeeBps(_basis: uint256) <<onlyGovernor>> <<VaultAdmin>> -    setOusdMetaStrategy(_ousdMetaStrategy: address) <<onlyGovernor>> <<VaultAdmin>> -    pauseRebase() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    unpauseRebase() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    pauseCapital() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    unpauseCapital() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<VaultAdmin>> -    withdrawAllFromStrategy(_strategyAddr: address) <<onlyGovernorOrStrategist>> <<VaultAdmin>> -    withdrawAllFromStrategies() <<onlyGovernorOrStrategist>> <<VaultAdmin>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> AssetSupported(_asset: address) <<VaultStorage>> -    <<event>> AssetRemoved(_asset: address) <<VaultStorage>> -    <<event>> AssetDefaultStrategyUpdated(_asset: address, _strategy: address) <<VaultStorage>> -    <<event>> AssetAllocated(_asset: address, _strategy: address, _amount: uint256) <<VaultStorage>> -    <<event>> StrategyApproved(_addr: address) <<VaultStorage>> -    <<event>> StrategyRemoved(_addr: address) <<VaultStorage>> -    <<event>> Mint(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> Redeem(_addr: address, _value: uint256) <<VaultStorage>> -    <<event>> CapitalPaused() <<VaultStorage>> -    <<event>> CapitalUnpaused() <<VaultStorage>> -    <<event>> RebasePaused() <<VaultStorage>> -    <<event>> RebaseUnpaused() <<VaultStorage>> -    <<event>> VaultBufferUpdated(_vaultBuffer: uint256) <<VaultStorage>> -    <<event>> OusdMetaStrategyUpdated(_ousdMetaStrategy: address) <<VaultStorage>> -    <<event>> RedeemFeeUpdated(_redeemFeeBps: uint256) <<VaultStorage>> -    <<event>> PriceProviderUpdated(_priceProvider: address) <<VaultStorage>> -    <<event>> AllocateThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> RebaseThresholdUpdated(_threshold: uint256) <<VaultStorage>> -    <<event>> StrategistUpdated(_address: address) <<VaultStorage>> -    <<event>> MaxSupplyDiffChanged(maxSupplyDiff: uint256) <<VaultStorage>> -    <<event>> YieldDistribution(_to: address, _yield: uint256, _fee: uint256) <<VaultStorage>> -    <<event>> TrusteeFeeBpsChanged(_basis: uint256) <<VaultStorage>> -    <<event>> TrusteeAddressChanged(_address: address) <<VaultStorage>> -    <<event>> NetOusdMintForStrategyThresholdChanged(_threshold: uint256) <<VaultStorage>> -    <<event>> SwapperChanged(_address: address) <<VaultStorage>> -    <<event>> SwapAllowedUndervalueChanged(_basis: uint256) <<VaultStorage>> -    <<event>> SwapSlippageChanged(_asset: address, _basis: uint256) <<VaultStorage>> -    <<event>> Swapped(_fromAsset: address, _toAsset: address, _fromAssetAmount: uint256, _toAssetAmount: uint256) <<VaultStorage>> -    <<event>> StrategyAddedToMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> StrategyRemovedFromMintWhitelist(strategy: address) <<VaultStorage>> -    <<event>> DripperChanged(_dripper: address) <<VaultStorage>> -    <<event>> RebasePerSecondMaxChanged(rebaseRatePerSecond: uint256) <<VaultStorage>> -    <<event>> DripDurationChanged(dripDuration: uint256) <<VaultStorage>> -    <<event>> WithdrawalRequested(_withdrawer: address, _requestId: uint256, _amount: uint256, _queued: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimed(_withdrawer: address, _requestId: uint256, _amount: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimable(_claimable: uint256, _newClaimable: uint256) <<VaultStorage>> -    <<event>> WithdrawalClaimDelayUpdated(_newDelay: uint256) <<VaultStorage>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyGovernorOrStrategist() <<VaultAdmin>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> +   vaultBuffer: uint256 <<VaultStorage>> +   autoAllocateThreshold: uint256 <<VaultStorage>> +   rebaseThreshold: uint256 <<VaultStorage>> +   oUSD: OUSD <<VaultStorage>> +   strategistAddr: address <<VaultStorage>> +   maxSupplyDiff: uint256 <<VaultStorage>> +   trusteeAddress: address <<VaultStorage>> +   trusteeFeeBps: uint256 <<VaultStorage>> +   isMintWhitelistedStrategy: mapping(address=>bool) <<VaultStorage>> +   withdrawalQueueMetadata: WithdrawalQueueMetadata <<VaultStorage>> +   withdrawalRequests: mapping(uint256=>WithdrawalRequest) <<VaultStorage>> +   withdrawalClaimDelay: uint256 <<VaultStorage>> +   lastRebase: uint64 <<VaultStorage>> +   dripDuration: uint64 <<VaultStorage>> +   rebasePerSecondMax: uint64 <<VaultStorage>> +   rebasePerSecondTarget: uint64 <<VaultStorage>> +   defaultStrategy: address <<VaultStorage>> +   asset: address <<VaultStorage>> + +Internal: +    _governor(): (governorOut: address) <<Governable>> +    _pendingGovernor(): (pendingGovernor: address) <<Governable>> +    _setGovernor(newGovernor: address) <<Governable>> +    _setPendingGovernor(newGovernor: address) <<Governable>> +    _changeGovernor(_newGovernor: address) <<Governable>> +    _mint(_amount: uint256) <<VaultCore>> +    _claimWithdrawal(requestId: uint256): (amount: uint256) <<VaultCore>> +    _postRedeem(_amount: uint256) <<VaultCore>> +    _allocate() <<VaultCore>> +    _rebase(): uint256 <<whenNotRebasePaused>> <<VaultCore>> +    _nextYield(supply: uint256, vaultValue: uint256): (yield: uint256, targetRate: uint256) <<VaultCore>> +    _totalValue(): (value: uint256) <<VaultCore>> +    _totalValueInVault(): (value: uint256) <<VaultCore>> +    _checkBalance(_asset: address): (balance: uint256) <<VaultCore>> +    _addWithdrawalQueueLiquidity(): (addedClaimable: uint256) <<VaultCore>> +    _assetAvailable(): (assetAvailable: uint256) <<VaultCore>> +    _min(a: uint256, b: uint256): uint256 <<VaultCore>> +    _max(a: uint256, b: uint256): uint256 <<VaultCore>> +    _depositToStrategy(_strategyToAddress: address, _assets: address[], _amounts: uint256[]) <<VaultAdmin>> +    _withdrawFromStrategy(_recipient: address, _strategyFromAddress: address, _assets: address[], _amounts: uint256[]) <<VaultAdmin>> +    _withdrawAllFromStrategy(_strategyAddr: address) <<VaultAdmin>> +    _withdrawAllFromStrategies() <<VaultAdmin>> +External: +    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> +    claimGovernance() <<Governable>> +    initialize(_oToken: address) <<onlyGovernor, initializer>> <<VaultInitializer>> +    mint(address, _amount: uint256, uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> +    mint(_amount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> +    mintForStrategy(_amount: uint256) <<whenNotCapitalPaused>> <<VaultCore>> +    burnForStrategy(_amount: uint256) <<whenNotCapitalPaused>> <<VaultCore>> +    requestWithdrawal(_amount: uint256): (requestId: uint256, queued: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> +    claimWithdrawal(_requestId: uint256): (amount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> +    claimWithdrawals(_requestIds: uint256[]): (amounts: uint256[], totalAmount: uint256) <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> +    allocate() <<whenNotCapitalPaused, nonReentrant>> <<VaultCore>> +    rebase() <<nonReentrant>> <<VaultCore>> +    previewYield(): (yield: uint256) <<VaultCore>> +    totalValue(): (value: uint256) <<VaultCore>> +    checkBalance(_asset: address): uint256 <<VaultCore>> +    addWithdrawalQueueLiquidity() <<VaultCore>> +    getAllAssets(): address[] <<VaultCore>> +    getStrategyCount(): uint256 <<VaultCore>> +    getAllStrategies(): address[] <<VaultCore>> +    isSupportedAsset(_asset: address): bool <<VaultCore>> +    setVaultBuffer(_vaultBuffer: uint256) <<onlyGovernorOrStrategist>> <<VaultAdmin>> +    setAutoAllocateThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> +    setRebaseThreshold(_threshold: uint256) <<onlyGovernor>> <<VaultAdmin>> +    setStrategistAddr(_address: address) <<onlyGovernor>> <<VaultAdmin>> +    setDefaultStrategy(_strategy: address) <<onlyGovernorOrStrategist>> <<VaultAdmin>> +    setWithdrawalClaimDelay(_delay: uint256) <<onlyGovernor>> <<VaultAdmin>> +    setRebaseRateMax(yearlyApr: uint256) <<onlyGovernorOrStrategist>> <<VaultAdmin>> +    setDripDuration(_dripDuration: uint256) <<onlyGovernorOrStrategist>> <<VaultAdmin>> +    approveStrategy(_addr: address) <<onlyGovernor>> <<VaultAdmin>> +    removeStrategy(_addr: address) <<onlyGovernor>> <<VaultAdmin>> +    addStrategyToMintWhitelist(strategyAddr: address) <<onlyGovernor>> <<VaultAdmin>> +    removeStrategyFromMintWhitelist(strategyAddr: address) <<onlyGovernor>> <<VaultAdmin>> +    depositToStrategy(_strategyToAddress: address, _assets: address[], _amounts: uint256[]) <<onlyGovernorOrStrategist, nonReentrant>> <<VaultAdmin>> +    withdrawFromStrategy(_strategyFromAddress: address, _assets: address[], _amounts: uint256[]) <<onlyGovernorOrStrategist, nonReentrant>> <<VaultAdmin>> +    setMaxSupplyDiff(_maxSupplyDiff: uint256) <<onlyGovernor>> <<VaultAdmin>> +    setTrusteeAddress(_address: address) <<onlyGovernor>> <<VaultAdmin>> +    setTrusteeFeeBps(_basis: uint256) <<onlyGovernor>> <<VaultAdmin>> +    pauseRebase() <<onlyGovernorOrStrategist>> <<VaultAdmin>> +    unpauseRebase() <<onlyGovernorOrStrategist>> <<VaultAdmin>> +    pauseCapital() <<onlyGovernorOrStrategist>> <<VaultAdmin>> +    unpauseCapital() <<onlyGovernorOrStrategist>> <<VaultAdmin>> +    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<VaultAdmin>> +    withdrawAllFromStrategy(_strategyAddr: address) <<onlyGovernorOrStrategist>> <<VaultAdmin>> +    withdrawAllFromStrategies() <<onlyGovernorOrStrategist>> <<VaultAdmin>> +Public: +    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> AssetAllocated(_asset: address, _strategy: address, _amount: uint256) <<VaultStorage>> +    <<event>> StrategyApproved(_addr: address) <<VaultStorage>> +    <<event>> StrategyRemoved(_addr: address) <<VaultStorage>> +    <<event>> Mint(_addr: address, _value: uint256) <<VaultStorage>> +    <<event>> Redeem(_addr: address, _value: uint256) <<VaultStorage>> +    <<event>> CapitalPaused() <<VaultStorage>> +    <<event>> CapitalUnpaused() <<VaultStorage>> +    <<event>> DefaultStrategyUpdated(_strategy: address) <<VaultStorage>> +    <<event>> RebasePaused() <<VaultStorage>> +    <<event>> RebaseUnpaused() <<VaultStorage>> +    <<event>> VaultBufferUpdated(_vaultBuffer: uint256) <<VaultStorage>> +    <<event>> AllocateThresholdUpdated(_threshold: uint256) <<VaultStorage>> +    <<event>> RebaseThresholdUpdated(_threshold: uint256) <<VaultStorage>> +    <<event>> StrategistUpdated(_address: address) <<VaultStorage>> +    <<event>> MaxSupplyDiffChanged(maxSupplyDiff: uint256) <<VaultStorage>> +    <<event>> YieldDistribution(_to: address, _yield: uint256, _fee: uint256) <<VaultStorage>> +    <<event>> TrusteeFeeBpsChanged(_basis: uint256) <<VaultStorage>> +    <<event>> TrusteeAddressChanged(_address: address) <<VaultStorage>> +    <<event>> StrategyAddedToMintWhitelist(strategy: address) <<VaultStorage>> +    <<event>> StrategyRemovedFromMintWhitelist(strategy: address) <<VaultStorage>> +    <<event>> RebasePerSecondMaxChanged(rebaseRatePerSecond: uint256) <<VaultStorage>> +    <<event>> DripDurationChanged(dripDuration: uint256) <<VaultStorage>> +    <<event>> WithdrawalRequested(_withdrawer: address, _requestId: uint256, _amount: uint256, _queued: uint256) <<VaultStorage>> +    <<event>> WithdrawalClaimed(_withdrawer: address, _requestId: uint256, _amount: uint256) <<VaultStorage>> +    <<event>> WithdrawalClaimable(_claimable: uint256, _newClaimable: uint256) <<VaultStorage>> +    <<event>> WithdrawalClaimDelayUpdated(_newDelay: uint256) <<VaultStorage>> +    <<modifier>> initializer() <<Initializable>> +    <<modifier>> onlyGovernor() <<Governable>> +    <<modifier>> nonReentrant() <<Governable>> +    <<modifier>> whenNotRebasePaused() <<VaultCore>> +    <<modifier>> whenNotCapitalPaused() <<VaultCore>> +    <<modifier>> onlyGovernorOrStrategist() <<VaultAdmin>> +    governor(): address <<Governable>> +    isGovernor(): bool <<Governable>> +    constructor(_usdc: address) <<OUSDVault>> +    getAssetCount(): uint256 <<VaultCore>> diff --git a/contracts/docs/VaultStorage.svg b/contracts/docs/VaultStorage.svg index 0e415f8939..876c965fa2 100644 --- a/contracts/docs/VaultStorage.svg +++ b/contracts/docs/VaultStorage.svg @@ -4,358 +4,316 @@ - - + + StorageDiagram - - + + -8 - -VaultCore <<Contract>> - -slot - -0 - -1-50 - -51 - -52 - -53 - -54 - -55 - -56 - -57 - -58 - -59 - -60 - -61 - -62 - -63 - -64 - -65 - -66 - -67 - -68 - -69 - -70 - -71 - -72 - -73 - -74 - -75-76 - -77 - -78 - -79 - -80-122 - -type: <inherited contract>.variable (bytes) - -unallocated (30) - -bool: Initializable.initializing (1) - -bool: Initializable.initialized (1) - -uint256[50]: Initializable.______gap (1600) - -mapping(address=>Asset): VaultStorage.assets (32) - -address[]: VaultStorage.allAssets (32) - -mapping(address=>Strategy): VaultStorage.strategies (32) - -address[]: VaultStorage.allStrategies (32) - -unallocated (10) - -bool: VaultStorage.capitalPaused (1) - -bool: VaultStorage.rebasePaused (1) - -address: VaultStorage.priceProvider (20) - -uint256: VaultStorage.redeemFeeBps (32) - -uint256: VaultStorage.vaultBuffer (32) - -uint256: VaultStorage.autoAllocateThreshold (32) - -uint256: VaultStorage.rebaseThreshold (32) - -unallocated (12) - -OUSD: VaultStorage.oUSD (20) - -unallocated (12) - -address: VaultStorage._deprecated_rebaseHooksAddr (20) - -unallocated (12) - -address: VaultStorage._deprecated_uniswapAddr (20) - -unallocated (12) - -address: VaultStorage.strategistAddr (20) - -mapping(address=>address): VaultStorage.assetDefaultStrategies (32) - -uint256: VaultStorage.maxSupplyDiff (32) - -unallocated (12) - -address: VaultStorage.trusteeAddress (20) - -uint256: VaultStorage.trusteeFeeBps (32) - -address[]: VaultStorage._deprecated_swapTokens (32) - -unallocated (12) - -address: VaultStorage.ousdMetaStrategy (20) - -int256: VaultStorage.netOusdMintedForStrategy (32) - -uint256: VaultStorage.netOusdMintForStrategyThreshold (32) - -SwapConfig: VaultStorage.swapConfig (32) - -mapping(address=>bool): VaultStorage.isMintWhitelistedStrategy (32) - -unallocated (12) - -address: VaultStorage.dripper (20) - -WithdrawalQueueMetadata: VaultStorage.withdrawalQueueMetadata (64) - -mapping(uint256=>WithdrawalRequest): VaultStorage.withdrawalRequests (32) - -uint256: VaultStorage.withdrawalClaimDelay (32) - -uint64: VaultStorage.rebasePerSecondTarget (8) - -uint64: VaultStorage.rebasePerSecondMax (8) - -uint64: VaultStorage.dripDuration (8) - -uint64: VaultStorage.lastRebase (8) - -uint256[43]: VaultStorage.__gap (1376) +6 + +OUSDVault <<Contract>> + +slot + +0 + +1-50 + +51 + +52 + +53 + +54 + +55 + +56 + +57 + +58 + +59 + +60 + +61 + +62 + +63 + +64 + +65 + +66 + +67 + +68 + +69 + +70 + +71 + +72 + +73 + +74 + +75-76 + +77 + +78 + +79 + +80 + +81-122 + +123 + +type: <inherited contract>.variable (bytes) + +unallocated (30) + +bool: Initializable.initializing (1) + +bool: Initializable.initialized (1) + +uint256[50]: Initializable.______gap (1600) + +uint256: VaultStorage._deprecated_assets (32) + +address[]: VaultStorage._deprecated_allAssets (32) + +mapping(address=>Strategy): VaultStorage.strategies (32) + +address[]: VaultStorage.allStrategies (32) + +unallocated (10) + +bool: VaultStorage.capitalPaused (1) + +bool: VaultStorage.rebasePaused (1) + +address: VaultStorage._deprecated_priceProvider (20) + +uint256: VaultStorage._deprecated_redeemFeeBps (32) + +uint256: VaultStorage.vaultBuffer (32) + +uint256: VaultStorage.autoAllocateThreshold (32) + +uint256: VaultStorage.rebaseThreshold (32) + +unallocated (12) + +OUSD: VaultStorage.oUSD (20) + +unallocated (12) + +address: VaultStorage._deprecated_rebaseHooksAddr (20) + +unallocated (12) + +address: VaultStorage._deprecated_uniswapAddr (20) + +unallocated (12) + +address: VaultStorage.strategistAddr (20) + +uint256: VaultStorage._deprecated_assetDefaultStrategies (32) + +uint256: VaultStorage.maxSupplyDiff (32) + +unallocated (12) + +address: VaultStorage.trusteeAddress (20) + +uint256: VaultStorage.trusteeFeeBps (32) + +address[]: VaultStorage._deprecated_swapTokens (32) + +unallocated (12) + +address: VaultStorage._deprecated_ousdMetaStrategy (20) + +int256: VaultStorage._deprecated_netOusdMintedForStrategy (32) + +uint256: VaultStorage._deprecated_netOusdMintForStrategyThreshold (32) + +uint256: VaultStorage._deprecated_swapConfig (32) + +mapping(address=>bool): VaultStorage.isMintWhitelistedStrategy (32) + +unallocated (12) + +address: VaultStorage._deprecated_dripper (20) + +WithdrawalQueueMetadata: VaultStorage.withdrawalQueueMetadata (64) + +mapping(uint256=>WithdrawalRequest): VaultStorage.withdrawalRequests (32) + +uint256: VaultStorage.withdrawalClaimDelay (32) + +uint64: VaultStorage.rebasePerSecondTarget (8) + +uint64: VaultStorage.rebasePerSecondMax (8) + +uint64: VaultStorage.dripDuration (8) + +uint64: VaultStorage.lastRebase (8) + +unallocated (12) + +address: VaultStorage.defaultStrategy (20) + +uint256[42]: VaultStorage.__gap (1344) + +uint256: VaultStorage._deprecated_wethAssetIndex (32) 1 - -Asset <<Struct>> - -offset - -0 - -type: variable (bytes) - -unallocated (27) - -uint16: allowedOracleSlippageBps (2) - -uint8: decimals (1) - -UnitConversion: unitConversion (1) - -bool: isSupported (1) + +address[]: _deprecated_allAssets <<Array>> +0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1 + +offset + +0 + +type: variable (bytes) + +unallocated (12) + +address (20) - + -8:8->1 - - +6:6->1 + + 2 - -address[]: allAssets <<Array>> -0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1 - -offset - -0 - -type: variable (bytes) - -unallocated (12) - -address (20) + +Strategy <<Struct>> + +offset + +0 + +1 + +type: variable (bytes) + +unallocated (31) + +bool: isSupported (1) + +uint256: _deprecated (32) - + -8:10->2 - - +6:9->2 + + 3 - -Strategy <<Struct>> - -offset - -0 - -1 - -type: variable (bytes) - -unallocated (31) - -bool: isSupported (1) - -uint256: _deprecated (32) + +address[]: allStrategies <<Array>> +0x4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8 + +offset + +0 + +type: variable (bytes) + +unallocated (12) + +address (20) - + -8:13->3 - - +6:11->3 + + 4 - -address[]: allStrategies <<Array>> -0x4a11f94e20a93c79f6ec743a1954ec4fc2c08429ae2122118bf234b2185c81b8 - -offset - -0 - -type: variable (bytes) - -unallocated (12) - -address (20) + +WithdrawalQueueMetadata <<Struct>> + +slot + +75 + +76 + +type: variable (bytes) + +uint128: claimable (16) + +uint128: queued (16) + +uint128: nextWithdrawalIndex (16) + +uint128: claimed (16) - + -8:15->4 - - +6:38->4 + + 5 - -SwapConfig <<Struct>> - -slot - -72 - -type: variable (bytes) - -unallocated (10) - -uint16: allowedUndervalueBps (2) - -address: swapper (20) + +WithdrawalRequest <<Struct>> + +offset + +0 + +1 + +type: variable (bytes) + +unallocated (6) + +uint40: timestamp (5) + +bool: claimed (1) + +address: withdrawer (20) + +uint128: queued (16) + +uint128: amount (16) - + -8:37->5 - - - - - -6 - -WithdrawalQueueMetadata <<Struct>> - -slot - -75 - -76 - -type: variable (bytes) - -uint128: claimable (16) - -uint128: queued (16) - -uint128: nextWithdrawalIndex (16) - -uint128: claimed (16) - - - -8:44->6 - - - - - -7 - -WithdrawalRequest <<Struct>> - -offset - -0 - -1 - -type: variable (bytes) - -unallocated (6) - -uint40: timestamp (5) - -bool: claimed (1) - -address: withdrawer (20) - -uint128: queued (16) - -uint128: amount (16) - - - -8:50->7 - - +6:44->5 + + diff --git a/contracts/docs/generate.sh b/contracts/docs/generate.sh index f32d8a7601..5af8c5867b 100644 --- a/contracts/docs/generate.sh +++ b/contracts/docs/generate.sh @@ -147,23 +147,19 @@ sol2uml storage .. -c WOSonic -o WOSonicStorage.svg --hideExpand ______gap # contracts/vault -sol2uml .. -v -hv -hf -he -hs -hl -hi -b OETHBaseVaultCore,OETHBaseVaultAdmin,OSonicVaultCore,OSonicVaultAdmin -o VaultHierarchy.svg +sol2uml .. -v -hv -hf -he -hs -hl -hi -i prettier-plugin-solidity -b OUSDVault,OETHVault,OETHBaseVault,OSonicVault -o VaultHierarchy.svg -sol2uml .. -s -d 0 -b VaultCore -o VaultCoreSquashed.svg -sol2uml .. -s -d 0 -b VaultAdmin -o VaultAdminSquashed.svg -sol2uml storage .. -c VaultCore -o VaultStorage.svg --hideExpand __gap,______gap,_deprecated_swapTokens +sol2uml .. -s -d 0 -i prettier-plugin-solidity -b OUSDVault -o VaultSquashed.svg +sol2uml storage .. -i prettier-plugin-solidity -c OUSDVault -o VaultStorage.svg --hideExpand __gap,______gap,_deprecated_swapTokens -sol2uml .. -s -d 0 -b OETHVaultCore -o OETHVaultCoreSquashed.svg -sol2uml .. -s -d 0 -b OETHVaultAdmin -o OETHVaultAdminSquashed.svg -sol2uml storage .. -c OETHVaultCore -o OETHVaultStorage.svg --hideExpand __gap,______gap,_deprecated_swapTokens +# sol2uml .. -s -d 0 -i prettier-plugin-solidity -b OETHVault -o OETHVaultSquashed.svg +# sol2uml storage .. -i prettier-plugin-solidity -c OETHVault -o OETHVaultStorage.svg --hideExpand __gap,______gap,_deprecated_swapTokens -sol2uml .. -s -d 0 -b OETHBaseVaultCore -o OETHBaseVaultCoreSquashed.svg -sol2uml .. -s -d 0 -b OETHBaseVaultAdmin -o OETHBaseVaultAdminSquashed.svg -sol2uml storage .. -c OETHBaseVaultCore -o OETHBaseVaultStorage.svg --hideExpand __gap,______gap +# sol2uml .. -s -d 0 -i prettier-plugin-solidity -b OETHBaseVault -o OETHBaseVaultSquashed.svg +# sol2uml storage .. -i prettier-plugin-solidity -c OETHBaseVault -o OETHBaseVaultStorage.svg --hideExpand __gap,______gap -sol2uml .. -s -d 0 -b OSonicVaultCore -o OSonicVaultCoreSquashed.svg -sol2uml .. -s -d 0 -b OSonicVaultAdmin -o OSonicVaultAdminSquashed.svg -sol2uml storage .. -c OSonicVaultCore -o OSonicVaultStorage.svg --hideExpand __gap,______gap,_deprecated_swapTokens +# sol2uml .. -s -d 0 -i prettier-plugin-solidity -b OSonicVault -o OSonicVaultSquashed.svg +# sol2uml storage .. -i prettier-plugin-solidity -c OSonicVault -o OSonicVaultStorage.svg --hideExpand __gap,______gap,_deprecated_swapTokens # contracts/poolBooster # call stack size exceeded diff --git a/contracts/scripts/governor/propose.js b/contracts/scripts/governor/propose.js index 66228cf454..8bfdddbd50 100644 --- a/contracts/scripts/governor/propose.js +++ b/contracts/scripts/governor/propose.js @@ -348,46 +348,6 @@ async function proposeUpgradeOusdArgs() { return { args, description }; } -// Returns the argument to use for sending a proposal to upgrade VaultCore. -async function proposeUpgradeVaultCoreArgs(config) { - const vaultProxy = await ethers.getContract("VaultProxy"); - - const args = await proposeArgs([ - { - contract: vaultProxy, - signature: "upgradeTo(address)", - args: [config.address], - }, - ]); - const description = "Upgrade VaultCore"; - return { args, description }; -} - -async function proposeUpgradeVaultCoreAndAdminArgs() { - const cVaultProxy = await ethers.getContract("VaultProxy"); - const cVaultCoreProxy = await ethers.getContractAt( - "OUSDVaultCore", - cVaultProxy.address - ); - const cVaultCore = await ethers.getContract("OUSDVaultCore"); - const cVaultAdmin = await ethers.getContract("OUSDVaultAdmin"); - - const args = await proposeArgs([ - { - contract: cVaultProxy, - signature: "upgradeTo(address)", - args: [cVaultCore.address], - }, - { - contract: cVaultCoreProxy, - signature: "setAdminImpl(address)", - args: [cVaultAdmin.address], - }, - ]); - const description = "Vault Core and Admin upgrade"; - return { args, description }; -} - // Returns the arguments to use for sending a proposal call to upgrade to a new MicOracle. // See migration 11_new_mix_oracle for reference. async function proposeUpgradeOracleArgs() { @@ -656,94 +616,6 @@ async function proposeProp14Args() { return { args, description }; } -// Args to send a proposal to: -// - upgrade Vault Core and Admin -// - set the Aave reward token address to zero address -// - set the liquidation thresholds on strategies (except Aave since it does not have a reward token) -async function proposeProp17Args() { - const cVaultProxy = await ethers.getContract("VaultProxy"); - const cVaultCoreProxy = await ethers.getContractAt( - "OUSDVaultCore", - cVaultProxy.address - ); - const cVaultCore = await ethers.getContract("OUSDVaultCore"); - const cVaultAdmin = await ethers.getContract("OUSDVaultAdmin"); - const cAaveStrategyProxy = await ethers.getContract("AaveStrategyProxy"); - const cAaveStrategy = await ethers.getContractAt( - "AaveStrategy", - cAaveStrategyProxy.address - ); - - const cCompoundStrategyProxy = await ethers.getContract( - "CompoundStrategyProxy" - ); - const cCompoundStrategy = await ethers.getContractAt( - "CompoundStrategy", - cCompoundStrategyProxy.address - ); - - const cCurveUSDCStrategyProxy = await ethers.getContract( - "CurveUSDCStrategyProxy" - ); - const cCurveUSDCStrategy = await ethers.getContractAt( - "ThreePoolStrategy", - cCurveUSDCStrategyProxy.address - ); - - const cCurveUSDTStrategyProxy = await ethers.getContract( - "CurveUSDTStrategyProxy" - ); - const cCurveUSDTStrategy = await ethers.getContractAt( - "ThreePoolStrategy", - cCurveUSDTStrategyProxy.address - ); - - const args = await proposeArgs([ - { - contract: cVaultProxy, - signature: "upgradeTo(address)", - args: [cVaultCore.address], - }, - { - contract: cVaultCoreProxy, - signature: "setAdminImpl(address)", - args: [cVaultAdmin.address], - }, - { - contract: cAaveStrategy, - signature: "setRewardTokenAddress(address)", - args: [addresses.zero], - }, - { - contract: cCompoundStrategy, - signature: "setPTokenAddress(address,address)", - args: [addresses.mainnet.USDC, addresses.mainnet.cUSDC], - }, - { - contract: cCompoundStrategy, - signature: "setPTokenAddress(address,address)", - args: [addresses.mainnet.USDT, addresses.mainnet.cUSDT], - }, - { - contract: cCompoundStrategy, - signature: "setRewardLiquidationThreshold(uint256)", - args: [utils.parseUnits("1", 18)], // 1 COMP with precision 18 - }, - { - contract: cCurveUSDCStrategy, - signature: "setRewardLiquidationThreshold(uint256)", - args: [utils.parseUnits("200", 18)], // 200 CRV with precision 18 - }, - { - contract: cCurveUSDTStrategy, - signature: "setRewardLiquidationThreshold(uint256)", - args: [utils.parseUnits("200", 18)], // 200 CRV with precision 18 - }, - ]); - const description = "Prop 16"; - return { args, description }; -} - async function proposeSetRewardLiquidationThresholdArgs() { const cCompoundStrategyProxy = await ethers.getContract( "CompoundStrategyProxy" @@ -984,12 +856,6 @@ async function main(config) { } else if (config.upgradeOusd) { console.log("upgradeOusd proposal"); argsMethod = proposeUpgradeOusdArgs; - } else if (config.upgradeVaultCore) { - console.log("upgradeVaultCore proposal"); - argsMethod = proposeUpgradeVaultCoreArgs; - } else if (config.upgradeVaultCoreAndAdmin) { - console.log("upgradeVaultCoreAndAdmin proposal"); - argsMethod = proposeUpgradeVaultCoreAndAdminArgs; } else if (config.upgradeOracle) { console.log("upgradeOracle proposal"); argsMethod = proposeUpgradeOracleArgs; @@ -1017,9 +883,6 @@ async function main(config) { } else if (config.prop14) { console.log("prop14 proposal"); argsMethod = proposeProp14Args; - } else if (config.prop17) { - console.log("prop17 proposal"); - argsMethod = proposeProp17Args; } else if (config.pauseCapital) { console.log("pauseCapital"); argsMethod = proposePauseCapitalArgs; diff --git a/contracts/test/_fixture-base.js b/contracts/test/_fixture-base.js index 028e10d850..edeb7bd20e 100644 --- a/contracts/test/_fixture-base.js +++ b/contracts/test/_fixture-base.js @@ -27,18 +27,7 @@ let snapshotId; const baseFixtureWithMockedVaultAdminConfig = async () => { const fixture = await defaultFixture(); - - const cOETHVaultProxy = await ethers.getContract("OETHBaseVaultProxy"); - const cOETHVaultAdmin = await ethers.getContractAt( - "IVault", - cOETHVaultProxy.address - ); - await deployWithConfirmation("MockOETHVaultAdmin", [fixture.weth.address]); - - const mockVaultAdmin = await ethers.getContract("MockOETHVaultAdmin"); - await cOETHVaultAdmin - .connect(fixture.governor) - .setAdminImpl(mockVaultAdmin.address); + await deployWithConfirmation("MockOETHVault", [fixture.weth.address]); fixture.oethbVault = await ethers.getContractAt( "IMockVault", diff --git a/contracts/test/_fixture-plume.js b/contracts/test/_fixture-plume.js index 7b2ba1f552..91581ff216 100644 --- a/contracts/test/_fixture-plume.js +++ b/contracts/test/_fixture-plume.js @@ -21,18 +21,7 @@ let snapshotId; const baseFixtureWithMockedVaultAdminConfig = async () => { const fixture = await defaultFixture(); - - const cOETHVaultProxy = await ethers.getContract("OETHPlumeVaultProxy"); - const cOETHVaultAdmin = await ethers.getContractAt( - "IVault", - cOETHVaultProxy.address - ); - await deployWithConfirmation("MockOETHVaultAdmin", [fixture.weth.address]); - - const mockVaultAdmin = await ethers.getContract("MockOETHVaultAdmin"); - await cOETHVaultAdmin - .connect(fixture.governor) - .setAdminImpl(mockVaultAdmin.address); + await deployWithConfirmation("MockOETHVault", [fixture.weth.address]); fixture.oethpVault = await ethers.getContractAt( "IMockVault", diff --git a/contracts/test/_hot-deploy.js b/contracts/test/_hot-deploy.js index 403b0bdd35..59e7c94151 100644 --- a/contracts/test/_hot-deploy.js +++ b/contracts/test/_hot-deploy.js @@ -12,7 +12,6 @@ const { oethPoolLpPID, } = require("../utils/constants"); const { replaceContractAt } = require("../utils/hardhat"); -const { impersonateAndFund } = require("../utils/signers"); const log = require("../utils/logger")("test:fixtures:hot-deploy"); @@ -125,14 +124,13 @@ async function hotDeployOption( const { isOethFixture } = config; const deployStrat = hotDeployOptions.includes("strategy"); - const deployVaultCore = hotDeployOptions.includes("vaultCore"); - const deployVaultAdmin = hotDeployOptions.includes("vaultAdmin"); + const deployVault = hotDeployOptions.includes("vault"); const deployHarvester = hotDeployOptions.includes("harvester"); const deployOracleRouter = hotDeployOptions.includes("oracleRouter"); const deployBuyback = hotDeployOptions.includes("buyback"); log(`Running fixture hot deployment w/ config; isOethFixture:${isOethFixture} strategy:${!!deployStrat} - vaultCore:${!!deployVaultCore} vaultAdmin:${!!deployVaultAdmin} harvester:${!!deployHarvester}`); + vault:${!!deployVault} harvester:${!!deployHarvester}`); if (deployStrat) { if (fixtureName === "balancerREthFixture") { @@ -162,13 +160,8 @@ async function hotDeployOption( } } - if (deployVaultCore || deployVaultAdmin) { - await hotDeployVaultAdmin( - fixture, - deployVaultAdmin, - deployVaultCore, - isOethFixture - ); + if (deployVault) { + await hotDeployVault(fixture, isOethFixture); } if (deployHarvester) { await hotDeployHarvester(fixture, isOethFixture); @@ -182,66 +175,33 @@ async function hotDeployOption( } } -async function hotDeployVaultAdmin( - fixture, - deployVaultAdmin, - deployVaultCore, - isOeth -) { +async function hotDeployVault(fixture, isOeth) { const { deploy } = deployments; const vaultProxyName = `${isOeth ? "OETH" : ""}VaultProxy`; - const vaultCoreName = `${isOeth ? "OETH" : ""}VaultCore`; - const vaultAdminName = `${isOeth ? "OETH" : ""}VaultAdmin`; - const vaultVariableName = `${isOeth ? "oethVault" : "vault"}`; + const vaultName = `${isOeth ? "OETH" : "OUSD"}Vault`; const cVaultProxy = await ethers.getContract(vaultProxyName); - if (deployVaultAdmin) { - log(`Deploying new ${vaultAdminName} implementation`); - - // deploy this contract that exposes internal function - await deploy(vaultAdminName, { - from: addresses.mainnet.Timelock, // doesn't matter which address deploys it - contract: vaultAdminName, - args: isOeth ? [fixture.weth.address] : [], - }); - - const implementation = await ethers.getContract(vaultAdminName); - const cVault = await ethers.getContractAt( - vaultCoreName, - cVaultProxy.address - ); - // TODO: this might be faster by replacing bytecode of existing implementation contract - const signerTimelock = await impersonateAndFund(addresses.mainnet.Timelock); - await cVault.connect(signerTimelock).setAdminImpl(implementation.address); - - fixture[vaultVariableName] = await ethers.getContractAt( - "IVault", - cVaultProxy.address - ); - } - if (deployVaultCore) { - log(`Deploying new ${vaultCoreName} implementation`); - // deploy this contract that exposes internal function - await deploy(vaultCoreName, { - from: addresses.mainnet.Timelock, // doesn't matter which address deploys it - contract: vaultCoreName, - args: isOeth ? [fixture.weth.address] : [], - }); - const implementation = await ethers.getContract(vaultCoreName); + log(`Deploying new ${vaultName} implementation`); + // deploy this contract that exposes internal function + await deploy(vaultName, { + from: addresses.mainnet.Timelock, // doesn't matter which address deploys it + contract: vaultName, + args: isOeth ? [fixture.weth.address] : [], + }); + const implementation = await ethers.getContract(vaultName); - const cVault = await ethers.getContractAt( - "InitializeGovernedUpgradeabilityProxy", - cVaultProxy.address - ); - const liveImplContractAddress = await cVault.implementation(); + const cVault = await ethers.getContractAt( + "InitializeGovernedUpgradeabilityProxy", + cVaultProxy.address + ); + const liveImplContractAddress = await cVault.implementation(); - log( - `Replacing implementation at ${liveImplContractAddress} with the fresh bytecode` - ); + log( + `Replacing implementation at ${liveImplContractAddress} with the fresh bytecode` + ); - await replaceContractAt(liveImplContractAddress, implementation); - } + await replaceContractAt(liveImplContractAddress, implementation); } async function hotDeployHarvester(fixture, forOETH) { diff --git a/contracts/test/vault/upgrade.js b/contracts/test/vault/upgrade.js deleted file mode 100644 index 8044bc26b3..0000000000 --- a/contracts/test/vault/upgrade.js +++ /dev/null @@ -1,27 +0,0 @@ -const { expect } = require("chai"); - -const { loadDefaultFixture } = require("../_fixture"); - -describe("VaultAdmin Upgrades", async function () { - let ousd, vault, governor; - - beforeEach(async function () { - const fixture = await loadDefaultFixture(); - vault = fixture.vault; - ousd = fixture.ousd; - governor = fixture.governor; - }); - - it("should upgrade to a new admin implementation", async function () { - const newVaultImpl = ousd.address; // ;) - await vault.connect(governor).setAdminImpl(newVaultImpl); - expect(await vault.ADMIN_IMPLEMENTATION()).to.eq(newVaultImpl); - }); - - it("should not upgrade to a non-contract admin implementation", async function () { - const blankImpl = "0x4000000000000000000000000000000000000004"; - await expect( - vault.connect(governor).setAdminImpl(blankImpl) - ).to.be.revertedWith("new implementation is not a contract"); - }); -});