Skip to content

Commit acade8a

Browse files
sparrowDomnaddison36shahthepro
authored
deploy 77 - reDeploy rETH/WETH strategy (#1843)
* initail commit * intermediary commit * commit research files * balancer booster abi * intermittent commit * add base balancer contract that implements checkBalance functionality * add some additional initial integration * intermittent commit * add deployment file * add fork test fixture * intermittent commit * prettier * add basic withdrawal / deposit functionality * correct the BPT calculation * prettier + lint * simplify the BPT price calculation * add read-only re-entrancy protection * add some missing tests and adjust existing. Deparate deposit and withdrawal slippage * fix check balance implementation * Balancer review changes (#1726) * Generated contract docs * Refactor Balancer storage variables * Small Balancer changes * Natspec updates Added missing licensing getPoolAssets gas optimized * Updated generated Balancer strategy contract diagrams * fix contract linter * Removed restrictions on tests * Small gas improvements Fixed Slither * Change BalancerError version * Updated constant names Addresses to use checksum format * JS lint tasks * Updated Balancer and Aura pool id constants * Removed getRateProviderRate as it wasn't being used Refactored to remove poolAssetsMapped storage variable * Updated OETH Contracts diagrams Generated new Balancer contract diagrams * Fix failing test * Fix merge conflict * Restored getRateProviderRate * Natspec updates Added toPoolAsset override * Removed unused getRateProviderRate * Natspec updates Gas optimization of InitializableAbstractStrategy * Abstract strategy gas improvements (#1719) * Refactor base strategy to use immutables * Fixed strategy deployments in 001_core and fixtures * Generated new strategy diagrams * Deploy rETH instead of the stETH Balancer MetaStable Pool * removed unused Aura config * Balancer fork tests * Added check that BPT amount equals Aura LP amount Added rETH conversion to ETH value * Updated balancer strat fork tests * Updated Balancer fork tests * Added optional deposit with multiple assets to the strategy * Single asset deposit to use multi asset deposit * Added optional checkBalance to Balancer strategy * Added checkBalance() to BaseBalancerStrategy * Fix slither Fix curve HH task * Added multi-asset withdraw to balancer strategy * Fix multi-asset withdraw * Updated Balancer and Vault diagrams * Fix js linter * Fixed checkBalance of rETH asset in Balancer strategy * Only wrap assets if amount > 0 Added depositAll fork test for Balancer strat * Removed Vault changes for multi-asset strategy support * Updated generated docs * Add tests for wstETH/WETH Balancer pool (#1725) * Split deployment and fix fixtures * Deposit tests for wstETH/WETH pool * Add withdraw test * prettier * remove .only in fork tests --------- Co-authored-by: Shahul Hameed <[email protected]> * [ DFD-1 ] Balancer's checkBalance (#1730) * add alternative implementation of Balancer's checkBalance * correct the checkBalance implementation * Balancer fork tests (#1727) * Added large withdraw tests for Balancer strategy * fix test log * Balancer withdraw to handle close to BPT limit * Small change to Balancer withdraw fork test * add some comments * change implementation --------- Co-authored-by: Domen Grabec <[email protected]> * Add read-only reentrancy test (#1731) * Added large withdraw tests for Balancer strategy * fix test log * Balancer withdraw to handle close to BPT limit * Small change to Balancer withdraw fork test * add some comments * Add test for read-only reentrancy * add reentrancy protection to checkBalance functions * add documentation * remove the only --------- Co-authored-by: Nicholas Addison <[email protected]> Co-authored-by: Domen Grabec <[email protected]> * Balancer fixes (#1734) * prettier * adjust how checkBalance is calculated * Balancer withdrawal fix (#1739) * fix balancer withdrawals * lint * prettier * use only 1 safeApprove when applicable * some renames and more correct application of approves * renames, additional requires, move initializer to a better location, slither * bug fix * Generated latest Balancer strategy diagrams * re-deploy BPT tokens sitting in the strategy * fix re-entrancy test * fixture fix * bug fix * prettier * L02 improve naming (#1783) * improve naming * one more rename * buf fix * do a check that supported assets are being withdrawn (#1784) * set uint256 max instead of magic number (#1782) * remove unused files (#1785) * fix renaming bug * correct safe approve all tokens and adjust the documentation (#1776) * prettier * M04 - minBptFunction robustness (#1795) * change bptExpected to ignore Oracle prices and assume assets are always pegged. (Vault value checker shall be used to mitigate issues with said assumption) * fix all the tests * add test for pool manipulation * prettier & lint * minor change * add withdrawal test * update documentation * pick string error length that is smaller than 32 characters * prettier * correct comment * better comments * prettier * M02 withdrawal fuzzing tests (#1801) * add more withdrawal tests * add more withdrawal cases * N02 gas inefficiencies (#1786) * gas optimisation * fix bad merge and prettier * remove todo comments (#1796) * use a more appropriate array initialisation length (#1800) * more consistant function naming (#1797) * fix typo (#1798) * simplify the way we withdrawAll. no need to pass along min amonts (#1777) * M03 - missing or misleading documentation (#1781) * improve documentation * add comma * M01 More comprehensive test suite (#1780) * add tests for approving tokens and harvesting rewards * prettier and lint * fix bad merge + prettier & lint * fix fork tests remove .only * remove only * lint * fix unit tests * add more tests to see how checkBalance behaves * remove console log * improve checkBalance test by testing that checkBalance amount doesn't decrease after the attack comaring to the middle of the attack. * confirm that yield gained by 3rd party tilting the pool can be extracted by withdrawing the funds * rename internal functions by prepending them with underscore * Generated latest Balancer strategy diagrams (#1805) * bug fix * bug fix * Minor Balancer changes from final review (#1819) * Removed unused imports * Generated updated contract diagram * Deploy Balancer Meta stable pool RETH strategy * update deploy description * fix typo * add proposal Id to deploy script * prettier * create a deploy file * file rename * improve wording * fix name redundancy --------- Co-authored-by: Nick Addison <[email protected]> Co-authored-by: Shahul Hameed <[email protected]>
1 parent 8f473d4 commit acade8a

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
const { deploymentWithGovernanceProposal } = require("../utils/deploy");
2+
const addresses = require("../utils/addresses");
3+
const { balancer_rETH_WETH_PID } = require("../utils/constants");
4+
5+
const platformAddress = addresses.mainnet.rETH_WETH_BPT;
6+
7+
module.exports = deploymentWithGovernanceProposal(
8+
{
9+
deployName: "077_balancer_rETH_WETH",
10+
forceDeploy: false,
11+
//forceSkip: true,
12+
deployerIsProposer: false,
13+
//proposalId: ,
14+
},
15+
async ({ deployWithConfirmation, ethers }) => {
16+
// Current contracts
17+
const cOETHVaultProxy = await ethers.getContract("OETHVaultProxy");
18+
19+
// Deployer Actions
20+
// ----------------
21+
const cOETHBalancerMetaPoolStrategyProxy = await ethers.getContract(
22+
"OETHBalancerMetaPoolrEthStrategyProxy"
23+
);
24+
25+
// 1. Deploy new Balancer strategy implementation
26+
const dOETHBalancerMetaPoolStrategyImpl = await deployWithConfirmation(
27+
"BalancerMetaPoolStrategy",
28+
[
29+
[platformAddress, cOETHVaultProxy.address],
30+
[
31+
addresses.mainnet.rETH,
32+
addresses.mainnet.stETH,
33+
addresses.mainnet.wstETH,
34+
addresses.mainnet.frxETH,
35+
addresses.mainnet.sfrxETH,
36+
addresses.mainnet.balancerVault, // Address of the Balancer vault
37+
balancer_rETH_WETH_PID, // Pool ID of the Balancer pool
38+
],
39+
addresses.mainnet.rETH_WETH_AuraRewards, // Address of the Aura rewards contract
40+
]
41+
);
42+
43+
console.log(
44+
"Balancer strategy address:",
45+
cOETHBalancerMetaPoolStrategyProxy.address
46+
);
47+
48+
// Governance Actions
49+
// ----------------
50+
return {
51+
name: "Deploy new implementation of Balancer rETH/WETH MetaPool strategy\n\
52+
\n\
53+
The new implementation of the Balancer rETH/WETH strategy pool fixes a medium vulnerability of the strategy's checkBalance function.\n\
54+
\n\
55+
",
56+
actions: [
57+
// 1. Upgrade strategy implementation
58+
{
59+
contract: cOETHBalancerMetaPoolStrategyProxy,
60+
signature: "upgradeTo(address)",
61+
args: [dOETHBalancerMetaPoolStrategyImpl.address],
62+
},
63+
],
64+
};
65+
}
66+
);

contracts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"slither": "yarn run clean && slither . --filter-paths \"crytic|mocks|openzeppelin|@openzeppelin\" --exclude-low --exclude-informational --exclude conformance-to-solidity-naming-conventions,different-pragma-directives-are-used,external-function,assembly,incorrect-equality",
3232
"slither:triage": "yarn run clean && slither . --triage --filter-paths \"crytic|mocks|openzeppelin|@openzeppelin\" --exclude-low --exclude-informational --exclude conformance-to-solidity-naming-conventions,different-pragma-directives-are-used,external-function,assembly,incorrect-equality",
3333
"clean": "rm -rf build crytic-export artifacts cache deployments/local*",
34-
"cache-clean:light": "rm -rf cache/hardhat-network-fork/network-1337/*",
34+
"cache-clean:light": "rm -rf cache/hardhat-network-fork/network-1337/",
3535
"test:coverage": "IS_TEST=true npx hardhat coverage",
3636
"test:coverage:fork": "REPORT_COVERAGE=true ./fork-test.sh"
3737
},

0 commit comments

Comments
 (0)