Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/contracts/vault/VaultAdmin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ contract VaultAdmin is VaultStorage {
*/
function approveStrategy(address _addr) external onlyGovernor {
require(!strategies[_addr].isSupported, "Strategy already approved");
strategies[_addr] = Strategy({ isSupported: true, _deprecated: 0 });
strategies[_addr] = Strategy({ isSupported: true });
allStrategies.push(_addr);
emit StrategyApproved(_addr);
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/contracts/vault/VaultCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ contract VaultCore is VaultStorage {

/**
* @dev Internal to calculate total value of all assets held in Vault.
* @return value Total value in ETH (1e18)
* @return value Total value in base currency. eg USD or ETH (1e18)
*/
function _totalValueInVault() internal view returns (uint256 value) {
uint256 assetCount = allAssets.length;
Expand All @@ -426,7 +426,7 @@ contract VaultCore is VaultStorage {

/**
* @dev Internal to calculate total value of all assets held in Strategies.
* @return value Total value in ETH (1e18)
* @return value Total value in base currency. eg USD or ETH (1e18)
*/
function _totalValueInStrategies() internal view returns (uint256 value) {
uint256 stratCount = allStrategies.length;
Expand All @@ -438,7 +438,7 @@ contract VaultCore is VaultStorage {
/**
* @dev Internal to calculate total value of all assets held by strategy.
* @param _strategyAddr Address of the strategy
* @return value Total value in ETH (1e18)
* @return value Total value in base currency. eg USD or ETH (1e18)
*/
function _totalValueInStrategy(address _strategyAddr)
internal
Expand Down
1 change: 0 additions & 1 deletion contracts/contracts/vault/VaultStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ contract VaultStorage is Initializable, Governable {
// Strategies approved for use by the Vault
struct Strategy {
bool isSupported;
uint256 _deprecated; // Deprecated storage slot
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will affect any future changes to the struct (since any new prop added might already have values set for existing strategies). Uniswap strategy already does that. It's probably low impact but I'd prefer not to do it

Copy link
Collaborator Author

@naddison36 naddison36 Jun 23, 2023

Choose a reason for hiding this comment

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

That's why we need to do this now. The Uniswap V3 Strategy will add another bool after this which means we have two bools using three storage slots.

Each read from a storage slot costs 2,100 gas

Copy link
Collaborator

Choose a reason for hiding this comment

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

I get your point. But how do we make sure that we don't accidentally use the old value in slot1 (set before deprecation) when we add more vars to this? Right now, having this named _depreacted acts as a reminder for us

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, it makes more sense to remove it then

}
/// @dev mapping of strategy contracts to their configiration
mapping(address => Strategy) internal strategies;
Expand Down
15 changes: 13 additions & 2 deletions contracts/deploy/052_upgrade_ousd_vault_harvester.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,19 @@ module.exports = deploymentWithGovernanceProposal(

// Deploy VaultAdmin and VaultCore contracts
const cVaultProxy = await ethers.getContract("VaultProxy");
const dVaultAdmin = await deployWithConfirmation("VaultAdmin");
const dVaultCore = await deployWithConfirmation("VaultCore");
const dVaultAdmin = await deployWithConfirmation(
"VaultAdmin",
[],
undefined,
true // incompatible storage layout
);
const dVaultCore = await deployWithConfirmation(
"VaultCore",
[],
undefined,
true // incompatible storage layout
);

const cVault = await ethers.getContractAt("Vault", cVaultProxy.address);

// Deploy Oracle Router
Expand Down
14 changes: 12 additions & 2 deletions contracts/deploy/057_drip_all.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,18 @@ module.exports = deploymentWithGovernanceProposal(
const cVaultProxy = await ethers.getContract("VaultProxy");
// const cHarvester = await ethers.getContract("Harvester");

const dVaultCore = await deployWithConfirmation("VaultCore");
const dVaultAdmin = await deployWithConfirmation("VaultAdmin");
const dVaultAdmin = await deployWithConfirmation(
"VaultAdmin",
[],
undefined,
true // incompatible storage layout
);
const dVaultCore = await deployWithConfirmation(
"VaultCore",
[],
undefined,
true // incompatible storage layout
);

const cVaultCore = await ethers.getContract(
"VaultCore",
Expand Down