Skip to content

Commit

Permalink
Allow passing asset managers to ComposableStablePool. fixes balancer#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sajal committed Dec 21, 2022
1 parent 6194ed5 commit af3d120
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/pool-stable/contracts/ComposableStablePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ contract ComposableStablePool is
string name;
string symbol;
IERC20[] tokens;
address[] assetManagers;
IRateProvider[] rateProviders;
uint256[] tokenRateCacheDurations;
bool[] exemptFromYieldProtocolFeeFlags;
Expand All @@ -94,7 +95,7 @@ contract ComposableStablePool is
params.name,
params.symbol,
_insertSorted(params.tokens, IERC20(this)),
new address[](params.tokens.length + 1),
params.assetManagers,
params.swapFeePercentage,
params.pauseWindowDuration,
params.bufferPeriodDuration,
Expand Down
2 changes: 2 additions & 0 deletions pkg/pool-stable/contracts/ComposableStablePoolFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ contract ComposableStablePoolFactory is IVersion, IPoolVersion, BasePoolFactory
string memory name,
string memory symbol,
IERC20[] memory tokens,
address[] memory assetManagers,
uint256 amplificationParameter,
IRateProvider[] memory rateProviders,
uint256[] memory tokenRateCacheDurations,
Expand All @@ -80,6 +81,7 @@ contract ComposableStablePoolFactory is IVersion, IPoolVersion, BasePoolFactory
name: name,
symbol: symbol,
tokens: tokens,
assetManagers: assetManagers,
rateProviders: rateProviders,
tokenRateCacheDurations: tokenRateCacheDurations,
exemptFromYieldProtocolFeeFlags: exemptFromYieldProtocolFeeFlags,
Expand Down
2 changes: 2 additions & 0 deletions pkg/pool-stable/test/ComposableStablePoolFactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ describe('ComposableStablePoolFactory', function () {
});

async function createPool(): Promise<Contract> {
let assetManagers: string[] = Array(tokens.length+1).fill('0x0000000000000000000000000000000000000000');
const receipt = await factory.create(
NAME,
SYMBOL,
tokens.addresses,
assetManagers,
AMP,
rateProviders,
Array(tokens.length).fill(PRICE_RATE_CACHE_DURATION),
Expand Down
2 changes: 2 additions & 0 deletions pvt/helpers/src/models/pools/stable/StablePoolDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default {
async _deployStandalone(params: StablePoolDeployment, vault: Vault): Promise<Contract> {
const {
tokens,
assetManagers,
rateProviders,
tokenRateCacheDurations,
exemptFromYieldProtocolFeeFlags,
Expand All @@ -49,6 +50,7 @@ export default {
name: NAME,
symbol: SYMBOL,
tokens: tokens.addresses,
assetManagers: assetManagers,
rateProviders: TypesConverter.toAddresses(rateProviders),
tokenRateCacheDurations,
exemptFromYieldProtocolFeeFlags,
Expand Down
2 changes: 2 additions & 0 deletions pvt/helpers/src/models/pools/stable/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export type PoolQueryResult = JoinQueryResult | ExitQueryResult;

export type RawStablePoolDeployment = {
tokens?: TokenList;
assetManagers?: string[];
swapFeePercentage?: BigNumberish;
amplificationParameter?: BigNumberish;
rateProviders?: Account[];
Expand All @@ -139,6 +140,7 @@ export type RawStablePoolDeployment = {

export type StablePoolDeployment = {
tokens: TokenList;
assetManagers: string[];
swapFeePercentage: BigNumberish;
amplificationParameter: BigNumberish;
rateProviders: Account[];
Expand Down
3 changes: 3 additions & 0 deletions pvt/helpers/src/models/types/TypesConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export default {
toStablePoolDeployment(params: RawStablePoolDeployment): StablePoolDeployment {
let {
tokens,
assetManagers,
rateProviders,
tokenRateCacheDurations,
exemptFromYieldProtocolFeeFlags,
Expand All @@ -152,9 +153,11 @@ export default {
if (!bufferPeriodDuration) bufferPeriodDuration = MONTH;
if (!exemptFromYieldProtocolFeeFlags) exemptFromYieldProtocolFeeFlags = Array(tokens.length).fill(false);
if (!version) version = 'test';
if (!assetManagers) assetManagers = Array(tokens.length+1).fill('0x0000000000000000000000000000000000000000');

return {
tokens,
assetManagers,
rateProviders,
tokenRateCacheDurations,
exemptFromYieldProtocolFeeFlags,
Expand Down

0 comments on commit af3d120

Please sign in to comment.