Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparrow dom/balancer composable fixes #1927

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
Original file line number Diff line number Diff line change
Expand Up @@ -444,14 +444,20 @@ contract BalancerMetaPoolStrategy is BaseAuraStrategy {

/**
* @notice Withdraws all supported Vault collateral assets from the Balancer pool
* and send to the OToken's Vault.
* (when not in recovery mode) and send to the OToken's Vault.
*
* Is only executable by the OToken's Vault or the Governor.
*/
function withdrawAll() external override onlyVaultOrGovernor nonReentrant {
_withdrawAll(false);
}

/**
* @notice Withdraws all supported Vault collateral assets from the Balancer pool
* (when the pool is in recovery mode) and send to the OToken's Vault.
*
* Is only executable by the OToken's Vault or the Governor.
*/
function recoveryModeWithdrawAll()
external
onlyVaultOrGovernor
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/fixture/_custom-deploys.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const deployBalancerFrxEethRethWstEThStrategyMissConfigured = async () => {
});

const strategy = await ethers.getContract("BalancerComposablePoolStrategy");
log("Strategy deployed, calling initialize")
log("Strategy deployed, calling initialize");
// prettier-ignore
await strategy
.connect(sTimelock)["initialize(address[],address[],address[])"](
Expand Down
8 changes: 4 additions & 4 deletions contracts/test/fixture/_fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -1034,12 +1034,9 @@ async function balancerFrxETHwstETHeETHFixture(
* replace the byte code with the one that exposes internal functions
*/
async function balancerRethWETHExposeFunctionFixture() {

const fixture = await balancerREthFixture();
await hotDeployOption(fixture, "balancerRethWETHExposeFunctionFixture");

const { balancerREthStrategy, josh } = fixture;

return fixture;
}

Expand All @@ -1056,7 +1053,10 @@ async function balancerSfrxETHRETHWstETHMissConfiguredStrategy() {
*/
async function balancerSfrxETHRETHWstETHExposeFunctionFixture() {
const fixture = await balancerFrxETHwstETHeETHFixture();
await hotDeployOption(fixture, "balancerSfrxETHRETHWstETHExposeFunctionFixture");
await hotDeployOption(
fixture,
"balancerSfrxETHRETHWstETHExposeFunctionFixture"
);
return fixture;
}

Expand Down
26 changes: 13 additions & 13 deletions contracts/test/fixture/_hot-deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ async function constructNewContract(fixture, implContractName) {
],
addresses.mainnet.rETH_WETH_AuraRewards, // Address of the Aura rewards contract
];
}
else if (implContractName === "BalancerComposablePoolTestStrategy") {
} else if (implContractName === "BalancerComposablePoolTestStrategy") {
return [
[
addresses.mainnet.wstETH_sfrxETH_rETH_BPT,
Expand Down Expand Up @@ -127,10 +126,13 @@ async function hotDeployOption(
);

// IMPORTANT: remove once rETH/WETH is redeployed with the new code base
await fixture.balancerREthStrategy.connect(fixture.josh).cachePoolAssets();
await fixture.balancerREthStrategy
.connect(fixture.josh)
.cachePoolAssets();
// IMPORTANT also remove this one
await fixture.balancerREthStrategy.connect(fixture.josh).cacheRateProviders();

await fixture.balancerREthStrategy
.connect(fixture.josh)
.cacheRateProviders();
} else if (fixtureName === "morphoCompoundFixture") {
await hotDeployFixture(
fixture, // fixture
Expand All @@ -155,19 +157,17 @@ async function hotDeployOption(
"balancerREthStrategy", // fixtureStrategyVarName
"BalancerMetaPoolTestStrategy" // implContractName
);
} else if (fixtureName === "balancerRethWETHExposeFunctionFixture") {
await hotDeployFixture(
fixture, // fixture
"balancerREthStrategy", // fixtureStrategyVarName
"BalancerMetaPoolTestStrategy" // implContractName
);
} else if (fixtureName === "balancerSfrxETHRETHWstETHExposeFunctionFixture") {
} else if (
fixtureName === "balancerSfrxETHRETHWstETHExposeFunctionFixture"
) {
await hotDeployFixture(
fixture, // fixture
"balancerSfrxWstRETHStrategy", // fixtureStrategyVarName
"BalancerComposablePoolTestStrategy" // implContractName
);
} else if (fixtureName === "deployBalancerFrxEethRethWstEThStrategyMissConfigured") {
} else if (
fixtureName === "deployBalancerFrxEethRethWstEThStrategyMissConfigured"
) {
await hotDeployFixture(
fixture, // fixture
"balancerSfrxWstRETHStrategy", // fixtureStrategyVarName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,18 @@ describe("ForkTest: Balancer ComposableStablePool sfrxETH/wstETH/rETH Strategy",
"checkBalance()"
]();

expect(rethInVaultBefore.sub(rethInVaultAfter)).to.approxEqualTolerance(rethUnits, 0.5);
expect(rethInVaultBefore.sub(rethInVaultAfter)).to.approxEqualTolerance(
rethUnits,
0.5
);
// stETH has rounding issues
expect(stETHInVaultBefore.sub(stETHInVaultAfter)).to.approxEqualTolerance(
stethUnits,
0.01
);
expect(frxETHInVaultBefore.sub(frxETHInVaultAfter)).to.approxEqualTolerance(frxethUnits, 0.5);
expect(
frxETHInVaultBefore.sub(frxETHInVaultAfter)
).to.approxEqualTolerance(frxethUnits, 0.5);
expect(
strategyValueAfter.sub(strategyValueBefore)
).to.approxEqualTolerance(
Expand Down