diff --git a/contracts/Erc20VaultPoolSwap.sol b/contracts/Erc20VaultPoolSwap.sol index a48475dd..a192878c 100644 --- a/contracts/Erc20VaultPoolSwap.sol +++ b/contracts/Erc20VaultPoolSwap.sol @@ -78,43 +78,23 @@ contract Erc20VaultPoolSwap is ProgressiveFee, IErc20VaultPoolSwap { function setVaultConfigs( address[] memory _tokens, - address[] memory _depositors, - uint8[] memory _depositorTypes, - uint8[] memory _depositorAmountLength, - uint8[] memory _depositorIndexes, - address[] memory _lpTokens, - address[] memory _curvePoolRegistries + VaultConfig[] memory _vaultConfigs ) external onlyOwner { uint256 len = _tokens.length; - require( - len == _depositors.length && - len == _depositorAmountLength.length && - len == _depositorIndexes.length && - len == _depositorTypes.length && - len == _lpTokens.length && - len == _curvePoolRegistries.length, - "L" - ); + require(len == _vaultConfigs.length, "L"); for (uint256 i = 0; i < len; i++) { - vaultConfig[_tokens[i]] = VaultConfig( - _depositorAmountLength[i], - _depositorIndexes[i], - _depositorTypes[i], - _depositors[i], - _lpTokens[i], - _curvePoolRegistries[i] - ); + vaultConfig[_tokens[i]] = _vaultConfigs[i]; - usdc.approve(_depositors[i], uint256(-1)); - IERC20(_lpTokens[i]).approve(_tokens[i], uint256(-1)); - IERC20(_lpTokens[i]).approve(_depositors[i], uint256(-1)); + usdc.approve(_vaultConfigs[i].depositor, uint256(-1)); + IERC20(_vaultConfigs[i].lpToken).approve(_tokens[i], uint256(-1)); + IERC20(_vaultConfigs[i].lpToken).approve(_vaultConfigs[i].depositor, uint256(-1)); emit SetVaultConfig( _tokens[i], - _depositors[i], - _depositorAmountLength[i], - _depositorIndexes[i], - _lpTokens[i], - _curvePoolRegistries[i] + _vaultConfigs[i].depositor, + _vaultConfigs[i].depositorLength, + _vaultConfigs[i].depositorIndex, + _vaultConfigs[i].lpToken, + _vaultConfigs[i].curvePoolRegistry ); } } diff --git a/test/Erc20VaultPoolSwap.js b/test/Erc20VaultPoolSwap.js index 537fdfa2..f55c5847 100644 --- a/test/Erc20VaultPoolSwap.js +++ b/test/Erc20VaultPoolSwap.js @@ -166,12 +166,14 @@ describe('Erc20VaultPoolSwap', () => { }); await vaultPoolSwap.setVaultConfigs( vaults.map(v => v.vault.address), - vaults.map(v => v.depositor.address), - vaults.map(v => v.config.depositorType || 1), - vaults.map(v => v.config.amountsLength), - vaults.map(v => v.config.usdcIndex), - vaults.map(v => v.lpToken.address), - vaults.map(() => vaultRegistry.address), + vaults.map(v => ({ + depositorLength: v.config.amountsLength, + depositorIndex: v.config.usdcIndex, + depositorType: v.config.depositorType || 1, + depositor: v.depositor.address, + lpToken: v.lpToken.address, + curvePoolRegistry: vaultRegistry.address, + })), ); await vaultPoolSwap.updatePools([pool.address]); diff --git a/test/IndicesSupplyRedeemZap.test.js b/test/IndicesSupplyRedeemZap.test.js index af1fa17c..a3559544 100644 --- a/test/IndicesSupplyRedeemZap.test.js +++ b/test/IndicesSupplyRedeemZap.test.js @@ -692,12 +692,14 @@ describe('IndicesSupplyRedeemZap', () => { }); await vaultPoolSwap.setVaultConfigs( vaults.map(v => v.vault.address), - vaults.map(v => v.depositor.address), - vaults.map(v => v.config.depositorType || 1), - vaults.map(v => v.config.amountsLength), - vaults.map(v => v.config.usdcIndex), - vaults.map(v => v.lpToken.address), - vaults.map(() => vaultRegistry.address), + vaults.map(v => ({ + depositorLength: v.config.amountsLength, + depositorIndex: v.config.usdcIndex, + depositorType: v.config.depositorType || 1, + depositor: v.depositor.address, + lpToken: v.lpToken.address, + curvePoolRegistry: vaultRegistry.address, + })), ); await vaultPoolSwap.updatePools([pool.address]); diff --git a/test/pvp/CVPMaker.test.js b/test/pvp/CVPMaker.test.js index 55d1b3c4..7171ecc3 100644 --- a/test/pvp/CVPMaker.test.js +++ b/test/pvp/CVPMaker.test.js @@ -1276,15 +1276,14 @@ describe('CVPMaker test', () => { await vaultSwap.setVaultConfigs( [ycrvVault.address], - [crvDepositor.address], - // depositorType - [1], - // amountsLength - [2], - // usdcIndex - [1], - [curvePoolToken.address], - [curvePoolRegistry.address] + [{ + depositorLength: 2, + depositorIndex: 1, + depositorType: 1, + depositor: crvDepositor.address, + lpToken: curvePoolToken.address, + curvePoolRegistry: curvePoolRegistry.address, + }], ); tokens.push(ycrvVault); @@ -1411,15 +1410,14 @@ describe('CVPMaker test', () => { await vaultSwap.setVaultConfigs( [ycrvVault.address], - [crvDepositor.address], - // depositorType - [1], - // amountsLength - [2], - // usdcIndex - [1], - [curvePoolToken.address], - [curvePoolRegistry.address] + [{ + depositorLength: 2, + depositorIndex: 1, + depositorType: 1, + depositor: crvDepositor.address, + lpToken: curvePoolToken.address, + curvePoolRegistry: curvePoolRegistry.address, + }], ); await usdc.transfer(crvDepositor.address, mwei(1e12));